LCOV - code coverage report
Current view: top level - writerfilter/source/dmapper - NumberingManager.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 17 82.4 %
Date: 2012-08-25 Functions: 13 16 81.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 50.0 %

           Branch data     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_NUMBERINGMANAGER_HXX
      21                 :            : #define INCLUDED_NUMBERINGMANAGER_HXX
      22                 :            : 
      23                 :            : #include "PropertyMap.hxx"
      24                 :            : 
      25                 :            : #include <WriterFilterDllApi.hxx>
      26                 :            : #include <dmapper/DomainMapper.hxx>
      27                 :            : #include <resourcemodel/LoggedResources.hxx>
      28                 :            : 
      29                 :            : #include <editeng/numitem.hxx>
      30                 :            : 
      31                 :            : #include <com/sun/star/container/XIndexReplace.hpp>
      32                 :            : 
      33                 :            : namespace writerfilter {
      34                 :            : namespace dmapper {
      35                 :            : 
      36                 :            : class DomainMapper;
      37                 :            : class StyleSheetEntry;
      38                 :            : 
      39                 :            : 
      40                 :            : /** Class representing the numbering level properties.
      41                 :            :  */
      42                 :            : class ListLevel : public PropertyMap
      43                 :            : {
      44                 :            :     sal_Int32                                     m_nIStartAt;       //LN_ISTARTAT
      45                 :            :     sal_Int32                                     m_nNFC;            //LN_NFC
      46                 :            :     sal_Int32                                     m_nJC;             //LN_JC
      47                 :            :     sal_Int32                                     m_nFLegal;         //LN_FLEGAL
      48                 :            :     sal_Int32                                     m_nFNoRestart;     //LN_FNORESTART
      49                 :            :     sal_Int32                                     m_nFPrev;          //LN_FPREV
      50                 :            :     sal_Int32                                     m_nFPrevSpace;     //LN_FPREVSPACE
      51                 :            :     sal_Int32                                     m_nFWord6;         //LN_FWORD6
      52                 :            :     OUString                               m_sRGBXchNums;     //LN_RGBXCHNUMS
      53                 :            :     sal_Int16                                     m_nXChFollow;      //LN_IXCHFOLLOW
      54                 :            :     OUString                               m_sBulletChar;
      55                 :            :     sal_Int32                                     m_nTabstop;
      56                 :            :     boost::shared_ptr< StyleSheetEntry >          m_pParaStyle;
      57                 :            :     bool                                          m_outline;
      58                 :            : 
      59                 :            : public:
      60                 :            : 
      61                 :            :     typedef boost::shared_ptr< ListLevel > Pointer;
      62                 :            : 
      63                 :        612 :     ListLevel() :
      64                 :            :         m_nIStartAt(-1)
      65                 :            :         ,m_nNFC(-1)
      66                 :            :         ,m_nJC(-1)
      67                 :            :         ,m_nFLegal(-1)
      68                 :            :         ,m_nFNoRestart(-1)
      69                 :            :         ,m_nFPrev(-1)
      70                 :            :         ,m_nFPrevSpace(-1)
      71                 :            :         ,m_nFWord6(-1)
      72                 :            :         ,m_nXChFollow(SvxNumberFormat::LISTTAB)
      73                 :            :         ,m_nTabstop( 0 )
      74         [ +  - ]:        612 :         ,m_outline(false)
      75                 :        612 :         {}
      76                 :            : 
      77 [ +  - ][ -  + ]:       1224 :     ~ListLevel( ){ }
      78                 :            : 
      79                 :            :     // Setters for the import
      80                 :            :     void SetValue( Id nId, sal_Int32 nValue );
      81                 :        612 :     void SetBulletChar( OUString sValue ) { m_sBulletChar = sValue; };
      82                 :            :     void SetParaStyle( boost::shared_ptr< StyleSheetEntry > pStyle );
      83                 :          0 :     void AddRGBXchNums( OUString sValue ) { m_sRGBXchNums += sValue; };
      84                 :            : 
      85                 :            :     // Getters
      86                 :        573 :     OUString GetBulletChar( ) { return m_sBulletChar; };
      87                 :        573 :     boost::shared_ptr< StyleSheetEntry > GetParaStyle( ) { return m_pParaStyle; };
      88                 :       1359 :     bool isOutlineNumbering() const { return m_outline; }
      89                 :            : 
      90                 :            :     // UNO mapping functions
      91                 :            : 
      92                 :            :     // rPrefix and rSuffix are out parameters
      93                 :            :     static sal_Int16 GetParentNumbering( OUString sText, sal_Int16 nLevel,
      94                 :            :         OUString& rPrefix, OUString& rSuffix );
      95                 :            : 
      96                 :            :     com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
      97                 :            :         GetProperties(  );
      98                 :            : 
      99                 :            :     com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue>
     100                 :            :         GetCharStyleProperties( );
     101                 :            : private:
     102                 :            : 
     103                 :            :     com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
     104                 :            :         GetLevelProperties(  );
     105                 :            : 
     106                 :            :     void AddParaProperties( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* props );
     107                 :            : };
     108                 :            : 
     109                 :            : class AbstractListDef
     110                 :            : {
     111                 :            : private:
     112                 :            :     sal_Int32                            m_nTPLC;          //LN_TPLC
     113                 :            :     OUString                      m_sRGISTD;        //LN_RGISTD
     114                 :            :     sal_Int32                            m_nSimpleList;    //LN_FSIMPLELIST
     115                 :            :     sal_Int32                            m_nRestart;       //LN_FRESTARTHDN
     116                 :            :     sal_Int32                            m_nUnsigned;      //LN_UNSIGNED26_2
     117                 :            : 
     118                 :            :     // The ID member reflects either the abstractNumId or the numId
     119                 :            :     // depending on the use of the class
     120                 :            :     sal_Int32                            m_nId;
     121                 :            : 
     122                 :            :     // Properties of each level. This can also reflect the overridden
     123                 :            :     // levels of a numbering.
     124                 :            :     ::std::vector< ListLevel::Pointer >  m_aLevels;
     125                 :            : 
     126                 :            :     // Only used during the numberings import
     127                 :            :     ListLevel::Pointer                         m_pCurrentLevel;
     128                 :            : 
     129                 :            : public:
     130                 :            :     typedef boost::shared_ptr< AbstractListDef > Pointer;
     131                 :            : 
     132                 :            :     AbstractListDef( );
     133                 :            :     virtual ~AbstractListDef( );
     134                 :            : 
     135                 :            :     // Setters using during the import
     136                 :        195 :     void SetId( sal_Int32 nId ) { m_nId = nId; };
     137                 :            :     void SetValue( sal_uInt32 nSprmId, sal_Int32 nValue );
     138                 :          0 :     void AddRGISTD( OUString sValue ) { m_sRGISTD += sValue; };
     139                 :            : 
     140                 :            :     // Accessors
     141                 :        744 :     sal_Int32             GetId( ) { return m_nId; };
     142                 :            : 
     143                 :         84 :     sal_Int16             Size( ) { return sal_Int16( m_aLevels.size( ) ); };
     144                 :            :     ListLevel::Pointer    GetLevel( sal_uInt16 nLvl );
     145                 :            :     void                  AddLevel( );
     146                 :            : 
     147                 :       7395 :     ListLevel::Pointer    GetCurrentLevel( ) { return m_pCurrentLevel; };
     148                 :            : 
     149                 :            :     virtual com::sun::star::uno::Sequence<
     150                 :            :         com::sun::star::uno::Sequence<
     151                 :            :             com::sun::star::beans::PropertyValue > > GetPropertyValues( );
     152                 :            : };
     153                 :            : 
     154                 :            : class ListDef : public AbstractListDef
     155                 :            : {
     156                 :            : private:
     157                 :            :     // Pointer to the abstract numbering
     158                 :            :     AbstractListDef::Pointer             m_pAbstractDef;
     159                 :            : 
     160                 :            :     // Cache for the UNO numbering rules
     161                 :            :     uno::Reference< container::XIndexReplace > m_xNumRules;
     162                 :            : 
     163                 :            : public:
     164                 :            :     typedef boost::shared_ptr< ListDef > Pointer;
     165                 :            : 
     166                 :            :     ListDef( );
     167                 :            :     virtual ~ListDef( );
     168                 :            : 
     169                 :            :     // Accessors
     170                 :         96 :     void SetAbstractDefinition( AbstractListDef::Pointer pAbstract ) { m_pAbstractDef = pAbstract; };
     171                 :            :     AbstractListDef::Pointer GetAbstractDefinition( ) { return m_pAbstractDef; };
     172                 :            : 
     173                 :            :     // Mapping functions
     174                 :            :     static OUString GetStyleName( sal_Int32 nId );
     175                 :            : 
     176                 :            :     com::sun::star::uno::Sequence<
     177                 :            :         com::sun::star::uno::Sequence<
     178                 :            :             com::sun::star::beans::PropertyValue > > GetPropertyValues( );
     179                 :            : 
     180                 :            :     void CreateNumberingRules(
     181                 :            :             DomainMapper& rDMapper,
     182                 :            :             com::sun::star::uno::Reference<
     183                 :            :                 com::sun::star::lang::XMultiServiceFactory> xFactory );
     184                 :            : 
     185                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace >
     186                 :         78 :             GetNumberingRules( ) { return m_xNumRules; };
     187                 :            : 
     188                 :            : };
     189                 :            : 
     190                 :            : /** This class provides access to the defined numbering styles.
     191                 :            :   */
     192                 :            : class ListsManager :
     193                 :            :     public LoggedProperties,
     194                 :            :     public LoggedTable
     195                 :            : {
     196                 :            : private:
     197                 :            : 
     198                 :            :     DomainMapper&                                       m_rDMapper;
     199                 :            :     com::sun::star::uno::Reference<
     200                 :            :         com::sun::star::lang::XMultiServiceFactory >    m_xFactory;
     201                 :            : 
     202                 :            :     // The numbering entries
     203                 :            :     std::vector< AbstractListDef::Pointer >             m_aAbstractLists;
     204                 :            :     std::vector< ListDef::Pointer >                     m_aLists;
     205                 :            : 
     206                 :            : 
     207                 :            :     // These members are used for import only
     208                 :            :     AbstractListDef::Pointer                            m_pCurrentDefinition;
     209                 :            :     bool                                                m_bIsLFOImport;
     210                 :            : 
     211                 :            :     AbstractListDef::Pointer    GetAbstractList( sal_Int32 nId );
     212                 :            : 
     213                 :            :     // Properties
     214                 :            :     virtual void lcl_attribute( Id nName, Value & rVal );
     215                 :            :     virtual void lcl_sprm(Sprm & sprm);
     216                 :            : 
     217                 :            :     // Table
     218                 :            :     virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
     219                 :            : 
     220                 :            : public:
     221                 :            : 
     222                 :            :     ListsManager(
     223                 :            :             DomainMapper& rDMapper,
     224                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory);
     225                 :            :     virtual ~ListsManager();
     226                 :            : 
     227                 :            :     typedef boost::shared_ptr< ListsManager >  Pointer;
     228                 :            : 
     229                 :            :     // Config methods
     230                 :          0 :     void SetLFOImport( bool bLFOImport ) { m_bIsLFOImport = bLFOImport; };
     231                 :            : 
     232                 :            :     // Numberings accessors
     233                 :            :     AbstractListDef::Pointer GetCurrentDef( ) { return m_pCurrentDefinition; };
     234                 :            : 
     235                 :            :     sal_uInt32              Size() const
     236                 :            :         { return sal_uInt32( m_aLists.size( ) ); };
     237                 :            :     ListDef::Pointer        GetList( sal_Int32 nId );
     238                 :            : 
     239                 :            :     // Mapping methods
     240                 :            :     void CreateNumberingRules( );
     241                 :            : };
     242                 :            : 
     243                 :            : } }
     244                 :            : 
     245                 :            : #endif
     246                 :            : 
     247                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10