LibreOffice Module sfx2 (master) 1
ResourceManager.hxx
Go to the documentation of this file.
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#pragma once
20
22#include <map>
23#include <vector>
24#include <set>
25
26#include <sfx2/dllapi.h>
27
28namespace com::sun::star::frame { class XController; }
29namespace com::sun::star::frame { class XModel; }
30namespace sfx2::sidebar { class DeckDescriptor; }
31namespace sfx2::sidebar { class PanelDescriptor; }
32
33namespace sfx2::sidebar {
34
35class Context;
36class ContextList;
37
43{
44public:
45
48
49 std::shared_ptr<DeckDescriptor> GetDeckDescriptor(std::u16string_view rsDeckId) const;
50 std::shared_ptr<PanelDescriptor> GetPanelDescriptor(std::u16string_view rsPanelId) const;
51
52 void UpdateModel(const css::uno::Reference<css::frame::XModel>& xModel);
53
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);
58
59 void disposeDecks();
60
62 {
63 public:
64 OUString msId;
66 };
67 typedef std::vector<DeckContextDescriptor> DeckContextDescriptorContainer;
68
70 {
71 public:
72 OUString msId;
73 OUString msMenuCommand;
76 };
77 typedef std::vector<PanelContextDescriptor> PanelContextDescriptorContainer;
78
79 const DeckContextDescriptorContainer& GetMatchingDecks(
80 DeckContextDescriptorContainer& rDeckDescriptors,
81 const Context& rContext,
82 const bool bIsDocumentReadOnly,
83 const css::uno::Reference<css::frame::XController>& rxController);
84
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);
90
91 const OUString& GetLastActiveDeck( const Context& rContext );
92 void SetLastActiveDeck( const Context& rContext, const OUString& rsDeckId );
93
96 void StorePanelExpansionState(std::u16string_view rsPanelId,
97 const bool bExpansionState,
98 const Context& rContext);
99
100private:
101
102
103 typedef std::vector<std::shared_ptr<DeckDescriptor>> DeckContainer;
105
106 typedef std::vector<std::shared_ptr<PanelDescriptor>> PanelContainer;
108 mutable std::set<OUString> maProcessedApplications;
109 std::map<OUString, OUString> maLastActiveDecks;
110
111 void ReadDeckList();
112 void ReadPanelList();
113 void ReadLastActive();
114 static void ReadContextList(const utl::OConfigurationNode& rNode,
115 ContextList& rContextList,
116 const OUString& rsDefaultMenuCommand);
117
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);
125
126 std::shared_ptr<DeckDescriptor> ImplGetDeckDescriptor(std::u16string_view rsDeckId) const;
127 std::shared_ptr<PanelDescriptor> ImplGetPanelDescriptor(std::u16string_view rsPanelId) const;
128};
129
130} // end of namespace sfx2::sidebar
131
132/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Per context data for deck and panel descriptors.
Definition: ContextList.hxx:31
Read the content of the Sidebar.xcu file and provide access methods so that the sidebar can easily de...
std::map< OUString, OUString > maLastActiveDecks
std::vector< PanelContextDescriptor > PanelContextDescriptorContainer
std::vector< std::shared_ptr< DeckDescriptor > > DeckContainer
std::set< OUString > maProcessedApplications
std::vector< DeckContextDescriptor > DeckContextDescriptorContainer
std::vector< std::shared_ptr< PanelDescriptor > > PanelContainer
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
Reference< XModel > xModel