/* -*- 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 .
*/
void DrawViewShell::ModelHasChanged()
{
Invalidate(); // that the navigator also gets an up to date state
GetViewFrame()->GetBindings().Invalidate( SID_NAVIGATOR_STATE, true );
// now initialize the TextEditOutliner which was newly created by the draw engine
::Outliner* pOutliner = mpDrawView->GetTextEditOutliner(); if (pOutliner)
{
SfxStyleSheetPool* pSPool = static_cast<SfxStyleSheetPool*>( GetDocSh()->GetStyleSheetPool() );
pOutliner->SetStyleSheetPool(pSPool);
}
}
// tdf#151621 Do not set if the embedded object is opening in a new window. if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
&& GetDocSh()->IsInPlaceActive())
{
SetZoomRect(GetDocSh()->GetVisArea(ASPECT_CONTENT));
}
void DrawViewShell::ArrangeGUIElements()
{ // Retrieve the current size (thickness) of the scroll bars. That is // the width of the vertical and the height of the horizontal scroll // bar. int nScrollBarSize = GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
if ( mbZoomOnPage && !bInPlaceActive && !bClientActive )
{ // with split, always resize first window //af pWindow = mpContentWindow.get();
SfxRequest aReq(SID_SIZE_PAGE, SfxCallMode::SLOT, GetDoc()->GetItemPool());
ExecuteSlot( aReq );
}
}
/** * Apply data of the FrameView on the current view
*/ void DrawViewShell::ReadFrameViewData(FrameView* pView)
{
ModifyGuard aGuard( GetDoc() );
// this option has to be adjust at the model
GetDoc()->SetPickThroughTransparentTextFrames(
SdModule::get()->GetSdOptions(GetDoc()->GetDocumentType())->IsPickThrough());
// initialization of the Character-(Screen-) attribute if (HasRuler() != pView->HasRuler())
SetRuler( pView->HasRuler() );
if (mpDrawView->GetGridCoarse() != pView->GetGridCoarse())
mpDrawView->SetGridCoarse( pView->GetGridCoarse() );
if (mpDrawView->GetGridFine() != pView->GetGridFine())
mpDrawView->SetGridFine( pView->GetGridFine() );
if (mpDrawView->GetSnapGridWidthX() != pView->GetSnapGridWidthX() || mpDrawView->GetSnapGridWidthY() != pView->GetSnapGridWidthY())
mpDrawView->SetSnapGridWidth(pView->GetSnapGridWidthX(), pView->GetSnapGridWidthY());
if (mpDrawView->IsGridVisible() != pView->IsGridVisible())
mpDrawView->SetGridVisible( pView->IsGridVisible() );
if (mpDrawView->IsGridFront() != pView->IsGridFront())
mpDrawView->SetGridFront( pView->IsGridFront() );
if (mpDrawView->GetSnapAngle() != pView->GetSnapAngle())
mpDrawView->SetSnapAngle( pView->GetSnapAngle() );
if (mpDrawView->IsGridSnap() != pView->IsGridSnap() )
mpDrawView->SetGridSnap( pView->IsGridSnap() );
if (mpDrawView->IsBordSnap() != pView->IsBordSnap() )
mpDrawView->SetBordSnap( pView->IsBordSnap() );
if (mpDrawView->IsHlplSnap() != pView->IsHlplSnap() )
mpDrawView->SetHlplSnap( pView->IsHlplSnap() );
if (mpDrawView->IsOFrmSnap() != pView->IsOFrmSnap() )
mpDrawView->SetOFrmSnap( pView->IsOFrmSnap() );
if (mpDrawView->IsOPntSnap() != pView->IsOPntSnap() )
mpDrawView->SetOPntSnap( pView->IsOPntSnap() );
if (mpDrawView->IsOConSnap() != pView->IsOConSnap() )
mpDrawView->SetOConSnap( pView->IsOConSnap() );
if (mpDrawView->IsHlplVisible() != pView->IsHlplVisible() )
mpDrawView->SetHlplVisible( pView->IsHlplVisible() );
if (mpDrawView->IsDragStripes() != pView->IsDragStripes() )
mpDrawView->SetDragStripes( pView->IsDragStripes() );
if (mpDrawView->IsPlusHandlesAlwaysVisible() != pView->IsPlusHandlesAlwaysVisible() )
mpDrawView->SetPlusHandlesAlwaysVisible( pView->IsPlusHandlesAlwaysVisible() );
if (mpDrawView->GetSnapMagneticPixel() != pView->GetSnapMagneticPixel() )
mpDrawView->SetSnapMagneticPixel( pView->GetSnapMagneticPixel() );
if (mpDrawView->IsMarkedHitMovesAlways() != pView->IsMarkedHitMovesAlways() )
mpDrawView->SetMarkedHitMovesAlways( pView->IsMarkedHitMovesAlways() );
if (mpDrawView->IsMoveOnlyDragging() != pView->IsMoveOnlyDragging() )
mpDrawView->SetMoveOnlyDragging( pView->IsMoveOnlyDragging() );
if (mpDrawView->IsNoDragXorPolys() != pView->IsNoDragXorPolys() )
mpDrawView->SetNoDragXorPolys( pView->IsNoDragXorPolys() );
if (mpDrawView->IsCrookNoContortion() != pView->IsCrookNoContortion() )
mpDrawView->SetCrookNoContortion( pView->IsCrookNoContortion() );
if (mpDrawView->IsAngleSnapEnabled() != pView->IsAngleSnapEnabled() )
mpDrawView->SetAngleSnapEnabled( pView->IsAngleSnapEnabled() );
if (mpDrawView->IsBigOrtho() != pView->IsBigOrtho() )
mpDrawView->SetBigOrtho( pView->IsBigOrtho() );
if (mpDrawView->IsOrtho() != pView->IsOrtho() )
mpDrawView->SetOrtho( pView->IsOrtho() );
if (mpDrawView->GetEliminatePolyPointLimitAngle() != pView->GetEliminatePolyPointLimitAngle() )
mpDrawView->SetEliminatePolyPointLimitAngle( pView->GetEliminatePolyPointLimitAngle() );
if (mpDrawView->IsEliminatePolyPoints() != pView->IsEliminatePolyPoints() )
mpDrawView->SetEliminatePolyPoints( pView->IsEliminatePolyPoints() );
if (mpDrawView->IsSolidDragging() != pView->IsSolidDragging() )
mpDrawView->SetSolidDragging( pView->IsSolidDragging() );
if (mpDrawView->IsQuickTextEditMode() != pView->IsQuickEdit())
mpDrawView->SetQuickTextEditMode( pView->IsQuickEdit() );
// #i26631# if (mpDrawView->IsMasterPagePaintCaching() != pView->IsMasterPagePaintCaching())
mpDrawView->SetMasterPagePaintCaching( pView->IsMasterPagePaintCaching() );
if (mpDrawView->GetDragThresholdPixels() != pView->GetDragThresholdPixels())
mpDrawView->SetDragThresholdPixels( pView->GetDragThresholdPixels() );
if(IsLayerModeActive() && bNewLayerMode)
{ // #i57936# Force mbIsLayerModeActive to false so that ChangeEditMode // below does something regarding LayerTabBar content refresh. That refresh // is only done when IsLayerModeActive changes. It needs to be done // since e.g. Layer visibility was changed above and this may need // a refresh to show the correct graphical representation
mbIsLayerModeActive = false;
}
// has to be called in the end, because it executes a WriteFrameViewData() if (mpDrawView->IsFrameDragSingles() != pView->IsFrameDragSingles() )
mpDrawView->SetFrameDragSingles( pView->IsFrameDragSingles() );
}
Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
::tools::Rectangle aVisArea = GetActiveWindow()->PixelToLogic( ::tools::Rectangle( Point(0,0), aVisSizePixel) ); if (comphelper::LibreOfficeKit::isActive())
{ // aVisArea is nonsensical in the LOK case, use the slide size
aVisArea = ::tools::Rectangle(Point(), getCurrentPage()->GetSize());
}
/** * The event is forwarded to the Viewshell and the current function by the * window pWin. * * Remark: pWin==NULL, if Paint() is called from ShowWindow!
*/ void DrawViewShell::Paint(const ::tools::Rectangle& rRect, ::sd::Window* pWin)
{ /* This is done before each text edit, so why not do it before every paint. The default language is only used if the outliner only contains one
character in a symbol font */
GetDoc()->GetDrawOutliner().SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
// Set Application Background color for usage in SdrPaintView(s)
mpDrawView->SetApplicationBackgroundColor( GetViewOptions().mnAppBackgroundColor );
/* This is done before each text edit, so why not do it before every paint. The default language is only used if the outliner only contains one
character in a symbol font */
GetDoc()->GetDrawOutliner().SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
for (const css::beans::PropertyValue& rValue : rSequence)
{ if ( rValue.Name == sUNO_View_ZoomOnPage )
{ bool bZoomPage = false; if( rValue.Value >>= bZoomPage )
{
mbZoomOnPage = bZoomPage;
}
} // Fallback to common SdrModel processing else GetDocSh()->GetDoc()->ReadUserDataSequenceValue(&rValue);
}
// The parameter rSequence contains the config-items from // <config:config-item-set config:name="ooo:view-settings">. Determine, whether // they contain "VisibleLayers", "PrintableLayers" and "LockedLayers". If not, it // is a foreign document or a new document after transition period and the corresponding // information were read from <draw:layer-set>. In that case we need to bring // the information from model to view. bool bHasVisiPrnLockSettings(false); for ( auto & rPropertyValue : rSequence )
{ if ( rPropertyValue.Name == sUNO_View_VisibleLayers
|| rPropertyValue.Name == sUNO_View_PrintableLayers
|| rPropertyValue.Name == sUNO_View_LockedLayers )
{
bHasVisiPrnLockSettings = true; break;
}
} if ( !bHasVisiPrnLockSettings )
{ const SdrLayerAdmin& rLayerAdmin = GetDocSh()->GetDoc()->GetLayerAdmin();
SdrLayerIDSet aSdrLayerIDSet;
rLayerAdmin.getVisibleLayersODF( aSdrLayerIDSet );
mpFrameView -> SetVisibleLayers( aSdrLayerIDSet );
rLayerAdmin.getPrintableLayersODF( aSdrLayerIDSet );
mpFrameView -> SetPrintableLayers( aSdrLayerIDSet );
rLayerAdmin.getLockedLayersODF( aSdrLayerIDSet );
mpFrameView -> SetLockedLayers( aSdrLayerIDSet );
} else
{ // tdf#129898 repair layer "DrawnInSlideshow", which was wrongly written // in LO 6.2 to 6.4. The ODF defaults were corrected when reading draw:layer-set, but // not in reading config settings, because there the name is not known. const SdrLayerAdmin& rLayerAdmin = GetDocSh()->GetDoc()->GetLayerAdmin(); if (rLayerAdmin.GetLayer(u"DrawnInSlideshow"_ustr))
{
SdrLayerIDSet aSdrLayerIDSet;
rLayerAdmin.getVisibleLayersODF( aSdrLayerIDSet );
mpFrameView -> SetVisibleLayers( aSdrLayerIDSet );
rLayerAdmin.getPrintableLayersODF( aSdrLayerIDSet );
mpFrameView -> SetPrintableLayers( aSdrLayerIDSet );
rLayerAdmin.getLockedLayersODF( aSdrLayerIDSet );
mpFrameView -> SetLockedLayers( aSdrLayerIDSet );
}
}
// tdf#151621 Do not set if the embedded object is opening in a new window. if (GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED
&& GetDocSh()->IsInPlaceActive())
{
GetDocSh()->SetVisArea(aVisArea);
}
VisAreaChanged(aVisArea);
::sd::View* pView = GetView();
if (pView)
{
pView->VisAreaChanged(GetActiveWindow()->GetOutDev());
}
/** If there is a valid controller then create a new instance of <type>AccessibleDrawDocumentView</type>. Otherwise return an empty reference.
*/
css::uno::Reference<css::accessibility::XAccessible>
DrawViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
{ if (GetViewShellBase().GetController() != nullptr)
{
rtl::Reference<accessibility::AccessibleDrawDocumentView> pDocumentView = new accessibility::AccessibleDrawDocumentView (
pWindow, this,
GetViewShellBase().GetController(),
pWindow->GetAccessibleParent());
pDocumentView->Init(); return pDocumentView;
}
SAL_WARN("sd", "DrawViewShell::CreateAccessibleDocumentView: no controller"); return css::uno::Reference< css::accessibility::XAccessible>();
}
// Ignore invalid indices silently. if (nIndex>=0 && nIndex<pBar->GetPageCount())
{ // Tell the draw view and the tab control of the new active layer.
mpDrawView->SetActiveLayer (pBar->GetLayerName (pBar->GetPageId (static_cast<sal_uInt16>(nIndex))));
pBar->SetCurPageId (pBar->GetPageId (static_cast<sal_uInt16>(nIndex)));
rtl::Reference<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView (
*this,
*GetView()));
rtl::Reference<SdLayer> xLayer = pUnoDrawView->getActiveLayer();
GetViewShellBase().GetDrawController()->fireChangeLayer( xLayer );
}
}
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.