1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <comphelper/processfactory.hxx>
22 #include <ViewShellBase.hxx>
24 #include <EventMultiplexer.hxx>
25 #include <cache/SlsPageCacheManager.hxx>
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>
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>
45 #include <framework/ConfigurationController.hxx>
46 #include <DocumentRenderer.hxx>
47 #include <optsitem.hxx>
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>
57 #include <framework/FrameworkHelper.hxx>
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>
65 #include <vcl/commandinfoprovider.hxx>
66 #include <vcl/settings.hxx>
67 #include <vcl/svapp.hxx>
69 #include <sfx2/notebookbar/SfxNotebookBar.hxx>
71 #include <comphelper/diagnose_ex.hxx>
72 #include <sfx2/lokhelper.hxx>
73 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
74 #include <editeng/editview.hxx>
75 #include <tools/svborder.hxx>
77 #include <fubullet.hxx>
78 #include <drawview.hxx>
81 #define ShellClass_ViewShellBase
82 #include <sdslots.hxx>
84 using ::sd::framework::FrameworkHelper
;
86 using namespace com::sun::star
;
87 using namespace com::sun::star::beans
;
88 using namespace com::sun::star::container
;
89 using namespace com::sun::star::drawing::framework
;
90 using namespace com::sun::star::lang
;
91 using namespace com::sun::star::uno
;
95 class CurrentPageSetter
98 explicit CurrentPageSetter (ViewShellBase
& rBase
);
99 void operator () (bool);
101 ViewShellBase
& mrBase
;
104 } // end of anonymous namespace
108 class ViewShellBase::Implementation
111 /** Main controller of the view shell. During the switching from one
112 stacked shell to another this pointer may be NULL.
114 ::rtl::Reference
<DrawController
> mpController
;
116 /** The view tab bar is the control for switching between different
119 ::rtl::Reference
<ViewTabBar
> mpViewTabBar
;
121 // contains the complete area of the current view relative to the frame window
122 ::tools::Rectangle maClientArea
;
124 // This is set to true when PrepareClose() is called.
127 /** The view window is the parent of all UI elements that belong to the
128 view or ViewShell. This comprises the rulers, the scroll bars, and
130 It does not include the ViewTabBar.
132 VclPtr
<vcl::Window
> mpViewWindow
;
133 std::shared_ptr
<ToolBarManager
> mpToolBarManager
;
134 std::shared_ptr
<ViewShellManager
> mpViewShellManager
;
135 std::shared_ptr
<tools::EventMultiplexer
> mpEventMultiplexer
;
136 std::shared_ptr
<FormShellManager
> mpFormShellManager
;
138 explicit Implementation (ViewShellBase
& rBase
);
143 /** Show or hide the ViewTabBar.
145 When <TRUE/> then the ViewTabBar is shown, otherwise it is hidden.
147 void ShowViewTabBar (bool bShow
);
149 void SetUserWantsTabBar(bool inValue
);
150 bool GetUserWantsTabBar() const { return mbUserWantsTabBar
; }
152 /** Common code of ViewShellBase::OuterResizePixel() and
153 ViewShellBase::InnerResizePixel().
156 const Point
& rOrigin
,
160 /** Show or hide the specified pane. The visibility state is taken
161 from the given request.
163 The request determines the new visibility state. The state can
164 either be toggled or be set to a given value.
166 This URL specifies the pane whose visibility state to set.
168 When the pane becomes visible then this view URL specifies which
169 type of view to show in it.
171 void SetPaneVisibility (
172 const SfxRequest
& rRequest
,
173 const OUString
& rsPaneURL
,
174 const OUString
& rsViewURL
);
176 void GetSlotState (SfxItemSet
& rSet
);
178 void ProcessRestoreEditingViewSlot();
181 ViewShellBase
& mrBase
;
182 bool mbUserWantsTabBar
;
183 bool mbTabBarShouldBeVisible
;
184 /** Hold a reference to the page cache manager of the slide sorter in
185 order to ensure that it stays alive while the ViewShellBase is
188 std::shared_ptr
<slidesorter::cache::PageCacheManager
> mpPageCacheManager
;
192 /** The only task of this window is to forward key presses to the content
193 window of the main view shell. With the key press it forwards the focus
194 so that it is not called very often.
196 class FocusForwardingWindow
: public vcl::Window
199 FocusForwardingWindow (vcl::Window
& rParentWindow
, ViewShellBase
& rBase
);
200 virtual ~FocusForwardingWindow() override
;
201 virtual void dispose() override
;
202 virtual void KeyInput (const KeyEvent
& rEvent
) override
;
203 virtual void Command (const CommandEvent
& rEvent
) override
;
206 ViewShellBase
& mrBase
;
208 } // end of anonymous namespace
210 //===== ViewShellBase =========================================================
213 // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
214 // new ViewShellBase object has been constructed.
216 SFX_IMPL_SUPERCLASS_INTERFACE(ViewShellBase
, SfxViewShell
)
218 void ViewShellBase::InitInterface_Impl()
222 ViewShellBase::ViewShellBase (
223 SfxViewFrame
& _rFrame
,
225 : SfxViewShell(_rFrame
, SfxViewShellFlags::HAS_PRINTOPTIONS
),
226 mpDocShell (nullptr),
229 mpImpl
.reset(new Implementation(*this));
230 mpImpl
->mpViewWindow
= VclPtr
<FocusForwardingWindow
>::Create(_rFrame
.GetWindow(),*this);
231 mpImpl
->mpViewWindow
->SetBackground(Wallpaper());
233 _rFrame
.GetWindow().SetBackground(Application::GetSettings().GetStyleSettings().GetLightColor());
235 // Set up the members in the correct order.
236 if (auto pDrawDocShell
= dynamic_cast< DrawDocShell
*>( GetViewFrame().GetObjectShell() ))
237 mpDocShell
= pDrawDocShell
;
238 if (mpDocShell
!= nullptr)
239 mpDocument
= mpDocShell
->GetDoc();
240 mpImpl
->mpViewShellManager
= std::make_shared
<ViewShellManager
>(*this);
242 SetWindow(mpImpl
->mpViewWindow
.get());
244 // Hide the window to avoid complaints from Sfx...SwitchViewShell...
245 _rFrame
.GetWindow().Hide();
248 /** In this destructor the order in which some of the members are destroyed
249 (and/or being prepared to being destroyed) is important. Change it only
250 when you know what you are doing.
252 ViewShellBase::~ViewShellBase()
254 // Notify other LOK views that we are going away.
255 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_VIEW_CURSOR_VISIBLE
, "visible", "false");
256 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_TEXT_VIEW_SELECTION
, "selection", "");
257 SfxLokHelper::notifyOtherViews(this, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION
, "selection", "EMPTY");
259 sfx2::SfxNotebookBar::CloseMethod(GetFrame()->GetBindings());
261 rtl::Reference
<SlideShow
> xSlideShow(SlideShow::GetSlideShow(*this));
262 if (xSlideShow
.is() && xSlideShow
->dependsOn(this))
263 SlideShow::Stop(*this);
266 // Tell the controller that the ViewShellBase is not available anymore.
267 if (mpImpl
->mpController
)
268 mpImpl
->mpController
->ReleaseViewShellBase();
270 // We have to hide the main window to prevent SFX complaining after a
271 // reload about it being already visible.
272 ViewShell
* pShell
= GetMainViewShell().get();
274 && pShell
->GetActiveWindow()!=nullptr
275 && pShell
->GetActiveWindow()->GetParent()!=nullptr)
277 pShell
->GetActiveWindow()->GetParent()->Hide();
280 mpImpl
->mpToolBarManager
->Shutdown();
281 mpImpl
->mpViewShellManager
->Shutdown();
283 EndListening(GetViewFrame());
284 EndListening(*GetDocShell());
288 mpImpl
->mpFormShellManager
.reset();
291 void ViewShellBase::LateInit (const OUString
& rsDefaultView
)
293 StartListening(GetViewFrame(), DuplicateHandling::Prevent
);
294 StartListening(*GetDocShell(), DuplicateHandling::Prevent
);
296 InitializeFramework();
298 mpImpl
->mpEventMultiplexer
= std::make_shared
<tools::EventMultiplexer
>(*this);
300 mpImpl
->mpFormShellManager
= std::make_shared
<FormShellManager
>(*this);
302 mpImpl
->mpToolBarManager
= ToolBarManager::Create(
304 mpImpl
->mpEventMultiplexer
,
305 mpImpl
->mpViewShellManager
);
309 rtl::Reference
<::sd::DrawController
> xControllerManager (GetDrawController());
310 Reference
<XConfigurationController
> xConfigurationController
;
311 if (xControllerManager
)
312 xConfigurationController
= xControllerManager
->getConfigurationController();
313 if (xConfigurationController
.is())
315 OUString
sView (rsDefaultView
);
317 sView
= GetInitialViewShellType();
319 FrameworkHelper::Instance(*this);
321 // Create the resource ids for the center pane and view.
322 const Reference
<drawing::framework::XResourceId
> xCenterPaneId (
323 FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL
));
324 const Reference
<drawing::framework::XResourceId
> xCenterViewId (
325 FrameworkHelper::CreateResourceId(sView
, xCenterPaneId
));
327 // Request center pane and view.
328 xConfigurationController
->requestResourceActivation(xCenterPaneId
, ResourceActivationMode_ADD
);
329 xConfigurationController
->requestResourceActivation(xCenterViewId
, ResourceActivationMode_REPLACE
);
331 // Process configuration events synchronously until the center view
333 sd::framework::ConfigurationController
* pConfigurationController
334 = dynamic_cast<sd::framework::ConfigurationController
*>(xConfigurationController
.get());
335 if (pConfigurationController
!= nullptr)
338 ! pConfigurationController
->getResource(xCenterViewId
).is()
339 && pConfigurationController
->hasPendingRequests())
341 pConfigurationController
->ProcessEvent();
346 catch (const RuntimeException
&)
350 // AutoLayouts have to be ready.
351 GetDocument()->StopWorkStartupDelay();
355 // Remember the type of the current main view shell in the frame view.
356 ViewShell
* pViewShell
= GetMainViewShell().get();
357 if (pViewShell
!= nullptr)
359 FrameView
* pFrameView
= pViewShell
->GetFrameView();
360 if (pFrameView
!= nullptr)
361 pFrameView
->SetViewShellTypeOnLoad(pViewShell
->GetShellType());
363 // Show/Hide the TabBar
364 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(GetDocument()->GetDocumentType());
365 bool bIsTabBarVisible
= pOptions
->IsTabBarVisible();
366 mpImpl
->SetUserWantsTabBar( bIsTabBarVisible
);
369 std::shared_ptr
<ViewShellManager
> const & ViewShellBase::GetViewShellManager() const
371 return mpImpl
->mpViewShellManager
;
374 std::shared_ptr
<ViewShell
> ViewShellBase::GetMainViewShell() const
376 std::shared_ptr
<ViewShell
> pMainViewShell (
377 framework::FrameworkHelper::Instance(*const_cast<ViewShellBase
*>(this))
378 ->GetViewShell(framework::FrameworkHelper::msCenterPaneURL
));
379 if (pMainViewShell
== nullptr)
380 pMainViewShell
= framework::FrameworkHelper::Instance(*const_cast<ViewShellBase
*>(this))
381 ->GetViewShell(framework::FrameworkHelper::msFullScreenPaneURL
);
382 return pMainViewShell
;
385 ViewShellBase
* ViewShellBase::GetViewShellBase (SfxViewFrame
const * pViewFrame
)
387 ViewShellBase
* pBase
= nullptr;
389 if (pViewFrame
!= nullptr)
391 // Get the view shell for the frame and cast it to
392 // sd::ViewShellBase.
393 SfxViewShell
* pSfxViewShell
= pViewFrame
->GetViewShell();
394 pBase
= dynamic_cast< ::sd::ViewShellBase
*>( pSfxViewShell
);
400 void ViewShellBase::Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
)
402 SfxViewShell::Notify(rBC
, rHint
);
404 const SfxEventHint
* pEventHint
= dynamic_cast<const SfxEventHint
*>(&rHint
);
407 switch (pEventHint
->GetEventId())
409 case SfxEventHintId::OpenDoc
:
410 if( GetDocument() && GetDocument()->IsStartWithPresentation() )
412 GetViewFrame().GetDispatcher()->Execute(
413 SID_PRESENTATION
, SfxCallMode::ASYNCHRON
);
423 const SfxHintId nSlot
= rHint
.GetId();
426 case SfxHintId::LanguageChanged
:
428 GetViewFrame().GetBindings().Invalidate(SID_LANGUAGE_STATUS
);
438 void ViewShellBase::InitializeFramework()
442 OUString
ViewShellBase::GetSelectionText(bool bCompleteWords
, bool /*bOnlyASample*/)
444 std::shared_ptr
<ViewShell
> const pMainShell(GetMainViewShell());
445 DrawViewShell
*const pDrawViewShell(
446 dynamic_cast<DrawViewShell
*>(pMainShell
.get()));
447 return pDrawViewShell
448 ? pDrawViewShell
->GetSelectionText(bCompleteWords
)
449 : SfxViewShell::GetSelectionText(bCompleteWords
);
452 bool ViewShellBase::HasSelection(bool bText
) const
454 std::shared_ptr
<ViewShell
> const pMainShell(GetMainViewShell());
455 DrawViewShell
*const pDrawViewShell(
456 dynamic_cast<DrawViewShell
*>(pMainShell
.get()));
457 return pDrawViewShell
458 ? pDrawViewShell
->HasSelection(bText
)
459 : SfxViewShell::HasSelection(bText
);
462 void ViewShellBase::InnerResizePixel (const Point
& rOrigin
, const Size
&rSize
, bool)
464 Size aObjSize
= GetObjectShell()->GetVisArea().GetSize();
465 if ( !aObjSize
.IsEmpty() )
467 SvBorder
aBorder( GetBorderPixel() );
469 aSize
.AdjustWidth( -(aBorder
.Left() + aBorder
.Right()) );
470 aSize
.AdjustHeight( -(aBorder
.Top() + aBorder
.Bottom()) );
471 Size aObjSizePixel
= mpImpl
->mpViewWindow
->LogicToPixel(aObjSize
, MapMode(MapUnit::Map100thMM
));
472 SfxViewShell::SetZoomFactor(
473 Fraction( aSize
.Width(), std::max( aObjSizePixel
.Width(), static_cast<::tools::Long
>(1) ) ),
474 Fraction( aSize
.Height(), std::max( aObjSizePixel
.Height(), static_cast<::tools::Long
>(1)) ) );
477 mpImpl
->ResizePixel(rOrigin
, rSize
, false);
480 void ViewShellBase::OuterResizePixel (const Point
& rOrigin
, const Size
&rSize
)
482 mpImpl
->ResizePixel (rOrigin
, rSize
, true);
485 void ViewShellBase::Rearrange()
487 // There is a bug in the communication between embedded objects and the
488 // framework::LayoutManager that leads to missing resize updates. The
489 // following workaround enforces such an update by cycling the border to
490 // zero and back to the current value.
491 if (GetWindow() != nullptr)
493 SetBorderPixel(SvBorder());
498 SAL_WARN("sd.view", "Rearrange: window missing");
501 GetViewFrame().Resize(true);
504 ErrCode
ViewShellBase::DoVerb(sal_Int32 nVerb
)
506 ErrCode aResult
= ERRCODE_NONE
;
508 ::sd::ViewShell
* pShell
= GetMainViewShell().get();
509 if (pShell
!= nullptr)
510 aResult
= pShell
->DoVerb(nVerb
);
515 Reference
<view::XRenderable
> ViewShellBase::GetRenderable()
517 // Create a new DocumentRenderer on every call. It observes the life
518 // time of this ViewShellBase object.
519 return Reference
<view::XRenderable
>(new DocumentRenderer(*this));
522 SfxPrinter
* ViewShellBase::GetPrinter (bool bCreate
)
524 OSL_ASSERT(mpImpl
!= nullptr);
526 return GetDocShell()->GetPrinter (bCreate
);
529 sal_uInt16
ViewShellBase::SetPrinter (
530 SfxPrinter
* pNewPrinter
,
531 SfxPrinterChangeFlags nDiffFlags
)
533 OSL_ASSERT(mpImpl
!= nullptr);
535 GetDocShell()->SetPrinter(pNewPrinter
);
537 if ( (nDiffFlags
& SfxPrinterChangeFlags::CHG_ORIENTATION
||
538 nDiffFlags
& SfxPrinterChangeFlags::CHG_SIZE
) && pNewPrinter
)
540 MapMode aMap
= pNewPrinter
->GetMapMode();
541 aMap
.SetMapUnit(MapUnit::Map100thMM
);
542 MapMode aOldMap
= pNewPrinter
->GetMapMode();
543 pNewPrinter
->SetMapMode(aMap
);
544 Size aNewSize
= pNewPrinter
->GetOutputSize();
546 std::shared_ptr
<DrawViewShell
> pDrawViewShell (
547 std::dynamic_pointer_cast
<DrawViewShell
>(GetMainViewShell()));
550 SdPage
* pPage
= GetDocument()->GetSdPage(
551 0, PageKind::Standard
);
552 pDrawViewShell
->SetPageSizeAndBorder (
553 pDrawViewShell
->GetPageKind(),
557 pNewPrinter
->GetOrientation(),
558 pPage
->GetPaperBin(),
559 pPage
->IsBackgroundFullSize());
562 pNewPrinter
->SetMapMode(aOldMap
);
568 void ViewShellBase::UIActivating( SfxInPlaceClient
* pClient
)
570 mpImpl
->ShowViewTabBar(false);
572 ViewShell
* pViewShell
= GetMainViewShell().get();
574 pViewShell
->UIActivating( pClient
);
576 SfxViewShell::UIActivating( pClient
);
579 void ViewShellBase::UIDeactivated( SfxInPlaceClient
* pClient
)
581 SfxViewShell::UIDeactivated( pClient
);
583 mpImpl
->ShowViewTabBar(true);
585 ViewShell
* pViewShell
= GetMainViewShell().get();
587 pViewShell
->UIDeactivated( pClient
);
590 SvBorder
ViewShellBase::GetBorder (bool )
593 if (mpImpl
->mpViewTabBar
.is() && mpImpl
->mpViewTabBar
->GetTabControl()->IsVisible())
594 nTop
= mpImpl
->mpViewTabBar
->GetHeight();
595 return SvBorder(0,nTop
,0,0);
598 void ViewShellBase::Execute (SfxRequest
& rRequest
)
600 sal_uInt16 nSlotId
= rRequest
.GetSlot();
604 case SID_SWITCH_SHELL
:
606 Reference
<XControllerManager
> xControllerManager (GetController(), UNO_QUERY
);
607 if (xControllerManager
.is())
609 Reference
<XConfigurationController
> xConfigurationController (
610 xControllerManager
->getConfigurationController());
611 if (xConfigurationController
.is())
612 xConfigurationController
->update();
617 case SID_LEFT_PANE_DRAW
:
618 mpImpl
->SetPaneVisibility(
620 framework::FrameworkHelper::msLeftDrawPaneURL
,
621 framework::FrameworkHelper::msSlideSorterURL
);
624 case SID_LEFT_PANE_IMPRESS
:
625 mpImpl
->SetPaneVisibility(
627 framework::FrameworkHelper::msLeftImpressPaneURL
,
628 framework::FrameworkHelper::msSlideSorterURL
);
631 case SID_TOGGLE_TABBAR_VISIBILITY
:
633 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(GetDocument()->GetDocumentType());
634 bool bIsTabBarVisible
= pOptions
->IsTabBarVisible();
635 pOptions
->SetTabBarVisible( !bIsTabBarVisible
);
636 mpImpl
->SetUserWantsTabBar( !bIsTabBarVisible
);
642 case SID_DRAWINGMODE
:
644 case SID_NORMAL_MULTI_PANE_GUI
:
646 case SID_OUTLINE_MODE
:
647 case SID_SLIDE_SORTER_MULTI_PANE_GUI
:
648 case SID_SLIDE_SORTER_MODE
:
650 case SID_SLIDE_MASTER_MODE
:
651 case SID_NOTES_MASTER_MODE
:
652 case SID_HANDOUT_MASTER_MODE
:
653 framework::FrameworkHelper::Instance(*this)->HandleModeChangeSlot(nSlotId
, rRequest
);
656 case SID_WIN_FULLSCREEN
:
657 // The full screen mode is not supported. Ignore the request.
660 case SID_RESTORE_EDITING_VIEW
:
661 mpImpl
->ProcessRestoreEditingViewSlot();
665 // Ignore any other slot.
671 void ViewShellBase::GetState (SfxItemSet
& rSet
)
673 mpImpl
->GetSlotState(rSet
);
675 FuBullet::GetSlotState( rSet
, nullptr, &GetViewFrame() );
678 void ViewShellBase::WriteUserDataSequence (
679 css::uno::Sequence
< css::beans::PropertyValue
>& rSequence
)
681 // Forward call to main sub shell.
682 ViewShell
* pShell
= GetMainViewShell().get();
683 if (pShell
!= nullptr)
684 pShell
->WriteUserDataSequence (rSequence
);
687 void ViewShellBase::ReadUserDataSequence (
688 const css::uno::Sequence
< css::beans::PropertyValue
>& rSequence
)
690 // Forward call to main sub shell.
691 ViewShell
* pShell
= GetMainViewShell().get();
692 if (pShell
== nullptr)
695 pShell
->ReadUserDataSequence (rSequence
);
697 // For certain shell types ReadUserDataSequence may have changed the
698 // type to another one. Make sure that the center pane shows the
700 switch (pShell
->GetShellType())
702 case ViewShell::ST_IMPRESS
:
703 case ViewShell::ST_NOTES
:
704 case ViewShell::ST_HANDOUT
:
707 switch (dynamic_cast<DrawViewShell
&>(*pShell
).GetPageKind())
710 case PageKind::Standard
:
711 sViewURL
= framework::FrameworkHelper::msImpressViewURL
;
713 case PageKind::Notes
:
714 sViewURL
= framework::FrameworkHelper::msNotesViewURL
;
716 case PageKind::Handout
:
717 sViewURL
= framework::FrameworkHelper::msHandoutViewURL
;
720 if (!sViewURL
.isEmpty())
721 framework::FrameworkHelper::Instance(*this)->RequestView(
723 framework::FrameworkHelper::msCenterPaneURL
);
732 void ViewShellBase::Activate (bool bIsMDIActivate
)
734 SfxViewShell::Activate(bIsMDIActivate
);
736 Reference
<XControllerManager
> xControllerManager (GetController(), UNO_QUERY
);
737 if (xControllerManager
.is())
739 Reference
<XConfigurationController
> xConfigurationController (
740 xControllerManager
->getConfigurationController());
741 if (xConfigurationController
.is())
742 xConfigurationController
->update();
744 GetToolBarManager()->RequestUpdate();
747 void ViewShellBase::SetZoomFactor (
748 const Fraction
&rZoomX
,
749 const Fraction
&rZoomY
)
751 SfxViewShell::SetZoomFactor (rZoomX
, rZoomY
);
752 // Forward call to main sub shell.
753 ViewShell
* pShell
= GetMainViewShell().get();
754 if (pShell
!= nullptr)
755 pShell
->SetZoomFactor (rZoomX
, rZoomY
);
758 bool ViewShellBase::PrepareClose (bool bUI
)
760 bool bResult
= SfxViewShell::PrepareClose (bUI
);
764 mpImpl
->mbIsClosing
= true;
766 // Forward call to main sub shell.
767 ViewShell
* pShell
= GetMainViewShell().get();
768 if (pShell
!= nullptr)
769 bResult
= pShell
->PrepareClose (bUI
);
775 void ViewShellBase::WriteUserData (OUString
& rString
, bool bBrowse
)
777 SfxViewShell::WriteUserData (rString
, bBrowse
);
779 // Forward call to main sub shell.
780 ViewShell
* pShell
= GetMainViewShell().get();
781 if (pShell
!= nullptr)
782 pShell
->WriteUserData();
785 void ViewShellBase::ReadUserData (const OUString
& rString
, bool bBrowse
)
787 SfxViewShell::ReadUserData (rString
, bBrowse
);
789 // Forward call to main sub shell.
790 ViewShell
* pShell
= GetMainViewShell().get();
791 if (pShell
!= nullptr)
792 pShell
->ReadUserData();
795 SdrView
* ViewShellBase::GetDrawView() const
797 // Forward call to main sub shell.
798 ViewShell
* pShell
= GetMainViewShell().get();
799 if (pShell
!= nullptr)
800 return pShell
->GetDrawView ();
802 return SfxViewShell::GetDrawView();
805 void ViewShellBase::SetBusyState (bool bBusy
)
807 if (GetDocShell() != nullptr)
808 GetDocShell()->SetWaitCursor (bBusy
);
811 void ViewShellBase::UpdateBorder ( bool bForce
/* = false */ )
813 // The following calls to SetBorderPixel() and InvalidateBorder() are
814 // made only for the main view shell. This not only avoids unnecessary
815 // calls for the views in side panes but prevents calling an already
816 // dying SfxViewShell base class.
817 // We have to check the existence of the window, too.
818 // The SfxViewFrame accesses the window without checking it.
819 ViewShell
* pMainViewShell
= GetMainViewShell().get();
820 if (pMainViewShell
== nullptr || GetWindow()==nullptr)
823 SvBorder
aCurrentBorder (GetBorderPixel());
824 bool bOuterResize ( ! GetDocShell()->IsInPlaceActive());
825 SvBorder
aBorder (GetBorder(bOuterResize
));
826 aBorder
+= pMainViewShell
->GetBorder();
828 if (bForce
|| (aBorder
!= aCurrentBorder
))
830 SetBorderPixel (aBorder
);
835 void ViewShellBase::ShowUIControls (bool bVisible
)
837 mpImpl
->ShowViewTabBar(bVisible
);
839 ViewShell
* pMainViewShell
= GetMainViewShell().get();
840 if (pMainViewShell
!= nullptr)
841 pMainViewShell
->ShowUIControls (bVisible
);
848 OUString
ViewShellBase::GetInitialViewShellType() const
850 OUString
sRequestedView (FrameworkHelper::msImpressViewURL
);
854 Reference
<document::XViewDataSupplier
> xViewDataSupplier (
855 GetDocShell()->GetModel(), UNO_QUERY
);
856 if ( ! xViewDataSupplier
.is())
859 Reference
<container::XIndexAccess
> xViewData (xViewDataSupplier
->getViewData());
860 if ( ! xViewData
.is())
862 if (xViewData
->getCount() == 0)
865 css::uno::Any aAny
= xViewData
->getByIndex(0);
866 Sequence
<beans::PropertyValue
> aProperties
;
867 if ( ! (aAny
>>= aProperties
))
870 // Search the properties for the one that tells us what page kind to
872 auto pProperty
= std::find_if(std::cbegin(aProperties
), std::cend(aProperties
),
873 [](const beans::PropertyValue
& rProperty
) { return rProperty
.Name
== sUNO_View_PageKind
; });
874 if (pProperty
!= std::cend(aProperties
))
876 sal_Int16 nPageKind
= 0;
877 pProperty
->Value
>>= nPageKind
;
878 switch (static_cast<PageKind
>(nPageKind
))
880 case PageKind::Standard
:
881 sRequestedView
= FrameworkHelper::msImpressViewURL
;
884 case PageKind::Handout
:
885 sRequestedView
= FrameworkHelper::msHandoutViewURL
;
888 case PageKind::Notes
:
889 sRequestedView
= FrameworkHelper::msNotesViewURL
;
893 // The page kind is invalid. This is probably an
894 // error by the caller. We use the standard type to
895 // keep things going.
896 SAL_WARN( "sd.view", "ViewShellBase::GetInitialViewShellType: invalid page kind");
897 sRequestedView
= FrameworkHelper::msImpressViewURL
;
904 return sRequestedView
;
907 std::shared_ptr
<tools::EventMultiplexer
> const & ViewShellBase::GetEventMultiplexer() const
909 OSL_ASSERT(mpImpl
!= nullptr);
910 OSL_ASSERT(mpImpl
->mpEventMultiplexer
!= nullptr);
912 return mpImpl
->mpEventMultiplexer
;
915 const ::tools::Rectangle
& ViewShellBase::getClientRectangle() const
917 return mpImpl
->maClientArea
;
920 std::shared_ptr
<ToolBarManager
> const & ViewShellBase::GetToolBarManager() const
922 OSL_ASSERT(mpImpl
!= nullptr);
923 OSL_ASSERT(mpImpl
->mpToolBarManager
!= nullptr);
925 return mpImpl
->mpToolBarManager
;
928 std::shared_ptr
<FormShellManager
> const & ViewShellBase::GetFormShellManager() const
930 OSL_ASSERT(mpImpl
!= nullptr);
931 OSL_ASSERT(mpImpl
->mpFormShellManager
!= nullptr);
933 return mpImpl
->mpFormShellManager
;
936 DrawController
* ViewShellBase::GetDrawController() const
938 OSL_ASSERT(mpImpl
!= nullptr);
940 return mpImpl
->mpController
.get();
943 void ViewShellBase::SetViewTabBar (const ::rtl::Reference
<ViewTabBar
>& rViewTabBar
)
945 OSL_ASSERT(mpImpl
!= nullptr);
947 mpImpl
->mpViewTabBar
= rViewTabBar
;
950 vcl::Window
* ViewShellBase::GetViewWindow()
952 OSL_ASSERT(mpImpl
!= nullptr);
954 return mpImpl
->mpViewWindow
.get();
957 OUString
ViewShellBase::RetrieveLabelFromCommand( const OUString
& aCmdURL
) const
959 OUString
aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface()));
960 auto aProperties
= vcl::CommandInfoProvider::GetCommandProperties(aCmdURL
, aModuleName
);
961 return vcl::CommandInfoProvider::GetLabelForCommand(aProperties
);
964 int ViewShellBase::getPart() const
966 ViewShell
* pViewShell
= framework::FrameworkHelper::Instance(*const_cast<ViewShellBase
*>(this))->GetViewShell(FrameworkHelper::msCenterPaneURL
).get();
968 if (DrawViewShell
* pDrawViewShell
= dynamic_cast<DrawViewShell
*>(pViewShell
))
970 return pDrawViewShell
->GetCurPagePos();
976 int ViewShellBase::getEditMode() const
978 ViewShell
* pViewShell
= framework::FrameworkHelper::Instance(*const_cast<ViewShellBase
*>(this))->GetViewShell(FrameworkHelper::msCenterPaneURL
).get();
980 if (DrawViewShell
* pDrawViewShell
= dynamic_cast<DrawViewShell
*>(pViewShell
))
982 switch ( pDrawViewShell
->GetEditMode() )
986 case EditMode::MasterPage
:
994 void ViewShellBase::setEditMode(int nMode
)
996 ViewShell
* pViewShell
= framework::FrameworkHelper::Instance(*this)->GetViewShell(FrameworkHelper::msCenterPaneURL
).get();
998 if (DrawViewShell
* pDrawViewShell
= dynamic_cast<DrawViewShell
*>(pViewShell
))
1003 pDrawViewShell
->ChangeEditMode(EditMode::Page
, false);
1006 pDrawViewShell
->ChangeEditMode(EditMode::MasterPage
, false);
1012 void ViewShellBase::afterCallbackRegistered()
1014 // TODO: Add theme color palette changed callback
1017 void ViewShellBase::NotifyCursor(SfxViewShell
* pOtherShell
) const
1019 ViewShell
* pThisShell
= framework::FrameworkHelper::Instance(*const_cast<ViewShellBase
*>(this))->GetViewShell(FrameworkHelper::msCenterPaneURL
).get();
1021 DrawViewShell
* pDrawViewShell
= dynamic_cast<DrawViewShell
*>(pThisShell
);
1022 if (!pDrawViewShell
)
1025 if (this == pOtherShell
)
1028 DrawView
* pDrawView
= pDrawViewShell
->GetDrawView();
1032 if (pDrawView
->GetTextEditObject())
1035 EditView
& rEditView
= pDrawView
->GetTextEditOutlinerView()->GetEditView();
1036 rEditView
.RegisterOtherShell(pOtherShell
);
1037 rEditView
.ShowCursor();
1038 rEditView
.RegisterOtherShell(nullptr);
1039 // Text selection, if any.
1040 rEditView
.DrawSelectionXOR(pOtherShell
);
1043 if (OutlinerView
* pOutlinerView
= pDrawView
->GetTextEditOutlinerView())
1045 ::tools::Rectangle aRectangle
= pOutlinerView
->GetOutputArea();
1046 vcl::Window
* pWin
= pThisShell
->GetActiveWindow();
1047 if (pWin
&& pWin
->GetMapMode().GetMapUnit() == MapUnit::Map100thMM
)
1048 aRectangle
= o3tl::toTwips(aRectangle
, o3tl::Length::mm100
);
1049 OString sRectangle
= aRectangle
.toString();
1050 SfxLokHelper::notifyOtherView(&pDrawViewShell
->GetViewShellBase(), pOtherShell
, LOK_CALLBACK_VIEW_LOCK
, "rectangle", sRectangle
);
1055 // Graphic selection.
1056 pDrawView
->AdjustMarkHdl(pOtherShell
);
1060 //===== ViewShellBase::Implementation =========================================
1062 ViewShellBase::Implementation::Implementation (ViewShellBase
& rBase
)
1063 : mbIsClosing(false),
1065 mbUserWantsTabBar(false),
1066 mbTabBarShouldBeVisible(true),
1067 mpPageCacheManager(slidesorter::cache::PageCacheManager::Instance())
1071 ViewShellBase::Implementation::~Implementation()
1073 mpController
= nullptr;
1074 mpViewTabBar
= nullptr;
1075 mpViewWindow
.disposeAndClear();
1076 mpToolBarManager
.reset();
1079 void ViewShellBase::Implementation::LateInit()
1081 mpController
= new DrawController(mrBase
);
1084 void ViewShellBase::Implementation::ProcessRestoreEditingViewSlot()
1086 ViewShell
* pViewShell
= mrBase
.GetMainViewShell().get();
1087 if (pViewShell
== nullptr)
1090 FrameView
* pFrameView
= pViewShell
->GetFrameView();
1091 if (pFrameView
== nullptr)
1094 // Set view shell, edit mode, and page kind.
1095 // pFrameView->SetViewShEditMode(
1096 // pFrameView->GetViewShEditModeOnLoad(),
1097 // pFrameView->GetPageKindOnLoad());
1098 pFrameView
->SetViewShEditMode(
1099 pFrameView
->GetViewShEditModeOnLoad() );
1100 pFrameView
->SetPageKind(
1101 pFrameView
->GetPageKindOnLoad());
1102 std::shared_ptr
<FrameworkHelper
> pHelper (FrameworkHelper::Instance(mrBase
));
1103 pHelper
->RequestView(
1104 FrameworkHelper::GetViewURL(pFrameView
->GetViewShellTypeOnLoad()),
1105 FrameworkHelper::msCenterPaneURL
);
1106 pHelper
->RunOnConfigurationEvent("ConfigurationUpdateEnd", CurrentPageSetter(mrBase
));
1109 void ViewShellBase::Implementation::SetUserWantsTabBar(bool inValue
)
1111 mbUserWantsTabBar
= inValue
;
1112 // Call ShowViewTabBar to refresh the TabBar visibility
1113 ShowViewTabBar(mbTabBarShouldBeVisible
);
1116 void ViewShellBase::Implementation::ShowViewTabBar (bool bShow
)
1118 mbTabBarShouldBeVisible
= bShow
;
1119 bShow
= bShow
&& mbUserWantsTabBar
;
1121 if (mpViewTabBar
.is()
1122 && mpViewTabBar
->GetTabControl()->IsVisible() != bShow
)
1124 mpViewTabBar
->GetTabControl()->Show(bShow
);
1129 void ViewShellBase::Implementation::ResizePixel (
1130 const Point
& rOrigin
,
1137 // Forward the call to both the base class and the main stacked sub
1138 // shell only when main sub shell exists.
1139 ViewShell
* pMainViewShell
= mrBase
.GetMainViewShell().get();
1141 // Set the ViewTabBar temporarily to full size so that, when asked
1142 // later, it can return its true height.
1143 mrBase
.SetWindow (mpViewWindow
.get());
1144 if (mpViewTabBar
.is() && mpViewTabBar
->GetTabControl()->IsVisible())
1145 mpViewTabBar
->GetTabControl()->SetPosSizePixel (rOrigin
, rSize
);
1147 // Calculate and set the border before the controls are placed.
1149 if (pMainViewShell
!= nullptr)
1150 aBorder
= pMainViewShell
->GetBorder();
1151 aBorder
+= mrBase
.GetBorder(bOuterResize
);
1152 if (mrBase
.GetBorderPixel() != aBorder
)
1153 mrBase
.SetBorderPixel(aBorder
);
1155 // Place the ViewTabBar at the top. It is part of the border.
1156 SvBorder aBaseBorder
;
1157 if (mpViewTabBar
.is() && mpViewTabBar
->GetTabControl()->IsVisible())
1159 aBaseBorder
.Top() = mpViewTabBar
->GetHeight();
1160 mpViewTabBar
->GetTabControl()->SetPosSizePixel(
1161 rOrigin
, Size(rSize
.Width(),aBaseBorder
.Top()));
1164 // The view window gets the remaining space.
1165 Point
aViewWindowPosition (
1166 rOrigin
.X()+aBaseBorder
.Left(),
1167 rOrigin
.Y()+aBaseBorder
.Top());
1169 Size
aViewWindowSize (
1170 rSize
.Width() - aBaseBorder
.Left() - aBaseBorder
.Right(),
1171 rSize
.Height() - aBaseBorder
.Top() - aBaseBorder
.Bottom());
1172 mpViewWindow
->SetPosSizePixel(aViewWindowPosition
, aViewWindowSize
);
1174 maClientArea
= ::tools::Rectangle(Point(0,0), aViewWindowSize
);
1177 void ViewShellBase::Implementation::SetPaneVisibility (
1178 const SfxRequest
& rRequest
,
1179 const OUString
& rsPaneURL
,
1180 const OUString
& rsViewURL
)
1184 Reference
<XControllerManager
> xControllerManager (mrBase
.GetController(), UNO_QUERY_THROW
);
1186 const Reference
< XComponentContext
> xContext(
1187 ::comphelper::getProcessComponentContext() );
1188 Reference
<XResourceId
> xPaneId (ResourceId::create(
1189 xContext
, rsPaneURL
));
1190 Reference
<XResourceId
> xViewId (ResourceId::createWithAnchorURL(
1191 xContext
, rsViewURL
, rsPaneURL
));
1193 // Determine the new visibility state.
1194 const SfxItemSet
* pArguments
= rRequest
.GetArgs();
1195 bool bShowChildWindow
;
1196 sal_uInt16 nSlotId
= rRequest
.GetSlot();
1197 if (pArguments
!= nullptr)
1198 bShowChildWindow
= static_cast<const SfxBoolItem
&>(
1199 pArguments
->Get(nSlotId
)).GetValue();
1202 Reference
<XConfigurationController
> xConfigurationController (
1203 xControllerManager
->getConfigurationController());
1204 if ( ! xConfigurationController
.is())
1205 throw RuntimeException();
1206 Reference
<XConfiguration
> xConfiguration (
1207 xConfigurationController
->getRequestedConfiguration());
1208 if ( ! xConfiguration
.is())
1209 throw RuntimeException();
1211 bShowChildWindow
= ! xConfiguration
->hasResource(xPaneId
);
1214 // Set the desired visibility state at the current configuration
1215 // and update it accordingly.
1216 Reference
<XConfigurationController
> xConfigurationController (
1217 xControllerManager
->getConfigurationController());
1218 if ( ! xConfigurationController
.is())
1219 throw RuntimeException();
1220 if (bShowChildWindow
)
1222 xConfigurationController
->requestResourceActivation(
1224 ResourceActivationMode_ADD
);
1225 xConfigurationController
->requestResourceActivation(
1227 ResourceActivationMode_REPLACE
);
1230 xConfigurationController
->requestResourceDeactivation(
1233 catch (const Exception
&)
1235 DBG_UNHANDLED_EXCEPTION("sd.view");
1239 void ViewShellBase::Implementation::GetSlotState (SfxItemSet
& rSet
)
1243 // Get some frequently used values.
1244 Reference
<XControllerManager
> xControllerManager (mrBase
.GetController(), UNO_QUERY_THROW
);
1245 Reference
<XConfigurationController
> xConfigurationController (
1246 xControllerManager
->getConfigurationController());
1247 if ( ! xConfigurationController
.is())
1248 throw RuntimeException();
1249 Reference
<XConfiguration
> xConfiguration (
1250 xConfigurationController
->getRequestedConfiguration());
1251 if ( ! xConfiguration
.is())
1252 throw RuntimeException();
1254 const Reference
< XComponentContext
> xContext(
1255 ::comphelper::getProcessComponentContext() );
1256 SfxWhichIter
aSetIterator (rSet
);
1257 sal_uInt16
nItemId (aSetIterator
.FirstWhich());
1261 bool bState (false);
1262 Reference
<XResourceId
> xResourceId
;
1265 // Check if the right view is active
1268 case SID_LEFT_PANE_IMPRESS
:
1269 xResourceId
= ResourceId::create(
1270 xContext
, FrameworkHelper::msLeftImpressPaneURL
);
1271 bState
= xConfiguration
->hasResource(xResourceId
);
1274 case SID_LEFT_PANE_DRAW
:
1275 xResourceId
= ResourceId::create(
1276 xContext
, FrameworkHelper::msLeftDrawPaneURL
);
1277 bState
= xConfiguration
->hasResource(xResourceId
);
1280 case SID_DRAWINGMODE
:
1281 case SID_NORMAL_MULTI_PANE_GUI
:
1282 case SID_SLIDE_MASTER_MODE
:
1283 xResourceId
= ResourceId::createWithAnchorURL(
1284 xContext
, FrameworkHelper::msImpressViewURL
,
1285 FrameworkHelper::msCenterPaneURL
);
1286 bState
= xConfiguration
->hasResource(xResourceId
);
1289 case SID_SLIDE_SORTER_MULTI_PANE_GUI
:
1290 case SID_SLIDE_SORTER_MODE
:
1291 xResourceId
= ResourceId::createWithAnchorURL(
1293 FrameworkHelper::msSlideSorterURL
,
1294 FrameworkHelper::msCenterPaneURL
);
1295 bState
= xConfiguration
->hasResource(xResourceId
);
1298 case SID_OUTLINE_MODE
:
1299 xResourceId
= ResourceId::createWithAnchorURL(
1301 FrameworkHelper::msOutlineViewURL
,
1302 FrameworkHelper::msCenterPaneURL
);
1303 bState
= xConfiguration
->hasResource(xResourceId
);
1306 case SID_HANDOUT_MASTER_MODE
:
1307 xResourceId
= ResourceId::createWithAnchorURL(
1308 xContext
, FrameworkHelper::msHandoutViewURL
,
1309 FrameworkHelper::msCenterPaneURL
);
1310 bState
= xConfiguration
->hasResource(xResourceId
);
1313 case SID_NOTES_MODE
:
1314 case SID_NOTES_MASTER_MODE
:
1315 xResourceId
= ResourceId::createWithAnchorURL(
1316 xContext
, FrameworkHelper::msNotesViewURL
,
1317 FrameworkHelper::msCenterPaneURL
);
1318 bState
= xConfiguration
->hasResource(xResourceId
);
1321 case SID_TOGGLE_TABBAR_VISIBILITY
:
1322 bState
= GetUserWantsTabBar();
1326 // Ignore all other items. They are not meant to be
1331 catch (const DeploymentException
&)
1335 // Check if edit mode fits too
1338 ViewShell
* const pCenterViewShell
= FrameworkHelper::Instance(mrBase
)->GetViewShell(
1339 FrameworkHelper::msCenterPaneURL
).get();
1340 DrawViewShell
* const pShell
= dynamic_cast<DrawViewShell
*>(pCenterViewShell
);
1345 case SID_DRAWINGMODE
:
1346 case SID_NORMAL_MULTI_PANE_GUI
:
1347 case SID_NOTES_MODE
:
1348 bState
= pShell
->GetEditMode() == EditMode::Page
;
1350 case SID_SLIDE_MASTER_MODE
:
1351 case SID_NOTES_MASTER_MODE
:
1352 bState
= pShell
->GetEditMode() == EditMode::MasterPage
;
1358 // And finally set the state.
1359 rSet
.Put(SfxBoolItem(nItemId
, bState
));
1361 nItemId
= aSetIterator
.NextWhich();
1364 catch (const RuntimeException
&)
1366 DBG_UNHANDLED_EXCEPTION("sd.view");
1371 } // end of namespace sd
1373 //===== CurrentPageSetter ===========================================
1377 CurrentPageSetter::CurrentPageSetter (ViewShellBase
& rBase
)
1382 void CurrentPageSetter::operator() (bool)
1384 FrameView
* pFrameView
= nullptr;
1386 if (mrBase
.GetMainViewShell() != nullptr)
1388 pFrameView
= mrBase
.GetMainViewShell()->GetFrameView();
1391 if (pFrameView
==nullptr)
1396 // Get the current page either from the DrawPagesSupplier or the
1397 // MasterPagesSupplier.
1399 if (pFrameView
->GetViewShEditModeOnLoad() == EditMode::Page
)
1401 Reference
<drawing::XDrawPagesSupplier
> xPagesSupplier (
1402 mrBase
.GetController()->getModel(), UNO_QUERY_THROW
);
1403 Reference
<container::XIndexAccess
> xPages (
1404 xPagesSupplier
->getDrawPages(), UNO_QUERY_THROW
);
1405 aPage
= xPages
->getByIndex(pFrameView
->GetSelectedPageOnLoad());
1409 Reference
<drawing::XMasterPagesSupplier
> xPagesSupplier (
1410 mrBase
.GetController()->getModel(), UNO_QUERY_THROW
);
1411 Reference
<container::XIndexAccess
> xPages (
1412 xPagesSupplier
->getMasterPages(), UNO_QUERY_THROW
);
1413 aPage
= xPages
->getByIndex(pFrameView
->GetSelectedPageOnLoad());
1415 // Switch to the page last edited by setting the CurrentPage
1417 Reference
<beans::XPropertySet
> xSet (mrBase
.GetController(), UNO_QUERY_THROW
);
1418 xSet
->setPropertyValue ("CurrentPage", aPage
);
1420 catch (const RuntimeException
&)
1422 // We have not been able to set the current page at the main view.
1423 // This is sad but still leaves us in a valid state. Therefore,
1424 // this exception is silently ignored.
1426 catch (const beans::UnknownPropertyException
&)
1428 SAL_WARN("sd.view", "CurrentPage property unknown");
1432 } // end of anonymous namespace
1434 //===== FocusForwardingWindow =================================================
1439 FocusForwardingWindow::FocusForwardingWindow (
1440 vcl::Window
& rParentWindow
,
1441 ViewShellBase
& rBase
)
1442 : vcl::Window(&rParentWindow
, WinBits(WB_CLIPCHILDREN
| WB_DIALOGCONTROL
)),
1445 SAL_INFO("sd.view", "created FocusForwardingWindow at " << this);
1448 FocusForwardingWindow::~FocusForwardingWindow()
1453 void FocusForwardingWindow::dispose()
1455 SAL_INFO("sd.view", "destroyed FocusForwardingWindow at " << this);
1456 vcl::Window::dispose();
1459 void FocusForwardingWindow::KeyInput (const KeyEvent
& rKEvt
)
1461 std::shared_ptr
<ViewShell
> pViewShell
= mrBase
.GetMainViewShell();
1462 if (pViewShell
!= nullptr)
1464 vcl::Window
* pWindow
= pViewShell
->GetActiveWindow();
1465 if (pWindow
!= nullptr)
1467 // Forward the focus so that the window is called directly the
1469 pWindow
->GrabFocus();
1470 // Forward the key press as well.
1471 pWindow
->KeyInput(rKEvt
);
1476 void FocusForwardingWindow::Command (const CommandEvent
& rEvent
)
1478 std::shared_ptr
<ViewShell
> pViewShell
= mrBase
.GetMainViewShell();
1479 if (pViewShell
!= nullptr)
1481 vcl::Window
* pWindow
= pViewShell
->GetActiveWindow();
1482 if (pWindow
!= nullptr)
1484 pWindow
->Command(rEvent
);
1489 } // end of anonymous namespace
1491 } // end of namespace sd
1493 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */