LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/style - xmlnumi.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 404 575 70.3 %
Date: 2012-12-27 Functions: 43 52 82.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/beans/PropertyValue.hpp>
      21             : #include <com/sun/star/beans/XPropertySet.hpp>
      22             : #include <com/sun/star/awt/Size.hpp>
      23             : #include <com/sun/star/awt/FontDescriptor.hpp>
      24             : #include <com/sun/star/text/HoriOrientation.hpp>
      25             : #include <com/sun/star/text/VertOrientation.hpp>
      26             : #include <com/sun/star/text/PositionAndSpaceMode.hpp>
      27             : #include <com/sun/star/text/LabelFollow.hpp>
      28             : #include <com/sun/star/container/XNameContainer.hpp>
      29             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      30             : #include <com/sun/star/style/XStyle.hpp>
      31             : #include <com/sun/star/io/XOutputStream.hpp>
      32             : 
      33             : #include <rtl/ustrbuf.hxx>
      34             : 
      35             : #include <tools/debug.hxx>
      36             : #include <tools/fontenum.hxx>
      37             : 
      38             : #include <sax/tools/converter.hxx>
      39             : 
      40             : #include <xmloff/xmltkmap.hxx>
      41             : #include <xmloff/nmspmap.hxx>
      42             : #include "xmloff/xmlnmspe.hxx"
      43             : #include <xmloff/xmlimp.hxx>
      44             : #include <xmloff/XMLBase64ImportContext.hxx>
      45             : #include <xmloff/xmltoken.hxx>
      46             : 
      47             : #include <xmloff/i18nmap.hxx>
      48             : #include <xmloff/xmluconv.hxx>
      49             : #include "fonthdl.hxx"
      50             : #include <xmloff/XMLFontStylesContext.hxx>
      51             : #include <xmloff/families.hxx>
      52             : #include <xmloff/maptype.hxx>
      53             : 
      54             : #include <xmloff/xmlnumi.hxx>
      55             : 
      56             : 
      57             : using namespace ::com::sun::star;
      58             : using namespace ::com::sun::star::uno;
      59             : using namespace ::com::sun::star::style;
      60             : using namespace ::com::sun::star::text;
      61             : using namespace ::com::sun::star::beans;
      62             : using namespace ::com::sun::star::container;
      63             : using namespace ::com::sun::star::lang;
      64             : using namespace ::com::sun::star::frame;
      65             : using namespace ::xmloff::token;
      66             : using namespace ::com::sun::star::io;
      67             : 
      68             : static sal_Char const XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] =
      69             :         "SymbolTextDistance";
      70             : static sal_Char const XML_UNO_NAME_NRULE_PARENT_NUMBERING[] =
      71             :         "ParentNumbering";
      72             : static sal_Char const XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] =
      73             :         "CharStyleName";
      74             : static sal_Char const XML_UNO_NAME_NRULE_BULLET_CHAR[] ="BulletChar";
      75             : static sal_Char const XML_UNO_NAME_NRULE_BULLET_RELSIZE[] = "BulletRelSize";
      76             : static sal_Char const XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] =
      77             :         "GraphicSize";
      78             : static sal_Char const XML_UNO_NAME_NRULE_VERT_ORIENT[] ="VertOrient";
      79             : 
      80             : static sal_Char const XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType";
      81             : static sal_Char const XML_UNO_NAME_NRULE_PREFIX[] = "Prefix";
      82             : static sal_Char const XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix";
      83             : static sal_Char const XML_UNO_NAME_NRULE_ADJUST[] = "Adjust";
      84             : static sal_Char const XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin";
      85             : static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] =
      86             :     "FirstLineOffset";
      87             : static sal_Char const XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont";
      88             : static sal_Char const XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL";
      89             : static sal_Char const XML_UNO_NAME_NRULE_START_WITH[] = "StartWith";
      90             : static sal_Char const XML_UNO_NAME_NRULE_BULLET_COLOR[] = "BulletColor";
      91             : static sal_Char const XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
      92             : static sal_Char const XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
      93             : static sal_Char const XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION[] = "ListtabStopPosition";
      94             : static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_INDENT[] = "FirstLineIndent";
      95             : static sal_Char const XML_UNO_NAME_NRULE_INDENT_AT[] = "IndentAt";
      96             : 
      97             : // ---------------------------------------------------------------------
      98             : 
      99             : class SvxXMLListLevelStyleContext_Impl;
     100             : 
     101             : class SvxXMLListLevelStyleAttrContext_Impl : public SvXMLImportContext
     102             : {
     103             :     SvxXMLListLevelStyleContext_Impl&   rListLevel;
     104             : 
     105             : public:
     106             : 
     107             :     SvxXMLListLevelStyleAttrContext_Impl(
     108             :             SvXMLImport& rImport, sal_uInt16 nPrfx,
     109             :              const OUString& rLName,
     110             :               const Reference< xml::sax::XAttributeList >& xAttrList,
     111             :             SvxXMLListLevelStyleContext_Impl& rLLevel   );
     112             :     virtual ~SvxXMLListLevelStyleAttrContext_Impl();
     113             : 
     114             :     virtual SvXMLImportContext *CreateChildContext(
     115             :             sal_uInt16 nPrefix, const OUString& rLocalName,
     116             :             const Reference< xml::sax::XAttributeList > & xAttrList );
     117             : };
     118             : 
     119             : // ---------------------------------------------------------------------
     120             : 
     121             : class SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl : public SvXMLImportContext
     122             : {
     123             :     SvxXMLListLevelStyleContext_Impl&   rListLevel;
     124             : 
     125             : public:
     126             : 
     127             :     SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl(
     128             :             SvXMLImport& rImport, sal_uInt16 nPrfx,
     129             :             const OUString& rLName,
     130             :             const Reference< xml::sax::XAttributeList >& xAttrList,
     131             :             SvxXMLListLevelStyleContext_Impl& rLLevel   );
     132             :     virtual ~SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl();
     133             : };
     134             : 
     135             : // ---------------------------------------------------------------------
     136             : 
     137             : enum SvxXMLTextListLevelStyleAttrTokens
     138             : {
     139             :     XML_TOK_TEXT_LEVEL_ATTR_LEVEL,
     140             :     XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME,
     141             :     XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR,
     142             :     XML_TOK_TEXT_LEVEL_ATTR_HREF,
     143             :     XML_TOK_TEXT_LEVEL_ATTR_TYPE,
     144             :     XML_TOK_TEXT_LEVEL_ATTR_SHOW,
     145             :     XML_TOK_TEXT_LEVEL_ATTR_ACTUATE,
     146             :     XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT,
     147             :     XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX,
     148             :     XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX,
     149             :     XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC,
     150             :     XML_TOK_TEXT_LEVEL_ATTR_START_VALUE,
     151             :     XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS,
     152             : 
     153             :     XML_TOK_TEXT_LEVEL_ATTR_END=XML_TOK_UNKNOWN
     154             : };
     155             : 
     156         350 : static const SvXMLTokenMapEntry* lcl_getLevelAttrTokenMap()
     157             : {
     158             :     static SvXMLTokenMapEntry aLevelAttrTokenMap[] =
     159             :     {
     160             :         { XML_NAMESPACE_TEXT, XML_LEVEL, XML_TOK_TEXT_LEVEL_ATTR_LEVEL },
     161             :         { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME },
     162             :         { XML_NAMESPACE_TEXT, XML_BULLET_CHAR, XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR },
     163             :         { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXT_LEVEL_ATTR_HREF },
     164             :         { XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_TEXT_LEVEL_ATTR_TYPE },
     165             :         { XML_NAMESPACE_XLINK, XML_SHOW, XML_TOK_TEXT_LEVEL_ATTR_SHOW },
     166             :         { XML_NAMESPACE_XLINK, XML_ACTUATE, XML_TOK_TEXT_LEVEL_ATTR_ACTUATE },
     167             : 
     168             :         { XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT },
     169             :         { XML_NAMESPACE_STYLE, XML_NUM_PREFIX, XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX },
     170             :         { XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX },
     171             :         { XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC },
     172             :         { XML_NAMESPACE_TEXT, XML_START_VALUE, XML_TOK_TEXT_LEVEL_ATTR_START_VALUE },
     173             :         { XML_NAMESPACE_TEXT, XML_DISPLAY_LEVELS, XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS },
     174             : 
     175             :         XML_TOKEN_MAP_END
     176             :     };
     177         350 :     return aLevelAttrTokenMap;
     178             : }
     179             : 
     180             : class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext
     181             : {
     182             :     friend class SvxXMLListLevelStyleAttrContext_Impl;
     183             :     const OUString      sStarBats;
     184             :     const OUString      sStarMath;
     185             : 
     186             :     OUString            sPrefix;
     187             :     OUString            sSuffix;
     188             :     OUString            sTextStyleName;
     189             :     OUString            sNumFormat;
     190             :     OUString            sNumLetterSync;
     191             :     OUString            sBulletFontName;
     192             :     OUString            sBulletFontStyleName;
     193             :     OUString            sImageURL;
     194             : 
     195             :     Reference < XOutputStream > xBase64Stream;
     196             : 
     197             :     sal_Int32           nLevel;
     198             :     sal_Int32           nSpaceBefore;
     199             :     sal_Int32           nMinLabelWidth;
     200             :     sal_Int32           nMinLabelDist;
     201             :     sal_Int32           nImageWidth;
     202             :     sal_Int32           nImageHeight;
     203             :     sal_Int16           nNumStartValue;
     204             :     sal_Int16           nNumDisplayLevels;
     205             : 
     206             :     sal_Int16           eAdjust;
     207             :     sal_Int16           eBulletFontFamily;
     208             :     sal_Int16           eBulletFontPitch;
     209             :     rtl_TextEncoding    eBulletFontEncoding;
     210             :     sal_Int16           eImageVertOrient;
     211             : 
     212             :     sal_Unicode         cBullet;
     213             : 
     214             :     sal_Int16           nRelSize;
     215             :     sal_Int32           m_nColor;
     216             : 
     217             :     sal_Int16           ePosAndSpaceMode;
     218             :     sal_Int16           eLabelFollowedBy;
     219             :     sal_Int32           nListtabStopPosition;
     220             :     sal_Int32           nFirstLineIndent;
     221             :     sal_Int32           nIndentAt;
     222             : 
     223             :     sal_Bool            bBullet : 1;
     224             :     sal_Bool            bImage : 1;
     225             :     sal_Bool            bNum : 1;
     226             :     sal_Bool            bHasColor : 1;
     227             : 
     228         100 :     void SetRelSize( sal_Int16 nRel ) { nRelSize = nRel; }
     229         100 :     void SetColor( sal_Int32 nColor )
     230         100 :         { m_nColor = nColor; bHasColor = sal_True; }
     231          93 :     void SetSpaceBefore( sal_Int32 nSet ) { nSpaceBefore = nSet; }
     232          93 :     void SetMinLabelWidth( sal_Int32 nSet ) { nMinLabelWidth = nSet; }
     233          10 :     void SetMinLabelDist( sal_Int32 nSet ) { nMinLabelDist = nSet; }
     234           3 :     void SetAdjust( sal_Int16 eSet ) { eAdjust = eSet; }
     235             : 
     236         110 :     void SetBulletFontName( const OUString& rSet ) { sBulletFontName = rSet; }
     237           0 :     void SetBulletFontStyleName( const OUString& rSet )
     238           0 :          { sBulletFontStyleName = rSet; }
     239           0 :     void SetBulletFontFamily( sal_Int16 eSet ) { eBulletFontFamily = eSet; }
     240           0 :     void SetBulletFontPitch( sal_Int16 eSet ) { eBulletFontPitch = eSet; }
     241          40 :     void SetBulletFontEncoding( rtl_TextEncoding eSet )
     242          40 :          { eBulletFontEncoding = eSet; }
     243             : 
     244           0 :     void SetImageWidth( sal_Int32 nSet ) { nImageWidth = nSet; }
     245           0 :     void SetImageHeight( sal_Int32 nSet ) { nImageHeight = nSet; }
     246         460 :     void SetImageVertOrient( sal_Int16 eSet )
     247         460 :          { eImageVertOrient = eSet; }
     248             : 
     249             : public:
     250             : 
     251             :     SvxXMLListLevelStyleContext_Impl(
     252             :             SvXMLImport& rImport, sal_uInt16 nPrfx,
     253             :             const OUString& rLName,
     254             :             const Reference< xml::sax::XAttributeList > & xAttrList );
     255             :     virtual ~SvxXMLListLevelStyleContext_Impl();
     256             : 
     257             :     virtual SvXMLImportContext *CreateChildContext(
     258             :             sal_uInt16 nPrefix, const OUString& rLocalName,
     259             :             const Reference< xml::sax::XAttributeList > & xAttrList );
     260             : 
     261         320 :     sal_Int32 GetLevel() const { return nLevel; }
     262             :     Sequence<beans::PropertyValue> GetProperties(
     263             :             const SvI18NMap *pI18NMap=0 );
     264             : 
     265         240 :     inline void SetPosAndSpaceMode( sal_Int16 eValue )
     266             :     {
     267         240 :         ePosAndSpaceMode = eValue;
     268         240 :     }
     269         240 :     inline void SetLabelFollowedBy( sal_Int16 eValue )
     270             :     {
     271         240 :         eLabelFollowedBy = eValue;
     272         240 :     }
     273         186 :     inline void SetListtabStopPosition( sal_Int32 nValue )
     274             :     {
     275         186 :         nListtabStopPosition = nValue;
     276         186 :     }
     277         231 :     inline void SetFirstLineIndent( sal_Int32 nValue )
     278             :     {
     279         231 :         nFirstLineIndent = nValue;
     280         231 :     }
     281         239 :     inline void SetIndentAt( sal_Int32 nValue )
     282             :     {
     283         239 :         nIndentAt = nValue;
     284         239 :     }
     285             : };
     286             : 
     287         350 : SvxXMLListLevelStyleContext_Impl::SvxXMLListLevelStyleContext_Impl(
     288             :         SvXMLImport& rImport, sal_uInt16 nPrfx,
     289             :         const OUString& rLName,
     290             :         const Reference< xml::sax::XAttributeList > & xAttrList )
     291             : 
     292             : :   SvXMLImportContext( rImport, nPrfx, rLName )
     293             : ,   sStarBats( "StarBats"  )
     294             : ,   sStarMath( "StarMath"  )
     295             : ,   sNumFormat( OUString("1") )
     296             : ,   nLevel( -1L )
     297             : ,   nSpaceBefore( 0L )
     298             : ,   nMinLabelWidth( 0L )
     299             : ,   nMinLabelDist( 0L )
     300             : ,   nImageWidth( 0L )
     301             : ,   nImageHeight( 0L )
     302             : ,   nNumStartValue( 1 )
     303             : ,   nNumDisplayLevels( 1 )
     304             : ,   eAdjust( HoriOrientation::LEFT )
     305             : ,   eBulletFontFamily( FAMILY_DONTKNOW )
     306             : ,   eBulletFontPitch( PITCH_DONTKNOW )
     307             : ,   eBulletFontEncoding( RTL_TEXTENCODING_DONTKNOW )
     308             : ,   eImageVertOrient(0)
     309             : ,   cBullet( 0 )
     310             : ,   nRelSize(0)
     311             : ,   m_nColor(0)
     312             : ,   ePosAndSpaceMode( PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION )
     313             : ,   eLabelFollowedBy( LabelFollow::LISTTAB )
     314             : ,   nListtabStopPosition( 0 )
     315             : ,   nFirstLineIndent( 0 )
     316             : ,   nIndentAt( 0 )
     317             : ,   bBullet( sal_False )
     318             : ,   bImage( sal_False )
     319             : ,   bNum( sal_False )
     320         350 : ,   bHasColor( sal_False )
     321             : {
     322         630 :     if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_NUMBER ) ||
     323         280 :         IsXMLToken( rLName, XML_OUTLINE_LEVEL_STYLE )        )
     324         240 :         bNum = sal_True;
     325         110 :     else if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_BULLET ) )
     326         110 :         bBullet = sal_True;
     327           0 :     else if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_IMAGE ) )
     328           0 :         bImage = sal_True;
     329             : 
     330         350 :     SvXMLTokenMap aTokenMap( lcl_getLevelAttrTokenMap() );
     331         350 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
     332        1168 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
     333             :     {
     334         818 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
     335         818 :         OUString aLocalName;
     336             :         sal_uInt16 nPrefix =
     337         818 :             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
     338         818 :                                                             &aLocalName );
     339         818 :         const OUString& rValue = xAttrList->getValueByIndex( i );
     340             : 
     341         818 :         switch( aTokenMap.Get( nPrefix, aLocalName ) )
     342             :         {
     343             :         case XML_TOK_TEXT_LEVEL_ATTR_LEVEL:
     344         350 :             nLevel = rValue.toInt32();
     345         350 :             if( nLevel >= 1L )
     346         350 :                 nLevel--;
     347             :             else
     348           0 :                 nLevel = 0;
     349         350 :             break;
     350             :         case XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME:
     351          20 :             sTextStyleName = rValue;
     352          20 :             break;
     353             :         case XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR:
     354         110 :             cBullet = rValue[0];
     355         110 :             break;
     356             :         case XML_TOK_TEXT_LEVEL_ATTR_HREF:
     357           0 :             if( bImage )
     358           0 :                 sImageURL = rValue;
     359           0 :             break;
     360             :         case XML_TOK_TEXT_LEVEL_ATTR_TYPE:
     361             :         case XML_TOK_TEXT_LEVEL_ATTR_SHOW:
     362             :         case XML_TOK_TEXT_LEVEL_ATTR_ACTUATE:
     363             :             // This properties will be ignored
     364           0 :             break;
     365             :         case XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT:
     366         240 :             if( bNum )
     367         240 :                 sNumFormat = rValue;
     368         240 :             break;
     369             :         case XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX:
     370           5 :             sPrefix = rValue;
     371           5 :             break;
     372             :         case XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX:
     373          61 :             sSuffix = rValue;
     374          61 :             break;
     375             :         case XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC:
     376           0 :             if( bNum )
     377           0 :                 sNumLetterSync = rValue;
     378           0 :             break;
     379             :         case XML_TOK_TEXT_LEVEL_ATTR_START_VALUE:
     380           0 :             if( bNum )
     381             :             {
     382           0 :                 sal_Int32 nTmp = rValue.toInt32();
     383             :                 nNumStartValue =
     384             :                     (nTmp < 0L) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
     385           0 :                                                         : (sal_Int16)nTmp );
     386             :             }
     387           0 :             break;
     388             :         case XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS:
     389          32 :             if( bNum )
     390             :             {
     391          32 :                 sal_Int32 nTmp = rValue.toInt32();
     392             :                 nNumDisplayLevels =
     393             :                     (nTmp < 1L) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
     394          32 :                                                         : (sal_Int16)nTmp );
     395             :             }
     396          32 :             break;
     397             :         }
     398        1168 :     }
     399         350 : }
     400             : 
     401         700 : SvxXMLListLevelStyleContext_Impl::~SvxXMLListLevelStyleContext_Impl()
     402             : {
     403         700 : }
     404             : 
     405         460 : SvXMLImportContext *SvxXMLListLevelStyleContext_Impl::CreateChildContext(
     406             :         sal_uInt16 nPrefix, const OUString& rLocalName,
     407             :         const Reference< xml::sax::XAttributeList > & xAttrList )
     408             : {
     409         460 :     SvXMLImportContext *pContext = 0;
     410        1030 :     if( XML_NAMESPACE_STYLE == nPrefix &&
     411         460 :         ( IsXMLToken( rLocalName, XML_LIST_LEVEL_PROPERTIES ) ||
     412         110 :              IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) )
     413             :     {
     414         460 :         pContext = new SvxXMLListLevelStyleAttrContext_Impl( GetImport(),
     415             :                                                              nPrefix,
     416             :                                                              rLocalName,
     417             :                                                                xAttrList,
     418         460 :                                                              *this );
     419             :     }
     420           0 :     else if( (XML_NAMESPACE_OFFICE == nPrefix) && xmloff::token::IsXMLToken( rLocalName,
     421           0 :                                         xmloff::token::XML_BINARY_DATA ) )
     422             :     {
     423           0 :         if( bImage && sImageURL.isEmpty() && !xBase64Stream.is() )
     424             :         {
     425           0 :             xBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
     426           0 :             if( xBase64Stream.is() )
     427           0 :                 pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
     428             :                                                     rLocalName, xAttrList,
     429           0 :                                                     xBase64Stream );
     430             :         }
     431             :     }
     432         460 :     if( !pContext )
     433             :     {
     434           0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
     435             :     }
     436             : 
     437         460 :     return pContext;
     438             : }
     439             : 
     440         320 : Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties(
     441             :         const SvI18NMap *pI18NMap )
     442             : {
     443             :     sal_Int16 eType;
     444             : 
     445         320 :     sal_Int32 nCount = 0;
     446         320 :     if( bBullet )
     447             :     {
     448          80 :         eType = NumberingType::CHAR_SPECIAL;
     449          80 :         nCount = cBullet ? 15 : 14;
     450             :     }
     451         320 :     if( bImage )
     452             :     {
     453           0 :         eType = NumberingType::BITMAP;
     454           0 :         nCount = 15;
     455             : 
     456           0 :         if( !sImageURL.isEmpty() || xBase64Stream.is() )
     457           0 :             nCount++;
     458             :     }
     459         320 :     if( bNum )
     460             :     {
     461         240 :         eType = NumberingType::ARABIC;
     462         240 :         GetImport().GetMM100UnitConverter().convertNumFormat(
     463         480 :                 eType, sNumFormat, sNumLetterSync, sal_True );
     464         240 :         nCount = 15;
     465             :     }
     466             : 
     467         320 :     if( ( bBullet || bNum ) && nRelSize )
     468          70 :         nCount++;
     469             : 
     470         320 :     if( !bImage && bHasColor )
     471             :     {
     472          70 :         nCount++;
     473             :     }
     474             : 
     475         320 :     if (bBullet && !sSuffix.isEmpty())
     476             :     {
     477           0 :         sal_uInt16 const nVersion(GetImport().getGeneratorVersion());
     478             :         sal_Int32 nUPD;
     479             :         sal_Int32 nBuildId;
     480           0 :         if (GetImport().getBuildIds(nUPD, nBuildId)
     481             :             && (   (SvXMLImport::OOo_1x == nVersion)
     482             :                 || (SvXMLImport::OOo_2x == nVersion)
     483             :                 || (310 == nUPD) || (320 == nUPD) || (330 == nUPD)
     484             :                 || ((300 == nUPD) && (nBuildId <= 9573))))
     485             :         {
     486             :             // #i93908# OOo < 3.4 wrote a bogus suffix for bullet chars
     487           0 :             sSuffix = OUString(); // clear it
     488             :         }
     489             :     }
     490             : 
     491         320 :     Sequence<beans::PropertyValue> aPropSeq( nCount );
     492         320 :     if( nCount > 0 )
     493             :     {
     494         320 :         beans::PropertyValue *pProps = aPropSeq.getArray();
     495         320 :         sal_Int32 nPos = 0;
     496         320 :         pProps[nPos].Name =
     497         640 :                 OUString(XML_UNO_NAME_NRULE_NUMBERINGTYPE );
     498         320 :         pProps[nPos++].Value <<= (sal_Int16)eType ;
     499             : 
     500         320 :         pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_PREFIX );
     501         320 :         pProps[nPos++].Value <<= sPrefix;
     502             : 
     503         320 :         pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_SUFFIX );
     504         320 :         pProps[nPos++].Value <<= sSuffix;
     505             : 
     506         320 :         pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_ADJUST );
     507         320 :         pProps[nPos++].Value <<= eAdjust;
     508             : 
     509         320 :         sal_Int32 nLeftMargin = nSpaceBefore + nMinLabelWidth;
     510         320 :         pProps[nPos].Name =
     511         640 :             OUString(XML_UNO_NAME_NRULE_LEFT_MARGIN );
     512         320 :         pProps[nPos++].Value <<= (sal_Int32)nLeftMargin;
     513             : 
     514         320 :         sal_Int32 nFirstLineOffset = -nMinLabelWidth;
     515             : 
     516         320 :         pProps[nPos].Name =
     517         640 :                 OUString(XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET );
     518         320 :         pProps[nPos++].Value <<= (sal_Int32)nFirstLineOffset;
     519             : 
     520         320 :         pProps[nPos].Name =
     521         640 :             OUString(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE);
     522         320 :         pProps[nPos++].Value <<= (sal_Int16)nMinLabelDist;
     523             : 
     524         320 :         pProps[nPos].Name =
     525         640 :             OUString(XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE);
     526         320 :         pProps[nPos++].Value <<= (sal_Int16)ePosAndSpaceMode;
     527         320 :         pProps[nPos].Name =
     528         640 :             OUString(XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY);
     529         320 :         pProps[nPos++].Value <<= (sal_Int16)eLabelFollowedBy;
     530         320 :         pProps[nPos].Name =
     531         640 :             OUString(XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION);
     532         320 :         pProps[nPos++].Value <<= (sal_Int32)nListtabStopPosition;
     533         320 :         pProps[nPos].Name =
     534         640 :             OUString(XML_UNO_NAME_NRULE_FIRST_LINE_INDENT);
     535         320 :         pProps[nPos++].Value <<= (sal_Int32)nFirstLineIndent;
     536         320 :         pProps[nPos].Name =
     537         640 :             OUString(XML_UNO_NAME_NRULE_INDENT_AT);
     538         320 :         pProps[nPos++].Value <<= (sal_Int32)nIndentAt;
     539             : 
     540         320 :         OUString sDisplayTextStyleName = GetImport().GetStyleDisplayName(
     541         640 :                                 XML_STYLE_FAMILY_TEXT_TEXT, sTextStyleName  );
     542         320 :         OUString sStyleName = sDisplayTextStyleName;
     543         320 :         if( !sStyleName.isEmpty() && pI18NMap )
     544           0 :             sStyleName = pI18NMap->Get( SFX_STYLE_FAMILY_CHAR, sStyleName );
     545         320 :         pProps[nPos].Name =
     546         640 :                 OUString(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME );
     547         320 :         pProps[nPos++].Value <<= sDisplayTextStyleName;
     548             : 
     549         320 :         if( bBullet )
     550             :         {
     551          80 :             awt::FontDescriptor aFDesc;
     552          80 :             aFDesc.Name = sBulletFontName;
     553          80 :             if( !sBulletFontName.isEmpty() )
     554             :             {
     555          80 :                 aFDesc.StyleName = sBulletFontStyleName;
     556          80 :                 aFDesc.Family = eBulletFontFamily;
     557          80 :                 aFDesc.Pitch = eBulletFontPitch;
     558          80 :                 aFDesc.CharSet = eBulletFontEncoding;
     559          80 :                 aFDesc.Weight = WEIGHT_DONTKNOW;
     560          80 :                 sal_Bool bStarSymbol = sal_False;
     561          80 :                 if( aFDesc.Name.equalsIgnoreAsciiCase( sStarBats ) )
     562             :                 {
     563           0 :                     cBullet = GetImport().ConvStarBatsCharToStarSymbol( cBullet );
     564           0 :                     bStarSymbol = sal_True;
     565             :                 }
     566          80 :                 else if( aFDesc.Name.equalsIgnoreAsciiCase( sStarMath ) )
     567             :                 {
     568           0 :                     cBullet = GetImport().ConvStarMathCharToStarSymbol( cBullet );
     569           0 :                     bStarSymbol = sal_True;
     570             :                 }
     571          80 :                 if( bStarSymbol )
     572           0 :                     aFDesc.Name = OUString( "StarSymbol"  );
     573             :             }
     574             : 
     575          80 :             if( cBullet )
     576             :             {
     577          80 :                 OUStringBuffer sTmp(1);
     578          80 :                 sTmp.append( cBullet );
     579          80 :                 pProps[nPos].Name =
     580         160 :                         OUString(XML_UNO_NAME_NRULE_BULLET_CHAR );
     581          80 :                 pProps[nPos++].Value <<= sTmp.makeStringAndClear();
     582             :             }
     583             : 
     584          80 :             pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_BULLET_FONT );
     585          80 :             pProps[nPos++].Value <<= aFDesc;
     586             : 
     587             :         }
     588             : 
     589         320 :         if( bImage )
     590             :         {
     591           0 :             OUString sStr( sImageURL );
     592           0 :             if( !sImageURL.isEmpty() )
     593             :             {
     594           0 :                 sStr = GetImport().ResolveGraphicObjectURL( sImageURL,
     595           0 :                                                                  sal_False );
     596             :             }
     597           0 :             else if( xBase64Stream.is() )
     598             :             {
     599           0 :                 sStr = GetImport().ResolveGraphicObjectURLFromBase64( xBase64Stream );
     600             :             }
     601             : 
     602           0 :             if( !sStr.isEmpty() )
     603             :             {
     604           0 :                 pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_GRAPHICURL );
     605           0 :                 pProps[nPos++].Value <<= sStr;
     606             :             }
     607             : 
     608           0 :             awt::Size aSize( nImageWidth, nImageHeight );
     609           0 :             pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_GRAPHIC_SIZE );
     610           0 :             pProps[nPos++].Value <<= aSize;
     611             : 
     612           0 :             pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_VERT_ORIENT );
     613           0 :             pProps[nPos++].Value <<= (sal_Int16)eImageVertOrient;
     614             :         }
     615             : 
     616         320 :         if( bNum )
     617             :         {
     618         240 :             pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_START_WITH );
     619         240 :             pProps[nPos++].Value <<= (sal_Int16)nNumStartValue;
     620             : 
     621         240 :             pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_PARENT_NUMBERING);
     622         240 :             pProps[nPos++].Value <<= (sal_Int16)nNumDisplayLevels;
     623             :         }
     624             : 
     625         320 :         if( ( bNum || bBullet ) && nRelSize )
     626             :         {
     627          70 :             pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_BULLET_RELSIZE );
     628          70 :             pProps[nPos++].Value <<= nRelSize;
     629             :         }
     630             : 
     631         320 :         if( !bImage && bHasColor )
     632             :         {
     633          70 :             pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_BULLET_COLOR );
     634          70 :             pProps[nPos++].Value <<= m_nColor;
     635             :         }
     636             : 
     637         320 :         DBG_ASSERT( nPos == nCount, "array under/overflow" );
     638             :     }
     639             : 
     640         320 :     return aPropSeq;
     641             : }
     642             : 
     643             : // ---------------------------------------------------------------------
     644             : 
     645             : enum SvxXMLStyleAttributesAttrTokens
     646             : {
     647             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE,
     648             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH,
     649             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST,
     650             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN,
     651             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME,
     652             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY,
     653             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC,
     654             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME,
     655             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH,
     656             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET,
     657             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS,
     658             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL,
     659             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH,
     660             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT,
     661             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR,
     662             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR,
     663             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE,
     664             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE,
     665             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_END=XML_TOK_UNKNOWN
     666             : };
     667         460 : static const SvXMLTokenMapEntry* lcl_getStyleAttributesAttrTokenMap()
     668             : {
     669             :     static SvXMLTokenMapEntry aStyleAttributesAttrTokenMap[] =
     670             :     {
     671             :         { XML_NAMESPACE_TEXT, XML_SPACE_BEFORE,
     672             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE },
     673             :         { XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH,
     674             :                   XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH },
     675             :         { XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE,
     676             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST },
     677             :         { XML_NAMESPACE_FO, XML_TEXT_ALIGN,
     678             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN },
     679             :         { XML_NAMESPACE_STYLE, XML_FONT_NAME,
     680             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME },
     681             :         { XML_NAMESPACE_FO, XML_FONT_FAMILY,
     682             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY },
     683             :         { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC,
     684             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC },
     685             :         { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME,
     686             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME },
     687             :         { XML_NAMESPACE_STYLE, XML_FONT_PITCH,
     688             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH },
     689             :         { XML_NAMESPACE_STYLE, XML_FONT_CHARSET,
     690             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET },
     691             :         { XML_NAMESPACE_STYLE, XML_VERTICAL_POS,
     692             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS },
     693             :         { XML_NAMESPACE_STYLE, XML_VERTICAL_REL,
     694             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL },
     695             :         { XML_NAMESPACE_FO, XML_WIDTH,
     696             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH },
     697             :         { XML_NAMESPACE_FO, XML_HEIGHT,
     698             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT },
     699             :         { XML_NAMESPACE_FO, XML_COLOR,
     700             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR },
     701             :         { XML_NAMESPACE_STYLE, XML_USE_WINDOW_FONT_COLOR,
     702             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR },
     703             :         { XML_NAMESPACE_FO, XML_FONT_SIZE,
     704             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE },
     705             :         { XML_NAMESPACE_TEXT, XML_LIST_LEVEL_POSITION_AND_SPACE_MODE,
     706             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE },
     707             :         XML_TOKEN_MAP_END
     708             :     };
     709         460 :     return aStyleAttributesAttrTokenMap;
     710             : }
     711         460 : SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
     712             :         SvXMLImport& rImport, sal_uInt16 nPrfx,
     713             :         const OUString& rLName,
     714             :         const Reference< xml::sax::XAttributeList > & xAttrList,
     715             :         SvxXMLListLevelStyleContext_Impl& rLLevel ) :
     716             :     SvXMLImportContext( rImport, nPrfx, rLName ),
     717         460 :     rListLevel( rLLevel )
     718             : {
     719         460 :     SvXMLTokenMap aTokenMap( lcl_getStyleAttributesAttrTokenMap() );
     720         460 :     SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
     721             : 
     722         460 :     OUString sFontName, sFontFamily, sFontStyleName, sFontFamilyGeneric,
     723         460 :              sFontPitch, sFontCharset;
     724         460 :     OUString sVerticalPos, sVerticalRel;
     725             : 
     726         460 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
     727        1249 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
     728             :     {
     729         789 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
     730         789 :         OUString aLocalName;
     731             :         sal_uInt16 nPrefix =
     732         789 :             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
     733         789 :                                                             &aLocalName );
     734         789 :         const OUString& rValue = xAttrList->getValueByIndex( i );
     735             : 
     736             :         sal_Int32 nVal;
     737         789 :         switch( aTokenMap.Get( nPrefix, aLocalName ) )
     738             :         {
     739             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE:
     740          93 :             if (rUnitConv.convertMeasureToCore(nVal, rValue, SHRT_MIN, SHRT_MAX))
     741          93 :                 rListLevel.SetSpaceBefore( nVal );
     742          93 :             break;
     743             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH:
     744          93 :             if (rUnitConv.convertMeasureToCore( nVal, rValue, 0, SHRT_MAX ))
     745          93 :                 rListLevel.SetMinLabelWidth( nVal );
     746          93 :             break;
     747             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST:
     748          10 :             if (rUnitConv.convertMeasureToCore( nVal, rValue, 0, USHRT_MAX ))
     749          10 :                 rListLevel.SetMinLabelDist( nVal );
     750          10 :             break;
     751             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN:
     752           3 :             if( !rValue.isEmpty() )
     753             :             {
     754           3 :                 sal_Int16 eAdjust = HoriOrientation::LEFT;
     755           3 :                 if( IsXMLToken( rValue, XML_CENTER ) )
     756           0 :                     eAdjust = HoriOrientation::CENTER;
     757           3 :                 else if( IsXMLToken( rValue, XML_END ) )
     758           3 :                     eAdjust = HoriOrientation::RIGHT;
     759           3 :                 rListLevel.SetAdjust( eAdjust );
     760             :             }
     761           3 :             break;
     762             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME:
     763           0 :             sFontName = rValue;
     764           0 :             break;
     765             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY:
     766         110 :             sFontFamily = rValue;
     767         110 :             break;
     768             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC:
     769           0 :             sFontFamilyGeneric = rValue;
     770           0 :             break;
     771             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME:
     772           0 :             sFontStyleName = rValue;
     773           0 :             break;
     774             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH:
     775           0 :             sFontPitch = rValue;
     776           0 :             break;
     777             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET:
     778          40 :             sFontCharset = rValue;
     779          40 :             break;
     780             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS:
     781           0 :             sVerticalPos = rValue;
     782           0 :             break;
     783             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL:
     784           0 :             sVerticalRel = rValue;
     785           0 :             break;
     786             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH:
     787           0 :             if (rUnitConv.convertMeasureToCore(nVal, rValue, 0, SAL_MAX_INT32))
     788           0 :                 rListLevel.SetImageWidth( nVal );
     789           0 :             break;
     790             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT:
     791           0 :             if (rUnitConv.convertMeasureToCore(nVal, rValue, 0, SAL_MAX_INT32))
     792           0 :                 rListLevel.SetImageHeight( nVal );
     793           0 :             break;
     794             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR:
     795             :             {
     796          40 :                 sal_Int32 nColor(0);
     797          40 :                 if (::sax::Converter::convertColor( nColor, rValue ))
     798             :                 {
     799          40 :                     rListLevel.SetColor( nColor );
     800             :                 }
     801             :             }
     802          40 :             break;
     803             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR:
     804             :             {
     805          60 :                 if( IsXMLToken( rValue, XML_TRUE ) )
     806          60 :                     rListLevel.SetColor( (sal_Int32)0xffffffff );
     807             :             }
     808          60 :             break;
     809             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE:
     810         100 :             if (::sax::Converter::convertPercent( nVal, rValue ))
     811         100 :                 rListLevel.SetRelSize( (sal_Int16)nVal );
     812         100 :             break;
     813             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE:
     814             :             {
     815         240 :                 sal_Int16 ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
     816         240 :                 if( IsXMLToken( rValue, XML_LABEL_ALIGNMENT ) )
     817         240 :                     ePosAndSpaceMode = PositionAndSpaceMode::LABEL_ALIGNMENT;
     818         240 :                 rListLevel.SetPosAndSpaceMode( ePosAndSpaceMode );
     819             :             }
     820         240 :             break;
     821             :         }
     822         789 :     }
     823             : 
     824         460 :     if( !sFontName.isEmpty() )
     825             :     {
     826             :         const XMLFontStylesContext *pFontDecls =
     827           0 :             GetImport().GetTextImport()->GetFontDecls();
     828           0 :         if( pFontDecls )
     829             :         {
     830           0 :             ::std::vector < XMLPropertyState > aProps;
     831           0 :             if( pFontDecls->FillProperties( sFontName, aProps, 0, 1, 2, 3, 4 ) )
     832             :             {
     833           0 :                 OUString sTmp;
     834           0 :                 sal_Int16 nTmp = 0;
     835           0 :                 ::std::vector< XMLPropertyState >::iterator i;
     836           0 :                 for( i = aProps.begin(); i != aProps.end(); ++i )
     837             :                 {
     838           0 :                     switch( i->mnIndex )
     839             :                     {
     840             :                     case 0:
     841           0 :                         i->maValue >>= sTmp;
     842           0 :                         rListLevel.SetBulletFontName( sTmp);
     843           0 :                         break;
     844             :                     case 1:
     845           0 :                         i->maValue >>= sTmp;
     846           0 :                         rListLevel.SetBulletFontStyleName( sTmp );
     847           0 :                         break;
     848             :                     case 2:
     849           0 :                         i->maValue >>= nTmp;
     850           0 :                         rListLevel.SetBulletFontFamily( nTmp );
     851           0 :                         break;
     852             :                     case 3:
     853           0 :                         i->maValue >>= nTmp;
     854           0 :                         rListLevel.SetBulletFontPitch( nTmp );
     855           0 :                         break;
     856             :                     case 4:
     857           0 :                         i->maValue >>= nTmp;
     858           0 :                         rListLevel.SetBulletFontEncoding( nTmp );
     859           0 :                         break;
     860             :                     }
     861           0 :                 }
     862           0 :             }
     863             :         }
     864             :     }
     865         460 :     if( !sFontFamily.isEmpty() )
     866             :     {
     867         110 :         Any aAny;
     868             : 
     869         110 :         XMLFontFamilyNamePropHdl aFamilyNameHdl;
     870         110 :         if( aFamilyNameHdl.importXML( sFontFamily, aAny, rUnitConv ) )
     871             :         {
     872         110 :             OUString sTmp;
     873         110 :             aAny >>= sTmp;
     874         110 :             rListLevel.SetBulletFontName( sTmp);
     875             :         }
     876             : 
     877         110 :         XMLFontFamilyPropHdl aFamilyHdl;
     878         110 :         if( !sFontFamilyGeneric.isEmpty() &&
     879           0 :             aFamilyHdl.importXML( sFontFamilyGeneric, aAny, rUnitConv  ) )
     880             :         {
     881           0 :             sal_Int16 nTmp = 0;
     882           0 :             aAny >>= nTmp;
     883           0 :             rListLevel.SetBulletFontFamily( nTmp );
     884             :         }
     885             : 
     886         110 :         if( !sFontStyleName.isEmpty() )
     887           0 :             rListLevel.SetBulletFontStyleName( sFontStyleName );
     888             : 
     889         110 :         XMLFontPitchPropHdl aPitchHdl;
     890         110 :         if( !sFontPitch.isEmpty() &&
     891           0 :             aPitchHdl.importXML( sFontPitch, aAny, rUnitConv  ) )
     892             :         {
     893           0 :             sal_Int16 nTmp = 0;
     894           0 :             aAny >>= nTmp;
     895           0 :             rListLevel.SetBulletFontPitch( nTmp );
     896             :         }
     897             : 
     898         110 :         XMLFontEncodingPropHdl aEncHdl;
     899         150 :         if( !sFontCharset.isEmpty() &&
     900          40 :             aEncHdl.importXML( sFontCharset, aAny, rUnitConv  ) )
     901             :         {
     902          40 :             sal_Int16 nTmp = 0;
     903          40 :             aAny >>= nTmp;
     904          40 :             rListLevel.SetBulletFontEncoding( nTmp );
     905         110 :         }
     906             :     }
     907             : 
     908         460 :     sal_Int16 eVertOrient = VertOrientation::LINE_CENTER;
     909         460 :     if( !sVerticalPos.isEmpty() )
     910             :     {
     911           0 :         if( IsXMLToken( sVerticalPos, XML_TOP ) )
     912           0 :             eVertOrient = VertOrientation::LINE_TOP;
     913           0 :         else if( IsXMLToken( sVerticalPos, XML_BOTTOM ) )
     914           0 :             eVertOrient = VertOrientation::LINE_BOTTOM;
     915             :     }
     916         460 :     if( !sVerticalRel.isEmpty() )
     917             :     {
     918           0 :         if( IsXMLToken( sVerticalRel, XML_BASELINE ) )
     919             :         {
     920             :             // TOP and BOTTOM are exchanged for a baseline relation
     921           0 :             switch( eVertOrient  )
     922             :             {
     923             :             case VertOrientation::LINE_TOP:
     924           0 :                 eVertOrient = VertOrientation::BOTTOM;
     925           0 :                 break;
     926             :             case VertOrientation::LINE_CENTER:
     927           0 :                 eVertOrient = VertOrientation::CENTER;
     928           0 :                 break;
     929             :             case VertOrientation::LINE_BOTTOM:
     930           0 :                 eVertOrient = VertOrientation::TOP;
     931           0 :                 break;
     932             :             }
     933             :         }
     934           0 :         else if( IsXMLToken( sVerticalRel, XML_CHAR ) )
     935             :         {
     936           0 :             switch( eVertOrient  )
     937             :             {
     938             :             case VertOrientation::LINE_TOP:
     939           0 :                 eVertOrient = VertOrientation::CHAR_TOP;
     940           0 :                 break;
     941             :             case VertOrientation::LINE_CENTER:
     942           0 :                 eVertOrient = VertOrientation::CHAR_CENTER;
     943           0 :                 break;
     944             :             case VertOrientation::LINE_BOTTOM:
     945           0 :                 eVertOrient = VertOrientation::CHAR_BOTTOM;
     946           0 :                 break;
     947             :             }
     948             :         }
     949             :     }
     950         460 :     rListLevel.SetImageVertOrient( eVertOrient );
     951         460 : }
     952             : 
     953         920 : SvxXMLListLevelStyleAttrContext_Impl::~SvxXMLListLevelStyleAttrContext_Impl()
     954             : {
     955         920 : }
     956             : 
     957         240 : SvXMLImportContext* SvxXMLListLevelStyleAttrContext_Impl::CreateChildContext(
     958             :         sal_uInt16 nPrefix, const OUString& rLocalName,
     959             :         const Reference< xml::sax::XAttributeList > & xAttrList )
     960             : {
     961         240 :     SvXMLImportContext *pContext = 0;
     962         480 :     if ( XML_NAMESPACE_STYLE == nPrefix &&
     963         240 :          IsXMLToken( rLocalName, XML_LIST_LEVEL_LABEL_ALIGNMENT ) )
     964             :     {
     965         240 :         pContext = new SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl( GetImport(),
     966             :                                                              nPrefix,
     967             :                                                              rLocalName,
     968             :                                                              xAttrList,
     969         240 :                                                              rListLevel );
     970             :     }
     971         240 :     if( !pContext )
     972             :     {
     973           0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
     974             :     }
     975             : 
     976         240 :     return pContext;
     977             : }
     978             : 
     979             : // ---------------------------------------------------------------------
     980             : 
     981             : enum SvxXMLStyleAttributesLabelAlignmentAttrTokens
     982             : {
     983             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY,
     984             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION,
     985             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT,
     986             :     XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT,
     987             : 
     988             :     XML_TOK_STYLE_ATTRIBUTES_LABEL_ALIGNMENT_ATTR_END=XML_TOK_UNKNOWN
     989             : };
     990         240 : static const SvXMLTokenMapEntry* lcl_getStyleAlignmentAttributesAttrTokenMap()
     991             : {
     992             :     static SvXMLTokenMapEntry aStyleAlignmentAttributesAttrTokenMap[] =
     993             :     {
     994             :         { XML_NAMESPACE_TEXT, XML_LABEL_FOLLOWED_BY,
     995             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY },
     996             :         { XML_NAMESPACE_TEXT, XML_LIST_TAB_STOP_POSITION,
     997             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION },
     998             :         { XML_NAMESPACE_FO, XML_TEXT_INDENT,
     999             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT },
    1000             :         { XML_NAMESPACE_FO, XML_MARGIN_LEFT,
    1001             :                 XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT },
    1002             : 
    1003             :         XML_TOKEN_MAP_END
    1004             :     };
    1005         240 :     return aStyleAlignmentAttributesAttrTokenMap;
    1006             : }
    1007         240 : SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl(
    1008             :         SvXMLImport& rImport, sal_uInt16 nPrfx,
    1009             :         const OUString& rLName,
    1010             :         const Reference< xml::sax::XAttributeList > & xAttrList,
    1011             :         SvxXMLListLevelStyleContext_Impl& rLLevel ) :
    1012             :     SvXMLImportContext( rImport, nPrfx, rLName ),
    1013         240 :     rListLevel( rLLevel )
    1014             : {
    1015         240 :     SvXMLTokenMap aTokenMap( lcl_getStyleAlignmentAttributesAttrTokenMap() );
    1016         240 :     SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
    1017             : 
    1018         240 :     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
    1019        1136 :     for( sal_Int16 i=0; i < nAttrCount; i++ )
    1020             :     {
    1021         896 :         const OUString& rAttrName = xAttrList->getNameByIndex( i );
    1022         896 :         OUString aLocalName;
    1023             :         sal_uInt16 nPrefix =
    1024         896 :             GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
    1025         896 :                                                             &aLocalName );
    1026         896 :         const OUString& rValue = xAttrList->getValueByIndex( i );
    1027             : 
    1028             :         sal_Int32 nVal;
    1029         896 :         switch( aTokenMap.Get( nPrefix, aLocalName ) )
    1030             :         {
    1031             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY:
    1032             :             {
    1033         240 :                 sal_Int16 eLabelFollowedBy = LabelFollow::LISTTAB;
    1034         240 :                 if( IsXMLToken( rValue, XML_SPACE ) )
    1035           0 :                     eLabelFollowedBy = LabelFollow::SPACE;
    1036         240 :                 else if( IsXMLToken( rValue, XML_NOTHING ) )
    1037           0 :                     eLabelFollowedBy = LabelFollow::NOTHING;
    1038         240 :                 rListLevel.SetLabelFollowedBy( eLabelFollowedBy );
    1039             :             }
    1040         240 :             break;
    1041             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION:
    1042         186 :             if (rUnitConv.convertMeasureToCore(nVal, rValue, 0, SHRT_MAX))
    1043         186 :                 rListLevel.SetListtabStopPosition( nVal );
    1044         186 :             break;
    1045             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT:
    1046         231 :             if (rUnitConv.convertMeasureToCore(nVal, rValue, SHRT_MIN, SHRT_MAX))
    1047         231 :                 rListLevel.SetFirstLineIndent( nVal );
    1048         231 :             break;
    1049             :         case XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT:
    1050         239 :             if (rUnitConv.convertMeasureToCore(nVal, rValue, SHRT_MIN, SHRT_MAX))
    1051         239 :                 rListLevel.SetIndentAt( nVal );
    1052         239 :             break;
    1053             :         }
    1054        1136 :     }
    1055         240 : }
    1056             : 
    1057         480 : SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::~SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl()
    1058             : {
    1059         480 : }
    1060             : 
    1061             : // ---------------------------------------------------------------------
    1062             : 
    1063          70 : class SvxXMLListStyle_Impl : public std::vector<SvxXMLListLevelStyleContext_Impl *> {};
    1064             : 
    1065          37 : void SvxXMLListStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
    1066             :                                            const OUString& rLocalName,
    1067             :                                            const OUString& rValue )
    1068             : {
    1069          37 :     if( XML_NAMESPACE_TEXT == nPrefixKey &&
    1070           0 :         IsXMLToken( rLocalName, XML_CONSECUTIVE_NUMBERING ) )
    1071             :     {
    1072           0 :         bConsecutive = IsXMLToken( rValue, XML_TRUE );
    1073             :     }
    1074             :     else
    1075             :     {
    1076          37 :         SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
    1077             :     }
    1078          37 : }
    1079             : 
    1080             : 
    1081          35 : SvxXMLListStyleContext::SvxXMLListStyleContext( SvXMLImport& rImport,
    1082             :         sal_uInt16 nPrfx,
    1083             :         const OUString& rLName,
    1084             :         const Reference< xml::sax::XAttributeList > & xAttrList,
    1085             :         sal_Bool bOutl )
    1086             : :   SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, bOutl ? XML_STYLE_FAMILY_TEXT_OUTLINE : XML_STYLE_FAMILY_TEXT_LIST )
    1087             : ,   sIsPhysical( "IsPhysical"  )
    1088             : ,   sNumberingRules( "NumberingRules"  )
    1089             : ,   sName( "Name"  )
    1090             : ,   sIsContinuousNumbering( "IsContinuousNumbering"  )
    1091             : ,   pLevelStyles( 0 )
    1092             : ,   nLevels( 0 )
    1093             : ,   bConsecutive( sal_False )
    1094          35 : ,   bOutline( bOutl )
    1095             : {
    1096          35 : }
    1097             : 
    1098         105 : SvxXMLListStyleContext::~SvxXMLListStyleContext()
    1099             : {
    1100          35 :     if( pLevelStyles )
    1101             :     {
    1102         420 :         while( !pLevelStyles->empty() )
    1103             :         {
    1104         350 :             SvxXMLListLevelStyleContext_Impl *pStyle = pLevelStyles->back();
    1105         350 :             pLevelStyles->pop_back();
    1106         350 :             pStyle->ReleaseRef();
    1107             :         }
    1108             :     }
    1109             : 
    1110          35 :     delete pLevelStyles;
    1111          70 : }
    1112             : 
    1113           9 : TYPEINIT1( SvxXMLListStyleContext, SvXMLStyleContext );
    1114             : 
    1115         350 : SvXMLImportContext *SvxXMLListStyleContext::CreateChildContext(
    1116             :         sal_uInt16 nPrefix,
    1117             :         const OUString& rLocalName,
    1118             :         const Reference< xml::sax::XAttributeList > & xAttrList )
    1119             : {
    1120         350 :     SvXMLImportContext *pContext = 0;
    1121             : 
    1122         870 :     if( XML_NAMESPACE_TEXT == nPrefix &&
    1123             :         ( bOutline
    1124         170 :               ? IsXMLToken( rLocalName, XML_OUTLINE_LEVEL_STYLE )
    1125         180 :               : ( IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_NUMBER ) ||
    1126         110 :                 IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_BULLET ) ||
    1127         290 :                  IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_IMAGE )    ) ) )
    1128             :     {
    1129             :         SvxXMLListLevelStyleContext_Impl *pLevelStyle =
    1130         350 :             new SvxXMLListLevelStyleContext_Impl( GetImport(), nPrefix,
    1131         350 :                                                   rLocalName, xAttrList );
    1132         350 :         if( !pLevelStyles )
    1133          35 :             pLevelStyles = new SvxXMLListStyle_Impl;
    1134         350 :         pLevelStyles->push_back( pLevelStyle );
    1135         350 :         pLevelStyle->AddRef();
    1136             : 
    1137         350 :         pContext = pLevelStyle;
    1138             :     }
    1139             :     else
    1140             :     {
    1141           0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
    1142             :     }
    1143             : 
    1144         350 :     return pContext;
    1145             : }
    1146             : 
    1147          32 : void SvxXMLListStyleContext::FillUnoNumRule(
    1148             :         const Reference< container::XIndexReplace > & rNumRule,
    1149             :         const SvI18NMap *pI18NMap ) const
    1150             : {
    1151             :     try
    1152             :     {
    1153          32 :         if( pLevelStyles && rNumRule.is() )
    1154             :         {
    1155          32 :             sal_uInt16 nCount = pLevelStyles->size();
    1156          32 :             sal_Int32 l_nLevels = rNumRule->getCount();
    1157         352 :             for( sal_uInt16 i=0; i < nCount; i++ )
    1158             :             {
    1159             :                 SvxXMLListLevelStyleContext_Impl *pLevelStyle =
    1160         320 :                     (*pLevelStyles)[i];
    1161         320 :                 sal_Int32 nLevel = pLevelStyle->GetLevel();
    1162         320 :                 if( nLevel >= 0 && nLevel < l_nLevels )
    1163             :                 {
    1164             :                     Sequence<beans::PropertyValue> aProps =
    1165         320 :                         pLevelStyle->GetProperties( pI18NMap );
    1166         320 :                     Any aAny;
    1167         320 :                     aAny <<= aProps;
    1168         320 :                     rNumRule->replaceByIndex( nLevel, aAny );
    1169             :                 }
    1170             :             }
    1171             :         }
    1172             : 
    1173          32 :         Reference < XPropertySet > xPropSet( rNumRule, UNO_QUERY );
    1174          32 :         Reference< XPropertySetInfo > xPropSetInfo;
    1175          32 :         if (xPropSet.is())
    1176          25 :             xPropSetInfo = xPropSet->getPropertySetInfo();
    1177          57 :         if( xPropSetInfo.is() &&
    1178          25 :             xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) )
    1179             :         {
    1180          25 :             Any aAny;
    1181          25 :             sal_Bool bTmp = bConsecutive;
    1182          25 :             aAny.setValue( &bTmp, ::getBooleanCppuType() );
    1183          25 :             xPropSet->setPropertyValue( sIsContinuousNumbering, aAny );
    1184          32 :         }
    1185             :     }
    1186           0 :     catch (const Exception&)
    1187             :     {
    1188             :         OSL_FAIL( "SvxXMLListStyleContext::FillUnoNumRule - Exception caught" );
    1189             :     }
    1190          32 : }
    1191             : 
    1192          25 : void SvxXMLListStyleContext::CreateAndInsertLate( sal_Bool bOverwrite )
    1193             : {
    1194          25 :     if( bOutline )
    1195             :     {
    1196          17 :         if( bOverwrite )
    1197             :         {
    1198             :             const Reference< XIndexReplace >& rNumRule =
    1199          17 :                 GetImport().GetTextImport()->GetChapterNumbering();
    1200             :             // We don't set xNumberingRules here, to avoid using them
    1201             :             // as numbering rules.
    1202          17 :             if( rNumRule.is() )
    1203          17 :                 FillUnoNumRule( rNumRule, 0 );
    1204             :         }
    1205             :     }
    1206             :     else
    1207             :     {
    1208           8 :         Reference < XStyle > xStyle;
    1209           8 :         const OUString& rName = GetDisplayName();
    1210           8 :         if( rName.isEmpty() )
    1211             :         {
    1212           0 :             SetValid( sal_False );
    1213             :             return;
    1214             :         }
    1215             : 
    1216             :         const Reference < XNameContainer >& rNumStyles =
    1217           8 :                 GetImport().GetTextImport()->GetNumberingStyles();
    1218           8 :         if( !rNumStyles.is() )
    1219             :         {
    1220           0 :             SetValid( sal_False );
    1221             :             return;
    1222             :         }
    1223             : 
    1224           8 :         sal_Bool bNew = sal_False;
    1225           8 :         if( rNumStyles->hasByName( rName ) )
    1226             :         {
    1227           2 :             Any aAny = rNumStyles->getByName( rName );
    1228           2 :             aAny >>= xStyle;
    1229             :         }
    1230             :         else
    1231             :         {
    1232           6 :             Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
    1233           6 :                                                         UNO_QUERY );
    1234             :             DBG_ASSERT( xFactory.is(), "no factory" );
    1235           6 :             if( !xFactory.is() )
    1236             :                 return;
    1237             : 
    1238           6 :             Reference < XInterface > xIfc = xFactory->createInstance(OUString("com.sun.star.style.NumberingStyle") );
    1239           6 :             if( !xIfc.is() )
    1240             :                 return;
    1241           6 :             Reference < XStyle > xTmp( xIfc, UNO_QUERY );
    1242           6 :             xStyle = xTmp;
    1243           6 :             if( !xStyle.is() )
    1244             :                 return;
    1245             : 
    1246           6 :             Any aAny;
    1247           6 :             aAny <<= xStyle;
    1248           6 :             rNumStyles->insertByName( rName, aAny );
    1249           6 :             bNew = sal_True;
    1250             :         }
    1251             : 
    1252           8 :         Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
    1253             :         Reference< XPropertySetInfo > xPropSetInfo =
    1254           8 :             xPropSet->getPropertySetInfo();
    1255           8 :         if( !bNew && xPropSetInfo->hasPropertyByName( sIsPhysical ) )
    1256             :         {
    1257           2 :             Any aAny = xPropSet->getPropertyValue( sIsPhysical );
    1258           2 :             bNew = !*(sal_Bool *)aAny.getValue();
    1259             :         }
    1260             : 
    1261           8 :         if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
    1262           8 :             xPropSet->setPropertyValue( "Hidden", uno::makeAny( IsHidden( ) ) );
    1263             : 
    1264           8 :         if( rName != GetName() )
    1265           2 :             GetImport().AddStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
    1266           4 :                                              GetName(), rName );
    1267             : 
    1268           8 :         Any aAny = xPropSet->getPropertyValue( sNumberingRules );
    1269           8 :         aAny >>= xNumRules;
    1270           8 :         nLevels = xNumRules->getCount();
    1271           8 :         if( bOverwrite || bNew )
    1272             :         {
    1273           8 :             FillUnoNumRule( xNumRules, 0 );
    1274           8 :             aAny <<= xNumRules;
    1275           8 :             xPropSet->setPropertyValue( sNumberingRules, aAny );
    1276             :         }
    1277             :         else
    1278             :         {
    1279           0 :             SetValid( sal_False );
    1280             :         }
    1281             : 
    1282           8 :         SetNew( bNew );
    1283             :     }
    1284             : }
    1285             : 
    1286           0 : void SvxXMLListStyleContext::CreateAndInsertAuto() const
    1287             : {
    1288             :     DBG_ASSERT( !bOutline, "Outlines cannot be inserted here" );
    1289             :     DBG_ASSERT( !xNumRules.is(), "Numbering Rule is existing already" );
    1290             : 
    1291           0 :     const OUString& rName = GetName();
    1292           0 :     if( bOutline || xNumRules.is() || rName.isEmpty() )
    1293             :     {
    1294           0 :         ((SvxXMLListStyleContext *)this)->SetValid( sal_False );
    1295           0 :         return;
    1296             :     }
    1297             : 
    1298             :     ((SvxXMLListStyleContext *)this)->xNumRules = CreateNumRule(
    1299           0 :         GetImport().GetModel() );
    1300           0 :     ((SvxXMLListStyleContext *)this)->nLevels = xNumRules->getCount();
    1301             : 
    1302           0 :     FillUnoNumRule( xNumRules, 0 );
    1303             : }
    1304             : 
    1305           7 : Reference < XIndexReplace > SvxXMLListStyleContext::CreateNumRule(
    1306             :                                 const Reference < XModel > & rModel )
    1307             : {
    1308           7 :     Reference<XIndexReplace> xNumRule;
    1309             : 
    1310           7 :     Reference< XMultiServiceFactory > xFactory( rModel, UNO_QUERY );
    1311             :     DBG_ASSERT( xFactory.is(), "no factory" );
    1312           7 :     if( !xFactory.is() )
    1313             :         return xNumRule;
    1314             : 
    1315           7 :     Reference < XInterface > xIfc = xFactory->createInstance(OUString("com.sun.star.text.NumberingRules") );
    1316           7 :     if( !xIfc.is() )
    1317             :         return xNumRule;
    1318             : 
    1319           7 :     xNumRule = Reference<XIndexReplace>( xIfc, UNO_QUERY );
    1320             :     DBG_ASSERT( xNumRule.is(), "go no numbering rule" );
    1321             : 
    1322           7 :     return xNumRule;
    1323             : }
    1324             : 
    1325           0 : void SvxXMLListStyleContext::SetDefaultStyle(
    1326             :         const Reference < XIndexReplace > & rNumRule,
    1327             :         sal_Int16 nLevel,
    1328             :         sal_Bool bOrdered )
    1329             : {
    1330           0 :     Sequence<beans::PropertyValue> aPropSeq( bOrdered ? 1 : 4  );
    1331           0 :     beans::PropertyValue *pProps = aPropSeq.getArray();
    1332             : 
    1333             :     pProps->Name =
    1334           0 :                 OUString(XML_UNO_NAME_NRULE_NUMBERINGTYPE );
    1335             :     (pProps++)->Value <<= (sal_Int16)(bOrdered ? NumberingType::ARABIC
    1336           0 :                                                  : NumberingType::CHAR_SPECIAL );
    1337           0 :     if( !bOrdered )
    1338             :     {
    1339             :         // TODO: Bullet-Font
    1340           0 :         awt::FontDescriptor aFDesc;
    1341             :         aFDesc.Name = OUString(
    1342             : #if defined UNX
    1343             :                         "starbats"
    1344             : #else
    1345             :                         "StarBats"
    1346             : #endif
    1347           0 :                                         );
    1348           0 :         aFDesc.Family = FAMILY_DONTKNOW ;
    1349           0 :         aFDesc.Pitch = PITCH_DONTKNOW ;
    1350           0 :         aFDesc.CharSet = RTL_TEXTENCODING_SYMBOL ;
    1351           0 :         aFDesc.Weight = WEIGHT_DONTKNOW;
    1352             :         pProps->Name =
    1353           0 :                     OUString(XML_UNO_NAME_NRULE_BULLET_FONT );
    1354           0 :         (pProps++)->Value <<= aFDesc;
    1355             : 
    1356           0 :         OUStringBuffer sTmp(1);
    1357           0 :         sTmp.append( (sal_Unicode)(0xF000 + 149) );
    1358             :         pProps->Name =
    1359           0 :                     OUString(XML_UNO_NAME_NRULE_BULLET_CHAR );
    1360           0 :         (pProps++)->Value <<= sTmp.makeStringAndClear();
    1361             :         pProps->Name =
    1362           0 :                 OUString(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME );
    1363           0 :         (pProps++)->Value <<= OUString( "Numbering Symbols"  );
    1364             :     }
    1365             : 
    1366           0 :     Any aAny;
    1367           0 :     aAny <<= aPropSeq;
    1368           0 :     rNumRule->replaceByIndex( nLevel, aAny );
    1369           0 : }
    1370             : 
    1371             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10