/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
Point aPos;
::tools::Rectangle aWinRect(aPos, pShell->GetActiveWindow()->GetOutputSizePixel());
aWinRect = pShell->GetActiveWindow()->PixelToLogic(aWinRect);
// make sure that the default size of the table fits on the paper and is inside the viewing area. // if zoomed in close, don't make the table bigger than the viewing window.
Size aMaxSize = pShell->getCurrentPage()->GetSize();
if (comphelper::LibreOfficeKit::isActive())
{ // aWinRect is nonsensical in the LOK case
aWinRect = ::tools::Rectangle(aPos, aMaxSize);
} else
{ if( aMaxSize.Height() > aWinRect.getOpenHeight() )
aMaxSize.setHeight( aWinRect.getOpenHeight() ); if( aMaxSize.Width() > aWinRect.getOpenWidth() )
aMaxSize.setWidth( aWinRect.getOpenWidth() );
}
rtl::Reference<sdr::table::SdrTableObj> pObj = new sdr::table::SdrTableObj(
*pShell->GetDoc(), // TTTT should be reference
aRect,
nColumns,
nRows);
pObj->NbcSetStyleSheet( pShell->GetDoc()->GetDefaultStyleSheet(), true );
apply_table_style( pObj.get(), pShell->GetDoc(), sTableStyle );
SdrPageView* pPV = pView->GetSdrPageView();
// #i123359# if an object is to be replaced/manipulated it may be that it is in text edit mode, // so to be on the safe side call SdrEndTextEdit here
SdrTextObj* pCheckForTextEdit = DynCastSdrTextObj(pPickObj);
// if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj if( pPickObj )
{
SdPage* pPage = static_cast< SdPage* >(pPickObj->getSdrPageFromSdrObject()); if(pPage && pPage->IsPresObj(pPickObj))
{
pObj->SetUserCall( pPickObj->GetUserCall() );
pPage->InsertPresObj( pObj.get(), PresObjKind::Table );
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.