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 :
21 : #include "ToolPanelModule.hxx"
22 :
23 : #include "framework/FrameworkHelper.hxx"
24 : #include <com/sun/star/drawing/framework/XTabBar.hpp>
25 : #include <com/sun/star/drawing/framework/TabBarButton.hpp>
26 :
27 : #include "strings.hrc"
28 : #include "sdresid.hxx"
29 : #include "svtools/toolpanelopt.hxx"
30 :
31 : using namespace ::com::sun::star;
32 : using namespace ::com::sun::star::uno;
33 : using namespace ::com::sun::star::drawing::framework;
34 :
35 : using ::sd::framework::FrameworkHelper;
36 :
37 :
38 : namespace sd { namespace framework {
39 :
40 :
41 : //===== ToolPanelModule ==================================================
42 :
43 0 : ToolPanelModule::ToolPanelModule (
44 : const Reference<frame::XController>& rxController,
45 : const OUString& rsSidebarPaneURL)
46 : : ResourceManager(rxController,
47 : FrameworkHelper::CreateResourceId(FrameworkHelper::msSidebarViewURL, rsSidebarPaneURL)),
48 0 : mxControllerManager(rxController,UNO_QUERY)
49 : {
50 0 : if (mxConfigurationController.is())
51 : {
52 0 : if (SvtToolPanelOptions().GetVisibleImpressView())
53 0 : AddActiveMainView(FrameworkHelper::msImpressViewURL);
54 0 : if (SvtToolPanelOptions().GetVisibleOutlineView())
55 0 : AddActiveMainView(FrameworkHelper::msOutlineViewURL);
56 0 : if (SvtToolPanelOptions().GetVisibleNotesView())
57 0 : AddActiveMainView(FrameworkHelper::msNotesViewURL);
58 0 : if (SvtToolPanelOptions().GetVisibleHandoutView())
59 0 : AddActiveMainView(FrameworkHelper::msHandoutViewURL);
60 0 : if (SvtToolPanelOptions().GetVisibleSlideSorterView())
61 0 : AddActiveMainView(FrameworkHelper::msSlideSorterURL);
62 :
63 0 : mxConfigurationController->addConfigurationChangeListener(
64 : this,
65 : FrameworkHelper::msResourceActivationEvent,
66 0 : Any());
67 : }
68 0 : }
69 :
70 0 : ToolPanelModule::~ToolPanelModule (void)
71 : {
72 0 : }
73 :
74 0 : void ToolPanelModule::SaveResourceState (void)
75 : {
76 0 : SvtToolPanelOptions().SetVisibleImpressView(IsResourceActive(FrameworkHelper::msImpressViewURL));
77 0 : SvtToolPanelOptions().SetVisibleOutlineView(IsResourceActive(FrameworkHelper::msOutlineViewURL));
78 0 : SvtToolPanelOptions().SetVisibleNotesView(IsResourceActive(FrameworkHelper::msNotesViewURL));
79 0 : SvtToolPanelOptions().SetVisibleHandoutView(IsResourceActive(FrameworkHelper::msHandoutViewURL));
80 0 : SvtToolPanelOptions().SetVisibleSlideSorterView(IsResourceActive(FrameworkHelper::msSlideSorterURL));
81 0 : }
82 :
83 0 : void SAL_CALL ToolPanelModule::notifyConfigurationChange (
84 : const ConfigurationChangeEvent& rEvent)
85 : throw (RuntimeException, std::exception)
86 : {
87 0 : if (!rEvent.Type.equals(FrameworkHelper::msResourceActivationEvent))
88 0 : ResourceManager::notifyConfigurationChange(rEvent);
89 0 : }
90 :
91 : } } // end of namespace sd::framework
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|