LCOV - code coverage report
Current view: top level - chart2/source/controller/main - FeatureCommandDispatchBase.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 5 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_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
      20             : #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
      21             : 
      22             : #include "CommandDispatch.hxx"
      23             : 
      24             : #include <com/sun/star/frame/CommandGroup.hpp>
      25             : #include <com/sun/star/frame/DispatchInformation.hpp>
      26             : #include <com/sun/star/util/URL.hpp>
      27             : 
      28             : namespace chart
      29             : {
      30             : 
      31           0 : struct ControllerFeature: public ::com::sun::star::frame::DispatchInformation
      32             : {
      33             :     sal_uInt16 nFeatureId;
      34             : };
      35             : 
      36             : typedef ::std::map< OUString,
      37             :                     ControllerFeature,
      38             :                     ::std::less< OUString > > SupportedFeatures;
      39             : 
      40           0 : struct FeatureState
      41             : {
      42             :     bool bEnabled;
      43             :     ::com::sun::star::uno::Any aState;
      44             : 
      45           0 :     FeatureState() : bEnabled( false ) { }
      46             : };
      47             : 
      48             : /** This is a base class for CommandDispatch implementations with feature support.
      49             :  */
      50             : class FeatureCommandDispatchBase: public CommandDispatch
      51             : {
      52             : public:
      53             :     FeatureCommandDispatchBase( const ::com::sun::star::uno::Reference<
      54             :         ::com::sun::star::uno::XComponentContext >& rxContext );
      55             :     virtual ~FeatureCommandDispatchBase();
      56             : 
      57             :     // late initialisation, especially for adding as listener
      58             :     virtual void initialize() SAL_OVERRIDE;
      59             : 
      60             :     virtual bool isFeatureSupported( const OUString& rCommandURL );
      61             : 
      62             : protected:
      63             :     // XDispatch
      64             :     virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& URL,
      65             :         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
      66             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      67             : 
      68             :     virtual void fireStatusEvent( const OUString& rURL,
      69             :         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xSingleListener ) SAL_OVERRIDE;
      70             : 
      71             :     // state of a feature
      72             :     virtual FeatureState getState( const OUString& rCommand ) = 0;
      73             : 
      74             :     // execute a feature
      75             :     virtual void execute( const OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs ) = 0;
      76             : 
      77             :     // all the features which should be handled by this class
      78             :     virtual void describeSupportedFeatures() = 0;
      79             : 
      80             :     /** describes a feature supported by the controller
      81             : 
      82             :         Must not be called outside <member>describeSupportedFeatures</member>.
      83             : 
      84             :         @param pAsciiCommandURL
      85             :             the URL of the feature command
      86             :         @param nId
      87             :             the id of the feature. Later references to this feature usually happen by id, not by
      88             :             URL.
      89             :         @param nGroup
      90             :             the command group of the feature. This is important for configuring the controller UI
      91             :             by the user, see also <type scope="com::sun::star::frame">CommandGroup</type>.
      92             :     */
      93             :     void implDescribeSupportedFeature( const sal_Char* pAsciiCommandURL, sal_uInt16 nId,
      94             :         sal_Int16 nGroup = ::com::sun::star::frame::CommandGroup::INTERNAL );
      95             : 
      96             :     mutable SupportedFeatures m_aSupportedFeatures;
      97             : 
      98             :     sal_uInt16 m_nFeatureId;
      99             : 
     100             : private:
     101             :     void fillSupportedFeatures();
     102             : };
     103             : 
     104             : } //  namespace chart
     105             : 
     106             : // INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_FEATURECOMMANDDISPATCHBASE_HXX
     107             : #endif
     108             : 
     109             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10