/* -*- 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 .
*/
// We play it safe: Remove old font information whenever the printer // resolution or the zoom factor changes. For that, Init() and Reformat() // are the most secure places.
pFntCache->Flush( );
// ViewOptions are created dynamically
if( !mpOpt )
{
mpOpt.reset(new SwViewOption);
// ApplyViewOptions() does not need to be called if( pNewOpt )
{
*mpOpt = *pNewOpt; // Zoom factor needs to be set because there is no call to ApplyViewOptions() during // CTOR for performance reasons. if( GetWin() && 100 != mpOpt->GetZoom() )
{
MapMode aMode( mpWin->GetMapMode() ); const Fraction aNewFactor( mpOpt->GetZoom(), 100 );
aMode.SetScaleX( aNewFactor );
aMode.SetScaleY( aNewFactor );
mpWin->SetMapMode( aMode );
}
}
}
SwDocShell* pDShell = mxDoc->GetDocShell();
mxDoc->GetDocumentSettingManager().set(DocumentSettingId::HTML_MODE, 0 != ::GetHtmlMode( pDShell ) ); // set readonly flag at ViewOptions before creating layout. Otherwise, // one would have to reformat again.
if (mpOut && (OUTDEV_PDF == mpOut->GetOutDevType()))
pPDFOut = mpOut;
// Only setup the printer if we need one: constbool bBrowseMode = mpOpt->getBrowseMode(); if( pPDFOut )
InitPrt( pPDFOut );
// i#44963 Good occasion to check if page sizes in // page descriptions are still set to (LONG_MAX, LONG_MAX) (html import) if ( !bBrowseMode )
{
mxDoc->CheckDefaultPageFormat();
}
// Create a new layout, if there is no one available if( !mpLayout )
{ // Here's the code which disables the usage of "multiple" layouts at the moment // If the problems with controls and groups objects are solved, // this code can be removed...
SwViewShell *pCurrShell = GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); if( pCurrShell )
mpLayout = pCurrShell->mpLayout; // end of "disable multiple layouts" if( !mpLayout )
{ // switched to two step construction because creating the layout in SwRootFrame needs a valid pLayout set
mpLayout = SwRootFramePtr(new SwRootFrame(mxDoc->GetDfltFrameFormat(), this),
&SwFrame::DestroyFrame);
mpLayout->Init( mxDoc->GetDfltFrameFormat() );
}
}
SizeChgNotify();
// i#38810 Do not reset modified state of document, // if it's already been modified. constbool bIsDocModified( mxDoc->getIDocumentState().IsModified() );
OutputDevice* pOrigOut = mpOut;
Init( pNewOpt ); // may change the Outdev (InitPrt())
mpOut = pOrigOut;
// initialize print preview layout after layout // is created in <SwViewShell::Init(..)> - called above. if ( mbPreview )
{ // init page preview layout
mpImp->InitPagePreviewLayout();
}
// In Init a standard FrameFormat is created. if ( !mxDoc->GetIDocumentUndoRedo().IsUndoNoResetModified()
&& !bIsDocModified )
{
mxDoc->getIDocumentState().ResetModified();
}
// extend format cache. if ( SwTextFrame::GetTextCache()->GetCurMax() < 2550 )
SwTextFrame::GetTextCache()->IncreaseMax( 100 ); if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess().GetDrawModel() )
Imp()->MakeDrawView();
mbInConstructor = false;
}
/// CTor for further Shells on a document.
SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow,
OutputDevice * pOutput, tools::Longconst nFlags)
: Ring( &rShell ) ,
maBrowseBorder( rShell.maBrowseBorder ),
mpSfxViewShell( nullptr ),
mpImp( new SwViewShellImp( *this ) ),
mpWin( pWindow ),
mpOut( pOutput ? pOutput
: pWindow ? pWindow->GetOutDev()
: static_cast<OutputDevice*>(rShell.GetDoc()->getIDocumentDeviceAccess().getPrinter( true ))),
mpAccOptions( new SwAccessibilityOptions ),
mbShowHeaderSeparator( false ),
mbShowFooterSeparator( false ),
mbHeaderFooterEdit( false ),
mpTargetPaintWindow(nullptr),
mpBufferedOut(nullptr),
mxDoc( rShell.GetDoc() ),
mnStartAction( 0 ),
mnLockPaint( 0 ),
mbSelectAll(false),
mbOutputToWindow(false),
mpPrePostOutDev(nullptr)
{ // in order to suppress event handling in // <SwDrawContact::Changed> during construction of <SwViewShell> instance
mbInConstructor = true;
// In Init a standard FrameFormat is created. if( !bModified && !mxDoc->GetIDocumentUndoRedo().IsUndoNoResetModified() )
{
mxDoc->getIDocumentState().ResetModified();
}
// extend format cache. if ( SwTextFrame::GetTextCache()->GetCurMax() < 2550 )
SwTextFrame::GetTextCache()->IncreaseMax( 100 ); if( mpOpt->IsGridVisible() || getIDocumentDrawModelAccess().GetDrawModel() )
Imp()->MakeDrawView();
// i#9684 Stopping the animated graphics is not // necessary during printing or pdf export, because the animation // has not been started in this case. if( mxDoc && GetWin() )
{
SwNodes& rNds = mxDoc->GetNodes();
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.