1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_editeng.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <editeng/numitem.hxx> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/text/VertOrientation.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/text/RelOrientation.hpp> 36*cdf0e10cSrcweir #include <editeng/brshitem.hxx> 37*cdf0e10cSrcweir #include <vcl/font.hxx> 38*cdf0e10cSrcweir #include <editeng/editids.hrc> 39*cdf0e10cSrcweir #include <editeng/editrids.hrc> 40*cdf0e10cSrcweir #include <editeng/numdef.hxx> 41*cdf0e10cSrcweir #include <vcl/graph.hxx> 42*cdf0e10cSrcweir #include <vcl/window.hxx> 43*cdf0e10cSrcweir #include <vcl/svapp.hxx> 44*cdf0e10cSrcweir #include <editeng/unolingu.hxx> 45*cdf0e10cSrcweir #include <com/sun/star/text/XNumberingFormatter.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/text/XDefaultNumberingProvider.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/style/NumberingType.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 50*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #include <editeng/unonrule.hxx> 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir #define MM100_TO_TWIP(MM100) ((MM100*72L+63L)/127L) 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir #define DEF_WRITER_LSPACE 500 //Standardeinrueckung 57*cdf0e10cSrcweir #define DEF_DRAW_LSPACE 800 //Standardeinrueckung 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #define NUMITEM_VERSION_01 0x01 60*cdf0e10cSrcweir #define NUMITEM_VERSION_02 0x02 61*cdf0e10cSrcweir #define NUMITEM_VERSION_03 0x03 62*cdf0e10cSrcweir #define NUMITEM_VERSION_04 0x04 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir using namespace ::com::sun::star; 65*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 66*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 67*cdf0e10cSrcweir using namespace ::com::sun::star::text; 68*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 69*cdf0e10cSrcweir using namespace ::com::sun::star::style; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir sal_Int32 SvxNumberType::nRefCount = 0; 72*cdf0e10cSrcweir com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> SvxNumberType::xFormatter = 0; 73*cdf0e10cSrcweir void lcl_getFormatter(com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& _xFormatter) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir if(!_xFormatter.is()) 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir try 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); 80*cdf0e10cSrcweir Reference < XInterface > xI = xMSF->createInstance( 81*cdf0e10cSrcweir ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); 82*cdf0e10cSrcweir Reference<XDefaultNumberingProvider> xRet(xI, UNO_QUERY); 83*cdf0e10cSrcweir DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\""); 84*cdf0e10cSrcweir _xFormatter = Reference<XNumberingFormatter> (xRet, UNO_QUERY); 85*cdf0e10cSrcweir } 86*cdf0e10cSrcweir catch(Exception& ) 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir } 90*cdf0e10cSrcweir } 91*cdf0e10cSrcweir /* -----------------------------22.02.01 14:24-------------------------------- 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 94*cdf0e10cSrcweir SvxNumberType::SvxNumberType(sal_Int16 nType) : 95*cdf0e10cSrcweir nNumType(nType), 96*cdf0e10cSrcweir bShowSymbol(sal_True) 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir nRefCount++; 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir /* -----------------------------22.02.01 14:31-------------------------------- 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 103*cdf0e10cSrcweir SvxNumberType::SvxNumberType(const SvxNumberType& rType) : 104*cdf0e10cSrcweir nNumType(rType.nNumType), 105*cdf0e10cSrcweir bShowSymbol(rType.bShowSymbol) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir nRefCount++; 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir /* -----------------------------22.02.01 14:24-------------------------------- 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 112*cdf0e10cSrcweir SvxNumberType::~SvxNumberType() 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir if(!--nRefCount) 115*cdf0e10cSrcweir xFormatter = 0; 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir /* -----------------------------22.02.01 11:09-------------------------------- 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 120*cdf0e10cSrcweir String SvxNumberType::GetNumStr( sal_uLong nNo ) const 121*cdf0e10cSrcweir { 122*cdf0e10cSrcweir LanguageType eLang = Application::GetSettings().GetLanguage(); 123*cdf0e10cSrcweir Locale aLocale = SvxCreateLocale(eLang); 124*cdf0e10cSrcweir return GetNumStr( nNo, aLocale ); 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir /* -----------------28.10.98 15:56------------------- 127*cdf0e10cSrcweir * 128*cdf0e10cSrcweir * --------------------------------------------------*/ 129*cdf0e10cSrcweir String SvxNumberType::GetNumStr( sal_uLong nNo, const Locale& rLocale ) const 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir lcl_getFormatter(xFormatter); 132*cdf0e10cSrcweir String aTmpStr; 133*cdf0e10cSrcweir if(!xFormatter.is()) 134*cdf0e10cSrcweir return aTmpStr; 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir if(bShowSymbol) 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir switch(nNumType) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir case NumberingType::CHAR_SPECIAL: 141*cdf0e10cSrcweir case NumberingType::BITMAP: 142*cdf0e10cSrcweir break; 143*cdf0e10cSrcweir default: 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir //#95525# '0' allowed for ARABIC numberings 146*cdf0e10cSrcweir if(NumberingType::ARABIC == nNumType && 0 == nNo ) 147*cdf0e10cSrcweir aTmpStr = '0'; 148*cdf0e10cSrcweir else 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir Sequence< PropertyValue > aProperties(2); 151*cdf0e10cSrcweir PropertyValue* pValues = aProperties.getArray(); 152*cdf0e10cSrcweir pValues[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingType")); 153*cdf0e10cSrcweir pValues[0].Value <<= nNumType; 154*cdf0e10cSrcweir pValues[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); 155*cdf0e10cSrcweir pValues[1].Value <<= (sal_Int32)nNo; 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir try 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir aTmpStr = xFormatter->makeNumberingString( aProperties, rLocale ); 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir catch(Exception&) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir return aTmpStr; 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir /* -----------------27.10.98 10:33------------------- 171*cdf0e10cSrcweir * 172*cdf0e10cSrcweir * --------------------------------------------------*/ 173*cdf0e10cSrcweir // --> OD 2008-01-09 #newlistlevelattrs# 174*cdf0e10cSrcweir SvxNumberFormat::SvxNumberFormat( sal_Int16 eType, 175*cdf0e10cSrcweir SvxNumPositionAndSpaceMode ePositionAndSpaceMode ) 176*cdf0e10cSrcweir // <-- 177*cdf0e10cSrcweir : SvxNumberType(eType), 178*cdf0e10cSrcweir eNumAdjust(SVX_ADJUST_LEFT), 179*cdf0e10cSrcweir nInclUpperLevels(0), 180*cdf0e10cSrcweir nStart(1), 181*cdf0e10cSrcweir cBullet(SVX_DEF_BULLET), 182*cdf0e10cSrcweir nBulletRelSize(100), 183*cdf0e10cSrcweir nBulletColor(COL_BLACK), 184*cdf0e10cSrcweir // --> OD 2008-01-09 #newlistlevelattrs# 185*cdf0e10cSrcweir mePositionAndSpaceMode( ePositionAndSpaceMode ), 186*cdf0e10cSrcweir // <-- 187*cdf0e10cSrcweir nFirstLineOffset(0), 188*cdf0e10cSrcweir nAbsLSpace(0), 189*cdf0e10cSrcweir nLSpace(0), 190*cdf0e10cSrcweir nCharTextDistance(0), 191*cdf0e10cSrcweir // --> OD 2008-01-09 #newlistlevelattrs# 192*cdf0e10cSrcweir meLabelFollowedBy( LISTTAB ), 193*cdf0e10cSrcweir mnListtabPos( 0 ), 194*cdf0e10cSrcweir mnFirstLineIndent( 0 ), 195*cdf0e10cSrcweir mnIndentAt( 0 ), 196*cdf0e10cSrcweir // <-- 197*cdf0e10cSrcweir pGraphicBrush(0), 198*cdf0e10cSrcweir eVertOrient(text::VertOrientation::NONE), 199*cdf0e10cSrcweir pBulletFont(0) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir /* -----------------27.10.98 10:56------------------- 203*cdf0e10cSrcweir * 204*cdf0e10cSrcweir * --------------------------------------------------*/ 205*cdf0e10cSrcweir SvxNumberFormat::SvxNumberFormat(const SvxNumberFormat& rFormat) : 206*cdf0e10cSrcweir SvxNumberType(rFormat), 207*cdf0e10cSrcweir // --> OD 2008-01-09 #newlistlevelattrs# 208*cdf0e10cSrcweir mePositionAndSpaceMode( rFormat.mePositionAndSpaceMode ), 209*cdf0e10cSrcweir // <-- 210*cdf0e10cSrcweir pGraphicBrush(0), 211*cdf0e10cSrcweir pBulletFont(0) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir *this = rFormat; 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir /* -----------------27.10.98 10:56------------------- 216*cdf0e10cSrcweir * 217*cdf0e10cSrcweir * --------------------------------------------------*/ 218*cdf0e10cSrcweir SvxNumberFormat::~SvxNumberFormat() 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir delete pGraphicBrush; 221*cdf0e10cSrcweir delete pBulletFont; 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir /* -----------------08.12.98 11:14------------------- 224*cdf0e10cSrcweir * 225*cdf0e10cSrcweir * --------------------------------------------------*/ 226*cdf0e10cSrcweir SvxNumberFormat::SvxNumberFormat(SvStream &rStream) 227*cdf0e10cSrcweir : mePositionAndSpaceMode( LABEL_WIDTH_AND_POSITION ), 228*cdf0e10cSrcweir meLabelFollowedBy( LISTTAB ), 229*cdf0e10cSrcweir mnListtabPos( 0 ), 230*cdf0e10cSrcweir mnFirstLineIndent( 0 ), 231*cdf0e10cSrcweir mnIndentAt( 0 ) 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir sal_uInt16 nVersion; 235*cdf0e10cSrcweir rStream >> nVersion; 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir sal_uInt16 nUSHORT; 238*cdf0e10cSrcweir rStream >> nUSHORT; 239*cdf0e10cSrcweir SetNumberingType((sal_Int16)nUSHORT); 240*cdf0e10cSrcweir rStream >> nUSHORT; 241*cdf0e10cSrcweir eNumAdjust = (SvxAdjust)nUSHORT; 242*cdf0e10cSrcweir rStream >> nUSHORT; 243*cdf0e10cSrcweir nInclUpperLevels = (sal_uInt8)nUSHORT; 244*cdf0e10cSrcweir rStream >> nUSHORT; 245*cdf0e10cSrcweir nStart = nUSHORT; 246*cdf0e10cSrcweir rStream >> nUSHORT; 247*cdf0e10cSrcweir cBullet = nUSHORT; 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir short nShort; 250*cdf0e10cSrcweir rStream >> nShort; 251*cdf0e10cSrcweir nFirstLineOffset = nShort; 252*cdf0e10cSrcweir rStream >> nShort; 253*cdf0e10cSrcweir nAbsLSpace = nShort; 254*cdf0e10cSrcweir rStream >> nShort; 255*cdf0e10cSrcweir nLSpace = nShort; 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir rStream >> nShort; 258*cdf0e10cSrcweir nCharTextDistance = nShort; 259*cdf0e10cSrcweir rtl_TextEncoding eEnc = gsl_getSystemTextEncoding(); 260*cdf0e10cSrcweir rStream.ReadByteString(sPrefix, eEnc); 261*cdf0e10cSrcweir rStream.ReadByteString(sSuffix, eEnc); 262*cdf0e10cSrcweir rStream.ReadByteString(sCharStyleName, eEnc); 263*cdf0e10cSrcweir rStream >> nUSHORT; 264*cdf0e10cSrcweir if(nUSHORT) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir SvxBrushItem aHelper(0); 267*cdf0e10cSrcweir pGraphicBrush = (SvxBrushItem*) aHelper.Create( rStream, BRUSH_GRAPHIC_VERSION ); 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir else 270*cdf0e10cSrcweir pGraphicBrush = 0; 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir rStream >> nUSHORT; 273*cdf0e10cSrcweir eVertOrient = (sal_Int16)nUSHORT; 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir rStream >> nUSHORT; 276*cdf0e10cSrcweir if(nUSHORT) 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir pBulletFont = new Font; 279*cdf0e10cSrcweir rStream >> *pBulletFont; 280*cdf0e10cSrcweir if(!pBulletFont->GetCharSet()) 281*cdf0e10cSrcweir pBulletFont->SetCharSet(rStream.GetStreamCharSet()); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir else 284*cdf0e10cSrcweir pBulletFont = 0; 285*cdf0e10cSrcweir rStream >> aGraphicSize; 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir rStream >> nBulletColor; 288*cdf0e10cSrcweir rStream >> nUSHORT; 289*cdf0e10cSrcweir nBulletRelSize = nUSHORT; 290*cdf0e10cSrcweir rStream >> nUSHORT; 291*cdf0e10cSrcweir SetShowSymbol((sal_Bool)nUSHORT); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir if( nVersion < NUMITEM_VERSION_03 ) 294*cdf0e10cSrcweir cBullet = ByteString::ConvertToUnicode( (sal_Char)cBullet, 295*cdf0e10cSrcweir (pBulletFont&&pBulletFont->GetCharSet()) ? pBulletFont->GetCharSet() 296*cdf0e10cSrcweir : RTL_TEXTENCODING_SYMBOL ); 297*cdf0e10cSrcweir if(pBulletFont) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir sal_Bool bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; 300*cdf0e10cSrcweir if(bConvertBulletFont) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir FontToSubsFontConverter pConverter = 304*cdf0e10cSrcweir CreateFontToSubsFontConverter(pBulletFont->GetName(), 305*cdf0e10cSrcweir FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS); 306*cdf0e10cSrcweir if(pConverter) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir cBullet = ConvertFontToSubsFontChar(pConverter, cBullet); 309*cdf0e10cSrcweir String sFontName = GetFontToSubsFontName(pConverter); 310*cdf0e10cSrcweir pBulletFont->SetName(sFontName); 311*cdf0e10cSrcweir DestroyFontToSubsFontConverter(pConverter); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir if( NUMITEM_VERSION_04 <= nVersion ) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir rStream >> nUSHORT; 319*cdf0e10cSrcweir mePositionAndSpaceMode = (SvxNumPositionAndSpaceMode) nUSHORT; 320*cdf0e10cSrcweir rStream >> nUSHORT; 321*cdf0e10cSrcweir meLabelFollowedBy = ( SvxNumLabelFollowedBy ) nUSHORT; 322*cdf0e10cSrcweir long nLong; 323*cdf0e10cSrcweir rStream >> nLong; 324*cdf0e10cSrcweir mnListtabPos = nLong; 325*cdf0e10cSrcweir rStream >> nLong; 326*cdf0e10cSrcweir mnFirstLineIndent = nLong; 327*cdf0e10cSrcweir rStream >> nLong; 328*cdf0e10cSrcweir mnIndentAt = nLong; 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir /* -----------------08.12.98 11:14------------------- 332*cdf0e10cSrcweir * 333*cdf0e10cSrcweir * --------------------------------------------------*/ 334*cdf0e10cSrcweir SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverter) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir if(pConverter && pBulletFont) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir cBullet = ConvertFontToSubsFontChar(pConverter, cBullet); 339*cdf0e10cSrcweir String sFontName = GetFontToSubsFontName(pConverter); 340*cdf0e10cSrcweir pBulletFont->SetName(sFontName); 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir rStream << (sal_uInt16)NUMITEM_VERSION_04; 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir rStream << (sal_uInt16)GetNumberingType(); 346*cdf0e10cSrcweir rStream << (sal_uInt16)eNumAdjust; 347*cdf0e10cSrcweir rStream << (sal_uInt16)nInclUpperLevels; 348*cdf0e10cSrcweir rStream << nStart; 349*cdf0e10cSrcweir rStream << (sal_uInt16)cBullet; 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir rStream << nFirstLineOffset; 352*cdf0e10cSrcweir rStream << nAbsLSpace; 353*cdf0e10cSrcweir rStream << nLSpace; 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir rStream << nCharTextDistance; 356*cdf0e10cSrcweir rtl_TextEncoding eEnc = gsl_getSystemTextEncoding(); 357*cdf0e10cSrcweir rStream.WriteByteString(sPrefix, eEnc); 358*cdf0e10cSrcweir rStream.WriteByteString(sSuffix, eEnc); 359*cdf0e10cSrcweir rStream.WriteByteString(sCharStyleName, eEnc); 360*cdf0e10cSrcweir if(pGraphicBrush) 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir rStream << (sal_uInt16)1; 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir // #75113# in SD or SI force bullet itself to be stored, 365*cdf0e10cSrcweir // for that purpose throw away link when link and graphic 366*cdf0e10cSrcweir // are present, so Brush save is forced 367*cdf0e10cSrcweir if(pGraphicBrush->GetGraphicLink() && pGraphicBrush->GetGraphic()) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir String aEmpty; 370*cdf0e10cSrcweir pGraphicBrush->SetGraphicLink(aEmpty); 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION); 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir else 376*cdf0e10cSrcweir rStream << (sal_uInt16)0; 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir rStream << (sal_uInt16)eVertOrient; 379*cdf0e10cSrcweir if(pBulletFont) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir rStream << (sal_uInt16)1; 382*cdf0e10cSrcweir rStream << *pBulletFont; 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir else 385*cdf0e10cSrcweir rStream << (sal_uInt16)0; 386*cdf0e10cSrcweir rStream << aGraphicSize; 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir Color nTempColor = nBulletColor; 389*cdf0e10cSrcweir if(COL_AUTO == nBulletColor.GetColor()) 390*cdf0e10cSrcweir nTempColor = COL_BLACK; 391*cdf0e10cSrcweir rStream << nTempColor; 392*cdf0e10cSrcweir rStream << nBulletRelSize; 393*cdf0e10cSrcweir rStream << (sal_uInt16)IsShowSymbol(); 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir rStream << ( sal_uInt16 ) mePositionAndSpaceMode; 396*cdf0e10cSrcweir rStream << ( sal_uInt16 ) meLabelFollowedBy; 397*cdf0e10cSrcweir rStream << ( long ) mnListtabPos; 398*cdf0e10cSrcweir rStream << ( long ) mnFirstLineIndent; 399*cdf0e10cSrcweir rStream << ( long ) mnIndentAt; 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir return rStream; 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir /* -----------------------------23.02.01 11:10-------------------------------- 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 407*cdf0e10cSrcweir SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat ) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir if (& rFormat == this) { return *this; } 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir SetNumberingType(rFormat.GetNumberingType()); 412*cdf0e10cSrcweir eNumAdjust = rFormat.eNumAdjust ; 413*cdf0e10cSrcweir nInclUpperLevels = rFormat.nInclUpperLevels ; 414*cdf0e10cSrcweir nStart = rFormat.nStart ; 415*cdf0e10cSrcweir cBullet = rFormat.cBullet ; 416*cdf0e10cSrcweir // --> OD 2008-01-09 #newlistlevelattrs# 417*cdf0e10cSrcweir mePositionAndSpaceMode = rFormat.mePositionAndSpaceMode; 418*cdf0e10cSrcweir // <-- 419*cdf0e10cSrcweir nFirstLineOffset = rFormat.nFirstLineOffset; 420*cdf0e10cSrcweir nAbsLSpace = rFormat.nAbsLSpace ; 421*cdf0e10cSrcweir nLSpace = rFormat.nLSpace ; 422*cdf0e10cSrcweir nCharTextDistance = rFormat.nCharTextDistance ; 423*cdf0e10cSrcweir // --> OD 2008-01-09 #newlistlevelattrs# 424*cdf0e10cSrcweir meLabelFollowedBy = rFormat.meLabelFollowedBy; 425*cdf0e10cSrcweir mnListtabPos = rFormat.mnListtabPos; 426*cdf0e10cSrcweir mnFirstLineIndent = rFormat.mnFirstLineIndent; 427*cdf0e10cSrcweir mnIndentAt = rFormat.mnIndentAt; 428*cdf0e10cSrcweir // <-- 429*cdf0e10cSrcweir eVertOrient = rFormat.eVertOrient ; 430*cdf0e10cSrcweir sPrefix = rFormat.sPrefix ; 431*cdf0e10cSrcweir sSuffix = rFormat.sSuffix ; 432*cdf0e10cSrcweir aGraphicSize = rFormat.aGraphicSize ; 433*cdf0e10cSrcweir nBulletColor = rFormat.nBulletColor ; 434*cdf0e10cSrcweir nBulletRelSize = rFormat.nBulletRelSize; 435*cdf0e10cSrcweir SetShowSymbol(rFormat.IsShowSymbol()); 436*cdf0e10cSrcweir sCharStyleName = rFormat.sCharStyleName; 437*cdf0e10cSrcweir DELETEZ(pGraphicBrush); 438*cdf0e10cSrcweir if(rFormat.pGraphicBrush) 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir pGraphicBrush = new SvxBrushItem(*rFormat.pGraphicBrush); 441*cdf0e10cSrcweir pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) ); 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir DELETEZ(pBulletFont); 444*cdf0e10cSrcweir if(rFormat.pBulletFont) 445*cdf0e10cSrcweir pBulletFont = new Font(*rFormat.pBulletFont); 446*cdf0e10cSrcweir return *this; 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir /* -----------------27.10.98 10:56------------------- 449*cdf0e10cSrcweir * 450*cdf0e10cSrcweir * --------------------------------------------------*/ 451*cdf0e10cSrcweir sal_Bool SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir if( GetNumberingType() != rFormat.GetNumberingType() || 454*cdf0e10cSrcweir eNumAdjust != rFormat.eNumAdjust || 455*cdf0e10cSrcweir nInclUpperLevels != rFormat.nInclUpperLevels || 456*cdf0e10cSrcweir nStart != rFormat.nStart || 457*cdf0e10cSrcweir cBullet != rFormat.cBullet || 458*cdf0e10cSrcweir // --> OD 2008-01-09 #newlistlevelattrs# 459*cdf0e10cSrcweir mePositionAndSpaceMode != rFormat.mePositionAndSpaceMode || 460*cdf0e10cSrcweir // <-- 461*cdf0e10cSrcweir nFirstLineOffset != rFormat.nFirstLineOffset || 462*cdf0e10cSrcweir nAbsLSpace != rFormat.nAbsLSpace || 463*cdf0e10cSrcweir nLSpace != rFormat.nLSpace || 464*cdf0e10cSrcweir nCharTextDistance != rFormat.nCharTextDistance || 465*cdf0e10cSrcweir // --> OD 2008-01-09 #newlistlevelattrs# 466*cdf0e10cSrcweir meLabelFollowedBy != rFormat.meLabelFollowedBy || 467*cdf0e10cSrcweir mnListtabPos != rFormat.mnListtabPos || 468*cdf0e10cSrcweir mnFirstLineIndent != rFormat.mnFirstLineIndent || 469*cdf0e10cSrcweir mnIndentAt != rFormat.mnIndentAt || 470*cdf0e10cSrcweir // <-- 471*cdf0e10cSrcweir eVertOrient != rFormat.eVertOrient || 472*cdf0e10cSrcweir sPrefix != rFormat.sPrefix || 473*cdf0e10cSrcweir sSuffix != rFormat.sSuffix || 474*cdf0e10cSrcweir aGraphicSize != rFormat.aGraphicSize || 475*cdf0e10cSrcweir nBulletColor != rFormat.nBulletColor || 476*cdf0e10cSrcweir nBulletRelSize != rFormat.nBulletRelSize || 477*cdf0e10cSrcweir IsShowSymbol() != rFormat.IsShowSymbol() || 478*cdf0e10cSrcweir sCharStyleName != rFormat.sCharStyleName 479*cdf0e10cSrcweir ) 480*cdf0e10cSrcweir return sal_False; 481*cdf0e10cSrcweir if ( 482*cdf0e10cSrcweir (pGraphicBrush && !rFormat.pGraphicBrush) || 483*cdf0e10cSrcweir (!pGraphicBrush && rFormat.pGraphicBrush) || 484*cdf0e10cSrcweir (pGraphicBrush && *pGraphicBrush != *rFormat.pGraphicBrush) 485*cdf0e10cSrcweir ) 486*cdf0e10cSrcweir { 487*cdf0e10cSrcweir return sal_False; 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir if ( 490*cdf0e10cSrcweir (pBulletFont && !rFormat.pBulletFont) || 491*cdf0e10cSrcweir (!pBulletFont && rFormat.pBulletFont) || 492*cdf0e10cSrcweir (pBulletFont && *pBulletFont != *rFormat.pBulletFont) 493*cdf0e10cSrcweir ) 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir return sal_False; 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir return sal_True; 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir /* -----------------28.10.98 09:53------------------- 500*cdf0e10cSrcweir * 501*cdf0e10cSrcweir * --------------------------------------------------*/ 502*cdf0e10cSrcweir void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem, 503*cdf0e10cSrcweir const Size* pSize, const sal_Int16* pOrient) 504*cdf0e10cSrcweir { 505*cdf0e10cSrcweir if(!pBrushItem) 506*cdf0e10cSrcweir { 507*cdf0e10cSrcweir delete pGraphicBrush; 508*cdf0e10cSrcweir pGraphicBrush = 0; 509*cdf0e10cSrcweir } 510*cdf0e10cSrcweir else if ( !pGraphicBrush || (pGraphicBrush && !(*pBrushItem == *pGraphicBrush)) ) 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir delete pGraphicBrush; 513*cdf0e10cSrcweir pGraphicBrush = (SvxBrushItem*)pBrushItem->Clone(); 514*cdf0e10cSrcweir pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) ); 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir if(pOrient) 518*cdf0e10cSrcweir eVertOrient = *pOrient; 519*cdf0e10cSrcweir else 520*cdf0e10cSrcweir eVertOrient = text::VertOrientation::NONE; 521*cdf0e10cSrcweir if(pSize) 522*cdf0e10cSrcweir aGraphicSize = *pSize; 523*cdf0e10cSrcweir else 524*cdf0e10cSrcweir aGraphicSize.Width() = aGraphicSize.Height() = 0; 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir /* -----------------28.10.98 09:59------------------- 527*cdf0e10cSrcweir * 528*cdf0e10cSrcweir * --------------------------------------------------*/ 529*cdf0e10cSrcweir void SvxNumberFormat::SetGraphic( const String& rName ) 530*cdf0e10cSrcweir { 531*cdf0e10cSrcweir const String* pName; 532*cdf0e10cSrcweir if( pGraphicBrush && 533*cdf0e10cSrcweir 0 != (pName = pGraphicBrush->GetGraphicLink()) 534*cdf0e10cSrcweir && *pName == rName ) 535*cdf0e10cSrcweir return ; 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir delete pGraphicBrush; 538*cdf0e10cSrcweir String sTmp; 539*cdf0e10cSrcweir pGraphicBrush = new SvxBrushItem( rName, sTmp, GPOS_AREA, 0 ); 540*cdf0e10cSrcweir pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) ); 541*cdf0e10cSrcweir if( eVertOrient == text::VertOrientation::NONE ) 542*cdf0e10cSrcweir eVertOrient = text::VertOrientation::TOP; 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir aGraphicSize.Width() = aGraphicSize.Height() = 0; 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir /* -----------------------------22.02.01 15:55-------------------------------- 547*cdf0e10cSrcweir 548*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 549*cdf0e10cSrcweir void SvxNumberFormat::SetVertOrient(sal_Int16 eSet) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir eVertOrient = eSet; 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir /* -----------------------------22.02.01 15:55-------------------------------- 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 556*cdf0e10cSrcweir sal_Int16 SvxNumberFormat::GetVertOrient() const 557*cdf0e10cSrcweir { 558*cdf0e10cSrcweir return eVertOrient; 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir /* -----------------28.10.98 09:59------------------- 561*cdf0e10cSrcweir * 562*cdf0e10cSrcweir * --------------------------------------------------*/ 563*cdf0e10cSrcweir void SvxNumberFormat::SetBulletFont(const Font* pFont) 564*cdf0e10cSrcweir { 565*cdf0e10cSrcweir delete pBulletFont; 566*cdf0e10cSrcweir pBulletFont = pFont ? new Font(*pFont): 0; 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir // --> OD 2008-01-09 #newlistlevelattrs# 570*cdf0e10cSrcweir SvxNumberFormat::SvxNumPositionAndSpaceMode SvxNumberFormat::GetPositionAndSpaceMode() const 571*cdf0e10cSrcweir { 572*cdf0e10cSrcweir return mePositionAndSpaceMode; 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir void SvxNumberFormat::SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode ) 575*cdf0e10cSrcweir { 576*cdf0e10cSrcweir mePositionAndSpaceMode = ePositionAndSpaceMode; 577*cdf0e10cSrcweir } 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir short SvxNumberFormat::GetLSpace() const 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir //#if OSL_DEBUG_LEVEL > 1 582*cdf0e10cSrcweir // DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, 583*cdf0e10cSrcweir // "<SvxNumberFormat::GetLSpace()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); 584*cdf0e10cSrcweir //#endif 585*cdf0e10cSrcweir return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nLSpace : 0; 586*cdf0e10cSrcweir } 587*cdf0e10cSrcweir short SvxNumberFormat::GetAbsLSpace() const 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir //#if OSL_DEBUG_LEVEL > 1 590*cdf0e10cSrcweir // DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, 591*cdf0e10cSrcweir // "<SvxNumberFormat::GetAbsLSpace()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); 592*cdf0e10cSrcweir //#endif 593*cdf0e10cSrcweir return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION 594*cdf0e10cSrcweir ? nAbsLSpace 595*cdf0e10cSrcweir : static_cast<short>( GetFirstLineIndent() + GetIndentAt() ); 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir short SvxNumberFormat::GetFirstLineOffset() const 598*cdf0e10cSrcweir { 599*cdf0e10cSrcweir //#if OSL_DEBUG_LEVEL > 1 600*cdf0e10cSrcweir // DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, 601*cdf0e10cSrcweir // "<SvxNumberFormat::GetFirstLineOffset()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); 602*cdf0e10cSrcweir //#endif 603*cdf0e10cSrcweir return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION 604*cdf0e10cSrcweir ? nFirstLineOffset 605*cdf0e10cSrcweir : static_cast<short>( GetFirstLineIndent() ); 606*cdf0e10cSrcweir } 607*cdf0e10cSrcweir short SvxNumberFormat::GetCharTextDistance() const 608*cdf0e10cSrcweir { 609*cdf0e10cSrcweir //#if OSL_DEBUG_LEVEL > 1 610*cdf0e10cSrcweir // DBG_ASSERT( mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION, 611*cdf0e10cSrcweir // "<SvxNumberFormat::GetCharTextDistance()> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION"); 612*cdf0e10cSrcweir //#endif 613*cdf0e10cSrcweir return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION ? nCharTextDistance : 0; 614*cdf0e10cSrcweir } 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir void SvxNumberFormat::SetLabelFollowedBy( const SvxNumLabelFollowedBy eLabelFollowedBy ) 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir meLabelFollowedBy = eLabelFollowedBy; 619*cdf0e10cSrcweir } 620*cdf0e10cSrcweir SvxNumberFormat::SvxNumLabelFollowedBy SvxNumberFormat::GetLabelFollowedBy() const 621*cdf0e10cSrcweir { 622*cdf0e10cSrcweir return meLabelFollowedBy; 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir void SvxNumberFormat::SetListtabPos( const long nListtabPos ) 625*cdf0e10cSrcweir { 626*cdf0e10cSrcweir mnListtabPos = nListtabPos; 627*cdf0e10cSrcweir } 628*cdf0e10cSrcweir long SvxNumberFormat::GetListtabPos() const 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir return mnListtabPos; 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir void SvxNumberFormat::SetFirstLineIndent( const long nFirstLineIndent ) 633*cdf0e10cSrcweir { 634*cdf0e10cSrcweir mnFirstLineIndent = nFirstLineIndent; 635*cdf0e10cSrcweir } 636*cdf0e10cSrcweir long SvxNumberFormat::GetFirstLineIndent() const 637*cdf0e10cSrcweir { 638*cdf0e10cSrcweir return mnFirstLineIndent; 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir void SvxNumberFormat::SetIndentAt( const long nIndentAt ) 641*cdf0e10cSrcweir { 642*cdf0e10cSrcweir mnIndentAt = nIndentAt; 643*cdf0e10cSrcweir } 644*cdf0e10cSrcweir long SvxNumberFormat::GetIndentAt() const 645*cdf0e10cSrcweir { 646*cdf0e10cSrcweir return mnIndentAt; 647*cdf0e10cSrcweir } 648*cdf0e10cSrcweir // <-- 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir /* -----------------28.10.98 10:03------------------- 651*cdf0e10cSrcweir * 652*cdf0e10cSrcweir * --------------------------------------------------*/ 653*cdf0e10cSrcweir IMPL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void *, EMPTYARG ) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir // ggfs. die GrfSize setzen: 656*cdf0e10cSrcweir if( !pThis->aGraphicSize.Width() || !pThis->aGraphicSize.Height() ) 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir const Graphic* pGrf = pThis->pGraphicBrush->GetGraphic(); 659*cdf0e10cSrcweir if( pGrf ) 660*cdf0e10cSrcweir pThis->aGraphicSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf ); 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir pThis->NotifyGraphicArrived(); 663*cdf0e10cSrcweir return 0; 664*cdf0e10cSrcweir } 665*cdf0e10cSrcweir /* -----------------------------02.07.01 15:36-------------------------------- 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 668*cdf0e10cSrcweir void SvxNumberFormat::NotifyGraphicArrived() 669*cdf0e10cSrcweir { 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir /* -----------------28.10.98 10:38------------------- 673*cdf0e10cSrcweir * 674*cdf0e10cSrcweir * --------------------------------------------------*/ 675*cdf0e10cSrcweir Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic) 676*cdf0e10cSrcweir { 677*cdf0e10cSrcweir const MapMode aMapMM100( MAP_100TH_MM ); 678*cdf0e10cSrcweir const Size& rSize = pGraphic->GetPrefSize(); 679*cdf0e10cSrcweir Size aRetSize; 680*cdf0e10cSrcweir if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir OutputDevice* pOutDev = Application::GetDefaultDevice(); 683*cdf0e10cSrcweir MapMode aOldMap( pOutDev->GetMapMode() ); 684*cdf0e10cSrcweir pOutDev->SetMapMode( aMapMM100 ); 685*cdf0e10cSrcweir aRetSize = pOutDev->PixelToLogic( rSize ); 686*cdf0e10cSrcweir pOutDev->SetMapMode( aOldMap ); 687*cdf0e10cSrcweir } 688*cdf0e10cSrcweir else 689*cdf0e10cSrcweir aRetSize = OutputDevice::LogicToLogic( rSize, pGraphic->GetPrefMapMode(), aMapMM100 ); 690*cdf0e10cSrcweir return aRetSize; 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir /* -----------------28.10.98 15:57------------------- 693*cdf0e10cSrcweir * 694*cdf0e10cSrcweir * --------------------------------------------------*/ 695*cdf0e10cSrcweir String SvxNumberFormat::CreateRomanString( sal_uLong nNo, sal_Bool bUpper ) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir nNo %= 4000; // mehr kann nicht dargestellt werden 698*cdf0e10cSrcweir // i, ii, iii, iv, v, vi, vii, vii, viii, ix 699*cdf0e10cSrcweir // (Dummy),1000,500,100,50,10,5,1 700*cdf0e10cSrcweir const char *cRomanArr = bUpper 701*cdf0e10cSrcweir ? "MDCLXVI--" // +2 Dummy-Eintraege !! 702*cdf0e10cSrcweir : "mdclxvi--"; // +2 Dummy-Eintraege !! 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir String sRet; 705*cdf0e10cSrcweir sal_uInt16 nMask = 1000; 706*cdf0e10cSrcweir while( nMask ) 707*cdf0e10cSrcweir { 708*cdf0e10cSrcweir sal_uInt8 nZahl = sal_uInt8(nNo / nMask); 709*cdf0e10cSrcweir sal_uInt8 nDiff = 1; 710*cdf0e10cSrcweir nNo %= nMask; 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir if( 5 < nZahl ) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir if( nZahl < 9 ) 715*cdf0e10cSrcweir sRet += sal_Unicode(*(cRomanArr-1)); 716*cdf0e10cSrcweir ++nDiff; 717*cdf0e10cSrcweir nZahl -= 5; 718*cdf0e10cSrcweir } 719*cdf0e10cSrcweir switch( nZahl ) 720*cdf0e10cSrcweir { 721*cdf0e10cSrcweir case 3: { sRet += sal_Unicode(*cRomanArr); } 722*cdf0e10cSrcweir case 2: { sRet += sal_Unicode(*cRomanArr); } 723*cdf0e10cSrcweir case 1: { sRet += sal_Unicode(*cRomanArr); } 724*cdf0e10cSrcweir break; 725*cdf0e10cSrcweir 726*cdf0e10cSrcweir case 4: { 727*cdf0e10cSrcweir sRet += sal_Unicode(*cRomanArr); 728*cdf0e10cSrcweir sRet += sal_Unicode(*(cRomanArr-nDiff)); 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir break; 731*cdf0e10cSrcweir case 5: { sRet += sal_Unicode(*(cRomanArr-nDiff)); } 732*cdf0e10cSrcweir break; 733*cdf0e10cSrcweir } 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir nMask /= 10; // zur naechsten Dekade 736*cdf0e10cSrcweir cRomanArr += 2; 737*cdf0e10cSrcweir } 738*cdf0e10cSrcweir return sRet; 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir #ifdef OLD_NUMBER_FORMATTING 741*cdf0e10cSrcweir void SvxNumberFormat::GetCharStr( sal_uLong nNo, String& rStr ) const 742*cdf0e10cSrcweir { 743*cdf0e10cSrcweir DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" ); 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir const sal_uLong coDiff = 'Z' - 'A' +1; 746*cdf0e10cSrcweir char cAdd = (SVX_NUM_CHARS_UPPER_LETTER == eNumType ? 'A' : 'a') - 1; 747*cdf0e10cSrcweir sal_uLong nCalc; 748*cdf0e10cSrcweir 749*cdf0e10cSrcweir do { 750*cdf0e10cSrcweir nCalc = nNo % coDiff; 751*cdf0e10cSrcweir if( !nCalc ) 752*cdf0e10cSrcweir nCalc = coDiff; 753*cdf0e10cSrcweir rStr.Insert( sal_Unicode(cAdd + nCalc ), 0 ); 754*cdf0e10cSrcweir nNo -= nCalc; 755*cdf0e10cSrcweir if( nNo ) 756*cdf0e10cSrcweir nNo /= coDiff; 757*cdf0e10cSrcweir } while( nNo ); 758*cdf0e10cSrcweir } 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir void SvxNumberFormat::GetCharStrN( sal_uLong nNo, String& rStr ) const 761*cdf0e10cSrcweir { 762*cdf0e10cSrcweir DBG_ASSERT( nNo, "0 ist eine ungueltige Nummer !!" ); 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir const sal_uLong coDiff = 'Z' - 'A' +1; 765*cdf0e10cSrcweir char cChar = (char)(--nNo % coDiff); 766*cdf0e10cSrcweir if( SVX_NUM_CHARS_UPPER_LETTER_N == eNumType ) 767*cdf0e10cSrcweir cChar += 'A'; 768*cdf0e10cSrcweir else 769*cdf0e10cSrcweir cChar += 'a'; 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir rStr.Fill( (sal_uInt16)(nNo / coDiff) + 1, sal_Unicode(cChar) ); 772*cdf0e10cSrcweir } 773*cdf0e10cSrcweir #endif //OLD_NUMBER_FORMATTING 774*cdf0e10cSrcweir /* -----------------------------22.02.01 13:31-------------------------------- 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 777*cdf0e10cSrcweir const String& SvxNumberFormat::GetCharFmtName()const 778*cdf0e10cSrcweir { 779*cdf0e10cSrcweir return sCharStyleName; 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir /* -----------------27.10.98 10:38------------------- 782*cdf0e10cSrcweir * 783*cdf0e10cSrcweir * --------------------------------------------------*/ 784*cdf0e10cSrcweir sal_Int32 SvxNumRule::nRefCount = 0; 785*cdf0e10cSrcweir static SvxNumberFormat* pStdNumFmt = 0; 786*cdf0e10cSrcweir static SvxNumberFormat* pStdOutlineNumFmt = 0; 787*cdf0e10cSrcweir // --> OD 2008-02-11 #newlistlevelattrs# 788*cdf0e10cSrcweir SvxNumRule::SvxNumRule( sal_uLong nFeatures, 789*cdf0e10cSrcweir sal_uInt16 nLevels, 790*cdf0e10cSrcweir sal_Bool bCont, 791*cdf0e10cSrcweir SvxNumRuleType eType, 792*cdf0e10cSrcweir SvxNumberFormat::SvxNumPositionAndSpaceMode 793*cdf0e10cSrcweir eDefaultNumberFormatPositionAndSpaceMode ) 794*cdf0e10cSrcweir : nLevelCount(nLevels), 795*cdf0e10cSrcweir nFeatureFlags(nFeatures), 796*cdf0e10cSrcweir eNumberingType(eType), 797*cdf0e10cSrcweir bContinuousNumbering(bCont) 798*cdf0e10cSrcweir { 799*cdf0e10cSrcweir ++nRefCount; 800*cdf0e10cSrcweir LanguageType eLang = Application::GetSettings().GetLanguage(); 801*cdf0e10cSrcweir aLocale = SvxCreateLocale(eLang); 802*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) 803*cdf0e10cSrcweir { 804*cdf0e10cSrcweir if(i < nLevels) 805*cdf0e10cSrcweir { 806*cdf0e10cSrcweir aFmts[i] = new SvxNumberFormat(SVX_NUM_CHARS_UPPER_LETTER); 807*cdf0e10cSrcweir //daran wird zwischen writer und draw unterschieden 808*cdf0e10cSrcweir if(nFeatures & NUM_CONTINUOUS) 809*cdf0e10cSrcweir { 810*cdf0e10cSrcweir // --> OD 2008-02-11 #newlistlevelattrs# 811*cdf0e10cSrcweir if ( eDefaultNumberFormatPositionAndSpaceMode == 812*cdf0e10cSrcweir SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) 813*cdf0e10cSrcweir { 814*cdf0e10cSrcweir aFmts[i]->SetLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE) ); 815*cdf0e10cSrcweir aFmts[i]->SetAbsLSpace( MM100_TO_TWIP(DEF_WRITER_LSPACE * (i+1)) ); 816*cdf0e10cSrcweir aFmts[i]->SetFirstLineOffset(MM100_TO_TWIP(-DEF_WRITER_LSPACE)); 817*cdf0e10cSrcweir } 818*cdf0e10cSrcweir else if ( eDefaultNumberFormatPositionAndSpaceMode == 819*cdf0e10cSrcweir SvxNumberFormat::LABEL_ALIGNMENT ) 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir // first line indent of general numbering in inch: -0,25 inch 822*cdf0e10cSrcweir const long cFirstLineIndent = -1440/4; 823*cdf0e10cSrcweir // indent values of general numbering in inch: 824*cdf0e10cSrcweir // 0,5 0,75 1,0 1,25 1,5 825*cdf0e10cSrcweir // 1,75 2,0 2,25 2,5 2,75 826*cdf0e10cSrcweir const long cIndentAt = 1440/4; 827*cdf0e10cSrcweir aFmts[i]->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT ); 828*cdf0e10cSrcweir aFmts[i]->SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); 829*cdf0e10cSrcweir aFmts[i]->SetListtabPos( cIndentAt * (i+2) ); 830*cdf0e10cSrcweir aFmts[i]->SetFirstLineIndent( cFirstLineIndent ); 831*cdf0e10cSrcweir aFmts[i]->SetIndentAt( cIndentAt * (i+2) ); 832*cdf0e10cSrcweir } 833*cdf0e10cSrcweir // <-- 834*cdf0e10cSrcweir } 835*cdf0e10cSrcweir else 836*cdf0e10cSrcweir { 837*cdf0e10cSrcweir aFmts[i]->SetLSpace( DEF_DRAW_LSPACE ); 838*cdf0e10cSrcweir aFmts[i]->SetAbsLSpace( DEF_DRAW_LSPACE * (i) ); 839*cdf0e10cSrcweir } 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir else 842*cdf0e10cSrcweir aFmts[i] = 0; 843*cdf0e10cSrcweir aFmtsSet[i] = sal_False; 844*cdf0e10cSrcweir } 845*cdf0e10cSrcweir } 846*cdf0e10cSrcweir /* -----------------27.10.98 10:41------------------- 847*cdf0e10cSrcweir * 848*cdf0e10cSrcweir * --------------------------------------------------*/ 849*cdf0e10cSrcweir SvxNumRule::SvxNumRule(const SvxNumRule& rCopy) 850*cdf0e10cSrcweir { 851*cdf0e10cSrcweir ++nRefCount; 852*cdf0e10cSrcweir aLocale = rCopy.aLocale; 853*cdf0e10cSrcweir nLevelCount = rCopy.nLevelCount ; 854*cdf0e10cSrcweir nFeatureFlags = rCopy.nFeatureFlags ; 855*cdf0e10cSrcweir bContinuousNumbering = rCopy.bContinuousNumbering; 856*cdf0e10cSrcweir eNumberingType = rCopy.eNumberingType; 857*cdf0e10cSrcweir memset( aFmts, 0, sizeof( aFmts )); 858*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) 859*cdf0e10cSrcweir { 860*cdf0e10cSrcweir if(rCopy.aFmts[i]) 861*cdf0e10cSrcweir aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]); 862*cdf0e10cSrcweir else 863*cdf0e10cSrcweir aFmts[i] = 0; 864*cdf0e10cSrcweir aFmtsSet[i] = rCopy.aFmtsSet[i]; 865*cdf0e10cSrcweir } 866*cdf0e10cSrcweir } 867*cdf0e10cSrcweir /* -----------------08.12.98 11:07------------------- 868*cdf0e10cSrcweir * 869*cdf0e10cSrcweir * --------------------------------------------------*/ 870*cdf0e10cSrcweir SvxNumRule::SvxNumRule(SvStream &rStream) 871*cdf0e10cSrcweir { 872*cdf0e10cSrcweir ++nRefCount; 873*cdf0e10cSrcweir LanguageType eLang = Application::GetSettings().GetLanguage(); 874*cdf0e10cSrcweir aLocale = SvxCreateLocale(eLang); 875*cdf0e10cSrcweir sal_uInt16 nVersion; 876*cdf0e10cSrcweir sal_uInt16 nTemp; 877*cdf0e10cSrcweir rStream >> nVersion; 878*cdf0e10cSrcweir rStream >> nLevelCount; 879*cdf0e10cSrcweir rStream >> nTemp; 880*cdf0e10cSrcweir nFeatureFlags = nTemp; 881*cdf0e10cSrcweir rStream >> nTemp; 882*cdf0e10cSrcweir bContinuousNumbering = (sal_Bool)nTemp; 883*cdf0e10cSrcweir rStream >> nTemp; 884*cdf0e10cSrcweir eNumberingType = (SvxNumRuleType)nTemp; 885*cdf0e10cSrcweir memset( aFmts, 0, sizeof( aFmts )); 886*cdf0e10cSrcweir 887*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) 888*cdf0e10cSrcweir { 889*cdf0e10cSrcweir sal_uInt16 nSet; 890*cdf0e10cSrcweir rStream >> nSet; 891*cdf0e10cSrcweir if(nSet) 892*cdf0e10cSrcweir aFmts[i] = new SvxNumberFormat(rStream); 893*cdf0e10cSrcweir else 894*cdf0e10cSrcweir aFmts[i] = 0; 895*cdf0e10cSrcweir aFmtsSet[i] = aFmts[i] ? sal_True : sal_False; 896*cdf0e10cSrcweir } 897*cdf0e10cSrcweir if(NUMITEM_VERSION_02 <= nVersion) 898*cdf0e10cSrcweir { 899*cdf0e10cSrcweir sal_uInt16 nShort; 900*cdf0e10cSrcweir rStream >> nShort; 901*cdf0e10cSrcweir nFeatureFlags = nShort; 902*cdf0e10cSrcweir } 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir 905*cdf0e10cSrcweir /* -----------------08.12.98 11:07------------------- 906*cdf0e10cSrcweir * 907*cdf0e10cSrcweir * --------------------------------------------------*/ 908*cdf0e10cSrcweir SvStream& SvxNumRule::Store(SvStream &rStream) 909*cdf0e10cSrcweir { 910*cdf0e10cSrcweir rStream<<(sal_uInt16)NUMITEM_VERSION_03; 911*cdf0e10cSrcweir rStream<<nLevelCount; 912*cdf0e10cSrcweir //first save of nFeatureFlags for old versions 913*cdf0e10cSrcweir rStream<<(sal_uInt16)nFeatureFlags; 914*cdf0e10cSrcweir rStream<<(sal_uInt16)bContinuousNumbering; 915*cdf0e10cSrcweir rStream<<(sal_uInt16)eNumberingType; 916*cdf0e10cSrcweir 917*cdf0e10cSrcweir FontToSubsFontConverter pConverter = 0; 918*cdf0e10cSrcweir sal_Bool bConvertBulletFont = rStream.GetVersion() <= SOFFICE_FILEFORMAT_50; 919*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) 920*cdf0e10cSrcweir { 921*cdf0e10cSrcweir if(aFmts[i]) 922*cdf0e10cSrcweir { 923*cdf0e10cSrcweir rStream << sal_uInt16(1); 924*cdf0e10cSrcweir if(bConvertBulletFont && aFmts[i]->GetBulletFont()) 925*cdf0e10cSrcweir { 926*cdf0e10cSrcweir if(!pConverter) 927*cdf0e10cSrcweir pConverter = 928*cdf0e10cSrcweir CreateFontToSubsFontConverter(aFmts[i]->GetBulletFont()->GetName(), 929*cdf0e10cSrcweir FONTTOSUBSFONT_EXPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS); 930*cdf0e10cSrcweir } 931*cdf0e10cSrcweir aFmts[i]->Store(rStream, pConverter); 932*cdf0e10cSrcweir } 933*cdf0e10cSrcweir else 934*cdf0e10cSrcweir rStream << sal_uInt16(0); 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir //second save of nFeatureFlags for new versions 937*cdf0e10cSrcweir rStream<<(sal_uInt16)nFeatureFlags; 938*cdf0e10cSrcweir if(pConverter) 939*cdf0e10cSrcweir DestroyFontToSubsFontConverter(pConverter); 940*cdf0e10cSrcweir 941*cdf0e10cSrcweir return rStream; 942*cdf0e10cSrcweir } 943*cdf0e10cSrcweir 944*cdf0e10cSrcweir /* -----------------27.10.98 10:41------------------- 945*cdf0e10cSrcweir * 946*cdf0e10cSrcweir * --------------------------------------------------*/ 947*cdf0e10cSrcweir SvxNumRule::~SvxNumRule() 948*cdf0e10cSrcweir { 949*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) 950*cdf0e10cSrcweir delete aFmts[i]; 951*cdf0e10cSrcweir if(!--nRefCount) 952*cdf0e10cSrcweir { 953*cdf0e10cSrcweir DELETEZ(pStdNumFmt); 954*cdf0e10cSrcweir DELETEZ(pStdOutlineNumFmt); 955*cdf0e10cSrcweir } 956*cdf0e10cSrcweir } 957*cdf0e10cSrcweir /* -----------------29.10.98 16:07------------------- 958*cdf0e10cSrcweir * 959*cdf0e10cSrcweir * --------------------------------------------------*/ 960*cdf0e10cSrcweir SvxNumRule& SvxNumRule::operator=( const SvxNumRule& rCopy ) 961*cdf0e10cSrcweir { 962*cdf0e10cSrcweir nLevelCount = rCopy.nLevelCount; 963*cdf0e10cSrcweir nFeatureFlags = rCopy.nFeatureFlags; 964*cdf0e10cSrcweir bContinuousNumbering = rCopy.bContinuousNumbering; 965*cdf0e10cSrcweir eNumberingType = rCopy.eNumberingType; 966*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) 967*cdf0e10cSrcweir { 968*cdf0e10cSrcweir delete aFmts[i]; 969*cdf0e10cSrcweir if(rCopy.aFmts[i]) 970*cdf0e10cSrcweir aFmts[i] = new SvxNumberFormat(*rCopy.aFmts[i]); 971*cdf0e10cSrcweir else 972*cdf0e10cSrcweir aFmts[i] = 0; 973*cdf0e10cSrcweir aFmtsSet[i] = rCopy.aFmtsSet[i]; 974*cdf0e10cSrcweir } 975*cdf0e10cSrcweir return *this; 976*cdf0e10cSrcweir } 977*cdf0e10cSrcweir /* -----------------27.10.98 10:41------------------- 978*cdf0e10cSrcweir * 979*cdf0e10cSrcweir * --------------------------------------------------*/ 980*cdf0e10cSrcweir int SvxNumRule::operator==( const SvxNumRule& rCopy) const 981*cdf0e10cSrcweir { 982*cdf0e10cSrcweir if(nLevelCount != rCopy.nLevelCount || 983*cdf0e10cSrcweir nFeatureFlags != rCopy.nFeatureFlags || 984*cdf0e10cSrcweir bContinuousNumbering != rCopy.bContinuousNumbering || 985*cdf0e10cSrcweir eNumberingType != rCopy.eNumberingType) 986*cdf0e10cSrcweir return sal_False; 987*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nLevelCount; i++) 988*cdf0e10cSrcweir { 989*cdf0e10cSrcweir if ( 990*cdf0e10cSrcweir (aFmtsSet[i] != rCopy.aFmtsSet[i]) || 991*cdf0e10cSrcweir (!aFmts[i] && rCopy.aFmts[i]) || 992*cdf0e10cSrcweir (aFmts[i] && !rCopy.aFmts[i]) || 993*cdf0e10cSrcweir (aFmts[i] && *aFmts[i] != *rCopy.aFmts[i]) 994*cdf0e10cSrcweir ) 995*cdf0e10cSrcweir { 996*cdf0e10cSrcweir return sal_False; 997*cdf0e10cSrcweir } 998*cdf0e10cSrcweir } 999*cdf0e10cSrcweir return sal_True; 1000*cdf0e10cSrcweir } 1001*cdf0e10cSrcweir /* -----------------27.10.98 10:41------------------- 1002*cdf0e10cSrcweir * 1003*cdf0e10cSrcweir * --------------------------------------------------*/ 1004*cdf0e10cSrcweir const SvxNumberFormat* SvxNumRule::Get(sal_uInt16 nLevel)const 1005*cdf0e10cSrcweir { 1006*cdf0e10cSrcweir DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" ); 1007*cdf0e10cSrcweir if( nLevel < SVX_MAX_NUM ) 1008*cdf0e10cSrcweir return aFmtsSet[nLevel] ? aFmts[nLevel] : 0; 1009*cdf0e10cSrcweir else 1010*cdf0e10cSrcweir return 0; 1011*cdf0e10cSrcweir } 1012*cdf0e10cSrcweir /* -----------------02.11.98 09:10------------------- 1013*cdf0e10cSrcweir * 1014*cdf0e10cSrcweir * --------------------------------------------------*/ 1015*cdf0e10cSrcweir const SvxNumberFormat& SvxNumRule::GetLevel(sal_uInt16 nLevel)const 1016*cdf0e10cSrcweir { 1017*cdf0e10cSrcweir if(!pStdNumFmt) 1018*cdf0e10cSrcweir { 1019*cdf0e10cSrcweir pStdNumFmt = new SvxNumberFormat(SVX_NUM_ARABIC); 1020*cdf0e10cSrcweir pStdOutlineNumFmt = new SvxNumberFormat(SVX_NUM_NUMBER_NONE); 1021*cdf0e10cSrcweir } 1022*cdf0e10cSrcweir 1023*cdf0e10cSrcweir DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" ); 1024*cdf0e10cSrcweir 1025*cdf0e10cSrcweir return ( ( nLevel < SVX_MAX_NUM ) && aFmts[nLevel] ) ? 1026*cdf0e10cSrcweir *aFmts[nLevel] : eNumberingType == SVX_RULETYPE_NUMBERING ? 1027*cdf0e10cSrcweir *pStdNumFmt : *pStdOutlineNumFmt; 1028*cdf0e10cSrcweir } 1029*cdf0e10cSrcweir 1030*cdf0e10cSrcweir /* -----------------29.10.98 09:08------------------- 1031*cdf0e10cSrcweir * 1032*cdf0e10cSrcweir * --------------------------------------------------*/ 1033*cdf0e10cSrcweir void SvxNumRule::SetLevel( sal_uInt16 i, const SvxNumberFormat& rNumFmt, sal_Bool bIsValid ) 1034*cdf0e10cSrcweir { 1035*cdf0e10cSrcweir DBG_ASSERT(i < SVX_MAX_NUM, "falsches Level" ); 1036*cdf0e10cSrcweir 1037*cdf0e10cSrcweir if( (i < SVX_MAX_NUM) && (!aFmtsSet[i] || !(rNumFmt == *Get( i ))) ) 1038*cdf0e10cSrcweir { 1039*cdf0e10cSrcweir delete aFmts[ i ]; 1040*cdf0e10cSrcweir aFmts[ i ] = new SvxNumberFormat( rNumFmt ); 1041*cdf0e10cSrcweir aFmtsSet[i] = bIsValid; 1042*cdf0e10cSrcweir // bInvalidRuleFlag = sal_True; 1043*cdf0e10cSrcweir } 1044*cdf0e10cSrcweir } 1045*cdf0e10cSrcweir /* -----------------30.10.98 12:44------------------- 1046*cdf0e10cSrcweir * 1047*cdf0e10cSrcweir * --------------------------------------------------*/ 1048*cdf0e10cSrcweir void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt) 1049*cdf0e10cSrcweir { 1050*cdf0e10cSrcweir DBG_ASSERT(nLevel < SVX_MAX_NUM, "falsches Level" ); 1051*cdf0e10cSrcweir 1052*cdf0e10cSrcweir if( nLevel < SVX_MAX_NUM ) 1053*cdf0e10cSrcweir { 1054*cdf0e10cSrcweir aFmtsSet[nLevel] = 0 != pFmt; 1055*cdf0e10cSrcweir if(pFmt) 1056*cdf0e10cSrcweir SetLevel(nLevel, *pFmt); 1057*cdf0e10cSrcweir else 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir delete aFmts[nLevel]; 1060*cdf0e10cSrcweir aFmts[nLevel] = 0; 1061*cdf0e10cSrcweir } 1062*cdf0e10cSrcweir } 1063*cdf0e10cSrcweir } 1064*cdf0e10cSrcweir /* -----------------28.10.98 15:38------------------- 1065*cdf0e10cSrcweir * 1066*cdf0e10cSrcweir * --------------------------------------------------*/ 1067*cdf0e10cSrcweir String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings ) const 1068*cdf0e10cSrcweir { 1069*cdf0e10cSrcweir String aStr; 1070*cdf0e10cSrcweir if( SVX_NO_NUM > rNum.GetLevel() && !( SVX_NO_NUMLEVEL & rNum.GetLevel() ) ) 1071*cdf0e10cSrcweir { 1072*cdf0e10cSrcweir const SvxNumberFormat& rMyNFmt = GetLevel( rNum.GetLevel() ); 1073*cdf0e10cSrcweir if( SVX_NUM_NUMBER_NONE != rMyNFmt.GetNumberingType() ) 1074*cdf0e10cSrcweir { 1075*cdf0e10cSrcweir sal_uInt8 i = rNum.GetLevel(); 1076*cdf0e10cSrcweir 1077*cdf0e10cSrcweir if( !IsContinuousNumbering() && 1078*cdf0e10cSrcweir 1 < rMyNFmt.GetIncludeUpperLevels() ) // nur der eigene Level ? 1079*cdf0e10cSrcweir { 1080*cdf0e10cSrcweir sal_uInt8 n = rMyNFmt.GetIncludeUpperLevels(); 1081*cdf0e10cSrcweir if( 1 < n ) 1082*cdf0e10cSrcweir { 1083*cdf0e10cSrcweir if( i+1 >= n ) 1084*cdf0e10cSrcweir i -= n - 1; 1085*cdf0e10cSrcweir else 1086*cdf0e10cSrcweir i = 0; 1087*cdf0e10cSrcweir } 1088*cdf0e10cSrcweir } 1089*cdf0e10cSrcweir 1090*cdf0e10cSrcweir for( ; i <= rNum.GetLevel(); ++i ) 1091*cdf0e10cSrcweir { 1092*cdf0e10cSrcweir const SvxNumberFormat& rNFmt = GetLevel( i ); 1093*cdf0e10cSrcweir if( SVX_NUM_NUMBER_NONE == rNFmt.GetNumberingType() ) 1094*cdf0e10cSrcweir { 1095*cdf0e10cSrcweir // Soll aus 1.1.1 --> 2. NoNum --> 1..1 oder 1.1 ?? 1096*cdf0e10cSrcweir // if( i != rNum.nMyLevel ) 1097*cdf0e10cSrcweir // aStr += aDotStr; 1098*cdf0e10cSrcweir continue; 1099*cdf0e10cSrcweir } 1100*cdf0e10cSrcweir 1101*cdf0e10cSrcweir sal_Bool bDot = sal_True; 1102*cdf0e10cSrcweir if( rNum.GetLevelVal()[ i ] ) 1103*cdf0e10cSrcweir { 1104*cdf0e10cSrcweir if(SVX_NUM_BITMAP != rNFmt.GetNumberingType()) 1105*cdf0e10cSrcweir aStr += rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], aLocale ); 1106*cdf0e10cSrcweir else 1107*cdf0e10cSrcweir bDot = sal_False; 1108*cdf0e10cSrcweir } 1109*cdf0e10cSrcweir else 1110*cdf0e10cSrcweir aStr += sal_Unicode('0'); // alle 0-Level sind eine 0 1111*cdf0e10cSrcweir if( i != rNum.GetLevel() && bDot) 1112*cdf0e10cSrcweir aStr += sal_Unicode('.'); 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir } 1115*cdf0e10cSrcweir 1116*cdf0e10cSrcweir if( bInclStrings ) 1117*cdf0e10cSrcweir { 1118*cdf0e10cSrcweir aStr.Insert( rMyNFmt.GetPrefix(), 0 ); 1119*cdf0e10cSrcweir aStr += rMyNFmt.GetSuffix(); 1120*cdf0e10cSrcweir } 1121*cdf0e10cSrcweir } 1122*cdf0e10cSrcweir return aStr; 1123*cdf0e10cSrcweir } 1124*cdf0e10cSrcweir /* -----------------18.08.99 10:18------------------- 1125*cdf0e10cSrcweir Description: changes linked to embedded bitmaps 1126*cdf0e10cSrcweir --------------------------------------------------*/ 1127*cdf0e10cSrcweir sal_Bool SvxNumRule::UnLinkGraphics() 1128*cdf0e10cSrcweir { 1129*cdf0e10cSrcweir sal_Bool bRet = sal_False; 1130*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < GetLevelCount(); i++) 1131*cdf0e10cSrcweir { 1132*cdf0e10cSrcweir SvxNumberFormat aFmt(GetLevel(i)); 1133*cdf0e10cSrcweir const SvxBrushItem* pBrush = aFmt.GetBrush(); 1134*cdf0e10cSrcweir const String* pLinkStr; 1135*cdf0e10cSrcweir const Graphic* pGraphic; 1136*cdf0e10cSrcweir if(SVX_NUM_BITMAP == aFmt.GetNumberingType()) 1137*cdf0e10cSrcweir { 1138*cdf0e10cSrcweir if(pBrush && 1139*cdf0e10cSrcweir 0 != (pLinkStr = pBrush->GetGraphicLink()) && 1140*cdf0e10cSrcweir pLinkStr->Len() && 1141*cdf0e10cSrcweir 0 !=(pGraphic = pBrush->GetGraphic())) 1142*cdf0e10cSrcweir { 1143*cdf0e10cSrcweir SvxBrushItem aTempItem(*pBrush); 1144*cdf0e10cSrcweir aTempItem.SetGraphicLink( String()); 1145*cdf0e10cSrcweir aTempItem.SetGraphic(*pGraphic); 1146*cdf0e10cSrcweir sal_Int16 eOrient = aFmt.GetVertOrient(); 1147*cdf0e10cSrcweir aFmt.SetGraphicBrush( &aTempItem, &aFmt.GetGraphicSize(), &eOrient ); 1148*cdf0e10cSrcweir bRet = sal_True; 1149*cdf0e10cSrcweir } 1150*cdf0e10cSrcweir } 1151*cdf0e10cSrcweir else if((SVX_NUM_BITMAP|LINK_TOKEN) == aFmt.GetNumberingType()) 1152*cdf0e10cSrcweir aFmt.SetNumberingType(SVX_NUM_BITMAP); 1153*cdf0e10cSrcweir SetLevel(i, aFmt); 1154*cdf0e10cSrcweir } 1155*cdf0e10cSrcweir return bRet; 1156*cdf0e10cSrcweir } 1157*cdf0e10cSrcweir 1158*cdf0e10cSrcweir /* -----------------27.10.98 10:41------------------- 1159*cdf0e10cSrcweir * 1160*cdf0e10cSrcweir * --------------------------------------------------*/ 1161*cdf0e10cSrcweir SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule) : 1162*cdf0e10cSrcweir SfxPoolItem(SID_ATTR_NUMBERING_RULE), 1163*cdf0e10cSrcweir pNumRule(new SvxNumRule(rRule)) 1164*cdf0e10cSrcweir { 1165*cdf0e10cSrcweir } 1166*cdf0e10cSrcweir 1167*cdf0e10cSrcweir /*-----------------23.11.98 10:36------------------- 1168*cdf0e10cSrcweir MT: Das sind ja sehr sinnige Kommentare... 1169*cdf0e10cSrcweir --------------------------------------------------*/ 1170*cdf0e10cSrcweir SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 _nWhich ) : 1171*cdf0e10cSrcweir SfxPoolItem(_nWhich), 1172*cdf0e10cSrcweir pNumRule(new SvxNumRule(rRule)) 1173*cdf0e10cSrcweir { 1174*cdf0e10cSrcweir } 1175*cdf0e10cSrcweir 1176*cdf0e10cSrcweir SfxPoolItem* SvxNumBulletItem::Create(SvStream &s, sal_uInt16 n) const 1177*cdf0e10cSrcweir { 1178*cdf0e10cSrcweir return SfxPoolItem::Create(s, n ); 1179*cdf0e10cSrcweir } 1180*cdf0e10cSrcweir 1181*cdf0e10cSrcweir /* -----------------27.10.98 10:41------------------- 1182*cdf0e10cSrcweir * 1183*cdf0e10cSrcweir * --------------------------------------------------*/ 1184*cdf0e10cSrcweir SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) : 1185*cdf0e10cSrcweir SfxPoolItem(rCopy.Which()) 1186*cdf0e10cSrcweir { 1187*cdf0e10cSrcweir pNumRule = new SvxNumRule(*rCopy.pNumRule); 1188*cdf0e10cSrcweir } 1189*cdf0e10cSrcweir /* -----------------27.10.98 10:41------------------- 1190*cdf0e10cSrcweir * 1191*cdf0e10cSrcweir * --------------------------------------------------*/ 1192*cdf0e10cSrcweir SvxNumBulletItem::~SvxNumBulletItem() 1193*cdf0e10cSrcweir { 1194*cdf0e10cSrcweir delete pNumRule; 1195*cdf0e10cSrcweir } 1196*cdf0e10cSrcweir 1197*cdf0e10cSrcweir /* -----------------27.10.98 10:41------------------- 1198*cdf0e10cSrcweir * 1199*cdf0e10cSrcweir * --------------------------------------------------*/ 1200*cdf0e10cSrcweir int SvxNumBulletItem::operator==( const SfxPoolItem& rCopy) const 1201*cdf0e10cSrcweir { 1202*cdf0e10cSrcweir return *pNumRule == *((SvxNumBulletItem&)rCopy).pNumRule; 1203*cdf0e10cSrcweir } 1204*cdf0e10cSrcweir /* -----------------27.10.98 10:41------------------- 1205*cdf0e10cSrcweir * 1206*cdf0e10cSrcweir * --------------------------------------------------*/ 1207*cdf0e10cSrcweir SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const 1208*cdf0e10cSrcweir { 1209*cdf0e10cSrcweir return new SvxNumBulletItem(*this); 1210*cdf0e10cSrcweir } 1211*cdf0e10cSrcweir /* -----------------08.12.98 10:43------------------- 1212*cdf0e10cSrcweir * 1213*cdf0e10cSrcweir * --------------------------------------------------*/ 1214*cdf0e10cSrcweir sal_uInt16 SvxNumBulletItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const 1215*cdf0e10cSrcweir { 1216*cdf0e10cSrcweir return NUMITEM_VERSION_03; 1217*cdf0e10cSrcweir } 1218*cdf0e10cSrcweir /* -----------------08.12.98 10:43------------------- 1219*cdf0e10cSrcweir * 1220*cdf0e10cSrcweir * --------------------------------------------------*/ 1221*cdf0e10cSrcweir SvStream& SvxNumBulletItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/ )const 1222*cdf0e10cSrcweir { 1223*cdf0e10cSrcweir pNumRule->Store(rStream); 1224*cdf0e10cSrcweir return rStream; 1225*cdf0e10cSrcweir } 1226*cdf0e10cSrcweir 1227*cdf0e10cSrcweir /* -----------------08.12.98 10:43------------------- 1228*cdf0e10cSrcweir * 1229*cdf0e10cSrcweir * --------------------------------------------------*/ 1230*cdf0e10cSrcweir 1231*cdf0e10cSrcweir sal_Bool SvxNumBulletItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const 1232*cdf0e10cSrcweir { 1233*cdf0e10cSrcweir rVal <<= SvxCreateNumRule( pNumRule ); 1234*cdf0e10cSrcweir return sal_True; 1235*cdf0e10cSrcweir } 1236*cdf0e10cSrcweir 1237*cdf0e10cSrcweir sal_Bool SvxNumBulletItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) 1238*cdf0e10cSrcweir { 1239*cdf0e10cSrcweir uno::Reference< container::XIndexReplace > xRule; 1240*cdf0e10cSrcweir if( rVal >>= xRule ) 1241*cdf0e10cSrcweir { 1242*cdf0e10cSrcweir try 1243*cdf0e10cSrcweir { 1244*cdf0e10cSrcweir SvxNumRule* pNewRule = new SvxNumRule( SvxGetNumRule( xRule ) ); 1245*cdf0e10cSrcweir if( pNewRule->GetLevelCount() != pNumRule->GetLevelCount() || 1246*cdf0e10cSrcweir pNewRule->GetNumRuleType() != pNumRule->GetNumRuleType() ) 1247*cdf0e10cSrcweir { 1248*cdf0e10cSrcweir SvxNumRule* pConverted = SvxConvertNumRule( pNewRule, pNumRule->GetLevelCount(), pNumRule->GetNumRuleType() ); 1249*cdf0e10cSrcweir delete pNewRule; 1250*cdf0e10cSrcweir pNewRule = pConverted; 1251*cdf0e10cSrcweir } 1252*cdf0e10cSrcweir delete pNumRule; 1253*cdf0e10cSrcweir pNumRule = pNewRule; 1254*cdf0e10cSrcweir return sal_True; 1255*cdf0e10cSrcweir } 1256*cdf0e10cSrcweir catch(lang::IllegalArgumentException&) 1257*cdf0e10cSrcweir { 1258*cdf0e10cSrcweir } 1259*cdf0e10cSrcweir } 1260*cdf0e10cSrcweir return sal_False; 1261*cdf0e10cSrcweir } 1262*cdf0e10cSrcweir 1263*cdf0e10cSrcweir /* -----------------08.12.98 10:43------------------- 1264*cdf0e10cSrcweir * 1265*cdf0e10cSrcweir * --------------------------------------------------*/ 1266*cdf0e10cSrcweir SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevels, SvxNumRuleType eType ) 1267*cdf0e10cSrcweir { 1268*cdf0e10cSrcweir const sal_uInt16 nSrcLevels = pRule->GetLevelCount(); 1269*cdf0e10cSrcweir SvxNumRule* pNewRule = new SvxNumRule( pRule->GetFeatureFlags(), nLevels, pRule->IsContinuousNumbering(), eType ); 1270*cdf0e10cSrcweir 1271*cdf0e10cSrcweir for( sal_uInt16 nLevel = 0; (nLevel < nLevels) && (nLevel < nSrcLevels); nLevel++ ) 1272*cdf0e10cSrcweir pNewRule->SetLevel( nLevel, pRule->GetLevel( nLevel ) ); 1273*cdf0e10cSrcweir 1274*cdf0e10cSrcweir return pNewRule; 1275*cdf0e10cSrcweir } 1276