Branch data Line data Source code
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 : :
21 : : #include "PaneHider.hxx"
22 : :
23 : : #include "ViewShell.hxx"
24 : : #include "ViewShellBase.hxx"
25 : : #include "slideshow.hxx"
26 : : #include "slideshowimpl.hxx"
27 : : #include "framework/FrameworkHelper.hxx"
28 : : #include "framework/ConfigurationController.hxx"
29 : :
30 : : #include <com/sun/star/drawing/framework/XControllerManager.hpp>
31 : : #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
32 : : #include <com/sun/star/drawing/framework/XConfiguration.hpp>
33 : : #include <com/sun/star/lang/DisposedException.hpp>
34 : :
35 : : #include <tools/diagnose_ex.h>
36 : :
37 : : using namespace ::com::sun::star::uno;
38 : : using namespace ::com::sun::star::drawing::framework;
39 : : using ::sd::framework::FrameworkHelper;
40 : : using ::com::sun::star::lang::DisposedException;
41 : :
42 : : namespace sd {
43 : :
44 : 0 : PaneHider::PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow)
45 : : : mrViewShell(rViewShell),
46 : : mbWindowVisibilitySaved(false),
47 : : mbOriginalLeftPaneWindowVisibility(false),
48 : 0 : mbOriginalRightPaneWindowVisibility(false)
49 : : {
50 : : // Hide the left and right pane windows when a slideshow exists and is
51 : : // not full screen.
52 [ # # ][ # # ]: 0 : if (pSlideShow!=NULL && !pSlideShow->isFullScreen()) try
[ # # ][ # # ]
53 : : {
54 : : Reference<XControllerManager> xControllerManager (
55 [ # # ][ # # ]: 0 : mrViewShell.GetViewShellBase().GetController(), UNO_QUERY_THROW);
[ # # ]
56 [ # # ][ # # ]: 0 : mxConfigurationController = xControllerManager->getConfigurationController();
[ # # ]
57 [ # # ]: 0 : if (mxConfigurationController.is())
58 : : {
59 : : // Get and save the current configuration.
60 [ # # ][ # # ]: 0 : mxConfiguration = mxConfigurationController->getRequestedConfiguration();
[ # # ]
61 [ # # ]: 0 : if (mxConfiguration.is())
62 : : {
63 : : // Iterate over the resources and deactivate the panes.
64 : : Sequence<Reference<XResourceId> > aResources (
65 [ # # ]: 0 : mxConfiguration->getResources(
66 : : NULL,
67 : : framework::FrameworkHelper::msPaneURLPrefix,
68 [ # # ][ # # ]: 0 : AnchorBindingMode_DIRECT));
69 [ # # ]: 0 : for (sal_Int32 nIndex=0; nIndex<aResources.getLength(); ++nIndex)
70 : : {
71 [ # # ]: 0 : Reference<XResourceId> xPaneId (aResources[nIndex]);
72 [ # # ][ # # ]: 0 : if ( ! xPaneId->getResourceURL().equals(FrameworkHelper::msCenterPaneURL))
[ # # ]
73 : : {
74 [ # # ][ # # ]: 0 : mxConfigurationController->requestResourceDeactivation(xPaneId);
75 : : }
76 [ # # ]: 0 : }
77 : : }
78 : : }
79 [ # # ][ # # ]: 0 : FrameworkHelper::Instance(mrViewShell.GetViewShellBase())->WaitForUpdate();
[ # # ][ # # ]
[ # # ]
80 : : }
81 [ # # ]: 0 : catch (RuntimeException&)
82 : : {
83 : : DBG_UNHANDLED_EXCEPTION();
84 : : }
85 : 0 : }
86 : :
87 : :
88 : :
89 : :
90 : 0 : PaneHider::~PaneHider (void)
91 : : {
92 [ # # ][ # # ]: 0 : if (mxConfiguration.is() && mxConfigurationController.is())
[ # # ]
93 : : {
94 : : try
95 : : {
96 [ # # ][ # # ]: 0 : mxConfigurationController->restoreConfiguration(mxConfiguration);
97 : : }
98 [ # # ]: 0 : catch (DisposedException&)
99 : : {
100 : : // When the configuration controller is already disposed then
101 : : // there is no point in restoring the configuration.
102 : : }
103 : : }
104 [ # # ]: 0 : }
105 : :
106 : :
107 : : } // end of namespace sd
108 : :
109 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|