Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "ToolPanelModule.hxx"
21 :
22 : #include "framework/FrameworkHelper.hxx"
23 : #include <com/sun/star/drawing/framework/XTabBar.hpp>
24 : #include <com/sun/star/drawing/framework/TabBarButton.hpp>
25 :
26 : #include "strings.hrc"
27 : #include "sdresid.hxx"
28 : #include "svtools/toolpanelopt.hxx"
29 :
30 : using namespace ::com::sun::star;
31 : using namespace ::com::sun::star::uno;
32 : using namespace ::com::sun::star::drawing::framework;
33 :
34 : using ::sd::framework::FrameworkHelper;
35 :
36 : namespace sd { namespace framework {
37 :
38 : //===== ToolPanelModule ==================================================
39 :
40 52 : ToolPanelModule::ToolPanelModule (
41 : const Reference<frame::XController>& rxController,
42 : const OUString& rsSidebarPaneURL)
43 : : ResourceManager(rxController,
44 : FrameworkHelper::CreateResourceId(FrameworkHelper::msSidebarViewURL, rsSidebarPaneURL)),
45 52 : mxControllerManager(rxController,UNO_QUERY)
46 : {
47 52 : if (mxConfigurationController.is())
48 : {
49 52 : if (SvtToolPanelOptions().GetVisibleImpressView())
50 52 : AddActiveMainView(FrameworkHelper::msImpressViewURL);
51 52 : if (SvtToolPanelOptions().GetVisibleOutlineView())
52 0 : AddActiveMainView(FrameworkHelper::msOutlineViewURL);
53 52 : if (SvtToolPanelOptions().GetVisibleNotesView())
54 52 : AddActiveMainView(FrameworkHelper::msNotesViewURL);
55 52 : if (SvtToolPanelOptions().GetVisibleHandoutView())
56 52 : AddActiveMainView(FrameworkHelper::msHandoutViewURL);
57 52 : if (SvtToolPanelOptions().GetVisibleSlideSorterView())
58 52 : AddActiveMainView(FrameworkHelper::msSlideSorterURL);
59 :
60 52 : mxConfigurationController->addConfigurationChangeListener(
61 : this,
62 : FrameworkHelper::msResourceActivationEvent,
63 52 : Any());
64 : }
65 52 : }
66 :
67 104 : ToolPanelModule::~ToolPanelModule (void)
68 : {
69 104 : }
70 :
71 52 : void ToolPanelModule::SaveResourceState (void)
72 : {
73 52 : SvtToolPanelOptions().SetVisibleImpressView(IsResourceActive(FrameworkHelper::msImpressViewURL));
74 52 : SvtToolPanelOptions().SetVisibleOutlineView(IsResourceActive(FrameworkHelper::msOutlineViewURL));
75 52 : SvtToolPanelOptions().SetVisibleNotesView(IsResourceActive(FrameworkHelper::msNotesViewURL));
76 52 : SvtToolPanelOptions().SetVisibleHandoutView(IsResourceActive(FrameworkHelper::msHandoutViewURL));
77 52 : SvtToolPanelOptions().SetVisibleSlideSorterView(IsResourceActive(FrameworkHelper::msSlideSorterURL));
78 52 : }
79 :
80 984 : void SAL_CALL ToolPanelModule::notifyConfigurationChange (
81 : const ConfigurationChangeEvent& rEvent)
82 : throw (RuntimeException, std::exception)
83 : {
84 984 : if (!rEvent.Type.equals(FrameworkHelper::msResourceActivationEvent))
85 728 : ResourceManager::notifyConfigurationChange(rEvent);
86 984 : }
87 :
88 114 : } } // end of namespace sd::framework
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|