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 41 : ToolPanelModule::ToolPanelModule (
41 : const Reference<frame::XController>& rxController,
42 : const OUString& rsSidebarPaneURL)
43 : : ResourceManager(rxController,
44 : FrameworkHelper::CreateResourceId(FrameworkHelper::msSidebarViewURL, rsSidebarPaneURL)),
45 41 : mxControllerManager(rxController,UNO_QUERY)
46 : {
47 41 : if (mxConfigurationController.is())
48 : {
49 41 : if (SvtToolPanelOptions().GetVisibleImpressView())
50 41 : AddActiveMainView(FrameworkHelper::msImpressViewURL);
51 41 : if (SvtToolPanelOptions().GetVisibleOutlineView())
52 0 : AddActiveMainView(FrameworkHelper::msOutlineViewURL);
53 41 : if (SvtToolPanelOptions().GetVisibleNotesView())
54 41 : AddActiveMainView(FrameworkHelper::msNotesViewURL);
55 41 : if (SvtToolPanelOptions().GetVisibleHandoutView())
56 41 : AddActiveMainView(FrameworkHelper::msHandoutViewURL);
57 41 : if (SvtToolPanelOptions().GetVisibleSlideSorterView())
58 41 : AddActiveMainView(FrameworkHelper::msSlideSorterURL);
59 :
60 41 : mxConfigurationController->addConfigurationChangeListener(
61 : this,
62 : FrameworkHelper::msResourceActivationEvent,
63 41 : Any());
64 : }
65 41 : }
66 :
67 82 : ToolPanelModule::~ToolPanelModule()
68 : {
69 82 : }
70 :
71 41 : void ToolPanelModule::SaveResourceState()
72 : {
73 41 : SvtToolPanelOptions().SetVisibleImpressView(IsResourceActive(FrameworkHelper::msImpressViewURL));
74 41 : SvtToolPanelOptions().SetVisibleOutlineView(IsResourceActive(FrameworkHelper::msOutlineViewURL));
75 41 : SvtToolPanelOptions().SetVisibleNotesView(IsResourceActive(FrameworkHelper::msNotesViewURL));
76 41 : SvtToolPanelOptions().SetVisibleHandoutView(IsResourceActive(FrameworkHelper::msHandoutViewURL));
77 41 : SvtToolPanelOptions().SetVisibleSlideSorterView(IsResourceActive(FrameworkHelper::msSlideSorterURL));
78 41 : }
79 :
80 789 : void SAL_CALL ToolPanelModule::notifyConfigurationChange (
81 : const ConfigurationChangeEvent& rEvent)
82 : throw (RuntimeException, std::exception)
83 : {
84 789 : if (!rEvent.Type.equals(FrameworkHelper::msResourceActivationEvent))
85 590 : ResourceManager::notifyConfigurationChange(rEvent);
86 789 : }
87 :
88 66 : } } // end of namespace sd::framework
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|