1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PaneHider.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sd.hxx"
34 #include "PaneHider.hxx"
36 #include "ViewShell.hxx"
37 #include "ViewShellBase.hxx"
38 #include "slideshow.hxx"
39 #include "slideshowimpl.hxx"
40 #include "framework/FrameworkHelper.hxx"
41 #include "framework/ConfigurationController.hxx"
43 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
44 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
45 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
46 #include <com/sun/star/lang/DisposedException.hpp>
48 using namespace ::com::sun::star::uno
;
49 using namespace ::com::sun::star::drawing::framework
;
50 using ::sd::framework::FrameworkHelper
;
51 using ::com::sun::star::lang::DisposedException
;
55 PaneHider::PaneHider (const ViewShell
& rViewShell
, SlideshowImpl
* pSlideShow
)
56 : mrViewShell(rViewShell
),
57 mbWindowVisibilitySaved(false),
58 mbOriginalLeftPaneWindowVisibility(false),
59 mbOriginalRightPaneWindowVisibility(false)
61 // Hide the left and right pane windows when a slideshow exists and is
63 if (pSlideShow
!=NULL
&& !pSlideShow
->isFullScreen()) try
65 Reference
<XControllerManager
> xControllerManager (
66 mrViewShell
.GetViewShellBase().GetController(), UNO_QUERY_THROW
);
67 mxConfigurationController
= xControllerManager
->getConfigurationController();
68 if (mxConfigurationController
.is())
70 // Get and save the current configuration.
71 mxConfiguration
= mxConfigurationController
->getRequestedConfiguration();
72 if (mxConfiguration
.is())
74 // Iterate over the resources and deactivate the panes.
75 Sequence
<Reference
<XResourceId
> > aResources (
76 mxConfiguration
->getResources(
78 framework::FrameworkHelper::msPaneURLPrefix
,
79 AnchorBindingMode_DIRECT
));
80 for (sal_Int32 nIndex
=0; nIndex
<aResources
.getLength(); ++nIndex
)
82 Reference
<XResourceId
> xPaneId (aResources
[nIndex
]);
83 if ( ! xPaneId
->getResourceURL().equals(FrameworkHelper::msCenterPaneURL
))
85 mxConfigurationController
->requestResourceDeactivation(xPaneId
);
90 FrameworkHelper::Instance(mrViewShell
.GetViewShellBase())->WaitForUpdate();
92 catch (RuntimeException
&)
94 DBG_ASSERT(false, "caught exception in PaneHider constructor");
101 PaneHider::~PaneHider (void)
103 if (mxConfiguration
.is() && mxConfigurationController
.is())
107 mxConfigurationController
->restoreConfiguration(mxConfiguration
);
109 catch (DisposedException
&)
111 // When the configuration controller is already disposed then
112 // there is no point in restoring the configuration.
118 } // end of namespace sd