1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 // MARKER(update_precomp.py): autogen include statement, do not remove 23 #include "precompiled_sd.hxx" 24 #include "PaneHider.hxx" 25 26 #include "ViewShell.hxx" 27 #include "ViewShellBase.hxx" 28 #include "slideshow.hxx" 29 #include "slideshowimpl.hxx" 30 #include "framework/FrameworkHelper.hxx" 31 #include "framework/ConfigurationController.hxx" 32 33 #include <com/sun/star/drawing/framework/XControllerManager.hpp> 34 #include <com/sun/star/drawing/framework/XConfigurationController.hpp> 35 #include <com/sun/star/drawing/framework/XConfiguration.hpp> 36 #include <com/sun/star/lang/DisposedException.hpp> 37 38 #include <tools/diagnose_ex.h> 39 40 using namespace ::com::sun::star::uno; 41 using namespace ::com::sun::star::drawing::framework; 42 using ::sd::framework::FrameworkHelper; 43 using ::com::sun::star::lang::DisposedException; 44 45 namespace sd { 46 47 PaneHider::PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow) 48 : mrViewShell(rViewShell), 49 mbWindowVisibilitySaved(false), 50 mbOriginalLeftPaneWindowVisibility(false), 51 mbOriginalRightPaneWindowVisibility(false) 52 { 53 // Hide the left and right pane windows when a slideshow exists and is 54 // not full screen. 55 if (pSlideShow!=NULL && !pSlideShow->isFullScreen()) try 56 { 57 Reference<XControllerManager> xControllerManager ( 58 mrViewShell.GetViewShellBase().GetController(), UNO_QUERY_THROW); 59 mxConfigurationController = xControllerManager->getConfigurationController(); 60 if (mxConfigurationController.is()) 61 { 62 // Get and save the current configuration. 63 mxConfiguration = mxConfigurationController->getRequestedConfiguration(); 64 if (mxConfiguration.is()) 65 { 66 // Iterate over the resources and deactivate the panes. 67 Sequence<Reference<XResourceId> > aResources ( 68 mxConfiguration->getResources( 69 NULL, 70 framework::FrameworkHelper::msPaneURLPrefix, 71 AnchorBindingMode_DIRECT)); 72 for (sal_Int32 nIndex=0; nIndex<aResources.getLength(); ++nIndex) 73 { 74 Reference<XResourceId> xPaneId (aResources[nIndex]); 75 if ( ! xPaneId->getResourceURL().equals(FrameworkHelper::msCenterPaneURL)) 76 { 77 mxConfigurationController->requestResourceDeactivation(xPaneId); 78 } 79 } 80 } 81 } 82 FrameworkHelper::Instance(mrViewShell.GetViewShellBase())->WaitForUpdate(); 83 } 84 catch (RuntimeException&) 85 { 86 DBG_UNHANDLED_EXCEPTION(); 87 } 88 } 89 90 91 PaneHider::~PaneHider (void) 92 { 93 if (mxConfiguration.is() && mxConfigurationController.is()) 94 { 95 try 96 { 97 mxConfigurationController->restoreConfiguration(mxConfiguration); 98 } 99 catch (DisposedException&) 100 { 101 // When the configuration controller is already disposed then 102 // there is no point in restoring the configuration. 103 } 104 } 105 } 106 107 } // end of namespace sd 108 109 /* vim: set noet sw=4 ts=4: */ 110