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" 277a32b0c8SAndre 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 397a32b0c8SAndre Fischer class Context; 40f120fe41SAndre Fischer class ContextList; 417a32b0c8SAndre Fischer 42ff12d537SAndre Fischer /** Read the content of the Sidebar.xcu file and provide access 43ff12d537SAndre Fischer methods so that the sidebar can easily decide which content panels 44ff12d537SAndre Fischer to display for a certain context. 45ff12d537SAndre Fischer */ 46ff12d537SAndre Fischer class ResourceManager 47ff12d537SAndre Fischer { 48ff12d537SAndre Fischer public: 49ff12d537SAndre Fischer static ResourceManager& Instance (void); 50ff12d537SAndre Fischer 5195a18594SAndre Fischer const DeckDescriptor* GetDeckDescriptor ( 5295a18594SAndre Fischer const ::rtl::OUString& rsDeckId) const; 5395a18594SAndre Fischer const PanelDescriptor* GetPanelDescriptor ( 5495a18594SAndre Fischer const ::rtl::OUString& rsPanelId) const; 5595a18594SAndre Fischer 5695a18594SAndre Fischer /** Excluded or include a deck from being displayed in the tab 5795a18594SAndre Fischer bar. 5895a18594SAndre Fischer Note that this value is not persistent. 5995a18594SAndre Fischer The flag can not be set directly at a DeckDescriptor object 6095a18594SAndre Fischer because the ResourceManager gives access to to them only 6195a18594SAndre Fischer read-only. 6295a18594SAndre Fischer */ 6395a18594SAndre Fischer void SetIsDeckEnabled ( 6495a18594SAndre Fischer const ::rtl::OUString& rsDeckId, 6595a18594SAndre Fischer const bool bIsEnabled); 6695a18594SAndre Fischer 67*13e1c3b4SAndre Fischer class DeckContextDescriptor 68*13e1c3b4SAndre Fischer { 69*13e1c3b4SAndre Fischer public: 70*13e1c3b4SAndre Fischer ::rtl::OUString msId; 71*13e1c3b4SAndre Fischer bool mbIsEnabled; 72*13e1c3b4SAndre Fischer }; 73*13e1c3b4SAndre Fischer typedef ::std::vector<DeckContextDescriptor> DeckContextDescriptorContainer; 74*13e1c3b4SAndre Fischer 75f120fe41SAndre Fischer class PanelContextDescriptor 76f120fe41SAndre Fischer { 77f120fe41SAndre Fischer public: 78f120fe41SAndre Fischer ::rtl::OUString msId; 79f120fe41SAndre Fischer ::rtl::OUString msMenuCommand; 80f120fe41SAndre Fischer bool mbIsInitiallyVisible; 81*13e1c3b4SAndre Fischer bool mbShowForReadOnlyDocuments; 82f120fe41SAndre Fischer }; 83f120fe41SAndre Fischer typedef ::std::vector<PanelContextDescriptor> PanelContextDescriptorContainer; 84f120fe41SAndre Fischer 85*13e1c3b4SAndre Fischer const DeckContextDescriptorContainer& GetMatchingDecks ( 86*13e1c3b4SAndre Fischer DeckContextDescriptorContainer& rDeckDescriptors, 877a32b0c8SAndre Fischer const Context& rContext, 88*13e1c3b4SAndre Fischer const bool bIsDocumentReadOnly, 89ff12d537SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 90ff12d537SAndre Fischer 91f120fe41SAndre Fischer const PanelContextDescriptorContainer& GetMatchingPanels ( 92f120fe41SAndre Fischer PanelContextDescriptorContainer& rPanelDescriptors, 937a32b0c8SAndre Fischer const Context& rContext, 94ff12d537SAndre Fischer const ::rtl::OUString& rsDeckId, 95ff12d537SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 96ff12d537SAndre Fischer 9795a18594SAndre Fischer static ::rtl::OUString GetModuleName ( 9895a18594SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 9995a18594SAndre Fischer 100ff12d537SAndre Fischer private: 101ff12d537SAndre Fischer ResourceManager (void); 102ff12d537SAndre Fischer ~ResourceManager (void); 103ff12d537SAndre Fischer class Deleter; 104ff12d537SAndre Fischer friend class Deleter; 105ff12d537SAndre Fischer 10695a18594SAndre Fischer typedef ::std::vector<DeckDescriptor> DeckContainer; 107ff12d537SAndre Fischer DeckContainer maDecks; 10895a18594SAndre Fischer typedef ::std::vector<PanelDescriptor> PanelContainer; 109ff12d537SAndre Fischer PanelContainer maPanels; 110ff12d537SAndre Fischer mutable ::std::set<rtl::OUString> maProcessedApplications; 111ff12d537SAndre Fischer 112ff12d537SAndre Fischer void ReadDeckList (void); 113ff12d537SAndre Fischer void ReadPanelList (void); 114f120fe41SAndre Fischer void ReadContextList ( 115ff12d537SAndre Fischer const ::utl::OConfigurationNode& rNode, 116f120fe41SAndre Fischer ContextList& rContextList, 117f120fe41SAndre Fischer const ::rtl::OUString& rsDefaultMenuCommand) const; 118ff12d537SAndre Fischer void ReadLegacyAddons ( 119ff12d537SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame); 120ff12d537SAndre Fischer ::utl::OConfigurationTreeRoot GetLegacyAddonRootNode ( 121ff12d537SAndre Fischer const ::rtl::OUString& rsModuleName) const; 122ff12d537SAndre Fischer void GetToolPanelNodeNames ( 123ff12d537SAndre Fischer ::std::vector<rtl::OUString>& rMatchingNames, 124ff12d537SAndre Fischer const ::utl::OConfigurationTreeRoot aRoot) const; 125*13e1c3b4SAndre Fischer bool IsDeckEnabled ( 126*13e1c3b4SAndre Fischer const ::rtl::OUString& rsDeckId, 127*13e1c3b4SAndre Fischer const Context& rContext, 128*13e1c3b4SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame) const; 129ff12d537SAndre Fischer }; 130ff12d537SAndre Fischer 131ff12d537SAndre Fischer 132ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 133ff12d537SAndre Fischer 134ff12d537SAndre Fischer #endif 135