1*766ce4d0SZheng Fan /************************************************************************* 2*766ce4d0SZheng Fan * 3*766ce4d0SZheng Fan * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*766ce4d0SZheng Fan * 5*766ce4d0SZheng Fan * Copyright IBM Corporation 2009. 6*766ce4d0SZheng Fan * Copyright 2009. by Sun Microsystems, Inc. 7*766ce4d0SZheng Fan * 8*766ce4d0SZheng Fan * OpenOffice.org - a multi-platform office productivity suite 9*766ce4d0SZheng Fan * 10*766ce4d0SZheng Fan * $RCSfile: nbdtmg.cxx,v $ 11*766ce4d0SZheng Fan * $Revision: 1.00.00.0 $ 12*766ce4d0SZheng Fan * 13*766ce4d0SZheng Fan * This file is part of OpenOffice.org. 14*766ce4d0SZheng Fan * 15*766ce4d0SZheng Fan * OpenOffice.org is free software: you can redistribute it and/or modify 16*766ce4d0SZheng Fan * it under the terms of the GNU Lesser General Public License version 3 17*766ce4d0SZheng Fan * only, as published by the Free Software Foundation. 18*766ce4d0SZheng Fan * 19*766ce4d0SZheng Fan * OpenOffice.org is distributed in the hope that it will be useful, 20*766ce4d0SZheng Fan * but WITHOUT ANY WARRANTY; without even the implied warranty of 21*766ce4d0SZheng Fan * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22*766ce4d0SZheng Fan * GNU Lesser General Public License version 3 for more details 23*766ce4d0SZheng Fan * (a copy is included in the LICENSE file that accompanied this code). 24*766ce4d0SZheng Fan * 25*766ce4d0SZheng Fan * You should have received a copy of the GNU Lesser General Public License 26*766ce4d0SZheng Fan * version 3 along with OpenOffice.org. If not, see 27*766ce4d0SZheng Fan * <http://www.openoffice.org/license.html> 28*766ce4d0SZheng Fan * for a copy of the LGPLv3 License. 29*766ce4d0SZheng Fan * 30*766ce4d0SZheng Fan ************************************************************************/ 31*766ce4d0SZheng Fan 32*766ce4d0SZheng Fan /*********************************************************************** 33*766ce4d0SZheng Fan * 34*766ce4d0SZheng Fan * Tool to Visualize Internal Data Structure for Productive Development 35*766ce4d0SZheng Fan * It is a developer's tool from Lotus Symphony Documents Editor Team 36*766ce4d0SZheng Fan * 37*766ce4d0SZheng Fan * This file provides developers of OpenOffice.org a visualize tool for tracing 38*766ce4d0SZheng Fan * the internal data structure and its parameters. 39*766ce4d0SZheng Fan * 40*766ce4d0SZheng Fan * Date: 05/25/2009 41*766ce4d0SZheng Fan * 42*766ce4d0SZheng Fan ***********************************************************************/ 43*766ce4d0SZheng Fan #include "precompiled_svx.hxx" 44*766ce4d0SZheng Fan #ifndef _NBDTMG_HXX 45*766ce4d0SZheng Fan #include <svx/nbdtmg.hxx> 46*766ce4d0SZheng Fan #endif 47*766ce4d0SZheng Fan #ifndef _SVX_SVXIDS_HRC 48*766ce4d0SZheng Fan #include <svx/svxids.hrc> 49*766ce4d0SZheng Fan #endif 50*766ce4d0SZheng Fan #ifndef _SV_SVAPP_HXX 51*766ce4d0SZheng Fan #include <vcl/svapp.hxx> 52*766ce4d0SZheng Fan #endif 53*766ce4d0SZheng Fan #ifndef _SFXITEMSET_HXX 54*766ce4d0SZheng Fan #include <svl/itemset.hxx> 55*766ce4d0SZheng Fan #endif 56*766ce4d0SZheng Fan #ifndef _SFXREQUEST_HXX 57*766ce4d0SZheng Fan #include <sfx2/request.hxx> 58*766ce4d0SZheng Fan #endif 59*766ce4d0SZheng Fan #ifndef _SFXSTRITEM_HXX 60*766ce4d0SZheng Fan #include <svl/stritem.hxx> 61*766ce4d0SZheng Fan #endif 62*766ce4d0SZheng Fan #ifndef _UNO_LINGU_HXX 63*766ce4d0SZheng Fan #include <editeng/unolingu.hxx> 64*766ce4d0SZheng Fan #endif 65*766ce4d0SZheng Fan #ifndef _CTRLTOOL_HXX 66*766ce4d0SZheng Fan #include <svtools/ctrltool.hxx> 67*766ce4d0SZheng Fan #endif 68*766ce4d0SZheng Fan #ifndef _SFX_OBJSH_HXX 69*766ce4d0SZheng Fan #include <sfx2/objsh.hxx> 70*766ce4d0SZheng Fan #endif 71*766ce4d0SZheng Fan #ifndef _SVX_FLSTITEM_HXX 72*766ce4d0SZheng Fan #include <editeng/flstitem.hxx> 73*766ce4d0SZheng Fan #endif 74*766ce4d0SZheng Fan #ifndef _SFXITEMPOOL_HXX 75*766ce4d0SZheng Fan #include <svl/itempool.hxx> 76*766ce4d0SZheng Fan #endif 77*766ce4d0SZheng Fan #ifndef _SV_OUTDEV_HXX 78*766ce4d0SZheng Fan #include <vcl/outdev.hxx> 79*766ce4d0SZheng Fan #endif 80*766ce4d0SZheng Fan #ifndef _GALLERY_HXX_ 81*766ce4d0SZheng Fan #include <svx/gallery.hxx> 82*766ce4d0SZheng Fan #endif 83*766ce4d0SZheng Fan #ifndef _SVX_BRSHITEM_HXX 84*766ce4d0SZheng Fan #include <editeng/brshitem.hxx> 85*766ce4d0SZheng Fan #endif 86*766ce4d0SZheng Fan #include <svx/dialmgr.hxx> 87*766ce4d0SZheng Fan #ifndef _SVX_DIALOGS_HRC 88*766ce4d0SZheng Fan #include <svx/dialogs.hrc> 89*766ce4d0SZheng Fan #endif 90*766ce4d0SZheng Fan #ifndef _SV_GRAPH_HXX 91*766ce4d0SZheng Fan #include <vcl/graph.hxx> 92*766ce4d0SZheng Fan #endif 93*766ce4d0SZheng Fan 94*766ce4d0SZheng Fan #include <unotools/streamwrap.hxx> 95*766ce4d0SZheng Fan #include <unotools/ucbstreamhelper.hxx> 96*766ce4d0SZheng Fan #include <unotools/pathoptions.hxx> 97*766ce4d0SZheng Fan //#include <svtools/pathoptions.hxx> 98*766ce4d0SZheng Fan #include <editeng/eeitem.hxx> 99*766ce4d0SZheng Fan 100*766ce4d0SZheng Fan #include <com/sun/star/text/HoriOrientation.hpp> 101*766ce4d0SZheng Fan #include <com/sun/star/text/VertOrientation.hpp> 102*766ce4d0SZheng Fan #include <com/sun/star/text/RelOrientation.hpp> 103*766ce4d0SZheng Fan #include <com/sun/star/style/NumberingType.hpp> 104*766ce4d0SZheng Fan #include <com/sun/star/lang/XMultiServiceFactory.hpp> 105*766ce4d0SZheng Fan #include <com/sun/star/container/XIndexAccess.hpp> 106*766ce4d0SZheng Fan #include <com/sun/star/text/XDefaultNumberingProvider.hpp> 107*766ce4d0SZheng Fan #include <com/sun/star/text/XNumberingFormatter.hpp> 108*766ce4d0SZheng Fan #include <com/sun/star/beans/PropertyValue.hpp> 109*766ce4d0SZheng Fan #include <comphelper/processfactory.hxx> 110*766ce4d0SZheng Fan #include <com/sun/star/text/XNumberingTypeInfo.hpp> 111*766ce4d0SZheng Fan 112*766ce4d0SZheng Fan using namespace com::sun::star; 113*766ce4d0SZheng Fan using namespace com::sun::star::uno; 114*766ce4d0SZheng Fan using namespace com::sun::star::beans; 115*766ce4d0SZheng Fan using namespace com::sun::star::lang; 116*766ce4d0SZheng Fan using namespace com::sun::star::text; 117*766ce4d0SZheng Fan using namespace com::sun::star::container; 118*766ce4d0SZheng Fan using namespace com::sun::star::style; 119*766ce4d0SZheng Fan using rtl::OUString; 120*766ce4d0SZheng Fan 121*766ce4d0SZheng Fan namespace svx { namespace sidebar { 122*766ce4d0SZheng Fan #define NUM_TYPE_MEMBER 4 123*766ce4d0SZheng Fan #define NUM_VALUSET_COUNT 16 124*766ce4d0SZheng Fan #define MAX_VALUESET_GRAPHIC 30 125*766ce4d0SZheng Fan 126*766ce4d0SZheng Fan typedef NumSettings_Impl* NumSettings_ImplPtr; 127*766ce4d0SZheng Fan SV_DECL_PTRARR_DEL(NumSettingsArr_Impl,NumSettings_ImplPtr,8,4) 128*766ce4d0SZheng Fan SV_IMPL_PTRARR( NumSettingsArr_Impl, NumSettings_ImplPtr ) 129*766ce4d0SZheng Fan 130*766ce4d0SZheng Fan typedef NumberSettings_Impl* NumberSettings_ImplPtr; 131*766ce4d0SZheng Fan SV_DECL_PTRARR_DEL(NumberSettingsArr_Impl,NumberSettings_ImplPtr,8,4) 132*766ce4d0SZheng Fan SV_IMPL_PTRARR( NumberSettingsArr_Impl, NumberSettings_ImplPtr ) 133*766ce4d0SZheng Fan 134*766ce4d0SZheng Fan //extern Font& lcl_GetDefaultBulletFont(); 135*766ce4d0SZheng Fan Font& lcl_GetDefaultBulletFont() 136*766ce4d0SZheng Fan { 137*766ce4d0SZheng Fan static sal_Bool bInit = 0; 138*766ce4d0SZheng Fan static Font aDefBulletFont( UniString::CreateFromAscii( 139*766ce4d0SZheng Fan RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ), 140*766ce4d0SZheng Fan String(), Size( 0, 14 ) ); 141*766ce4d0SZheng Fan if(!bInit) 142*766ce4d0SZheng Fan { 143*766ce4d0SZheng Fan aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); 144*766ce4d0SZheng Fan aDefBulletFont.SetFamily( FAMILY_DONTKNOW ); 145*766ce4d0SZheng Fan aDefBulletFont.SetPitch( PITCH_DONTKNOW ); 146*766ce4d0SZheng Fan aDefBulletFont.SetWeight( WEIGHT_DONTKNOW ); 147*766ce4d0SZheng Fan aDefBulletFont.SetTransparent( sal_True ); 148*766ce4d0SZheng Fan bInit = sal_True; 149*766ce4d0SZheng Fan } 150*766ce4d0SZheng Fan return aDefBulletFont; 151*766ce4d0SZheng Fan } 152*766ce4d0SZheng Fan 153*766ce4d0SZheng Fan static const sal_Unicode aDefaultBulletTypes[] = 154*766ce4d0SZheng Fan { 155*766ce4d0SZheng Fan 0x2022, 156*766ce4d0SZheng Fan 0x25cf, 157*766ce4d0SZheng Fan 0xe00c, 158*766ce4d0SZheng Fan 0xe00a, 159*766ce4d0SZheng Fan 0x2794, 160*766ce4d0SZheng Fan 0x27a2, 161*766ce4d0SZheng Fan 0x2717, 162*766ce4d0SZheng Fan 0x2714 163*766ce4d0SZheng Fan }; 164*766ce4d0SZheng Fan 165*766ce4d0SZheng Fan static const sal_Unicode aDefaultRTLBulletTypes[] = 166*766ce4d0SZheng Fan { 167*766ce4d0SZheng Fan 0x2022, 168*766ce4d0SZheng Fan 0x25cf, 169*766ce4d0SZheng Fan 0xe00c, 170*766ce4d0SZheng Fan 0xe00a, 171*766ce4d0SZheng Fan 0x25c4, 172*766ce4d0SZheng Fan 0x272b, 173*766ce4d0SZheng Fan 0x2717, 174*766ce4d0SZheng Fan 0x2714 175*766ce4d0SZheng Fan }; 176*766ce4d0SZheng Fan 177*766ce4d0SZheng Fan static const sal_Char sNumberingType[] = "NumberingType"; 178*766ce4d0SZheng Fan static const sal_Char sValue[] = "Value"; 179*766ce4d0SZheng Fan static const sal_Char sParentNumbering[] = "ParentNumbering"; 180*766ce4d0SZheng Fan static const sal_Char sPrefix[] = "Prefix"; 181*766ce4d0SZheng Fan static const sal_Char sSuffix[] = "Suffix"; 182*766ce4d0SZheng Fan static const sal_Char sBulletChar[] = "BulletChar"; 183*766ce4d0SZheng Fan static const sal_Char sBulletFontName[] = "BulletFontName"; 184*766ce4d0SZheng Fan 185*766ce4d0SZheng Fan NumSettings_ImplPtr lcl_CreateNumberingSettingsPtr(const Sequence<PropertyValue>& rLevelProps) 186*766ce4d0SZheng Fan { 187*766ce4d0SZheng Fan const PropertyValue* pValues = rLevelProps.getConstArray(); 188*766ce4d0SZheng Fan NumSettings_ImplPtr pNew = new NumSettings_Impl; 189*766ce4d0SZheng Fan for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++) 190*766ce4d0SZheng Fan { 191*766ce4d0SZheng Fan if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNumberingType))) 192*766ce4d0SZheng Fan pValues[j].Value >>= pNew->nNumberType; 193*766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPrefix))) 194*766ce4d0SZheng Fan pValues[j].Value >>= pNew->sPrefix; 195*766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuffix))) 196*766ce4d0SZheng Fan pValues[j].Value >>= pNew->sSuffix; 197*766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sParentNumbering))) 198*766ce4d0SZheng Fan pValues[j].Value >>= pNew->nParentNumbering; 199*766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletChar))) 200*766ce4d0SZheng Fan pValues[j].Value >>= pNew->sBulletChar; 201*766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletFontName))) 202*766ce4d0SZheng Fan pValues[j].Value >>= pNew->sBulletFont; 203*766ce4d0SZheng Fan } 204*766ce4d0SZheng Fan const sal_Unicode cLocalPrefix = pNew->sPrefix.getLength() ? pNew->sPrefix.getStr()[0] : 0; 205*766ce4d0SZheng Fan const sal_Unicode cLocalSuffix = pNew->sSuffix.getLength() ? pNew->sSuffix.getStr()[0] : 0; 206*766ce4d0SZheng Fan String aEmptyStr; 207*766ce4d0SZheng Fan if( cLocalPrefix == ' ') pNew->sPrefix=aEmptyStr; 208*766ce4d0SZheng Fan if( cLocalSuffix == ' ') pNew->sSuffix=aEmptyStr; 209*766ce4d0SZheng Fan return pNew; 210*766ce4d0SZheng Fan } 211*766ce4d0SZheng Fan 212*766ce4d0SZheng Fan sal_uInt16 NBOTypeMgrBase:: IsSingleLevel(sal_uInt16 nCurLevel) 213*766ce4d0SZheng Fan { 214*766ce4d0SZheng Fan sal_uInt16 nLv = (sal_uInt16)0xFFFF; 215*766ce4d0SZheng Fan sal_uInt16 nCount = 0; 216*766ce4d0SZheng Fan sal_uInt16 nMask = 1; 217*766ce4d0SZheng Fan for( sal_uInt16 i = 0; i < SVX_MAX_NUM; i++ ) 218*766ce4d0SZheng Fan { 219*766ce4d0SZheng Fan if(nCurLevel & nMask) 220*766ce4d0SZheng Fan { 221*766ce4d0SZheng Fan nCount++; 222*766ce4d0SZheng Fan nLv=i; 223*766ce4d0SZheng Fan } 224*766ce4d0SZheng Fan nMask <<= 1 ; 225*766ce4d0SZheng Fan } 226*766ce4d0SZheng Fan 227*766ce4d0SZheng Fan if ( nCount == 1) 228*766ce4d0SZheng Fan return nLv; 229*766ce4d0SZheng Fan else 230*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 231*766ce4d0SZheng Fan } 232*766ce4d0SZheng Fan 233*766ce4d0SZheng Fan void NBOTypeMgrBase::StoreBulCharFmtName_impl() { 234*766ce4d0SZheng Fan if ( pSet ) 235*766ce4d0SZheng Fan { 236*766ce4d0SZheng Fan SfxAllItemSet aSet(*pSet); 237*766ce4d0SZheng Fan //const SfxPoolItem* pItem; 238*766ce4d0SZheng Fan SFX_ITEMSET_ARG(&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); 239*766ce4d0SZheng Fan //if(SFX_ITEM_SET == pSet->GetItemState(SID_BULLET_CHAR_FMT, sal_False, &pItem)) 240*766ce4d0SZheng Fan // pNumCharFmtName = new String(((const SfxStringItem*)pItem)->GetValue()); 241*766ce4d0SZheng Fan 242*766ce4d0SZheng Fan //const SfxStringItem* pBulletCharFmt = (const SfxStringItem*)(pSet->GetItem(SID_BULLET_CHAR_FMT)); 243*766ce4d0SZheng Fan 244*766ce4d0SZheng Fan if ( pBulletCharFmt ) 245*766ce4d0SZheng Fan { 246*766ce4d0SZheng Fan aNumCharFmtName = String(pBulletCharFmt->GetValue()); 247*766ce4d0SZheng Fan } 248*766ce4d0SZheng Fan } 249*766ce4d0SZheng Fan } 250*766ce4d0SZheng Fan String NBOTypeMgrBase::GetBulCharFmtName() 251*766ce4d0SZheng Fan { 252*766ce4d0SZheng Fan return aNumCharFmtName; 253*766ce4d0SZheng Fan } 254*766ce4d0SZheng Fan void NBOTypeMgrBase::ImplLoad(String filename) 255*766ce4d0SZheng Fan { 256*766ce4d0SZheng Fan bIsLoading = true; 257*766ce4d0SZheng Fan //Sym3_2508 store size with stardard unit 258*766ce4d0SZheng Fan SfxMapUnit eOldCoreUnit=eCoreUnit; 259*766ce4d0SZheng Fan eCoreUnit = SFX_MAPUNIT_100TH_MM; 260*766ce4d0SZheng Fan INetURLObject aFile( SvtPathOptions().GetPalettePath() ); 261*766ce4d0SZheng Fan aFile.Append( filename); 262*766ce4d0SZheng Fan SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); 263*766ce4d0SZheng Fan if( pIStm ) { 264*766ce4d0SZheng Fan sal_uInt32 nVersion; 265*766ce4d0SZheng Fan sal_Int32 nNumIndex; 266*766ce4d0SZheng Fan *pIStm >> nVersion; 267*766ce4d0SZheng Fan if (nVersion==DEFAULT_NUMBERING_CACHE_FORMAT_VERSION) //first version 268*766ce4d0SZheng Fan { 269*766ce4d0SZheng Fan *pIStm >> nNumIndex; 270*766ce4d0SZheng Fan sal_uInt16 mLevel = 0x1; 271*766ce4d0SZheng Fan while (nNumIndex>=0 && nNumIndex<DEFAULT_NUM_VALUSET_COUNT) { 272*766ce4d0SZheng Fan SvxNumRule aNum(*pIStm); 273*766ce4d0SZheng Fan //bullet color in font properties is not stored correctly. Need set tranparency bits manually 274*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 275*766ce4d0SZheng Fan { 276*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 277*766ce4d0SZheng Fan if (aFmt.GetBulletFont()) { 278*766ce4d0SZheng Fan Font aFont(*aFmt.GetBulletFont()); 279*766ce4d0SZheng Fan Color c=aFont.GetColor(); 280*766ce4d0SZheng Fan c.SetTransparency(0xFF); 281*766ce4d0SZheng Fan aFont.SetColor(c); 282*766ce4d0SZheng Fan aFmt.SetBulletFont(&aFont); 283*766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 284*766ce4d0SZheng Fan } 285*766ce4d0SZheng Fan } 286*766ce4d0SZheng Fan RelplaceNumRule(aNum,nNumIndex,mLevel); 287*766ce4d0SZheng Fan *pIStm >> nNumIndex; 288*766ce4d0SZheng Fan } 289*766ce4d0SZheng Fan delete pIStm; 290*766ce4d0SZheng Fan } 291*766ce4d0SZheng Fan } 292*766ce4d0SZheng Fan eCoreUnit = eOldCoreUnit; 293*766ce4d0SZheng Fan bIsLoading = false; 294*766ce4d0SZheng Fan } 295*766ce4d0SZheng Fan void NBOTypeMgrBase::ImplStore(String filename) 296*766ce4d0SZheng Fan { 297*766ce4d0SZheng Fan if (bIsLoading) return; 298*766ce4d0SZheng Fan //Sym3_2508 store size with stardard unit 299*766ce4d0SZheng Fan SfxMapUnit eOldCoreUnit=eCoreUnit; 300*766ce4d0SZheng Fan eCoreUnit = SFX_MAPUNIT_100TH_MM; 301*766ce4d0SZheng Fan INetURLObject aFile( SvtPathOptions().GetPalettePath() ); 302*766ce4d0SZheng Fan aFile.Append( filename); 303*766ce4d0SZheng Fan SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE ); 304*766ce4d0SZheng Fan if( pOStm ) { 305*766ce4d0SZheng Fan sal_uInt32 nVersion; 306*766ce4d0SZheng Fan sal_Int32 nNumIndex; 307*766ce4d0SZheng Fan nVersion = DEFAULT_NUMBERING_CACHE_FORMAT_VERSION; 308*766ce4d0SZheng Fan *pOStm << nVersion; 309*766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) { 310*766ce4d0SZheng Fan if (IsCustomized(nItem)) { 311*766ce4d0SZheng Fan SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , 312*766ce4d0SZheng Fan SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); 313*766ce4d0SZheng Fan sal_uInt16 mLevel = 0x1; 314*766ce4d0SZheng Fan *pOStm << nItem; 315*766ce4d0SZheng Fan ApplyNumRule(aDefNumRule,nItem,mLevel,false,true); 316*766ce4d0SZheng Fan aDefNumRule.Store(*pOStm); 317*766ce4d0SZheng Fan } 318*766ce4d0SZheng Fan } 319*766ce4d0SZheng Fan nNumIndex = -1; 320*766ce4d0SZheng Fan *pOStm << nNumIndex; //write end flag 321*766ce4d0SZheng Fan delete pOStm; 322*766ce4d0SZheng Fan } 323*766ce4d0SZheng Fan eCoreUnit = eOldCoreUnit; 324*766ce4d0SZheng Fan } 325*766ce4d0SZheng Fan 326*766ce4d0SZheng Fan void NBOTypeMgrBase::StoreMapUnit_impl() { 327*766ce4d0SZheng Fan if ( pSet ) 328*766ce4d0SZheng Fan { 329*766ce4d0SZheng Fan const SfxPoolItem* pItem; 330*766ce4d0SZheng Fan SfxItemState eState = pSet->GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); 331*766ce4d0SZheng Fan if(eState == SFX_ITEM_SET) 332*766ce4d0SZheng Fan { 333*766ce4d0SZheng Fan eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); 334*766ce4d0SZheng Fan } else { 335*766ce4d0SZheng Fan //Sym3_2508 sd use different sid for numbering rule 336*766ce4d0SZheng Fan eState = pSet->GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem); 337*766ce4d0SZheng Fan if(eState == SFX_ITEM_SET) 338*766ce4d0SZheng Fan { 339*766ce4d0SZheng Fan eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(EE_PARA_NUMBULLET)); 340*766ce4d0SZheng Fan } 341*766ce4d0SZheng Fan } 342*766ce4d0SZheng Fan } 343*766ce4d0SZheng Fan } 344*766ce4d0SZheng Fan SfxMapUnit NBOTypeMgrBase::GetMapUnit() 345*766ce4d0SZheng Fan { 346*766ce4d0SZheng Fan return eCoreUnit; 347*766ce4d0SZheng Fan } 348*766ce4d0SZheng Fan /*************************************************************************************************** 349*766ce4d0SZheng Fan **********************Character Bullet Type lib********************************************************** 350*766ce4d0SZheng Fan ****************************************************************************************************/ 351*766ce4d0SZheng Fan BulletsTypeMgr* BulletsTypeMgr::_instance = 0; 352*766ce4d0SZheng Fan BulletsSettings_Impl* BulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0}; 353*766ce4d0SZheng Fan sal_Unicode BulletsTypeMgr::aDynamicBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '}; 354*766ce4d0SZheng Fan sal_Unicode BulletsTypeMgr::aDynamicRTLBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '}; 355*766ce4d0SZheng Fan 356*766ce4d0SZheng Fan BulletsTypeMgr::BulletsTypeMgr(const NBOType aType): 357*766ce4d0SZheng Fan NBOTypeMgrBase(aType) 358*766ce4d0SZheng Fan { 359*766ce4d0SZheng Fan Init(); 360*766ce4d0SZheng Fan } 361*766ce4d0SZheng Fan 362*766ce4d0SZheng Fan BulletsTypeMgr::BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): 363*766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg) 364*766ce4d0SZheng Fan { 365*766ce4d0SZheng Fan Init(); 366*766ce4d0SZheng Fan } 367*766ce4d0SZheng Fan 368*766ce4d0SZheng Fan BulletsTypeMgr::BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr): 369*766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr) 370*766ce4d0SZheng Fan { 371*766ce4d0SZheng Fan for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) 372*766ce4d0SZheng Fan { 373*766ce4d0SZheng Fan pActualBullets[i]->bIsCustomized = aTypeMgr.pActualBullets[i]->bIsCustomized; 374*766ce4d0SZheng Fan pActualBullets[i]->cBulletChar = aTypeMgr.pActualBullets[i]->cBulletChar; 375*766ce4d0SZheng Fan pActualBullets[i]->aFont = aTypeMgr.pActualBullets[i]->aFont; 376*766ce4d0SZheng Fan pActualBullets[i]->sDescription = aTypeMgr. pActualBullets[i]->sDescription; 377*766ce4d0SZheng Fan pActualBullets[i]->eType = aTypeMgr. pActualBullets[i]->eType; 378*766ce4d0SZheng Fan } 379*766ce4d0SZheng Fan } 380*766ce4d0SZheng Fan void BulletsTypeMgr::Init() 381*766ce4d0SZheng Fan { 382*766ce4d0SZheng Fan Font& rActBulletFont = lcl_GetDefaultBulletFont(); 383*766ce4d0SZheng Fan String sName = rActBulletFont.GetName(); 384*766ce4d0SZheng Fan if( Application::GetSettings().GetLayoutRTL() ) 385*766ce4d0SZheng Fan { 386*766ce4d0SZheng Fan for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) 387*766ce4d0SZheng Fan { 388*766ce4d0SZheng Fan pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS); 389*766ce4d0SZheng Fan pActualBullets[i]->cBulletChar = aDefaultRTLBulletTypes[i]; 390*766ce4d0SZheng Fan pActualBullets[i]->aFont = rActBulletFont; 391*766ce4d0SZheng Fan if (i==4 || i==5) 392*766ce4d0SZheng Fan pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_RTL_DESCRIPTION_4 - 4 + i ); 393*766ce4d0SZheng Fan else 394*766ce4d0SZheng Fan pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i ); 395*766ce4d0SZheng Fan } 396*766ce4d0SZheng Fan }else 397*766ce4d0SZheng Fan { 398*766ce4d0SZheng Fan for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) 399*766ce4d0SZheng Fan { 400*766ce4d0SZheng Fan pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS); 401*766ce4d0SZheng Fan pActualBullets[i]->cBulletChar = aDefaultBulletTypes[i]; 402*766ce4d0SZheng Fan pActualBullets[i]->aFont =rActBulletFont; 403*766ce4d0SZheng Fan pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i ); 404*766ce4d0SZheng Fan } 405*766ce4d0SZheng Fan } 406*766ce4d0SZheng Fan } 407*766ce4d0SZheng Fan sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 408*766ce4d0SZheng Fan { 409*766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 410*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 411*766ce4d0SZheng Fan //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; 412*766ce4d0SZheng Fan 413*766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 414*766ce4d0SZheng Fan 415*766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 416*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 417*766ce4d0SZheng Fan 418*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 419*766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 420*766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 421*766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 422*766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 423*766ce4d0SZheng Fan { 424*766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 425*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < nLength; i++) 426*766ce4d0SZheng Fan { 427*766ce4d0SZheng Fan if ( cChar == aDynamicRTLBulletTypes[i] || 428*766ce4d0SZheng Fan (cChar == 9830 && 57356 == aDynamicRTLBulletTypes[i]) || 429*766ce4d0SZheng Fan (cChar == 9632 && 57354 == aDynamicRTLBulletTypes[i]) ) 430*766ce4d0SZheng Fan { 431*766ce4d0SZheng Fan return i+1; 432*766ce4d0SZheng Fan } 433*766ce4d0SZheng Fan } 434*766ce4d0SZheng Fan } else 435*766ce4d0SZheng Fan { 436*766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 437*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < nLength; i++) 438*766ce4d0SZheng Fan { 439*766ce4d0SZheng Fan if ( cChar == aDynamicBulletTypes[i] || 440*766ce4d0SZheng Fan (cChar == 9830 && 57356 == aDynamicBulletTypes[i]) || 441*766ce4d0SZheng Fan (cChar == 9632 && 57354 == aDynamicBulletTypes[i]) ) 442*766ce4d0SZheng Fan { 443*766ce4d0SZheng Fan return i+1; 444*766ce4d0SZheng Fan } 445*766ce4d0SZheng Fan } 446*766ce4d0SZheng Fan }*/ 447*766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 448*766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) 449*766ce4d0SZheng Fan { 450*766ce4d0SZheng Fan if ( (cChar == pActualBullets[i]->cBulletChar|| 451*766ce4d0SZheng Fan (cChar == 9830 && 57356 == pActualBullets[i]->cBulletChar) || 452*766ce4d0SZheng Fan (cChar == 9632 && 57354 == pActualBullets[i]->cBulletChar)))// && pFont && (pFont->GetName().CompareTo(pActualBullets[i]->aFont.GetName())==COMPARE_EQUAL)) 453*766ce4d0SZheng Fan { 454*766ce4d0SZheng Fan return i+1; 455*766ce4d0SZheng Fan } 456*766ce4d0SZheng Fan } 457*766ce4d0SZheng Fan 458*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 459*766ce4d0SZheng Fan } 460*766ce4d0SZheng Fan 461*766ce4d0SZheng Fan sal_Bool BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 462*766ce4d0SZheng Fan { 463*766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 464*766ce4d0SZheng Fan return sal_False; 465*766ce4d0SZheng Fan 466*766ce4d0SZheng Fan if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 467*766ce4d0SZheng Fan return sal_False; 468*766ce4d0SZheng Fan 469*766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 470*766ce4d0SZheng Fan 471*766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 472*766ce4d0SZheng Fan return sal_False; 473*766ce4d0SZheng Fan 474*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 475*766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 476*766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 477*766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 478*766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 479*766ce4d0SZheng Fan { 480*766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 481*766ce4d0SZheng Fan 482*766ce4d0SZheng Fan if ( nIndex >= nLength ) 483*766ce4d0SZheng Fan return sal_False; 484*766ce4d0SZheng Fan 485*766ce4d0SZheng Fan aDynamicRTLBulletTypes[nIndex] = cChar; 486*766ce4d0SZheng Fan } else 487*766ce4d0SZheng Fan { 488*766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 489*766ce4d0SZheng Fan 490*766ce4d0SZheng Fan if ( nIndex >= nLength ) 491*766ce4d0SZheng Fan return sal_False; 492*766ce4d0SZheng Fan 493*766ce4d0SZheng Fan aDynamicBulletTypes[nIndex] = cChar; 494*766ce4d0SZheng Fan }*/ 495*766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 496*766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 497*766ce4d0SZheng Fan return sal_False; 498*766ce4d0SZheng Fan 499*766ce4d0SZheng Fan pActualBullets[nIndex]->cBulletChar = cChar; 500*766ce4d0SZheng Fan if ( pFont ) 501*766ce4d0SZheng Fan pActualBullets[nIndex]->aFont = *pFont; 502*766ce4d0SZheng Fan pActualBullets[nIndex]->bIsCustomized = sal_True; 503*766ce4d0SZheng Fan 504*766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 505*766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 506*766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 507*766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 508*766ce4d0SZheng Fan pActualBullets[nIndex]->sDescription = aStrFromRES; 509*766ce4d0SZheng Fan 510*766ce4d0SZheng Fan return sal_True; 511*766ce4d0SZheng Fan } 512*766ce4d0SZheng Fan 513*766ce4d0SZheng Fan sal_Bool BulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 514*766ce4d0SZheng Fan { 515*766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 516*766ce4d0SZheng Fan // return sal_False; 517*766ce4d0SZheng Fan 518*766ce4d0SZheng Fan sal_Unicode cChar; 519*766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 520*766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 521*766ce4d0SZheng Fan { 522*766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 523*766ce4d0SZheng Fan 524*766ce4d0SZheng Fan if ( nIndex >= nLength ) 525*766ce4d0SZheng Fan return sal_False; 526*766ce4d0SZheng Fan 527*766ce4d0SZheng Fan cChar = aDynamicRTLBulletTypes[nIndex]; 528*766ce4d0SZheng Fan }else 529*766ce4d0SZheng Fan { 530*766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 531*766ce4d0SZheng Fan 532*766ce4d0SZheng Fan if ( nIndex >= nLength ) 533*766ce4d0SZheng Fan return sal_False; 534*766ce4d0SZheng Fan 535*766ce4d0SZheng Fan cChar = aDynamicBulletTypes[nIndex]; 536*766ce4d0SZheng Fan }*/ 537*766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 538*766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 539*766ce4d0SZheng Fan return sal_False; 540*766ce4d0SZheng Fan cChar = pActualBullets[nIndex]->cBulletChar; 541*766ce4d0SZheng Fan //Font& rActBulletFont = lcl_GetDefaultBulletFont(); 542*766ce4d0SZheng Fan Font rActBulletFont = pActualBullets[nIndex]->aFont; 543*766ce4d0SZheng Fan 544*766ce4d0SZheng Fan sal_uInt16 nMask = 1; 545*766ce4d0SZheng Fan String sBulletCharFmtName = GetBulCharFmtName(); 546*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 547*766ce4d0SZheng Fan { 548*766ce4d0SZheng Fan if(mLevel & nMask) 549*766ce4d0SZheng Fan { 550*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 551*766ce4d0SZheng Fan aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); 552*766ce4d0SZheng Fan aFmt.SetBulletFont(&rActBulletFont); 553*766ce4d0SZheng Fan aFmt.SetBulletChar(cChar ); 554*766ce4d0SZheng Fan aFmt.SetCharFmtName(sBulletCharFmtName); 555*766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(45); 556*766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 557*766ce4d0SZheng Fan } 558*766ce4d0SZheng Fan nMask <<= 1; 559*766ce4d0SZheng Fan } 560*766ce4d0SZheng Fan 561*766ce4d0SZheng Fan return sal_True; 562*766ce4d0SZheng Fan } 563*766ce4d0SZheng Fan 564*766ce4d0SZheng Fan String BulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 565*766ce4d0SZheng Fan { 566*766ce4d0SZheng Fan String sRet; 567*766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 568*766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 569*766ce4d0SZheng Fan 570*766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 571*766ce4d0SZheng Fan return sRet; 572*766ce4d0SZheng Fan else 573*766ce4d0SZheng Fan sRet = pActualBullets[nIndex]->sDescription; 574*766ce4d0SZheng Fan 575*766ce4d0SZheng Fan return sRet; 576*766ce4d0SZheng Fan } 577*766ce4d0SZheng Fan sal_Bool BulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) 578*766ce4d0SZheng Fan { 579*766ce4d0SZheng Fan sal_Bool bRet = sal_False; 580*766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 581*766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 582*766ce4d0SZheng Fan 583*766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 584*766ce4d0SZheng Fan bRet = sal_False; 585*766ce4d0SZheng Fan else 586*766ce4d0SZheng Fan bRet = pActualBullets[nIndex]->bIsCustomized; 587*766ce4d0SZheng Fan 588*766ce4d0SZheng Fan return bRet; 589*766ce4d0SZheng Fan } 590*766ce4d0SZheng Fan 591*766ce4d0SZheng Fan sal_Unicode BulletsTypeMgr::GetBulChar(sal_uInt16 nIndex) 592*766ce4d0SZheng Fan { 593*766ce4d0SZheng Fan sal_Unicode cChar; 594*766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 595*766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 596*766ce4d0SZheng Fan 597*766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 598*766ce4d0SZheng Fan cChar = ' '; 599*766ce4d0SZheng Fan else 600*766ce4d0SZheng Fan cChar = pActualBullets[nIndex]->cBulletChar; 601*766ce4d0SZheng Fan 602*766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 603*766ce4d0SZheng Fan { 604*766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 605*766ce4d0SZheng Fan 606*766ce4d0SZheng Fan if ( nIndex >= nLength ) 607*766ce4d0SZheng Fan cChar = ' '; 608*766ce4d0SZheng Fan else 609*766ce4d0SZheng Fan cChar = aDynamicRTLBulletTypes[nIndex]; 610*766ce4d0SZheng Fan }else 611*766ce4d0SZheng Fan { 612*766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 613*766ce4d0SZheng Fan 614*766ce4d0SZheng Fan if ( nIndex >= nLength ) 615*766ce4d0SZheng Fan cChar = ' '; 616*766ce4d0SZheng Fan else 617*766ce4d0SZheng Fan cChar = aDynamicBulletTypes[nIndex]; 618*766ce4d0SZheng Fan }*/ 619*766ce4d0SZheng Fan 620*766ce4d0SZheng Fan return cChar; 621*766ce4d0SZheng Fan } 622*766ce4d0SZheng Fan Font BulletsTypeMgr::GetBulCharFont(sal_uInt16 nIndex) 623*766ce4d0SZheng Fan { 624*766ce4d0SZheng Fan Font aRet; 625*766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 626*766ce4d0SZheng Fan aRet = lcl_GetDefaultBulletFont(); 627*766ce4d0SZheng Fan else 628*766ce4d0SZheng Fan aRet = pActualBullets[nIndex]->aFont; 629*766ce4d0SZheng Fan 630*766ce4d0SZheng Fan return aRet; 631*766ce4d0SZheng Fan } 632*766ce4d0SZheng Fan /*************************************************************************************************** 633*766ce4d0SZheng Fan **********************Graphic Bullet Type lib*********************************************************** 634*766ce4d0SZheng Fan ****************************************************************************************************/ 635*766ce4d0SZheng Fan GraphyicBulletsTypeMgr* GraphyicBulletsTypeMgr::_instance = 0; 636*766ce4d0SZheng Fan GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType): 637*766ce4d0SZheng Fan NBOTypeMgrBase(aType) 638*766ce4d0SZheng Fan { 639*766ce4d0SZheng Fan Init(); 640*766ce4d0SZheng Fan } 641*766ce4d0SZheng Fan 642*766ce4d0SZheng Fan GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): 643*766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg) 644*766ce4d0SZheng Fan { 645*766ce4d0SZheng Fan Init(); 646*766ce4d0SZheng Fan } 647*766ce4d0SZheng Fan GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr): 648*766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr) 649*766ce4d0SZheng Fan { 650*766ce4d0SZheng Fan for (sal_uInt16 i=0;i< aTypeMgr.aGrfDataLst.Count();i++) 651*766ce4d0SZheng Fan { 652*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); 653*766ce4d0SZheng Fan GrfBulDataRelation* pSrcEntry = (GrfBulDataRelation*)(aTypeMgr.aGrfDataLst.GetObject(i)); 654*766ce4d0SZheng Fan if ( pEntry && pSrcEntry) 655*766ce4d0SZheng Fan { 656*766ce4d0SZheng Fan pEntry->bIsCustomized = pSrcEntry->bIsCustomized; 657*766ce4d0SZheng Fan pEntry->nTabIndex = pSrcEntry->nTabIndex; 658*766ce4d0SZheng Fan pEntry->nGallaryIndex = pSrcEntry->nGallaryIndex; 659*766ce4d0SZheng Fan pEntry->sGrfName = pSrcEntry->sGrfName; 660*766ce4d0SZheng Fan pEntry->sDescription = pSrcEntry->sDescription; 661*766ce4d0SZheng Fan aGrfDataLst.Insert( pEntry, LIST_APPEND ); 662*766ce4d0SZheng Fan } 663*766ce4d0SZheng Fan } 664*766ce4d0SZheng Fan } 665*766ce4d0SZheng Fan void GraphyicBulletsTypeMgr::Init() 666*766ce4d0SZheng Fan { 667*766ce4d0SZheng Fan List aGrfNames; 668*766ce4d0SZheng Fan GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); 669*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aGrfNames.Count(); i++) 670*766ce4d0SZheng Fan { 671*766ce4d0SZheng Fan String* pGrfNm = (String*) aGrfNames.GetObject(i); 672*766ce4d0SZheng Fan INetURLObject aObj(*pGrfNm); 673*766ce4d0SZheng Fan if(aObj.GetProtocol() == INET_PROT_FILE) 674*766ce4d0SZheng Fan *pGrfNm = aObj.PathToFileName(); 675*766ce4d0SZheng Fan 676*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); 677*766ce4d0SZheng Fan pEntry->nTabIndex = i+1; 678*766ce4d0SZheng Fan pEntry->nGallaryIndex = i; 679*766ce4d0SZheng Fan pEntry->sGrfName = *pGrfNm; 680*766ce4d0SZheng Fan 681*766ce4d0SZheng Fan if( i < MAX_VALUESET_GRAPHIC ) 682*766ce4d0SZheng Fan { 683*766ce4d0SZheng Fan pEntry->sDescription = SVX_RESSTR( RID_SVXSTR_GRAPHICS_DESCRIPTIONS + i ); 684*766ce4d0SZheng Fan }else 685*766ce4d0SZheng Fan { 686*766ce4d0SZheng Fan pEntry->sDescription = *pGrfNm; 687*766ce4d0SZheng Fan } 688*766ce4d0SZheng Fan 689*766ce4d0SZheng Fan aGrfDataLst.Insert( pEntry, LIST_APPEND ); 690*766ce4d0SZheng Fan } 691*766ce4d0SZheng Fan } 692*766ce4d0SZheng Fan sal_uInt16 GraphyicBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 693*766ce4d0SZheng Fan { 694*766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 695*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 696*766ce4d0SZheng Fan 697*766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 698*766ce4d0SZheng Fan 699*766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 700*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 701*766ce4d0SZheng Fan 702*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 703*766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 704*766ce4d0SZheng Fan const Graphic* pGrf = 0; 705*766ce4d0SZheng Fan if ( pBrsh ) 706*766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 707*766ce4d0SZheng Fan 708*766ce4d0SZheng Fan if ( pGrf ) 709*766ce4d0SZheng Fan { 710*766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 711*766ce4d0SZheng Fan Graphic aGraphic; 712*766ce4d0SZheng Fan for(sal_uInt16 i=0;i<aGrfDataLst.Count();i++) 713*766ce4d0SZheng Fan { 714*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(i); 715*766ce4d0SZheng Fan sal_Bool bExist = sal_False; 716*766ce4d0SZheng Fan if ( pEntry) // && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) 717*766ce4d0SZheng Fan bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pEntry->nGallaryIndex,&aGraphic); 718*766ce4d0SZheng Fan if (bExist) { 719*766ce4d0SZheng Fan Bitmap aSum=pGrf->GetBitmap(); 720*766ce4d0SZheng Fan Bitmap aSum1=aGraphic.GetBitmap(); 721*766ce4d0SZheng Fan if (aSum.IsEqual(aSum1)) 722*766ce4d0SZheng Fan return pEntry->nTabIndex; 723*766ce4d0SZheng Fan } 724*766ce4d0SZheng Fan } 725*766ce4d0SZheng Fan } 726*766ce4d0SZheng Fan 727*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 728*766ce4d0SZheng Fan } 729*766ce4d0SZheng Fan 730*766ce4d0SZheng Fan sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 731*766ce4d0SZheng Fan { 732*766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) 733*766ce4d0SZheng Fan return sal_False; 734*766ce4d0SZheng Fan 735*766ce4d0SZheng Fan if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 736*766ce4d0SZheng Fan return sal_False; 737*766ce4d0SZheng Fan 738*766ce4d0SZheng Fan if ( nIndex >= aGrfDataLst.Count() ) 739*766ce4d0SZheng Fan return sal_False; 740*766ce4d0SZheng Fan 741*766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 742*766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 743*766ce4d0SZheng Fan return sal_False; 744*766ce4d0SZheng Fan 745*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 746*766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 747*766ce4d0SZheng Fan const Graphic* pGrf = 0; 748*766ce4d0SZheng Fan if ( pBrsh ) 749*766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 750*766ce4d0SZheng Fan else 751*766ce4d0SZheng Fan return sal_False; 752*766ce4d0SZheng Fan 753*766ce4d0SZheng Fan String sEmpty; 754*766ce4d0SZheng Fan if ( pGrf ) 755*766ce4d0SZheng Fan { 756*766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 757*766ce4d0SZheng Fan //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); 758*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 759*766ce4d0SZheng Fan if ( pGrfName ) 760*766ce4d0SZheng Fan pEntry->sGrfName = *pGrfName; 761*766ce4d0SZheng Fan //pEntry->sDescription = sEmpty; 762*766ce4d0SZheng Fan pEntry->nGallaryIndex = (sal_uInt16)0xFFFF; 763*766ce4d0SZheng Fan pEntry->bIsCustomized = sal_True; 764*766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 765*766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 766*766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 767*766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 768*766ce4d0SZheng Fan pEntry->sDescription = aStrFromRES; 769*766ce4d0SZheng Fan }else 770*766ce4d0SZheng Fan { 771*766ce4d0SZheng Fan return sal_False; 772*766ce4d0SZheng Fan } 773*766ce4d0SZheng Fan 774*766ce4d0SZheng Fan return sal_True; 775*766ce4d0SZheng Fan } 776*766ce4d0SZheng Fan 777*766ce4d0SZheng Fan sal_Bool GraphyicBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 778*766ce4d0SZheng Fan { 779*766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 780*766ce4d0SZheng Fan // return sal_False; 781*766ce4d0SZheng Fan 782*766ce4d0SZheng Fan if ( nIndex >= aGrfDataLst.Count() ) 783*766ce4d0SZheng Fan return sal_False; 784*766ce4d0SZheng Fan 785*766ce4d0SZheng Fan String sGrfName; 786*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 787*766ce4d0SZheng Fan sGrfName= pEntry->sGrfName; 788*766ce4d0SZheng Fan 789*766ce4d0SZheng Fan sal_uInt16 nMask = 1; 790*766ce4d0SZheng Fan String aEmptyStr; 791*766ce4d0SZheng Fan sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; 792*766ce4d0SZheng Fan String sNumCharFmtName = GetBulCharFmtName(); 793*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 794*766ce4d0SZheng Fan { 795*766ce4d0SZheng Fan if(mLevel & nMask) 796*766ce4d0SZheng Fan { 797*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 798*766ce4d0SZheng Fan aFmt.SetNumberingType(nSetNumberingType); 799*766ce4d0SZheng Fan aFmt.SetPrefix( aEmptyStr ); 800*766ce4d0SZheng Fan aFmt.SetSuffix( aEmptyStr ); 801*766ce4d0SZheng Fan aFmt.SetCharFmtName( sNumCharFmtName ); 802*766ce4d0SZheng Fan 803*766ce4d0SZheng Fan Graphic aGraphic; 804*766ce4d0SZheng Fan if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pEntry->nGallaryIndex, &aGraphic)) 805*766ce4d0SZheng Fan { 806*766ce4d0SZheng Fan Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); 807*766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 808*766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 809*766ce4d0SZheng Fan SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); 810*766ce4d0SZheng Fan aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); 811*766ce4d0SZheng Fan } 812*766ce4d0SZheng Fan else// if(pGrfName) 813*766ce4d0SZheng Fan aFmt.SetGraphic( sGrfName ); 814*766ce4d0SZheng Fan 815*766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 816*766ce4d0SZheng Fan } 817*766ce4d0SZheng Fan nMask <<= 1 ; 818*766ce4d0SZheng Fan } 819*766ce4d0SZheng Fan 820*766ce4d0SZheng Fan return sal_True; 821*766ce4d0SZheng Fan } 822*766ce4d0SZheng Fan String GraphyicBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 823*766ce4d0SZheng Fan { 824*766ce4d0SZheng Fan String sRet; 825*766ce4d0SZheng Fan sal_uInt16 nLength = 0; 826*766ce4d0SZheng Fan nLength = aGrfDataLst.Count() ; 827*766ce4d0SZheng Fan 828*766ce4d0SZheng Fan if ( nIndex >= nLength ) 829*766ce4d0SZheng Fan return sRet; 830*766ce4d0SZheng Fan else 831*766ce4d0SZheng Fan { 832*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 833*766ce4d0SZheng Fan if ( pEntry ) 834*766ce4d0SZheng Fan { 835*766ce4d0SZheng Fan sRet = pEntry->sDescription; 836*766ce4d0SZheng Fan }; 837*766ce4d0SZheng Fan } 838*766ce4d0SZheng Fan return sRet; 839*766ce4d0SZheng Fan } 840*766ce4d0SZheng Fan sal_Bool GraphyicBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) 841*766ce4d0SZheng Fan { 842*766ce4d0SZheng Fan sal_Bool bRet = sal_False; 843*766ce4d0SZheng Fan 844*766ce4d0SZheng Fan sal_uInt16 nLength = 0; 845*766ce4d0SZheng Fan nLength = aGrfDataLst.Count() ; 846*766ce4d0SZheng Fan 847*766ce4d0SZheng Fan if ( nIndex >= nLength ) 848*766ce4d0SZheng Fan return bRet; 849*766ce4d0SZheng Fan else 850*766ce4d0SZheng Fan { 851*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 852*766ce4d0SZheng Fan if ( pEntry ) 853*766ce4d0SZheng Fan { 854*766ce4d0SZheng Fan bRet = pEntry->bIsCustomized; 855*766ce4d0SZheng Fan }; 856*766ce4d0SZheng Fan } 857*766ce4d0SZheng Fan 858*766ce4d0SZheng Fan return bRet; 859*766ce4d0SZheng Fan } 860*766ce4d0SZheng Fan String GraphyicBulletsTypeMgr::GetGrfName(sal_uInt16 nIndex) 861*766ce4d0SZheng Fan { 862*766ce4d0SZheng Fan String sRet; 863*766ce4d0SZheng Fan if ( nIndex < aGrfDataLst.Count() ) 864*766ce4d0SZheng Fan { 865*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 866*766ce4d0SZheng Fan if ( pEntry ) 867*766ce4d0SZheng Fan { 868*766ce4d0SZheng Fan sRet = pEntry->sGrfName; 869*766ce4d0SZheng Fan } 870*766ce4d0SZheng Fan } 871*766ce4d0SZheng Fan 872*766ce4d0SZheng Fan return sRet; 873*766ce4d0SZheng Fan } 874*766ce4d0SZheng Fan /*************************************************************************************************** 875*766ce4d0SZheng Fan **********************Mix Bullets Type lib************************************************************** 876*766ce4d0SZheng Fan ****************************************************************************************************/ 877*766ce4d0SZheng Fan MixBulletsTypeMgr* MixBulletsTypeMgr::_instance = 0; 878*766ce4d0SZheng Fan MixBulletsSettings_Impl* MixBulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0}; 879*766ce4d0SZheng Fan MixBulletsSettings_Impl* MixBulletsTypeMgr::pDefaultActualBullets[] ={0,0,0,0,0,0,0,0}; 880*766ce4d0SZheng Fan 881*766ce4d0SZheng Fan MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType): 882*766ce4d0SZheng Fan NBOTypeMgrBase(aType) 883*766ce4d0SZheng Fan { 884*766ce4d0SZheng Fan Init(); 885*766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) 886*766ce4d0SZheng Fan { 887*766ce4d0SZheng Fan pDefaultActualBullets[nItem] = pActualBullets[nItem]; 888*766ce4d0SZheng Fan } 889*766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 890*766ce4d0SZheng Fan Init(); 891*766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.sya")); 892*766ce4d0SZheng Fan } 893*766ce4d0SZheng Fan 894*766ce4d0SZheng Fan MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): 895*766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg) 896*766ce4d0SZheng Fan { 897*766ce4d0SZheng Fan Init(); 898*766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) 899*766ce4d0SZheng Fan { 900*766ce4d0SZheng Fan pDefaultActualBullets[nItem] = pActualBullets[nItem]; 901*766ce4d0SZheng Fan } 902*766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 903*766ce4d0SZheng Fan Init(); 904*766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.sya")); 905*766ce4d0SZheng Fan } 906*766ce4d0SZheng Fan 907*766ce4d0SZheng Fan MixBulletsTypeMgr::MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr): 908*766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr) 909*766ce4d0SZheng Fan { 910*766ce4d0SZheng Fan for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) 911*766ce4d0SZheng Fan { 912*766ce4d0SZheng Fan if ( aTypeMgr.pActualBullets[i]->eType == eNBType::BULLETS ) 913*766ce4d0SZheng Fan { 914*766ce4d0SZheng Fan pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; 915*766ce4d0SZheng Fan pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display 916*766ce4d0SZheng Fan pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; 917*766ce4d0SZheng Fan pActualBullets[i]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 918*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->cBulletChar; 919*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->aFont; 920*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->sDescription = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; 921*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->bIsCustomized = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; 922*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->eType = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; 923*766ce4d0SZheng Fan }else if ( aTypeMgr.pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) 924*766ce4d0SZheng Fan { 925*766ce4d0SZheng Fan pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; 926*766ce4d0SZheng Fan pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display 927*766ce4d0SZheng Fan pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; 928*766ce4d0SZheng Fan pActualBullets[i]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 929*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sGrfName = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sGrfName; 930*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sDescription = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; 931*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->bIsCustomized = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; 932*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->eType = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; 933*766ce4d0SZheng Fan if ( ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized && ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj != NULL) 934*766ce4d0SZheng Fan { 935*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->pGrfObj = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj; 936*766ce4d0SZheng Fan } 937*766ce4d0SZheng Fan } 938*766ce4d0SZheng Fan } 939*766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.sya")); 940*766ce4d0SZheng Fan } 941*766ce4d0SZheng Fan void MixBulletsTypeMgr::Init() 942*766ce4d0SZheng Fan { 943*766ce4d0SZheng Fan BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); 944*766ce4d0SZheng Fan if ( pBTMgr ) 945*766ce4d0SZheng Fan { 946*766ce4d0SZheng Fan //Index 1 947*766ce4d0SZheng Fan pActualBullets[0] = new MixBulletsSettings_Impl(eNBType::BULLETS); 948*766ce4d0SZheng Fan pActualBullets[0]->eType = eNBType::BULLETS; 949*766ce4d0SZheng Fan pActualBullets[0]->nIndex = 0+1; //index in the tab page display,decrease 1 to the index within arr 950*766ce4d0SZheng Fan pActualBullets[0]->nIndexDefault = 2; //index in the tab page display,decrease 1 to the index within arr 951*766ce4d0SZheng Fan pActualBullets[0]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 952*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[0]->nIndexDefault-1); 953*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[0]->nIndexDefault-1); 954*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[0]->nIndexDefault-1); 955*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[0]->nIndexDefault-1); 956*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->eType = eNBType::BULLETS; 957*766ce4d0SZheng Fan 958*766ce4d0SZheng Fan //Index 2 959*766ce4d0SZheng Fan pActualBullets[1] = new MixBulletsSettings_Impl(eNBType::BULLETS); 960*766ce4d0SZheng Fan pActualBullets[1]->eType = eNBType::BULLETS; 961*766ce4d0SZheng Fan pActualBullets[1]->nIndex = 1+1; //index in the tab page display,decrease 1 to the index within arr 962*766ce4d0SZheng Fan pActualBullets[1]->nIndexDefault = 3; //index in the tab page display,decrease 1 to the index within arr 963*766ce4d0SZheng Fan pActualBullets[1]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 964*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[1]->nIndexDefault-1); 965*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[1]->nIndexDefault-1); 966*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[1]->nIndexDefault-1); 967*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[1]->nIndexDefault-1); 968*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->eType = eNBType::BULLETS; 969*766ce4d0SZheng Fan 970*766ce4d0SZheng Fan //Index 3 971*766ce4d0SZheng Fan pActualBullets[2] = new MixBulletsSettings_Impl(eNBType::BULLETS); 972*766ce4d0SZheng Fan pActualBullets[2]->eType = eNBType::BULLETS; 973*766ce4d0SZheng Fan pActualBullets[2]->nIndex = 2+1; //index in the tab page display,decrease 1 to the index within arr 974*766ce4d0SZheng Fan pActualBullets[2]->nIndexDefault = 4; //index in the tab page display,decrease 1 to the index within arr 975*766ce4d0SZheng Fan pActualBullets[2]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 976*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[2]->nIndexDefault-1); 977*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[2]->nIndexDefault-1); 978*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[2]->nIndexDefault-1); 979*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[2]->nIndexDefault-1); 980*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->eType = eNBType::BULLETS; 981*766ce4d0SZheng Fan 982*766ce4d0SZheng Fan //Index 4 983*766ce4d0SZheng Fan pActualBullets[3] = new MixBulletsSettings_Impl(eNBType::BULLETS); 984*766ce4d0SZheng Fan pActualBullets[3]->eType = eNBType::BULLETS; 985*766ce4d0SZheng Fan pActualBullets[3]->nIndex = 3+1; //index in the tab page display,decrease 1 to the index within arr 986*766ce4d0SZheng Fan pActualBullets[3]->nIndexDefault = 5; //index in the tab page display,decrease 1 to the index within arr 987*766ce4d0SZheng Fan pActualBullets[3]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 988*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[3]->nIndexDefault-1); 989*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[3]->nIndexDefault-1); 990*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[3]->nIndexDefault-1); 991*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[3]->nIndexDefault-1); 992*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->eType = eNBType::BULLETS; 993*766ce4d0SZheng Fan 994*766ce4d0SZheng Fan //Index 5 995*766ce4d0SZheng Fan pActualBullets[4] = new MixBulletsSettings_Impl(eNBType::BULLETS); 996*766ce4d0SZheng Fan pActualBullets[4]->eType = eNBType::BULLETS; 997*766ce4d0SZheng Fan pActualBullets[4]->nIndex = 4+1; //index in the tab page display,decrease 1 to the index within arr 998*766ce4d0SZheng Fan pActualBullets[4]->nIndexDefault = 6; //index in the tab page display,decrease 1 to the index within arr 999*766ce4d0SZheng Fan pActualBullets[4]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 1000*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[4]->nIndexDefault-1); 1001*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[4]->nIndexDefault-1); 1002*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[4]->nIndexDefault-1); 1003*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[4]->nIndexDefault-1); 1004*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->eType = eNBType::BULLETS; 1005*766ce4d0SZheng Fan 1006*766ce4d0SZheng Fan //Index 6 1007*766ce4d0SZheng Fan pActualBullets[5] = new MixBulletsSettings_Impl(eNBType::BULLETS); 1008*766ce4d0SZheng Fan pActualBullets[5]->eType = eNBType::BULLETS; 1009*766ce4d0SZheng Fan pActualBullets[5]->nIndex = 5+1; //index in the tab page display,decrease 1 to the index within arr 1010*766ce4d0SZheng Fan pActualBullets[5]->nIndexDefault = 8; //index in the tab page display,decrease 1 to the index within arr 1011*766ce4d0SZheng Fan pActualBullets[5]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 1012*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[5]->nIndexDefault-1); 1013*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[5]->nIndexDefault-1); 1014*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[5]->nIndexDefault-1); 1015*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[5]->nIndexDefault-1); 1016*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->eType = eNBType::BULLETS; 1017*766ce4d0SZheng Fan } 1018*766ce4d0SZheng Fan 1019*766ce4d0SZheng Fan GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); 1020*766ce4d0SZheng Fan if ( mGrfTMgr ) 1021*766ce4d0SZheng Fan { 1022*766ce4d0SZheng Fan //Index 7 1023*766ce4d0SZheng Fan pActualBullets[6] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); 1024*766ce4d0SZheng Fan pActualBullets[6]->eType = eNBType::GRAPHICBULLETS; 1025*766ce4d0SZheng Fan pActualBullets[6]->nIndex = 6+1; //index in the tab page display,decrease 1 to the index within arr 1026*766ce4d0SZheng Fan pActualBullets[6]->nIndexDefault = 9; //index in the tab page display,decrease 1 to the index within arr 1027*766ce4d0SZheng Fan pActualBullets[6]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 1028*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[6]->nIndexDefault); 1029*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[6]->nIndexDefault); 1030*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[6]->nIndexDefault); 1031*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->eType = eNBType::GRAPHICBULLETS; 1032*766ce4d0SZheng Fan 1033*766ce4d0SZheng Fan //Index 8 1034*766ce4d0SZheng Fan pActualBullets[7] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); 1035*766ce4d0SZheng Fan pActualBullets[7]->eType = eNBType::GRAPHICBULLETS; 1036*766ce4d0SZheng Fan pActualBullets[7]->nIndex = 7+1; //index in the tab page display,decrease 1 to the index within arr 1037*766ce4d0SZheng Fan pActualBullets[7]->nIndexDefault = 23; //index in the tab page display,decrease 1 to the index within arr 1038*766ce4d0SZheng Fan pActualBullets[7]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 1039*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[7]->nIndexDefault); 1040*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[7]->nIndexDefault); 1041*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[7]->nIndexDefault); 1042*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->eType = eNBType::GRAPHICBULLETS; 1043*766ce4d0SZheng Fan } 1044*766ce4d0SZheng Fan 1045*766ce4d0SZheng Fan } 1046*766ce4d0SZheng Fan sal_uInt16 MixBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 1047*766ce4d0SZheng Fan { 1048*766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 1049*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1050*766ce4d0SZheng Fan //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; 1051*766ce4d0SZheng Fan 1052*766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1053*766ce4d0SZheng Fan 1054*766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1055*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1056*766ce4d0SZheng Fan 1057*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1058*766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1059*766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL) 1060*766ce4d0SZheng Fan { 1061*766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1062*766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1063*766ce4d0SZheng Fan String sName = pFont?pFont->GetName():String(); 1064*766ce4d0SZheng Fan 1065*766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) 1066*766ce4d0SZheng Fan { 1067*766ce4d0SZheng Fan if ( pActualBullets[i]->eType == eNBType::BULLETS ) 1068*766ce4d0SZheng Fan { 1069*766ce4d0SZheng Fan String ssName = ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName(); 1070*766ce4d0SZheng Fan if ( (cChar == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar|| 1071*766ce4d0SZheng Fan (cChar == 9830 && 57356 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar) || 1072*766ce4d0SZheng Fan (cChar == 9632 && 57354 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar)))//&& 1073*766ce4d0SZheng Fan //(pFont && pFont->GetName().CompareTo(((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName())==COMPARE_EQUAL) ) 1074*766ce4d0SZheng Fan { 1075*766ce4d0SZheng Fan return pActualBullets[i]->nIndex; 1076*766ce4d0SZheng Fan } 1077*766ce4d0SZheng Fan } 1078*766ce4d0SZheng Fan } 1079*766ce4d0SZheng Fan }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) 1080*766ce4d0SZheng Fan { 1081*766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 1082*766ce4d0SZheng Fan const Graphic* pGrf = 0; 1083*766ce4d0SZheng Fan if ( pBrsh ) 1084*766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 1085*766ce4d0SZheng Fan 1086*766ce4d0SZheng Fan if ( pGrf ) 1087*766ce4d0SZheng Fan { 1088*766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 1089*766ce4d0SZheng Fan //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); 1090*766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) 1091*766ce4d0SZheng Fan { 1092*766ce4d0SZheng Fan if ( pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) 1093*766ce4d0SZheng Fan { 1094*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[i]->pBullets); 1095*766ce4d0SZheng Fan //sal_Bool bExist = sal_False; 1096*766ce4d0SZheng Fan if ( pEntry && pActualBullets[i]->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj) 1097*766ce4d0SZheng Fan { 1098*766ce4d0SZheng Fan if ( pEntry->pGrfObj->GetBitmap().IsEqual(pGrf->GetBitmap())) 1099*766ce4d0SZheng Fan { 1100*766ce4d0SZheng Fan return pActualBullets[i]->nIndex; 1101*766ce4d0SZheng Fan } 1102*766ce4d0SZheng Fan }else { //if ( pEntry && pGrfName && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) 1103*766ce4d0SZheng Fan //bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault-1,pSrGrf); 1104*766ce4d0SZheng Fan Graphic aSrGrf; 1105*766ce4d0SZheng Fan if (pEntry) 1106*766ce4d0SZheng Fan GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault,&aSrGrf); 1107*766ce4d0SZheng Fan Bitmap aSum=pGrf->GetBitmap(); 1108*766ce4d0SZheng Fan Bitmap aSum1=aSrGrf.GetBitmap(); 1109*766ce4d0SZheng Fan if (aSum.IsEqual(aSum1)) 1110*766ce4d0SZheng Fan return pActualBullets[i]->nIndex; 1111*766ce4d0SZheng Fan } 1112*766ce4d0SZheng Fan } 1113*766ce4d0SZheng Fan } 1114*766ce4d0SZheng Fan } 1115*766ce4d0SZheng Fan } 1116*766ce4d0SZheng Fan 1117*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1118*766ce4d0SZheng Fan } 1119*766ce4d0SZheng Fan 1120*766ce4d0SZheng Fan sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 1121*766ce4d0SZheng Fan { 1122*766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0 || nIndex>=DEFAULT_BULLET_TYPES) 1123*766ce4d0SZheng Fan return sal_False; 1124*766ce4d0SZheng Fan 1125*766ce4d0SZheng Fan //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 1126*766ce4d0SZheng Fan // return sal_False; 1127*766ce4d0SZheng Fan 1128*766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1129*766ce4d0SZheng Fan 1130*766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1131*766ce4d0SZheng Fan return sal_False; 1132*766ce4d0SZheng Fan 1133*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1134*766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1135*766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL && pActualBullets[nIndex]->eType == eNBType::BULLETS ) 1136*766ce4d0SZheng Fan { 1137*766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1138*766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1139*766ce4d0SZheng Fan BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); 1140*766ce4d0SZheng Fan pEntry->cBulletChar = cChar; 1141*766ce4d0SZheng Fan //Sym3_2884 provide a default font when pFont is NULL 1142*766ce4d0SZheng Fan pEntry->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); 1143*766ce4d0SZheng Fan pEntry->bIsCustomized = sal_True; 1144*766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1145*766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1146*766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1147*766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1148*766ce4d0SZheng Fan pEntry->sDescription = aStrFromRES; 1149*766ce4d0SZheng Fan 1150*766ce4d0SZheng Fan }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP && pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS ) 1151*766ce4d0SZheng Fan { 1152*766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 1153*766ce4d0SZheng Fan const Graphic* pGrf = 0; 1154*766ce4d0SZheng Fan if ( pBrsh ) 1155*766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 1156*766ce4d0SZheng Fan else 1157*766ce4d0SZheng Fan return sal_False; 1158*766ce4d0SZheng Fan 1159*766ce4d0SZheng Fan String sEmpty; 1160*766ce4d0SZheng Fan if ( pGrf ) 1161*766ce4d0SZheng Fan { 1162*766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 1163*766ce4d0SZheng Fan //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); 1164*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); 1165*766ce4d0SZheng Fan if ( pGrfName ) 1166*766ce4d0SZheng Fan pEntry->sGrfName = *pGrfName; 1167*766ce4d0SZheng Fan GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); 1168*766ce4d0SZheng Fan if ( mGrfTMgr ) 1169*766ce4d0SZheng Fan { 1170*766ce4d0SZheng Fan //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1171*766ce4d0SZheng Fan //if ( nDIndex != (sal_uInt16)0xFFFF) 1172*766ce4d0SZheng Fan //{ 1173*766ce4d0SZheng Fan // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; 1174*766ce4d0SZheng Fan // sEmpty = mGrfTMgr->GetDescription( nDIndex -1); 1175*766ce4d0SZheng Fan //}else 1176*766ce4d0SZheng Fan { 1177*766ce4d0SZheng Fan pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; 1178*766ce4d0SZheng Fan sEmpty = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1179*766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1180*766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1181*766ce4d0SZheng Fan sEmpty.SearchAndReplace(aReplace,sNUM); 1182*766ce4d0SZheng Fan //pEntry->pGrfObj = pGrf; 1183*766ce4d0SZheng Fan pEntry->pGrfObj = new Graphic(*pGrf); 1184*766ce4d0SZheng Fan pEntry->aSize = aFmt.GetGraphicSize(); 1185*766ce4d0SZheng Fan //Sym3_2508 use standard unit to store size 1186*766ce4d0SZheng Fan pEntry->aSize = OutputDevice::LogicToLogic(pEntry->aSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); 1187*766ce4d0SZheng Fan sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1188*766ce4d0SZheng Fan if (nDIndex!=(sal_uInt16)0xFFFF) pEntry->aSize=Size(0,0); 1189*766ce4d0SZheng Fan } 1190*766ce4d0SZheng Fan } 1191*766ce4d0SZheng Fan pEntry->sDescription = sEmpty; 1192*766ce4d0SZheng Fan pEntry->bIsCustomized = sal_True; 1193*766ce4d0SZheng Fan }else 1194*766ce4d0SZheng Fan { 1195*766ce4d0SZheng Fan return sal_False; 1196*766ce4d0SZheng Fan } 1197*766ce4d0SZheng Fan }else 1198*766ce4d0SZheng Fan { 1199*766ce4d0SZheng Fan delete pActualBullets[nIndex]->pBullets; 1200*766ce4d0SZheng Fan pActualBullets[nIndex]->pBullets = 0; 1201*766ce4d0SZheng Fan if ( eNumType == SVX_NUM_CHAR_SPECIAL ) 1202*766ce4d0SZheng Fan { 1203*766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1204*766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1205*766ce4d0SZheng Fan pActualBullets[nIndex]->eType = eNBType::BULLETS; 1206*766ce4d0SZheng Fan pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr 1207*766ce4d0SZheng Fan pActualBullets[nIndex]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 1208*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->cBulletChar = cChar; 1209*766ce4d0SZheng Fan //Sym3_2884 provide a default font when pFont is NULL 1210*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); 1211*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; 1212*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::BULLETS; 1213*766ce4d0SZheng Fan BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); 1214*766ce4d0SZheng Fan if ( pBTMgr ) 1215*766ce4d0SZheng Fan { 1216*766ce4d0SZheng Fan //sal_uInt16 nDIndex = pBTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1217*766ce4d0SZheng Fan //if ( nDIndex != (sal_uInt16)0xFFFF) 1218*766ce4d0SZheng Fan //{ 1219*766ce4d0SZheng Fan // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; 1220*766ce4d0SZheng Fan // ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = pBTMgr->GetDescription(nDIndex - 1); 1221*766ce4d0SZheng Fan //}else 1222*766ce4d0SZheng Fan { 1223*766ce4d0SZheng Fan pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; 1224*766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1225*766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1226*766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1227*766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1228*766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; 1229*766ce4d0SZheng Fan } 1230*766ce4d0SZheng Fan } 1231*766ce4d0SZheng Fan }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) 1232*766ce4d0SZheng Fan { 1233*766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 1234*766ce4d0SZheng Fan const Graphic* pGrf = 0; 1235*766ce4d0SZheng Fan if ( pBrsh ) 1236*766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 1237*766ce4d0SZheng Fan else 1238*766ce4d0SZheng Fan return sal_False; 1239*766ce4d0SZheng Fan 1240*766ce4d0SZheng Fan String sEmpty; 1241*766ce4d0SZheng Fan const String* pGrfName = 0; 1242*766ce4d0SZheng Fan if ( pGrf ) 1243*766ce4d0SZheng Fan { 1244*766ce4d0SZheng Fan pGrfName = pBrsh->GetGraphicLink(); 1245*766ce4d0SZheng Fan 1246*766ce4d0SZheng Fan pActualBullets[nIndex]->eType = eNBType::GRAPHICBULLETS; 1247*766ce4d0SZheng Fan pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr 1248*766ce4d0SZheng Fan pActualBullets[nIndex]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 1249*766ce4d0SZheng Fan if (pGrfName) 1250*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sGrfName = *pGrfName; 1251*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; 1252*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::GRAPHICBULLETS; 1253*766ce4d0SZheng Fan GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); 1254*766ce4d0SZheng Fan if ( mGrfTMgr ) 1255*766ce4d0SZheng Fan { 1256*766ce4d0SZheng Fan //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1257*766ce4d0SZheng Fan //if ( nDIndex != (sal_uInt16)0xFFFF) 1258*766ce4d0SZheng Fan //{ 1259*766ce4d0SZheng Fan // pActualBullets[nIndex]->nIndexDefault = nDIndex - 1; 1260*766ce4d0SZheng Fan // ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = mGrfTMgr->GetDescription(nDIndex - 1); 1261*766ce4d0SZheng Fan //}else 1262*766ce4d0SZheng Fan { 1263*766ce4d0SZheng Fan pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; 1264*766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1265*766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1266*766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1267*766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1268*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; 1269*766ce4d0SZheng Fan //((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = pGrf; 1270*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); 1271*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); 1272*766ce4d0SZheng Fan //Sym3_2508 use standard unit to store size 1273*766ce4d0SZheng Fan Size aTmpSize = aFmt.GetGraphicSize(); 1274*766ce4d0SZheng Fan aTmpSize = OutputDevice::LogicToLogic(aTmpSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); 1275*766ce4d0SZheng Fan sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1276*766ce4d0SZheng Fan if (nDIndex!=(sal_uInt16)0xFFFF) aTmpSize=Size(0,0); 1277*766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->aSize = aTmpSize; 1278*766ce4d0SZheng Fan 1279*766ce4d0SZheng Fan } 1280*766ce4d0SZheng Fan } 1281*766ce4d0SZheng Fan } 1282*766ce4d0SZheng Fan } 1283*766ce4d0SZheng Fan } 1284*766ce4d0SZheng Fan SvxNumRule aTmpRule1(aNum); 1285*766ce4d0SZheng Fan ApplyNumRule(aTmpRule1,nIndex,mLevel,true); 1286*766ce4d0SZheng Fan if (GetNBOIndexForNumRule(aTmpRule1,mLevel,nIndex)==nIndex+1) { 1287*766ce4d0SZheng Fan if (pActualBullets[nIndex]->eType == eNBType::BULLETS) { 1288*766ce4d0SZheng Fan BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); 1289*766ce4d0SZheng Fan pEntry->bIsCustomized = false; 1290*766ce4d0SZheng Fan pEntry->sDescription = GetDescription(nIndex,true); 1291*766ce4d0SZheng Fan } 1292*766ce4d0SZheng Fan if (pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS) { 1293*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); 1294*766ce4d0SZheng Fan pEntry->bIsCustomized = false; 1295*766ce4d0SZheng Fan pEntry->sDescription = GetDescription(nIndex,true); 1296*766ce4d0SZheng Fan } 1297*766ce4d0SZheng Fan } 1298*766ce4d0SZheng Fan ImplStore(String::CreateFromAscii("standard.sya")); 1299*766ce4d0SZheng Fan return sal_True; 1300*766ce4d0SZheng Fan } 1301*766ce4d0SZheng Fan 1302*766ce4d0SZheng Fan sal_Bool MixBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 1303*766ce4d0SZheng Fan { 1304*766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF || nIndex>=DEFAULT_BULLET_TYPES ) 1305*766ce4d0SZheng Fan if ( nIndex>=DEFAULT_BULLET_TYPES ) 1306*766ce4d0SZheng Fan return sal_False; 1307*766ce4d0SZheng Fan MixBulletsSettings_Impl* pCurrentBullets = pActualBullets[nIndex]; 1308*766ce4d0SZheng Fan if (isDefault) pCurrentBullets=pDefaultActualBullets[nIndex]; 1309*766ce4d0SZheng Fan 1310*766ce4d0SZheng Fan if ( pCurrentBullets->eType == eNBType::BULLETS ) 1311*766ce4d0SZheng Fan { 1312*766ce4d0SZheng Fan sal_Unicode cChar; 1313*766ce4d0SZheng Fan cChar = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->cBulletChar; 1314*766ce4d0SZheng Fan 1315*766ce4d0SZheng Fan //Font& rActBulletFont = lcl_GetDefaultBulletFont(); 1316*766ce4d0SZheng Fan Font rActBulletFont = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->aFont; 1317*766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1318*766ce4d0SZheng Fan String sBulletCharFmtName = GetBulCharFmtName(); 1319*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1320*766ce4d0SZheng Fan { 1321*766ce4d0SZheng Fan if(mLevel & nMask) 1322*766ce4d0SZheng Fan { 1323*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1324*766ce4d0SZheng Fan if (SVX_NUM_CHAR_SPECIAL !=aFmt.GetNumberingType()) isResetSize=true; 1325*766ce4d0SZheng Fan aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); 1326*766ce4d0SZheng Fan aFmt.SetBulletFont(&rActBulletFont); 1327*766ce4d0SZheng Fan aFmt.SetBulletChar(cChar ); 1328*766ce4d0SZheng Fan aFmt.SetCharFmtName(sBulletCharFmtName); 1329*766ce4d0SZheng Fan //Sym3_2398 1330*766ce4d0SZheng Fan String aEmptyStr; 1331*766ce4d0SZheng Fan aFmt.SetPrefix( aEmptyStr ); 1332*766ce4d0SZheng Fan aFmt.SetSuffix( aEmptyStr ); 1333*766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(45); 1334*766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 1335*766ce4d0SZheng Fan } 1336*766ce4d0SZheng Fan nMask <<= 1; 1337*766ce4d0SZheng Fan } 1338*766ce4d0SZheng Fan }else if ( pCurrentBullets->eType == eNBType::GRAPHICBULLETS ) 1339*766ce4d0SZheng Fan { 1340*766ce4d0SZheng Fan String sGrfName; 1341*766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pCurrentBullets->pBullets); 1342*766ce4d0SZheng Fan sGrfName= pEntry->sGrfName; 1343*766ce4d0SZheng Fan 1344*766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1345*766ce4d0SZheng Fan String aEmptyStr; 1346*766ce4d0SZheng Fan sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; 1347*766ce4d0SZheng Fan String sNumCharFmtName = GetBulCharFmtName(); 1348*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1349*766ce4d0SZheng Fan { 1350*766ce4d0SZheng Fan if(mLevel & nMask) 1351*766ce4d0SZheng Fan { 1352*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1353*766ce4d0SZheng Fan if (SVX_NUM_BITMAP !=aFmt.GetNumberingType()) isResetSize=true; 1354*766ce4d0SZheng Fan aFmt.SetNumberingType(nSetNumberingType); 1355*766ce4d0SZheng Fan aFmt.SetPrefix( aEmptyStr ); 1356*766ce4d0SZheng Fan aFmt.SetSuffix( aEmptyStr ); 1357*766ce4d0SZheng Fan aFmt.SetCharFmtName( sNumCharFmtName ); 1358*766ce4d0SZheng Fan if ( pCurrentBullets->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj ) 1359*766ce4d0SZheng Fan { 1360*766ce4d0SZheng Fan Size aSize = pEntry->aSize; 1361*766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 1362*766ce4d0SZheng Fan if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); 1363*766ce4d0SZheng Fan else { 1364*766ce4d0SZheng Fan if (aSize.Width()==0 && aSize.Height()==0) { 1365*766ce4d0SZheng Fan aSize = SvxNumberFormat::GetGraphicSizeMM100( pEntry->pGrfObj ); 1366*766ce4d0SZheng Fan } 1367*766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 1368*766ce4d0SZheng Fan } 1369*766ce4d0SZheng Fan SvxBrushItem aBrush(*(pEntry->pGrfObj), GPOS_AREA, SID_ATTR_BRUSH ); 1370*766ce4d0SZheng Fan aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); 1371*766ce4d0SZheng Fan }else 1372*766ce4d0SZheng Fan { 1373*766ce4d0SZheng Fan Graphic aGraphic; 1374*766ce4d0SZheng Fan if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pCurrentBullets->nIndexDefault, &aGraphic)) 1375*766ce4d0SZheng Fan { 1376*766ce4d0SZheng Fan Size aSize = pEntry->aSize; 1377*766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 1378*766ce4d0SZheng Fan if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); 1379*766ce4d0SZheng Fan else { 1380*766ce4d0SZheng Fan if (aSize.Width()==0 && aSize.Height()==0) { 1381*766ce4d0SZheng Fan aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); 1382*766ce4d0SZheng Fan } 1383*766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 1384*766ce4d0SZheng Fan } 1385*766ce4d0SZheng Fan SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); 1386*766ce4d0SZheng Fan aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); 1387*766ce4d0SZheng Fan }else 1388*766ce4d0SZheng Fan aFmt.SetGraphic( sGrfName ); 1389*766ce4d0SZheng Fan } 1390*766ce4d0SZheng Fan 1391*766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 1392*766ce4d0SZheng Fan } 1393*766ce4d0SZheng Fan nMask <<= 1 ; 1394*766ce4d0SZheng Fan } 1395*766ce4d0SZheng Fan } 1396*766ce4d0SZheng Fan 1397*766ce4d0SZheng Fan return sal_True; 1398*766ce4d0SZheng Fan } 1399*766ce4d0SZheng Fan 1400*766ce4d0SZheng Fan String MixBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 1401*766ce4d0SZheng Fan { 1402*766ce4d0SZheng Fan String sRet; 1403*766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 1404*766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 1405*766ce4d0SZheng Fan 1406*766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 1407*766ce4d0SZheng Fan return sRet; 1408*766ce4d0SZheng Fan else 1409*766ce4d0SZheng Fan sRet = pActualBullets[nIndex]->pBullets->sDescription; 1410*766ce4d0SZheng Fan if (isDefault) sRet = pDefaultActualBullets[nIndex]->pBullets->sDescription; 1411*766ce4d0SZheng Fan return sRet; 1412*766ce4d0SZheng Fan } 1413*766ce4d0SZheng Fan sal_Bool MixBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) 1414*766ce4d0SZheng Fan { 1415*766ce4d0SZheng Fan sal_Bool bRet = sal_False; 1416*766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 1417*766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 1418*766ce4d0SZheng Fan 1419*766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 1420*766ce4d0SZheng Fan bRet = sal_False; 1421*766ce4d0SZheng Fan else 1422*766ce4d0SZheng Fan bRet = pActualBullets[nIndex]->pBullets->bIsCustomized; 1423*766ce4d0SZheng Fan 1424*766ce4d0SZheng Fan return bRet; 1425*766ce4d0SZheng Fan } 1426*766ce4d0SZheng Fan /*************************************************************************************************** 1427*766ce4d0SZheng Fan **********************Numbering Type lib************************************************************** 1428*766ce4d0SZheng Fan ****************************************************************************************************/ 1429*766ce4d0SZheng Fan NumberingTypeMgr* NumberingTypeMgr::_instance = 0; 1430*766ce4d0SZheng Fan 1431*766ce4d0SZheng Fan NumberingTypeMgr::NumberingTypeMgr(const NBOType aType): 1432*766ce4d0SZheng Fan NBOTypeMgrBase(aType), 1433*766ce4d0SZheng Fan //pNumSettingsArr( new NumSettingsArr_Impl ), 1434*766ce4d0SZheng Fan pNumberSettingsArr (new NumberSettingsArr_Impl) 1435*766ce4d0SZheng Fan { 1436*766ce4d0SZheng Fan Init(); 1437*766ce4d0SZheng Fan pDefaultNumberSettingsArr = pNumberSettingsArr; 1438*766ce4d0SZheng Fan pNumberSettingsArr = new NumberSettingsArr_Impl; 1439*766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1440*766ce4d0SZheng Fan Init(); 1441*766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syb")); 1442*766ce4d0SZheng Fan } 1443*766ce4d0SZheng Fan 1444*766ce4d0SZheng Fan NumberingTypeMgr::NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg): 1445*766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg), 1446*766ce4d0SZheng Fan //pNumSettingsArr( new NumSettingsArr_Impl ), 1447*766ce4d0SZheng Fan pNumberSettingsArr (new NumberSettingsArr_Impl) 1448*766ce4d0SZheng Fan { 1449*766ce4d0SZheng Fan Init(); 1450*766ce4d0SZheng Fan pDefaultNumberSettingsArr = pNumberSettingsArr; 1451*766ce4d0SZheng Fan pNumberSettingsArr = new NumberSettingsArr_Impl; 1452*766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1453*766ce4d0SZheng Fan Init(); 1454*766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syb")); 1455*766ce4d0SZheng Fan } 1456*766ce4d0SZheng Fan 1457*766ce4d0SZheng Fan NumberingTypeMgr::NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr): 1458*766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr), 1459*766ce4d0SZheng Fan //pNumSettingsArr( new NumSettingsArr_Impl ), 1460*766ce4d0SZheng Fan pNumberSettingsArr (new NumberSettingsArr_Impl) 1461*766ce4d0SZheng Fan { 1462*766ce4d0SZheng Fan /* 1463*766ce4d0SZheng Fan for(sal_uInt16 i=0;i<aTypeMgr.GetNumCount();i++) 1464*766ce4d0SZheng Fan { 1465*766ce4d0SZheng Fan NumberSettings_Impl* _pSet = aTypeMgr.GetNumSettingByIndex(i); 1466*766ce4d0SZheng Fan if ( _pSet ) 1467*766ce4d0SZheng Fan { 1468*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->nIndex = _pSet->nIndex; 1469*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->nIndexDefault = _pSet->nIndexDefault; 1470*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->sDescription = _pSet->sDescription; 1471*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->bIsCustomized = _pSet->bIsCustomized; 1472*766ce4d0SZheng Fan if ( _pSet->pNumSetting ) 1473*766ce4d0SZheng Fan { 1474*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nNumberType = _pSet->pNumSetting->nNumberType; 1475*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nParentNumbering = _pSet->pNumSetting->nParentNumbering; 1476*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sPrefix = _pSet->pNumSetting->sPrefix; 1477*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sSuffix = _pSet->pNumSetting->sSuffix; 1478*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletChar = _pSet->pNumSetting->sBulletChar; 1479*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletFont = _pSet->pNumSetting->sBulletFont; 1480*766ce4d0SZheng Fan 1481*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->eLabelFollowedBy = _pSet->pNumSetting->eLabelFollowedBy; 1482*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nTabValue = _pSet->pNumSetting->nTabValue; 1483*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->eNumAlign = _pSet->pNumSetting->eNumAlign; 1484*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nNumAlignAt = _pSet->pNumSetting->nNumAlignAt; 1485*766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nNumIndentAt = _pSet->pNumSetting->nNumIndentAt; 1486*766ce4d0SZheng Fan } 1487*766ce4d0SZheng Fan } 1488*766ce4d0SZheng Fan } 1489*766ce4d0SZheng Fan */ 1490*766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syb")); 1491*766ce4d0SZheng Fan } 1492*766ce4d0SZheng Fan 1493*766ce4d0SZheng Fan void NumberingTypeMgr::Init() 1494*766ce4d0SZheng Fan { 1495*766ce4d0SZheng Fan Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); 1496*766ce4d0SZheng Fan Reference < XInterface > xI = xMSF->createInstance( 1497*766ce4d0SZheng Fan ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); 1498*766ce4d0SZheng Fan Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); 1499*766ce4d0SZheng Fan 1500*766ce4d0SZheng Fan if(xDefNum.is()) 1501*766ce4d0SZheng Fan { 1502*766ce4d0SZheng Fan Sequence< Sequence< PropertyValue > > aNumberings; 1503*766ce4d0SZheng Fan LanguageType eLang = Application::GetSettings().GetLanguage(); 1504*766ce4d0SZheng Fan Locale aLocale = SvxCreateLocale(eLang); 1505*766ce4d0SZheng Fan try 1506*766ce4d0SZheng Fan { 1507*766ce4d0SZheng Fan aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale ); 1508*766ce4d0SZheng Fan 1509*766ce4d0SZheng Fan sal_Int32 nLength = aNumberings.getLength() > DEFAULT_NUM_VALUSET_COUNT ? DEFAULT_NUM_VALUSET_COUNT :aNumberings.getLength(); 1510*766ce4d0SZheng Fan 1511*766ce4d0SZheng Fan const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray(); 1512*766ce4d0SZheng Fan for(sal_Int32 i = 0; i < nLength; i++) 1513*766ce4d0SZheng Fan { 1514*766ce4d0SZheng Fan NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(pValuesArr[i]); 1515*766ce4d0SZheng Fan NumberSettings_Impl* pNumEntry = new NumberSettings_Impl; 1516*766ce4d0SZheng Fan pNumEntry->nIndex = i + 1; 1517*766ce4d0SZheng Fan pNumEntry->nIndexDefault = i; 1518*766ce4d0SZheng Fan pNumEntry->pNumSetting = pNew; 1519*766ce4d0SZheng Fan //Modified for Sym2_7882 1520*766ce4d0SZheng Fan //SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i )); 1521*766ce4d0SZheng Fan { 1522*766ce4d0SZheng Fan String sText; 1523*766ce4d0SZheng Fan //const OUString sValue(C2U("Value")); 1524*766ce4d0SZheng Fan Reference<XNumberingFormatter> xFormatter(xDefNum, UNO_QUERY); 1525*766ce4d0SZheng Fan if(xFormatter.is() && aNumberings.getLength() > i) 1526*766ce4d0SZheng Fan { 1527*766ce4d0SZheng Fan 1528*766ce4d0SZheng Fan for (sal_uInt16 j=0;j<3;j++) 1529*766ce4d0SZheng Fan { 1530*766ce4d0SZheng Fan Sequence<PropertyValue> aLevel = aNumberings.getConstArray()[i]; 1531*766ce4d0SZheng Fan try 1532*766ce4d0SZheng Fan { 1533*766ce4d0SZheng Fan aLevel.realloc(aLevel.getLength() + 1); 1534*766ce4d0SZheng Fan PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1]; 1535*766ce4d0SZheng Fan rValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); 1536*766ce4d0SZheng Fan rValue.Value <<= (sal_Int32)(j + 1); 1537*766ce4d0SZheng Fan 1538*766ce4d0SZheng Fan if (j!=0) 1539*766ce4d0SZheng Fan sText += String::CreateFromAscii(" "); 1540*766ce4d0SZheng Fan 1541*766ce4d0SZheng Fan sText+=String(xFormatter->makeNumberingString( aLevel, aLocale )); 1542*766ce4d0SZheng Fan } 1543*766ce4d0SZheng Fan catch(Exception&) 1544*766ce4d0SZheng Fan { 1545*766ce4d0SZheng Fan DBG_ERROR("Exception in DefaultNumberingProvider::makeNumberingString"); 1546*766ce4d0SZheng Fan } 1547*766ce4d0SZheng Fan } 1548*766ce4d0SZheng Fan } 1549*766ce4d0SZheng Fan String aStrFromRES(SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS)); 1550*766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%NUMBERINGSAMPLE"); 1551*766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sText); 1552*766ce4d0SZheng Fan pNumEntry->sDescription = aStrFromRES; 1553*766ce4d0SZheng Fan } 1554*766ce4d0SZheng Fan //End modification 1555*766ce4d0SZheng Fan 1556*766ce4d0SZheng Fan //pNumEntry->sDescription = SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTION_0 + i ); 1557*766ce4d0SZheng Fan pNumberSettingsArr->Insert(pNumEntry, pNumberSettingsArr->Count()); 1558*766ce4d0SZheng Fan } 1559*766ce4d0SZheng Fan } 1560*766ce4d0SZheng Fan catch(Exception&) 1561*766ce4d0SZheng Fan { 1562*766ce4d0SZheng Fan } 1563*766ce4d0SZheng Fan } 1564*766ce4d0SZheng Fan } 1565*766ce4d0SZheng Fan 1566*766ce4d0SZheng Fan sal_uInt16 NumberingTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 1567*766ce4d0SZheng Fan { 1568*766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) 1569*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1570*766ce4d0SZheng Fan 1571*766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1572*766ce4d0SZheng Fan 1573*766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1574*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1575*766ce4d0SZheng Fan 1576*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1577*766ce4d0SZheng Fan sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; 1578*766ce4d0SZheng Fan sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; 1579*766ce4d0SZheng Fan String sPreFix = aFmt.GetPrefix(); 1580*766ce4d0SZheng Fan String sSuffix = aFmt.GetSuffix(); 1581*766ce4d0SZheng Fan String sEmpty; 1582*766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1583*766ce4d0SZheng Fan 1584*766ce4d0SZheng Fan sal_uInt16 nCount = pNumberSettingsArr->Count(); 1585*766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < nCount; i++) 1586*766ce4d0SZheng Fan { 1587*766ce4d0SZheng Fan NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(i); 1588*766ce4d0SZheng Fan sal_Int16 eNType = _pSet->pNumSetting->nNumberType; 1589*766ce4d0SZheng Fan String sLocalPreFix = _pSet->pNumSetting->sPrefix.getStr(); 1590*766ce4d0SZheng Fan String sLocalSuffix = _pSet->pNumSetting->sSuffix.getStr(); 1591*766ce4d0SZheng Fan if (sPreFix.CompareTo(sLocalPreFix)==COMPARE_EQUAL && 1592*766ce4d0SZheng Fan sSuffix.CompareTo(sLocalSuffix)==COMPARE_EQUAL && 1593*766ce4d0SZheng Fan eNumType == eNType ) 1594*766ce4d0SZheng Fan { 1595*766ce4d0SZheng Fan return i+1; 1596*766ce4d0SZheng Fan } 1597*766ce4d0SZheng Fan } 1598*766ce4d0SZheng Fan 1599*766ce4d0SZheng Fan 1600*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1601*766ce4d0SZheng Fan } 1602*766ce4d0SZheng Fan 1603*766ce4d0SZheng Fan sal_Bool NumberingTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 1604*766ce4d0SZheng Fan { 1605*766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 1606*766ce4d0SZheng Fan // return sal_False; 1607*766ce4d0SZheng Fan 1608*766ce4d0SZheng Fan //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 1609*766ce4d0SZheng Fan // return sal_False; 1610*766ce4d0SZheng Fan 1611*766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1612*766ce4d0SZheng Fan 1613*766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1614*766ce4d0SZheng Fan return sal_False; 1615*766ce4d0SZheng Fan 1616*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1617*766ce4d0SZheng Fan //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; 1618*766ce4d0SZheng Fan //sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; 1619*766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1620*766ce4d0SZheng Fan 1621*766ce4d0SZheng Fan sal_uInt16 nCount = pNumberSettingsArr->Count(); 1622*766ce4d0SZheng Fan if ( nIndex >= nCount ) 1623*766ce4d0SZheng Fan return sal_False; 1624*766ce4d0SZheng Fan 1625*766ce4d0SZheng Fan NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(nIndex); 1626*766ce4d0SZheng Fan 1627*766ce4d0SZheng Fan _pSet->pNumSetting->sPrefix = aFmt.GetPrefix(); 1628*766ce4d0SZheng Fan _pSet->pNumSetting->sSuffix = aFmt.GetSuffix(); 1629*766ce4d0SZheng Fan _pSet->pNumSetting->nNumberType = eNumType; 1630*766ce4d0SZheng Fan _pSet->bIsCustomized = sal_True; 1631*766ce4d0SZheng Fan 1632*766ce4d0SZheng Fan SvxNumRule aTmpRule1(aNum); 1633*766ce4d0SZheng Fan SvxNumRule aTmpRule2(aNum); 1634*766ce4d0SZheng Fan ApplyNumRule(aTmpRule1,nIndex,mLevel,true); 1635*766ce4d0SZheng Fan ApplyNumRule(aTmpRule2,nIndex,mLevel,false); 1636*766ce4d0SZheng Fan if (aTmpRule1==aTmpRule2) _pSet->bIsCustomized=false; 1637*766ce4d0SZheng Fan if (_pSet->bIsCustomized) { 1638*766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_NUMBERING_DESCRIPTION)); 1639*766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1640*766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1641*766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1642*766ce4d0SZheng Fan _pSet->sDescription = aStrFromRES; 1643*766ce4d0SZheng Fan } else { 1644*766ce4d0SZheng Fan _pSet->sDescription = GetDescription(nIndex,true); 1645*766ce4d0SZheng Fan } 1646*766ce4d0SZheng Fan ImplStore(String::CreateFromAscii("standard.syb")); 1647*766ce4d0SZheng Fan return sal_True; 1648*766ce4d0SZheng Fan } 1649*766ce4d0SZheng Fan 1650*766ce4d0SZheng Fan sal_Bool NumberingTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 1651*766ce4d0SZheng Fan { 1652*766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 1653*766ce4d0SZheng Fan // return sal_False; 1654*766ce4d0SZheng Fan 1655*766ce4d0SZheng Fan //DBG_ASSERT(pNumSettingsArr->Count() > nIndex, "wrong index"); 1656*766ce4d0SZheng Fan if(pNumberSettingsArr->Count() <= nIndex) 1657*766ce4d0SZheng Fan return sal_False; 1658*766ce4d0SZheng Fan NumberSettingsArr_Impl* pCurrentNumberSettingsArr=pNumberSettingsArr; 1659*766ce4d0SZheng Fan if (isDefault) pCurrentNumberSettingsArr=pDefaultNumberSettingsArr; 1660*766ce4d0SZheng Fan NumberSettings_ImplPtr _pSet = pCurrentNumberSettingsArr->GetObject(nIndex); 1661*766ce4d0SZheng Fan sal_Int16 eNewType = _pSet->pNumSetting->nNumberType; 1662*766ce4d0SZheng Fan 1663*766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1664*766ce4d0SZheng Fan String sNumCharFmtName = GetBulCharFmtName(); 1665*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1666*766ce4d0SZheng Fan { 1667*766ce4d0SZheng Fan if(mLevel & nMask) 1668*766ce4d0SZheng Fan { 1669*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1670*766ce4d0SZheng Fan if (eNewType!=aFmt.GetNumberingType()) isResetSize=true; 1671*766ce4d0SZheng Fan aFmt.SetNumberingType(eNewType); 1672*766ce4d0SZheng Fan aFmt.SetPrefix(_pSet->pNumSetting->sPrefix); 1673*766ce4d0SZheng Fan aFmt.SetSuffix(_pSet->pNumSetting->sSuffix); 1674*766ce4d0SZheng Fan 1675*766ce4d0SZheng Fan aFmt.SetCharFmtName(sNumCharFmtName); 1676*766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(100); 1677*766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 1678*766ce4d0SZheng Fan } 1679*766ce4d0SZheng Fan nMask <<= 1 ; 1680*766ce4d0SZheng Fan } 1681*766ce4d0SZheng Fan 1682*766ce4d0SZheng Fan return sal_True; 1683*766ce4d0SZheng Fan } 1684*766ce4d0SZheng Fan String NumberingTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 1685*766ce4d0SZheng Fan { 1686*766ce4d0SZheng Fan String sRet; 1687*766ce4d0SZheng Fan sal_uInt16 nLength = 0; 1688*766ce4d0SZheng Fan nLength = pNumberSettingsArr->Count(); 1689*766ce4d0SZheng Fan 1690*766ce4d0SZheng Fan if ( nIndex >= nLength ) 1691*766ce4d0SZheng Fan return sRet; 1692*766ce4d0SZheng Fan else 1693*766ce4d0SZheng Fan sRet = pNumberSettingsArr->GetObject(nIndex)->sDescription; 1694*766ce4d0SZheng Fan if (isDefault) sRet = pDefaultNumberSettingsArr->GetObject(nIndex)->sDescription; 1695*766ce4d0SZheng Fan 1696*766ce4d0SZheng Fan return sRet; 1697*766ce4d0SZheng Fan } 1698*766ce4d0SZheng Fan sal_Bool NumberingTypeMgr::IsCustomized(sal_uInt16 nIndex) 1699*766ce4d0SZheng Fan { 1700*766ce4d0SZheng Fan sal_Bool bRet = sal_False; 1701*766ce4d0SZheng Fan sal_uInt16 nLength = 0; 1702*766ce4d0SZheng Fan nLength = pNumberSettingsArr->Count(); 1703*766ce4d0SZheng Fan 1704*766ce4d0SZheng Fan if ( nIndex >= nLength ) 1705*766ce4d0SZheng Fan bRet = sal_False; 1706*766ce4d0SZheng Fan else 1707*766ce4d0SZheng Fan bRet = pNumberSettingsArr->GetObject(nIndex)->bIsCustomized; 1708*766ce4d0SZheng Fan 1709*766ce4d0SZheng Fan return bRet; 1710*766ce4d0SZheng Fan } 1711*766ce4d0SZheng Fan sal_uInt16 NumberingTypeMgr::GetNumCount() const 1712*766ce4d0SZheng Fan { 1713*766ce4d0SZheng Fan sal_uInt16 nRet = 0; 1714*766ce4d0SZheng Fan if ( pNumberSettingsArr ) 1715*766ce4d0SZheng Fan nRet = pNumberSettingsArr->Count(); 1716*766ce4d0SZheng Fan 1717*766ce4d0SZheng Fan return nRet; 1718*766ce4d0SZheng Fan } 1719*766ce4d0SZheng Fan NumberSettings_Impl* NumberingTypeMgr::GetNumSettingByIndex(sal_uInt16 nIndex) const 1720*766ce4d0SZheng Fan { 1721*766ce4d0SZheng Fan NumberSettings_Impl* pRet = 0; 1722*766ce4d0SZheng Fan if ( pNumberSettingsArr && nIndex< pNumberSettingsArr->Count() ) 1723*766ce4d0SZheng Fan { 1724*766ce4d0SZheng Fan pRet = pNumberSettingsArr->GetObject(nIndex); 1725*766ce4d0SZheng Fan } 1726*766ce4d0SZheng Fan 1727*766ce4d0SZheng Fan return pRet; 1728*766ce4d0SZheng Fan } 1729*766ce4d0SZheng Fan /*************************************************************************************************** 1730*766ce4d0SZheng Fan **********************Multi-level /Outline Type lib******************************************************* 1731*766ce4d0SZheng Fan ****************************************************************************************************/ 1732*766ce4d0SZheng Fan OutlineTypeMgr* OutlineTypeMgr::_instance = 0; 1733*766ce4d0SZheng Fan 1734*766ce4d0SZheng Fan OutlineTypeMgr::OutlineTypeMgr(const NBOType aType): 1735*766ce4d0SZheng Fan NBOTypeMgrBase(aType)//, 1736*766ce4d0SZheng Fan //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT] ) 1737*766ce4d0SZheng Fan { 1738*766ce4d0SZheng Fan Init(); 1739*766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) 1740*766ce4d0SZheng Fan { 1741*766ce4d0SZheng Fan pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; 1742*766ce4d0SZheng Fan } 1743*766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1744*766ce4d0SZheng Fan Init(); 1745*766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syc")); 1746*766ce4d0SZheng Fan } 1747*766ce4d0SZheng Fan 1748*766ce4d0SZheng Fan OutlineTypeMgr::OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg): 1749*766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg)//, 1750*766ce4d0SZheng Fan //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) 1751*766ce4d0SZheng Fan { 1752*766ce4d0SZheng Fan Init(); 1753*766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) 1754*766ce4d0SZheng Fan { 1755*766ce4d0SZheng Fan pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; 1756*766ce4d0SZheng Fan } 1757*766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1758*766ce4d0SZheng Fan Init(); 1759*766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syc")); 1760*766ce4d0SZheng Fan } 1761*766ce4d0SZheng Fan 1762*766ce4d0SZheng Fan OutlineTypeMgr::OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr): 1763*766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr)//, 1764*766ce4d0SZheng Fan //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) 1765*766ce4d0SZheng Fan { 1766*766ce4d0SZheng Fan Init(); 1767*766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) 1768*766ce4d0SZheng Fan { 1769*766ce4d0SZheng Fan pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; 1770*766ce4d0SZheng Fan } 1771*766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1772*766ce4d0SZheng Fan Init(); 1773*766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syc")); 1774*766ce4d0SZheng Fan } 1775*766ce4d0SZheng Fan 1776*766ce4d0SZheng Fan void OutlineTypeMgr::Init() 1777*766ce4d0SZheng Fan { 1778*766ce4d0SZheng Fan Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); 1779*766ce4d0SZheng Fan Reference < XInterface > xI = xMSF->createInstance( 1780*766ce4d0SZheng Fan ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); 1781*766ce4d0SZheng Fan Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); 1782*766ce4d0SZheng Fan 1783*766ce4d0SZheng Fan if(xDefNum.is()) 1784*766ce4d0SZheng Fan { 1785*766ce4d0SZheng Fan Sequence<Reference<XIndexAccess> > aOutlineAccess; 1786*766ce4d0SZheng Fan LanguageType eLang = Application::GetSettings().GetLanguage(); 1787*766ce4d0SZheng Fan Locale aLocale = SvxCreateLocale(eLang); 1788*766ce4d0SZheng Fan try 1789*766ce4d0SZheng Fan { 1790*766ce4d0SZheng Fan aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); 1791*766ce4d0SZheng Fan 1792*766ce4d0SZheng Fan SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , 1793*766ce4d0SZheng Fan SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); 1794*766ce4d0SZheng Fan 1795*766ce4d0SZheng Fan for(sal_Int32 nItem = 0; 1796*766ce4d0SZheng Fan nItem < aOutlineAccess.getLength() && nItem < DEFAULT_NUM_VALUSET_COUNT; 1797*766ce4d0SZheng Fan nItem++ ) 1798*766ce4d0SZheng Fan { 1799*766ce4d0SZheng Fan pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl; 1800*766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ]; 1801*766ce4d0SZheng Fan pItemArr->sDescription = SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 + nItem ); 1802*766ce4d0SZheng Fan pItemArr->pNumSettingsArr = new NumSettingsArr_Impl; 1803*766ce4d0SZheng Fan Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem]; 1804*766ce4d0SZheng Fan for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) 1805*766ce4d0SZheng Fan { 1806*766ce4d0SZheng Fan Any aValueAny = xLevel->getByIndex(nLevel); 1807*766ce4d0SZheng Fan Sequence<PropertyValue> aLevelProps; 1808*766ce4d0SZheng Fan aValueAny >>= aLevelProps; 1809*766ce4d0SZheng Fan NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(aLevelProps); 1810*766ce4d0SZheng Fan SvxNumberFormat aNumFmt( aDefNumRule.GetLevel( nLevel) ); 1811*766ce4d0SZheng Fan pNew->eLabelFollowedBy = aNumFmt.GetLabelFollowedBy(); 1812*766ce4d0SZheng Fan pNew->nTabValue = aNumFmt.GetListtabPos(); 1813*766ce4d0SZheng Fan pNew->eNumAlign = aNumFmt.GetNumAdjust(); 1814*766ce4d0SZheng Fan pNew->nNumAlignAt = aNumFmt.GetFirstLineIndent(); 1815*766ce4d0SZheng Fan pNew->nNumIndentAt = aNumFmt.GetIndentAt(); 1816*766ce4d0SZheng Fan pItemArr->pNumSettingsArr->Insert( pNew, pItemArr->pNumSettingsArr->Count() ); 1817*766ce4d0SZheng Fan } 1818*766ce4d0SZheng Fan } 1819*766ce4d0SZheng Fan } 1820*766ce4d0SZheng Fan catch(Exception&) 1821*766ce4d0SZheng Fan { 1822*766ce4d0SZheng Fan } 1823*766ce4d0SZheng Fan } 1824*766ce4d0SZheng Fan } 1825*766ce4d0SZheng Fan 1826*766ce4d0SZheng Fan sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 1827*766ce4d0SZheng Fan { 1828*766ce4d0SZheng Fan sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 1829*766ce4d0SZheng Fan for(sal_uInt16 iDex = nFromIndex; iDex < nLength; iDex++) 1830*766ce4d0SZheng Fan { 1831*766ce4d0SZheng Fan sal_Bool bNotMatch = sal_False; 1832*766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[iDex]; 1833*766ce4d0SZheng Fan sal_uInt16 nCount = pItemArr->pNumSettingsArr->Count(); 1834*766ce4d0SZheng Fan for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) 1835*766ce4d0SZheng Fan { 1836*766ce4d0SZheng Fan NumSettings_ImplPtr _pSet = pItemArr->pNumSettingsArr->GetObject(iLevel); 1837*766ce4d0SZheng Fan sal_Int16 eNType = _pSet->nNumberType; 1838*766ce4d0SZheng Fan const sal_Unicode cLocalPrefix = _pSet->sPrefix.getLength() ? _pSet->sPrefix.getStr()[0] : 0; 1839*766ce4d0SZheng Fan const sal_Unicode cLocalSuffix = _pSet->sSuffix.getLength() ? _pSet->sSuffix.getStr()[0] : 0; 1840*766ce4d0SZheng Fan 1841*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); 1842*766ce4d0SZheng Fan sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; 1843*766ce4d0SZheng Fan sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; 1844*766ce4d0SZheng Fan String sPreFix = aFmt.GetPrefix(); 1845*766ce4d0SZheng Fan String sSuffix = aFmt.GetSuffix(); 1846*766ce4d0SZheng Fan String sEmpty; 1847*766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1848*766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL) 1849*766ce4d0SZheng Fan { 1850*766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1851*766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1852*766ce4d0SZheng Fan sal_Unicode ccChar = _pSet->sBulletChar.getStr()[0]; 1853*766ce4d0SZheng Fan rtl::OUString sFont = _pSet->sBulletFont; 1854*766ce4d0SZheng Fan if ( !((cChar == ccChar) && //pFont && sFont.compareTo(pFont->GetName()) && 1855*766ce4d0SZheng Fan _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && 1856*766ce4d0SZheng Fan _pSet->nTabValue == aFmt.GetListtabPos() && 1857*766ce4d0SZheng Fan _pSet->eNumAlign == aFmt.GetNumAdjust() && 1858*766ce4d0SZheng Fan _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && 1859*766ce4d0SZheng Fan _pSet->nNumIndentAt == aFmt.GetIndentAt())) 1860*766ce4d0SZheng Fan { 1861*766ce4d0SZheng Fan bNotMatch = sal_True; 1862*766ce4d0SZheng Fan break; 1863*766ce4d0SZheng Fan } 1864*766ce4d0SZheng Fan }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { 1865*766ce4d0SZheng Fan const SvxBrushItem* pBrsh1 = aFmt.GetBrush(); 1866*766ce4d0SZheng Fan const SvxBrushItem* pBrsh2 = _pSet->pBrushItem; 1867*766ce4d0SZheng Fan sal_Bool bIsMatch = false; 1868*766ce4d0SZheng Fan if (pBrsh1==pBrsh2) bIsMatch = true; 1869*766ce4d0SZheng Fan if (pBrsh1 && pBrsh2) { 1870*766ce4d0SZheng Fan const Graphic* pGrf1 = pBrsh1->GetGraphic();; 1871*766ce4d0SZheng Fan const Graphic* pGrf2 = pBrsh2->GetGraphic();; 1872*766ce4d0SZheng Fan if (pGrf1==pGrf2) bIsMatch = true; 1873*766ce4d0SZheng Fan if (pGrf1 && pGrf2) { 1874*766ce4d0SZheng Fan if ( pGrf1->GetBitmap().IsEqual(pGrf2->GetBitmap()) && 1875*766ce4d0SZheng Fan _pSet->aSize==aFmt.GetGraphicSize()) 1876*766ce4d0SZheng Fan bIsMatch = true; 1877*766ce4d0SZheng Fan } 1878*766ce4d0SZheng Fan } 1879*766ce4d0SZheng Fan if (!bIsMatch) { 1880*766ce4d0SZheng Fan bNotMatch = sal_True; 1881*766ce4d0SZheng Fan break; 1882*766ce4d0SZheng Fan } 1883*766ce4d0SZheng Fan } else 1884*766ce4d0SZheng Fan { 1885*766ce4d0SZheng Fan if (!((sPreFix.CompareTo(_pSet->sPrefix.getStr())==COMPARE_EQUAL) && 1886*766ce4d0SZheng Fan ( sSuffix.CompareTo(_pSet->sSuffix.getStr())==COMPARE_EQUAL ) && 1887*766ce4d0SZheng Fan eNumType == eNType && 1888*766ce4d0SZheng Fan _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && 1889*766ce4d0SZheng Fan _pSet->nTabValue == aFmt.GetListtabPos() && 1890*766ce4d0SZheng Fan _pSet->eNumAlign == aFmt.GetNumAdjust() && 1891*766ce4d0SZheng Fan _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && 1892*766ce4d0SZheng Fan _pSet->nNumIndentAt == aFmt.GetIndentAt())) 1893*766ce4d0SZheng Fan { 1894*766ce4d0SZheng Fan bNotMatch = sal_True; 1895*766ce4d0SZheng Fan break; 1896*766ce4d0SZheng Fan } 1897*766ce4d0SZheng Fan } 1898*766ce4d0SZheng Fan } 1899*766ce4d0SZheng Fan if ( !bNotMatch ) 1900*766ce4d0SZheng Fan return iDex+1; 1901*766ce4d0SZheng Fan } 1902*766ce4d0SZheng Fan 1903*766ce4d0SZheng Fan 1904*766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1905*766ce4d0SZheng Fan } 1906*766ce4d0SZheng Fan 1907*766ce4d0SZheng Fan sal_Bool OutlineTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 1908*766ce4d0SZheng Fan { 1909*766ce4d0SZheng Fan //if ( mLevel == 0 || mLevel == (sal_uInt16)0xFFFF ) 1910*766ce4d0SZheng Fan // return sal_False; 1911*766ce4d0SZheng Fan 1912*766ce4d0SZheng Fan sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 1913*766ce4d0SZheng Fan if ( nIndex >= nLength ) 1914*766ce4d0SZheng Fan return sal_False; 1915*766ce4d0SZheng Fan 1916*766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 1917*766ce4d0SZheng Fan sal_uInt16 nCount = pItemArr->pNumSettingsArr->Count(); 1918*766ce4d0SZheng Fan for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) 1919*766ce4d0SZheng Fan { 1920*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); 1921*766ce4d0SZheng Fan sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; 1922*766ce4d0SZheng Fan sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; 1923*766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1924*766ce4d0SZheng Fan 1925*766ce4d0SZheng Fan NumSettings_ImplPtr _pSet = pItemArr->pNumSettingsArr->GetObject(iLevel); 1926*766ce4d0SZheng Fan 1927*766ce4d0SZheng Fan _pSet->eLabelFollowedBy = aFmt.GetLabelFollowedBy(); 1928*766ce4d0SZheng Fan _pSet->nTabValue = aFmt.GetListtabPos(); 1929*766ce4d0SZheng Fan _pSet->eNumAlign = aFmt.GetNumAdjust(); 1930*766ce4d0SZheng Fan _pSet->nNumAlignAt = aFmt.GetFirstLineIndent(); 1931*766ce4d0SZheng Fan _pSet->nNumIndentAt = aFmt.GetIndentAt(); 1932*766ce4d0SZheng Fan 1933*766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL) 1934*766ce4d0SZheng Fan { 1935*766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1936*766ce4d0SZheng Fan OUString sChar(cChar); 1937*766ce4d0SZheng Fan _pSet->sBulletChar = sChar;//OUString(cChar); 1938*766ce4d0SZheng Fan if ( aFmt.GetBulletFont() ) 1939*766ce4d0SZheng Fan _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); 1940*766ce4d0SZheng Fan _pSet->nNumberType = eNumType; 1941*766ce4d0SZheng Fan pItemArr->bIsCustomized = sal_True; 1942*766ce4d0SZheng Fan }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { 1943*766ce4d0SZheng Fan if (_pSet->pBrushItem) { 1944*766ce4d0SZheng Fan delete (_pSet->pBrushItem); 1945*766ce4d0SZheng Fan _pSet->pBrushItem=NULL; 1946*766ce4d0SZheng Fan } 1947*766ce4d0SZheng Fan if (aFmt.GetBrush()) 1948*766ce4d0SZheng Fan _pSet->pBrushItem = new SvxBrushItem(*aFmt.GetBrush()); 1949*766ce4d0SZheng Fan _pSet->aSize = aFmt.GetGraphicSize(); 1950*766ce4d0SZheng Fan _pSet->nNumberType = eNumType; 1951*766ce4d0SZheng Fan } else 1952*766ce4d0SZheng Fan { 1953*766ce4d0SZheng Fan _pSet->sPrefix = aFmt.GetPrefix(); 1954*766ce4d0SZheng Fan _pSet->sSuffix = aFmt.GetSuffix(); 1955*766ce4d0SZheng Fan _pSet->nNumberType = eNumType; 1956*766ce4d0SZheng Fan if ( aFmt.GetBulletFont() ) 1957*766ce4d0SZheng Fan _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); 1958*766ce4d0SZheng Fan pItemArr->bIsCustomized = sal_True; 1959*766ce4d0SZheng Fan } 1960*766ce4d0SZheng Fan } 1961*766ce4d0SZheng Fan SvxNumRule aTmpRule1(aNum); 1962*766ce4d0SZheng Fan SvxNumRule aTmpRule2(aNum); 1963*766ce4d0SZheng Fan ApplyNumRule(aTmpRule1,nIndex,mLevel,true); 1964*766ce4d0SZheng Fan ApplyNumRule(aTmpRule2,nIndex,mLevel,false); 1965*766ce4d0SZheng Fan if (aTmpRule1==aTmpRule2) pItemArr->bIsCustomized=false; 1966*766ce4d0SZheng Fan if (pItemArr->bIsCustomized) { 1967*766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_MULTILEVEL_DESCRIPTION)); 1968*766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1969*766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1970*766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1971*766ce4d0SZheng Fan pItemArr->sDescription = aStrFromRES; 1972*766ce4d0SZheng Fan } else { 1973*766ce4d0SZheng Fan pItemArr->sDescription = GetDescription(nIndex,true); 1974*766ce4d0SZheng Fan } 1975*766ce4d0SZheng Fan ImplStore(String::CreateFromAscii("standard.syc")); 1976*766ce4d0SZheng Fan return sal_True; 1977*766ce4d0SZheng Fan } 1978*766ce4d0SZheng Fan 1979*766ce4d0SZheng Fan sal_Bool OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 1980*766ce4d0SZheng Fan { 1981*766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 1982*766ce4d0SZheng Fan // return sal_False; 1983*766ce4d0SZheng Fan 1984*766ce4d0SZheng Fan DBG_ASSERT(DEFAULT_NUM_VALUSET_COUNT > nIndex, "wrong index"); 1985*766ce4d0SZheng Fan if(DEFAULT_NUM_VALUSET_COUNT <= nIndex) 1986*766ce4d0SZheng Fan return sal_False; 1987*766ce4d0SZheng Fan 1988*766ce4d0SZheng Fan const FontList* pList = 0; 1989*766ce4d0SZheng Fan 1990*766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 1991*766ce4d0SZheng Fan if (isDefault) pItemArr=pDefaultOutlineSettingsArrs[nIndex]; 1992*766ce4d0SZheng Fan 1993*766ce4d0SZheng Fan //Font& rActBulletFont = lcl_GetDefaultBulletFont(); 1994*766ce4d0SZheng Fan NumSettingsArr_Impl *pNumSettingsArr=pItemArr->pNumSettingsArr; 1995*766ce4d0SZheng Fan 1996*766ce4d0SZheng Fan NumSettings_ImplPtr pLevelSettings = 0; 1997*766ce4d0SZheng Fan String sBulletCharFmtName = GetBulCharFmtName(); 1998*766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1999*766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 2000*766ce4d0SZheng Fan { 2001*766ce4d0SZheng Fan if(pNumSettingsArr->Count() > i) 2002*766ce4d0SZheng Fan pLevelSettings = pNumSettingsArr->GetObject(i); 2003*766ce4d0SZheng Fan 2004*766ce4d0SZheng Fan if(!pLevelSettings) 2005*766ce4d0SZheng Fan break; 2006*766ce4d0SZheng Fan 2007*766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 2008*766ce4d0SZheng Fan //aFmt.SetBulletFont(&pLevelSettings->aFont); 2009*766ce4d0SZheng Fan Font& rActBulletFont = lcl_GetDefaultBulletFont(); 2010*766ce4d0SZheng Fan if (pLevelSettings->nNumberType !=aFmt.GetNumberingType()) isResetSize=true; 2011*766ce4d0SZheng Fan aFmt.SetNumberingType( pLevelSettings->nNumberType ); 2012*766ce4d0SZheng Fan sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering; 2013*766ce4d0SZheng Fan if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) 2014*766ce4d0SZheng Fan { 2015*766ce4d0SZheng Fan if( pLevelSettings->sBulletFont.getLength() && 2016*766ce4d0SZheng Fan pLevelSettings->sBulletFont.compareTo(rActBulletFont.GetName())) 2017*766ce4d0SZheng Fan { 2018*766ce4d0SZheng Fan //search for the font 2019*766ce4d0SZheng Fan if(!pList) 2020*766ce4d0SZheng Fan { 2021*766ce4d0SZheng Fan SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); 2022*766ce4d0SZheng Fan const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pCurDocShell->GetItem( SID_ATTR_CHAR_FONTLIST ); 2023*766ce4d0SZheng Fan pList = pFontListItem ? pFontListItem->GetFontList() : 0; 2024*766ce4d0SZheng Fan } 2025*766ce4d0SZheng Fan if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) ) 2026*766ce4d0SZheng Fan { 2027*766ce4d0SZheng Fan FontInfo aInfo = pList->Get(pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE); 2028*766ce4d0SZheng Fan Font aFont(aInfo); 2029*766ce4d0SZheng Fan aFmt.SetBulletFont(&aFont); 2030*766ce4d0SZheng Fan } 2031*766ce4d0SZheng Fan else 2032*766ce4d0SZheng Fan { 2033*766ce4d0SZheng Fan //if it cannot be found then create a new one 2034*766ce4d0SZheng Fan Font aCreateFont( pLevelSettings->sBulletFont,String(), Size( 0, 14 ) ); 2035*766ce4d0SZheng Fan aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); 2036*766ce4d0SZheng Fan aCreateFont.SetFamily( FAMILY_DONTKNOW ); 2037*766ce4d0SZheng Fan aCreateFont.SetPitch( PITCH_DONTKNOW ); 2038*766ce4d0SZheng Fan aCreateFont.SetWeight( WEIGHT_DONTKNOW ); 2039*766ce4d0SZheng Fan aCreateFont.SetTransparent( sal_True ); 2040*766ce4d0SZheng Fan aFmt.SetBulletFont( &aCreateFont ); 2041*766ce4d0SZheng Fan } 2042*766ce4d0SZheng Fan }else 2043*766ce4d0SZheng Fan aFmt.SetBulletFont( &rActBulletFont ); 2044*766ce4d0SZheng Fan 2045*766ce4d0SZheng Fan sal_Unicode cChar = 0; 2046*766ce4d0SZheng Fan if( pLevelSettings->sBulletChar.getLength() ) 2047*766ce4d0SZheng Fan cChar = pLevelSettings->sBulletChar.getStr()[0]; 2048*766ce4d0SZheng Fan if( Application::GetSettings().GetLayoutRTL() ) 2049*766ce4d0SZheng Fan { 2050*766ce4d0SZheng Fan if( 0 == i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] ) 2051*766ce4d0SZheng Fan cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[5]; 2052*766ce4d0SZheng Fan else if( 1 == i ) 2053*766ce4d0SZheng Fan { 2054*766ce4d0SZheng Fan const SvxNumberFormat& numberFmt = aNum.GetLevel(0); 2055*766ce4d0SZheng Fan if( numberFmt.GetBulletChar() == BulletsTypeMgr::aDynamicRTLBulletTypes[5] ) 2056*766ce4d0SZheng Fan cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[4]; 2057*766ce4d0SZheng Fan } 2058*766ce4d0SZheng Fan } 2059*766ce4d0SZheng Fan 2060*766ce4d0SZheng Fan aFmt.SetBulletChar(cChar); 2061*766ce4d0SZheng Fan aFmt.SetCharFmtName( sBulletCharFmtName ); 2062*766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(45); 2063*766ce4d0SZheng Fan }else if ((aFmt.GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { 2064*766ce4d0SZheng Fan if (pLevelSettings->pBrushItem) { 2065*766ce4d0SZheng Fan const Graphic* pGrf = pLevelSettings->pBrushItem->GetGraphic();; 2066*766ce4d0SZheng Fan Size aSize = pLevelSettings->aSize; 2067*766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 2068*766ce4d0SZheng Fan if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); 2069*766ce4d0SZheng Fan else { 2070*766ce4d0SZheng Fan if (aSize.Width()==0 && aSize.Height()==0 && pGrf) { 2071*766ce4d0SZheng Fan aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf ); 2072*766ce4d0SZheng Fan } 2073*766ce4d0SZheng Fan } 2074*766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 2075*766ce4d0SZheng Fan aFmt.SetGraphicBrush( pLevelSettings->pBrushItem, &aSize, &eOrient ); 2076*766ce4d0SZheng Fan } 2077*766ce4d0SZheng Fan } else 2078*766ce4d0SZheng Fan { 2079*766ce4d0SZheng Fan aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? aNum.GetLevelCount() : 0)); 2080*766ce4d0SZheng Fan aFmt.SetCharFmtName(sBulletCharFmtName); 2081*766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(100); 2082*766ce4d0SZheng Fan } 2083*766ce4d0SZheng Fan //Sym3_2636. Do not set indent values if no default value for this level 2084*766ce4d0SZheng Fan if(pNumSettingsArr->Count() > i) { 2085*766ce4d0SZheng Fan aFmt.SetLabelFollowedBy(pLevelSettings->eLabelFollowedBy); 2086*766ce4d0SZheng Fan aFmt.SetListtabPos(pLevelSettings->nTabValue); 2087*766ce4d0SZheng Fan aFmt.SetNumAdjust(pLevelSettings->eNumAlign); 2088*766ce4d0SZheng Fan aFmt.SetFirstLineIndent(pLevelSettings->nNumAlignAt); 2089*766ce4d0SZheng Fan aFmt.SetIndentAt(pLevelSettings->nNumIndentAt); 2090*766ce4d0SZheng Fan } 2091*766ce4d0SZheng Fan aFmt.SetPrefix(pLevelSettings->sPrefix); 2092*766ce4d0SZheng Fan aFmt.SetSuffix(pLevelSettings->sSuffix); 2093*766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 2094*766ce4d0SZheng Fan } 2095*766ce4d0SZheng Fan 2096*766ce4d0SZheng Fan return sal_True; 2097*766ce4d0SZheng Fan } 2098*766ce4d0SZheng Fan String OutlineTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 2099*766ce4d0SZheng Fan { 2100*766ce4d0SZheng Fan String sRet; 2101*766ce4d0SZheng Fan sal_uInt16 nLength = 0; 2102*766ce4d0SZheng Fan nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 2103*766ce4d0SZheng Fan 2104*766ce4d0SZheng Fan if ( nIndex >= nLength ) 2105*766ce4d0SZheng Fan return sRet; 2106*766ce4d0SZheng Fan else 2107*766ce4d0SZheng Fan { 2108*766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 2109*766ce4d0SZheng Fan if (isDefault) pItemArr = pDefaultOutlineSettingsArrs[nIndex]; 2110*766ce4d0SZheng Fan if ( pItemArr ) 2111*766ce4d0SZheng Fan { 2112*766ce4d0SZheng Fan sRet = pItemArr->sDescription; 2113*766ce4d0SZheng Fan }; 2114*766ce4d0SZheng Fan } 2115*766ce4d0SZheng Fan return sRet; 2116*766ce4d0SZheng Fan } 2117*766ce4d0SZheng Fan sal_Bool OutlineTypeMgr::IsCustomized(sal_uInt16 nIndex) 2118*766ce4d0SZheng Fan { 2119*766ce4d0SZheng Fan sal_Bool bRet = sal_False; 2120*766ce4d0SZheng Fan 2121*766ce4d0SZheng Fan sal_uInt16 nLength = 0; 2122*766ce4d0SZheng Fan nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 2123*766ce4d0SZheng Fan 2124*766ce4d0SZheng Fan if ( nIndex >= nLength ) 2125*766ce4d0SZheng Fan return bRet; 2126*766ce4d0SZheng Fan else 2127*766ce4d0SZheng Fan { 2128*766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 2129*766ce4d0SZheng Fan if ( pItemArr ) 2130*766ce4d0SZheng Fan { 2131*766ce4d0SZheng Fan bRet = pItemArr->bIsCustomized; 2132*766ce4d0SZheng Fan }; 2133*766ce4d0SZheng Fan } 2134*766ce4d0SZheng Fan 2135*766ce4d0SZheng Fan return bRet; 2136*766ce4d0SZheng Fan } 2137*766ce4d0SZheng Fan 2138*766ce4d0SZheng Fan 2139*766ce4d0SZheng Fan }} 2140