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