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

Generated by: LCOV version 1.10