/* -*- 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 .
*/
if (mpDrawLayer->IsRecording())
mpDrawLayer->AddCalcUndo( std::make_unique<SdrUndoInsertObj>( *pNewObject ) );
pOldObject = aIter.Next();
}
}
}
// make sure the data references of charts are adapted // (this must be after InsertObject!)
ScChartHelper::AdjustRangesOfChartsOnDestinationPage( rSrcDoc, *this, nSrcPos, nDestPos );
ScChartHelper::UpdateChartsOnDestinationPage(*this, nDestPos);
}
sfx2::LinkManager* pMgr = GetDocLinkManager().getLinkManager(bAutoCalc); if (pMgr)
mpDrawLayer->SetLinkManager(pMgr);
// set DrawingLayer's SfxItemPool at Calc's SfxItemPool as // secondary pool to support DrawingLayer FillStyle ranges (and similar) // in SfxItemSets using the Calc SfxItemPool. This is e.g. needed when // the PageStyle using SvxBrushItem is visualized and will be potentially // used more intense in the future if (mxPoolHelper.is() && !IsClipOrUndo()) //Using IsClipOrUndo as a proxy for SharePooledResources called
{
ScDocumentPool* pLocalPool = mxPoolHelper->GetDocPool();
if (pLocalPool)
{
OSL_ENSURE(!pLocalPool->GetSecondaryPool(), "OOps, already a secondary pool set where the DrawingLayer ItemPool is to be placed (!)");
pLocalPool->SetSecondaryPool(&mpDrawLayer->GetItemPool());
}
mpDrawLayer->CreateDefaultStyles();
}
// Drawing pages are accessed by table number, so they must also be present // for preceding table numbers, even if the tables aren't allocated // (important for clipboard documents).
SCTAB nDrawPages = 0;
SCTAB nTab; for (nTab = 0; nTab < GetTableCount(); nTab++) if (maTabs[nTab])
nDrawPages = nTab + 1; // needed number of pages
for (nTab = 0; nTab < nDrawPages && nTab < GetTableCount(); nTab++)
{
mpDrawLayer->ScAddPage( nTab ); // always add page, with or without the table if (maTabs[nTab])
{
OUString aTabName = maTabs[nTab]->GetName();
mpDrawLayer->ScRenamePage( nTab, aTabName );
maTabs[nTab]->SetDrawPageSize(false,false); // set the right size immediately
}
}
void ScDocument::UpdateDrawPrinter()
{ if (mpDrawLayer)
{ // use the printer even if IsValid is false // Application::GetDefaultDevice causes trouble with changing MapModes
mpDrawLayer->SetRefDevice(GetRefDevice());
}
}
SCTAB nTabCount = GetTableCount(); for (constauto& rTab : rMark)
{ if (rTab >= nTabCount) break; if (maTabs[rTab])
mpDrawLayer->DeleteObjectsInArea( rTab, nCol1, nRow1, nCol2, nRow2, bAnchored);
}
}
void ScDocument::DeleteObjectsInSelection( const ScMarkData& rMark )
{ if (!mpDrawLayer) return;
mpDrawLayer->DeleteObjectsInSelection( rMark );
}
bool ScDocument::HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark )
{ // pTabMark is used only for selected tables. If pTabMark is 0, all tables of rRange are used.
bool ScDocument::HasBackgroundDraw( SCTAB nTab, const tools::Rectangle& rMMRect ) const
{ // Are there objects in the background layer who are (partly) affected by rMMRect // (for Drawing optimization, no deletion in front of the background if (!mpDrawLayer) returnfalse;
SdrPage* pPage = mpDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
OSL_ENSURE(pPage,"Page ?"); if (!pPage) returnfalse;
bool ScDocument::HasAnyDraw( SCTAB nTab, const tools::Rectangle& rMMRect ) const
{ // Are there any objects at all who are (partly) affected by rMMRect? // (To detect blank pages when printing) if (!mpDrawLayer) returnfalse;
SdrPage* pPage = mpDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
OSL_ENSURE(pPage,"Page ?"); if (!pPage) returnfalse;
if (HasAttrib(ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab), HasAttrFlags::Lines)) // We want to print sheets with borders even if there is no cell content. returnfalse;
tools::Rectangle aMMRect; if ( pLastRange && pLastMM && nTab == pLastRange->aStart.Tab() &&
nStartRow == pLastRange->aStart.Row() && nEndRow == pLastRange->aEnd.Row() )
{ // keep vertical part of aMMRect, only update horizontal position
aMMRect = *pLastMM;
if ( nStartCol > 0 && !bLeftIsEmpty )
{ // similar to in ScPrintFunc::AdjustPrintArea // ExtendPrintArea starting only from the start column of the print area
// ExtendMerge() is non-const, but called without refresh. GetPrinter() // might create and assign a printer.
ScDocument* pThis = const_cast<ScDocument*>(this);
pThis->ExtendMerge( 0,nStartRow, nExtendCol,nTmpRow, nTab ); // no Refresh, incl. Attrs
OutputDevice* pDev = pThis->GetPrinter();
pDev->SetMapMode(MapMode(MapUnit::MapPixel)); // Important for GetNeededSize
ExtendPrintArea( pDev, nTab, 0, nStartRow, nExtendCol, nEndRow ); if ( nExtendCol >= nStartCol ) returnfalse;
}
returntrue;
}
void ScDocument::Clear( bool bFromDestructor )
{ for (auto& rxTab : maTabs) if (rxTab)
rxTab->GetCondFormList()->clear();
maTabs.clear();
pSelectionAttr.reset();
if (mpDrawLayer)
{
mpDrawLayer->ClearModel( bFromDestructor );
}
}
bool ScDocument::HasDetectiveObjects(SCTAB nTab) const
{ // looks for detective objects, annotations don't count // (used to adjust scale so detective objects hit their cells better)
bool bFound = false;
if (mpDrawLayer)
{
SdrPage* pPage = mpDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
OSL_ENSURE(pPage,"Page ?"); if (pPage)
{
SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
SdrObject* pObject = aIter.Next(); while (pObject && !bFound)
{ // anything on the internal layer except captions (annotations) if ( (pObject->GetLayer() == SC_LAYER_INTERN) && !ScDrawLayer::IsNoteCaption( pObject ) )
bFound = true;
pObject = aIter.Next();
}
}
}
return bFound;
}
void ScDocument::UpdateFontCharSet()
{ // In old versions (until 4.0 without SP), when switching between systems, // the Font attribute was not adjusted. // This has to be redone for Documents until SP2: // Everything that is not SYMBOL is set to system CharSet. // CharSet should be correct for new documents (version SC_FONTCHARSET)
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.