1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_sd.hxx"
31 #include "PaneHider.hxx"
33 #include "ViewShell.hxx"
34 #include "ViewShellBase.hxx"
35 #include "slideshow.hxx"
36 #include "slideshowimpl.hxx"
37 #include "framework/FrameworkHelper.hxx"
38 #include "framework/ConfigurationController.hxx"
40 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
41 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
42 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
43 #include <com/sun/star/lang/DisposedException.hpp>
45 #include <tools/diagnose_ex.h>
47 using namespace ::com::sun::star::uno
;
48 using namespace ::com::sun::star::drawing::framework
;
49 using ::sd::framework::FrameworkHelper
;
50 using ::com::sun::star::lang::DisposedException
;
54 PaneHider::PaneHider (const ViewShell
& rViewShell
, SlideshowImpl
* pSlideShow
)
55 : mrViewShell(rViewShell
),
56 mbWindowVisibilitySaved(false),
57 mbOriginalLeftPaneWindowVisibility(false),
58 mbOriginalRightPaneWindowVisibility(false)
60 // Hide the left and right pane windows when a slideshow exists and is
62 if (pSlideShow
!=NULL
&& !pSlideShow
->isFullScreen()) try
64 Reference
<XControllerManager
> xControllerManager (
65 mrViewShell
.GetViewShellBase().GetController(), UNO_QUERY_THROW
);
66 mxConfigurationController
= xControllerManager
->getConfigurationController();
67 if (mxConfigurationController
.is())
69 // Get and save the current configuration.
70 mxConfiguration
= mxConfigurationController
->getRequestedConfiguration();
71 if (mxConfiguration
.is())
73 // Iterate over the resources and deactivate the panes.
74 Sequence
<Reference
<XResourceId
> > aResources (
75 mxConfiguration
->getResources(
77 framework::FrameworkHelper::msPaneURLPrefix
,
78 AnchorBindingMode_DIRECT
));
79 for (sal_Int32 nIndex
=0; nIndex
<aResources
.getLength(); ++nIndex
)
81 Reference
<XResourceId
> xPaneId (aResources
[nIndex
]);
82 if ( ! xPaneId
->getResourceURL().equals(FrameworkHelper::msCenterPaneURL
))
84 mxConfigurationController
->requestResourceDeactivation(xPaneId
);
89 FrameworkHelper::Instance(mrViewShell
.GetViewShellBase())->WaitForUpdate();
91 catch (RuntimeException
&)
93 DBG_UNHANDLED_EXCEPTION();
100 PaneHider::~PaneHider (void)
102 if (mxConfiguration
.is() && mxConfigurationController
.is())
106 mxConfigurationController
->restoreConfiguration(mxConfiguration
);
108 catch (DisposedException
&)
110 // When the configuration controller is already disposed then
111 // there is no point in restoring the configuration.
117 } // end of namespace sd