LCOV - code coverage report
Current view: top level - writerfilter/source/dmapper - PropertyMap.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 76 102 74.5 %
Date: 2012-08-25 Functions: 66 88 75.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 4 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                 :            : #ifndef INCLUDED_DMAPPER_PROPERTYMAP_HXX
      20                 :            : #define INCLUDED_DMAPPER_PROPERTYMAP_HXX
      21                 :            : 
      22                 :            : #include <rtl/ustring.hxx>
      23                 :            : #include <com/sun/star/uno/Sequence.hxx>
      24                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      25                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      26                 :            : #include <com/sun/star/uno/Any.h>
      27                 :            : #include "PropertyIds.hxx"
      28                 :            : #include <boost/shared_ptr.hpp>
      29                 :            : #include <map>
      30                 :            : #include <vector>
      31                 :            : 
      32                 :            : #include <resourcemodel/TagLogger.hxx>
      33                 :            : 
      34                 :            : namespace com{namespace sun{namespace star{
      35                 :            :     namespace beans{
      36                 :            :     struct PropertyValue;
      37                 :            :     }
      38                 :            :     namespace container{
      39                 :            :         class XNameContainer;
      40                 :            :     }
      41                 :            :     namespace lang{
      42                 :            :         class XMultiServiceFactory;
      43                 :            :     }
      44                 :            :     namespace text{
      45                 :            :         class XTextRange;
      46                 :            :         class XTextColumns;
      47                 :            :         class XFootnote;
      48                 :            :     }
      49                 :            :     namespace table{
      50                 :            :         struct BorderLine2;
      51                 :            :     }
      52                 :            : }}}
      53                 :            : 
      54                 :            : namespace writerfilter {
      55                 :            : namespace dmapper{
      56                 :            : class DomainMapper_Impl;
      57                 :            : 
      58                 :            : enum BorderPosition
      59                 :            : {
      60                 :            :     BORDER_LEFT,
      61                 :            :     BORDER_RIGHT,
      62                 :            :     BORDER_TOP,
      63                 :            :     BORDER_BOTTOM
      64                 :            : };
      65                 :            : 
      66                 :            : 
      67                 :            : struct PropertyDefinition
      68                 :            : {
      69                 :            :     PropertyIds eId;
      70                 :            :     bool        bIsTextProperty;
      71                 :            : 
      72                 :     268371 :     PropertyDefinition( PropertyIds _eId, bool _bIsTextProperty ) :
      73                 :            :         eId( _eId ),
      74                 :     268371 :         bIsTextProperty( _bIsTextProperty ){}
      75                 :            : 
      76                 :            :     bool    operator== (const PropertyDefinition& rDef) const
      77                 :            :             {   return rDef.eId == eId; }
      78                 :     880399 :     bool    operator< (const PropertyDefinition& rDef) const
      79                 :     880399 :             {   return eId < rDef.eId; }
      80                 :            : };
      81                 :            : typedef std::map < PropertyDefinition, ::com::sun::star::uno::Any > _PropertyMap;
      82                 :            : class PropertyMap : public _PropertyMap
      83                 :            : {
      84                 :            :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >   m_aValues;
      85                 :            :     //marks context as footnote context - ::text( ) events contain either the footnote character or can be ignored
      86                 :            :     //depending on sprmCSymbol
      87                 :            :     sal_Unicode                                                                 m_cFootnoteSymbol; // 0 == invalid
      88                 :            :     sal_Int32                                                                   m_nFootnoteFontId; // negative values are invalid ids
      89                 :            :     OUString                                                             m_sFootnoteFontName;
      90                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote >       m_xFootnote;
      91                 :            : 
      92                 :            : protected:
      93                 :     124176 :     void Invalidate()
      94                 :            :     {
      95         [ -  + ]:     124176 :         if(m_aValues.getLength())
      96                 :          0 :             m_aValues.realloc( 0 );
      97                 :     124176 :     }
      98                 :            : 
      99                 :            : public:
     100                 :            :     PropertyMap();
     101                 :            :     virtual ~PropertyMap();
     102                 :            : 
     103                 :            :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetPropertyValues();
     104                 :            :     bool hasEmptyPropertyValues() const {return !m_aValues.getLength();}
     105                 :            :     /** Add property, usually overwrites already available attributes. It shouldn't overwrite in case of default attributes
     106                 :            :      */
     107                 :            :     void Insert( PropertyIds eId, bool bIsTextProperty, const ::com::sun::star::uno::Any& rAny, bool bOverwrite = true );
     108                 :            :     using _PropertyMap::insert;
     109                 :            :     void insert(const boost::shared_ptr<PropertyMap> pMap, bool bOverwrite = true);
     110                 :            : 
     111                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote>&  GetFootnote() const;
     112                 :          3 :     void SetFootnote( ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote> xF ) { m_xFootnote = xF; }
     113                 :            : 
     114                 :          3 :     sal_Unicode GetFootnoteSymbol() const { return m_cFootnoteSymbol;}
     115                 :          0 :     void        SetFootnoteSymbol(sal_Unicode cSet) { m_cFootnoteSymbol = cSet;}
     116                 :            : 
     117                 :          3 :     sal_Int32   GetFootnoteFontId() const { return m_nFootnoteFontId;}
     118                 :          0 :     void        SetFootnoteFontId(sal_Int32 nSet) { m_nFootnoteFontId = nSet;}
     119                 :            : 
     120                 :          3 :     const OUString&      GetFootnoteFontName() const { return m_sFootnoteFontName;}
     121                 :            :     void                        SetFootnoteFontName( const OUString& rSet ) { m_sFootnoteFontName = rSet;}
     122                 :            : 
     123                 :            :     virtual void insertTableProperties( const PropertyMap* );
     124                 :            : 
     125                 :            : #if OSL_DEBUG_LEVEL > 1
     126                 :            :     virtual void dumpXml( const TagLogger::Pointer_t pLogger ) const;
     127                 :            : #endif
     128                 :            : 
     129                 :            : };
     130                 :            : typedef boost::shared_ptr<PropertyMap>  PropertyMapPtr;
     131                 :            : 
     132                 :            : 
     133                 :            : 
     134                 :            : class SectionPropertyMap : public PropertyMap
     135                 :            : {
     136                 :            :     //--> debug
     137                 :            :     sal_Int32 nSectionNumber;
     138                 :            :     //<-- debug
     139                 :            :     //'temporarily' the section page settings are imported as page styles
     140                 :            :     // empty strings mark page settings as not yet imported
     141                 :            : 
     142                 :            :     bool                                                                        m_bIsFirstSection;
     143                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >      m_xStartingRange;
     144                 :            : 
     145                 :            :     OUString                                                             m_sFirstPageStyleName;
     146                 :            :     OUString                                                             m_sFollowPageStyleName;
     147                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   m_aFirstPageStyle;
     148                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   m_aFollowPageStyle;
     149                 :            : 
     150                 :            :     ::com::sun::star::table::BorderLine2*   m_pBorderLines[4];
     151                 :            :     sal_Int32                               m_nBorderDistances[4];
     152                 :            :     sal_Int32                               m_nBorderParams;
     153                 :            : 
     154                 :            :     bool                                    m_bTitlePage;
     155                 :            :     sal_Int16                               m_nColumnCount;
     156                 :            :     sal_Int32                               m_nColumnDistance;
     157                 :            :     ::std::vector< sal_Int32 >              m_aColWidth;
     158                 :            :     ::std::vector< sal_Int32 >              m_aColDistance;
     159                 :            : 
     160                 :            :     bool                                    m_bSeparatorLineIsOn;
     161                 :            :     bool                                    m_bEvenlySpaced;
     162                 :            :     bool                                    m_bIsLandscape;
     163                 :            : 
     164                 :            :     bool                                    m_bPageNoRestart;
     165                 :            :     sal_Int32                               m_nPageNumber;
     166                 :            :     sal_Int32                               m_nBreakType;
     167                 :            :     sal_Int32                               m_nPaperBin;
     168                 :            :     sal_Int32                               m_nFirstPaperBin;
     169                 :            : 
     170                 :            :     sal_Int32                               m_nLeftMargin;
     171                 :            :     sal_Int32                               m_nRightMargin;
     172                 :            :     sal_Int32                               m_nTopMargin;
     173                 :            :     sal_Int32                               m_nBottomMargin;
     174                 :            :     sal_Int32                               m_nHeaderTop;
     175                 :            :     sal_Int32                               m_nHeaderBottom;
     176                 :            : 
     177                 :            :     sal_Int32                               m_nDzaGutter;
     178                 :            :     bool                                    m_bGutterRTL;
     179                 :            :     bool                                    m_bSFBiDi;
     180                 :            : 
     181                 :            :     sal_Int32                               m_nGridType;
     182                 :            :     sal_Int32                               m_nGridLinePitch;
     183                 :            :     sal_Int32                               m_nDxtCharSpace;
     184                 :            : 
     185                 :            :     //line numbering
     186                 :            :     sal_Int32                               m_nLnnMod;
     187                 :            :     sal_Int32                               m_nLnc;
     188                 :            :     sal_Int32                               m_ndxaLnn;
     189                 :            :     sal_Int32                               m_nLnnMin;
     190                 :            : 
     191                 :            :     void _ApplyProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle );
     192                 :            :     ::com::sun::star::uno::Reference< com::sun::star::text::XTextColumns > ApplyColumnProperties(
     193                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xFollowPageStyle );
     194                 :            :     void CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl );
     195                 :            :     void PrepareHeaderFooterProperties( bool bFirstPage );
     196                 :            :     bool HasHeader( bool bFirstPage ) const;
     197                 :            :     bool HasFooter( bool bFirstPage ) const;
     198                 :            : 
     199                 :            :     void SetBorderDistance( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle,
     200                 :            :         PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom, sal_uInt32 nLineWidth );
     201                 :            : 
     202                 :            : public:
     203                 :            :         explicit SectionPropertyMap(bool bIsFirstSection);
     204                 :            :         ~SectionPropertyMap();
     205                 :            : 
     206                 :            :     enum PageType
     207                 :            :     {
     208                 :            :         PAGE_FIRST,
     209                 :            :         PAGE_LEFT,
     210                 :            :         PAGE_RIGHT
     211                 :            :     };
     212                 :            : 
     213                 :        506 :     void SetStart( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange )
     214                 :            :     {
     215                 :        506 :         m_xStartingRange = xRange;
     216                 :        506 :     }
     217                 :            : 
     218                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetPageStyle(
     219                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xStyles,
     220                 :            :             const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xTextFactory,
     221                 :            :             bool bFirst );
     222                 :            : 
     223                 :            :     void SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const ::com::sun::star::table::BorderLine2& rBorderLine );
     224                 :          6 :     void SetBorderParams( sal_Int32 nSet ) { m_nBorderParams = nSet; }
     225                 :            : 
     226                 :          6 :     void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; }
     227                 :          6 :     void SetColumnDistance( sal_Int32 nDist ) { m_nColumnDistance = nDist; }
     228                 :         12 :     void AppendColumnWidth( sal_Int32 nWidth ) { m_aColWidth.push_back( nWidth ); }
     229                 :          6 :     void AppendColumnSpacing( sal_Int32 nDist ) {m_aColDistance.push_back( nDist ); }
     230                 :            : 
     231                 :         21 :     void SetTitlePage( bool bSet ) { m_bTitlePage = bSet; }
     232                 :          6 :     void SetSeparatorLine( bool bSet ) { m_bSeparatorLineIsOn = bSet; }
     233                 :          6 :     void SetEvenlySpaced( bool bSet ) {    m_bEvenlySpaced = bSet; }
     234                 :        326 :     void SetLandscape( bool bSet ) { m_bIsLandscape = bSet; }
     235                 :          0 :     void SetPageNoRestart( bool bSet ) { m_bPageNoRestart = bSet; }
     236                 :          0 :     void SetPageNumber( sal_Int32 nSet ) { m_nPageNumber = nSet; }
     237                 :        123 :     void SetBreakType( sal_Int32 nSet ) { m_nBreakType = nSet; }
     238                 :            :     void SetPaperBin( sal_Int32 nSet );
     239                 :            :     void SetFirstPaperBin( sal_Int32 nSet );
     240                 :            : 
     241                 :        332 :     void SetLeftMargin(    sal_Int32 nSet ) { m_nLeftMargin = nSet; }
     242                 :        332 :     void SetRightMargin( sal_Int32 nSet ) { m_nRightMargin = nSet; }
     243                 :        332 :     void SetTopMargin(    sal_Int32 nSet ) { m_nTopMargin = nSet; }
     244                 :        332 :     void SetBottomMargin( sal_Int32 nSet ) { m_nBottomMargin = nSet; }
     245                 :        332 :     void SetHeaderTop(    sal_Int32 nSet ) { m_nHeaderTop = nSet; }
     246                 :        332 :     void SetHeaderBottom( sal_Int32 nSet ) { m_nHeaderBottom = nSet; }
     247                 :            : 
     248                 :          0 :     void SetGutterRTL( bool bSet ) { m_bGutterRTL = bSet;}
     249                 :          0 :     void SetDzaGutter( sal_Int32 nSet ) {m_nDzaGutter = nSet; }
     250                 :          0 :     void SetSFBiDi( bool bSet ) { m_bSFBiDi = bSet;}
     251                 :            : 
     252                 :         87 :     void SetGridType(sal_Int32 nSet) { m_nGridType = nSet; }
     253                 :        179 :     void SetGridLinePitch( sal_Int32 nSet ) { m_nGridLinePitch = nSet; }
     254                 :         87 :     void SetDxtCharSpace( sal_Int32 nSet ) { m_nDxtCharSpace = nSet; }
     255                 :            : 
     256                 :          0 :     void SetLnnMod( sal_Int32 nValue ) { m_nLnnMod = nValue; }
     257                 :          0 :     void SetLnc(    sal_Int32 nValue ) { m_nLnc    = nValue; }
     258                 :          0 :     void SetdxaLnn( sal_Int32 nValue ) { m_ndxaLnn  = nValue; }
     259                 :          0 :     void SetLnnMin( sal_Int32 nValue ) { m_nLnnMin = nValue; }
     260                 :            : 
     261                 :            :     //determine which style gets the borders
     262                 :            :     void ApplyBorderToPageStyles(
     263                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xStyles,
     264                 :            :             const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xTextFactory,
     265                 :            :             sal_Int32 nValue );
     266                 :            : 
     267                 :            :     void CloseSectionGroup( DomainMapper_Impl& rDM_Impl );
     268                 :            : };
     269                 :            : typedef boost::shared_ptr<SectionPropertyMap> SectionPropertyMapPtr;
     270                 :            : 
     271                 :            : 
     272                 :            : 
     273                 :            : class ParagraphProperties
     274                 :            : {
     275                 :            :     bool                    m_bFrameMode;
     276                 :            :     sal_Int32               m_nDropCap; //drop, margin ST_DropCap
     277                 :            :     sal_Int32               m_nLines; //number of lines of the drop cap
     278                 :            :     sal_Int32               m_w;    //width
     279                 :            :     sal_Int32               m_h;    //height
     280                 :            :     sal_Int32               m_nWrap;   // from ST_Wrap around, auto, none, notBeside, through, tight
     281                 :            :     sal_Int32               m_hAnchor; // page, from ST_HAnchor  margin, page, text
     282                 :            :     sal_Int32               m_vAnchor; // around from ST_VAnchor margin, page, text
     283                 :            :     sal_Int32               m_x; //x-position
     284                 :            :     bool                    m_bxValid;
     285                 :            :     sal_Int32               m_y; //y-position
     286                 :            :     bool                    m_byValid;
     287                 :            :     sal_Int32               m_hSpace; //frame padding h
     288                 :            :     sal_Int32               m_vSpace; //frame padding v
     289                 :            :     sal_Int32               m_hRule; //  from ST_HeightRule exact, atLeast, auto
     290                 :            :     sal_Int32               m_xAlign; // from ST_XAlign center, inside, left, outside, right
     291                 :            :     sal_Int32               m_yAlign; // from ST_YAlign bottom, center, inline, inside, outside, top
     292                 :            :     bool                    m_bAnchorLock;
     293                 :            : 
     294                 :            :     sal_Int8                m_nDropCapLength; //number of characters
     295                 :            : 
     296                 :            :     OUString         m_sParaStyleName;
     297                 :            : 
     298                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >      m_xStartingRange; //start of a frame
     299                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >      m_xEndingRange; //end of the frame
     300                 :            : 
     301                 :            : public:
     302                 :            :     ParagraphProperties();
     303                 :            :     ParagraphProperties(const ParagraphProperties&);
     304                 :            :     ~ParagraphProperties();
     305                 :            : 
     306                 :            :     int operator==(const ParagraphProperties&); //does not compare the starting/ending range, m_sParaStyleName and m_nDropCapLength
     307                 :            : 
     308                 :         24 :     void    SetFrameMode() { m_bFrameMode = true; }
     309                 :       2978 :     bool    IsFrameMode()const { return m_bFrameMode; }
     310                 :            : 
     311                 :          0 :     void SetDropCap( sal_Int32 nSet ) { m_nDropCap = nSet; }
     312                 :         42 :     sal_Int32 GetDropCap()const { return m_nDropCap; }
     313                 :            : 
     314                 :          0 :     void SetLines( sal_Int32 nSet ) { m_nLines = nSet; }
     315                 :          0 :     sal_Int32 GetLines() const { return m_nLines; }
     316                 :            : 
     317                 :         24 :     void Setw( sal_Int32 nSet ) { m_w = nSet; }
     318                 :         15 :     sal_Int32 Getw() const { return m_w; }
     319                 :            : 
     320                 :         24 :     void Seth( sal_Int32 nSet ) { m_h = nSet; }
     321                 :         30 :     sal_Int32 Geth() const { return m_h; }
     322                 :            : 
     323                 :          0 :     void SetWrap( sal_Int32 nSet ) { m_nWrap = nSet; }
     324                 :         15 :     sal_Int32 GetWrap() const { return m_nWrap; }
     325                 :            : 
     326                 :         18 :     void SethAnchor( sal_Int32 nSet ) { m_hAnchor = nSet; }
     327                 :         24 :     sal_Int32 GethAnchor() const { return m_hAnchor;}
     328                 :            : 
     329                 :         24 :     void SetvAnchor( sal_Int32 nSet ) { m_vAnchor = nSet; }
     330                 :         30 :     sal_Int32 GetvAnchor() const { return m_vAnchor; }
     331                 :            : 
     332                 :         24 :     void Setx( sal_Int32 nSet ) { m_x = nSet; m_bxValid = true;}
     333                 :         15 :     sal_Int32 Getx() const { return m_x; }
     334                 :         15 :     bool IsxValid() const {return m_bxValid;}
     335                 :            : 
     336                 :         24 :     void Sety( sal_Int32 nSet ) { m_y = nSet; m_byValid = true;}
     337                 :         15 :     sal_Int32 Gety()const { return m_y; }
     338                 :         15 :     bool IsyValid() const {return m_byValid;}
     339                 :            : 
     340                 :          0 :     void SethSpace( sal_Int32 nSet ) { m_hSpace = nSet; }
     341                 :         15 :     sal_Int32 GethSpace()const { return m_hSpace; }
     342                 :            : 
     343                 :          0 :     void SetvSpace( sal_Int32 nSet ) { m_vSpace = nSet; }
     344                 :         15 :     sal_Int32 GetvSpace()const { return m_vSpace; }
     345                 :            : 
     346                 :         24 :     void SethRule( sal_Int32 nSet ) { m_hRule = nSet; }
     347                 :         30 :     sal_Int32 GethRule() const  { return m_hRule; }
     348                 :            : 
     349                 :         24 :     void SetxAlign( sal_Int32 nSet ) { m_xAlign = nSet; }
     350                 :         30 :     sal_Int32 GetxAlign()const { return m_xAlign; }
     351                 :            : 
     352                 :         24 :     void SetyAlign( sal_Int32 nSet ) { m_yAlign = nSet; }
     353                 :         30 :     sal_Int32 GetyAlign()const { return m_yAlign; }
     354                 :            : 
     355                 :            :     void SetAnchorLock( bool bSet ) {m_bAnchorLock = bSet; }
     356                 :            : 
     357                 :          0 :     sal_Int8    GetDropCapLength() const { return m_nDropCapLength;}
     358                 :          0 :     void        SetDropCapLength(sal_Int8 nSet) { m_nDropCapLength = nSet;}
     359                 :            : 
     360                 :         30 :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetStartingRange() const { return m_xStartingRange; }
     361                 :         15 :     void SetStartingRange( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xSet ) { m_xStartingRange = xSet; }
     362                 :            : 
     363                 :         30 :     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetEndingRange() const { return m_xEndingRange; }
     364                 :         24 :     void SetEndingRange( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xSet ) { m_xEndingRange = xSet; }
     365                 :            : 
     366                 :         15 :     void                    SetParaStyleName( const OUString& rSet ) { m_sParaStyleName = rSet;}
     367                 :         15 :     const OUString&  GetParaStyleName() const { return m_sParaStyleName;}
     368                 :            : 
     369                 :            :     void ResetFrameProperties();
     370                 :            : };
     371                 :            : typedef boost::shared_ptr<ParagraphProperties>  ParagraphPropertiesPtr;
     372                 :            : /*-------------------------------------------------------------------------
     373                 :            :     property map of a stylesheet
     374                 :            :   -----------------------------------------------------------------------*/
     375                 :            : 
     376                 :            : #define WW_OUTLINE_MAX  sal_Int16( 9 )
     377                 :            : 
     378                 :            : class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
     379                 :            : 
     380                 :            : {
     381                 :            :     //special table style properties
     382                 :            :     sal_Int32               mnCT_Spacing_line;
     383                 :            :     sal_Int32               mnCT_Spacing_lineRule;
     384                 :            : 
     385                 :            :     OUString         msCT_Fonts_ascii;
     386                 :            :     bool                    mbCT_TrPrBase_tblHeader;
     387                 :            :     sal_Int32               mnCT_TrPrBase_jc;
     388                 :            :     sal_Int32               mnCT_TcPrBase_vAlign;
     389                 :            : 
     390                 :            :     sal_Int32               mnCT_TblWidth_w;
     391                 :            :     sal_Int32               mnCT_TblWidth_type;
     392                 :            : 
     393                 :            :     bool                    mbCT_Spacing_lineSet;
     394                 :            :     bool                    mbCT_Spacing_lineRuleSet;
     395                 :            : 
     396                 :            :     bool                    mbCT_TrPrBase_tblHeaderSet;
     397                 :            :     bool                    mbCT_TrPrBase_jcSet;
     398                 :            :     bool                    mbCT_TcPrBase_vAlignSet;
     399                 :            : 
     400                 :            :     bool                    mbCT_TblWidth_wSet;
     401                 :            :     bool                    mbCT_TblWidth_typeSet;
     402                 :            : 
     403                 :            :     sal_Int32               mnListId;
     404                 :            :     sal_Int16               mnListLevel;
     405                 :            : 
     406                 :            :     sal_Int16               mnOutlineLevel;
     407                 :            : public:
     408                 :            :     explicit StyleSheetPropertyMap();
     409                 :            :     ~StyleSheetPropertyMap();
     410                 :            : 
     411                 :            :     void SetCT_Spacing_line(       sal_Int32 nSet )
     412                 :            :         {mnCT_Spacing_line = nSet;     mbCT_Spacing_lineSet = true;         }
     413                 :            :     void SetCT_Spacing_lineRule(   sal_Int32  nSet )
     414                 :            :         {mnCT_Spacing_lineRule = nSet; mbCT_Spacing_lineRuleSet = true;     }
     415                 :            : 
     416                 :            :     void SetCT_Fonts_ascii(  const OUString& rSet )
     417                 :            :         {msCT_Fonts_ascii = rSet;          }
     418                 :            :     void SetCT_TrPrBase_tblHeader( bool bSet )
     419                 :            :         {mbCT_TrPrBase_tblHeader = bSet; mbCT_TrPrBase_tblHeaderSet = true; }
     420                 :          0 :     void SetCT_TrPrBase_jc(        sal_Int32 nSet )
     421                 :          0 :         {mnCT_TrPrBase_jc = nSet;        mbCT_TrPrBase_jcSet = true;     }
     422                 :            :     void SetCT_TcPrBase_vAlign(    sal_Int32 nSet )
     423                 :            :         {mnCT_TcPrBase_vAlign = nSet;    mbCT_TcPrBase_vAlignSet = true; }
     424                 :            : 
     425                 :          0 :     void SetCT_TblWidth_w( sal_Int32 nSet )
     426                 :          0 :         { mnCT_TblWidth_w = nSet;    mbCT_TblWidth_wSet = true; }
     427                 :          0 :     void SetCT_TblWidth_type( sal_Int32 nSet )
     428                 :          0 :         {mnCT_TblWidth_type = nSet;    mbCT_TblWidth_typeSet = true; }
     429                 :            : 
     430                 :            :     bool GetCT_Spacing_line(    sal_Int32& rToFill) const
     431                 :            :     {
     432                 :            :         if( mbCT_Spacing_lineSet )
     433                 :            :             rToFill = mnCT_Spacing_line;
     434                 :            :         return mbCT_Spacing_lineSet;
     435                 :            :     }
     436                 :            :     bool GetCT_Spacing_lineRule(sal_Int32& rToFill) const
     437                 :            :     {
     438                 :            :         if( mbCT_Spacing_lineRuleSet )
     439                 :            :             rToFill = mnCT_Spacing_lineRule;
     440                 :            :         return mbCT_Spacing_lineRuleSet;
     441                 :            :     }
     442                 :            : 
     443                 :            :     bool GetCT_Fonts_ascii(OUString& rToFill) const
     444                 :            :     {
     445                 :            :         if( msCT_Fonts_ascii.getLength() > 0 )
     446                 :            :             rToFill = msCT_Fonts_ascii;
     447                 :            :         return msCT_Fonts_ascii.getLength() > 0;
     448                 :            :     }
     449                 :            :     bool GetCT_TrPrBase_tblHeader(bool& rToFill) const
     450                 :            :     {
     451                 :            :         if( mbCT_TrPrBase_tblHeaderSet )
     452                 :            :             rToFill = mbCT_TrPrBase_tblHeader;
     453                 :            :         return mbCT_TrPrBase_tblHeaderSet;
     454                 :            :     }
     455                 :            :     bool GetCT_TrPrBase_jc(     sal_Int32& rToFill)const
     456                 :            :     {
     457                 :            :         if( mbCT_TrPrBase_jcSet )
     458                 :            :             rToFill = mnCT_TrPrBase_jc;
     459                 :            :         return mbCT_TrPrBase_jcSet;
     460                 :            :     }
     461                 :            :     bool GetCT_TcPrBase_vAlign( sal_Int32& rToFill)const
     462                 :            :     {
     463                 :            :         if( mbCT_TcPrBase_vAlignSet )
     464                 :            :             rToFill = mnCT_TcPrBase_vAlign;
     465                 :            :         return mbCT_TcPrBase_vAlignSet;
     466                 :            :     }
     467                 :        441 :     sal_Int32   GetListId() const               { return mnListId; }
     468                 :         36 :     void        SetListId(sal_Int32 nId)        { mnListId = nId; }
     469                 :            : 
     470                 :        435 :     sal_Int16   GetListLevel() const            { return mnListLevel; }
     471                 :         30 :     void        SetListLevel(sal_Int16 nLevel)  { mnListLevel = nLevel; }
     472                 :            : 
     473                 :       2788 :     sal_Int16   GetOutlineLevel() const            { return mnOutlineLevel; }
     474                 :         51 :     void        SetOutlineLevel(sal_Int16 nLevel)
     475                 :            :     {
     476         [ +  - ]:         51 :         if ( nLevel < WW_OUTLINE_MAX )
     477                 :         51 :             mnOutlineLevel = nLevel;
     478                 :         51 :     }
     479                 :            : };
     480                 :            : 
     481                 :            : 
     482                 :            : class ParagraphPropertyMap : public PropertyMap, public ParagraphProperties
     483                 :            : {
     484                 :            : public:
     485                 :            :     explicit ParagraphPropertyMap();
     486                 :            :     ~ParagraphPropertyMap();
     487                 :            : 
     488                 :            : };
     489                 :            : 
     490                 :            : 
     491                 :            : class TablePropertyMap : public PropertyMap
     492                 :            : {
     493                 :            : public:
     494                 :            :     enum TablePropertyMapTarget
     495                 :            :     {
     496                 :            :         TablePropertyMapTarget_START,
     497                 :            :         CELL_MAR_LEFT = TablePropertyMapTarget_START,
     498                 :            :         CELL_MAR_RIGHT,
     499                 :            :         CELL_MAR_TOP,
     500                 :            :         CELL_MAR_BOTTOM,
     501                 :            :         TABLE_WIDTH,
     502                 :            :         GAP_HALF,
     503                 :            :         LEFT_MARGIN,
     504                 :            :         HORI_ORIENT,
     505                 :            :         TablePropertyMapTarget_MAX
     506                 :            :     };
     507                 :            : private:
     508                 :            :     struct ValidValue
     509                 :            :     {
     510                 :            :         sal_Int32   nValue;
     511                 :            :         bool        bValid;
     512                 :      11144 :         ValidValue() :
     513                 :            :             nValue( 0 ),
     514                 :      11144 :             bValid( false ){}
     515                 :            :     };
     516                 :            :     ValidValue m_aValidValues[TablePropertyMapTarget_MAX];
     517                 :            : 
     518                 :            : public:
     519                 :            :     explicit TablePropertyMap();
     520                 :            :     ~TablePropertyMap();
     521                 :            : 
     522                 :            :     bool    getValue( TablePropertyMapTarget eWhich, sal_Int32& nFill );
     523                 :            :     void    setValue( TablePropertyMapTarget eWhich, sal_Int32 nSet );
     524                 :            : 
     525                 :            :     virtual void insertTableProperties( const PropertyMap* );
     526                 :            : };
     527                 :            : typedef boost::shared_ptr<TablePropertyMap>  TablePropertyMapPtr;
     528                 :            : } //namespace dmapper
     529                 :            : } //namespace writerfilter
     530                 :            : #endif
     531                 :            : 
     532                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10