1ff12d537SAndre Fischer /************************************************************** 2ff12d537SAndre Fischer * 3ff12d537SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 4ff12d537SAndre Fischer * or more contributor license agreements. See the NOTICE file 5ff12d537SAndre Fischer * distributed with this work for additional information 6ff12d537SAndre Fischer * regarding copyright ownership. The ASF licenses this file 7ff12d537SAndre Fischer * to you under the Apache License, Version 2.0 (the 8ff12d537SAndre Fischer * "License"); you may not use this file except in compliance 9ff12d537SAndre Fischer * with the License. You may obtain a copy of the License at 10ff12d537SAndre Fischer * 11ff12d537SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 12ff12d537SAndre Fischer * 13ff12d537SAndre Fischer * Unless required by applicable law or agreed to in writing, 14ff12d537SAndre Fischer * software distributed under the License is distributed on an 15ff12d537SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16ff12d537SAndre Fischer * KIND, either express or implied. See the License for the 17ff12d537SAndre Fischer * specific language governing permissions and limitations 18ff12d537SAndre Fischer * under the License. 19ff12d537SAndre Fischer * 20ff12d537SAndre Fischer *************************************************************/ 21ff12d537SAndre Fischer 22ff12d537SAndre Fischer #ifndef SFX_SIDEBAR_RESOURCE_MANAGER_HXX 23ff12d537SAndre Fischer #define SFX_SIDEBAR_RESOURCE_MANAGER_HXX 24ff12d537SAndre Fischer 25ff12d537SAndre Fischer #include "DeckDescriptor.hxx" 26ff12d537SAndre Fischer #include "PanelDescriptor.hxx" 27*7a32b0c8SAndre Fischer #include "Context.hxx" 2895a18594SAndre Fischer #include <unotools/confignode.hxx> 2995a18594SAndre Fischer #include <com/sun/star/frame/XFrame.hpp> 30ff12d537SAndre Fischer #include <set> 31ff12d537SAndre Fischer #include <boost/shared_ptr.hpp> 32ff12d537SAndre Fischer 33ff12d537SAndre Fischer 34ff12d537SAndre Fischer namespace css = ::com::sun::star; 35ff12d537SAndre Fischer namespace cssu = ::com::sun::star::uno; 36ff12d537SAndre Fischer 37ff12d537SAndre Fischer namespace sfx2 { namespace sidebar { 38ff12d537SAndre Fischer 39*7a32b0c8SAndre Fischer class Context; 40*7a32b0c8SAndre Fischer 41ff12d537SAndre Fischer /** Read the content of the Sidebar.xcu file and provide access 42ff12d537SAndre Fischer methods so that the sidebar can easily decide which content panels 43ff12d537SAndre Fischer to display for a certain context. 44ff12d537SAndre Fischer */ 45ff12d537SAndre Fischer class ResourceManager 46ff12d537SAndre Fischer { 47ff12d537SAndre Fischer public: 48ff12d537SAndre Fischer static ResourceManager& Instance (void); 49ff12d537SAndre Fischer 50ff12d537SAndre Fischer const DeckDescriptor* GetBestMatchingDeck ( 51*7a32b0c8SAndre Fischer const Context& rContext, 52ff12d537SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 53ff12d537SAndre Fischer 5495a18594SAndre Fischer const DeckDescriptor* GetDeckDescriptor ( 5595a18594SAndre Fischer const ::rtl::OUString& rsDeckId) const; 5695a18594SAndre Fischer const PanelDescriptor* GetPanelDescriptor ( 5795a18594SAndre Fischer const ::rtl::OUString& rsPanelId) const; 5895a18594SAndre Fischer 5995a18594SAndre Fischer /** Excluded or include a deck from being displayed in the tab 6095a18594SAndre Fischer bar. 6195a18594SAndre Fischer Note that this value is not persistent. 6295a18594SAndre Fischer The flag can not be set directly at a DeckDescriptor object 6395a18594SAndre Fischer because the ResourceManager gives access to to them only 6495a18594SAndre Fischer read-only. 6595a18594SAndre Fischer */ 6695a18594SAndre Fischer void SetIsDeckEnabled ( 6795a18594SAndre Fischer const ::rtl::OUString& rsDeckId, 6895a18594SAndre Fischer const bool bIsEnabled); 6995a18594SAndre Fischer 7095a18594SAndre Fischer typedef ::std::vector<rtl::OUString> IdContainer; 71ff12d537SAndre Fischer 7295a18594SAndre Fischer const IdContainer& GetMatchingDecks ( 7395a18594SAndre Fischer IdContainer& rDeckDescriptors, 74*7a32b0c8SAndre Fischer const Context& rContext, 75ff12d537SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 76ff12d537SAndre Fischer 7795a18594SAndre Fischer const IdContainer& GetMatchingPanels ( 7895a18594SAndre Fischer IdContainer& rPanelDescriptors, 79*7a32b0c8SAndre Fischer const Context& rContext, 80ff12d537SAndre Fischer const ::rtl::OUString& rsDeckId, 81ff12d537SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 82ff12d537SAndre Fischer 8395a18594SAndre Fischer static ::rtl::OUString GetModuleName ( 8495a18594SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 8595a18594SAndre Fischer 86ff12d537SAndre Fischer private: 87ff12d537SAndre Fischer ResourceManager (void); 88ff12d537SAndre Fischer ~ResourceManager (void); 89ff12d537SAndre Fischer class Deleter; 90ff12d537SAndre Fischer friend class Deleter; 91ff12d537SAndre Fischer 9295a18594SAndre Fischer typedef ::std::vector<DeckDescriptor> DeckContainer; 93ff12d537SAndre Fischer DeckContainer maDecks; 9495a18594SAndre Fischer typedef ::std::vector<PanelDescriptor> PanelContainer; 95ff12d537SAndre Fischer PanelContainer maPanels; 96ff12d537SAndre Fischer mutable ::std::set<rtl::OUString> maProcessedApplications; 97ff12d537SAndre Fischer 98ff12d537SAndre Fischer void ReadDeckList (void); 99ff12d537SAndre Fischer void ReadPanelList (void); 100*7a32b0c8SAndre Fischer void ReadContextMatcher ( 101ff12d537SAndre Fischer const ::utl::OConfigurationNode& rNode, 102*7a32b0c8SAndre Fischer ContextMatcher& rContextMatcher) const; 103ff12d537SAndre Fischer void ReadLegacyAddons ( 104ff12d537SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 105ff12d537SAndre Fischer ::utl::OConfigurationTreeRoot GetLegacyAddonRootNode ( 106ff12d537SAndre Fischer const ::rtl::OUString& rsModuleName) const; 107ff12d537SAndre Fischer void GetToolPanelNodeNames ( 108ff12d537SAndre Fischer ::std::vector<rtl::OUString>& rMatchingNames, 109ff12d537SAndre Fischer const ::utl::OConfigurationTreeRoot aRoot) const; 110ff12d537SAndre Fischer }; 111ff12d537SAndre Fischer 112ff12d537SAndre Fischer 113ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 114ff12d537SAndre Fischer 115ff12d537SAndre Fischer #endif 116