/* -*- 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 .
*/
ConfigureAppBackgroundColor();
SdModule* mod = SdModule::get();
mod->GetColorConfig().AddListener(this);
if (comphelper::LibreOfficeKit::isActive())
{ // get the full page size in pixels
mpContentWindow->EnableMapMode();
Size aSize(mpContentWindow->LogicToPixel(GetView()->GetSdrPageView()->GetPage()->GetSize())); // Disable map mode, so that it's possible to send mouse event // coordinates in logic units
mpContentWindow->EnableMapMode(false);
// arrange UI elements again with new view size
GetParentWindow()->SetSizePixel(aSize);
Resize();
if ( mxClipEvtLstnr.is() )
{
mxClipEvtLstnr->RemoveListener( GetActiveWindow() );
mxClipEvtLstnr->ClearCallbackLink(); // prevent callback if another thread is waiting
mxClipEvtLstnr.clear();
}
mpDrawView.reset(); // Set mpView to NULL so that the destructor of the ViewShell base class // does not access it.
mpView = nullptr;
/** * common part of both constructors
*/ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind)
{
mpActualPage = nullptr;
mbReadOnly = GetDocSh()->IsReadOnly();
mxClipEvtLstnr.clear();
mbPastePossible = false;
mbIsLayerModeActive = false;
mpFrameView->Connect();
OSL_ASSERT (GetViewShell()!=nullptr);
SetPool( &GetDoc()->GetPool() );
GetDoc()->CreateFirstPages();
mpDrawView.reset( new DrawView(pDocSh, GetActiveWindow()->GetOutDev(), this) );
mpView = mpDrawView.get(); // Pointer of base class ViewShell
mpDrawView->SetSwapAsynchron(); // Asynchronous load of graphics
// We do not read the page kind from the frame view anymore so we have // to set it in order to resync frame view and this view.
mpFrameView->SetPageKind(eInitialPageKind);
mePageKind = eInitialPageKind;
meEditMode = EditMode::Page;
DocumentType eDocType = GetDoc()->GetDocumentType(); // RTTI does not work here switch (mePageKind)
{ case PageKind::Standard:
meShellType = ST_IMPRESS; break;
case PageKind::Notes:
meShellType = ST_NOTES; break;
case PageKind::Handout:
meShellType = ST_HANDOUT; break;
}
/* In order to set the correct EditMode of the FrameView, we select another
one (small trick). */ if (mpFrameView->GetViewShEditMode(/*mePageKind*/) == EditMode::Page)
{
meEditMode = EditMode::MasterPage;
} else
{
meEditMode = EditMode::Page;
}
// Use configuration of FrameView
ReadFrameViewData(mpFrameView);
// AutoLayouts have to be created
GetDoc()->StopWorkStartupDelay();
} elseif (mePageKind == PageKind::Handout)
{
GetActiveWindow()->SetHelpId( CMD_SID_HANDOUT_MASTER_MODE );
// AutoLayouts have to be created
GetDoc()->StopWorkStartupDelay();
} else
{
GetActiveWindow()->SetHelpId( HID_SDDRAWVIEWSHELL );
}
}
// start selection function
SfxRequest aReq(SID_OBJECT_SELECT, SfxCallMode::SLOT, GetDoc()->GetItemPool());
FuPermanent(aReq);
mpDrawView->SetFrameDragSingles();
mxScannerListener = new ScannerEventListener( this );
} catch (DeploymentException const &)
{
SAL_INFO("sd", "Scanner manager not available");
} catch (Exception const &)
{ // Eat the exception and log it // We can still continue if scanner manager is not available.
DBG_UNHANDLED_EXCEPTION("sd");
}
mpAnnotationManager.reset( new AnnotationManager( GetViewShellBase() ) );
mpViewOverlayManager.reset( new ViewOverlayManager( GetViewShellBase() ) );
}
if (IsMainViewShell())
{ // Create uno sub controller for the main view shell.
xSubController.set( new SdUnoDrawView( *this, *GetView()));
}
return xSubController;
}
bool DrawViewShell::RelocateToParentWindow (vcl::Window* pParentWindow)
{ // DrawViewShells can not be relocated to a new parent window at the // moment, so return <FALSE/> except when the given parent window is the // parent window that is already in use. return pParentWindow==GetParentWindow();
}
/** * check if we have to draw a polyline
*/
/* Polylines are represented by macros as a sequence of: MoveTo (x, y) LineTo (x, y) [or BezierTo (x, y)] LineTo (x, y) : There is no end command for polylines. Therefore, we have to test all commands in the requests for LineTo (BezierTo) and we have to gather the point-parameter. The first not-LineTo leads to the creation of the polyline from the gathered points.
*/
void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
{ /* Zoom-Item Here we should propagate the corresponding value (Optimal ?, page width
or page) with the help of the ZoomItems !!! */ if( SfxItemState::DEFAULT == rSet.GetItemState( SID_ATTR_ZOOM ) )
{ if (GetDocSh()->IsUIActive()
|| (SlideShow::IsRunning(GetViewShellBase()) && !SlideShow::IsInteractiveSlideshow(&GetViewShellBase())) // IASS
|| !GetActiveWindow())
{
rSet.DisableItem( SID_ATTR_ZOOM );
} else
{
std::unique_ptr<SvxZoomItem> pZoomItem;
sal_uInt16 nZoom = static_cast<sal_uInt16>(GetActiveWindow()->GetZoom());
// Show the position of the selected shape(s)
Point aShapePosition (aRect.TopLeft());
aShapePosition.setX( ::tools::Long(aShapePosition.X() / aUIScale) );
aShapePosition.setY( ::tools::Long(aShapePosition.Y() / aUIScale) );
rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition));
// If in layer mode additionally show the layer that contains all // selected shapes of the page. If the shapes are distributed on // more than one layer, no layer name is shown. if (IsLayerModeActive())
{
SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
SdrLayerID nLayer(0), nOldLayer(0);
SdrObject* pObj = nullptr; const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); const size_t nMarkCount = rMarkList.GetMarkCount(); bool bOneLayer = true;
// Use the first ten selected shapes as a (hopefully // representative) sample of all shapes of the current page. // Detect whether they belong to the same layer. for( size_t j = 0; j < nMarkCount && bOneLayer && j < 10; ++j )
{
pObj = rMarkList.GetMark( j )->GetMarkedSdrObj(); if( pObj )
{
nLayer = pObj->GetLayer();
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.