1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_RESOURCEMANAGER_HXX
20 #define INCLUDED_SFX2_SOURCE_SIDEBAR_RESOURCEMANAGER_HXX
22 #include "DeckDescriptor.hxx"
23 #include "PanelDescriptor.hxx"
24 #include "Context.hxx"
25 #include <unotools/confignode.hxx>
26 #include <com/sun/star/frame/XFrame.hpp>
28 #include <boost/shared_ptr.hpp>
29 #include <svtools/miscopt.hxx>
31 namespace sfx2
{ namespace sidebar
{
36 /** Read the content of the Sidebar.xcu file and provide access
37 methods so that the sidebar can easily decide which content panels
38 to display for a certain context.
43 static ResourceManager
& Instance();
45 const DeckDescriptor
* GetDeckDescriptor(const OUString
& rsDeckId
) const;
46 const PanelDescriptor
* GetPanelDescriptor(const OUString
& rsPanelId
) const;
48 /** Excluded or include a deck from being displayed in the tab
50 Note that this value is not persistent.
51 The flag can not be set directly at a DeckDescriptor object
52 because the ResourceManager gives access to them only
55 void SetIsDeckEnabled(const OUString
& rsDeckId
, const bool bIsEnabled
);
57 class DeckContextDescriptor
63 typedef std::vector
<DeckContextDescriptor
> DeckContextDescriptorContainer
;
65 class PanelContextDescriptor
69 OUString msMenuCommand
;
70 bool mbIsInitiallyVisible
;
71 bool mbShowForReadOnlyDocuments
;
73 typedef std::vector
<PanelContextDescriptor
> PanelContextDescriptorContainer
;
75 const DeckContextDescriptorContainer
& GetMatchingDecks(
76 DeckContextDescriptorContainer
& rDeckDescriptors
,
77 const Context
& rContext
,
78 const bool bIsDocumentReadOnly
,
79 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
);
81 const PanelContextDescriptorContainer
& GetMatchingPanels(
82 PanelContextDescriptorContainer
& rPanelDescriptors
,
83 const Context
& rContext
,
84 const OUString
& rsDeckId
,
85 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
);
87 /** Remember the expansions state per panel and context.
88 This is not persistent past application end.
90 void StorePanelExpansionState(const OUString
& rsPanelId
,
91 const bool bExpansionState
,
92 const Context
& rContext
);
98 typedef std::vector
<DeckDescriptor
> DeckContainer
;
99 DeckContainer maDecks
;
101 typedef std::vector
<PanelDescriptor
> PanelContainer
;
102 PanelContainer maPanels
;
103 mutable std::set
<rtl::OUString
> maProcessedApplications
;
105 SvtMiscOptions maMiscOptions
;
108 void ReadPanelList();
109 static void ReadContextList(const utl::OConfigurationNode
& rNode
,
110 ContextList
& rContextList
,
111 const OUString
& rsDefaultMenuCommand
);
112 void ReadLegacyAddons(const css::uno::Reference
<css::frame::XFrame
>& rxFrame
);
113 static utl::OConfigurationTreeRoot
GetLegacyAddonRootNode(const OUString
& rsModuleName
);
114 static void GetToolPanelNodeNames(std::vector
<OUString
>& rMatchingNames
,
115 const utl::OConfigurationTreeRoot
& aRoot
);
116 static bool IsDeckEnabled(const OUString
& rsDeckId
,
117 const Context
& rContext
,
118 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
);
121 } } // end of namespace sfx2::sidebar
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */