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