bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / framework / module / ResourceManager.hxx
blobe2d31dd49c1af1c1de7b00021d13ddb1a057be87
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_FRAMEWORK_MODULE_RESOURCEMANAGER_HXX
21 #define INCLUDED_SD_SOURCE_UI_FRAMEWORK_MODULE_RESOURCEMANAGER_HXX
23 #include "MutexOwner.hxx"
24 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
25 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
26 #include <com/sun/star/frame/XController.hpp>
27 #include <cppuhelper/compbase1.hxx>
28 #include <boost/scoped_ptr.hpp>
30 namespace {
32 typedef ::cppu::WeakComponentImplHelper1 <
33 ::com::sun::star::drawing::framework::XConfigurationChangeListener
34 > ResourceManagerInterfaceBase;
36 } // end of anonymous namespace.
38 namespace sd { namespace framework {
40 /** Manage the activation state of one resource depending on the view in the
41 center pane. The ResourceManager remembers in which configuration to
42 activate and in which to deactivate the resource. When the resource is
43 deactivated or activated manually by the user then the ResourceManager
44 detects this and remembers it for the future.
46 class ResourceManager
47 : private sd::MutexOwner,
48 public ResourceManagerInterfaceBase
50 public:
51 ResourceManager (
52 const ::com::sun::star::uno::Reference<
53 ::com::sun::star::frame::XController>& rxController,
54 const ::com::sun::star::uno::Reference<
55 ::com::sun::star::drawing::framework::XResourceId>& rxResourceId);
56 virtual ~ResourceManager();
58 /** Remember the given URL as one of a center pane view for which to
59 activate the resource managed by the called object.
61 void AddActiveMainView (const OUString& rsMainViewURL);
62 bool IsResourceActive (const OUString& rsMainViewURL);
63 virtual void SaveResourceState();
65 virtual void SAL_CALL disposing() SAL_OVERRIDE;
67 // XConfigurationChangeListener
69 virtual void SAL_CALL notifyConfigurationChange (
70 const com::sun::star::drawing::framework::ConfigurationChangeEvent& rEvent)
71 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 // XEventListener
75 virtual void SAL_CALL disposing (
76 const com::sun::star::lang::EventObject& rEvent)
77 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 protected:
80 ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XConfigurationController>
81 mxConfigurationController;
83 private:
84 class MainViewContainer;
85 ::boost::scoped_ptr<MainViewContainer> mpActiveMainViewContainer;
87 /// The resource managed by this class.
88 css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId;
90 /// The anchor of the main view.
91 css::uno::Reference<css::drawing::framework::XResourceId> mxMainViewAnchorId;
93 OUString msCurrentMainViewURL;
95 void HandleMainViewSwitch (
96 const OUString& rsViewURL,
97 const ::com::sun::star::uno::Reference<
98 com::sun::star::drawing::framework::XConfiguration>& rxConfiguration,
99 const bool bIsActivated);
100 void HandleResourceRequest(
101 bool bActivation,
102 const ::com::sun::star::uno::Reference<
103 com::sun::star::drawing::framework::XConfiguration>& rxConfiguration);
104 void UpdateForMainViewShell();
107 } } // end of namespace sd::framework
109 #endif
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */