LibreOffice Module sd (master) 1
ViewShellBase.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
21
22#include <ViewShellBase.hxx>
23#include <algorithm>
24#include <EventMultiplexer.hxx>
26#include <app.hrc>
27#include <slideshow.hxx>
28#include <unokywds.hxx>
29#include <svx/svxids.hrc>
30#include <DrawDocShell.hxx>
31#include <ViewShellManager.hxx>
32#include <DrawController.hxx>
33#include <FrameView.hxx>
34#include <ViewTabBar.hxx>
35#include <sfx2/event.hxx>
36#include <drawdoc.hxx>
37#include <sdpage.hxx>
38#include <sfx2/dispatch.hxx>
39#include <sfx2/request.hxx>
40#include <sfx2/printer.hxx>
41#include <DrawViewShell.hxx>
42#include <FormShellManager.hxx>
43#include <ToolBarManager.hxx>
44#include <Window.hxx>
46#include <DocumentRenderer.hxx>
47#include <optsitem.hxx>
48#include <sdmod.hxx>
49
50#include <com/sun/star/document/XViewDataSupplier.hpp>
51#include <com/sun/star/container/XIndexAccess.hpp>
52#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
53#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
54#include <com/sun/star/drawing/framework/XControllerManager.hpp>
55#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
56#include <com/sun/star/drawing/framework/ResourceId.hpp>
58
59#include <sal/log.hxx>
60#include <rtl/ref.hxx>
61#include <sfx2/msg.hxx>
62#include <sfx2/objface.hxx>
63#include <sfx2/viewfrm.hxx>
64#include <svl/whiter.hxx>
66#include <vcl/settings.hxx>
67#include <vcl/svapp.hxx>
68
70
72#include <sfx2/lokhelper.hxx>
73#include <LibreOfficeKit/LibreOfficeKitEnums.h>
74#include <editeng/editview.hxx>
75#include <tools/svborder.hxx>
76#include <o3tl/unreachable.hxx>
77
78#include <fubullet.hxx>
79#include <drawview.hxx>
80
81using namespace sd;
82#define ShellClass_ViewShellBase
83#include <sdslots.hxx>
84
85using ::sd::framework::FrameworkHelper;
86
87using namespace com::sun::star;
88using namespace com::sun::star::beans;
89using namespace com::sun::star::container;
91using namespace com::sun::star::lang;
92using namespace com::sun::star::uno;
93
94namespace {
95
96class CurrentPageSetter
97{
98public:
99 explicit CurrentPageSetter (ViewShellBase& rBase);
100 void operator () (bool);
101private:
102 ViewShellBase& mrBase;
103};
104
105} // end of anonymous namespace
106
107namespace sd {
108
110{
111public:
116
121
122 // contains the complete area of the current view relative to the frame window
124
125 // This is set to true when PrepareClose() is called.
127
134 std::shared_ptr<ToolBarManager> mpToolBarManager;
135 std::shared_ptr<ViewShellManager> mpViewShellManager;
136 std::shared_ptr<tools::EventMultiplexer> mpEventMultiplexer;
137 std::shared_ptr<FormShellManager> mpFormShellManager;
138
139 explicit Implementation (ViewShellBase& rBase);
141
142 void LateInit();
143
148 void ShowViewTabBar (bool bShow);
149
150 void SetUserWantsTabBar(bool inValue);
151 bool GetUserWantsTabBar() const { return mbUserWantsTabBar; }
152
156 void ResizePixel (
157 const Point& rOrigin,
158 const Size& rSize,
159 bool bOuterResize);
160
172 void SetPaneVisibility (
173 const SfxRequest& rRequest,
174 const OUString& rsPaneURL,
175 const OUString& rsViewURL);
176
177 void GetSlotState (SfxItemSet& rSet);
178
180
181private:
189 std::shared_ptr<slidesorter::cache::PageCacheManager> mpPageCacheManager;
190};
191
192namespace {
197class FocusForwardingWindow : public vcl::Window
198{
199public:
200 FocusForwardingWindow (vcl::Window& rParentWindow, ViewShellBase& rBase);
201 virtual ~FocusForwardingWindow() override;
202 virtual void dispose() override;
203 virtual void KeyInput (const KeyEvent& rEvent) override;
204 virtual void Command (const CommandEvent& rEvent) override;
205
206private:
207 ViewShellBase& mrBase;
208};
209} // end of anonymous namespace
210
211//===== ViewShellBase =========================================================
212
213
214// We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
215// new ViewShellBase object has been constructed.
216
218
219void ViewShellBase::InitInterface_Impl()
220{
221}
222
224 SfxViewFrame& _rFrame,
227 mpDocShell (nullptr),
228 mpDocument (nullptr)
229{
230 mpImpl.reset(new Implementation(*this));
231 mpImpl->mpViewWindow = VclPtr<FocusForwardingWindow>::Create(_rFrame.GetWindow(),*this);
232 mpImpl->mpViewWindow->SetBackground(Wallpaper());
233
234 _rFrame.GetWindow().SetBackground(Application::GetSettings().GetStyleSettings().GetLightColor());
235
236 // Set up the members in the correct order.
237 if (auto pDrawDocShell = dynamic_cast< DrawDocShell *>( GetViewFrame().GetObjectShell() ))
238 mpDocShell = pDrawDocShell;
239 if (mpDocShell != nullptr)
241 mpImpl->mpViewShellManager = std::make_shared<ViewShellManager>(*this);
242
243 SetWindow(mpImpl->mpViewWindow.get());
244
245 // Hide the window to avoid complaints from Sfx...SwitchViewShell...
246 _rFrame.GetWindow().Hide();
247}
248
254{
255 // Notify other LOK views that we are going away.
256 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", "false");
257 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "");
258 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
259
261
263 if (xSlideShow.is() && xSlideShow->dependsOn(this))
264 SlideShow::Stop(*this);
265 xSlideShow.clear();
266
267 // Tell the controller that the ViewShellBase is not available anymore.
268 if (mpImpl->mpController)
269 mpImpl->mpController->ReleaseViewShellBase();
270
271 // We have to hide the main window to prevent SFX complaining after a
272 // reload about it being already visible.
273 ViewShell* pShell = GetMainViewShell().get();
274 if (pShell!=nullptr
275 && pShell->GetActiveWindow()!=nullptr
276 && pShell->GetActiveWindow()->GetParent()!=nullptr)
277 {
278 pShell->GetActiveWindow()->GetParent()->Hide();
279 }
280
281 mpImpl->mpToolBarManager->Shutdown();
282 mpImpl->mpViewShellManager->Shutdown();
283
284 EndListening(GetViewFrame());
285 EndListening(*GetDocShell());
286
287 SetWindow(nullptr);
288
289 mpImpl->mpFormShellManager.reset();
290}
291
292void ViewShellBase::LateInit (const OUString& rsDefaultView)
293{
294 StartListening(GetViewFrame(), DuplicateHandling::Prevent);
295 StartListening(*GetDocShell(), DuplicateHandling::Prevent);
296 mpImpl->LateInit();
298
299 mpImpl->mpEventMultiplexer = std::make_shared<tools::EventMultiplexer>(*this);
300
301 mpImpl->mpFormShellManager = std::make_shared<FormShellManager>(*this);
302
303 mpImpl->mpToolBarManager = ToolBarManager::Create(
304 *this,
305 mpImpl->mpEventMultiplexer,
306 mpImpl->mpViewShellManager);
307
308 try
309 {
311 Reference<XConfigurationController> xConfigurationController;
312 if (xControllerManager)
313 xConfigurationController = xControllerManager->getConfigurationController();
314 if (xConfigurationController.is())
315 {
316 OUString sView (rsDefaultView);
317 if (sView.isEmpty())
318 sView = GetInitialViewShellType();
319
320 FrameworkHelper::Instance(*this);
321
322 // Create the resource ids for the center pane and view.
324 FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL));
326 FrameworkHelper::CreateResourceId(sView, xCenterPaneId));
327
328 // Request center pane and view.
329 xConfigurationController->requestResourceActivation(xCenterPaneId, ResourceActivationMode_ADD);
330 xConfigurationController->requestResourceActivation(xCenterViewId, ResourceActivationMode_REPLACE);
331
332 // Process configuration events synchronously until the center view
333 // has been created.
334 sd::framework::ConfigurationController* pConfigurationController
335 = dynamic_cast<sd::framework::ConfigurationController*>(xConfigurationController.get());
336 if (pConfigurationController != nullptr)
337 {
338 while (
339 ! pConfigurationController->getResource(xCenterViewId).is()
340 && pConfigurationController->hasPendingRequests())
341 {
342 pConfigurationController->ProcessEvent();
343 }
344 }
345 }
346 }
347 catch (const RuntimeException&)
348 {
349 }
350
351 // AutoLayouts have to be ready.
353
354 UpdateBorder();
355
356 // Remember the type of the current main view shell in the frame view.
357 ViewShell* pViewShell = GetMainViewShell().get();
358 if (pViewShell != nullptr)
359 {
360 FrameView* pFrameView = pViewShell->GetFrameView();
361 if (pFrameView != nullptr)
362 pFrameView->SetViewShellTypeOnLoad(pViewShell->GetShellType());
363 }
364 // Show/Hide the TabBar
365 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDocument()->GetDocumentType());
366 bool bIsTabBarVisible = pOptions->IsTabBarVisible();
367 mpImpl->SetUserWantsTabBar( bIsTabBarVisible );
368}
369
370std::shared_ptr<ViewShellManager> const & ViewShellBase::GetViewShellManager() const
371{
372 return mpImpl->mpViewShellManager;
373}
374
375std::shared_ptr<ViewShell> ViewShellBase::GetMainViewShell() const
376{
377 std::shared_ptr<ViewShell> pMainViewShell (
380 if (pMainViewShell == nullptr)
381 pMainViewShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))
383 return pMainViewShell;
384}
385
387{
388 ViewShellBase* pBase = nullptr;
389
390 if (pViewFrame != nullptr)
391 {
392 // Get the view shell for the frame and cast it to
393 // sd::ViewShellBase.
394 SfxViewShell* pSfxViewShell = pViewFrame->GetViewShell();
395 pBase = dynamic_cast< ::sd::ViewShellBase *>( pSfxViewShell );
396 }
397
398 return pBase;
399}
400
402{
403 SfxViewShell::Notify(rBC, rHint);
404
405 const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint);
406 if (pEventHint)
407 {
408 switch (pEventHint->GetEventId())
409 {
410 case SfxEventHintId::OpenDoc:
412 {
414 SID_PRESENTATION, SfxCallMode::ASYNCHRON );
415 }
416 break;
417
418 default:
419 break;
420 }
421 }
422 else
423 {
424 const SfxHintId nSlot = rHint.GetId();
425 switch ( nSlot )
426 {
427 case SfxHintId::LanguageChanged:
428 {
429 GetViewFrame().GetBindings().Invalidate(SID_LANGUAGE_STATUS);
430 }
431 break;
432
433 default:
434 break;
435 }
436 }
437}
438
440{
441}
442
443OUString ViewShellBase::GetSelectionText(bool bCompleteWords, bool /*bOnlyASample*/)
444{
445 std::shared_ptr<ViewShell> const pMainShell(GetMainViewShell());
446 DrawViewShell *const pDrawViewShell(
447 dynamic_cast<DrawViewShell*>(pMainShell.get()));
448 return pDrawViewShell
449 ? pDrawViewShell->GetSelectionText(bCompleteWords)
450 : SfxViewShell::GetSelectionText(bCompleteWords);
451}
452
453bool ViewShellBase::HasSelection(bool bText) const
454{
455 std::shared_ptr<ViewShell> const pMainShell(GetMainViewShell());
456 DrawViewShell *const pDrawViewShell(
457 dynamic_cast<DrawViewShell*>(pMainShell.get()));
458 return pDrawViewShell
459 ? pDrawViewShell->HasSelection(bText)
461}
462
463void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize, bool)
464{
465 Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
466 if ( !aObjSize.IsEmpty() )
467 {
468 SvBorder aBorder( GetBorderPixel() );
469 Size aSize( rSize );
470 aSize.AdjustWidth( -(aBorder.Left() + aBorder.Right()) );
471 aSize.AdjustHeight( -(aBorder.Top() + aBorder.Bottom()) );
472 Size aObjSizePixel = mpImpl->mpViewWindow->LogicToPixel(aObjSize, MapMode(MapUnit::Map100thMM));
474 Fraction( aSize.Width(), std::max( aObjSizePixel.Width(), static_cast<::tools::Long>(1) ) ),
475 Fraction( aSize.Height(), std::max( aObjSizePixel.Height(), static_cast<::tools::Long>(1)) ) );
476 }
477
478 mpImpl->ResizePixel(rOrigin, rSize, false);
479}
480
481void ViewShellBase::OuterResizePixel (const Point& rOrigin, const Size &rSize)
482{
483 mpImpl->ResizePixel (rOrigin, rSize, true);
484}
485
487{
488 // There is a bug in the communication between embedded objects and the
489 // framework::LayoutManager that leads to missing resize updates. The
490 // following workaround enforces such an update by cycling the border to
491 // zero and back to the current value.
492 if (GetWindow() != nullptr)
493 {
495 UpdateBorder(true);
496 }
497 else
498 {
499 SAL_WARN("sd.view", "Rearrange: window missing");
500 }
501
502 GetViewFrame().Resize(true);
503}
504
506{
507 ErrCode aResult = ERRCODE_NONE;
508
509 ::sd::ViewShell* pShell = GetMainViewShell().get();
510 if (pShell != nullptr)
511 aResult = pShell->DoVerb(nVerb);
512
513 return aResult;
514}
515
517{
518 // Create a new DocumentRenderer on every call. It observes the life
519 // time of this ViewShellBase object.
521}
522
524{
525 OSL_ASSERT(mpImpl != nullptr);
526
527 return GetDocShell()->GetPrinter (bCreate);
528}
529
531 SfxPrinter* pNewPrinter,
532 SfxPrinterChangeFlags nDiffFlags)
533{
534 OSL_ASSERT(mpImpl != nullptr);
535
536 GetDocShell()->SetPrinter(pNewPrinter);
537
538 if ( (nDiffFlags & SfxPrinterChangeFlags::CHG_ORIENTATION ||
539 nDiffFlags & SfxPrinterChangeFlags::CHG_SIZE) && pNewPrinter )
540 {
541 MapMode aMap = pNewPrinter->GetMapMode();
542 aMap.SetMapUnit(MapUnit::Map100thMM);
543 MapMode aOldMap = pNewPrinter->GetMapMode();
544 pNewPrinter->SetMapMode(aMap);
545 Size aNewSize = pNewPrinter->GetOutputSize();
546
547 std::shared_ptr<DrawViewShell> pDrawViewShell (
548 std::dynamic_pointer_cast<DrawViewShell>(GetMainViewShell()));
549 if (pDrawViewShell)
550 {
551 SdPage* pPage = GetDocument()->GetSdPage(
553 pDrawViewShell->SetPageSizeAndBorder (
554 pDrawViewShell->GetPageKind(),
555 aNewSize,
556 -1,-1,-1,-1,
557 false/*bScaleAll*/,
558 pNewPrinter->GetOrientation(),
559 pPage->GetPaperBin(),
560 pPage->IsBackgroundFullSize());
561 }
562
563 pNewPrinter->SetMapMode(aOldMap);
564 }
565
566 return 0;
567}
568
570{
571 mpImpl->ShowViewTabBar(false);
572
573 ViewShell* pViewShell = GetMainViewShell().get();
574 if ( pViewShell )
575 pViewShell->UIActivating( pClient );
576
578}
579
581{
583
584 mpImpl->ShowViewTabBar(true);
585
586 ViewShell* pViewShell = GetMainViewShell().get();
587 if ( pViewShell )
588 pViewShell->UIDeactivated( pClient );
589}
590
592{
593 int nTop = 0;
594 if (mpImpl->mpViewTabBar.is() && mpImpl->mpViewTabBar->GetTabControl()->IsVisible())
595 nTop = mpImpl->mpViewTabBar->GetHeight();
596 return SvBorder(0,nTop,0,0);
597}
598
600{
601 sal_uInt16 nSlotId = rRequest.GetSlot();
602
603 switch (nSlotId)
604 {
605 case SID_SWITCH_SHELL:
606 {
607 Reference<XControllerManager> xControllerManager (GetController(), UNO_QUERY);
608 if (xControllerManager.is())
609 {
610 Reference<XConfigurationController> xConfigurationController (
611 xControllerManager->getConfigurationController());
612 if (xConfigurationController.is())
613 xConfigurationController->update();
614 }
615 }
616 break;
617
618 case SID_LEFT_PANE_DRAW:
619 mpImpl->SetPaneVisibility(
620 rRequest,
623 break;
624
625 case SID_LEFT_PANE_IMPRESS:
626 mpImpl->SetPaneVisibility(
627 rRequest,
630 break;
631
632 case SID_TOGGLE_TABBAR_VISIBILITY:
633 {
634 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDocument()->GetDocumentType());
635 bool bIsTabBarVisible = pOptions->IsTabBarVisible();
636 pOptions->SetTabBarVisible( !bIsTabBarVisible );
637 mpImpl->SetUserWantsTabBar( !bIsTabBarVisible );
638 rRequest.Done();
639 }
640 break;
641
642 // draw
643 case SID_DRAWINGMODE:
644 // impress normal
645 case SID_NORMAL_MULTI_PANE_GUI:
646 case SID_NOTES_MODE:
647 case SID_OUTLINE_MODE:
648 case SID_SLIDE_SORTER_MULTI_PANE_GUI:
649 case SID_SLIDE_SORTER_MODE:
650 // impress master
651 case SID_SLIDE_MASTER_MODE:
652 case SID_NOTES_MASTER_MODE:
653 case SID_HANDOUT_MASTER_MODE:
654 framework::FrameworkHelper::Instance(*this)->HandleModeChangeSlot(nSlotId, rRequest);
655 break;
656
657 case SID_WIN_FULLSCREEN:
658 // The full screen mode is not supported. Ignore the request.
659 break;
660
661 case SID_RESTORE_EDITING_VIEW:
662 mpImpl->ProcessRestoreEditingViewSlot();
663 break;
664
665 default:
666 // Ignore any other slot.
667 rRequest.Ignore ();
668 break;
669 }
670}
671
673{
674 mpImpl->GetSlotState(rSet);
675
677}
678
680 css::uno::Sequence< css::beans::PropertyValue >& rSequence)
681{
682 // Forward call to main sub shell.
683 ViewShell* pShell = GetMainViewShell().get();
684 if (pShell != nullptr)
685 pShell->WriteUserDataSequence (rSequence);
686}
687
689 const css::uno::Sequence< css::beans::PropertyValue >& rSequence)
690{
691 // Forward call to main sub shell.
692 ViewShell* pShell = GetMainViewShell().get();
693 if (pShell == nullptr)
694 return;
695
696 pShell->ReadUserDataSequence (rSequence);
697
698 // For certain shell types ReadUserDataSequence may have changed the
699 // type to another one. Make sure that the center pane shows the
700 // right view shell.
701 switch (pShell->GetShellType())
702 {
706 {
707 OUString sViewURL;
708 switch (dynamic_cast<DrawViewShell&>(*pShell).GetPageKind())
709 {
710 default:
713 break;
714 case PageKind::Notes:
716 break;
719 break;
720 }
721 if (!sViewURL.isEmpty())
722 framework::FrameworkHelper::Instance(*this)->RequestView(
723 sViewURL,
725 }
726 break;
727
728 default:
729 break;
730 }
731}
732
733void ViewShellBase::Activate (bool bIsMDIActivate)
734{
735 SfxViewShell::Activate(bIsMDIActivate);
736
737 Reference<XControllerManager> xControllerManager (GetController(), UNO_QUERY);
738 if (xControllerManager.is())
739 {
740 Reference<XConfigurationController> xConfigurationController (
741 xControllerManager->getConfigurationController());
742 if (xConfigurationController.is())
743 xConfigurationController->update();
744 }
745 GetToolBarManager()->RequestUpdate();
746}
747
749 const Fraction &rZoomX,
750 const Fraction &rZoomY)
751{
752 SfxViewShell::SetZoomFactor (rZoomX, rZoomY);
753 // Forward call to main sub shell.
754 ViewShell* pShell = GetMainViewShell().get();
755 if (pShell != nullptr)
756 pShell->SetZoomFactor (rZoomX, rZoomY);
757}
758
760{
761 bool bResult = SfxViewShell::PrepareClose (bUI);
762
763 if (bResult)
764 {
765 mpImpl->mbIsClosing = true;
766
767 // Forward call to main sub shell.
768 ViewShell* pShell = GetMainViewShell().get();
769 if (pShell != nullptr)
770 bResult = pShell->PrepareClose (bUI);
771 }
772
773 return bResult;
774}
775
776void ViewShellBase::WriteUserData (OUString& rString, bool bBrowse)
777{
778 SfxViewShell::WriteUserData (rString, bBrowse);
779
780 // Forward call to main sub shell.
781 ViewShell* pShell = GetMainViewShell().get();
782 if (pShell != nullptr)
783 pShell->WriteUserData();
784}
785
786void ViewShellBase::ReadUserData (const OUString& rString, bool bBrowse)
787{
788 SfxViewShell::ReadUserData (rString, bBrowse);
789
790 // Forward call to main sub shell.
791 ViewShell* pShell = GetMainViewShell().get();
792 if (pShell != nullptr)
793 pShell->ReadUserData();
794}
795
797{
798 // Forward call to main sub shell.
799 ViewShell* pShell = GetMainViewShell().get();
800 if (pShell != nullptr)
801 return pShell->GetDrawView ();
802 else
804}
805
807{
808 if (GetDocShell() != nullptr)
809 GetDocShell()->SetWaitCursor (bBusy);
810}
811
812void ViewShellBase::UpdateBorder ( bool bForce /* = false */ )
813{
814 // The following calls to SetBorderPixel() and InvalidateBorder() are
815 // made only for the main view shell. This not only avoids unnecessary
816 // calls for the views in side panes but prevents calling an already
817 // dying SfxViewShell base class.
818 // We have to check the existence of the window, too.
819 // The SfxViewFrame accesses the window without checking it.
820 ViewShell* pMainViewShell = GetMainViewShell().get();
821 if (pMainViewShell == nullptr || GetWindow()==nullptr)
822 return;
823
824 SvBorder aCurrentBorder (GetBorderPixel());
825 bool bOuterResize ( ! GetDocShell()->IsInPlaceActive());
826 SvBorder aBorder (GetBorder(bOuterResize));
827 aBorder += pMainViewShell->GetBorder();
828
829 if (bForce || (aBorder != aCurrentBorder))
830 {
831 SetBorderPixel (aBorder);
833 }
834}
835
837{
838 mpImpl->ShowViewTabBar(bVisible);
839
840 ViewShell* pMainViewShell = GetMainViewShell().get();
841 if (pMainViewShell != nullptr)
842 pMainViewShell->ShowUIControls (bVisible);
843
844 UpdateBorder();
845 if (bVisible)
846 Rearrange();
847}
848
850{
851 OUString sRequestedView (FrameworkHelper::msImpressViewURL);
852
853 do
854 {
856 GetDocShell()->GetModel(), UNO_QUERY);
857 if ( ! xViewDataSupplier.is())
858 break;
859
860 Reference<container::XIndexAccess> xViewData (xViewDataSupplier->getViewData());
861 if ( ! xViewData.is())
862 break;
863 if (xViewData->getCount() == 0)
864 break;
865
866 css::uno::Any aAny = xViewData->getByIndex(0);
868 if ( ! (aAny >>= aProperties))
869 break;
870
871 // Search the properties for the one that tells us what page kind to
872 // use.
873 auto pProperty = std::find_if(std::cbegin(aProperties), std::cend(aProperties),
874 [](const beans::PropertyValue& rProperty) { return rProperty.Name == sUNO_View_PageKind; });
875 if (pProperty != std::cend(aProperties))
876 {
877 sal_Int16 nPageKind = 0;
878 pProperty->Value >>= nPageKind;
879 switch (static_cast<PageKind>(nPageKind))
880 {
882 sRequestedView = FrameworkHelper::msImpressViewURL;
883 break;
884
886 sRequestedView = FrameworkHelper::msHandoutViewURL;
887 break;
888
889 case PageKind::Notes:
890 sRequestedView = FrameworkHelper::msNotesViewURL;
891 break;
892
893 default:
894 // The page kind is invalid. This is probably an
895 // error by the caller. We use the standard type to
896 // keep things going.
897 SAL_WARN( "sd.view", "ViewShellBase::GetInitialViewShellType: invalid page kind");
898 sRequestedView = FrameworkHelper::msImpressViewURL;
899 break;
900 }
901 }
902 }
903 while (false);
904
905 return sRequestedView;
906}
907
908std::shared_ptr<tools::EventMultiplexer> const & ViewShellBase::GetEventMultiplexer() const
909{
910 OSL_ASSERT(mpImpl != nullptr);
911 OSL_ASSERT(mpImpl->mpEventMultiplexer != nullptr);
912
913 return mpImpl->mpEventMultiplexer;
914}
915
916const ::tools::Rectangle& ViewShellBase::getClientRectangle() const
917{
918 return mpImpl->maClientArea;
919}
920
921std::shared_ptr<ToolBarManager> const & ViewShellBase::GetToolBarManager() const
922{
923 OSL_ASSERT(mpImpl != nullptr);
924 OSL_ASSERT(mpImpl->mpToolBarManager != nullptr);
925
926 return mpImpl->mpToolBarManager;
927}
928
929std::shared_ptr<FormShellManager> const & ViewShellBase::GetFormShellManager() const
930{
931 OSL_ASSERT(mpImpl != nullptr);
932 OSL_ASSERT(mpImpl->mpFormShellManager != nullptr);
933
934 return mpImpl->mpFormShellManager;
935}
936
938{
939 OSL_ASSERT(mpImpl != nullptr);
940
941 return mpImpl->mpController.get();
942}
943
944void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar)
945{
946 OSL_ASSERT(mpImpl != nullptr);
947
948 mpImpl->mpViewTabBar = rViewTabBar;
949}
950
952{
953 OSL_ASSERT(mpImpl != nullptr);
954
955 return mpImpl->mpViewWindow.get();
956}
957
958OUString ViewShellBase::RetrieveLabelFromCommand( const OUString& aCmdURL ) const
959{
960 OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface()));
963}
964
966{
967 ViewShell* pViewShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))->GetViewShell(FrameworkHelper::msCenterPaneURL).get();
968
969 if (DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pViewShell))
970 {
971 return pDrawViewShell->GetCurPagePos();
972 }
973
974 return 0;
975}
976
978{
979 ViewShell* pViewShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))->GetViewShell(FrameworkHelper::msCenterPaneURL).get();
980
981 if (DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pViewShell))
982 {
983 switch ( pDrawViewShell->GetEditMode() )
984 {
985 case EditMode::Page:
986 return 0;
988 return 1;
989 }
990 }
991
992 return 0;
993}
994
996{
997 ViewShell* pViewShell = framework::FrameworkHelper::Instance(*this)->GetViewShell(FrameworkHelper::msCenterPaneURL).get();
998
999 if (DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pViewShell))
1000 {
1001 switch ( nMode )
1002 {
1003 case 0:
1004 pDrawViewShell->ChangeEditMode(EditMode::Page, false);
1005 break;
1006 case 1:
1007 pDrawViewShell->ChangeEditMode(EditMode::MasterPage, false);
1008 break;
1009 }
1010 }
1011}
1012
1014{
1015 // TODO: Add theme color palette changed callback
1016}
1017
1019{
1020 ViewShell* pThisShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))->GetViewShell(FrameworkHelper::msCenterPaneURL).get();
1021
1022 DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pThisShell);
1023 if (!pDrawViewShell)
1024 return;
1025
1026 if (this == pOtherShell)
1027 return;
1028
1029 DrawView* pDrawView = pDrawViewShell->GetDrawView();
1030 if (!pDrawView)
1031 return;
1032
1033 if (pDrawView->GetTextEditObject())
1034 {
1035 // Blinking cursor.
1036 EditView& rEditView = pDrawView->GetTextEditOutlinerView()->GetEditView();
1037 rEditView.RegisterOtherShell(pOtherShell);
1038 rEditView.ShowCursor();
1039 rEditView.RegisterOtherShell(nullptr);
1040 // Text selection, if any.
1041 rEditView.DrawSelectionXOR(pOtherShell);
1042
1043 // Shape text lock.
1044 if (OutlinerView* pOutlinerView = pDrawView->GetTextEditOutlinerView())
1045 {
1046 ::tools::Rectangle aRectangle = pOutlinerView->GetOutputArea();
1047 vcl::Window* pWin = pThisShell->GetActiveWindow();
1048 if (pWin && pWin->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
1049 aRectangle = o3tl::toTwips(aRectangle, o3tl::Length::mm100);
1050 OString sRectangle = aRectangle.toString();
1051 SfxLokHelper::notifyOtherView(&pDrawViewShell->GetViewShellBase(), pOtherShell, LOK_CALLBACK_VIEW_LOCK, "rectangle", sRectangle);
1052 }
1053 }
1054 else
1055 {
1056 // Graphic selection.
1057 pDrawView->AdjustMarkHdl(pOtherShell);
1058 }
1059}
1060
1062{
1063 if (DrawViewShell* pCurrentDrawShell = dynamic_cast<DrawViewShell*>(GetMainViewShell().get()))
1064 {
1065 const SdViewOptions& rViewOptions = pCurrentDrawShell->GetViewOptions();
1066 switch (nColorType)
1067 {
1068 case svtools::ColorConfigEntry::DOCCOLOR:
1069 {
1070 return rViewOptions.mnDocBackgroundColor;
1071 }
1072 // Should never be called for an unimplemented color type
1073 default:
1074 {
1076 }
1077 }
1078 }
1079 else
1080 {
1081 SAL_WARN("sd", "dynamic_cast to DrawViewShell failed");
1082 }
1083
1084 return {};
1085}
1086
1088{
1089 if (DrawViewShell* pCurrentDrawShell = dynamic_cast<DrawViewShell*>(GetMainViewShell().get()))
1090 {
1091 const SdViewOptions& rViewOptions = pCurrentDrawShell->GetViewOptions();
1092 return rViewOptions.msColorSchemeName;
1093 }
1094
1095 SAL_WARN("sd", "dynamic_cast to DrawViewShell failed");
1096 return {};
1097}
1098
1099//===== ViewShellBase::Implementation =========================================
1100
1102 : mbIsClosing(false),
1103 mrBase(rBase),
1104 mbUserWantsTabBar(false),
1105 mbTabBarShouldBeVisible(true),
1106 mpPageCacheManager(slidesorter::cache::PageCacheManager::Instance())
1107{
1108}
1109
1111{
1112 mpController = nullptr;
1113 mpViewTabBar = nullptr;
1114 mpViewWindow.disposeAndClear();
1115 mpToolBarManager.reset();
1116}
1117
1119{
1120 mpController = new DrawController(mrBase);
1121}
1122
1124{
1125 ViewShell* pViewShell = mrBase.GetMainViewShell().get();
1126 if (pViewShell == nullptr)
1127 return;
1128
1129 FrameView* pFrameView = pViewShell->GetFrameView();
1130 if (pFrameView == nullptr)
1131 return;
1132
1133 // Set view shell, edit mode, and page kind.
1134 // pFrameView->SetViewShEditMode(
1135 // pFrameView->GetViewShEditModeOnLoad(),
1136 // pFrameView->GetPageKindOnLoad());
1137 pFrameView->SetViewShEditMode(
1138 pFrameView->GetViewShEditModeOnLoad() );
1139 pFrameView->SetPageKind(
1140 pFrameView->GetPageKindOnLoad());
1141 std::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(mrBase));
1142 pHelper->RequestView(
1143 FrameworkHelper::GetViewURL(pFrameView->GetViewShellTypeOnLoad()),
1144 FrameworkHelper::msCenterPaneURL);
1145 pHelper->RunOnConfigurationEvent("ConfigurationUpdateEnd", CurrentPageSetter(mrBase));
1146}
1147
1149{
1150 mbUserWantsTabBar = inValue;
1151 // Call ShowViewTabBar to refresh the TabBar visibility
1152 ShowViewTabBar(mbTabBarShouldBeVisible);
1153}
1154
1156{
1157 mbTabBarShouldBeVisible = bShow;
1158 bShow = bShow && mbUserWantsTabBar;
1159
1160 if (mpViewTabBar.is()
1161 && mpViewTabBar->GetTabControl()->IsVisible() != bShow)
1162 {
1163 mpViewTabBar->GetTabControl()->Show(bShow);
1164 mrBase.Rearrange();
1165 }
1166}
1167
1169 const Point& rOrigin,
1170 const Size &rSize,
1171 bool bOuterResize)
1172{
1173 if (mbIsClosing)
1174 return;
1175
1176 // Forward the call to both the base class and the main stacked sub
1177 // shell only when main sub shell exists.
1178 ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
1179
1180 // Set the ViewTabBar temporarily to full size so that, when asked
1181 // later, it can return its true height.
1182 mrBase.SetWindow (mpViewWindow.get());
1183 if (mpViewTabBar.is() && mpViewTabBar->GetTabControl()->IsVisible())
1184 mpViewTabBar->GetTabControl()->SetPosSizePixel (rOrigin, rSize);
1185
1186 // Calculate and set the border before the controls are placed.
1187 SvBorder aBorder;
1188 if (pMainViewShell != nullptr)
1189 aBorder = pMainViewShell->GetBorder();
1190 aBorder += mrBase.GetBorder(bOuterResize);
1191 if (mrBase.GetBorderPixel() != aBorder)
1192 mrBase.SetBorderPixel(aBorder);
1193
1194 // Place the ViewTabBar at the top. It is part of the border.
1195 SvBorder aBaseBorder;
1196 if (mpViewTabBar.is() && mpViewTabBar->GetTabControl()->IsVisible())
1197 {
1198 aBaseBorder.Top() = mpViewTabBar->GetHeight();
1199 mpViewTabBar->GetTabControl()->SetPosSizePixel(
1200 rOrigin, Size(rSize.Width(),aBaseBorder.Top()));
1201 }
1202
1203 // The view window gets the remaining space.
1204 Point aViewWindowPosition (
1205 rOrigin.X()+aBaseBorder.Left(),
1206 rOrigin.Y()+aBaseBorder.Top());
1207
1208 Size aViewWindowSize (
1209 rSize.Width() - aBaseBorder.Left() - aBaseBorder.Right(),
1210 rSize.Height() - aBaseBorder.Top() - aBaseBorder.Bottom());
1211 mpViewWindow->SetPosSizePixel(aViewWindowPosition, aViewWindowSize);
1212
1213 maClientArea = ::tools::Rectangle(Point(0,0), aViewWindowSize);
1214}
1215
1217 const SfxRequest& rRequest,
1218 const OUString& rsPaneURL,
1219 const OUString& rsViewURL)
1220{
1221 try
1222 {
1223 Reference<XControllerManager> xControllerManager (mrBase.GetController(), UNO_QUERY_THROW);
1224
1225 const Reference< XComponentContext > xContext(
1226 ::comphelper::getProcessComponentContext() );
1227 Reference<XResourceId> xPaneId (ResourceId::create(
1228 xContext, rsPaneURL));
1229 Reference<XResourceId> xViewId (ResourceId::createWithAnchorURL(
1230 xContext, rsViewURL, rsPaneURL));
1231
1232 // Determine the new visibility state.
1233 const SfxItemSet* pArguments = rRequest.GetArgs();
1234 bool bShowChildWindow;
1235 sal_uInt16 nSlotId = rRequest.GetSlot();
1236 if (pArguments != nullptr)
1237 bShowChildWindow = static_cast<const SfxBoolItem&>(
1238 pArguments->Get(nSlotId)).GetValue();
1239 else
1240 {
1241 Reference<XConfigurationController> xConfigurationController (
1242 xControllerManager->getConfigurationController());
1243 if ( ! xConfigurationController.is())
1244 throw RuntimeException();
1245 Reference<XConfiguration> xConfiguration (
1246 xConfigurationController->getRequestedConfiguration());
1247 if ( ! xConfiguration.is())
1248 throw RuntimeException();
1249
1250 bShowChildWindow = ! xConfiguration->hasResource(xPaneId);
1251 }
1252
1253 // Set the desired visibility state at the current configuration
1254 // and update it accordingly.
1255 Reference<XConfigurationController> xConfigurationController (
1256 xControllerManager->getConfigurationController());
1257 if ( ! xConfigurationController.is())
1258 throw RuntimeException();
1259 if (bShowChildWindow)
1260 {
1261 xConfigurationController->requestResourceActivation(
1262 xPaneId,
1263 ResourceActivationMode_ADD);
1264 xConfigurationController->requestResourceActivation(
1265 xViewId,
1266 ResourceActivationMode_REPLACE);
1267 }
1268 else
1269 xConfigurationController->requestResourceDeactivation(
1270 xPaneId);
1271 }
1272 catch (const Exception&)
1273 {
1274 DBG_UNHANDLED_EXCEPTION("sd.view");
1275 }
1276}
1277
1279{
1280 try
1281 {
1282 // Get some frequently used values.
1283 Reference<XControllerManager> xControllerManager (mrBase.GetController(), UNO_QUERY_THROW);
1284 Reference<XConfigurationController> xConfigurationController (
1285 xControllerManager->getConfigurationController());
1286 if ( ! xConfigurationController.is())
1287 throw RuntimeException();
1288 Reference<XConfiguration> xConfiguration (
1289 xConfigurationController->getRequestedConfiguration());
1290 if ( ! xConfiguration.is())
1291 throw RuntimeException();
1292
1293 const Reference< XComponentContext > xContext(
1294 ::comphelper::getProcessComponentContext() );
1295 SfxWhichIter aSetIterator (rSet);
1296 sal_uInt16 nItemId (aSetIterator.FirstWhich());
1297
1298 while (nItemId > 0)
1299 {
1300 bool bState (false);
1301 Reference<XResourceId> xResourceId;
1302 try
1303 {
1304 // Check if the right view is active
1305 switch (nItemId)
1306 {
1307 case SID_LEFT_PANE_IMPRESS:
1308 xResourceId = ResourceId::create(
1309 xContext, FrameworkHelper::msLeftImpressPaneURL);
1310 bState = xConfiguration->hasResource(xResourceId);
1311 break;
1312
1313 case SID_LEFT_PANE_DRAW:
1314 xResourceId = ResourceId::create(
1315 xContext, FrameworkHelper::msLeftDrawPaneURL);
1316 bState = xConfiguration->hasResource(xResourceId);
1317 break;
1318
1319 case SID_DRAWINGMODE:
1320 case SID_NORMAL_MULTI_PANE_GUI:
1321 case SID_SLIDE_MASTER_MODE:
1322 xResourceId = ResourceId::createWithAnchorURL(
1323 xContext, FrameworkHelper::msImpressViewURL,
1324 FrameworkHelper::msCenterPaneURL);
1325 bState = xConfiguration->hasResource(xResourceId);
1326 break;
1327
1328 case SID_SLIDE_SORTER_MULTI_PANE_GUI:
1329 case SID_SLIDE_SORTER_MODE:
1330 xResourceId = ResourceId::createWithAnchorURL(
1331 xContext,
1332 FrameworkHelper::msSlideSorterURL,
1333 FrameworkHelper::msCenterPaneURL);
1334 bState = xConfiguration->hasResource(xResourceId);
1335 break;
1336
1337 case SID_OUTLINE_MODE:
1338 xResourceId = ResourceId::createWithAnchorURL(
1339 xContext,
1340 FrameworkHelper::msOutlineViewURL,
1341 FrameworkHelper::msCenterPaneURL);
1342 bState = xConfiguration->hasResource(xResourceId);
1343 break;
1344
1345 case SID_HANDOUT_MASTER_MODE:
1346 xResourceId = ResourceId::createWithAnchorURL(
1347 xContext, FrameworkHelper::msHandoutViewURL,
1348 FrameworkHelper::msCenterPaneURL);
1349 bState = xConfiguration->hasResource(xResourceId);
1350 break;
1351
1352 case SID_NOTES_MODE:
1353 case SID_NOTES_MASTER_MODE:
1354 xResourceId = ResourceId::createWithAnchorURL(
1355 xContext, FrameworkHelper::msNotesViewURL,
1356 FrameworkHelper::msCenterPaneURL);
1357 bState = xConfiguration->hasResource(xResourceId);
1358 break;
1359
1360 case SID_TOGGLE_TABBAR_VISIBILITY:
1361 bState = GetUserWantsTabBar();
1362 break;
1363
1364 default:
1365 // Ignore all other items. They are not meant to be
1366 // handled by us.
1367 break;
1368 }
1369 }
1370 catch (const DeploymentException&)
1371 {
1372 }
1373
1374 // Check if edit mode fits too
1375 if (bState)
1376 {
1377 ViewShell* const pCenterViewShell = FrameworkHelper::Instance(mrBase)->GetViewShell(
1378 FrameworkHelper::msCenterPaneURL).get();
1379 DrawViewShell* const pShell = dynamic_cast<DrawViewShell*>(pCenterViewShell);
1380 if (pShell)
1381 {
1382 switch (nItemId)
1383 {
1384 case SID_DRAWINGMODE:
1385 case SID_NORMAL_MULTI_PANE_GUI:
1386 case SID_NOTES_MODE:
1387 bState = pShell->GetEditMode() == EditMode::Page;
1388 break;
1389 case SID_SLIDE_MASTER_MODE:
1390 case SID_NOTES_MASTER_MODE:
1391 bState = pShell->GetEditMode() == EditMode::MasterPage;
1392 break;
1393 }
1394 }
1395 }
1396
1397 // And finally set the state.
1398 rSet.Put(SfxBoolItem(nItemId, bState));
1399
1400 nItemId = aSetIterator.NextWhich();
1401 }
1402 }
1403 catch (const RuntimeException&)
1404 {
1405 DBG_UNHANDLED_EXCEPTION("sd.view");
1406 }
1407
1408}
1409
1410} // end of namespace sd
1411
1412//===== CurrentPageSetter ===========================================
1413
1414namespace {
1415
1416CurrentPageSetter::CurrentPageSetter (ViewShellBase& rBase)
1417 : mrBase(rBase)
1418{
1419}
1420
1421void CurrentPageSetter::operator() (bool)
1422{
1423 FrameView* pFrameView = nullptr;
1424
1425 if (mrBase.GetMainViewShell() != nullptr)
1426 {
1427 pFrameView = mrBase.GetMainViewShell()->GetFrameView();
1428 }
1429
1430 if (pFrameView==nullptr)
1431 return;
1432
1433 try
1434 {
1435 // Get the current page either from the DrawPagesSupplier or the
1436 // MasterPagesSupplier.
1437 Any aPage;
1438 if (pFrameView->GetViewShEditModeOnLoad() == EditMode::Page)
1439 {
1441 mrBase.GetController()->getModel(), UNO_QUERY_THROW);
1443 xPagesSupplier->getDrawPages(), UNO_QUERY_THROW);
1444 aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad());
1445 }
1446 else
1447 {
1449 mrBase.GetController()->getModel(), UNO_QUERY_THROW);
1451 xPagesSupplier->getMasterPages(), UNO_QUERY_THROW);
1452 aPage = xPages->getByIndex(pFrameView->GetSelectedPageOnLoad());
1453 }
1454 // Switch to the page last edited by setting the CurrentPage
1455 // property.
1456 Reference<beans::XPropertySet> xSet (mrBase.GetController(), UNO_QUERY_THROW);
1457 xSet->setPropertyValue ("CurrentPage", aPage);
1458 }
1459 catch (const RuntimeException&)
1460 {
1461 // We have not been able to set the current page at the main view.
1462 // This is sad but still leaves us in a valid state. Therefore,
1463 // this exception is silently ignored.
1464 }
1465 catch (const beans::UnknownPropertyException&)
1466 {
1467 SAL_WARN("sd.view", "CurrentPage property unknown");
1468 }
1469}
1470
1471} // end of anonymous namespace
1472
1473//===== FocusForwardingWindow =================================================
1474
1475namespace sd {
1476namespace {
1477
1478FocusForwardingWindow::FocusForwardingWindow (
1479 vcl::Window& rParentWindow,
1480 ViewShellBase& rBase)
1481 : vcl::Window(&rParentWindow, WinBits(WB_CLIPCHILDREN | WB_DIALOGCONTROL)),
1482 mrBase(rBase)
1483{
1484 SAL_INFO("sd.view", "created FocusForwardingWindow at " << this);
1485}
1486
1487FocusForwardingWindow::~FocusForwardingWindow()
1488{
1489 disposeOnce();
1490}
1491
1492void FocusForwardingWindow::dispose()
1493{
1494 SAL_INFO("sd.view", "destroyed FocusForwardingWindow at " << this);
1496}
1497
1498void FocusForwardingWindow::KeyInput (const KeyEvent& rKEvt)
1499{
1500 std::shared_ptr<ViewShell> pViewShell = mrBase.GetMainViewShell();
1501 if (pViewShell != nullptr)
1502 {
1503 vcl::Window* pWindow = pViewShell->GetActiveWindow();
1504 if (pWindow != nullptr)
1505 {
1506 // Forward the focus so that the window is called directly the
1507 // next time.
1508 pWindow->GrabFocus();
1509 // Forward the key press as well.
1510 pWindow->KeyInput(rKEvt);
1511 }
1512 }
1513}
1514
1515void FocusForwardingWindow::Command (const CommandEvent& rEvent)
1516{
1517 std::shared_ptr<ViewShell> pViewShell = mrBase.GetMainViewShell();
1518 if (pViewShell != nullptr)
1519 {
1520 vcl::Window* pWindow = pViewShell->GetActiveWindow();
1521 if (pWindow != nullptr)
1522 {
1523 pWindow->Command(rEvent);
1524 }
1525 }
1526}
1527
1528} // end of anonymous namespace
1529
1530} // end of namespace sd
1531
1532/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
static const AllSettings & GetSettings()
void DrawSelectionXOR(OutlinerViewShell *pOtherShell)
void RegisterOtherShell(OutlinerViewShell *pOtherShell)
void ShowCursor(bool bGotoCursor=true, bool bForceVisCursor=true, bool bActivate=false)
MapUnit GetMapUnit() const
EditView & GetEditView() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
Definition: drawdoc2.cxx:207
void StopWorkStartupDelay()
Definition: drawdoc2.cxx:932
SAL_DLLPRIVATE bool IsStartWithPresentation() const
Definition: drawdoc.hxx:287
bool IsTabBarVisible() const
Definition: optsitem.hxx:257
void SetTabBarVisible(bool bOn)
Definition: optsitem.hxx:300
sal_uInt16 GetPaperBin() const
Definition: sdpage.hxx:278
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
SdrTextObj * GetTextEditObject() const
const OutlinerView * GetTextEditOutlinerView() const
bool IsBackgroundFullSize() const
void Invalidate(sal_uInt16 nId)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SfxEventHintId GetEventId() const
SfxHintId GetId() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static void notifyOtherView(const SfxViewShell *pThisView, SfxViewShell const *pOtherView, int nType, std::string_view rKey, const OString &rPayload)
static void notifyOtherViews(const SfxViewShell *pThisView, int nType, std::string_view rKey, const OString &rPayload)
void SetWaitCursor(bool bSet) const
virtual tools::Rectangle GetVisArea(sal_uInt16 nAspect) const
sal_uInt16 GetSlot() const
void Ignore()
const SfxItemSet * GetArgs() const
void Done(bool bRemove=false)
SfxViewFrame * GetFrame() const
SfxViewShell * GetViewShell() const
vcl::Window & GetWindow() const
SfxBindings & GetBindings()
void Resize(bool bForce=false)
SfxDispatcher * GetDispatcher()
virtual bool PrepareClose(bool bUI=true)
VclPtr< vcl::Window > pWindow
void InvalidateBorder()
virtual void Activate(bool IsMDIActivate) override
virtual void WriteUserData(OUString &, bool bBrowse=false)
css::uno::Reference< css::frame::XController > GetController() const
virtual OUString GetSelectionText(bool bCompleteWords=false, bool bOnlyASample=false)
void SetBorderPixel(const SvBorder &rBorder)
virtual void UIActivating(SfxInPlaceClient *pClient)
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY)
SfxViewFrame & GetViewFrame() const
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
virtual void ReadUserData(const OUString &, bool bBrowse=false)
virtual bool HasSelection(bool bText=true) const
const SvBorder & GetBorderPixel() const
virtual SfxObjectShell * GetObjectShell() override
virtual SdrView * GetDrawView() const
void SetWindow(vcl::Window *pViewPort)
vcl::Window * GetWindow() const
virtual void UIDeactivated(SfxInPlaceClient *pClient)
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
bool IsEmpty() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
tools::Long & Left()
tools::Long & Top()
tools::Long & Right()
tools::Long & Bottom()
static VclPtr< reference_type > Create(Arg &&... arg)
The DrawController is the UNO controller for Impress and Draw.
void SetPrinter(SfxPrinter *pNewPrinter)
Set new SfxPrinter (transfer of ownership)
Definition: docshel4.cxx:142
SfxPrinter * GetPrinter(bool bCreate)
Creates (if necessary) and returns a SfxPrinter.
Definition: docshel4.cxx:95
SdDrawDocument * GetDoc()
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
OUString GetSelectionText(bool bCompleteWords)
Definition: drviewsf.cxx:777
EditMode GetEditMode() const
bool HasSelection(bool bText) const
Definition: drviewsf.cxx:803
DrawView * GetDrawView() const
PageKind GetPageKind() const
Derivative of sd::View; contains also a pointer to the document.
Definition: drawview.hxx:35
View for MDIFrame.
Definition: FrameView.hxx:36
ViewShell::ShellType GetViewShellTypeOnLoad() const
Definition: FrameView.hxx:150
PageKind GetPageKindOnLoad() const
can be used to get the page kind that was selected on last save of this document
Definition: FrameView.hxx:93
EditMode GetViewShEditModeOnLoad() const
Return the value of the edit mode as it was when the document was loaded.
Definition: FrameView.hxx:116
void SetViewShellTypeOnLoad(ViewShell::ShellType eType)
Remember the type of the view shell at the time when the document is loaded or, rather,...
Definition: frmview.cxx:902
void SetPageKind(PageKind eKind)
Definition: FrameView.hxx:85
sal_uInt16 GetSelectedPageOnLoad() const
can be used to get the page that was selected on last save of this document
Definition: FrameView.hxx:103
void SetViewShEditMode(EditMode eMode)
Set EditMode (Page or MasterPage) of working mode.
Definition: frmview.cxx:326
static void GetSlotState(SfxItemSet &rSet, ViewShell const *pViewShell, SfxViewFrame *pViewFrame)
Definition: fubullet.cxx:276
static void Stop(ViewShellBase const &rBase)
Definition: slideshow.cxx:201
static rtl::Reference< SlideShow > GetSlideShow(SdDrawDocument const *pDocument)
Definition: slideshow.cxx:157
static std::shared_ptr< ToolBarManager > Create(ViewShellBase &rBase, const std::shared_ptr< tools::EventMultiplexer > &rpMultiplexer, const std::shared_ptr< ViewShellManager > &rpViewShellManager)
Use this method instead of the constructor to create new objects of this class.
std::shared_ptr< ViewShellManager > mpViewShellManager
void ShowViewTabBar(bool bShow)
Show or hide the ViewTabBar.
::rtl::Reference< DrawController > mpController
Main controller of the view shell.
::rtl::Reference< ViewTabBar > mpViewTabBar
The view tab bar is the control for switching between different views in one pane.
void ResizePixel(const Point &rOrigin, const Size &rSize, bool bOuterResize)
Common code of ViewShellBase::OuterResizePixel() and ViewShellBase::InnerResizePixel().
void GetSlotState(SfxItemSet &rSet)
void SetPaneVisibility(const SfxRequest &rRequest, const OUString &rsPaneURL, const OUString &rsViewURL)
Show or hide the specified pane.
std::shared_ptr< slidesorter::cache::PageCacheManager > mpPageCacheManager
Hold a reference to the page cache manager of the slide sorter in order to ensure that it stays alive...
VclPtr< vcl::Window > mpViewWindow
The view window is the parent of all UI elements that belong to the view or ViewShell.
std::shared_ptr< ToolBarManager > mpToolBarManager
std::shared_ptr< FormShellManager > mpFormShellManager
std::shared_ptr< tools::EventMultiplexer > mpEventMultiplexer
Implementation(ViewShellBase &rBase)
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
DrawController * GetDrawController() const
void LateInit(const OUString &rsDefaultView)
This method is part of the object construction.
virtual void Execute(SfxRequest &rRequest)
Callback function for general slot calls.
::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const override
See SfxViewShell::GetColorConfigColor().
static ViewShellBase * GetViewShellBase(SfxViewFrame const *pFrame)
When given a view frame this static method returns the corresponding sd::ViewShellBase object.
OUString RetrieveLabelFromCommand(const OUString &aCmdURL) const
returns the ui descriptive name for the given uno slot.
OUString GetInitialViewShellType() const
Determine from the properties of the document shell the initial type of the view shell in the center ...
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY) override
void ShowUIControls(bool bVisible)
With this method the UI controls can be turned on or off.
virtual sal_uInt16 SetPrinter(SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags=SFX_PRINTER_ALL) override
Forwarded to the print manager.
virtual void InnerResizePixel(const Point &rOrigin, const Size &rSize, bool inplaceEditModeChange) override
virtual bool HasSelection(bool=true) const override
virtual ~ViewShellBase() override
In this destructor the order in which some of the members are destroyed (and/or being prepared to bei...
void setEditMode(int nMode)
See SfxViewShell::setEditMode().
void GetState(SfxItemSet &rSet)
Callback function for retrieving item values related to certain slots.
void SetBusyState(bool bBusy)
When <TRUE> is given, then the mouse shape is set to hour glass (or whatever the busy shape looks lik...
std::shared_ptr< ToolBarManager > const & GetToolBarManager() const
OUString GetColorConfigName() const override
See SfxViewShell::GetColorConfigName().
DrawDocShell * mpDocShell
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &) override
Forward methods to main sub shell.
const ::tools::Rectangle & getClientRectangle() const
returns the complete area of the current view relative to the frame window
virtual void UIDeactivated(SfxInPlaceClient *) override
virtual void Activate(bool IsMDIActivate) override
virtual void OuterResizePixel(const Point &rOrigin, const Size &rSize) override
std::unique_ptr< Implementation > mpImpl
virtual void ReadUserDataSequence(const css::uno::Sequence< css::beans::PropertyValue > &) override
Pass the given properties to the main view shell.
virtual OUString GetSelectionText(bool=false, bool bOnlyASample=false) override
SdDrawDocument * mpDocument
std::shared_ptr< ViewShell > GetMainViewShell() const
Return the main view shell stacked on the called ViewShellBase object.
virtual void UIActivating(SfxInPlaceClient *) override
void NotifyCursor(SfxViewShell *pViewShell) const override
See SfxViewShell::NotifyCursor().
int getPart() const override
See SfxViewShell::getPart().
int getEditMode() const override
See SfxViewShell::getEditMode().
virtual void InitializeFramework()
std::shared_ptr< tools::EventMultiplexer > const & GetEventMultiplexer() const
Return an event multiplexer.
SvBorder GetBorder(bool bOuterResize)
virtual SfxPrinter * GetPrinter(bool bCreate=false) override
Forwarded to the print manager.
std::shared_ptr< FormShellManager > const & GetFormShellManager() const
virtual ErrCode DoVerb(sal_Int32 nVerb) override
This call is forwarded to the main sub-shell.
virtual css::uno::Reference< css::view::XRenderable > GetRenderable() override
Return a new renderer that can be used for example for printing the document.
vcl::Window * GetViewWindow()
Return the window that is used by the main view shell to display its view and other UI elements,...
ViewShellBase(SfxViewFrame &rFrame, SfxViewShell *pOldShell)
This constructor is used by the view factory of the SFX macros.
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
std::shared_ptr< ViewShellManager > const & GetViewShellManager() const
void UpdateBorder(bool bForce=false)
Update the border that is set with SfxViewShell::SetBorderPixel().
virtual bool PrepareClose(bool bUI=true) override
void Rearrange()
Call this method when the controls of this view shell or the embedded sub shell need to be rearranged...
virtual void ReadUserData(const OUString &, bool bBrowse=false) override
void afterCallbackRegistered() override
See SfxViewShell::afterCallbackRegistered().
virtual void WriteUserData(OUString &, bool bBrowse=false) override
DrawDocShell * GetDocShell() const
virtual SdrView * GetDrawView() const override
SdDrawDocument * GetDocument() const
void SetViewTabBar(const ::rtl::Reference< ViewTabBar > &rViewTabBar)
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
void ReadUserData()
Definition: viewshe2.cxx:798
virtual void ShowUIControls(bool bVisible)
Show controls of the UI or hide them, depending on the given flag.
Definition: viewshel.cxx:1518
FrameView * GetFrameView()
Definition: ViewShell.hxx:221
virtual ErrCode DoVerb(sal_Int32 nVerb)
This function is called from the underlying ViewShellBase object to handle a verb execution request.
Definition: viewshel.cxx:1417
virtual void ReadUserDataSequence(const css::uno::Sequence< css::beans::PropertyValue > &)
Definition: viewshe2.cxx:897
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
Definition: ViewShell.hxx:155
SvBorder GetBorder()
Return the border that is drawn around the actual document view.
Definition: viewshel.cxx:934
virtual bool PrepareClose(bool bUI=true)
Tell the FmFormShell that the view shell is closing.
Definition: viewshel.cxx:1076
void WriteUserData()
Definition: viewshe2.cxx:805
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &)
Definition: viewshe2.cxx:878
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY)
Set zoom factor for InPlace.
Definition: viewshe2.cxx:543
virtual void UIActivating(SfxInPlaceClient *)
Definition: viewshel.cxx:338
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
Definition: viewshel.cxx:1397
virtual void UIDeactivated(SfxInPlaceClient *)
Definition: viewshel.cxx:344
SD_DLLPUBLIC ShellType GetShellType() const
Return the type of the shell.
Definition: viewshel.cxx:1402
SdrView * GetDrawView() const
Definition: ViewShell.hxx:552
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
The configuration controller is responsible for maintaining the current configuration.
virtual css::uno::Reference< css::drawing::framework::XResource > SAL_CALL getResource(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId) override
virtual sal_Bool SAL_CALL hasPendingRequests() override
static const OUString msHandoutViewURL
static const OUString msCenterPaneURL
static const OUString msLeftDrawPaneURL
static const OUString msNotesViewURL
static const OUString msSlideSorterURL
static ::std::shared_ptr< FrameworkHelper > Instance(ViewShellBase &rBase)
Return the FrameworkHelper object that is associated with the given ViewShellBase.
static const OUString msLeftImpressPaneURL
static const OUString msImpressViewURL
static const OUString msFullScreenPaneURL
static void CloseMethod(SfxBindings &rBindings)
constexpr Size GetSize() const
rtl::OString toString() const
virtual void dispose() override
vcl::Window * GetParent() const
const MapMode & GetMapMode() const
void SetBackground()
#define DBG_UNHANDLED_EXCEPTION(...)
virtual SfxBindings & GetBindings() override
SFX_IMPL_SUPERCLASS_INTERFACE(DrawDocShell, SfxObjectShell)
#define ERRCODE_NONE
SfxHintId
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
@ Exception
constexpr auto toTwips(N number, Length from)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
void dispose()
long Long
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
HashMap_OWString_Interface aMap
const char GetValue[]
PageKind
Definition: pres.hxx:45
#define SD_MOD()
Definition: sdmod.hxx:184
static SfxItemSet & rSet
View options for the current view.
Definition: viewopt.hxx:25
Color mnDocBackgroundColor
Definition: viewopt.hxx:29
OUString msColorSchemeName
Definition: viewopt.hxx:31
SvxTableController * mpController
bool bVisible
constexpr OUStringLiteral sUNO_View_PageKind
Definition: unokywds.hxx:71
#define O3TL_UNREACHABLE
SfxPrinterChangeFlags
SfxViewShellFlags
sal_Int64 WinBits
WinBits const WB_DIALOGCONTROL
WinBits const WB_CLIPCHILDREN