Update ooo320-m1
[ooovba.git] / sd / source / ui / framework / module / SlideSorterModule.cxx
blobe5e81672f134d968c4c34f35ebd7adb426257a31
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlideSorterModule.cxx,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
31 #include "precompiled_sd.hxx"
33 #include "SlideSorterModule.hxx"
35 #include "framework/FrameworkHelper.hxx"
36 #include <com/sun/star/drawing/framework/XTabBar.hpp>
37 #include <com/sun/star/drawing/framework/TabBarButton.hpp>
39 #include "strings.hrc"
40 #include "sdresid.hxx"
42 using namespace ::com::sun::star;
43 using namespace ::com::sun::star::uno;
44 using namespace ::com::sun::star::drawing::framework;
46 using ::rtl::OUString;
47 using ::sd::framework::FrameworkHelper;
50 namespace sd { namespace framework {
53 //===== SlideSorterModule ==================================================
55 SlideSorterModule::SlideSorterModule (
56 const Reference<frame::XController>& rxController,
57 const OUString& rsLeftPaneURL)
58 : ResourceManager(rxController,
59 FrameworkHelper::CreateResourceId(FrameworkHelper::msSlideSorterURL, rsLeftPaneURL)),
60 mxViewTabBarId(FrameworkHelper::CreateResourceId(
61 FrameworkHelper::msViewTabBarURL,
62 FrameworkHelper::msCenterPaneURL)),
63 mxControllerManager(rxController,UNO_QUERY)
65 if (mxConfigurationController.is())
67 UpdateViewTabBar(NULL);
69 AddActiveMainView(FrameworkHelper::msImpressViewURL);
70 AddActiveMainView(FrameworkHelper::msOutlineViewURL);
71 AddActiveMainView(FrameworkHelper::msNotesViewURL);
73 AddActiveMainView(FrameworkHelper::msDrawViewURL);
75 mxConfigurationController->addConfigurationChangeListener(
76 this,
77 FrameworkHelper::msResourceActivationEvent,
78 Any());
85 SlideSorterModule::~SlideSorterModule (void)
92 void SAL_CALL SlideSorterModule::notifyConfigurationChange (
93 const ConfigurationChangeEvent& rEvent)
94 throw (RuntimeException)
96 if (rEvent.Type.equals(FrameworkHelper::msResourceActivationEvent))
98 if (rEvent.ResourceId->compareTo(mxViewTabBarId) == 0)
100 // Update the view tab bar because the view tab bar has just
101 // become active.
102 UpdateViewTabBar(Reference<XTabBar>(rEvent.ResourceObject,UNO_QUERY));
104 else if (rEvent.ResourceId->getResourceTypePrefix().equals(
105 FrameworkHelper::msViewURLPrefix)
106 && rEvent.ResourceId->isBoundTo(
107 FrameworkHelper::CreateResourceId(FrameworkHelper::msCenterPaneURL),
108 AnchorBindingMode_DIRECT))
110 // Update the view tab bar because the view in the center pane
111 // has changed.
112 UpdateViewTabBar(NULL);
115 else
117 ResourceManager::notifyConfigurationChange(rEvent);
124 void SlideSorterModule::UpdateViewTabBar (const Reference<XTabBar>& rxTabBar)
126 if ( ! mxControllerManager.is())
127 return;
129 Reference<XTabBar> xBar (rxTabBar);
130 if ( ! xBar.is())
132 Reference<XConfigurationController> xCC (
133 mxControllerManager->getConfigurationController());
134 if (xCC.is())
135 xBar = Reference<XTabBar>(xCC->getResource(mxViewTabBarId), UNO_QUERY);
138 if (xBar.is())
140 TabBarButton aButtonA;
141 aButtonA.ResourceId = FrameworkHelper::CreateResourceId(
142 FrameworkHelper::msSlideSorterURL,
143 FrameworkHelper::msCenterPaneURL);
144 aButtonA.ButtonLabel = String(SdResId(STR_SLIDE_MODE));
146 TabBarButton aButtonB;
147 aButtonB.ResourceId = FrameworkHelper::CreateResourceId(
148 FrameworkHelper::msHandoutViewURL,
149 FrameworkHelper::msCenterPaneURL);
151 if ( ! xBar->hasTabBarButton(aButtonA))
152 xBar->addTabBarButtonAfter(aButtonA, aButtonB);
158 } } // end of namespace sd::framework