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