LCOV - code coverage report
Current view: top level - xmloff/source/style - xmlnume.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 315 419 75.2 %
Date: 2012-08-25 Functions: 9 11 81.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 266 611 43.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      31                 :            : #include <com/sun/star/style/NumberingType.hpp>
      32                 :            : #include <com/sun/star/style/XStyle.hpp>
      33                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      34                 :            : #include <com/sun/star/container/XIndexReplace.hpp>
      35                 :            : #include <com/sun/star/awt/XBitmap.hpp>
      36                 :            : #include <com/sun/star/awt/FontDescriptor.hpp>
      37                 :            : #include <com/sun/star/text/HoriOrientation.hpp>
      38                 :            : #include <com/sun/star/text/VertOrientation.hpp>
      39                 :            : #include <com/sun/star/text/XChapterNumberingSupplier.hpp>
      40                 :            : #include <com/sun/star/text/PositionAndSpaceMode.hpp>
      41                 :            : #include <com/sun/star/text/LabelFollow.hpp>
      42                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      43                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      44                 :            : 
      45                 :            : #include <rtl/ustrbuf.hxx>
      46                 :            : 
      47                 :            : #include <tools/debug.hxx>
      48                 :            : 
      49                 :            : #include <sax/tools/converter.hxx>
      50                 :            : 
      51                 :            : #include <xmloff/nmspmap.hxx>
      52                 :            : #include "xmloff/xmlnmspe.hxx"
      53                 :            : #include <xmloff/xmltoken.hxx>
      54                 :            : #include <xmloff/xmluconv.hxx>
      55                 :            : #include "fonthdl.hxx"
      56                 :            : #include "xmloff/XMLTextListAutoStylePool.hxx"
      57                 :            : #include <xmloff/xmlnume.hxx>
      58                 :            : #include <xmloff/xmlexp.hxx>
      59                 :            : #include <tools/fontenum.hxx>
      60                 :            : 
      61                 :            : 
      62                 :            : using ::rtl::OUString;
      63                 :            : using ::rtl::OUStringBuffer;
      64                 :            : 
      65                 :            : using namespace ::com::sun::star;
      66                 :            : using namespace ::com::sun::star::uno;
      67                 :            : using namespace ::com::sun::star::style;
      68                 :            : using namespace ::com::sun::star::text;
      69                 :            : using namespace ::com::sun::star::container;
      70                 :            : using namespace ::com::sun::star::beans;
      71                 :            : using namespace ::xmloff::token;
      72                 :            : 
      73                 :            : static sal_Char const XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] = "SymbolTextDistance";
      74                 :            : static sal_Char const XML_UNO_NAME_NRULE_PARENT_NUMBERING[] = "ParentNumbering";
      75                 :            : static sal_Char const XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] = "CharStyleName";
      76                 :            : static sal_Char const XML_UNO_NAME_NRULE_BULLET_CHAR[] = "BulletChar";
      77                 :            : static sal_Char const XML_UNO_NAME_NRULE_BULLET_RELSIZE[] = "BulletRelSize";
      78                 :            : static sal_Char const XML_UNO_NAME_NRULE_BULLET_COLOR[] = "BulletColor";
      79                 :            : static sal_Char const XML_UNO_NAME_NRULE_GRAPHIC_BITMAP[] = "GraphicBitmap";
      80                 :            : static sal_Char const XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] = "GraphicSize";
      81                 :            : static sal_Char const XML_UNO_NAME_NRULE_VERT_ORIENT[] = "VertOrient";
      82                 :            : static sal_Char const XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType";
      83                 :            : static sal_Char const XML_UNO_NAME_NRULE_HEADING_STYLE_NAME[] = "HeadingStyleName";
      84                 :            : static sal_Char const XML_UNO_NAME_NRULE_PREFIX[] = "Prefix";
      85                 :            : static sal_Char const XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix";
      86                 :            : static sal_Char const XML_UNO_NAME_NRULE_ADJUST[] = "Adjust";
      87                 :            : static sal_Char const XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin";
      88                 :            : static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] = "FirstLineOffset";
      89                 :            : static sal_Char const XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont";
      90                 :            : static sal_Char const XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL";
      91                 :            : static sal_Char const XML_UNO_NAME_NRULE_START_WITH[] = "StartWith";
      92                 :            : static sal_Char const XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
      93                 :            : static sal_Char const XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
      94                 :            : static sal_Char const XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION[] = "ListtabStopPosition";
      95                 :            : static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_INDENT[] = "FirstLineIndent";
      96                 :            : static sal_Char const XML_UNO_NAME_NRULE_INDENT_AT[] = "IndentAt";
      97                 :            : 
      98                 :         51 : void SvxXMLNumRuleExport::exportLevelStyles( const uno::Reference< ::com::sun::star::container::XIndexReplace > & xNumRule,
      99                 :            :                                              sal_Bool bOutline )
     100                 :            : {
     101                 :         51 :     sal_Int32 nCount = xNumRule ->getCount();
     102         [ +  + ]:        561 :     for( sal_Int32 i=0; i<nCount; i++ )
     103                 :            :     {
     104 [ +  - ][ +  - ]:        510 :         uno::Any aEntry( xNumRule->getByIndex( i ) );
     105         [ +  - ]:        510 :         uno::Sequence<beans::PropertyValue> aSeq;
     106 [ +  - ][ +  - ]:        510 :         if( aEntry >>= aSeq )
     107                 :            :         {
     108         [ +  - ]:        510 :             exportLevelStyle( i, aSeq, bOutline );
     109                 :            :         }
     110         [ +  - ]:        510 :     }
     111                 :         51 : }
     112                 :            : 
     113                 :        510 : void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
     114                 :            :                                     const uno::Sequence<beans::PropertyValue>& rProps,
     115                 :            :                                     sal_Bool bOutline )
     116                 :            : {
     117                 :        510 :     sal_Int16 eType = NumberingType::CHAR_SPECIAL;
     118                 :            : 
     119                 :        510 :     sal_Int16 eAdjust = HoriOrientation::LEFT;
     120                 :        510 :     OUString sPrefix, sSuffix;
     121                 :        510 :     OUString sTextStyleName;
     122                 :        510 :     sal_Bool bHasColor = sal_False;
     123                 :        510 :     sal_Int32 nColor = 0;
     124                 :        510 :     sal_Int32 nSpaceBefore = 0, nMinLabelWidth = 0, nMinLabelDist = 0;
     125                 :            : 
     126                 :        510 :     sal_Int16 nStartValue = 1, nDisplayLevels = 1, nBullRelSize = 0;
     127                 :            : 
     128                 :        510 :     sal_Unicode cBullet = 0xf095;
     129                 :        510 :     OUString sBulletFontName, sBulletFontStyleName ;
     130                 :        510 :     sal_Int16 eBulletFontFamily = FAMILY_DONTKNOW;
     131                 :        510 :     sal_Int16 eBulletFontPitch = PITCH_DONTKNOW;
     132                 :        510 :     rtl_TextEncoding eBulletFontEncoding = RTL_TEXTENCODING_DONTKNOW;
     133                 :            : 
     134                 :        510 :     OUString sImageURL;
     135                 :        510 :     uno::Reference< ::com::sun::star::awt::XBitmap >  xBitmap;
     136                 :        510 :     sal_Int32 nImageWidth = 0, nImageHeight = 0;
     137                 :        510 :     sal_Int16 eImageVertOrient = VertOrientation::LINE_CENTER;
     138                 :            : 
     139                 :        510 :     sal_Int16 ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
     140                 :        510 :     sal_Int16 eLabelFollowedBy = LabelFollow::LISTTAB;
     141                 :        510 :     sal_Int32 nListtabStopPosition( 0 );
     142                 :        510 :     sal_Int32 nFirstLineIndent( 0 );
     143                 :        510 :     sal_Int32 nIndentAt( 0 );
     144                 :            : 
     145                 :        510 :     const sal_Int32 nCount = rProps.getLength();
     146                 :        510 :     const beans::PropertyValue* pPropArray = rProps.getConstArray();
     147         [ +  + ]:       7140 :     for( sal_Int32 i=0; i<nCount; i++ )
     148                 :            :     {
     149                 :       6630 :         const beans::PropertyValue& rProp = pPropArray[i];
     150                 :            : 
     151         [ +  + ]:       6630 :         if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_NUMBERINGTYPE, sizeof(XML_UNO_NAME_NRULE_NUMBERINGTYPE)-1 ) )
     152                 :            :         {
     153                 :        510 :             rProp.Value >>= eType;
     154                 :            :         }
     155         [ +  + ]:       6120 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PREFIX, sizeof(XML_UNO_NAME_NRULE_PREFIX)-1 ) )
     156                 :            :         {
     157                 :        510 :             rProp.Value >>= sPrefix;
     158                 :            :         }
     159         [ +  + ]:       5610 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SUFFIX, sizeof(XML_UNO_NAME_NRULE_SUFFIX)-1 ) )
     160                 :            :         {
     161                 :        510 :             rProp.Value >>= sSuffix;
     162                 :            :         }
     163         [ +  + ]:       5100 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_CHAR, sizeof(XML_UNO_NAME_NRULE_BULLET_CHAR)-1 ) )
     164                 :            :         {
     165                 :        320 :             OUString sValue;
     166                 :        320 :             rProp.Value >>= sValue;
     167         [ +  - ]:        320 :             if( !sValue.isEmpty() )
     168                 :            :             {
     169                 :        320 :                 cBullet = (sal_Unicode)sValue[0];
     170                 :        320 :             }
     171                 :            :         }
     172         [ +  + ]:       4780 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_RELSIZE, sizeof(XML_UNO_NAME_NRULE_BULLET_RELSIZE)-1 ) )
     173                 :            :         {
     174                 :        320 :             rProp.Value >>= nBullRelSize;
     175                 :            :         }
     176         [ +  + ]:       4460 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_ADJUST, sizeof(XML_UNO_NAME_NRULE_ADJUST)-1 ) )
     177                 :            :         {
     178                 :        510 :             sal_Int16 nValue = 0;
     179                 :        510 :             rProp.Value >>= nValue;
     180                 :        510 :             eAdjust = nValue;
     181                 :            :         }
     182         [ +  + ]:       3950 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_FONT, sizeof(XML_UNO_NAME_NRULE_BULLET_FONT)-1 ) )
     183                 :            :         {
     184                 :        320 :             awt::FontDescriptor rFDesc;
     185 [ +  - ][ +  - ]:        320 :             if( rProp.Value >>= rFDesc )
     186                 :            :             {
     187                 :        320 :                 sBulletFontName = rFDesc.Name;
     188                 :        320 :                 sBulletFontStyleName = rFDesc.StyleName;
     189                 :        320 :                 eBulletFontFamily = (sal_Int16)rFDesc.Family;
     190                 :        320 :                 eBulletFontPitch = (sal_Int16)rFDesc.Pitch;
     191                 :        320 :                 eBulletFontEncoding = (rtl_TextEncoding)rFDesc.CharSet;
     192                 :        320 :             }
     193                 :            :         }
     194         [ -  + ]:       3630 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHICURL, sizeof(XML_UNO_NAME_NRULE_GRAPHICURL)-1 ) )
     195                 :            :         {
     196                 :          0 :             rProp.Value >>= sImageURL;
     197                 :            :         }
     198         [ -  + ]:       3630 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_BITMAP, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_BITMAP)-1 ) )
     199                 :            :         {
     200         [ #  # ]:          0 :             rProp.Value >>= xBitmap;
     201                 :            :         }
     202         [ +  + ]:       3630 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_COLOR, sizeof(XML_UNO_NAME_NRULE_BULLET_COLOR)-1 ) )
     203                 :            :         {
     204                 :        320 :             rProp.Value >>= nColor;
     205                 :        320 :             bHasColor = sal_True;
     206                 :            :         }
     207         [ +  + ]:       3310 :         else  if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_START_WITH, sizeof(XML_UNO_NAME_NRULE_START_WITH)-1 ) )
     208                 :            :         {
     209                 :        510 :             rProp.Value >>= nStartValue;
     210                 :            :         }
     211         [ +  + ]:       2800 :         else  if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LEFT_MARGIN, sizeof(XML_UNO_NAME_NRULE_LEFT_MARGIN)-1 ) )
     212                 :            :         {
     213                 :        320 :             rProp.Value >>= nSpaceBefore;
     214                 :            :         }
     215         [ +  + ]:       2480 :         else  if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET, sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET)-1 ) )
     216                 :            :         {
     217                 :        320 :             rProp.Value >>= nMinLabelWidth;
     218                 :            :         }
     219         [ +  + ]:       2160 :         else  if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE, sizeof(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE)-1 ) )
     220                 :            :         {
     221                 :        320 :             rProp.Value >>= nMinLabelDist;
     222                 :            :         }
     223         [ +  + ]:       1840 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PARENT_NUMBERING, sizeof(XML_UNO_NAME_NRULE_PARENT_NUMBERING)-1 ) )
     224                 :            :         {
     225                 :        190 :             rProp.Value >>= nDisplayLevels;
     226         [ +  + ]:        190 :             if( nDisplayLevels > nLevel+1 )
     227                 :         90 :                 nDisplayLevels = static_cast<sal_Int16>( nLevel )+1;
     228                 :            :         }
     229         [ +  + ]:       1650 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME, sizeof(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME)-1 ) )
     230                 :            :         {
     231                 :        190 :             rProp.Value >>= sTextStyleName;
     232                 :            :         }
     233         [ +  + ]:       1460 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_SIZE, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_SIZE)-1 ) )
     234                 :            :         {
     235                 :        320 :             awt::Size aSize;
     236 [ +  - ][ +  - ]:        320 :             if( rProp.Value >>= aSize )
     237                 :            :             {
     238                 :        320 :                 nImageWidth = aSize.Width;
     239                 :        320 :                 nImageHeight = aSize.Height;
     240                 :            :             }
     241                 :            :         }
     242         [ -  + ]:       1140 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_VERT_ORIENT, sizeof(XML_UNO_NAME_NRULE_VERT_ORIENT)-1 ) )
     243                 :            :         {
     244                 :          0 :             sal_Int16 nValue = 0;
     245                 :          0 :             rProp.Value >>= nValue;
     246                 :          0 :             eImageVertOrient = nValue;
     247                 :            :         }
     248         [ +  + ]:       1140 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE,
     249                 :       1140 :                                           sizeof(XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE)-1 ) )
     250                 :            :         {
     251                 :        190 :             sal_Int16 nValue = 0;
     252                 :        190 :             rProp.Value >>= nValue;
     253                 :        190 :             ePosAndSpaceMode = nValue;
     254                 :            :         }
     255         [ +  + ]:        950 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY,
     256                 :        950 :                                           sizeof(XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY)-1 ) )
     257                 :            :         {
     258                 :        190 :             sal_Int16 nValue = 0;
     259                 :        190 :             rProp.Value >>= nValue;
     260                 :        190 :             eLabelFollowedBy = nValue;
     261                 :            :         }
     262         [ +  + ]:        760 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION,
     263                 :        760 :                                           sizeof(XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION)-1 ) )
     264                 :            :         {
     265                 :        190 :             rProp.Value >>= nListtabStopPosition;
     266                 :            :         }
     267         [ +  + ]:        570 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_FIRST_LINE_INDENT,
     268                 :        570 :                                           sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_INDENT)-1 ) )
     269                 :            :         {
     270                 :        190 :             rProp.Value >>= nFirstLineIndent;
     271                 :            :         }
     272         [ +  + ]:        380 :         else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_INDENT_AT,
     273                 :        380 :                                           sizeof(XML_UNO_NAME_NRULE_INDENT_AT)-1 ) )
     274                 :            :         {
     275                 :        190 :             rProp.Value >>= nIndentAt;
     276                 :            :         }
     277                 :            :     }
     278                 :            : 
     279 [ +  + ][ +  - ]:        510 :     if( bOutline && (NumberingType::CHAR_SPECIAL == eType ||
                 [ -  + ]
     280                 :            :                      NumberingType::BITMAP == eType) )
     281                 :            :     {
     282                 :            :         DBG_ASSERT( !bOutline,
     283                 :            :            "SvxXMLNumRuleExport::exportLevelStyle: invalid style for outline" );
     284                 :        510 :         return;
     285                 :            :     }
     286                 :            : 
     287                 :        510 :     GetExport().CheckAttrList();
     288                 :            : 
     289                 :            :     // text:level
     290                 :        510 :     OUStringBuffer sTmp;
     291         [ +  - ]:        510 :     sTmp.append( nLevel + 1 );
     292 [ +  - ][ +  - ]:        510 :     GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, sTmp.makeStringAndClear() );
     293                 :            :     // #i110694#: no style-name on list-level-style-image
     294                 :            :     // #i116149#: neither prefix/suffix
     295         [ +  - ]:        510 :     if (NumberingType::BITMAP != eType)
     296                 :            :     {
     297         [ -  + ]:        510 :         if (!sTextStyleName.isEmpty())
     298                 :            :         {
     299                 :          0 :             GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
     300   [ #  #  #  # ]:          0 :                     GetExport().EncodeStyleName( sTextStyleName ) );
     301                 :            :         }
     302         [ -  + ]:        510 :         if (!sPrefix.isEmpty())
     303                 :            :         {
     304                 :          0 :             GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_PREFIX,
     305         [ #  # ]:          0 :                     sPrefix );
     306                 :            :         }
     307         [ -  + ]:        510 :         if (!sSuffix.isEmpty())
     308                 :            :         {
     309                 :          0 :             GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_SUFFIX,
     310         [ #  # ]:          0 :                     sSuffix );
     311                 :            :         }
     312                 :            :     }
     313                 :            : 
     314                 :        510 :     enum XMLTokenEnum eElem = XML_LIST_LEVEL_STYLE_NUMBER;
     315         [ +  + ]:        510 :     if( NumberingType::CHAR_SPECIAL == eType )
     316                 :            :     {
     317                 :            :         // <text:list-level-style-bullet>
     318                 :        320 :         eElem = XML_LIST_LEVEL_STYLE_BULLET;
     319                 :            : 
     320         [ +  - ]:        320 :         if( cBullet )
     321                 :            :         {
     322         [ -  + ]:        320 :             if( cBullet < ' ' )
     323                 :            :             {
     324                 :          0 :                 cBullet = 0xF000 + 149;
     325                 :            :             }
     326                 :            :             // text:bullet-char="..."
     327         [ +  - ]:        320 :             sTmp.append( cBullet );
     328                 :        320 :             GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_BULLET_CHAR,
     329   [ +  -  +  - ]:        640 :                           sTmp.makeStringAndClear() );
     330                 :            :         }
     331                 :            : 
     332                 :            :     }
     333         [ -  + ]:        190 :     else if( NumberingType::BITMAP == eType )
     334                 :            :     {
     335                 :            :         // <text:list-level-style-image>
     336                 :            : 
     337                 :          0 :         eElem = XML_LIST_LEVEL_STYLE_IMAGE;
     338                 :            : 
     339                 :            : 
     340         [ #  # ]:          0 :         if( !sImageURL.isEmpty() )
     341                 :            :         {
     342         [ #  # ]:          0 :             OUString sURL( GetExport().AddEmbeddedGraphicObject( sImageURL ) );
     343         [ #  # ]:          0 :             if( !sURL.isEmpty() )
     344                 :            :             {
     345         [ #  # ]:          0 :                 GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
     346                 :            : 
     347         [ #  # ]:          0 :                 GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
     348         [ #  # ]:          0 :                 GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
     349         [ #  # ]:          0 :                 GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
     350                 :          0 :             }
     351                 :            :         }
     352                 :            :         else
     353                 :            :         {
     354                 :            :             DBG_ASSERT( !xBitmap.is(),
     355                 :            :                         "embedded images are not supported by now" );
     356                 :            :         }
     357                 :            :     }
     358                 :            :     else
     359                 :            :     {
     360                 :            :         // <text:list-level-style-number> or <text:outline-level-style>
     361         [ +  - ]:        190 :         if( bOutline )
     362                 :        190 :             eElem = XML_OUTLINE_LEVEL_STYLE;
     363                 :            :         else
     364                 :          0 :             eElem = XML_LIST_LEVEL_STYLE_NUMBER;
     365                 :            : 
     366         [ +  - ]:        190 :         GetExport().GetMM100UnitConverter().convertNumFormat( sTmp, eType );
     367                 :        190 :         GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_FORMAT,
     368   [ +  -  +  - ]:        380 :                                        sTmp.makeStringAndClear() );
     369         [ +  - ]:        190 :         GetExport().GetMM100UnitConverter().convertNumLetterSync( sTmp, eType );
     370         [ -  + ]:        190 :         if( sTmp.getLength() )
     371                 :          0 :             GetExport().AddAttribute( XML_NAMESPACE_STYLE,
     372                 :            :                                       XML_NUM_LETTER_SYNC,
     373   [ #  #  #  # ]:          0 :                                            sTmp.makeStringAndClear() );
     374                 :            : 
     375         [ -  + ]:        190 :         if( nStartValue != 1 )
     376                 :            :         {
     377         [ #  # ]:          0 :             sTmp.append( (sal_Int32)nStartValue );
     378                 :          0 :             GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
     379   [ #  #  #  # ]:          0 :                           sTmp.makeStringAndClear() );
     380                 :            :         }
     381 [ +  + ][ -  + ]:        190 :         if( nDisplayLevels > 1 && NumberingType::NUMBER_NONE != eType )
     382                 :            :         {
     383         [ #  # ]:          0 :             sTmp.append( (sal_Int32)nDisplayLevels );
     384                 :          0 :             GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_DISPLAY_LEVELS,
     385   [ #  #  #  # ]:          0 :                           sTmp.makeStringAndClear() );
     386                 :            :         }
     387                 :            :     }
     388                 :            : 
     389                 :            :     {
     390                 :        510 :         SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem,
     391         [ +  - ]:        510 :                                   sal_True, sal_True );
     392                 :            : 
     393                 :        510 :         OUStringBuffer sBuffer;
     394         [ +  + ]:        510 :         if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
     395                 :            :         {
     396                 :        320 :             nSpaceBefore += nMinLabelWidth;
     397                 :        320 :             nMinLabelWidth = -nMinLabelWidth;
     398         [ +  + ]:        320 :             if( nSpaceBefore != 0 )
     399                 :            :             {
     400                 :        292 :                 GetExport().GetMM100UnitConverter().convertMeasureToXML(
     401         [ +  - ]:        292 :                         sBuffer, nSpaceBefore );
     402                 :        292 :                 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_SPACE_BEFORE,
     403   [ +  -  +  - ]:        584 :                               sBuffer.makeStringAndClear() );
     404                 :            :             }
     405         [ +  + ]:        320 :             if( nMinLabelWidth != 0 )
     406                 :            :             {
     407                 :        308 :                 GetExport().GetMM100UnitConverter().convertMeasureToXML(
     408         [ +  - ]:        308 :                         sBuffer, nMinLabelWidth );
     409                 :        308 :                 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH,
     410   [ +  -  +  - ]:        616 :                               sBuffer.makeStringAndClear() );
     411                 :            :             }
     412         [ -  + ]:        320 :             if( nMinLabelDist > 0 )
     413                 :            :             {
     414                 :          0 :                 GetExport().GetMM100UnitConverter().convertMeasureToXML(
     415         [ #  # ]:          0 :                         sBuffer, nMinLabelDist );
     416                 :          0 :                 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE,
     417   [ #  #  #  # ]:          0 :                               sBuffer.makeStringAndClear() );
     418                 :            :             }
     419                 :            :         }
     420                 :            :         /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
     421                 :            :            are allowed to be exported. (#i89178#)
     422                 :            :         */
     423 [ +  - ][ +  - ]:        190 :         else if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
     424                 :            :                   mbExportPositionAndSpaceModeLabelAlignment )
     425                 :            :         {
     426                 :        190 :             GetExport().AddAttribute( XML_NAMESPACE_TEXT,
     427                 :            :                                       XML_LIST_LEVEL_POSITION_AND_SPACE_MODE,
     428         [ +  - ]:        190 :                                       XML_LABEL_ALIGNMENT );
     429                 :            :         }
     430         [ -  + ]:        510 :         if( HoriOrientation::LEFT != eAdjust )
     431                 :            :         {
     432                 :          0 :             enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
     433      [ #  #  # ]:          0 :             switch( eAdjust )
     434                 :            :             {
     435                 :          0 :             case HoriOrientation::RIGHT:    eValue = XML_END;   break;
     436                 :          0 :             case HoriOrientation::CENTER:   eValue = XML_CENTER;    break;
     437                 :            :             }
     438         [ #  # ]:          0 :             if( eValue != XML_TOKEN_INVALID )
     439         [ #  # ]:          0 :                 GetExport().AddAttribute( XML_NAMESPACE_FO, XML_TEXT_ALIGN, eValue );
     440                 :            :         }
     441                 :            : 
     442         [ -  + ]:        510 :         if( NumberingType::BITMAP == eType )
     443                 :            :         {
     444                 :          0 :             enum XMLTokenEnum eValue = XML_TOKEN_INVALID;
     445   [ #  #  #  # ]:          0 :             switch( eImageVertOrient )
     446                 :            :             {
     447                 :            :             case VertOrientation::BOTTOM:   // yes, its OK: BOTTOM means that the baseline
     448                 :            :                                     // hits the frame at its topmost position
     449                 :            :             case VertOrientation::LINE_TOP:
     450                 :            :             case VertOrientation::CHAR_TOP:
     451                 :          0 :                 eValue = XML_TOP;
     452                 :          0 :                 break;
     453                 :            :             case VertOrientation::CENTER:
     454                 :            :             case VertOrientation::LINE_CENTER:
     455                 :            :             case VertOrientation::CHAR_CENTER:
     456                 :          0 :                 eValue = XML_MIDDLE;
     457                 :          0 :                 break;
     458                 :            :             case VertOrientation::TOP:      // yes, its OK: TOP means that the baseline
     459                 :            :                                     // hits the frame at its bottommost position
     460                 :            :             case VertOrientation::LINE_BOTTOM:
     461                 :            :             case VertOrientation::CHAR_BOTTOM:
     462                 :          0 :                 eValue = XML_BOTTOM;
     463                 :          0 :                 break;
     464                 :            :             }
     465         [ #  # ]:          0 :             if( eValue != XML_TOKEN_INVALID )
     466         [ #  # ]:          0 :                 GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_VERTICAL_POS, eValue );
     467                 :            : 
     468                 :          0 :             eValue = XML_TOKEN_INVALID;
     469   [ #  #  #  # ]:          0 :             switch( eImageVertOrient )
     470                 :            :             {
     471                 :            :             case VertOrientation::TOP:
     472                 :            :             case VertOrientation::CENTER:
     473                 :            :             case VertOrientation::BOTTOM:
     474                 :          0 :                 eValue = XML_BASELINE;
     475                 :          0 :                 break;
     476                 :            :             case VertOrientation::LINE_TOP:
     477                 :            :             case VertOrientation::LINE_CENTER:
     478                 :            :             case VertOrientation::LINE_BOTTOM:
     479                 :          0 :                 eValue = XML_LINE;
     480                 :          0 :                 break;
     481                 :            :             case VertOrientation::CHAR_TOP:
     482                 :            :             case VertOrientation::CHAR_CENTER:
     483                 :            :             case VertOrientation::CHAR_BOTTOM:
     484                 :          0 :                 eValue = XML_CHAR;
     485                 :          0 :                 break;
     486                 :            :             }
     487         [ #  # ]:          0 :             if( eValue != XML_TOKEN_INVALID )
     488         [ #  # ]:          0 :                 GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_VERTICAL_REL, eValue );
     489                 :            : 
     490         [ #  # ]:          0 :             if( nImageWidth > 0 )
     491                 :            :             {
     492                 :          0 :                 GetExport().GetMM100UnitConverter().convertMeasureToXML(
     493         [ #  # ]:          0 :                         sBuffer, nImageWidth );
     494                 :          0 :                 GetExport().AddAttribute( XML_NAMESPACE_FO, XML_WIDTH,
     495   [ #  #  #  # ]:          0 :                               sBuffer.makeStringAndClear() );
     496                 :            :             }
     497                 :            : 
     498         [ #  # ]:          0 :             if( nImageHeight > 0 )
     499                 :            :             {
     500                 :          0 :                 GetExport().GetMM100UnitConverter().convertMeasureToXML(
     501         [ #  # ]:          0 :                         sBuffer, nImageHeight );
     502                 :          0 :                 GetExport().AddAttribute( XML_NAMESPACE_FO, XML_HEIGHT,
     503   [ #  #  #  # ]:          0 :                               sBuffer.makeStringAndClear() );
     504                 :            :             }
     505                 :            :         }
     506                 :            : 
     507                 :            :         {
     508                 :        510 :             SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE,
     509         [ +  - ]:        510 :                                       XML_LIST_LEVEL_PROPERTIES, sal_True, sal_True );
     510                 :            : 
     511                 :            :             /* Check, if properties for position-and-space-mode LABEL_ALIGNMENT
     512                 :            :                are allowed to be exported. (#i89178#)
     513                 :            :             */
     514 [ +  + ][ +  - ]:        510 :             if ( ePosAndSpaceMode == PositionAndSpaceMode::LABEL_ALIGNMENT &&
     515                 :            :                  mbExportPositionAndSpaceModeLabelAlignment )
     516                 :            :             {
     517                 :        190 :                 enum XMLTokenEnum eValue = XML_LISTTAB;
     518         [ -  + ]:        190 :                 if ( eLabelFollowedBy == LabelFollow::SPACE )
     519                 :            :                 {
     520                 :          0 :                     eValue = XML_SPACE;
     521                 :            :                 }
     522         [ -  + ]:        190 :                 else if ( eLabelFollowedBy == LabelFollow::NOTHING )
     523                 :            :                 {
     524                 :          0 :                     eValue = XML_NOTHING;
     525                 :            :                 }
     526                 :        190 :                 GetExport().AddAttribute( XML_NAMESPACE_TEXT,
     527         [ +  - ]:        190 :                                           XML_LABEL_FOLLOWED_BY, eValue );
     528                 :            : 
     529 [ +  - ][ +  - ]:        190 :                 if ( eLabelFollowedBy == LabelFollow::LISTTAB &&
     530                 :            :                      nListtabStopPosition > 0 )
     531                 :            :                 {
     532                 :        190 :                     GetExport().GetMM100UnitConverter().convertMeasureToXML(
     533         [ +  - ]:        190 :                             sBuffer, nListtabStopPosition );
     534                 :        190 :                     GetExport().AddAttribute( XML_NAMESPACE_TEXT,
     535                 :            :                                               XML_LIST_TAB_STOP_POSITION,
     536   [ +  -  +  - ]:        380 :                                               sBuffer.makeStringAndClear() );
     537                 :            :                 }
     538                 :            : 
     539         [ +  - ]:        190 :                 if ( nFirstLineIndent != 0 )
     540                 :            :                 {
     541                 :        190 :                     GetExport().GetMM100UnitConverter().convertMeasureToXML(
     542         [ +  - ]:        190 :                             sBuffer, nFirstLineIndent );
     543                 :        190 :                     GetExport().AddAttribute( XML_NAMESPACE_FO,
     544                 :            :                                               XML_TEXT_INDENT,
     545   [ +  -  +  - ]:        380 :                                               sBuffer.makeStringAndClear() );
     546                 :            :                 }
     547                 :            : 
     548         [ +  - ]:        190 :                 if ( nIndentAt != 0 )
     549                 :            :                 {
     550                 :        190 :                     GetExport().GetMM100UnitConverter().convertMeasureToXML(
     551         [ +  - ]:        190 :                             sBuffer, nIndentAt );
     552                 :        190 :                     GetExport().AddAttribute( XML_NAMESPACE_FO,
     553                 :            :                                               XML_MARGIN_LEFT,
     554   [ +  -  +  - ]:        380 :                                               sBuffer.makeStringAndClear() );
     555                 :            :                 }
     556                 :            : 
     557                 :        190 :                 SvXMLElementExport aLabelAlignmentElement( GetExport(), XML_NAMESPACE_STYLE,
     558                 :            :                                              XML_LIST_LEVEL_LABEL_ALIGNMENT,
     559 [ +  - ][ +  - ]:        190 :                                              sal_True, sal_True );
     560         [ +  - ]:        510 :             }
     561                 :            :         }
     562                 :            : 
     563         [ +  + ]:        510 :         if( NumberingType::CHAR_SPECIAL == eType )
     564                 :            :         {
     565         [ +  - ]:        320 :             if( !sBulletFontName.isEmpty() )
     566                 :            :             {
     567                 :            :                 OUString sStyleName =
     568                 :        320 :                     GetExport().GetFontAutoStylePool()->Find(
     569                 :            :                         sBulletFontName, sBulletFontStyleName,
     570                 :            :                         eBulletFontFamily, eBulletFontPitch,
     571 [ +  - ][ +  - ]:        320 :                         eBulletFontEncoding );
         [ +  - ][ +  - ]
     572                 :            : 
     573         [ -  + ]:        320 :                 if( !sStyleName.isEmpty() )
     574                 :            :                 {
     575                 :          0 :                         GetExport().AddAttribute( XML_NAMESPACE_STYLE,
     576                 :            :                                                   XML_FONT_NAME,
     577         [ #  # ]:          0 :                                                   sStyleName );
     578                 :            :                 }
     579                 :            :                 else
     580                 :            :                 {
     581                 :        320 :                     Any aAny;
     582                 :        320 :                     OUString sTemp;
     583                 :            : 
     584                 :            :                     const SvXMLUnitConverter& rUnitConv =
     585                 :        320 :                         GetExport().GetMM100UnitConverter();
     586                 :        320 :                     XMLFontFamilyNamePropHdl aFamilyNameHdl;
     587         [ +  - ]:        320 :                     aAny <<= sBulletFontName;
     588 [ +  - ][ +  - ]:        320 :                     if( aFamilyNameHdl.exportXML( sTemp, aAny, rUnitConv ) )
     589                 :        320 :                         GetExport().AddAttribute( XML_NAMESPACE_FO,
     590         [ +  - ]:        320 :                                                   XML_FONT_FAMILY, sTemp );
     591                 :            : 
     592         [ -  + ]:        320 :                     if( !sBulletFontStyleName.isEmpty() )
     593                 :          0 :                         GetExport().AddAttribute( XML_NAMESPACE_STYLE,
     594                 :            :                                                   XML_FONT_STYLE_NAME,
     595         [ #  # ]:          0 :                                                   sBulletFontStyleName );
     596                 :            : 
     597                 :        320 :                     XMLFontFamilyPropHdl aFamilyHdl;
     598         [ +  - ]:        320 :                     aAny <<= (sal_Int16)eBulletFontFamily;
     599 [ +  - ][ -  + ]:        320 :                     if( aFamilyHdl.exportXML( sTemp, aAny, rUnitConv  ) )
     600                 :          0 :                         GetExport().AddAttribute( XML_NAMESPACE_STYLE,
     601                 :            :                                                   XML_FONT_FAMILY_GENERIC,
     602         [ #  # ]:          0 :                                                   sTemp );
     603                 :            : 
     604                 :        320 :                     XMLFontPitchPropHdl aPitchHdl;
     605         [ +  - ]:        320 :                     aAny <<= (sal_Int16)eBulletFontPitch;
     606 [ +  - ][ -  + ]:        320 :                     if( aPitchHdl.exportXML( sTemp, aAny, rUnitConv  ) )
     607                 :          0 :                         GetExport().AddAttribute( XML_NAMESPACE_STYLE,
     608         [ #  # ]:          0 :                                                   XML_FONT_PITCH, sTemp );
     609                 :            : 
     610                 :        320 :                     XMLFontEncodingPropHdl aEncHdl;
     611         [ +  - ]:        320 :                     aAny <<= (sal_Int16)eBulletFontEncoding;
     612 [ +  - ][ -  + ]:        320 :                     if( aEncHdl.exportXML( sTemp, aAny, rUnitConv  ) )
     613                 :          0 :                         GetExport().AddAttribute( XML_NAMESPACE_STYLE,
     614 [ +  - ][ +  - ]:        320 :                                                   XML_FONT_CHARSET, sTemp );
         [ +  - ][ +  - ]
                 [ #  # ]
     615                 :        320 :                 }
     616                 :            :             }
     617                 :            :         }
     618         [ +  - ]:        510 :         if( NumberingType::BITMAP != eType )
     619                 :            :         {
     620                 :            :             // fo:color = "#..."
     621         [ +  + ]:        510 :             if( bHasColor )
     622                 :            :             {
     623         [ +  - ]:        320 :                 if (0xffffffff == static_cast<sal_uInt32>(nColor))
     624                 :            :                 {
     625         [ +  - ]:        320 :                     GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_USE_WINDOW_FONT_COLOR, XML_TRUE );
     626                 :            :                 }
     627                 :            :                 else
     628                 :            :                 {
     629         [ #  # ]:          0 :                     ::sax::Converter::convertColor( sBuffer, nColor );
     630                 :          0 :                     GetExport().AddAttribute( XML_NAMESPACE_FO, XML_COLOR,
     631   [ #  #  #  # ]:          0 :                                   sBuffer.makeStringAndClear() );
     632                 :            :                 }
     633                 :            :             }
     634                 :            :             // fo:height="...%"
     635         [ +  + ]:        510 :             if( nBullRelSize )
     636                 :            :             {
     637         [ +  - ]:        320 :                 ::sax::Converter::convertPercent( sTmp, nBullRelSize );
     638                 :        320 :                 GetExport().AddAttribute( XML_NAMESPACE_FO, XML_FONT_SIZE,
     639   [ +  -  +  - ]:        640 :                               sTmp.makeStringAndClear() );
     640                 :            :             }
     641                 :            :         }
     642 [ +  - ][ +  + ]:        510 :         if( GetExport().GetAttrList().getLength() > 0 )
     643                 :            :         {
     644                 :        320 :             SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_STYLE,
     645 [ +  - ][ +  - ]:        320 :                                       XML_TEXT_PROPERTIES, sal_True, sal_True );
     646                 :            :         }
     647 [ -  + ][ #  # ]:        510 :         if( NumberingType::BITMAP == eType && !sImageURL.isEmpty() )
                 [ -  + ]
     648                 :            :         {
     649                 :            :             // optional office:binary-data
     650         [ #  # ]:          0 :             GetExport().AddEmbeddedGraphicObjectAsBase64( sImageURL );
     651         [ +  - ]:        510 :         }
     652 [ -  + ][ -  + ]:        510 :     }
         [ -  + ][ -  + ]
         [ -  + ][ -  + ]
                 [ +  - ]
     653                 :            : }
     654                 :            : 
     655                 :            : 
     656                 :          0 : uno::Reference< ::com::sun::star::container::XIndexReplace >  SvxXMLNumRuleExport::GetUNONumRule() const
     657                 :            : {
     658                 :          0 :     return uno::Reference< ::com::sun::star::container::XIndexReplace > ();
     659                 :            : }
     660                 :            : 
     661                 :         32 : void SvxXMLNumRuleExport::AddListStyleAttributes()
     662                 :            : {
     663                 :         32 : }
     664                 :            : 
     665                 :            : 
     666                 :        361 : SvxXMLNumRuleExport::SvxXMLNumRuleExport( SvXMLExport& rExp ) :
     667                 :            :     rExport( rExp ),
     668                 :            :     sNumberingRules( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ),
     669                 :            :     sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
     670                 :            :     sIsContinuousNumbering( RTL_CONSTASCII_USTRINGPARAM( "IsContinuousNumbering" ) ),
     671                 :            :     // Let list style creation depend on Load/Save option "ODF format version" (#i89178#)
     672 [ +  - ][ +  - ]:        361 :     mbExportPositionAndSpaceModeLabelAlignment( true )
                 [ +  - ]
     673                 :            : {
     674 [ +  - ][ -  + ]:        361 :     switch ( GetExport().getDefaultVersion() )
     675                 :            :     {
     676                 :            :         case SvtSaveOptions::ODFVER_010:
     677                 :            :         case SvtSaveOptions::ODFVER_011:
     678                 :            :         {
     679                 :          0 :             mbExportPositionAndSpaceModeLabelAlignment = false;
     680                 :            :         }
     681                 :          0 :         break;
     682                 :            :         default: // ODFVER_UNKNOWN or ODFVER_012
     683                 :            :         {
     684                 :        361 :             mbExportPositionAndSpaceModeLabelAlignment = true;
     685                 :            :         }
     686                 :            :     }
     687                 :        361 : }
     688                 :            : 
     689                 :        351 : SvxXMLNumRuleExport::~SvxXMLNumRuleExport()
     690                 :            : {
     691         [ -  + ]:        351 : }
     692                 :            : 
     693                 :         32 : void SvxXMLNumRuleExport::exportNumberingRule(
     694                 :            :         const OUString& rName,
     695                 :            :         const Reference< XIndexReplace >& rNumRule )
     696                 :            : {
     697         [ +  - ]:         32 :     Reference< XPropertySet > xPropSet( rNumRule, UNO_QUERY );
     698                 :         32 :     Reference< XPropertySetInfo > xPropSetInfo;
     699         [ -  + ]:         32 :     if( xPropSet.is() )
     700 [ #  # ][ #  # ]:          0 :            xPropSetInfo = xPropSet->getPropertySetInfo();
                 [ #  # ]
     701                 :            : 
     702                 :         32 :     GetExport().CheckAttrList();
     703                 :            : 
     704                 :            :     // style:name="..."
     705         [ +  - ]:         32 :     if( !rName.isEmpty() )
     706                 :            :     {
     707                 :         32 :         sal_Bool bEncoded = sal_False;
     708                 :         32 :         GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
     709   [ +  -  +  - ]:         64 :                           GetExport().EncodeStyleName( rName, &bEncoded ) );
     710         [ -  + ]:         32 :         if( bEncoded )
     711                 :          0 :             GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
     712         [ #  # ]:         32 :                                  rName);
     713                 :            :     }
     714                 :            : 
     715                 :            :     // text:consecutive-numbering="..."
     716                 :         32 :     sal_Bool bContNumbering = sal_False;
     717 [ -  + ][ #  # ]:         32 :     if( xPropSetInfo.is() &&
                 [ -  + ]
     718 [ #  # ][ #  # ]:          0 :         xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) )
     719                 :            :     {
     720 [ #  # ][ #  # ]:          0 :         Any aAny( xPropSet->getPropertyValue( sIsContinuousNumbering ) );
     721                 :          0 :         bContNumbering = *(sal_Bool *)aAny.getValue();
     722                 :            :     }
     723         [ -  + ]:         32 :     if( bContNumbering )
     724                 :          0 :         GetExport().AddAttribute( XML_NAMESPACE_TEXT,
     725         [ #  # ]:          0 :                                   XML_CONSECUTIVE_NUMBERING, XML_TRUE );
     726                 :            : 
     727                 :            :     // other application specific attributes
     728         [ +  - ]:         32 :     AddListStyleAttributes();
     729                 :            : 
     730                 :            :     {
     731                 :         32 :         SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, XML_LIST_STYLE ,
     732         [ +  - ]:         32 :                                   sal_True, sal_True );
     733 [ +  - ][ +  - ]:         32 :         exportLevelStyles( rNumRule );
     734                 :         32 :     }
     735                 :         32 : }
     736                 :            : 
     737                 :        210 : sal_Bool SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle )
     738                 :            : {
     739         [ +  - ]:        210 :     Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
     740 [ +  - ][ +  - ]:        210 :     Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
     741                 :            : 
     742                 :        210 :     Any aAny;
     743                 :            : 
     744                 :            :     // Don't export styles that aren't existing really. This may be the
     745                 :            :     // case for StarOffice Writer's pool styles.
     746 [ +  - ][ +  - ]:        210 :     if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
                 [ +  - ]
     747                 :            :     {
     748 [ +  - ][ +  - ]:        210 :         aAny = xPropSet->getPropertyValue( sIsPhysical );
     749         [ +  - ]:        210 :         if( !*(sal_Bool *)aAny.getValue() )
     750                 :        210 :             return sal_False;
     751                 :            :     }
     752                 :            : 
     753 [ #  # ][ #  # ]:          0 :     aAny = xPropSet->getPropertyValue( sNumberingRules );
     754                 :          0 :     Reference<XIndexReplace> xNumRule;
     755         [ #  # ]:          0 :     aAny >>= xNumRule;
     756                 :            : 
     757 [ #  # ][ #  # ]:          0 :     OUString sName = rStyle->getName();
     758                 :            : 
     759         [ #  # ]:          0 :     exportNumberingRule( sName, xNumRule );
     760                 :            : 
     761                 :        210 :     return sal_True;
     762                 :            : }
     763                 :            : 
     764                 :         19 : void SvxXMLNumRuleExport::exportOutline()
     765                 :            : {
     766                 :         19 :     Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(),
     767         [ +  - ]:         19 :                                                         UNO_QUERY );
     768                 :            :     DBG_ASSERT( xCNSupplier.is(), "no chapter numbering supplier" );
     769                 :            : 
     770         [ +  - ]:         19 :     if( xCNSupplier.is() )
     771                 :            :     {
     772 [ +  - ][ +  - ]:         19 :         Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
     773                 :            :         DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
     774                 :            : 
     775         [ +  - ]:         19 :         if( xNumRule.is() )
     776                 :            :         {
     777                 :            :             /* Outline style has property style:name since ODF 1.2
     778                 :            :                Thus, export this property and adjust fix for issue #i69627# (#i90780#)
     779                 :            :             */
     780                 :         19 :             OUString sOutlineStyleName;
     781                 :            :             {
     782                 :            :                 Reference<XPropertySet> xNumRulePropSet(
     783 [ +  - ][ +  - ]:         19 :                     xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
                 [ +  - ]
     784         [ +  - ]:         19 :                 if (xNumRulePropSet.is())
     785                 :            :                 {
     786         [ +  - ]:         19 :                     const OUString sName( RTL_CONSTASCII_USTRINGPARAM("Name") );
     787 [ +  - ][ +  - ]:         19 :                     xNumRulePropSet->getPropertyValue( sName ) >>= sOutlineStyleName;
     788                 :         19 :                 }
     789                 :            :             }
     790                 :            :             const SvtSaveOptions::ODFDefaultVersion nODFVersion =
     791         [ +  - ]:         19 :                                                 GetExport().getDefaultVersion();
     792 [ +  - ][ -  + ]:         19 :             if ( ( nODFVersion == SvtSaveOptions::ODFVER_010 ||
         [ #  # ][ -  + ]
     793                 :            :                    nODFVersion == SvtSaveOptions::ODFVER_011 ) &&
     794         [ #  # ]:          0 :                  GetExport().writeOutlineStyleAsNormalListStyle() )
     795                 :            :             {
     796         [ #  # ]:          0 :                 exportNumberingRule( sOutlineStyleName, xNumRule );
     797                 :            :             }
     798                 :            :             else
     799                 :            :             {
     800 [ +  - ][ +  - ]:         19 :                 if ( nODFVersion != SvtSaveOptions::ODFVER_010 &&
     801                 :            :                      nODFVersion != SvtSaveOptions::ODFVER_011 )
     802                 :            :                 {
     803                 :            :                     // style:name="..."
     804                 :         19 :                     GetExport().CheckAttrList();
     805         [ +  - ]:         19 :                     if ( !sOutlineStyleName.isEmpty() )
     806                 :            :                      {
     807                 :         19 :                         sal_Bool bEncoded = sal_False;
     808                 :         19 :                         GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME,
     809                 :         19 :                                         GetExport().EncodeStyleName( sOutlineStyleName,
     810   [ +  -  +  - ]:         38 :                                                                      &bEncoded ) );
     811         [ -  + ]:         19 :                         if( bEncoded )
     812                 :          0 :                             GetExport().AddAttribute( XML_NAMESPACE_STYLE,
     813                 :            :                                                       XML_DISPLAY_NAME,
     814         [ #  # ]:         19 :                                                       sOutlineStyleName );
     815                 :            :                     }
     816                 :            :                 }
     817                 :         19 :                 SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
     818         [ +  - ]:         19 :                                           XML_OUTLINE_STYLE, sal_True, sal_True );
     819 [ +  - ][ +  - ]:         19 :                 exportLevelStyles( xNumRule, sal_True );
     820                 :         19 :             }
     821                 :         19 :         }
     822                 :         19 :     }
     823                 :         19 : }
     824                 :            : 
     825                 :         21 : void SvxXMLNumRuleExport::exportStyles( sal_Bool bUsed,
     826                 :            :                                          XMLTextListAutoStylePool *pPool,
     827                 :            :                                          sal_Bool bExportChapterNumbering )
     828                 :            : {
     829         [ +  + ]:         21 :     if( bExportChapterNumbering )
     830         [ +  - ]:         19 :         exportOutline();
     831                 :            : 
     832         [ +  - ]:         21 :     Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
     833                 :            :     DBG_ASSERT( xFamiliesSupp.is(), "No XStyleFamiliesSupplier from XModel for export!" );
     834         [ +  - ]:         21 :     if( xFamiliesSupp.is() )
     835                 :            :     {
     836 [ +  - ][ +  - ]:         21 :         Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
     837                 :            :         DBG_ASSERT( xFamiliesSupp.is(), "getStyleFamilies() from XModel failed for export!" );
     838                 :            : 
     839         [ +  - ]:         21 :         if( xFamilies.is() )
     840                 :            :         {
     841         [ +  - ]:         21 :             const OUString aNumberStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyles" ));
     842                 :            : 
     843                 :         21 :             Reference< XIndexAccess > xStyles;
     844 [ +  - ][ +  - ]:         21 :             if( xFamilies->hasByName( aNumberStyleName ) )
                 [ +  - ]
     845                 :            :             {
     846 [ +  - ][ +  - ]:         21 :                 xFamilies->getByName( aNumberStyleName ) >>= xStyles;
                 [ +  - ]
     847                 :            : 
     848                 :            :                 DBG_ASSERT( xStyles.is(), "Style not found for export!" );
     849                 :            : 
     850         [ +  - ]:         21 :                 if( xStyles.is() )
     851                 :            :                 {
     852 [ +  - ][ +  - ]:         21 :                     const sal_Int32 nStyles = xStyles->getCount();
     853                 :            : 
     854         [ +  + ]:        231 :                     for( sal_Int32 i=0; i < nStyles; i++ )
     855                 :            :                     {
     856                 :        210 :                         Reference< XStyle > xStyle;
     857 [ +  - ][ +  - ]:        210 :                         xStyles->getByIndex( i ) >>= xStyle;
                 [ +  - ]
     858                 :            : 
     859 [ #  # ][ #  # ]:        210 :                         if( !bUsed || xStyle->isInUse() )
         [ #  # ][ +  - ]
                 [ -  + ]
     860                 :            :                         {
     861         [ +  - ]:        210 :                             exportStyle( xStyle );
     862         [ +  - ]:        210 :                             if( pPool )
     863 [ +  - ][ +  - ]:        210 :                                 pPool->RegisterName( xStyle->getName() );
                 [ +  - ]
     864                 :            :                         }
     865                 :        210 :                     }
     866                 :            :                 }
     867                 :         21 :             }
     868                 :         21 :         }
     869                 :         21 :     }
     870                 :         21 : }
     871                 :            : 
     872                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10