LibreOffice Module sd (master) 1
drviewsa.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <DrawViewShell.hxx>
21#include <com/sun/star/scanner/ScannerManager.hpp>
24#include <editeng/sizeitem.hxx>
25#include <svx/svdlayer.hxx>
26#include <svx/svdograf.hxx>
27#include <sfx2/zoomitem.hxx>
28#include <svx/svdpagv.hxx>
29#include <svl/ptitem.hxx>
30#include <svl/stritem.hxx>
31#include <sfx2/request.hxx>
32#include <sfx2/dispatch.hxx>
34#include <svl/eitem.hxx>
35
36#include <sdcommands.h>
37#include <svx/f3dchild.hxx>
38#include <svx/clipfmtitem.hxx>
39
40#include <sfx2/viewfrm.hxx>
42#include <svx/float3d.hxx>
43#include <svx/extedit.hxx>
46#include <helpids.h>
47
49#include <app.hrc>
50#include <strings.hrc>
51#include <sdmod.hxx>
52#include <sdpage.hxx>
53#include <FrameView.hxx>
54#include <drawdoc.hxx>
55#include <sdresid.hxx>
56#include <DrawDocShell.hxx>
57#include <Window.hxx>
58#include <fupoor.hxx>
59#include <fusel.hxx>
60#include <funavig.hxx>
61#include <drawview.hxx>
62#include <SdUnoDrawView.hxx>
63#include <ViewShellBase.hxx>
64#include <slideshow.hxx>
65#include <annotationmanager.hxx>
66#include <DrawController.hxx>
68#include <LayerTabBar.hxx>
69
70#include <memory>
71
72using namespace ::com::sun::star;
73using namespace ::com::sun::star::uno;
75
76namespace sd {
77
78bool DrawViewShell::mbPipette = false;
79
80namespace {
81
82class ScannerEventListener : public ::cppu::WeakImplHelper< lang::XEventListener >
83{
84private:
85
86 DrawViewShell* mpParent;
87
88public:
89
90 explicit ScannerEventListener( DrawViewShell* pParent ) : mpParent( pParent ) {}
91
92 // XEventListener
93 virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) override;
94
95 void ParentDestroyed() { mpParent = nullptr; }
96};
97
98}
99
100void SAL_CALL ScannerEventListener::disposing( const lang::EventObject& /*rEventObject*/ )
101{
102 if( mpParent )
103 mpParent->ScannerEvent();
104}
105
106DrawViewShell::DrawViewShell( ViewShellBase& rViewShellBase, vcl::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument )
107 : ViewShell (pParentWindow, rViewShellBase)
108 , maTabControl(VclPtr<sd::TabControl>::Create(this, pParentWindow))
109 , mbIsLayerModeActive(false)
110 , mbIsInSwitchPage(false)
111 , mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
112 [this] () { return this->GetSidebarContextName(); },
113 uno::Reference<frame::XController>(rViewShellBase.GetDrawController()),
115 , mbMouseButtonDown(false)
116 , mbMouseSelecting(false)
117{
118 if (pFrameViewArgument != nullptr)
119 mpFrameView = pFrameViewArgument;
120 else
121 mpFrameView = new FrameView(GetDoc());
122 Construct(GetDocSh(), ePageKind);
123
124 mpSelectionChangeHandler->Connect();
125
126 SetContextName(GetSidebarContextName());
127
128 doShow();
129
130 ConfigureAppBackgroundColor();
131 SD_MOD()->GetColorConfig().AddListener(this);
132 maViewOptions.mnDocBackgroundColor = SD_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
133}
134
136{
138}
139
141{
142 SD_MOD()->GetColorConfig().RemoveListener(this);
143
144 mpSelectionChangeHandler->Disconnect();
145
146 mpAnnotationManager.reset();
147 mpViewOverlayManager.reset();
148
149 OSL_ASSERT (GetViewShell()!=nullptr);
150
151 if( mxScannerListener.is() )
152 static_cast< ScannerEventListener* >( mxScannerListener.get() )->ParentDestroyed();
153
154 // Remove references to items within Svx3DWin
155 // (maybe do a listening sometime in Svx3DWin)
156 sal_uInt16 nId = Svx3DChildWindow::GetChildWindowId();
157 SfxChildWindow* pWindow = GetViewFrame() ? GetViewFrame()->GetChildWindow(nId) : nullptr;
158 if(pWindow)
159 {
160 Svx3DWin* p3DWin = static_cast< Svx3DWin* > (pWindow->GetWindow());
161 if(p3DWin)
162 p3DWin->DocumentReload();
163 }
164
165 EndListening (*GetDoc());
167
168 if( SlideShow::IsRunning(*this) )
170
172
173 sal_uInt16 aPageCnt = GetDoc()->GetSdPageCount(mePageKind);
174
175 for (sal_uInt16 i = 0; i < aPageCnt; i++)
176 {
177 SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
178
179 if (pPage == mpActualPage)
180 {
181 GetDoc()->SetSelected(pPage, true);
182 }
183 else
184 {
185 GetDoc()->SetSelected(pPage, false);
186 }
187 }
188
189 if ( mxClipEvtLstnr.is() )
190 {
191 mxClipEvtLstnr->RemoveListener( GetActiveWindow() );
192 mxClipEvtLstnr->ClearCallbackLink(); // prevent callback if another thread is waiting
193 mxClipEvtLstnr.clear();
194 }
195
196 mpDrawView.reset();
197 // Set mpView to NULL so that the destructor of the ViewShell base class
198 // does not access it.
199 mpView = nullptr;
200
203}
204
208void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind)
209{
210 mpActualPage = nullptr;
212 mxClipEvtLstnr.clear();
213 mbPastePossible = false;
214 mbIsLayerModeActive = false;
215
217
218 OSL_ASSERT (GetViewShell()!=nullptr);
219
220 SetPool( &GetDoc()->GetPool() );
221
223
224 mpDrawView.reset( new DrawView(pDocSh, GetActiveWindow()->GetOutDev(), this) );
225 mpView = mpDrawView.get(); // Pointer of base class ViewShell
226 mpDrawView->SetSwapAsynchron(); // Asynchronous load of graphics
227
228 // We do not read the page kind from the frame view anymore so we have
229 // to set it in order to resync frame view and this view.
230 mpFrameView->SetPageKind(eInitialPageKind);
231 mePageKind = eInitialPageKind;
233 DocumentType eDocType = GetDoc()->GetDocumentType(); // RTTI does not work here
234 switch (mePageKind)
235 {
238 break;
239
240 case PageKind::Notes:
242 break;
243
246 break;
247 }
248
249 Size aPageSize( GetDoc()->GetSdPage(0, mePageKind)->GetSize() );
250 Point aPageOrg( aPageSize.Width(), aPageSize.Height() / 2);
251 Size aSize(aPageSize.Width() * 3, aPageSize.Height() * 2);
252 InitWindows(aPageOrg, aSize, Point(-1, -1));
253
254 Point aVisAreaPos;
255
256 if ( pDocSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
257 {
258 aVisAreaPos = pDocSh->GetVisArea(ASPECT_CONTENT).TopLeft();
259 }
260
261 mpDrawView->SetWorkArea(::tools::Rectangle(Point() - aVisAreaPos - aPageOrg, aSize));
262
263 // objects can not grow bigger than ViewSize
264 GetDoc()->SetMaxObjSize(aSize);
265
266 // Split-Handler for TabControls
267 maTabControl->SetSplitHdl( LINK( this, DrawViewShell, TabSplitHdl ) );
268
269 /* In order to set the correct EditMode of the FrameView, we select another
270 one (small trick). */
271 if (mpFrameView->GetViewShEditMode(/*mePageKind*/) == EditMode::Page)
272 {
274 }
275 else
276 {
278 }
279
280 // Use configuration of FrameView
282
283 if( eDocType == DocumentType::Draw )
284 {
286 }
287 else
288 {
290 {
292
293 // AutoLayouts have to be created
295 }
296 else if (mePageKind == PageKind::Handout)
297 {
299
300 // AutoLayouts have to be created
302 }
303 else
304 {
306 }
307 }
308
309 // start selection function
310 SfxRequest aReq(SID_OBJECT_SELECT, SfxCallMode::SLOT, GetDoc()->GetItemPool());
311 FuPermanent(aReq);
312 mpDrawView->SetFrameDragSingles();
313
314 if (pDocSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED)
315 {
316 mbZoomOnPage = false;
317 }
318 else
319 {
320 mbZoomOnPage = true;
321 }
322
323 mbIsRulerDrag = false;
324
325 SetName ("DrawViewShell");
326
327 mnLockCount = 0;
328
329 uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
330
331 try
332 {
333 mxScannerManager = scanner::ScannerManager::create( xContext );
334
335 mxScannerListener = new ScannerEventListener( this );
336 }
337 catch (Exception const &)
338 {
339 // Eat the exception and log it
340 // We can still continue if scanner manager is not available.
342 }
343
346}
347
348void DrawViewShell::Init (bool bIsMainViewShell)
349{
350 ViewShell::Init(bIsMainViewShell);
351
352 if (!IsListening(*GetDocSh()))
354}
355
357{
359
361 {
362 // Turn off effects.
363 GetDrawView()->SetAnimationMode(SdrAnimationMode::Disable);
364 }
365}
366
367css::uno::Reference<css::drawing::XDrawSubController> DrawViewShell::CreateSubController()
368{
369 css::uno::Reference<css::drawing::XDrawSubController> xSubController;
370
371 if (IsMainViewShell())
372 {
373 // Create uno sub controller for the main view shell.
374 xSubController.set( new SdUnoDrawView( *this, *GetView()));
375 }
376
377 return xSubController;
378}
379
381{
382 // DrawViewShells can not be relocated to a new parent window at the
383 // moment, so return <FALSE/> except when the given parent window is the
384 // parent window that is already in use.
385 return pParentWindow==GetParentWindow();
386}
387
392/*
393 Polylines are represented by macros as a sequence of:
394 MoveTo (x, y)
395 LineTo (x, y) [or BezierTo (x, y)]
396 LineTo (x, y)
397 :
398 There is no end command for polylines. Therefore, we have to test all
399 commands in the requests for LineTo (BezierTo) and we have to gather
400 the point-parameter. The first not-LineTo leads to the creation of the
401 polyline from the gathered points.
402*/
403
405{
406#ifdef DBG_UTIL
407 if(rReq.IsAPI())
408 {
409 if(SID_LINETO == rReq.GetSlot() || SID_BEZIERTO == rReq.GetSlot() || SID_MOVETO == rReq.GetSlot() )
410 {
411 OSL_FAIL("DrawViewShell::CheckLineTo: slots SID_LINETO, SID_BEZIERTO, SID_MOVETO no longer supported.");
412 }
413 }
414#endif
415
416 rReq.Ignore ();
417}
418
423 ::tools::Long nLeft,
424 ::tools::Long nRight,
425 ::tools::Long nUpper,
426 ::tools::Long nLower,
427 bool bSize,
428 bool bMargin,
429 bool bScaleAll)
430{
431 sal_uInt16 nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
432 sal_uInt16 i;
433
434 for (i = 0; i < nPageCnt; i++)
435 {
436 // first, handle all master pages
438
439 if( pPage )
440 {
441 if( bSize )
442 {
443 ::tools::Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
444 pPage->ScaleObjects(rSize, aBorderRect, bScaleAll);
445 pPage->SetSize(rSize);
446
447 }
448 if( bMargin )
449 {
450 pPage->SetLeftBorder(nLeft);
451 pPage->SetRightBorder(nRight);
452 pPage->SetUpperBorder(nUpper);
453 pPage->SetLowerBorder(nLower);
454 }
455
457 {
459 }
460
461 pPage->CreateTitleAndLayout();
462 }
463 }
464
465 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
466
467 for (i = 0; i < nPageCnt; i++)
468 {
469 // then, handle all pages
470 SdPage *pPage = GetDoc()->GetSdPage(i, mePageKind);
471
472 if( pPage )
473 {
474 if( bSize )
475 {
476 ::tools::Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
477 pPage->ScaleObjects(rSize, aBorderRect, bScaleAll);
478 pPage->SetSize(rSize);
479 }
480 if( bMargin )
481 {
482 pPage->SetLeftBorder(nLeft);
483 pPage->SetRightBorder(nRight);
484 pPage->SetUpperBorder(nUpper);
485 pPage->SetLowerBorder(nLower);
486 }
487
489 {
490 SdPage* pNotesPage = GetDoc()->GetSdPage(i, PageKind::Notes);
491 pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() );
492 }
493
494 pPage->SetAutoLayout( pPage->GetAutoLayout() );
495 }
496 }
497
499 {
500 SdPage* pHandoutPage = GetDoc()->GetSdPage(0, PageKind::Handout);
501 pHandoutPage->CreateTitleAndLayout(true);
502 }
503
506
507 Point aPageOrg(nWidth, nHeight / 2);
508 Size aSize( nWidth * 3, nHeight * 2);
509
510 InitWindows(aPageOrg, aSize, Point(-1, -1), true);
511
512 Point aVisAreaPos;
513
514 if ( GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
515 {
516 aVisAreaPos = GetDocSh()->GetVisArea(ASPECT_CONTENT).TopLeft();
517 }
518
519 GetView()->SetWorkArea(::tools::Rectangle(Point() - aVisAreaPos - aPageOrg, aSize));
520
522
524 GetView()->GetSdrPageView()->SetPageOrigin(aNewOrigin);
525
526 GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
527
528 // zoom onto (new) page size
529 GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE,
530 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
531}
532
534{
535 /* Zoom-Item
536 Here we should propagate the corresponding value (Optimal ?, page width
537 or page) with the help of the ZoomItems !!! */
538 if( SfxItemState::DEFAULT == rSet.GetItemState( SID_ATTR_ZOOM ) )
539 {
540 if (GetDocSh()->IsUIActive() || SlideShow::IsRunning(GetViewShellBase())
541 || !GetActiveWindow())
542 {
543 rSet.DisableItem( SID_ATTR_ZOOM );
544 }
545 else
546 {
547 std::unique_ptr<SvxZoomItem> pZoomItem;
548 sal_uInt16 nZoom = static_cast<sal_uInt16>(GetActiveWindow()->GetZoom());
549
550 if( mbZoomOnPage )
551 pZoomItem.reset(new SvxZoomItem( SvxZoomType::WHOLEPAGE, nZoom ));
552 else
553 pZoomItem.reset(new SvxZoomItem( SvxZoomType::PERCENT, nZoom ));
554
555 // constrain area
556 SvxZoomEnableFlags nZoomValues = SvxZoomEnableFlags::ALL;
557 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
558
559 if( pPageView && pPageView->GetObjList()->GetObjCount() == 0 )
560 {
561 nZoomValues &= ~SvxZoomEnableFlags::OPTIMAL;
562 }
563
564 pZoomItem->SetValueSet( nZoomValues );
565 rSet.Put( std::move(pZoomItem) );
566 }
567 }
568 if( SfxItemState::DEFAULT == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
569 {
571 if (GetDocSh()->IsUIActive() || (xSlideshow.is() && xSlideshow->isRunning()) || !GetActiveWindow() )
572 {
573 rSet.DisableItem( SID_ATTR_ZOOMSLIDER );
574 }
575 else
576 {
577 sd::Window * pActiveWindow = GetActiveWindow();
578 SvxZoomSliderItem aZoomItem( static_cast<sal_uInt16>(pActiveWindow->GetZoom()), static_cast<sal_uInt16>(pActiveWindow->GetMinZoom()), static_cast<sal_uInt16>(pActiveWindow->GetMaxZoom()) ) ;
579
580 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
581 if( pPageView )
582 {
583 Point aPagePos(0, 0);
584 Size aPageSize = pPageView->GetPage()->GetSize();
585
586 aPagePos.AdjustX(aPageSize.Width() / 2 );
587 aPageSize.setWidth( static_cast<::tools::Long>(aPageSize.Width() * 1.03) );
588
589 aPagePos.AdjustY(aPageSize.Height() / 2 );
590 aPageSize.setHeight( static_cast<::tools::Long>(aPageSize.Height() * 1.03) );
591 aPagePos.AdjustY( -(aPageSize.Height() / 2) );
592
593 aPagePos.AdjustX( -(aPageSize.Width() / 2) );
594
595 ::tools::Rectangle aFullPageZoomRect( aPagePos, aPageSize );
596 aZoomItem.AddSnappingPoint( pActiveWindow->GetZoomForRect( aFullPageZoomRect ) );
597 }
598 aZoomItem.AddSnappingPoint(100);
599 rSet.Put( aZoomItem );
600 }
601 }
602
603 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
604 if (pPageView)
605 {
607 pPageView->LogicToPagePos(aPos);
608 Fraction aUIScale(GetDoc()->GetUIScale());
609 aPos.setX( ::tools::Long(aPos.X() / aUIScale) );
610 aPos.setY( ::tools::Long(aPos.Y() / aUIScale) );
611
612 // position- and size items
613 if ( mpDrawView->IsAction() )
614 {
615 ::tools::Rectangle aRect;
616 mpDrawView->TakeActionRect( aRect );
617
618 if ( aRect.IsEmpty() )
619 rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) );
620 else
621 {
622 pPageView->LogicToPagePos(aRect);
623 aPos = aRect.TopLeft();
624 aPos.setX( ::tools::Long(aPos.X() / aUIScale) );
625 aPos.setY( ::tools::Long(aPos.Y() / aUIScale) );
626 rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) );
627 Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
628 aSize.setHeight( ::tools::Long(aSize.Height() / aUIScale) );
629 aSize.setWidth( ::tools::Long(aSize.Width() / aUIScale) );
630 rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
631 }
632 }
633 else
634 {
635 if ( mpDrawView->AreObjectsMarked() )
636 {
637 ::tools::Rectangle aRect = mpDrawView->GetAllMarkedRect();
638 pPageView->LogicToPagePos(aRect);
639
640 // Show the position of the selected shape(s)
641 Point aShapePosition (aRect.TopLeft());
642 aShapePosition.setX( ::tools::Long(aShapePosition.X() / aUIScale) );
643 aShapePosition.setY( ::tools::Long(aShapePosition.Y() / aUIScale) );
644 rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition));
645
646 Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
647 aSize.setHeight( ::tools::Long(aSize.Height() / aUIScale) );
648 aSize.setWidth( ::tools::Long(aSize.Width() / aUIScale) );
649 rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
650 }
651 else
652 {
653 rSet.Put( SfxPointItem(SID_ATTR_POSITION, aPos) );
654 rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) );
655 }
656 }
657 }
658
659 // Display of current page and layer.
660 if( SfxItemState::DEFAULT == rSet.GetItemState( SID_STATUS_PAGE ) )
661 {
662 sal_Int32 nPageCount = sal_Int32(GetDoc()->GetSdPageCount(mePageKind));
663 sal_Int32 nActivePageCount = sal_Int32(GetDoc()->GetActiveSdPageCount());
664 // Always show the slide/page number.
665 OUString aOUString;
666 if (GetDoc()->GetDocumentType() == DocumentType::Draw)
667 aOUString = (nPageCount == nActivePageCount) ? SdResId(STR_SD_PAGE_COUNT_DRAW) : SdResId(STR_SD_PAGE_COUNT_CUSTOM_DRAW);
668 else
669 aOUString = (nPageCount == nActivePageCount) ? SdResId(STR_SD_PAGE_COUNT) : SdResId(STR_SD_PAGE_COUNT_CUSTOM);
670
671 aOUString = aOUString.replaceFirst("%1", OUString::number(maTabControl->GetCurPagePos() + 1));
672 aOUString = aOUString.replaceFirst("%2", OUString::number(nPageCount));
673 if(nPageCount != nActivePageCount)
674 aOUString = aOUString.replaceFirst("%3", OUString::number(nActivePageCount));
675
676 // If in layer mode additionally show the layer that contains all
677 // selected shapes of the page. If the shapes are distributed on
678 // more than one layer, no layer name is shown.
679 if (IsLayerModeActive())
680 {
681 SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
682 SdrLayerID nLayer(0), nOldLayer(0);
683 SdrObject* pObj = nullptr;
684 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
685 const size_t nMarkCount = rMarkList.GetMarkCount();
686 bool bOneLayer = true;
687
688 // Use the first ten selected shapes as a (hopefully
689 // representative) sample of all shapes of the current page.
690 // Detect whether they belong to the same layer.
691 for( size_t j = 0; j < nMarkCount && bOneLayer && j < 10; ++j )
692 {
693 pObj = rMarkList.GetMark( j )->GetMarkedSdrObj();
694 if( pObj )
695 {
696 nLayer = pObj->GetLayer();
697
698 if( j != 0 && nLayer != nOldLayer )
699 bOneLayer = false;
700
701 nOldLayer = nLayer;
702 }
703 }
704
705 // Append the layer name to the current page number.
706 if( bOneLayer && nMarkCount )
707 {
708 SdrLayer* pLayer = rLayerAdmin.GetLayerPerID( nLayer );
709 if( pLayer )
710 {
711 aOUString += " (" + LayerTabBar::convertToLocalizedName(pLayer->GetName()) + ")";
712 }
713 }
714 }
715
716 rSet.Put (SfxStringItem (SID_STATUS_PAGE, aOUString));
717 }
718 // Layout
719 if( SfxItemState::DEFAULT == rSet.GetItemState( SID_STATUS_LAYOUT ) )
720 {
721 OUString aString = mpActualPage->GetLayoutName();
722 sal_Int32 nPos = aString.indexOf(SD_LT_SEPARATOR);
723 if (nPos != -1)
724 aString = aString.copy(0, nPos);
725 rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aString ) );
726 }
727 // Scale
728 if( SfxItemState::DEFAULT == rSet.GetItemState( SID_SCALE ) )
729 {
730 const Fraction& aUIScale = GetDoc()->GetUIScale();
731 OUString aString = OUString::number(aUIScale.GetNumerator()) +
732 ":" + OUString::number(aUIScale.GetDenominator());
733 rSet.Put( SfxStringItem( SID_SCALE, aString ) );
734 }
735}
736
738{
739 if (rHint.GetId()!=SfxHintId::ModeChanged)
740 return;
741
742 // Change to selection when turning on read-only mode.
743 if(GetDocSh()->IsReadOnly() && dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) )
744 {
745 SfxRequest aReq(SID_OBJECT_SELECT, SfxCallMode::SLOT, GetDoc()->GetItemPool());
746 FuPermanent(aReq);
747 }
748
749 // Turn on design mode when document is not read-only.
750 if (GetDocSh()->IsReadOnly() != mbReadOnly )
751 {
753
754 SfxBoolItem aItem( SID_FM_DESIGN_MODE, !mbReadOnly );
755 GetViewFrame()->GetDispatcher()->ExecuteList(SID_FM_DESIGN_MODE,
756 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aItem });
757 }
758
759}
760
762{
764 mpAnnotationManager->ExecuteAnnotation( rRequest );
765}
766
768{
770 mpAnnotationManager->GetAnnotationState( rItemSet );
771}
772
774{
776 switch (mePageKind)
777 {
780 break;
781 case PageKind::Notes:
783 break;
787 else
789 break;
790 }
791 return EnumContext::GetContextName(
793 mpDrawView->GetMarkedObjectList(),
794 eViewType));
795}
796
798{
800 Cancel();
801}
802
804{
805 SdPage* pPage = GetActualPage();
806 sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
807 sal_uInt16 totalPages = GetDoc()->GetSdPageCount(pPage->GetPageKind());
808 if (nSdPage + 1 >= totalPages)
809 rSet.DisableItem( SID_GO_TO_NEXT_PAGE );
810}
811
813{
815 Cancel();
816}
817
819{
820 SdPage* pPage = GetActualPage();
821 sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
822 if (nSdPage == 0)
823 rSet.DisableItem( SID_GO_TO_PREVIOUS_PAGE );
824}
825
826
828{
830 Cancel();
831}
832
834{
835 SdPage* pPage = GetActualPage();
836 sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
837 if (nSdPage == 0)
838 rSet.DisableItem( SID_GO_TO_FIRST_PAGE );
839}
840
842{
844 Cancel();
845}
846
848{
849 SdPage* pPage = GetActualPage();
850 sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
851 sal_uInt16 totalPages = GetDoc()->GetSdPageCount(pPage->GetPageKind());
852 if (nSdPage + 1 >= totalPages)
853 rSet.DisableItem( SID_GO_TO_LAST_PAGE );
854}
855
856
857} // end of namespace sd
858
859/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 GetNumerator() const
sal_Int32 GetDenominator() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
void CreateFirstPages(SdDrawDocument const *pRefDocument=nullptr)
if the document does not contain at least one handout, one slide and one notes page with at least one...
Definition: drawdoc2.cxx:493
sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const
Definition: drawdoc2.cxx:222
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
Definition: drawdoc2.cxx:207
void StopWorkStartupDelay()
Definition: drawdoc2.cxx:932
SdPage * GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind)
Definition: drawdoc2.cxx:217
SAL_DLLPRIVATE void SetSelected(SdPage *pPage, bool bSelect)
Definition: drawdoc2.cxx:461
SAL_DLLPRIVATE DocumentType GetDocumentType() const
Definition: drawdoc.hxx:251
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
Definition: drawdoc2.cxx:212
PageKind GetPageKind() const
Definition: sdpage.hxx:205
void CreateTitleAndLayout(bool bInit=false, bool bCreate=false)
Definition: sdpage.cxx:793
virtual void SetUpperBorder(sal_Int32 nBorder) override
Definition: sdpage.cxx:1781
void SetAutoLayout(AutoLayout eLayout, bool bInit=false, bool bCreate=false)
Definition: sdpage.cxx:1610
void ScaleObjects(const Size &rNewPageSize, const ::tools::Rectangle &rNewBorderRect, bool bScaleAllObj)
Definition: sdpage.cxx:1807
virtual OUString GetLayoutName() const override
Definition: sdpage.hxx:255
virtual void SetRightBorder(sal_Int32 nBorder) override
Definition: sdpage.cxx:1773
virtual void SetLowerBorder(sal_Int32 nBorder) override
Definition: sdpage.cxx:1789
virtual void SetLeftBorder(sal_Int32 nBorder) override
Definition: sdpage.cxx:1765
AutoLayout GetAutoLayout() const
Definition: sdpage.hxx:190
virtual void SetSize(const Size &aSize) override
Definition: sdpage.cxx:1746
void SetWorkArea(const tools::Rectangle &rRect)
SdrLayer * GetLayerPerID(SdrLayerID nID)
const OUString & GetName() const
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
SdrObject * GetMarkedSdrObj() const
void SetMaxObjSize(const Size &rSiz)
const Fraction & GetUIScale() const
const SdrLayerAdmin & GetLayerAdmin() const
size_t GetObjCount() const
virtual SdrLayerID GetLayer() const
SdrObjList * GetObjList() const
void SetPageOrigin(const Point &rOrg)
void LogicToPagePos(Point &rPnt) const
SdrPage * GetPage() const
sal_uInt16 GetPageNum() const
Size GetSize() const
sal_Int32 GetUpperBorder() const
sal_Int32 GetLeftBorder() const
SdrPageView * GetSdrPageView() const
void SetAnimationMode(const SdrAnimationMode eMode)
void Invalidate(sal_uInt16 nId)
vcl::Window * GetWindow() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
SfxHintId GetId() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void DisableItem(sal_uInt16 nWhich)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
bool IsListening(SfxBroadcaster &rBroadcaster) const
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
bool IsReadOnly() const
SfxObjectCreateMode GetCreateMode() const
sal_uInt16 GetSlot() const
void Ignore()
bool IsAPI() const
SfxItemPool & GetPool() const
SfxViewShell * GetViewShell() const
void SetPool(SfxItemPool *pNewPool)
void SetName(const OUString &rName)
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
SfxChildWindow * GetChildWindow(sal_uInt16)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
void DocumentReload()
void AddSnappingPoint(sal_Int32 nNew)
void disposeAndClear()
virtual ::tools::Rectangle GetVisArea(sal_uInt16 nAspect) const override
Definition: docshel2.cxx:120
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
static void CheckLineTo(SfxRequest &rReq)
check if we have to draw a polyline
Definition: drviewsa.cxx:404
void GetStatusBarState(SfxItemSet &rSet)
Definition: drviewsa.cxx:533
void SetupPage(Size const &rSize, ::tools::Long nLeft, ::tools::Long nRight, ::tools::Long nUpper, ::tools::Long nLower, bool bSize, bool bMargin, bool bScaleAll)
Change page parameter if SID_PAGESIZE or SID_PAGEMARGIN.
Definition: drviewsa.cxx:422
void FuPermanent(SfxRequest &rReq)
Definition: drviewse.cxx:141
virtual void Shutdown() override
This method is more or less an alias to Deactivate().
Definition: drviewsa.cxx:356
css::uno::Reference< css::scanner::XScannerManager2 > mxScannerManager
std::unique_ptr< DrawView > mpDrawView
void GetStateGoToLastPage(SfxItemSet &rSet)
Definition: drviewsa.cxx:847
bool IsLayerModeActive() const
rtl::Reference< TransferableClipboardListener > mxClipEvtLstnr
void StopSlideShow()
Stop a running slide show.
Definition: drviewse.cxx:1694
css::uno::Reference< css::lang::XEventListener > mxScannerListener
virtual bool RelocateToParentWindow(vcl::Window *pParentWindow) override
Relocation to a new parent window is not supported for DrawViewShell objects so this method always re...
Definition: drviewsa.cxx:380
virtual ~DrawViewShell() override
Definition: drviewsa.cxx:135
::std::unique_ptr< ViewOverlayManager > mpViewOverlayManager
void ExecuteAnnotation(SfxRequest const &rRequest)
Definition: drviewsa.cxx:761
DrawViewShell(ViewShellBase &rViewShellBase, vcl::Window *pParentWindow, PageKind ePageKind, FrameView *pFrameView)
Create a new stackable shell that may take some information (e.g.
Definition: drviewsa.cxx:106
void GetStateGoToPreviousPage(SfxItemSet &rSet)
Definition: drviewsa.cxx:818
void Construct(DrawDocShell *pDocSh, PageKind ePageKind)
common part of both constructors
Definition: drviewsa.cxx:208
VclPtr< TabControl > maTabControl
void ExecGoToFirstPage(SfxRequest &rReq)
Definition: drviewsa.cxx:827
void ExecGoToPreviousPage(SfxRequest &rReq)
Definition: drviewsa.cxx:812
void ExecGoToNextPage(SfxRequest &rReq)
Definition: drviewsa.cxx:797
virtual void Init(bool bIsMainViewShell) override
The Init method has to be called from the outside directly after a new object of this class has been ...
Definition: drviewsa.cxx:348
bool mbIsLayerModeActive
This flag controls whether the layer mode is active, i.e.
void GetAnnotationState(SfxItemSet &rItemSet)
Definition: drviewsa.cxx:767
virtual SdPage * GetActualPage() override
OUString const & GetSidebarContextName() const
Definition: drviewsa.cxx:773
DrawView * GetDrawView() const
void ExecGoToLastPage(SfxRequest &rReq)
Definition: drviewsa.cxx:841
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: drviewsa.cxx:737
::std::unique_ptr< AnnotationManager > mpAnnotationManager
void GetStateGoToNextPage(SfxItemSet &rSet)
Definition: drviewsa.cxx:803
virtual void ReadFrameViewData(FrameView *pView) override
Apply data of the FrameView on the current view.
Definition: drviews5.cxx:131
static bool mbPipette
virtual css::uno::Reference< css::drawing::XDrawSubController > CreateSubController() override
Return a sub controller that implements the view shell specific part of the DrawController.
Definition: drviewsa.cxx:367
void GetStateGoToFirstPage(SfxItemSet &rSet)
Definition: drviewsa.cxx:833
::rtl::Reference< svx::sidebar::SelectionChangeHandler > mpSelectionChangeHandler
Listen for selection changes and broadcast context changes for the sidebar.
Derivative of sd::View; contains also a pointer to the document.
Definition: drawview.hxx:35
View for MDIFrame.
Definition: FrameView.hxx:36
EditMode GetViewShEditMode() const
Return EditMode (Page or MasterPage) of working mode.
Definition: frmview.cxx:334
void Connect()
Definition: frmview.cxx:256
void Disconnect()
Definition: frmview.cxx:261
void SetPageKind(PageKind eKind)
Definition: FrameView.hxx:85
static rtl::Reference< FuPoor > Create(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: funavig.cxx:45
static OUString convertToLocalizedName(const OUString &rName)
Definition: LayerTabBar.cxx:69
This class implements the DrawViewShell specific part of the controller.
static bool IsRunning(ViewShellBase const &rBase)
returns true if there is a running presentation for the given ViewShellBase
Definition: slideshow.cxx:208
static rtl::Reference< SlideShow > GetSlideShow(SdDrawDocument const *pDocument)
Definition: slideshow.cxx:157
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
SD_DLLPUBLIC DrawDocShell * GetDocSh() const
Definition: viewshel.cxx:1407
bool IsMainViewShell() const
Return <TRUE> when the called view shell is the main sub shell of its ViewShellBase object,...
Definition: viewshel.cxx:1493
const rtl::Reference< FuPoor > & GetCurrentFunction() const
Definition: ViewShell.hxx:250
FrameView * mpFrameView
Definition: ViewShell.hxx:453
SdDrawDocument * GetDoc() const
Definition: viewshel.cxx:1412
virtual void Shutdown()
This method is more or less an alias to Deactivate().
Definition: viewshel.cxx:386
virtual void UpdateScrollBars()
Set internal values of all scroll bars that determine thumb size and position.
Definition: viewshe2.cxx:71
void DisposeFunctions()
must be called in the beginning of each subclass d'tor.
Definition: viewshel.cxx:1475
ShellType meShellType
The type of the shell. Returned by GetShellType().
Definition: ViewShell.hxx:483
virtual void Init(bool bIsMainViewShell)
The Init method has to be called from the outside directly after a new object of this class has been ...
Definition: viewshel.cxx:261
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
Definition: ViewShell.hxx:155
::sd::View * GetView() const
Definition: ViewShell.hxx:144
vcl::Window * GetParentWindow() const
Return the window that is the parent of all controls of this view shell.
Definition: ViewShell.hxx:140
void InitWindows(const Point &rViewOrigin, const Size &rViewSize, const Point &rWinPos, bool bUpdate=false)
Initialize imaging parameters for all split windows.
Definition: viewshe2.cxx:403
::sd::View * mpView
Definition: ViewShell.hxx:452
void SetCurrentFunction(const rtl::Reference< FuPoor > &xFunction)
Definition: viewshel.cxx:1422
void Cancel()
this method deactivates the current function.
Definition: viewshel.cxx:1442
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
Definition: viewshel.cxx:1397
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
::tools::Long GetMaxZoom() const
Definition: Window.hxx:106
::tools::Long GetMinZoom() const
Definition: Window.hxx:104
::tools::Long GetZoomForRect(const ::tools::Rectangle &rZoomRect)
Definition: sdwindow.cxx:388
::tools::Long GetZoom() const
Definition: sdwindow.cxx:183
static vcl::EnumContext::Context GetContextForSelection_SD(const SdrMarkList &rMarkList, const ViewType eViewType)
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr tools::Long Right() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
Point PixelToLogic(const Point &rDevicePt) const
void SetHelpId(const OUString &)
#define suppress_fun_call_w_exception(expr)
#define DBG_UNHANDLED_EXCEPTION(...)
RegionData_Impl * mpParent
constexpr OUStringLiteral IsReadOnly(u"IsReadOnly")
constexpr OUStringLiteral SD_LT_SEPARATOR
Definition: glob.hxx:49
constexpr OUStringLiteral HID_SDDRAWVIEWSHELL
Definition: helpids.h:24
constexpr OUStringLiteral HID_SDGRAPHICVIEWSHELL
Definition: helpids.h:25
sal_uInt16 nPos
@ Exception
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
DocumentType
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
#define ASPECT_CONTENT
sal_Int16 nId
PageKind
Definition: pres.hxx:45
constexpr OUStringLiteral CMD_SID_HANDOUT_MASTER_MODE
Definition: sdcommands.h:23
constexpr OUStringLiteral CMD_SID_NOTES_MODE
Definition: sdcommands.h:24
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
#define SD_MOD()
Definition: sdmod.hxx:184
static SfxItemSet & rSet
SvxZoomEnableFlags