/* -*- 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 .
*/
/** * This is the same as horizontal, but rotated counter-clockwise by 90 degrees. * This means logical top is physical left, bottom is right, left is bottom, * finally right is top. Values map from logical to physical.
*/ static SwRectFnCollection aVerticalLeftToRightBottomToTop = { /*.fnGetTop =*/&SwRect::Left_, /*.fnGetBottom =*/&SwRect::Right_, /*.fnGetLeft =*/&SwRect::Bottom_, /*.fnGetRight =*/&SwRect::Top_, /*.fnGetWidth =*/&SwRect::Height_, /*.fnGetHeight =*/&SwRect::Width_, /*.fnGetPos =*/&SwRect::BottomLeft, /*.fnGetSize =*/&SwRect::SwappedSize,
/* |* The RootFrame requests an own FrameFormat from the document, which it is |* going to delete again in the dtor. The own FrameFormat is derived from |* the passed FrameFormat.
|*/
SwRootFrame::SwRootFrame( SwFrameFormat *pFormat, SwViewShell * pSh ) :
SwLayoutFrame( pFormat->GetDoc().MakeFrameFormat(
UIName(u"Root"_ustr), pFormat ), nullptr ),
mnViewWidth( -1 ),
mnColumns( 0 ),
mbBookMode( false ),
mbSidebarChanged( false ),
mbNeedGrammarCheck( false ),
mbCheckSuperfluous( false ),
mbIdleFormat( true ),
mbBrowseWidthValid( false ),
mbTurboAllowed( true ),
mbAssertFlyPages( true ),
mbTableUpdateInProgress( false ),
mbIsVirtPageNum( false ),
mbIsNewLayout( true ),
mbCallbackActionEnabled ( false ),
mbLayoutFreezed ( false ),
mbHideRedlines(pFormat->GetDoc().GetDocumentRedlineManager().IsHideRedlines()),
m_FieldmarkMode(pSh->GetViewOptions()->IsFieldName()
? sw::FieldmarkMode::ShowCommand
: sw::FieldmarkMode::ShowResult),
m_ParagraphBreakMode(sw::IsShowHiddenChars(pSh)
? sw::ParagraphBreakMode::Shown
: sw::ParagraphBreakMode::Hidden),
mnBrowseWidth(MIN_BROWSE_WIDTH),
mpTurbo( nullptr ),
mpLastPage( nullptr ),
mpCurrShell( pSh ),
mpWaitingCurrShell( nullptr ),
mpDrawPage( nullptr ),
mnPhyPageNums( 0 ),
mnAccessibleShells( 0 )
{
mnFrameType = SwFrameType::Root;
setRootFrame( this );
s_pLast = this;
}
void SwRootFrame::Init( SwFrameFormat* pFormat )
{
InitCurrShells( this );
IDocumentTimerAccess& rTimerAccess = pFormat->getIDocumentTimerAccess();
IDocumentLayoutAccess& rLayoutAccess = pFormat->getIDocumentLayoutAccess();
IDocumentFieldsAccess& rFieldsAccess = pFormat->getIDocumentFieldsAccess(); const IDocumentSettingAccess& rSettingAccess = pFormat->getIDocumentSettingAccess();
rTimerAccess.StopIdling(); // For creating the Flys by MakeFrames()
rLayoutAccess.SetCurrentViewShell( GetCurrShell() );
mbCallbackActionEnabled = false; // needs to be set to true before leaving!
// Initialize the layout: create pages, link content with Content etc. // First, initialize some stuff, then get hold of the first // node (which will be needed for the PageDesc).
// Get hold of PageDesc (either via FrameFormat of the first node or the initial one).
SwPageDesc *pDesc = nullptr;
::std::optional<sal_uInt16> oPgNum;
if ( pTableNd )
{ const SwFormatPageDesc &rDesc = pTableNd->GetTable().GetFrameFormat()->GetPageDesc();
pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc()); //#19104# respect the page number offset!!
oPgNum = rDesc.GetNumOffset(); if (oPgNum)
mbIsVirtPageNum = true;
} elseif ( pNode )
{ const SwFormatPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc()); //#19104# respect the page number offset!!
oPgNum = rDesc.GetNumOffset(); if (oPgNum)
mbIsVirtPageNum = true;
} else
mbIsVirtPageNum = false; if ( !pDesc )
pDesc = &rDoc.GetPageDesc( 0 );
// Create a page and put it in the layout // The first page is always a right-page and always a first-page
SwPageFrame* pPage = ::InsertNewPage(
*pDesc, /*pUpper=*/this, /*isRightPage=*/true, /*bFirst=*/true, /*bInsertEmpty=*/false, /*bFootnote=*/false, /*pSibling=*/nullptr, /*bVeryFirstPage=*/true);
// Find the first page in the Bodytext section.
SwLayoutFrame *pLay = pPage->FindBodyCont(); while( pLay->Lower() )
pLay = static_cast<SwLayoutFrame*>(pLay->Lower());
// tdf#156077 create all pages for at-page anchored flys now because all // these flys must be attached to some page when Init() is finished
AssertFlyPages();
if( rSettingAccess.get(DocumentSettingId::GLOBAL_DOCUMENT) )
rFieldsAccess.UpdateRefFields(); //b6433357: Update page fields after loading if ( !mpCurrShell || !mpCurrShell->Imp()->IsUpdateExpFields() )
{
rFieldsAccess.UpdatePageFields(pPage->getFrameArea().Top());
}
// Some accessible shells are left => problems on second SwFrame::Destroy call
assert(0 == mnAccessibleShells);
// fdo#39510 crash on document close with footnotes // Object ownership in writer and esp. in layout are a mess: Before the // document/layout split SwDoc and SwRootFrame were essentially one object // and magically/uncleanly worked around their common destruction by call // to SwDoc::IsInDtor() -- even from the layout. As of now destruction of // the layout proceeds forward through the frames. Since SwTextFootnote::DelFrames // also searches backwards to find the master of footnotes, they must be // considered to be owned by the SwRootFrame and also be destroyed here, // before tearing down the (now footnote free) rest of the layout.
RemoveFootnotes(nullptr, false, true);
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.