LibreOffice Module sd (master) 1
PaneHider.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "PaneHider.hxx"
21
22#include <ViewShell.hxx>
23#include <ViewShellBase.hxx>
24#include "slideshowimpl.hxx"
26
27#include <com/sun/star/drawing/framework/XControllerManager.hpp>
28#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
29#include <com/sun/star/drawing/framework/XConfiguration.hpp>
30#include <com/sun/star/frame/XController.hpp>
31#include <com/sun/star/lang/DisposedException.hpp>
32
34
35using namespace ::com::sun::star::uno;
37using ::sd::framework::FrameworkHelper;
38using ::com::sun::star::lang::DisposedException;
39
40namespace sd
41{
42PaneHider::PaneHider(const ViewShell& rViewShell, SlideshowImpl* pSlideShow)
43{
44 // Hide the left and right pane windows when a slideshow exists and is
45 // not full screen.
46 if (pSlideShow == nullptr || pSlideShow->isFullScreen())
47 return;
48
49 try
50 {
51 Reference<XControllerManager> xControllerManager(
52 rViewShell.GetViewShellBase().GetController(), UNO_QUERY_THROW);
53 mxConfigurationController = xControllerManager->getConfigurationController();
55 {
56 // Get and save the current configuration.
57 mxConfiguration = mxConfigurationController->getRequestedConfiguration();
58 if (mxConfiguration.is())
59 {
60 // Iterate over the resources and deactivate the panes.
61 const Sequence<Reference<XResourceId>> aResources(mxConfiguration->getResources(
63 AnchorBindingMode_DIRECT));
64 for (const Reference<XResourceId>& xPaneId : aResources)
65 {
66 if (xPaneId->getResourceURL() != FrameworkHelper::msCenterPaneURL)
67 {
68 mxConfigurationController->requestResourceDeactivation(xPaneId);
69 }
70 }
71 }
72 }
73 FrameworkHelper::Instance(rViewShell.GetViewShellBase())->WaitForUpdate();
74 }
75 catch (RuntimeException&)
76 {
78 }
79}
80
82{
84 {
85 try
86 {
87 mxConfigurationController->restoreConfiguration(mxConfiguration);
88 }
89 catch (DisposedException&)
90 {
91 // When the configuration controller is already disposed then
92 // there is no point in restoring the configuration.
93 }
94 }
95}
96
97} // end of namespace sd
98
99/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::frame::XController > GetController() const
css::uno::Reference< css::drawing::framework::XConfiguration > mxConfiguration
Definition: PaneHider.hxx:61
PaneHider(const ViewShell &rViewShell, SlideshowImpl *pSlideShow)
The constructor hides all side panes that belong to the ViewShellBase of the given view shell.
Definition: PaneHider.cxx:42
~PaneHider()
Restore the original visibility of the side panes.
Definition: PaneHider.cxx:81
css::uno::Reference< css::drawing::framework::XConfigurationController > mxConfigurationController
Remember whether the visibility states of the windows of the panes has been modified and have to be r...
Definition: PaneHider.hxx:60
virtual sal_Bool SAL_CALL isFullScreen() override
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
Definition: viewshel.cxx:1397
static constexpr OUStringLiteral msPaneURLPrefix
#define DBG_UNHANDLED_EXCEPTION(...)