bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / slideshow / PaneHider.cxx
blobd4265dbbb80f93cf1d5237425415745ba7137d3d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "PaneHider.hxx"
22 #include <ViewShell.hxx>
23 #include <ViewShellBase.hxx>
24 #include <slideshow.hxx>
25 #include "slideshowimpl.hxx"
26 #include <framework/FrameworkHelper.hxx>
27 #include <framework/ConfigurationController.hxx>
29 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
30 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
31 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
32 #include <com/sun/star/lang/DisposedException.hpp>
34 #include <tools/diagnose_ex.h>
36 using namespace ::com::sun::star::uno;
37 using namespace ::com::sun::star::drawing::framework;
38 using ::sd::framework::FrameworkHelper;
39 using ::com::sun::star::lang::DisposedException;
41 namespace sd {
43 PaneHider::PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow)
44 : mrViewShell(rViewShell)
46 // Hide the left and right pane windows when a slideshow exists and is
47 // not full screen.
48 if (pSlideShow==nullptr || pSlideShow->isFullScreen())
49 return;
51 try
53 Reference<XControllerManager> xControllerManager (
54 mrViewShell.GetViewShellBase().GetController(), UNO_QUERY_THROW);
55 mxConfigurationController = xControllerManager->getConfigurationController();
56 if (mxConfigurationController.is())
58 // Get and save the current configuration.
59 mxConfiguration = mxConfigurationController->getRequestedConfiguration();
60 if (mxConfiguration.is())
62 // Iterate over the resources and deactivate the panes.
63 Sequence<Reference<XResourceId> > aResources (
64 mxConfiguration->getResources(
65 nullptr,
66 framework::FrameworkHelper::msPaneURLPrefix,
67 AnchorBindingMode_DIRECT));
68 for (sal_Int32 nIndex=0; nIndex<aResources.getLength(); ++nIndex)
70 Reference<XResourceId> xPaneId (aResources[nIndex]);
71 if ( xPaneId->getResourceURL() != FrameworkHelper::msCenterPaneURL )
73 mxConfigurationController->requestResourceDeactivation(xPaneId);
78 FrameworkHelper::Instance(mrViewShell.GetViewShellBase())->WaitForUpdate();
80 catch (RuntimeException&)
82 DBG_UNHANDLED_EXCEPTION("sd");
86 PaneHider::~PaneHider()
88 if (mxConfiguration.is() && mxConfigurationController.is())
90 try
92 mxConfigurationController->restoreConfiguration(mxConfiguration);
94 catch (DisposedException&)
96 // When the configuration controller is already disposed then
97 // there is no point in restoring the configuration.
102 } // end of namespace sd
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */