LCOV - code coverage report
Current view: top level - sfx2/source/sidebar - ResourceManager.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 Functions: 8 8 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_RESOURCEMANAGER_HXX
      20             : #define INCLUDED_SFX2_SOURCE_SIDEBAR_RESOURCEMANAGER_HXX
      21             : 
      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>
      27             : #include <set>
      28             : #include <boost/shared_ptr.hpp>
      29             : #include <svtools/miscopt.hxx>
      30             : 
      31             : namespace sfx2 { namespace sidebar {
      32             : 
      33             : class Context;
      34             : class ContextList;
      35             : 
      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.
      39             : */
      40             : class ResourceManager
      41             : {
      42             : public:
      43             :     static ResourceManager& Instance();
      44             : 
      45             :     const DeckDescriptor* GetDeckDescriptor(const OUString& rsDeckId) const;
      46             :     const PanelDescriptor* GetPanelDescriptor(const OUString& rsPanelId) const;
      47             : 
      48             :     /** Excluded or include a deck from being displayed in the tab
      49             :         bar.
      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
      53             :         read-only.
      54             :     */
      55             :     void SetIsDeckEnabled(const OUString& rsDeckId, const bool bIsEnabled);
      56             : 
      57       32300 :     class DeckContextDescriptor
      58             :     {
      59             :     public:
      60             :         OUString msId;
      61             :         bool mbIsEnabled;
      62             :     };
      63             :     typedef std::vector<DeckContextDescriptor> DeckContextDescriptorContainer;
      64             : 
      65       43906 :     class PanelContextDescriptor
      66             :     {
      67             :     public:
      68             :         OUString msId;
      69             :         OUString msMenuCommand;
      70             :         bool mbIsInitiallyVisible;
      71             :         bool mbShowForReadOnlyDocuments;
      72             :     };
      73             :     typedef std::vector<PanelContextDescriptor> PanelContextDescriptorContainer;
      74             : 
      75             :     const DeckContextDescriptorContainer& GetMatchingDecks(
      76             :                                             DeckContextDescriptorContainer& rDeckDescriptors,
      77             :                                             const Context& rContext,
      78             :                                             const bool bIsDocumentReadOnly,
      79             :                                             const css::uno::Reference<css::frame::XFrame>& rxFrame);
      80             : 
      81             :     const PanelContextDescriptorContainer& GetMatchingPanels(
      82             :                                             PanelContextDescriptorContainer& rPanelDescriptors,
      83             :                                             const Context& rContext,
      84             :                                             const OUString& rsDeckId,
      85             :                                             const css::uno::Reference<css::frame::XFrame>& rxFrame);
      86             : 
      87             :     /** Remember the expansions state per panel and context.
      88             :         This is not persistent past application end.
      89             :     */
      90             :     void StorePanelExpansionState(const OUString& rsPanelId,
      91             :                                   const bool bExpansionState,
      92             :                                   const Context& rContext);
      93             : 
      94             : private:
      95             :     ResourceManager();
      96             :     ~ResourceManager();
      97             : 
      98             :     typedef std::vector<DeckDescriptor> DeckContainer;
      99             :     DeckContainer maDecks;
     100             : 
     101             :     typedef std::vector<PanelDescriptor> PanelContainer;
     102             :     PanelContainer maPanels;
     103             :     mutable std::set<rtl::OUString> maProcessedApplications;
     104             : 
     105             :     SvtMiscOptions maMiscOptions;
     106             : 
     107             :     void ReadDeckList();
     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);
     119             : };
     120             : 
     121             : } } // end of namespace sfx2::sidebar
     122             : 
     123             : #endif
     124             : 
     125             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11