LCOV - code coverage report
Current view: top level - sd/inc - CustomAnimationPreset.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 13 0.0 %
Date: 2014-04-14 Functions: 0 12 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             : 
      20             : #ifndef INCLUDED_SD_INC_CUSTOMANIMATIONPRESET_HXX
      21             : #define INCLUDED_SD_INC_CUSTOMANIMATIONPRESET_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <vector>
      26             : 
      27             : #include <boost/shared_ptr.hpp>
      28             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      29             : #include <com/sun/star/animations/AnimationNodeType.hpp>
      30             : 
      31             : #include <CustomAnimationEffect.hxx>
      32             : 
      33             : #include <boost/unordered_map.hpp>
      34             : 
      35             : namespace sd {
      36             : 
      37             : typedef boost::unordered_map< OUString, CustomAnimationEffectPtr, OUStringHash > EffectsSubTypeMap;
      38             : typedef boost::unordered_map< OUString, OUString, OUStringHash > UStringMap;
      39             : typedef std::vector< OUString > UStringList;
      40             : 
      41           0 : class CustomAnimationPreset
      42             : {
      43             :     friend class CustomAnimationPresets;
      44             : 
      45             : public:
      46             :     CustomAnimationPreset( CustomAnimationEffectPtr pEffect );
      47             : 
      48             :     void add( CustomAnimationEffectPtr pEffect );
      49             : 
      50             :     SD_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > create( const OUString& rstrSubType );
      51             : 
      52           0 :     const OUString& getPresetId() const { return maPresetId; }
      53             :     const OUString& getProperty() const { return maProperty; }
      54           0 :     const OUString& getLabel() const { return maLabel; }
      55             :     sal_Int16 getPresetClass() const { return mnPresetClass; }
      56           0 :     double getDuration() const { return mfDuration; }
      57             : 
      58             :     UStringList getSubTypes();
      59             :     UStringList getProperties() const;
      60             : 
      61             :     bool hasProperty( const OUString& rProperty ) const;
      62           0 :     bool isTextOnly() const { return mbIsTextOnly; }
      63             : 
      64             : private:
      65             :     OUString maPresetId;
      66             :     OUString maProperty;
      67             :     sal_Int16 mnPresetClass;
      68             :     OUString maLabel;
      69             :     OUString maDefaultSubTyp;
      70             :     double mfDuration;
      71             :     bool mbIsTextOnly;
      72             : 
      73             :     EffectsSubTypeMap maSubTypes;
      74             : };
      75             : 
      76             : typedef boost::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr;
      77             : typedef boost::unordered_map<OUString, CustomAnimationPresetPtr, OUStringHash> EffectDescriptorMap;
      78             : typedef std::vector< CustomAnimationPresetPtr > EffectDescriptorList;
      79             : 
      80           0 : struct PresetCategory
      81             : {
      82             :     OUString maLabel;
      83             :     EffectDescriptorList maEffects;
      84             : 
      85           0 :     PresetCategory( const OUString& rLabel, const EffectDescriptorList& rEffects )
      86           0 :         : maLabel( rLabel ), maEffects( rEffects ) {}
      87             : };
      88             : typedef boost::shared_ptr< PresetCategory > PresetCategoryPtr;
      89             : typedef std::vector< PresetCategoryPtr > PresetCategoryList;
      90             : 
      91             : class CustomAnimationPresets
      92             : {
      93             : public:
      94             :     CustomAnimationPresets();
      95             :     virtual ~CustomAnimationPresets();
      96             : 
      97             :     void init();
      98             : 
      99             :     SD_DLLPUBLIC static const CustomAnimationPresets& getCustomAnimationPresets();
     100             : 
     101             :     ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getRandomPreset( sal_Int16 nPresetClass ) const;
     102             : 
     103             :     SD_DLLPUBLIC CustomAnimationPresetPtr getEffectDescriptor( const OUString& rPresetId ) const;
     104             : 
     105             :     const OUString& getUINameForPresetId( const OUString& rPresetId ) const;
     106             :     const OUString& getUINameForProperty( const OUString& rProperty ) const;
     107             : 
     108           0 :     const PresetCategoryList& getEntrancePresets() const { return maEntrancePresets; }
     109           0 :     const PresetCategoryList& getEmphasisPresets() const { return maEmphasisPresets; }
     110           0 :     const PresetCategoryList& getExitPresets() const { return maExitPresets; }
     111           0 :     const PresetCategoryList& getMotionPathsPresets() const { return maMotionPathsPresets; }
     112           0 :     const PresetCategoryList& getMiscPresets() const { return maMiscPresets; }
     113             : 
     114             :     void changePresetSubType( CustomAnimationEffectPtr pEffect, const OUString& rPresetSubType ) const;
     115             : 
     116             : private:
     117             :     void importEffects();
     118             :     void importResources();
     119             : 
     120             :     void importPresets( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xConfigProvider, const OUString& rNodePath, PresetCategoryList& rPresetMap  );
     121             : 
     122             :     const OUString& translateName( const OUString& rId, const UStringMap& rNameMap ) const;
     123             : 
     124             : private:
     125             :     ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxRootNode;
     126             :     EffectDescriptorMap maEffectDiscriptorMap;
     127             :     UStringMap maEffectNameMap;
     128             :     UStringMap maPropertyNameMap;
     129             : 
     130             :     PresetCategoryList maEntrancePresets;
     131             :     PresetCategoryList maEmphasisPresets;
     132             :     PresetCategoryList maExitPresets;
     133             :     PresetCategoryList maMotionPathsPresets;
     134             :     PresetCategoryList maMiscPresets;
     135             : 
     136             :     static CustomAnimationPresets*  mpCustomAnimationPresets;
     137             : };
     138             : 
     139             : typedef boost::shared_ptr< CustomAnimationPresets > CustomAnimationPresetsPtr;
     140             : 
     141             : }
     142             : 
     143             : #endif // _SD_CUSTOMANIMATIONEFFECTS_HXX
     144             : 
     145             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10