LCOV - code coverage report
Current view: top level - sfx2/source/sidebar - ResourceManager.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 2 100.0 %
Date: 2014-11-03 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             : 
      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 (void);
      44             : 
      45             :     const DeckDescriptor* GetDeckDescriptor (
      46             :         const ::rtl::OUString& rsDeckId) const;
      47             :     const PanelDescriptor* GetPanelDescriptor (
      48             :         const ::rtl::OUString& rsPanelId) const;
      49             : 
      50             :     /** Excluded or include a deck from being displayed in the tab
      51             :         bar.
      52             :         Note that this value is not persistent.
      53             :         The flag can not be set directly at a DeckDescriptor object
      54             :         because the ResourceManager gives access to to them only
      55             :         read-only.
      56             :     */
      57             :     void SetIsDeckEnabled (
      58             :         const ::rtl::OUString& rsDeckId,
      59             :         const bool bIsEnabled);
      60             : 
      61       30636 :     class DeckContextDescriptor
      62             :     {
      63             :     public:
      64             :         ::rtl::OUString msId;
      65             :         bool mbIsEnabled;
      66             :     };
      67             :     typedef ::std::vector<DeckContextDescriptor> DeckContextDescriptorContainer;
      68             : 
      69       60780 :     class PanelContextDescriptor
      70             :     {
      71             :     public:
      72             :         ::rtl::OUString msId;
      73             :         ::rtl::OUString msMenuCommand;
      74             :         bool mbIsInitiallyVisible;
      75             :         bool mbShowForReadOnlyDocuments;
      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::XFrame>& rxFrame);
      84             : 
      85             :     const PanelContextDescriptorContainer& GetMatchingPanels (
      86             :         PanelContextDescriptorContainer& rPanelDescriptors,
      87             :         const Context& rContext,
      88             :         const ::rtl::OUString& rsDeckId,
      89             :         const css::uno::Reference<css::frame::XFrame>& rxFrame);
      90             : 
      91             :     /** Remember the expansions state per panel and context.
      92             :         This is not persistent past application end.
      93             :     */
      94             :     void StorePanelExpansionState (
      95             :         const ::rtl::OUString& rsPanelId,
      96             :         const bool bExpansionState,
      97             :         const Context& rContext);
      98             : 
      99             : private:
     100             :     ResourceManager (void);
     101             :     ~ResourceManager (void);
     102             : 
     103             :     typedef ::std::vector<DeckDescriptor> DeckContainer;
     104             :     DeckContainer maDecks;
     105             :     typedef ::std::vector<PanelDescriptor> PanelContainer;
     106             :     PanelContainer maPanels;
     107             :     mutable ::std::set<rtl::OUString> maProcessedApplications;
     108             : 
     109             :     void ReadDeckList (void);
     110             :     void ReadPanelList (void);
     111             :     void ReadContextList (
     112             :         const ::utl::OConfigurationNode& rNode,
     113             :         ContextList& rContextList,
     114             :         const ::rtl::OUString& rsDefaultMenuCommand) const;
     115             :     void ReadLegacyAddons (
     116             :         const css::uno::Reference<css::frame::XFrame>& rxFrame);
     117             :     ::utl::OConfigurationTreeRoot GetLegacyAddonRootNode (
     118             :         const ::rtl::OUString& rsModuleName) const;
     119             :     void GetToolPanelNodeNames (
     120             :         ::std::vector<rtl::OUString>& rMatchingNames,
     121             :         const ::utl::OConfigurationTreeRoot& aRoot) const;
     122             :     bool IsDeckEnabled (
     123             :         const ::rtl::OUString& rsDeckId,
     124             :         const Context& rContext,
     125             :         const css::uno::Reference<css::frame::XFrame>& rxFrame) const;
     126             : };
     127             : 
     128             : 
     129             : } } // end of namespace sfx2::sidebar
     130             : 
     131             : #endif
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10