tdf#130857 qt weld: Support "Java Start Parameters" dialog
[LibreOffice.git] / include / sfx2 / sidebar / ResourceManager.hxx
blob9ac1130cc29b2bf5ac7a36e753186ff919535193
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 .
19 #pragma once
21 #include <unotools/confignode.hxx>
22 #include <map>
23 #include <vector>
24 #include <set>
26 #include <sfx2/dllapi.h>
28 namespace com::sun::star::frame { class XController; }
29 namespace com::sun::star::frame { class XModel; }
30 namespace sfx2::sidebar { class DeckDescriptor; }
31 namespace sfx2::sidebar { class PanelDescriptor; }
33 namespace sfx2::sidebar {
35 class Context;
36 class ContextList;
38 /** Read the content of the Sidebar.xcu file and provide access
39 methods so that the sidebar can easily decide which content panels
40 to display for a certain context.
42 class SFX2_DLLPUBLIC ResourceManager
44 public:
46 ResourceManager();
47 ~ResourceManager();
49 std::shared_ptr<DeckDescriptor> GetDeckDescriptor(std::u16string_view rsDeckId) const;
50 std::shared_ptr<PanelDescriptor> GetPanelDescriptor(std::u16string_view rsPanelId) const;
52 void UpdateModel(const css::uno::Reference<css::frame::XModel>& xModel);
54 void InitDeckContext(const Context& rContex);
55 void SaveDecksSettings(const Context& rContext);
56 void SaveDeckSettings(const DeckDescriptor* pDeckDesc);
57 void SaveLastActiveDeck(const Context& rContext, const OUString& rActiveDeck);
59 void disposeDecks();
61 class DeckContextDescriptor
63 public:
64 OUString msId;
65 bool mbIsEnabled;
67 typedef std::vector<DeckContextDescriptor> DeckContextDescriptorContainer;
69 class PanelContextDescriptor
71 public:
72 OUString msId;
73 OUString msMenuCommand;
74 bool mbIsInitiallyVisible;
75 bool mbShowForReadOnlyDocuments;
77 typedef std::vector<PanelContextDescriptor> PanelContextDescriptorContainer;
79 const DeckContextDescriptorContainer& GetMatchingDecks(
80 DeckContextDescriptorContainer& rDeckDescriptors,
81 const Context& rContext,
82 const bool bIsDocumentReadOnly,
83 const css::uno::Reference<css::frame::XController>& rxController);
85 const PanelContextDescriptorContainer& GetMatchingPanels(
86 PanelContextDescriptorContainer& rPanelDescriptors,
87 const Context& rContext,
88 std::u16string_view rsDeckId,
89 const css::uno::Reference<css::frame::XController>& rxController);
91 const OUString& GetLastActiveDeck( const Context& rContext );
92 void SetLastActiveDeck( const Context& rContext, const OUString& rsDeckId );
94 /** Remember the expansions state per panel and context.
96 void StorePanelExpansionState(std::u16string_view rsPanelId,
97 const bool bExpansionState,
98 const Context& rContext);
100 private:
103 typedef std::vector<std::shared_ptr<DeckDescriptor>> DeckContainer;
104 DeckContainer maDecks;
106 typedef std::vector<std::shared_ptr<PanelDescriptor>> PanelContainer;
107 PanelContainer maPanels;
108 mutable std::set<OUString> maProcessedApplications;
109 std::map<OUString, OUString> maLastActiveDecks;
111 void ReadDeckList();
112 void ReadPanelList();
113 void ReadLastActive();
114 static void ReadContextList(const utl::OConfigurationNode& rNode,
115 ContextList& rContextList,
116 const OUString& rsDefaultMenuCommand);
118 void ReadLegacyAddons(const css::uno::Reference<css::frame::XController>& rxController);
119 static utl::OConfigurationTreeRoot GetLegacyAddonRootNode(const OUString& rsModuleName);
120 static void GetToolPanelNodeNames(std::vector<OUString>& rMatchingNames,
121 const utl::OConfigurationTreeRoot& aRoot);
122 bool IsDeckEnabled(std::u16string_view rsDeckId,
123 const Context& rContext,
124 const css::uno::Reference<css::frame::XController>& rxController);
126 std::shared_ptr<DeckDescriptor> ImplGetDeckDescriptor(std::u16string_view rsDeckId) const;
127 std::shared_ptr<PanelDescriptor> ImplGetPanelDescriptor(std::u16string_view rsPanelId) const;
130 } // end of namespace sfx2::sidebar
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */