1*1ff378efSZheng Fan /************************************************************** 2766ce4d0SZheng Fan * 3*1ff378efSZheng Fan * Licensed to the Apache Software Foundation (ASF) under one 4*1ff378efSZheng Fan * or more contributor license agreements. See the NOTICE file 5*1ff378efSZheng Fan * distributed with this work for additional information 6*1ff378efSZheng Fan * regarding copyright ownership. The ASF licenses this file 7*1ff378efSZheng Fan * to you under the Apache License, Version 2.0 (the 8*1ff378efSZheng Fan * "License"); you may not use this file except in compliance 9*1ff378efSZheng Fan * with the License. You may obtain a copy of the License at 10766ce4d0SZheng Fan * 11*1ff378efSZheng Fan * http://www.apache.org/licenses/LICENSE-2.0 12766ce4d0SZheng Fan * 13*1ff378efSZheng Fan * Unless required by applicable law or agreed to in writing, 14*1ff378efSZheng Fan * software distributed under the License is distributed on an 15*1ff378efSZheng Fan * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1ff378efSZheng Fan * KIND, either express or implied. See the License for the 17*1ff378efSZheng Fan * specific language governing permissions and limitations 18*1ff378efSZheng Fan * under the License. 19766ce4d0SZheng Fan * 20*1ff378efSZheng Fan *************************************************************/ 21766ce4d0SZheng Fan #include "precompiled_svx.hxx" 22766ce4d0SZheng Fan #ifndef _NBDTMG_HXX 23766ce4d0SZheng Fan #include <svx/nbdtmg.hxx> 24766ce4d0SZheng Fan #endif 25766ce4d0SZheng Fan #ifndef _SVX_SVXIDS_HRC 26766ce4d0SZheng Fan #include <svx/svxids.hrc> 27766ce4d0SZheng Fan #endif 28766ce4d0SZheng Fan #ifndef _SV_SVAPP_HXX 29766ce4d0SZheng Fan #include <vcl/svapp.hxx> 30766ce4d0SZheng Fan #endif 31766ce4d0SZheng Fan #ifndef _SFXITEMSET_HXX 32766ce4d0SZheng Fan #include <svl/itemset.hxx> 33766ce4d0SZheng Fan #endif 34766ce4d0SZheng Fan #ifndef _SFXREQUEST_HXX 35766ce4d0SZheng Fan #include <sfx2/request.hxx> 36766ce4d0SZheng Fan #endif 37766ce4d0SZheng Fan #ifndef _SFXSTRITEM_HXX 38766ce4d0SZheng Fan #include <svl/stritem.hxx> 39766ce4d0SZheng Fan #endif 40766ce4d0SZheng Fan #ifndef _UNO_LINGU_HXX 41766ce4d0SZheng Fan #include <editeng/unolingu.hxx> 42766ce4d0SZheng Fan #endif 43766ce4d0SZheng Fan #ifndef _CTRLTOOL_HXX 44766ce4d0SZheng Fan #include <svtools/ctrltool.hxx> 45766ce4d0SZheng Fan #endif 46766ce4d0SZheng Fan #ifndef _SFX_OBJSH_HXX 47766ce4d0SZheng Fan #include <sfx2/objsh.hxx> 48766ce4d0SZheng Fan #endif 49766ce4d0SZheng Fan #ifndef _SVX_FLSTITEM_HXX 50766ce4d0SZheng Fan #include <editeng/flstitem.hxx> 51766ce4d0SZheng Fan #endif 52766ce4d0SZheng Fan #ifndef _SFXITEMPOOL_HXX 53766ce4d0SZheng Fan #include <svl/itempool.hxx> 54766ce4d0SZheng Fan #endif 55766ce4d0SZheng Fan #ifndef _SV_OUTDEV_HXX 56766ce4d0SZheng Fan #include <vcl/outdev.hxx> 57766ce4d0SZheng Fan #endif 58766ce4d0SZheng Fan #ifndef _GALLERY_HXX_ 59766ce4d0SZheng Fan #include <svx/gallery.hxx> 60766ce4d0SZheng Fan #endif 61766ce4d0SZheng Fan #ifndef _SVX_BRSHITEM_HXX 62766ce4d0SZheng Fan #include <editeng/brshitem.hxx> 63766ce4d0SZheng Fan #endif 64766ce4d0SZheng Fan #include <svx/dialmgr.hxx> 65766ce4d0SZheng Fan #ifndef _SVX_DIALOGS_HRC 66766ce4d0SZheng Fan #include <svx/dialogs.hrc> 67766ce4d0SZheng Fan #endif 68766ce4d0SZheng Fan #ifndef _SV_GRAPH_HXX 69766ce4d0SZheng Fan #include <vcl/graph.hxx> 70766ce4d0SZheng Fan #endif 71766ce4d0SZheng Fan 72766ce4d0SZheng Fan #include <unotools/streamwrap.hxx> 73766ce4d0SZheng Fan #include <unotools/ucbstreamhelper.hxx> 74766ce4d0SZheng Fan #include <unotools/pathoptions.hxx> 75766ce4d0SZheng Fan #include <editeng/eeitem.hxx> 76766ce4d0SZheng Fan 77766ce4d0SZheng Fan #include <com/sun/star/text/HoriOrientation.hpp> 78766ce4d0SZheng Fan #include <com/sun/star/text/VertOrientation.hpp> 79766ce4d0SZheng Fan #include <com/sun/star/text/RelOrientation.hpp> 80766ce4d0SZheng Fan #include <com/sun/star/style/NumberingType.hpp> 81766ce4d0SZheng Fan #include <com/sun/star/lang/XMultiServiceFactory.hpp> 82766ce4d0SZheng Fan #include <com/sun/star/container/XIndexAccess.hpp> 83766ce4d0SZheng Fan #include <com/sun/star/text/XDefaultNumberingProvider.hpp> 84766ce4d0SZheng Fan #include <com/sun/star/text/XNumberingFormatter.hpp> 85766ce4d0SZheng Fan #include <com/sun/star/beans/PropertyValue.hpp> 86766ce4d0SZheng Fan #include <comphelper/processfactory.hxx> 87766ce4d0SZheng Fan #include <com/sun/star/text/XNumberingTypeInfo.hpp> 88766ce4d0SZheng Fan 89766ce4d0SZheng Fan using namespace com::sun::star; 90766ce4d0SZheng Fan using namespace com::sun::star::uno; 91766ce4d0SZheng Fan using namespace com::sun::star::beans; 92766ce4d0SZheng Fan using namespace com::sun::star::lang; 93766ce4d0SZheng Fan using namespace com::sun::star::text; 94766ce4d0SZheng Fan using namespace com::sun::star::container; 95766ce4d0SZheng Fan using namespace com::sun::star::style; 96766ce4d0SZheng Fan using rtl::OUString; 97766ce4d0SZheng Fan 98766ce4d0SZheng Fan namespace svx { namespace sidebar { 99766ce4d0SZheng Fan #define NUM_TYPE_MEMBER 4 100766ce4d0SZheng Fan #define NUM_VALUSET_COUNT 16 101766ce4d0SZheng Fan #define MAX_VALUESET_GRAPHIC 30 102766ce4d0SZheng Fan 103766ce4d0SZheng Fan typedef NumSettings_Impl* NumSettings_ImplPtr; 104766ce4d0SZheng Fan SV_DECL_PTRARR_DEL(NumSettingsArr_Impl,NumSettings_ImplPtr,8,4) 105766ce4d0SZheng Fan SV_IMPL_PTRARR( NumSettingsArr_Impl, NumSettings_ImplPtr ) 106766ce4d0SZheng Fan 107766ce4d0SZheng Fan typedef NumberSettings_Impl* NumberSettings_ImplPtr; 108766ce4d0SZheng Fan SV_DECL_PTRARR_DEL(NumberSettingsArr_Impl,NumberSettings_ImplPtr,8,4) 109766ce4d0SZheng Fan SV_IMPL_PTRARR( NumberSettingsArr_Impl, NumberSettings_ImplPtr ) 110766ce4d0SZheng Fan 111766ce4d0SZheng Fan Font& lcl_GetDefaultBulletFont() 112766ce4d0SZheng Fan { 113766ce4d0SZheng Fan static sal_Bool bInit = 0; 114766ce4d0SZheng Fan static Font aDefBulletFont( UniString::CreateFromAscii( 115766ce4d0SZheng Fan RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ), 116766ce4d0SZheng Fan String(), Size( 0, 14 ) ); 117766ce4d0SZheng Fan if(!bInit) 118766ce4d0SZheng Fan { 119766ce4d0SZheng Fan aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); 120766ce4d0SZheng Fan aDefBulletFont.SetFamily( FAMILY_DONTKNOW ); 121766ce4d0SZheng Fan aDefBulletFont.SetPitch( PITCH_DONTKNOW ); 122766ce4d0SZheng Fan aDefBulletFont.SetWeight( WEIGHT_DONTKNOW ); 123766ce4d0SZheng Fan aDefBulletFont.SetTransparent( sal_True ); 124766ce4d0SZheng Fan bInit = sal_True; 125766ce4d0SZheng Fan } 126766ce4d0SZheng Fan return aDefBulletFont; 127766ce4d0SZheng Fan } 128766ce4d0SZheng Fan 129766ce4d0SZheng Fan static const sal_Unicode aDefaultBulletTypes[] = 130766ce4d0SZheng Fan { 131766ce4d0SZheng Fan 0x2022, 132766ce4d0SZheng Fan 0x25cf, 133766ce4d0SZheng Fan 0xe00c, 134766ce4d0SZheng Fan 0xe00a, 135766ce4d0SZheng Fan 0x2794, 136766ce4d0SZheng Fan 0x27a2, 137766ce4d0SZheng Fan 0x2717, 138766ce4d0SZheng Fan 0x2714 139766ce4d0SZheng Fan }; 140766ce4d0SZheng Fan 141766ce4d0SZheng Fan static const sal_Unicode aDefaultRTLBulletTypes[] = 142766ce4d0SZheng Fan { 143766ce4d0SZheng Fan 0x2022, 144766ce4d0SZheng Fan 0x25cf, 145766ce4d0SZheng Fan 0xe00c, 146766ce4d0SZheng Fan 0xe00a, 147766ce4d0SZheng Fan 0x25c4, 148766ce4d0SZheng Fan 0x272b, 149766ce4d0SZheng Fan 0x2717, 150766ce4d0SZheng Fan 0x2714 151766ce4d0SZheng Fan }; 152766ce4d0SZheng Fan 153766ce4d0SZheng Fan static const sal_Char sNumberingType[] = "NumberingType"; 154766ce4d0SZheng Fan static const sal_Char sValue[] = "Value"; 155766ce4d0SZheng Fan static const sal_Char sParentNumbering[] = "ParentNumbering"; 156766ce4d0SZheng Fan static const sal_Char sPrefix[] = "Prefix"; 157766ce4d0SZheng Fan static const sal_Char sSuffix[] = "Suffix"; 158766ce4d0SZheng Fan static const sal_Char sBulletChar[] = "BulletChar"; 159766ce4d0SZheng Fan static const sal_Char sBulletFontName[] = "BulletFontName"; 160766ce4d0SZheng Fan 161766ce4d0SZheng Fan NumSettings_ImplPtr lcl_CreateNumberingSettingsPtr(const Sequence<PropertyValue>& rLevelProps) 162766ce4d0SZheng Fan { 163766ce4d0SZheng Fan const PropertyValue* pValues = rLevelProps.getConstArray(); 164766ce4d0SZheng Fan NumSettings_ImplPtr pNew = new NumSettings_Impl; 165766ce4d0SZheng Fan for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++) 166766ce4d0SZheng Fan { 167766ce4d0SZheng Fan if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNumberingType))) 168766ce4d0SZheng Fan pValues[j].Value >>= pNew->nNumberType; 169766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPrefix))) 170766ce4d0SZheng Fan pValues[j].Value >>= pNew->sPrefix; 171766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuffix))) 172766ce4d0SZheng Fan pValues[j].Value >>= pNew->sSuffix; 173766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sParentNumbering))) 174766ce4d0SZheng Fan pValues[j].Value >>= pNew->nParentNumbering; 175766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletChar))) 176766ce4d0SZheng Fan pValues[j].Value >>= pNew->sBulletChar; 177766ce4d0SZheng Fan else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBulletFontName))) 178766ce4d0SZheng Fan pValues[j].Value >>= pNew->sBulletFont; 179766ce4d0SZheng Fan } 180766ce4d0SZheng Fan const sal_Unicode cLocalPrefix = pNew->sPrefix.getLength() ? pNew->sPrefix.getStr()[0] : 0; 181766ce4d0SZheng Fan const sal_Unicode cLocalSuffix = pNew->sSuffix.getLength() ? pNew->sSuffix.getStr()[0] : 0; 182766ce4d0SZheng Fan String aEmptyStr; 183766ce4d0SZheng Fan if( cLocalPrefix == ' ') pNew->sPrefix=aEmptyStr; 184766ce4d0SZheng Fan if( cLocalSuffix == ' ') pNew->sSuffix=aEmptyStr; 185766ce4d0SZheng Fan return pNew; 186766ce4d0SZheng Fan } 187766ce4d0SZheng Fan 188766ce4d0SZheng Fan sal_uInt16 NBOTypeMgrBase:: IsSingleLevel(sal_uInt16 nCurLevel) 189766ce4d0SZheng Fan { 190766ce4d0SZheng Fan sal_uInt16 nLv = (sal_uInt16)0xFFFF; 191766ce4d0SZheng Fan sal_uInt16 nCount = 0; 192766ce4d0SZheng Fan sal_uInt16 nMask = 1; 193766ce4d0SZheng Fan for( sal_uInt16 i = 0; i < SVX_MAX_NUM; i++ ) 194766ce4d0SZheng Fan { 195766ce4d0SZheng Fan if(nCurLevel & nMask) 196766ce4d0SZheng Fan { 197766ce4d0SZheng Fan nCount++; 198766ce4d0SZheng Fan nLv=i; 199766ce4d0SZheng Fan } 200766ce4d0SZheng Fan nMask <<= 1 ; 201766ce4d0SZheng Fan } 202766ce4d0SZheng Fan 203766ce4d0SZheng Fan if ( nCount == 1) 204766ce4d0SZheng Fan return nLv; 205766ce4d0SZheng Fan else 206766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 207766ce4d0SZheng Fan } 208766ce4d0SZheng Fan 209766ce4d0SZheng Fan void NBOTypeMgrBase::StoreBulCharFmtName_impl() { 210766ce4d0SZheng Fan if ( pSet ) 211766ce4d0SZheng Fan { 212766ce4d0SZheng Fan SfxAllItemSet aSet(*pSet); 213766ce4d0SZheng Fan SFX_ITEMSET_ARG(&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); 214766ce4d0SZheng Fan 215766ce4d0SZheng Fan if ( pBulletCharFmt ) 216766ce4d0SZheng Fan { 217766ce4d0SZheng Fan aNumCharFmtName = String(pBulletCharFmt->GetValue()); 218766ce4d0SZheng Fan } 219766ce4d0SZheng Fan } 220766ce4d0SZheng Fan } 221766ce4d0SZheng Fan String NBOTypeMgrBase::GetBulCharFmtName() 222766ce4d0SZheng Fan { 223766ce4d0SZheng Fan return aNumCharFmtName; 224766ce4d0SZheng Fan } 225766ce4d0SZheng Fan void NBOTypeMgrBase::ImplLoad(String filename) 226766ce4d0SZheng Fan { 227766ce4d0SZheng Fan bIsLoading = true; 228766ce4d0SZheng Fan SfxMapUnit eOldCoreUnit=eCoreUnit; 229766ce4d0SZheng Fan eCoreUnit = SFX_MAPUNIT_100TH_MM; 230766ce4d0SZheng Fan INetURLObject aFile( SvtPathOptions().GetPalettePath() ); 231766ce4d0SZheng Fan aFile.Append( filename); 232766ce4d0SZheng Fan SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); 233766ce4d0SZheng Fan if( pIStm ) { 234766ce4d0SZheng Fan sal_uInt32 nVersion; 235766ce4d0SZheng Fan sal_Int32 nNumIndex; 236766ce4d0SZheng Fan *pIStm >> nVersion; 237766ce4d0SZheng Fan if (nVersion==DEFAULT_NUMBERING_CACHE_FORMAT_VERSION) //first version 238766ce4d0SZheng Fan { 239766ce4d0SZheng Fan *pIStm >> nNumIndex; 240766ce4d0SZheng Fan sal_uInt16 mLevel = 0x1; 241766ce4d0SZheng Fan while (nNumIndex>=0 && nNumIndex<DEFAULT_NUM_VALUSET_COUNT) { 242766ce4d0SZheng Fan SvxNumRule aNum(*pIStm); 243766ce4d0SZheng Fan //bullet color in font properties is not stored correctly. Need set tranparency bits manually 244766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 245766ce4d0SZheng Fan { 246766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 247766ce4d0SZheng Fan if (aFmt.GetBulletFont()) { 248766ce4d0SZheng Fan Font aFont(*aFmt.GetBulletFont()); 249766ce4d0SZheng Fan Color c=aFont.GetColor(); 250766ce4d0SZheng Fan c.SetTransparency(0xFF); 251766ce4d0SZheng Fan aFont.SetColor(c); 252766ce4d0SZheng Fan aFmt.SetBulletFont(&aFont); 253766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 254766ce4d0SZheng Fan } 255766ce4d0SZheng Fan } 256766ce4d0SZheng Fan RelplaceNumRule(aNum,nNumIndex,mLevel); 257766ce4d0SZheng Fan *pIStm >> nNumIndex; 258766ce4d0SZheng Fan } 259766ce4d0SZheng Fan delete pIStm; 260766ce4d0SZheng Fan } 261766ce4d0SZheng Fan } 262766ce4d0SZheng Fan eCoreUnit = eOldCoreUnit; 263766ce4d0SZheng Fan bIsLoading = false; 264766ce4d0SZheng Fan } 265766ce4d0SZheng Fan void NBOTypeMgrBase::ImplStore(String filename) 266766ce4d0SZheng Fan { 267766ce4d0SZheng Fan if (bIsLoading) return; 268766ce4d0SZheng Fan SfxMapUnit eOldCoreUnit=eCoreUnit; 269766ce4d0SZheng Fan eCoreUnit = SFX_MAPUNIT_100TH_MM; 270766ce4d0SZheng Fan INetURLObject aFile( SvtPathOptions().GetPalettePath() ); 271766ce4d0SZheng Fan aFile.Append( filename); 272766ce4d0SZheng Fan SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aFile.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE ); 273766ce4d0SZheng Fan if( pOStm ) { 274766ce4d0SZheng Fan sal_uInt32 nVersion; 275766ce4d0SZheng Fan sal_Int32 nNumIndex; 276766ce4d0SZheng Fan nVersion = DEFAULT_NUMBERING_CACHE_FORMAT_VERSION; 277766ce4d0SZheng Fan *pOStm << nVersion; 278766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) { 279766ce4d0SZheng Fan if (IsCustomized(nItem)) { 280766ce4d0SZheng Fan SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , 281766ce4d0SZheng Fan SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); 282766ce4d0SZheng Fan sal_uInt16 mLevel = 0x1; 283766ce4d0SZheng Fan *pOStm << nItem; 284766ce4d0SZheng Fan ApplyNumRule(aDefNumRule,nItem,mLevel,false,true); 285766ce4d0SZheng Fan aDefNumRule.Store(*pOStm); 286766ce4d0SZheng Fan } 287766ce4d0SZheng Fan } 288766ce4d0SZheng Fan nNumIndex = -1; 289766ce4d0SZheng Fan *pOStm << nNumIndex; //write end flag 290766ce4d0SZheng Fan delete pOStm; 291766ce4d0SZheng Fan } 292766ce4d0SZheng Fan eCoreUnit = eOldCoreUnit; 293766ce4d0SZheng Fan } 294766ce4d0SZheng Fan 295766ce4d0SZheng Fan void NBOTypeMgrBase::StoreMapUnit_impl() { 296766ce4d0SZheng Fan if ( pSet ) 297766ce4d0SZheng Fan { 298766ce4d0SZheng Fan const SfxPoolItem* pItem; 299766ce4d0SZheng Fan SfxItemState eState = pSet->GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); 300766ce4d0SZheng Fan if(eState == SFX_ITEM_SET) 301766ce4d0SZheng Fan { 302766ce4d0SZheng Fan eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); 303766ce4d0SZheng Fan } else { 304766ce4d0SZheng Fan //Sym3_2508 sd use different sid for numbering rule 305766ce4d0SZheng Fan eState = pSet->GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem); 306766ce4d0SZheng Fan if(eState == SFX_ITEM_SET) 307766ce4d0SZheng Fan { 308766ce4d0SZheng Fan eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(EE_PARA_NUMBULLET)); 309766ce4d0SZheng Fan } 310766ce4d0SZheng Fan } 311766ce4d0SZheng Fan } 312766ce4d0SZheng Fan } 313766ce4d0SZheng Fan SfxMapUnit NBOTypeMgrBase::GetMapUnit() 314766ce4d0SZheng Fan { 315766ce4d0SZheng Fan return eCoreUnit; 316766ce4d0SZheng Fan } 317766ce4d0SZheng Fan /*************************************************************************************************** 318766ce4d0SZheng Fan **********************Character Bullet Type lib********************************************************** 319766ce4d0SZheng Fan ****************************************************************************************************/ 320766ce4d0SZheng Fan BulletsTypeMgr* BulletsTypeMgr::_instance = 0; 321766ce4d0SZheng Fan BulletsSettings_Impl* BulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0}; 322766ce4d0SZheng Fan sal_Unicode BulletsTypeMgr::aDynamicBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '}; 323766ce4d0SZheng Fan sal_Unicode BulletsTypeMgr::aDynamicRTLBulletTypes[]={' ',' ',' ',' ',' ',' ',' ',' '}; 324766ce4d0SZheng Fan 325766ce4d0SZheng Fan BulletsTypeMgr::BulletsTypeMgr(const NBOType aType): 326766ce4d0SZheng Fan NBOTypeMgrBase(aType) 327766ce4d0SZheng Fan { 328766ce4d0SZheng Fan Init(); 329766ce4d0SZheng Fan } 330766ce4d0SZheng Fan 331766ce4d0SZheng Fan BulletsTypeMgr::BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): 332766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg) 333766ce4d0SZheng Fan { 334766ce4d0SZheng Fan Init(); 335766ce4d0SZheng Fan } 336766ce4d0SZheng Fan 337766ce4d0SZheng Fan BulletsTypeMgr::BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr): 338766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr) 339766ce4d0SZheng Fan { 340766ce4d0SZheng Fan for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) 341766ce4d0SZheng Fan { 342766ce4d0SZheng Fan pActualBullets[i]->bIsCustomized = aTypeMgr.pActualBullets[i]->bIsCustomized; 343766ce4d0SZheng Fan pActualBullets[i]->cBulletChar = aTypeMgr.pActualBullets[i]->cBulletChar; 344766ce4d0SZheng Fan pActualBullets[i]->aFont = aTypeMgr.pActualBullets[i]->aFont; 345766ce4d0SZheng Fan pActualBullets[i]->sDescription = aTypeMgr. pActualBullets[i]->sDescription; 346766ce4d0SZheng Fan pActualBullets[i]->eType = aTypeMgr. pActualBullets[i]->eType; 347766ce4d0SZheng Fan } 348766ce4d0SZheng Fan } 349766ce4d0SZheng Fan void BulletsTypeMgr::Init() 350766ce4d0SZheng Fan { 351766ce4d0SZheng Fan Font& rActBulletFont = lcl_GetDefaultBulletFont(); 352766ce4d0SZheng Fan String sName = rActBulletFont.GetName(); 353766ce4d0SZheng Fan if( Application::GetSettings().GetLayoutRTL() ) 354766ce4d0SZheng Fan { 355766ce4d0SZheng Fan for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) 356766ce4d0SZheng Fan { 357766ce4d0SZheng Fan pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS); 358766ce4d0SZheng Fan pActualBullets[i]->cBulletChar = aDefaultRTLBulletTypes[i]; 359766ce4d0SZheng Fan pActualBullets[i]->aFont = rActBulletFont; 360766ce4d0SZheng Fan if (i==4 || i==5) 361766ce4d0SZheng Fan pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_RTL_DESCRIPTION_4 - 4 + i ); 362766ce4d0SZheng Fan else 363766ce4d0SZheng Fan pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i ); 364766ce4d0SZheng Fan } 365766ce4d0SZheng Fan }else 366766ce4d0SZheng Fan { 367766ce4d0SZheng Fan for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) 368766ce4d0SZheng Fan { 369766ce4d0SZheng Fan pActualBullets[i] = new BulletsSettings_Impl(eNBType::BULLETS); 370766ce4d0SZheng Fan pActualBullets[i]->cBulletChar = aDefaultBulletTypes[i]; 371766ce4d0SZheng Fan pActualBullets[i]->aFont =rActBulletFont; 372766ce4d0SZheng Fan pActualBullets[i]->sDescription = SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTION_0 + i ); 373766ce4d0SZheng Fan } 374766ce4d0SZheng Fan } 375766ce4d0SZheng Fan } 376766ce4d0SZheng Fan sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 377766ce4d0SZheng Fan { 378766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 379766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 380766ce4d0SZheng Fan //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; 381766ce4d0SZheng Fan 382766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 383766ce4d0SZheng Fan 384766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 385766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 386766ce4d0SZheng Fan 387766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 388766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 389766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 390766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 391766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 392766ce4d0SZheng Fan { 393766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 394766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < nLength; i++) 395766ce4d0SZheng Fan { 396766ce4d0SZheng Fan if ( cChar == aDynamicRTLBulletTypes[i] || 397766ce4d0SZheng Fan (cChar == 9830 && 57356 == aDynamicRTLBulletTypes[i]) || 398766ce4d0SZheng Fan (cChar == 9632 && 57354 == aDynamicRTLBulletTypes[i]) ) 399766ce4d0SZheng Fan { 400766ce4d0SZheng Fan return i+1; 401766ce4d0SZheng Fan } 402766ce4d0SZheng Fan } 403766ce4d0SZheng Fan } else 404766ce4d0SZheng Fan { 405766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 406766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < nLength; i++) 407766ce4d0SZheng Fan { 408766ce4d0SZheng Fan if ( cChar == aDynamicBulletTypes[i] || 409766ce4d0SZheng Fan (cChar == 9830 && 57356 == aDynamicBulletTypes[i]) || 410766ce4d0SZheng Fan (cChar == 9632 && 57354 == aDynamicBulletTypes[i]) ) 411766ce4d0SZheng Fan { 412766ce4d0SZheng Fan return i+1; 413766ce4d0SZheng Fan } 414766ce4d0SZheng Fan } 415766ce4d0SZheng Fan }*/ 416766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 417766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) 418766ce4d0SZheng Fan { 419766ce4d0SZheng Fan if ( (cChar == pActualBullets[i]->cBulletChar|| 420766ce4d0SZheng Fan (cChar == 9830 && 57356 == pActualBullets[i]->cBulletChar) || 421766ce4d0SZheng Fan (cChar == 9632 && 57354 == pActualBullets[i]->cBulletChar)))// && pFont && (pFont->GetName().CompareTo(pActualBullets[i]->aFont.GetName())==COMPARE_EQUAL)) 422766ce4d0SZheng Fan { 423766ce4d0SZheng Fan return i+1; 424766ce4d0SZheng Fan } 425766ce4d0SZheng Fan } 426766ce4d0SZheng Fan 427766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 428766ce4d0SZheng Fan } 429766ce4d0SZheng Fan 430766ce4d0SZheng Fan sal_Bool BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 431766ce4d0SZheng Fan { 432766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 433766ce4d0SZheng Fan return sal_False; 434766ce4d0SZheng Fan 435766ce4d0SZheng Fan if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 436766ce4d0SZheng Fan return sal_False; 437766ce4d0SZheng Fan 438766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 439766ce4d0SZheng Fan 440766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 441766ce4d0SZheng Fan return sal_False; 442766ce4d0SZheng Fan 443766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 444766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 445766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 446766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 447766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 448766ce4d0SZheng Fan { 449766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 450766ce4d0SZheng Fan 451766ce4d0SZheng Fan if ( nIndex >= nLength ) 452766ce4d0SZheng Fan return sal_False; 453766ce4d0SZheng Fan 454766ce4d0SZheng Fan aDynamicRTLBulletTypes[nIndex] = cChar; 455766ce4d0SZheng Fan } else 456766ce4d0SZheng Fan { 457766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 458766ce4d0SZheng Fan 459766ce4d0SZheng Fan if ( nIndex >= nLength ) 460766ce4d0SZheng Fan return sal_False; 461766ce4d0SZheng Fan 462766ce4d0SZheng Fan aDynamicBulletTypes[nIndex] = cChar; 463766ce4d0SZheng Fan }*/ 464766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 465766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 466766ce4d0SZheng Fan return sal_False; 467766ce4d0SZheng Fan 468766ce4d0SZheng Fan pActualBullets[nIndex]->cBulletChar = cChar; 469766ce4d0SZheng Fan if ( pFont ) 470766ce4d0SZheng Fan pActualBullets[nIndex]->aFont = *pFont; 471766ce4d0SZheng Fan pActualBullets[nIndex]->bIsCustomized = sal_True; 472766ce4d0SZheng Fan 473766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 474766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 475766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 476766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 477766ce4d0SZheng Fan pActualBullets[nIndex]->sDescription = aStrFromRES; 478766ce4d0SZheng Fan 479766ce4d0SZheng Fan return sal_True; 480766ce4d0SZheng Fan } 481766ce4d0SZheng Fan 482766ce4d0SZheng Fan sal_Bool BulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 483766ce4d0SZheng Fan { 484766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 485766ce4d0SZheng Fan // return sal_False; 486766ce4d0SZheng Fan 487766ce4d0SZheng Fan sal_Unicode cChar; 488766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 489766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 490766ce4d0SZheng Fan { 491766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 492766ce4d0SZheng Fan 493766ce4d0SZheng Fan if ( nIndex >= nLength ) 494766ce4d0SZheng Fan return sal_False; 495766ce4d0SZheng Fan 496766ce4d0SZheng Fan cChar = aDynamicRTLBulletTypes[nIndex]; 497766ce4d0SZheng Fan }else 498766ce4d0SZheng Fan { 499766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 500766ce4d0SZheng Fan 501766ce4d0SZheng Fan if ( nIndex >= nLength ) 502766ce4d0SZheng Fan return sal_False; 503766ce4d0SZheng Fan 504766ce4d0SZheng Fan cChar = aDynamicBulletTypes[nIndex]; 505766ce4d0SZheng Fan }*/ 506766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 507766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 508766ce4d0SZheng Fan return sal_False; 509766ce4d0SZheng Fan cChar = pActualBullets[nIndex]->cBulletChar; 510766ce4d0SZheng Fan //Font& rActBulletFont = lcl_GetDefaultBulletFont(); 511766ce4d0SZheng Fan Font rActBulletFont = pActualBullets[nIndex]->aFont; 512766ce4d0SZheng Fan 513766ce4d0SZheng Fan sal_uInt16 nMask = 1; 514766ce4d0SZheng Fan String sBulletCharFmtName = GetBulCharFmtName(); 515766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 516766ce4d0SZheng Fan { 517766ce4d0SZheng Fan if(mLevel & nMask) 518766ce4d0SZheng Fan { 519766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 520766ce4d0SZheng Fan aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); 521766ce4d0SZheng Fan aFmt.SetBulletFont(&rActBulletFont); 522766ce4d0SZheng Fan aFmt.SetBulletChar(cChar ); 523766ce4d0SZheng Fan aFmt.SetCharFmtName(sBulletCharFmtName); 524766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(45); 525766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 526766ce4d0SZheng Fan } 527766ce4d0SZheng Fan nMask <<= 1; 528766ce4d0SZheng Fan } 529766ce4d0SZheng Fan 530766ce4d0SZheng Fan return sal_True; 531766ce4d0SZheng Fan } 532766ce4d0SZheng Fan 533766ce4d0SZheng Fan String BulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 534766ce4d0SZheng Fan { 535766ce4d0SZheng Fan String sRet; 536766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 537766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 538766ce4d0SZheng Fan 539766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 540766ce4d0SZheng Fan return sRet; 541766ce4d0SZheng Fan else 542766ce4d0SZheng Fan sRet = pActualBullets[nIndex]->sDescription; 543766ce4d0SZheng Fan 544766ce4d0SZheng Fan return sRet; 545766ce4d0SZheng Fan } 546766ce4d0SZheng Fan sal_Bool BulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) 547766ce4d0SZheng Fan { 548766ce4d0SZheng Fan sal_Bool bRet = sal_False; 549766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 550766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 551766ce4d0SZheng Fan 552766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 553766ce4d0SZheng Fan bRet = sal_False; 554766ce4d0SZheng Fan else 555766ce4d0SZheng Fan bRet = pActualBullets[nIndex]->bIsCustomized; 556766ce4d0SZheng Fan 557766ce4d0SZheng Fan return bRet; 558766ce4d0SZheng Fan } 559766ce4d0SZheng Fan 560766ce4d0SZheng Fan sal_Unicode BulletsTypeMgr::GetBulChar(sal_uInt16 nIndex) 561766ce4d0SZheng Fan { 562766ce4d0SZheng Fan sal_Unicode cChar; 563766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 564766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 565766ce4d0SZheng Fan 566766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 567766ce4d0SZheng Fan cChar = ' '; 568766ce4d0SZheng Fan else 569766ce4d0SZheng Fan cChar = pActualBullets[nIndex]->cBulletChar; 570766ce4d0SZheng Fan 571766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 572766ce4d0SZheng Fan { 573766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 574766ce4d0SZheng Fan 575766ce4d0SZheng Fan if ( nIndex >= nLength ) 576766ce4d0SZheng Fan cChar = ' '; 577766ce4d0SZheng Fan else 578766ce4d0SZheng Fan cChar = aDynamicRTLBulletTypes[nIndex]; 579766ce4d0SZheng Fan }else 580766ce4d0SZheng Fan { 581766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 582766ce4d0SZheng Fan 583766ce4d0SZheng Fan if ( nIndex >= nLength ) 584766ce4d0SZheng Fan cChar = ' '; 585766ce4d0SZheng Fan else 586766ce4d0SZheng Fan cChar = aDynamicBulletTypes[nIndex]; 587766ce4d0SZheng Fan }*/ 588766ce4d0SZheng Fan 589766ce4d0SZheng Fan return cChar; 590766ce4d0SZheng Fan } 591766ce4d0SZheng Fan Font BulletsTypeMgr::GetBulCharFont(sal_uInt16 nIndex) 592766ce4d0SZheng Fan { 593766ce4d0SZheng Fan Font aRet; 594766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 595766ce4d0SZheng Fan aRet = lcl_GetDefaultBulletFont(); 596766ce4d0SZheng Fan else 597766ce4d0SZheng Fan aRet = pActualBullets[nIndex]->aFont; 598766ce4d0SZheng Fan 599766ce4d0SZheng Fan return aRet; 600766ce4d0SZheng Fan } 601766ce4d0SZheng Fan /*************************************************************************************************** 602766ce4d0SZheng Fan **********************Graphic Bullet Type lib*********************************************************** 603766ce4d0SZheng Fan ****************************************************************************************************/ 604766ce4d0SZheng Fan GraphyicBulletsTypeMgr* GraphyicBulletsTypeMgr::_instance = 0; 605766ce4d0SZheng Fan GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType): 606766ce4d0SZheng Fan NBOTypeMgrBase(aType) 607766ce4d0SZheng Fan { 608766ce4d0SZheng Fan Init(); 609766ce4d0SZheng Fan } 610766ce4d0SZheng Fan 611766ce4d0SZheng Fan GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): 612766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg) 613766ce4d0SZheng Fan { 614766ce4d0SZheng Fan Init(); 615766ce4d0SZheng Fan } 616766ce4d0SZheng Fan GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr): 617766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr) 618766ce4d0SZheng Fan { 619766ce4d0SZheng Fan for (sal_uInt16 i=0;i< aTypeMgr.aGrfDataLst.Count();i++) 620766ce4d0SZheng Fan { 621766ce4d0SZheng Fan GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); 622766ce4d0SZheng Fan GrfBulDataRelation* pSrcEntry = (GrfBulDataRelation*)(aTypeMgr.aGrfDataLst.GetObject(i)); 623766ce4d0SZheng Fan if ( pEntry && pSrcEntry) 624766ce4d0SZheng Fan { 625766ce4d0SZheng Fan pEntry->bIsCustomized = pSrcEntry->bIsCustomized; 626766ce4d0SZheng Fan pEntry->nTabIndex = pSrcEntry->nTabIndex; 627766ce4d0SZheng Fan pEntry->nGallaryIndex = pSrcEntry->nGallaryIndex; 628766ce4d0SZheng Fan pEntry->sGrfName = pSrcEntry->sGrfName; 629766ce4d0SZheng Fan pEntry->sDescription = pSrcEntry->sDescription; 630766ce4d0SZheng Fan aGrfDataLst.Insert( pEntry, LIST_APPEND ); 631766ce4d0SZheng Fan } 632766ce4d0SZheng Fan } 633766ce4d0SZheng Fan } 634766ce4d0SZheng Fan void GraphyicBulletsTypeMgr::Init() 635766ce4d0SZheng Fan { 636766ce4d0SZheng Fan List aGrfNames; 637766ce4d0SZheng Fan GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); 638766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aGrfNames.Count(); i++) 639766ce4d0SZheng Fan { 640766ce4d0SZheng Fan String* pGrfNm = (String*) aGrfNames.GetObject(i); 641766ce4d0SZheng Fan INetURLObject aObj(*pGrfNm); 642766ce4d0SZheng Fan if(aObj.GetProtocol() == INET_PROT_FILE) 643766ce4d0SZheng Fan *pGrfNm = aObj.PathToFileName(); 644766ce4d0SZheng Fan 645766ce4d0SZheng Fan GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); 646766ce4d0SZheng Fan pEntry->nTabIndex = i+1; 647766ce4d0SZheng Fan pEntry->nGallaryIndex = i; 648766ce4d0SZheng Fan pEntry->sGrfName = *pGrfNm; 649766ce4d0SZheng Fan 650766ce4d0SZheng Fan if( i < MAX_VALUESET_GRAPHIC ) 651766ce4d0SZheng Fan { 652766ce4d0SZheng Fan pEntry->sDescription = SVX_RESSTR( RID_SVXSTR_GRAPHICS_DESCRIPTIONS + i ); 653766ce4d0SZheng Fan }else 654766ce4d0SZheng Fan { 655766ce4d0SZheng Fan pEntry->sDescription = *pGrfNm; 656766ce4d0SZheng Fan } 657766ce4d0SZheng Fan 658766ce4d0SZheng Fan aGrfDataLst.Insert( pEntry, LIST_APPEND ); 659766ce4d0SZheng Fan } 660766ce4d0SZheng Fan } 661766ce4d0SZheng Fan sal_uInt16 GraphyicBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 662766ce4d0SZheng Fan { 663766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 664766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 665766ce4d0SZheng Fan 666766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 667766ce4d0SZheng Fan 668766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 669766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 670766ce4d0SZheng Fan 671766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 672766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 673766ce4d0SZheng Fan const Graphic* pGrf = 0; 674766ce4d0SZheng Fan if ( pBrsh ) 675766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 676766ce4d0SZheng Fan 677766ce4d0SZheng Fan if ( pGrf ) 678766ce4d0SZheng Fan { 679766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 680766ce4d0SZheng Fan Graphic aGraphic; 681766ce4d0SZheng Fan for(sal_uInt16 i=0;i<aGrfDataLst.Count();i++) 682766ce4d0SZheng Fan { 683766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(i); 684766ce4d0SZheng Fan sal_Bool bExist = sal_False; 685766ce4d0SZheng Fan if ( pEntry) // && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) 686766ce4d0SZheng Fan bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pEntry->nGallaryIndex,&aGraphic); 687766ce4d0SZheng Fan if (bExist) { 688766ce4d0SZheng Fan Bitmap aSum=pGrf->GetBitmap(); 689766ce4d0SZheng Fan Bitmap aSum1=aGraphic.GetBitmap(); 690766ce4d0SZheng Fan if (aSum.IsEqual(aSum1)) 691766ce4d0SZheng Fan return pEntry->nTabIndex; 692766ce4d0SZheng Fan } 693766ce4d0SZheng Fan } 694766ce4d0SZheng Fan } 695766ce4d0SZheng Fan 696766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 697766ce4d0SZheng Fan } 698766ce4d0SZheng Fan 699766ce4d0SZheng Fan sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 700766ce4d0SZheng Fan { 701766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) 702766ce4d0SZheng Fan return sal_False; 703766ce4d0SZheng Fan 704766ce4d0SZheng Fan if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 705766ce4d0SZheng Fan return sal_False; 706766ce4d0SZheng Fan 707766ce4d0SZheng Fan if ( nIndex >= aGrfDataLst.Count() ) 708766ce4d0SZheng Fan return sal_False; 709766ce4d0SZheng Fan 710766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 711766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 712766ce4d0SZheng Fan return sal_False; 713766ce4d0SZheng Fan 714766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 715766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 716766ce4d0SZheng Fan const Graphic* pGrf = 0; 717766ce4d0SZheng Fan if ( pBrsh ) 718766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 719766ce4d0SZheng Fan else 720766ce4d0SZheng Fan return sal_False; 721766ce4d0SZheng Fan 722766ce4d0SZheng Fan String sEmpty; 723766ce4d0SZheng Fan if ( pGrf ) 724766ce4d0SZheng Fan { 725766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 726766ce4d0SZheng Fan //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); 727766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 728766ce4d0SZheng Fan if ( pGrfName ) 729766ce4d0SZheng Fan pEntry->sGrfName = *pGrfName; 730766ce4d0SZheng Fan //pEntry->sDescription = sEmpty; 731766ce4d0SZheng Fan pEntry->nGallaryIndex = (sal_uInt16)0xFFFF; 732766ce4d0SZheng Fan pEntry->bIsCustomized = sal_True; 733766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 734766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 735766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 736766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 737766ce4d0SZheng Fan pEntry->sDescription = aStrFromRES; 738766ce4d0SZheng Fan }else 739766ce4d0SZheng Fan { 740766ce4d0SZheng Fan return sal_False; 741766ce4d0SZheng Fan } 742766ce4d0SZheng Fan 743766ce4d0SZheng Fan return sal_True; 744766ce4d0SZheng Fan } 745766ce4d0SZheng Fan 746766ce4d0SZheng Fan sal_Bool GraphyicBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 747766ce4d0SZheng Fan { 748766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 749766ce4d0SZheng Fan // return sal_False; 750766ce4d0SZheng Fan 751766ce4d0SZheng Fan if ( nIndex >= aGrfDataLst.Count() ) 752766ce4d0SZheng Fan return sal_False; 753766ce4d0SZheng Fan 754766ce4d0SZheng Fan String sGrfName; 755766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 756766ce4d0SZheng Fan sGrfName= pEntry->sGrfName; 757766ce4d0SZheng Fan 758766ce4d0SZheng Fan sal_uInt16 nMask = 1; 759766ce4d0SZheng Fan String aEmptyStr; 760766ce4d0SZheng Fan sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; 761766ce4d0SZheng Fan String sNumCharFmtName = GetBulCharFmtName(); 762766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 763766ce4d0SZheng Fan { 764766ce4d0SZheng Fan if(mLevel & nMask) 765766ce4d0SZheng Fan { 766766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 767766ce4d0SZheng Fan aFmt.SetNumberingType(nSetNumberingType); 768766ce4d0SZheng Fan aFmt.SetPrefix( aEmptyStr ); 769766ce4d0SZheng Fan aFmt.SetSuffix( aEmptyStr ); 770766ce4d0SZheng Fan aFmt.SetCharFmtName( sNumCharFmtName ); 771766ce4d0SZheng Fan 772766ce4d0SZheng Fan Graphic aGraphic; 773766ce4d0SZheng Fan if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pEntry->nGallaryIndex, &aGraphic)) 774766ce4d0SZheng Fan { 775766ce4d0SZheng Fan Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); 776766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 777766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 778766ce4d0SZheng Fan SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); 779766ce4d0SZheng Fan aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); 780766ce4d0SZheng Fan } 781766ce4d0SZheng Fan else// if(pGrfName) 782766ce4d0SZheng Fan aFmt.SetGraphic( sGrfName ); 783766ce4d0SZheng Fan 784766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 785766ce4d0SZheng Fan } 786766ce4d0SZheng Fan nMask <<= 1 ; 787766ce4d0SZheng Fan } 788766ce4d0SZheng Fan 789766ce4d0SZheng Fan return sal_True; 790766ce4d0SZheng Fan } 791766ce4d0SZheng Fan String GraphyicBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 792766ce4d0SZheng Fan { 793766ce4d0SZheng Fan String sRet; 794766ce4d0SZheng Fan sal_uInt16 nLength = 0; 795766ce4d0SZheng Fan nLength = aGrfDataLst.Count() ; 796766ce4d0SZheng Fan 797766ce4d0SZheng Fan if ( nIndex >= nLength ) 798766ce4d0SZheng Fan return sRet; 799766ce4d0SZheng Fan else 800766ce4d0SZheng Fan { 801766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 802766ce4d0SZheng Fan if ( pEntry ) 803766ce4d0SZheng Fan { 804766ce4d0SZheng Fan sRet = pEntry->sDescription; 805766ce4d0SZheng Fan }; 806766ce4d0SZheng Fan } 807766ce4d0SZheng Fan return sRet; 808766ce4d0SZheng Fan } 809766ce4d0SZheng Fan sal_Bool GraphyicBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) 810766ce4d0SZheng Fan { 811766ce4d0SZheng Fan sal_Bool bRet = sal_False; 812766ce4d0SZheng Fan 813766ce4d0SZheng Fan sal_uInt16 nLength = 0; 814766ce4d0SZheng Fan nLength = aGrfDataLst.Count() ; 815766ce4d0SZheng Fan 816766ce4d0SZheng Fan if ( nIndex >= nLength ) 817766ce4d0SZheng Fan return bRet; 818766ce4d0SZheng Fan else 819766ce4d0SZheng Fan { 820766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 821766ce4d0SZheng Fan if ( pEntry ) 822766ce4d0SZheng Fan { 823766ce4d0SZheng Fan bRet = pEntry->bIsCustomized; 824766ce4d0SZheng Fan }; 825766ce4d0SZheng Fan } 826766ce4d0SZheng Fan 827766ce4d0SZheng Fan return bRet; 828766ce4d0SZheng Fan } 829766ce4d0SZheng Fan String GraphyicBulletsTypeMgr::GetGrfName(sal_uInt16 nIndex) 830766ce4d0SZheng Fan { 831766ce4d0SZheng Fan String sRet; 832766ce4d0SZheng Fan if ( nIndex < aGrfDataLst.Count() ) 833766ce4d0SZheng Fan { 834766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 835766ce4d0SZheng Fan if ( pEntry ) 836766ce4d0SZheng Fan { 837766ce4d0SZheng Fan sRet = pEntry->sGrfName; 838766ce4d0SZheng Fan } 839766ce4d0SZheng Fan } 840766ce4d0SZheng Fan 841766ce4d0SZheng Fan return sRet; 842766ce4d0SZheng Fan } 843766ce4d0SZheng Fan /*************************************************************************************************** 844766ce4d0SZheng Fan **********************Mix Bullets Type lib************************************************************** 845766ce4d0SZheng Fan ****************************************************************************************************/ 846766ce4d0SZheng Fan MixBulletsTypeMgr* MixBulletsTypeMgr::_instance = 0; 847766ce4d0SZheng Fan MixBulletsSettings_Impl* MixBulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0}; 848766ce4d0SZheng Fan MixBulletsSettings_Impl* MixBulletsTypeMgr::pDefaultActualBullets[] ={0,0,0,0,0,0,0,0}; 849766ce4d0SZheng Fan 850766ce4d0SZheng Fan MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType): 851766ce4d0SZheng Fan NBOTypeMgrBase(aType) 852766ce4d0SZheng Fan { 853766ce4d0SZheng Fan Init(); 854766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) 855766ce4d0SZheng Fan { 856766ce4d0SZheng Fan pDefaultActualBullets[nItem] = pActualBullets[nItem]; 857766ce4d0SZheng Fan } 858766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 859766ce4d0SZheng Fan Init(); 860766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.sya")); 861766ce4d0SZheng Fan } 862766ce4d0SZheng Fan 863766ce4d0SZheng Fan MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): 864766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg) 865766ce4d0SZheng Fan { 866766ce4d0SZheng Fan Init(); 867766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) 868766ce4d0SZheng Fan { 869766ce4d0SZheng Fan pDefaultActualBullets[nItem] = pActualBullets[nItem]; 870766ce4d0SZheng Fan } 871766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 872766ce4d0SZheng Fan Init(); 873766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.sya")); 874766ce4d0SZheng Fan } 875766ce4d0SZheng Fan 876766ce4d0SZheng Fan MixBulletsTypeMgr::MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr): 877766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr) 878766ce4d0SZheng Fan { 879766ce4d0SZheng Fan for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) 880766ce4d0SZheng Fan { 881766ce4d0SZheng Fan if ( aTypeMgr.pActualBullets[i]->eType == eNBType::BULLETS ) 882766ce4d0SZheng Fan { 883766ce4d0SZheng Fan pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; 884766ce4d0SZheng Fan pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display 885766ce4d0SZheng Fan pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; 886766ce4d0SZheng Fan pActualBullets[i]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 887766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->cBulletChar; 888766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->aFont; 889766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->sDescription = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; 890766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->bIsCustomized = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; 891766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->eType = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; 892766ce4d0SZheng Fan }else if ( aTypeMgr.pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) 893766ce4d0SZheng Fan { 894766ce4d0SZheng Fan pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; 895766ce4d0SZheng Fan pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display 896766ce4d0SZheng Fan pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; 897766ce4d0SZheng Fan pActualBullets[i]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 898766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sGrfName = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sGrfName; 899766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sDescription = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; 900766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->bIsCustomized = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; 901766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->eType = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; 902766ce4d0SZheng Fan if ( ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized && ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj != NULL) 903766ce4d0SZheng Fan { 904766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->pGrfObj = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj; 905766ce4d0SZheng Fan } 906766ce4d0SZheng Fan } 907766ce4d0SZheng Fan } 908766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.sya")); 909766ce4d0SZheng Fan } 910766ce4d0SZheng Fan void MixBulletsTypeMgr::Init() 911766ce4d0SZheng Fan { 912766ce4d0SZheng Fan BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); 913766ce4d0SZheng Fan if ( pBTMgr ) 914766ce4d0SZheng Fan { 915766ce4d0SZheng Fan //Index 1 916766ce4d0SZheng Fan pActualBullets[0] = new MixBulletsSettings_Impl(eNBType::BULLETS); 917766ce4d0SZheng Fan pActualBullets[0]->eType = eNBType::BULLETS; 918766ce4d0SZheng Fan pActualBullets[0]->nIndex = 0+1; //index in the tab page display,decrease 1 to the index within arr 919766ce4d0SZheng Fan pActualBullets[0]->nIndexDefault = 2; //index in the tab page display,decrease 1 to the index within arr 920766ce4d0SZheng Fan pActualBullets[0]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 921766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[0]->nIndexDefault-1); 922766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[0]->nIndexDefault-1); 923766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[0]->nIndexDefault-1); 924766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[0]->nIndexDefault-1); 925766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->eType = eNBType::BULLETS; 926766ce4d0SZheng Fan 927766ce4d0SZheng Fan //Index 2 928766ce4d0SZheng Fan pActualBullets[1] = new MixBulletsSettings_Impl(eNBType::BULLETS); 929766ce4d0SZheng Fan pActualBullets[1]->eType = eNBType::BULLETS; 930766ce4d0SZheng Fan pActualBullets[1]->nIndex = 1+1; //index in the tab page display,decrease 1 to the index within arr 931766ce4d0SZheng Fan pActualBullets[1]->nIndexDefault = 3; //index in the tab page display,decrease 1 to the index within arr 932766ce4d0SZheng Fan pActualBullets[1]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 933766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[1]->nIndexDefault-1); 934766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[1]->nIndexDefault-1); 935766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[1]->nIndexDefault-1); 936766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[1]->nIndexDefault-1); 937766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->eType = eNBType::BULLETS; 938766ce4d0SZheng Fan 939766ce4d0SZheng Fan //Index 3 940766ce4d0SZheng Fan pActualBullets[2] = new MixBulletsSettings_Impl(eNBType::BULLETS); 941766ce4d0SZheng Fan pActualBullets[2]->eType = eNBType::BULLETS; 942766ce4d0SZheng Fan pActualBullets[2]->nIndex = 2+1; //index in the tab page display,decrease 1 to the index within arr 943766ce4d0SZheng Fan pActualBullets[2]->nIndexDefault = 4; //index in the tab page display,decrease 1 to the index within arr 944766ce4d0SZheng Fan pActualBullets[2]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 945766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[2]->nIndexDefault-1); 946766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[2]->nIndexDefault-1); 947766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[2]->nIndexDefault-1); 948766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[2]->nIndexDefault-1); 949766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->eType = eNBType::BULLETS; 950766ce4d0SZheng Fan 951766ce4d0SZheng Fan //Index 4 952766ce4d0SZheng Fan pActualBullets[3] = new MixBulletsSettings_Impl(eNBType::BULLETS); 953766ce4d0SZheng Fan pActualBullets[3]->eType = eNBType::BULLETS; 954766ce4d0SZheng Fan pActualBullets[3]->nIndex = 3+1; //index in the tab page display,decrease 1 to the index within arr 955766ce4d0SZheng Fan pActualBullets[3]->nIndexDefault = 5; //index in the tab page display,decrease 1 to the index within arr 956766ce4d0SZheng Fan pActualBullets[3]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 957766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[3]->nIndexDefault-1); 958766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[3]->nIndexDefault-1); 959766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[3]->nIndexDefault-1); 960766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[3]->nIndexDefault-1); 961766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->eType = eNBType::BULLETS; 962766ce4d0SZheng Fan 963766ce4d0SZheng Fan //Index 5 964766ce4d0SZheng Fan pActualBullets[4] = new MixBulletsSettings_Impl(eNBType::BULLETS); 965766ce4d0SZheng Fan pActualBullets[4]->eType = eNBType::BULLETS; 966766ce4d0SZheng Fan pActualBullets[4]->nIndex = 4+1; //index in the tab page display,decrease 1 to the index within arr 967766ce4d0SZheng Fan pActualBullets[4]->nIndexDefault = 6; //index in the tab page display,decrease 1 to the index within arr 968766ce4d0SZheng Fan pActualBullets[4]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 969766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[4]->nIndexDefault-1); 970766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[4]->nIndexDefault-1); 971766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[4]->nIndexDefault-1); 972766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[4]->nIndexDefault-1); 973766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->eType = eNBType::BULLETS; 974766ce4d0SZheng Fan 975766ce4d0SZheng Fan //Index 6 976766ce4d0SZheng Fan pActualBullets[5] = new MixBulletsSettings_Impl(eNBType::BULLETS); 977766ce4d0SZheng Fan pActualBullets[5]->eType = eNBType::BULLETS; 978766ce4d0SZheng Fan pActualBullets[5]->nIndex = 5+1; //index in the tab page display,decrease 1 to the index within arr 979766ce4d0SZheng Fan pActualBullets[5]->nIndexDefault = 8; //index in the tab page display,decrease 1 to the index within arr 980766ce4d0SZheng Fan pActualBullets[5]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 981766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[5]->nIndexDefault-1); 982766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[5]->nIndexDefault-1); 983766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[5]->nIndexDefault-1); 984766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[5]->nIndexDefault-1); 985766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->eType = eNBType::BULLETS; 986766ce4d0SZheng Fan } 987766ce4d0SZheng Fan 988766ce4d0SZheng Fan GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); 989766ce4d0SZheng Fan if ( mGrfTMgr ) 990766ce4d0SZheng Fan { 991766ce4d0SZheng Fan //Index 7 992766ce4d0SZheng Fan pActualBullets[6] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); 993766ce4d0SZheng Fan pActualBullets[6]->eType = eNBType::GRAPHICBULLETS; 994766ce4d0SZheng Fan pActualBullets[6]->nIndex = 6+1; //index in the tab page display,decrease 1 to the index within arr 995766ce4d0SZheng Fan pActualBullets[6]->nIndexDefault = 9; //index in the tab page display,decrease 1 to the index within arr 996766ce4d0SZheng Fan pActualBullets[6]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 997766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[6]->nIndexDefault); 998766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[6]->nIndexDefault); 999766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[6]->nIndexDefault); 1000766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->eType = eNBType::GRAPHICBULLETS; 1001766ce4d0SZheng Fan 1002766ce4d0SZheng Fan //Index 8 1003766ce4d0SZheng Fan pActualBullets[7] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); 1004766ce4d0SZheng Fan pActualBullets[7]->eType = eNBType::GRAPHICBULLETS; 1005766ce4d0SZheng Fan pActualBullets[7]->nIndex = 7+1; //index in the tab page display,decrease 1 to the index within arr 1006766ce4d0SZheng Fan pActualBullets[7]->nIndexDefault = 23; //index in the tab page display,decrease 1 to the index within arr 1007766ce4d0SZheng Fan pActualBullets[7]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 1008766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[7]->nIndexDefault); 1009766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[7]->nIndexDefault); 1010766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[7]->nIndexDefault); 1011766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->eType = eNBType::GRAPHICBULLETS; 1012766ce4d0SZheng Fan } 1013766ce4d0SZheng Fan 1014766ce4d0SZheng Fan } 1015766ce4d0SZheng Fan sal_uInt16 MixBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 1016766ce4d0SZheng Fan { 1017766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 1018766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1019766ce4d0SZheng Fan //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; 1020766ce4d0SZheng Fan 1021766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1022766ce4d0SZheng Fan 1023766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1024766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1025766ce4d0SZheng Fan 1026766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1027766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1028766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL) 1029766ce4d0SZheng Fan { 1030766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1031766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1032766ce4d0SZheng Fan String sName = pFont?pFont->GetName():String(); 1033766ce4d0SZheng Fan 1034766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) 1035766ce4d0SZheng Fan { 1036766ce4d0SZheng Fan if ( pActualBullets[i]->eType == eNBType::BULLETS ) 1037766ce4d0SZheng Fan { 1038766ce4d0SZheng Fan String ssName = ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName(); 1039766ce4d0SZheng Fan if ( (cChar == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar|| 1040766ce4d0SZheng Fan (cChar == 9830 && 57356 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar) || 1041766ce4d0SZheng Fan (cChar == 9632 && 57354 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar)))//&& 1042766ce4d0SZheng Fan //(pFont && pFont->GetName().CompareTo(((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName())==COMPARE_EQUAL) ) 1043766ce4d0SZheng Fan { 1044766ce4d0SZheng Fan return pActualBullets[i]->nIndex; 1045766ce4d0SZheng Fan } 1046766ce4d0SZheng Fan } 1047766ce4d0SZheng Fan } 1048766ce4d0SZheng Fan }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) 1049766ce4d0SZheng Fan { 1050766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 1051766ce4d0SZheng Fan const Graphic* pGrf = 0; 1052766ce4d0SZheng Fan if ( pBrsh ) 1053766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 1054766ce4d0SZheng Fan 1055766ce4d0SZheng Fan if ( pGrf ) 1056766ce4d0SZheng Fan { 1057766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 1058766ce4d0SZheng Fan //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); 1059766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) 1060766ce4d0SZheng Fan { 1061766ce4d0SZheng Fan if ( pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) 1062766ce4d0SZheng Fan { 1063766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[i]->pBullets); 1064766ce4d0SZheng Fan //sal_Bool bExist = sal_False; 1065766ce4d0SZheng Fan if ( pEntry && pActualBullets[i]->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj) 1066766ce4d0SZheng Fan { 1067766ce4d0SZheng Fan if ( pEntry->pGrfObj->GetBitmap().IsEqual(pGrf->GetBitmap())) 1068766ce4d0SZheng Fan { 1069766ce4d0SZheng Fan return pActualBullets[i]->nIndex; 1070766ce4d0SZheng Fan } 1071766ce4d0SZheng Fan }else { //if ( pEntry && pGrfName && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) 1072766ce4d0SZheng Fan //bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault-1,pSrGrf); 1073766ce4d0SZheng Fan Graphic aSrGrf; 1074766ce4d0SZheng Fan if (pEntry) 1075766ce4d0SZheng Fan GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault,&aSrGrf); 1076766ce4d0SZheng Fan Bitmap aSum=pGrf->GetBitmap(); 1077766ce4d0SZheng Fan Bitmap aSum1=aSrGrf.GetBitmap(); 1078766ce4d0SZheng Fan if (aSum.IsEqual(aSum1)) 1079766ce4d0SZheng Fan return pActualBullets[i]->nIndex; 1080766ce4d0SZheng Fan } 1081766ce4d0SZheng Fan } 1082766ce4d0SZheng Fan } 1083766ce4d0SZheng Fan } 1084766ce4d0SZheng Fan } 1085766ce4d0SZheng Fan 1086766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1087766ce4d0SZheng Fan } 1088766ce4d0SZheng Fan 1089766ce4d0SZheng Fan sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 1090766ce4d0SZheng Fan { 1091766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0 || nIndex>=DEFAULT_BULLET_TYPES) 1092766ce4d0SZheng Fan return sal_False; 1093766ce4d0SZheng Fan 1094766ce4d0SZheng Fan //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 1095766ce4d0SZheng Fan // return sal_False; 1096766ce4d0SZheng Fan 1097766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1098766ce4d0SZheng Fan 1099766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1100766ce4d0SZheng Fan return sal_False; 1101766ce4d0SZheng Fan 1102766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1103766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1104766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL && pActualBullets[nIndex]->eType == eNBType::BULLETS ) 1105766ce4d0SZheng Fan { 1106766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1107766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1108766ce4d0SZheng Fan BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); 1109766ce4d0SZheng Fan pEntry->cBulletChar = cChar; 1110766ce4d0SZheng Fan pEntry->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); 1111766ce4d0SZheng Fan pEntry->bIsCustomized = sal_True; 1112766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1113766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1114766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1115766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1116766ce4d0SZheng Fan pEntry->sDescription = aStrFromRES; 1117766ce4d0SZheng Fan 1118766ce4d0SZheng Fan }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP && pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS ) 1119766ce4d0SZheng Fan { 1120766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 1121766ce4d0SZheng Fan const Graphic* pGrf = 0; 1122766ce4d0SZheng Fan if ( pBrsh ) 1123766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 1124766ce4d0SZheng Fan else 1125766ce4d0SZheng Fan return sal_False; 1126766ce4d0SZheng Fan 1127766ce4d0SZheng Fan String sEmpty; 1128766ce4d0SZheng Fan if ( pGrf ) 1129766ce4d0SZheng Fan { 1130766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 1131766ce4d0SZheng Fan //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); 1132766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); 1133766ce4d0SZheng Fan if ( pGrfName ) 1134766ce4d0SZheng Fan pEntry->sGrfName = *pGrfName; 1135766ce4d0SZheng Fan GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); 1136766ce4d0SZheng Fan if ( mGrfTMgr ) 1137766ce4d0SZheng Fan { 1138766ce4d0SZheng Fan //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1139766ce4d0SZheng Fan //if ( nDIndex != (sal_uInt16)0xFFFF) 1140766ce4d0SZheng Fan //{ 1141766ce4d0SZheng Fan // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; 1142766ce4d0SZheng Fan // sEmpty = mGrfTMgr->GetDescription( nDIndex -1); 1143766ce4d0SZheng Fan //}else 1144766ce4d0SZheng Fan { 1145766ce4d0SZheng Fan pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; 1146766ce4d0SZheng Fan sEmpty = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1147766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1148766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1149766ce4d0SZheng Fan sEmpty.SearchAndReplace(aReplace,sNUM); 1150766ce4d0SZheng Fan //pEntry->pGrfObj = pGrf; 1151766ce4d0SZheng Fan pEntry->pGrfObj = new Graphic(*pGrf); 1152766ce4d0SZheng Fan pEntry->aSize = aFmt.GetGraphicSize(); 1153766ce4d0SZheng Fan pEntry->aSize = OutputDevice::LogicToLogic(pEntry->aSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); 1154766ce4d0SZheng Fan sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1155766ce4d0SZheng Fan if (nDIndex!=(sal_uInt16)0xFFFF) pEntry->aSize=Size(0,0); 1156766ce4d0SZheng Fan } 1157766ce4d0SZheng Fan } 1158766ce4d0SZheng Fan pEntry->sDescription = sEmpty; 1159766ce4d0SZheng Fan pEntry->bIsCustomized = sal_True; 1160766ce4d0SZheng Fan }else 1161766ce4d0SZheng Fan { 1162766ce4d0SZheng Fan return sal_False; 1163766ce4d0SZheng Fan } 1164766ce4d0SZheng Fan }else 1165766ce4d0SZheng Fan { 1166766ce4d0SZheng Fan delete pActualBullets[nIndex]->pBullets; 1167766ce4d0SZheng Fan pActualBullets[nIndex]->pBullets = 0; 1168766ce4d0SZheng Fan if ( eNumType == SVX_NUM_CHAR_SPECIAL ) 1169766ce4d0SZheng Fan { 1170766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1171766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1172766ce4d0SZheng Fan pActualBullets[nIndex]->eType = eNBType::BULLETS; 1173766ce4d0SZheng Fan pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr 1174766ce4d0SZheng Fan pActualBullets[nIndex]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 1175766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->cBulletChar = cChar; 1176766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); 1177766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; 1178766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::BULLETS; 1179766ce4d0SZheng Fan BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); 1180766ce4d0SZheng Fan if ( pBTMgr ) 1181766ce4d0SZheng Fan { 1182766ce4d0SZheng Fan //sal_uInt16 nDIndex = pBTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1183766ce4d0SZheng Fan //if ( nDIndex != (sal_uInt16)0xFFFF) 1184766ce4d0SZheng Fan //{ 1185766ce4d0SZheng Fan // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; 1186766ce4d0SZheng Fan // ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = pBTMgr->GetDescription(nDIndex - 1); 1187766ce4d0SZheng Fan //}else 1188766ce4d0SZheng Fan { 1189766ce4d0SZheng Fan pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; 1190766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1191766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1192766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1193766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1194766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; 1195766ce4d0SZheng Fan } 1196766ce4d0SZheng Fan } 1197766ce4d0SZheng Fan }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) 1198766ce4d0SZheng Fan { 1199766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 1200766ce4d0SZheng Fan const Graphic* pGrf = 0; 1201766ce4d0SZheng Fan if ( pBrsh ) 1202766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 1203766ce4d0SZheng Fan else 1204766ce4d0SZheng Fan return sal_False; 1205766ce4d0SZheng Fan 1206766ce4d0SZheng Fan String sEmpty; 1207766ce4d0SZheng Fan const String* pGrfName = 0; 1208766ce4d0SZheng Fan if ( pGrf ) 1209766ce4d0SZheng Fan { 1210766ce4d0SZheng Fan pGrfName = pBrsh->GetGraphicLink(); 1211766ce4d0SZheng Fan 1212766ce4d0SZheng Fan pActualBullets[nIndex]->eType = eNBType::GRAPHICBULLETS; 1213766ce4d0SZheng Fan pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr 1214766ce4d0SZheng Fan pActualBullets[nIndex]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 1215766ce4d0SZheng Fan if (pGrfName) 1216766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sGrfName = *pGrfName; 1217766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; 1218766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::GRAPHICBULLETS; 1219766ce4d0SZheng Fan GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); 1220766ce4d0SZheng Fan if ( mGrfTMgr ) 1221766ce4d0SZheng Fan { 1222766ce4d0SZheng Fan //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1223766ce4d0SZheng Fan //if ( nDIndex != (sal_uInt16)0xFFFF) 1224766ce4d0SZheng Fan //{ 1225766ce4d0SZheng Fan // pActualBullets[nIndex]->nIndexDefault = nDIndex - 1; 1226766ce4d0SZheng Fan // ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = mGrfTMgr->GetDescription(nDIndex - 1); 1227766ce4d0SZheng Fan //}else 1228766ce4d0SZheng Fan { 1229766ce4d0SZheng Fan pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; 1230766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1231766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1232766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1233766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1234766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; 1235766ce4d0SZheng Fan //((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = pGrf; 1236766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); 1237766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); 1238766ce4d0SZheng Fan Size aTmpSize = aFmt.GetGraphicSize(); 1239766ce4d0SZheng Fan aTmpSize = OutputDevice::LogicToLogic(aTmpSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); 1240766ce4d0SZheng Fan sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1241766ce4d0SZheng Fan if (nDIndex!=(sal_uInt16)0xFFFF) aTmpSize=Size(0,0); 1242766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->aSize = aTmpSize; 1243766ce4d0SZheng Fan 1244766ce4d0SZheng Fan } 1245766ce4d0SZheng Fan } 1246766ce4d0SZheng Fan } 1247766ce4d0SZheng Fan } 1248766ce4d0SZheng Fan } 1249766ce4d0SZheng Fan SvxNumRule aTmpRule1(aNum); 1250766ce4d0SZheng Fan ApplyNumRule(aTmpRule1,nIndex,mLevel,true); 1251766ce4d0SZheng Fan if (GetNBOIndexForNumRule(aTmpRule1,mLevel,nIndex)==nIndex+1) { 1252766ce4d0SZheng Fan if (pActualBullets[nIndex]->eType == eNBType::BULLETS) { 1253766ce4d0SZheng Fan BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); 1254766ce4d0SZheng Fan pEntry->bIsCustomized = false; 1255766ce4d0SZheng Fan pEntry->sDescription = GetDescription(nIndex,true); 1256766ce4d0SZheng Fan } 1257766ce4d0SZheng Fan if (pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS) { 1258766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); 1259766ce4d0SZheng Fan pEntry->bIsCustomized = false; 1260766ce4d0SZheng Fan pEntry->sDescription = GetDescription(nIndex,true); 1261766ce4d0SZheng Fan } 1262766ce4d0SZheng Fan } 1263766ce4d0SZheng Fan ImplStore(String::CreateFromAscii("standard.sya")); 1264766ce4d0SZheng Fan return sal_True; 1265766ce4d0SZheng Fan } 1266766ce4d0SZheng Fan 1267766ce4d0SZheng Fan sal_Bool MixBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 1268766ce4d0SZheng Fan { 1269766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF || nIndex>=DEFAULT_BULLET_TYPES ) 1270766ce4d0SZheng Fan if ( nIndex>=DEFAULT_BULLET_TYPES ) 1271766ce4d0SZheng Fan return sal_False; 1272766ce4d0SZheng Fan MixBulletsSettings_Impl* pCurrentBullets = pActualBullets[nIndex]; 1273766ce4d0SZheng Fan if (isDefault) pCurrentBullets=pDefaultActualBullets[nIndex]; 1274766ce4d0SZheng Fan 1275766ce4d0SZheng Fan if ( pCurrentBullets->eType == eNBType::BULLETS ) 1276766ce4d0SZheng Fan { 1277766ce4d0SZheng Fan sal_Unicode cChar; 1278766ce4d0SZheng Fan cChar = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->cBulletChar; 1279766ce4d0SZheng Fan 1280766ce4d0SZheng Fan //Font& rActBulletFont = lcl_GetDefaultBulletFont(); 1281766ce4d0SZheng Fan Font rActBulletFont = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->aFont; 1282766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1283766ce4d0SZheng Fan String sBulletCharFmtName = GetBulCharFmtName(); 1284766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1285766ce4d0SZheng Fan { 1286766ce4d0SZheng Fan if(mLevel & nMask) 1287766ce4d0SZheng Fan { 1288766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1289766ce4d0SZheng Fan if (SVX_NUM_CHAR_SPECIAL !=aFmt.GetNumberingType()) isResetSize=true; 1290766ce4d0SZheng Fan aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); 1291766ce4d0SZheng Fan aFmt.SetBulletFont(&rActBulletFont); 1292766ce4d0SZheng Fan aFmt.SetBulletChar(cChar ); 1293766ce4d0SZheng Fan aFmt.SetCharFmtName(sBulletCharFmtName); 1294766ce4d0SZheng Fan String aEmptyStr; 1295766ce4d0SZheng Fan aFmt.SetPrefix( aEmptyStr ); 1296766ce4d0SZheng Fan aFmt.SetSuffix( aEmptyStr ); 1297766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(45); 1298766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 1299766ce4d0SZheng Fan } 1300766ce4d0SZheng Fan nMask <<= 1; 1301766ce4d0SZheng Fan } 1302766ce4d0SZheng Fan }else if ( pCurrentBullets->eType == eNBType::GRAPHICBULLETS ) 1303766ce4d0SZheng Fan { 1304766ce4d0SZheng Fan String sGrfName; 1305766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pCurrentBullets->pBullets); 1306766ce4d0SZheng Fan sGrfName= pEntry->sGrfName; 1307766ce4d0SZheng Fan 1308766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1309766ce4d0SZheng Fan String aEmptyStr; 1310766ce4d0SZheng Fan sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; 1311766ce4d0SZheng Fan String sNumCharFmtName = GetBulCharFmtName(); 1312766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1313766ce4d0SZheng Fan { 1314766ce4d0SZheng Fan if(mLevel & nMask) 1315766ce4d0SZheng Fan { 1316766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1317766ce4d0SZheng Fan if (SVX_NUM_BITMAP !=aFmt.GetNumberingType()) isResetSize=true; 1318766ce4d0SZheng Fan aFmt.SetNumberingType(nSetNumberingType); 1319766ce4d0SZheng Fan aFmt.SetPrefix( aEmptyStr ); 1320766ce4d0SZheng Fan aFmt.SetSuffix( aEmptyStr ); 1321766ce4d0SZheng Fan aFmt.SetCharFmtName( sNumCharFmtName ); 1322766ce4d0SZheng Fan if ( pCurrentBullets->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj ) 1323766ce4d0SZheng Fan { 1324766ce4d0SZheng Fan Size aSize = pEntry->aSize; 1325766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 1326766ce4d0SZheng Fan if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); 1327766ce4d0SZheng Fan else { 1328766ce4d0SZheng Fan if (aSize.Width()==0 && aSize.Height()==0) { 1329766ce4d0SZheng Fan aSize = SvxNumberFormat::GetGraphicSizeMM100( pEntry->pGrfObj ); 1330766ce4d0SZheng Fan } 1331766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 1332766ce4d0SZheng Fan } 1333766ce4d0SZheng Fan SvxBrushItem aBrush(*(pEntry->pGrfObj), GPOS_AREA, SID_ATTR_BRUSH ); 1334766ce4d0SZheng Fan aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); 1335766ce4d0SZheng Fan }else 1336766ce4d0SZheng Fan { 1337766ce4d0SZheng Fan Graphic aGraphic; 1338766ce4d0SZheng Fan if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pCurrentBullets->nIndexDefault, &aGraphic)) 1339766ce4d0SZheng Fan { 1340766ce4d0SZheng Fan Size aSize = pEntry->aSize; 1341766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 1342766ce4d0SZheng Fan if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); 1343766ce4d0SZheng Fan else { 1344766ce4d0SZheng Fan if (aSize.Width()==0 && aSize.Height()==0) { 1345766ce4d0SZheng Fan aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); 1346766ce4d0SZheng Fan } 1347766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 1348766ce4d0SZheng Fan } 1349766ce4d0SZheng Fan SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); 1350766ce4d0SZheng Fan aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); 1351766ce4d0SZheng Fan }else 1352766ce4d0SZheng Fan aFmt.SetGraphic( sGrfName ); 1353766ce4d0SZheng Fan } 1354766ce4d0SZheng Fan 1355766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 1356766ce4d0SZheng Fan } 1357766ce4d0SZheng Fan nMask <<= 1 ; 1358766ce4d0SZheng Fan } 1359766ce4d0SZheng Fan } 1360766ce4d0SZheng Fan 1361766ce4d0SZheng Fan return sal_True; 1362766ce4d0SZheng Fan } 1363766ce4d0SZheng Fan 1364766ce4d0SZheng Fan String MixBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 1365766ce4d0SZheng Fan { 1366766ce4d0SZheng Fan String sRet; 1367766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 1368766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 1369766ce4d0SZheng Fan 1370766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 1371766ce4d0SZheng Fan return sRet; 1372766ce4d0SZheng Fan else 1373766ce4d0SZheng Fan sRet = pActualBullets[nIndex]->pBullets->sDescription; 1374766ce4d0SZheng Fan if (isDefault) sRet = pDefaultActualBullets[nIndex]->pBullets->sDescription; 1375766ce4d0SZheng Fan return sRet; 1376766ce4d0SZheng Fan } 1377766ce4d0SZheng Fan sal_Bool MixBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) 1378766ce4d0SZheng Fan { 1379766ce4d0SZheng Fan sal_Bool bRet = sal_False; 1380766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 1381766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 1382766ce4d0SZheng Fan 1383766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 1384766ce4d0SZheng Fan bRet = sal_False; 1385766ce4d0SZheng Fan else 1386766ce4d0SZheng Fan bRet = pActualBullets[nIndex]->pBullets->bIsCustomized; 1387766ce4d0SZheng Fan 1388766ce4d0SZheng Fan return bRet; 1389766ce4d0SZheng Fan } 1390766ce4d0SZheng Fan /*************************************************************************************************** 1391766ce4d0SZheng Fan **********************Numbering Type lib************************************************************** 1392766ce4d0SZheng Fan ****************************************************************************************************/ 1393766ce4d0SZheng Fan NumberingTypeMgr* NumberingTypeMgr::_instance = 0; 1394766ce4d0SZheng Fan 1395766ce4d0SZheng Fan NumberingTypeMgr::NumberingTypeMgr(const NBOType aType): 1396766ce4d0SZheng Fan NBOTypeMgrBase(aType), 1397766ce4d0SZheng Fan //pNumSettingsArr( new NumSettingsArr_Impl ), 1398766ce4d0SZheng Fan pNumberSettingsArr (new NumberSettingsArr_Impl) 1399766ce4d0SZheng Fan { 1400766ce4d0SZheng Fan Init(); 1401766ce4d0SZheng Fan pDefaultNumberSettingsArr = pNumberSettingsArr; 1402766ce4d0SZheng Fan pNumberSettingsArr = new NumberSettingsArr_Impl; 1403766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1404766ce4d0SZheng Fan Init(); 1405766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syb")); 1406766ce4d0SZheng Fan } 1407766ce4d0SZheng Fan 1408766ce4d0SZheng Fan NumberingTypeMgr::NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg): 1409766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg), 1410766ce4d0SZheng Fan //pNumSettingsArr( new NumSettingsArr_Impl ), 1411766ce4d0SZheng Fan pNumberSettingsArr (new NumberSettingsArr_Impl) 1412766ce4d0SZheng Fan { 1413766ce4d0SZheng Fan Init(); 1414766ce4d0SZheng Fan pDefaultNumberSettingsArr = pNumberSettingsArr; 1415766ce4d0SZheng Fan pNumberSettingsArr = new NumberSettingsArr_Impl; 1416766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1417766ce4d0SZheng Fan Init(); 1418766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syb")); 1419766ce4d0SZheng Fan } 1420766ce4d0SZheng Fan 1421766ce4d0SZheng Fan NumberingTypeMgr::NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr): 1422766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr), 1423766ce4d0SZheng Fan //pNumSettingsArr( new NumSettingsArr_Impl ), 1424766ce4d0SZheng Fan pNumberSettingsArr (new NumberSettingsArr_Impl) 1425766ce4d0SZheng Fan { 1426766ce4d0SZheng Fan /* 1427766ce4d0SZheng Fan for(sal_uInt16 i=0;i<aTypeMgr.GetNumCount();i++) 1428766ce4d0SZheng Fan { 1429766ce4d0SZheng Fan NumberSettings_Impl* _pSet = aTypeMgr.GetNumSettingByIndex(i); 1430766ce4d0SZheng Fan if ( _pSet ) 1431766ce4d0SZheng Fan { 1432766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->nIndex = _pSet->nIndex; 1433766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->nIndexDefault = _pSet->nIndexDefault; 1434766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->sDescription = _pSet->sDescription; 1435766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->bIsCustomized = _pSet->bIsCustomized; 1436766ce4d0SZheng Fan if ( _pSet->pNumSetting ) 1437766ce4d0SZheng Fan { 1438766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nNumberType = _pSet->pNumSetting->nNumberType; 1439766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nParentNumbering = _pSet->pNumSetting->nParentNumbering; 1440766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sPrefix = _pSet->pNumSetting->sPrefix; 1441766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sSuffix = _pSet->pNumSetting->sSuffix; 1442766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletChar = _pSet->pNumSetting->sBulletChar; 1443766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletFont = _pSet->pNumSetting->sBulletFont; 1444766ce4d0SZheng Fan 1445766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->eLabelFollowedBy = _pSet->pNumSetting->eLabelFollowedBy; 1446766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nTabValue = _pSet->pNumSetting->nTabValue; 1447766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->eNumAlign = _pSet->pNumSetting->eNumAlign; 1448766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nNumAlignAt = _pSet->pNumSetting->nNumAlignAt; 1449766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nNumIndentAt = _pSet->pNumSetting->nNumIndentAt; 1450766ce4d0SZheng Fan } 1451766ce4d0SZheng Fan } 1452766ce4d0SZheng Fan } 1453766ce4d0SZheng Fan */ 1454766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syb")); 1455766ce4d0SZheng Fan } 1456766ce4d0SZheng Fan 1457766ce4d0SZheng Fan void NumberingTypeMgr::Init() 1458766ce4d0SZheng Fan { 1459766ce4d0SZheng Fan Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); 1460766ce4d0SZheng Fan Reference < XInterface > xI = xMSF->createInstance( 1461766ce4d0SZheng Fan ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); 1462766ce4d0SZheng Fan Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); 1463766ce4d0SZheng Fan 1464766ce4d0SZheng Fan if(xDefNum.is()) 1465766ce4d0SZheng Fan { 1466766ce4d0SZheng Fan Sequence< Sequence< PropertyValue > > aNumberings; 1467766ce4d0SZheng Fan LanguageType eLang = Application::GetSettings().GetLanguage(); 1468766ce4d0SZheng Fan Locale aLocale = SvxCreateLocale(eLang); 1469766ce4d0SZheng Fan try 1470766ce4d0SZheng Fan { 1471766ce4d0SZheng Fan aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale ); 1472766ce4d0SZheng Fan 1473766ce4d0SZheng Fan sal_Int32 nLength = aNumberings.getLength() > DEFAULT_NUM_VALUSET_COUNT ? DEFAULT_NUM_VALUSET_COUNT :aNumberings.getLength(); 1474766ce4d0SZheng Fan 1475766ce4d0SZheng Fan const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray(); 1476766ce4d0SZheng Fan for(sal_Int32 i = 0; i < nLength; i++) 1477766ce4d0SZheng Fan { 1478766ce4d0SZheng Fan NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(pValuesArr[i]); 1479766ce4d0SZheng Fan NumberSettings_Impl* pNumEntry = new NumberSettings_Impl; 1480766ce4d0SZheng Fan pNumEntry->nIndex = i + 1; 1481766ce4d0SZheng Fan pNumEntry->nIndexDefault = i; 1482766ce4d0SZheng Fan pNumEntry->pNumSetting = pNew; 1483766ce4d0SZheng Fan //SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i )); 1484766ce4d0SZheng Fan { 1485766ce4d0SZheng Fan String sText; 1486766ce4d0SZheng Fan //const OUString sValue(C2U("Value")); 1487766ce4d0SZheng Fan Reference<XNumberingFormatter> xFormatter(xDefNum, UNO_QUERY); 1488766ce4d0SZheng Fan if(xFormatter.is() && aNumberings.getLength() > i) 1489766ce4d0SZheng Fan { 1490766ce4d0SZheng Fan 1491766ce4d0SZheng Fan for (sal_uInt16 j=0;j<3;j++) 1492766ce4d0SZheng Fan { 1493766ce4d0SZheng Fan Sequence<PropertyValue> aLevel = aNumberings.getConstArray()[i]; 1494766ce4d0SZheng Fan try 1495766ce4d0SZheng Fan { 1496766ce4d0SZheng Fan aLevel.realloc(aLevel.getLength() + 1); 1497766ce4d0SZheng Fan PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1]; 1498766ce4d0SZheng Fan rValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); 1499766ce4d0SZheng Fan rValue.Value <<= (sal_Int32)(j + 1); 1500766ce4d0SZheng Fan 1501766ce4d0SZheng Fan if (j!=0) 1502766ce4d0SZheng Fan sText += String::CreateFromAscii(" "); 1503766ce4d0SZheng Fan 1504766ce4d0SZheng Fan sText+=String(xFormatter->makeNumberingString( aLevel, aLocale )); 1505766ce4d0SZheng Fan } 1506766ce4d0SZheng Fan catch(Exception&) 1507766ce4d0SZheng Fan { 1508766ce4d0SZheng Fan DBG_ERROR("Exception in DefaultNumberingProvider::makeNumberingString"); 1509766ce4d0SZheng Fan } 1510766ce4d0SZheng Fan } 1511766ce4d0SZheng Fan } 1512766ce4d0SZheng Fan String aStrFromRES(SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS)); 1513766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%NUMBERINGSAMPLE"); 1514766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sText); 1515766ce4d0SZheng Fan pNumEntry->sDescription = aStrFromRES; 1516766ce4d0SZheng Fan } 1517766ce4d0SZheng Fan //End modification 1518766ce4d0SZheng Fan 1519766ce4d0SZheng Fan //pNumEntry->sDescription = SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTION_0 + i ); 1520766ce4d0SZheng Fan pNumberSettingsArr->Insert(pNumEntry, pNumberSettingsArr->Count()); 1521766ce4d0SZheng Fan } 1522766ce4d0SZheng Fan } 1523766ce4d0SZheng Fan catch(Exception&) 1524766ce4d0SZheng Fan { 1525766ce4d0SZheng Fan } 1526766ce4d0SZheng Fan } 1527766ce4d0SZheng Fan } 1528766ce4d0SZheng Fan 1529766ce4d0SZheng Fan sal_uInt16 NumberingTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 1530766ce4d0SZheng Fan { 1531766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) 1532766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1533766ce4d0SZheng Fan 1534766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1535766ce4d0SZheng Fan 1536766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1537766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1538766ce4d0SZheng Fan 1539766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1540766ce4d0SZheng Fan sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; 1541766ce4d0SZheng Fan sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; 1542766ce4d0SZheng Fan String sPreFix = aFmt.GetPrefix(); 1543766ce4d0SZheng Fan String sSuffix = aFmt.GetSuffix(); 1544766ce4d0SZheng Fan String sEmpty; 1545766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1546766ce4d0SZheng Fan 1547766ce4d0SZheng Fan sal_uInt16 nCount = pNumberSettingsArr->Count(); 1548766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < nCount; i++) 1549766ce4d0SZheng Fan { 1550766ce4d0SZheng Fan NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(i); 1551766ce4d0SZheng Fan sal_Int16 eNType = _pSet->pNumSetting->nNumberType; 1552766ce4d0SZheng Fan String sLocalPreFix = _pSet->pNumSetting->sPrefix.getStr(); 1553766ce4d0SZheng Fan String sLocalSuffix = _pSet->pNumSetting->sSuffix.getStr(); 1554766ce4d0SZheng Fan if (sPreFix.CompareTo(sLocalPreFix)==COMPARE_EQUAL && 1555766ce4d0SZheng Fan sSuffix.CompareTo(sLocalSuffix)==COMPARE_EQUAL && 1556766ce4d0SZheng Fan eNumType == eNType ) 1557766ce4d0SZheng Fan { 1558766ce4d0SZheng Fan return i+1; 1559766ce4d0SZheng Fan } 1560766ce4d0SZheng Fan } 1561766ce4d0SZheng Fan 1562766ce4d0SZheng Fan 1563766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1564766ce4d0SZheng Fan } 1565766ce4d0SZheng Fan 1566766ce4d0SZheng Fan sal_Bool NumberingTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 1567766ce4d0SZheng Fan { 1568766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 1569766ce4d0SZheng Fan // return sal_False; 1570766ce4d0SZheng Fan 1571766ce4d0SZheng Fan //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 1572766ce4d0SZheng Fan // return sal_False; 1573766ce4d0SZheng Fan 1574766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1575766ce4d0SZheng Fan 1576766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1577766ce4d0SZheng Fan return sal_False; 1578766ce4d0SZheng Fan 1579766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1580766ce4d0SZheng Fan //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; 1581766ce4d0SZheng Fan //sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; 1582766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1583766ce4d0SZheng Fan 1584766ce4d0SZheng Fan sal_uInt16 nCount = pNumberSettingsArr->Count(); 1585766ce4d0SZheng Fan if ( nIndex >= nCount ) 1586766ce4d0SZheng Fan return sal_False; 1587766ce4d0SZheng Fan 1588766ce4d0SZheng Fan NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(nIndex); 1589766ce4d0SZheng Fan 1590766ce4d0SZheng Fan _pSet->pNumSetting->sPrefix = aFmt.GetPrefix(); 1591766ce4d0SZheng Fan _pSet->pNumSetting->sSuffix = aFmt.GetSuffix(); 1592766ce4d0SZheng Fan _pSet->pNumSetting->nNumberType = eNumType; 1593766ce4d0SZheng Fan _pSet->bIsCustomized = sal_True; 1594766ce4d0SZheng Fan 1595766ce4d0SZheng Fan SvxNumRule aTmpRule1(aNum); 1596766ce4d0SZheng Fan SvxNumRule aTmpRule2(aNum); 1597766ce4d0SZheng Fan ApplyNumRule(aTmpRule1,nIndex,mLevel,true); 1598766ce4d0SZheng Fan ApplyNumRule(aTmpRule2,nIndex,mLevel,false); 1599766ce4d0SZheng Fan if (aTmpRule1==aTmpRule2) _pSet->bIsCustomized=false; 1600766ce4d0SZheng Fan if (_pSet->bIsCustomized) { 1601766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_NUMBERING_DESCRIPTION)); 1602766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1603766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1604766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1605766ce4d0SZheng Fan _pSet->sDescription = aStrFromRES; 1606766ce4d0SZheng Fan } else { 1607766ce4d0SZheng Fan _pSet->sDescription = GetDescription(nIndex,true); 1608766ce4d0SZheng Fan } 1609766ce4d0SZheng Fan ImplStore(String::CreateFromAscii("standard.syb")); 1610766ce4d0SZheng Fan return sal_True; 1611766ce4d0SZheng Fan } 1612766ce4d0SZheng Fan 1613766ce4d0SZheng Fan sal_Bool NumberingTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 1614766ce4d0SZheng Fan { 1615766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 1616766ce4d0SZheng Fan // return sal_False; 1617766ce4d0SZheng Fan 1618766ce4d0SZheng Fan //DBG_ASSERT(pNumSettingsArr->Count() > nIndex, "wrong index"); 1619766ce4d0SZheng Fan if(pNumberSettingsArr->Count() <= nIndex) 1620766ce4d0SZheng Fan return sal_False; 1621766ce4d0SZheng Fan NumberSettingsArr_Impl* pCurrentNumberSettingsArr=pNumberSettingsArr; 1622766ce4d0SZheng Fan if (isDefault) pCurrentNumberSettingsArr=pDefaultNumberSettingsArr; 1623766ce4d0SZheng Fan NumberSettings_ImplPtr _pSet = pCurrentNumberSettingsArr->GetObject(nIndex); 1624766ce4d0SZheng Fan sal_Int16 eNewType = _pSet->pNumSetting->nNumberType; 1625766ce4d0SZheng Fan 1626766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1627766ce4d0SZheng Fan String sNumCharFmtName = GetBulCharFmtName(); 1628766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1629766ce4d0SZheng Fan { 1630766ce4d0SZheng Fan if(mLevel & nMask) 1631766ce4d0SZheng Fan { 1632766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1633766ce4d0SZheng Fan if (eNewType!=aFmt.GetNumberingType()) isResetSize=true; 1634766ce4d0SZheng Fan aFmt.SetNumberingType(eNewType); 1635766ce4d0SZheng Fan aFmt.SetPrefix(_pSet->pNumSetting->sPrefix); 1636766ce4d0SZheng Fan aFmt.SetSuffix(_pSet->pNumSetting->sSuffix); 1637766ce4d0SZheng Fan 1638766ce4d0SZheng Fan aFmt.SetCharFmtName(sNumCharFmtName); 1639766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(100); 1640766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 1641766ce4d0SZheng Fan } 1642766ce4d0SZheng Fan nMask <<= 1 ; 1643766ce4d0SZheng Fan } 1644766ce4d0SZheng Fan 1645766ce4d0SZheng Fan return sal_True; 1646766ce4d0SZheng Fan } 1647766ce4d0SZheng Fan String NumberingTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 1648766ce4d0SZheng Fan { 1649766ce4d0SZheng Fan String sRet; 1650766ce4d0SZheng Fan sal_uInt16 nLength = 0; 1651766ce4d0SZheng Fan nLength = pNumberSettingsArr->Count(); 1652766ce4d0SZheng Fan 1653766ce4d0SZheng Fan if ( nIndex >= nLength ) 1654766ce4d0SZheng Fan return sRet; 1655766ce4d0SZheng Fan else 1656766ce4d0SZheng Fan sRet = pNumberSettingsArr->GetObject(nIndex)->sDescription; 1657766ce4d0SZheng Fan if (isDefault) sRet = pDefaultNumberSettingsArr->GetObject(nIndex)->sDescription; 1658766ce4d0SZheng Fan 1659766ce4d0SZheng Fan return sRet; 1660766ce4d0SZheng Fan } 1661766ce4d0SZheng Fan sal_Bool NumberingTypeMgr::IsCustomized(sal_uInt16 nIndex) 1662766ce4d0SZheng Fan { 1663766ce4d0SZheng Fan sal_Bool bRet = sal_False; 1664766ce4d0SZheng Fan sal_uInt16 nLength = 0; 1665766ce4d0SZheng Fan nLength = pNumberSettingsArr->Count(); 1666766ce4d0SZheng Fan 1667766ce4d0SZheng Fan if ( nIndex >= nLength ) 1668766ce4d0SZheng Fan bRet = sal_False; 1669766ce4d0SZheng Fan else 1670766ce4d0SZheng Fan bRet = pNumberSettingsArr->GetObject(nIndex)->bIsCustomized; 1671766ce4d0SZheng Fan 1672766ce4d0SZheng Fan return bRet; 1673766ce4d0SZheng Fan } 1674766ce4d0SZheng Fan sal_uInt16 NumberingTypeMgr::GetNumCount() const 1675766ce4d0SZheng Fan { 1676766ce4d0SZheng Fan sal_uInt16 nRet = 0; 1677766ce4d0SZheng Fan if ( pNumberSettingsArr ) 1678766ce4d0SZheng Fan nRet = pNumberSettingsArr->Count(); 1679766ce4d0SZheng Fan 1680766ce4d0SZheng Fan return nRet; 1681766ce4d0SZheng Fan } 1682766ce4d0SZheng Fan NumberSettings_Impl* NumberingTypeMgr::GetNumSettingByIndex(sal_uInt16 nIndex) const 1683766ce4d0SZheng Fan { 1684766ce4d0SZheng Fan NumberSettings_Impl* pRet = 0; 1685766ce4d0SZheng Fan if ( pNumberSettingsArr && nIndex< pNumberSettingsArr->Count() ) 1686766ce4d0SZheng Fan { 1687766ce4d0SZheng Fan pRet = pNumberSettingsArr->GetObject(nIndex); 1688766ce4d0SZheng Fan } 1689766ce4d0SZheng Fan 1690766ce4d0SZheng Fan return pRet; 1691766ce4d0SZheng Fan } 1692766ce4d0SZheng Fan /*************************************************************************************************** 1693766ce4d0SZheng Fan **********************Multi-level /Outline Type lib******************************************************* 1694766ce4d0SZheng Fan ****************************************************************************************************/ 1695766ce4d0SZheng Fan OutlineTypeMgr* OutlineTypeMgr::_instance = 0; 1696766ce4d0SZheng Fan 1697766ce4d0SZheng Fan OutlineTypeMgr::OutlineTypeMgr(const NBOType aType): 1698766ce4d0SZheng Fan NBOTypeMgrBase(aType)//, 1699766ce4d0SZheng Fan //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT] ) 1700766ce4d0SZheng Fan { 1701766ce4d0SZheng Fan Init(); 1702766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) 1703766ce4d0SZheng Fan { 1704766ce4d0SZheng Fan pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; 1705766ce4d0SZheng Fan } 1706766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1707766ce4d0SZheng Fan Init(); 1708766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syc")); 1709766ce4d0SZheng Fan } 1710766ce4d0SZheng Fan 1711766ce4d0SZheng Fan OutlineTypeMgr::OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg): 1712766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg)//, 1713766ce4d0SZheng Fan //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) 1714766ce4d0SZheng Fan { 1715766ce4d0SZheng Fan Init(); 1716766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) 1717766ce4d0SZheng Fan { 1718766ce4d0SZheng Fan pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; 1719766ce4d0SZheng Fan } 1720766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1721766ce4d0SZheng Fan Init(); 1722766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syc")); 1723766ce4d0SZheng Fan } 1724766ce4d0SZheng Fan 1725766ce4d0SZheng Fan OutlineTypeMgr::OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr): 1726766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr)//, 1727766ce4d0SZheng Fan //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) 1728766ce4d0SZheng Fan { 1729766ce4d0SZheng Fan Init(); 1730766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) 1731766ce4d0SZheng Fan { 1732766ce4d0SZheng Fan pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; 1733766ce4d0SZheng Fan } 1734766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1735766ce4d0SZheng Fan Init(); 1736766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syc")); 1737766ce4d0SZheng Fan } 1738766ce4d0SZheng Fan 1739766ce4d0SZheng Fan void OutlineTypeMgr::Init() 1740766ce4d0SZheng Fan { 1741766ce4d0SZheng Fan Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); 1742766ce4d0SZheng Fan Reference < XInterface > xI = xMSF->createInstance( 1743766ce4d0SZheng Fan ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); 1744766ce4d0SZheng Fan Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); 1745766ce4d0SZheng Fan 1746766ce4d0SZheng Fan if(xDefNum.is()) 1747766ce4d0SZheng Fan { 1748766ce4d0SZheng Fan Sequence<Reference<XIndexAccess> > aOutlineAccess; 1749766ce4d0SZheng Fan LanguageType eLang = Application::GetSettings().GetLanguage(); 1750766ce4d0SZheng Fan Locale aLocale = SvxCreateLocale(eLang); 1751766ce4d0SZheng Fan try 1752766ce4d0SZheng Fan { 1753766ce4d0SZheng Fan aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); 1754766ce4d0SZheng Fan 1755766ce4d0SZheng Fan SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , 1756766ce4d0SZheng Fan SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); 1757766ce4d0SZheng Fan 1758766ce4d0SZheng Fan for(sal_Int32 nItem = 0; 1759766ce4d0SZheng Fan nItem < aOutlineAccess.getLength() && nItem < DEFAULT_NUM_VALUSET_COUNT; 1760766ce4d0SZheng Fan nItem++ ) 1761766ce4d0SZheng Fan { 1762766ce4d0SZheng Fan pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl; 1763766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ]; 1764766ce4d0SZheng Fan pItemArr->sDescription = SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 + nItem ); 1765766ce4d0SZheng Fan pItemArr->pNumSettingsArr = new NumSettingsArr_Impl; 1766766ce4d0SZheng Fan Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem]; 1767766ce4d0SZheng Fan for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) 1768766ce4d0SZheng Fan { 1769766ce4d0SZheng Fan Any aValueAny = xLevel->getByIndex(nLevel); 1770766ce4d0SZheng Fan Sequence<PropertyValue> aLevelProps; 1771766ce4d0SZheng Fan aValueAny >>= aLevelProps; 1772766ce4d0SZheng Fan NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(aLevelProps); 1773766ce4d0SZheng Fan SvxNumberFormat aNumFmt( aDefNumRule.GetLevel( nLevel) ); 1774766ce4d0SZheng Fan pNew->eLabelFollowedBy = aNumFmt.GetLabelFollowedBy(); 1775766ce4d0SZheng Fan pNew->nTabValue = aNumFmt.GetListtabPos(); 1776766ce4d0SZheng Fan pNew->eNumAlign = aNumFmt.GetNumAdjust(); 1777766ce4d0SZheng Fan pNew->nNumAlignAt = aNumFmt.GetFirstLineIndent(); 1778766ce4d0SZheng Fan pNew->nNumIndentAt = aNumFmt.GetIndentAt(); 1779766ce4d0SZheng Fan pItemArr->pNumSettingsArr->Insert( pNew, pItemArr->pNumSettingsArr->Count() ); 1780766ce4d0SZheng Fan } 1781766ce4d0SZheng Fan } 1782766ce4d0SZheng Fan } 1783766ce4d0SZheng Fan catch(Exception&) 1784766ce4d0SZheng Fan { 1785766ce4d0SZheng Fan } 1786766ce4d0SZheng Fan } 1787766ce4d0SZheng Fan } 1788766ce4d0SZheng Fan 1789766ce4d0SZheng Fan sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 1790766ce4d0SZheng Fan { 1791766ce4d0SZheng Fan sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 1792766ce4d0SZheng Fan for(sal_uInt16 iDex = nFromIndex; iDex < nLength; iDex++) 1793766ce4d0SZheng Fan { 1794766ce4d0SZheng Fan sal_Bool bNotMatch = sal_False; 1795766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[iDex]; 1796766ce4d0SZheng Fan sal_uInt16 nCount = pItemArr->pNumSettingsArr->Count(); 1797766ce4d0SZheng Fan for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) 1798766ce4d0SZheng Fan { 1799766ce4d0SZheng Fan NumSettings_ImplPtr _pSet = pItemArr->pNumSettingsArr->GetObject(iLevel); 1800766ce4d0SZheng Fan sal_Int16 eNType = _pSet->nNumberType; 1801766ce4d0SZheng Fan const sal_Unicode cLocalPrefix = _pSet->sPrefix.getLength() ? _pSet->sPrefix.getStr()[0] : 0; 1802766ce4d0SZheng Fan const sal_Unicode cLocalSuffix = _pSet->sSuffix.getLength() ? _pSet->sSuffix.getStr()[0] : 0; 1803766ce4d0SZheng Fan 1804766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); 1805766ce4d0SZheng Fan sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; 1806766ce4d0SZheng Fan sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; 1807766ce4d0SZheng Fan String sPreFix = aFmt.GetPrefix(); 1808766ce4d0SZheng Fan String sSuffix = aFmt.GetSuffix(); 1809766ce4d0SZheng Fan String sEmpty; 1810766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1811766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL) 1812766ce4d0SZheng Fan { 1813766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1814766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1815766ce4d0SZheng Fan sal_Unicode ccChar = _pSet->sBulletChar.getStr()[0]; 1816766ce4d0SZheng Fan rtl::OUString sFont = _pSet->sBulletFont; 1817766ce4d0SZheng Fan if ( !((cChar == ccChar) && //pFont && sFont.compareTo(pFont->GetName()) && 1818766ce4d0SZheng Fan _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && 1819766ce4d0SZheng Fan _pSet->nTabValue == aFmt.GetListtabPos() && 1820766ce4d0SZheng Fan _pSet->eNumAlign == aFmt.GetNumAdjust() && 1821766ce4d0SZheng Fan _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && 1822766ce4d0SZheng Fan _pSet->nNumIndentAt == aFmt.GetIndentAt())) 1823766ce4d0SZheng Fan { 1824766ce4d0SZheng Fan bNotMatch = sal_True; 1825766ce4d0SZheng Fan break; 1826766ce4d0SZheng Fan } 1827766ce4d0SZheng Fan }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { 1828766ce4d0SZheng Fan const SvxBrushItem* pBrsh1 = aFmt.GetBrush(); 1829766ce4d0SZheng Fan const SvxBrushItem* pBrsh2 = _pSet->pBrushItem; 1830766ce4d0SZheng Fan sal_Bool bIsMatch = false; 1831766ce4d0SZheng Fan if (pBrsh1==pBrsh2) bIsMatch = true; 1832766ce4d0SZheng Fan if (pBrsh1 && pBrsh2) { 1833766ce4d0SZheng Fan const Graphic* pGrf1 = pBrsh1->GetGraphic();; 1834766ce4d0SZheng Fan const Graphic* pGrf2 = pBrsh2->GetGraphic();; 1835766ce4d0SZheng Fan if (pGrf1==pGrf2) bIsMatch = true; 1836766ce4d0SZheng Fan if (pGrf1 && pGrf2) { 1837766ce4d0SZheng Fan if ( pGrf1->GetBitmap().IsEqual(pGrf2->GetBitmap()) && 1838766ce4d0SZheng Fan _pSet->aSize==aFmt.GetGraphicSize()) 1839766ce4d0SZheng Fan bIsMatch = true; 1840766ce4d0SZheng Fan } 1841766ce4d0SZheng Fan } 1842766ce4d0SZheng Fan if (!bIsMatch) { 1843766ce4d0SZheng Fan bNotMatch = sal_True; 1844766ce4d0SZheng Fan break; 1845766ce4d0SZheng Fan } 1846766ce4d0SZheng Fan } else 1847766ce4d0SZheng Fan { 1848766ce4d0SZheng Fan if (!((sPreFix.CompareTo(_pSet->sPrefix.getStr())==COMPARE_EQUAL) && 1849766ce4d0SZheng Fan ( sSuffix.CompareTo(_pSet->sSuffix.getStr())==COMPARE_EQUAL ) && 1850766ce4d0SZheng Fan eNumType == eNType && 1851766ce4d0SZheng Fan _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && 1852766ce4d0SZheng Fan _pSet->nTabValue == aFmt.GetListtabPos() && 1853766ce4d0SZheng Fan _pSet->eNumAlign == aFmt.GetNumAdjust() && 1854766ce4d0SZheng Fan _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && 1855766ce4d0SZheng Fan _pSet->nNumIndentAt == aFmt.GetIndentAt())) 1856766ce4d0SZheng Fan { 1857766ce4d0SZheng Fan bNotMatch = sal_True; 1858766ce4d0SZheng Fan break; 1859766ce4d0SZheng Fan } 1860766ce4d0SZheng Fan } 1861766ce4d0SZheng Fan } 1862766ce4d0SZheng Fan if ( !bNotMatch ) 1863766ce4d0SZheng Fan return iDex+1; 1864766ce4d0SZheng Fan } 1865766ce4d0SZheng Fan 1866766ce4d0SZheng Fan 1867766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1868766ce4d0SZheng Fan } 1869766ce4d0SZheng Fan 1870766ce4d0SZheng Fan sal_Bool OutlineTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 1871766ce4d0SZheng Fan { 1872766ce4d0SZheng Fan //if ( mLevel == 0 || mLevel == (sal_uInt16)0xFFFF ) 1873766ce4d0SZheng Fan // return sal_False; 1874766ce4d0SZheng Fan 1875766ce4d0SZheng Fan sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 1876766ce4d0SZheng Fan if ( nIndex >= nLength ) 1877766ce4d0SZheng Fan return sal_False; 1878766ce4d0SZheng Fan 1879766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 1880766ce4d0SZheng Fan sal_uInt16 nCount = pItemArr->pNumSettingsArr->Count(); 1881766ce4d0SZheng Fan for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) 1882766ce4d0SZheng Fan { 1883766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); 1884766ce4d0SZheng Fan sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; 1885766ce4d0SZheng Fan sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; 1886766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1887766ce4d0SZheng Fan 1888766ce4d0SZheng Fan NumSettings_ImplPtr _pSet = pItemArr->pNumSettingsArr->GetObject(iLevel); 1889766ce4d0SZheng Fan 1890766ce4d0SZheng Fan _pSet->eLabelFollowedBy = aFmt.GetLabelFollowedBy(); 1891766ce4d0SZheng Fan _pSet->nTabValue = aFmt.GetListtabPos(); 1892766ce4d0SZheng Fan _pSet->eNumAlign = aFmt.GetNumAdjust(); 1893766ce4d0SZheng Fan _pSet->nNumAlignAt = aFmt.GetFirstLineIndent(); 1894766ce4d0SZheng Fan _pSet->nNumIndentAt = aFmt.GetIndentAt(); 1895766ce4d0SZheng Fan 1896766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL) 1897766ce4d0SZheng Fan { 1898766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1899766ce4d0SZheng Fan OUString sChar(cChar); 1900766ce4d0SZheng Fan _pSet->sBulletChar = sChar;//OUString(cChar); 1901766ce4d0SZheng Fan if ( aFmt.GetBulletFont() ) 1902766ce4d0SZheng Fan _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); 1903766ce4d0SZheng Fan _pSet->nNumberType = eNumType; 1904766ce4d0SZheng Fan pItemArr->bIsCustomized = sal_True; 1905766ce4d0SZheng Fan }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { 1906766ce4d0SZheng Fan if (_pSet->pBrushItem) { 1907766ce4d0SZheng Fan delete (_pSet->pBrushItem); 1908766ce4d0SZheng Fan _pSet->pBrushItem=NULL; 1909766ce4d0SZheng Fan } 1910766ce4d0SZheng Fan if (aFmt.GetBrush()) 1911766ce4d0SZheng Fan _pSet->pBrushItem = new SvxBrushItem(*aFmt.GetBrush()); 1912766ce4d0SZheng Fan _pSet->aSize = aFmt.GetGraphicSize(); 1913766ce4d0SZheng Fan _pSet->nNumberType = eNumType; 1914766ce4d0SZheng Fan } else 1915766ce4d0SZheng Fan { 1916766ce4d0SZheng Fan _pSet->sPrefix = aFmt.GetPrefix(); 1917766ce4d0SZheng Fan _pSet->sSuffix = aFmt.GetSuffix(); 1918766ce4d0SZheng Fan _pSet->nNumberType = eNumType; 1919766ce4d0SZheng Fan if ( aFmt.GetBulletFont() ) 1920766ce4d0SZheng Fan _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); 1921766ce4d0SZheng Fan pItemArr->bIsCustomized = sal_True; 1922766ce4d0SZheng Fan } 1923766ce4d0SZheng Fan } 1924766ce4d0SZheng Fan SvxNumRule aTmpRule1(aNum); 1925766ce4d0SZheng Fan SvxNumRule aTmpRule2(aNum); 1926766ce4d0SZheng Fan ApplyNumRule(aTmpRule1,nIndex,mLevel,true); 1927766ce4d0SZheng Fan ApplyNumRule(aTmpRule2,nIndex,mLevel,false); 1928766ce4d0SZheng Fan if (aTmpRule1==aTmpRule2) pItemArr->bIsCustomized=false; 1929766ce4d0SZheng Fan if (pItemArr->bIsCustomized) { 1930766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_MULTILEVEL_DESCRIPTION)); 1931766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1932766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1933766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1934766ce4d0SZheng Fan pItemArr->sDescription = aStrFromRES; 1935766ce4d0SZheng Fan } else { 1936766ce4d0SZheng Fan pItemArr->sDescription = GetDescription(nIndex,true); 1937766ce4d0SZheng Fan } 1938766ce4d0SZheng Fan ImplStore(String::CreateFromAscii("standard.syc")); 1939766ce4d0SZheng Fan return sal_True; 1940766ce4d0SZheng Fan } 1941766ce4d0SZheng Fan 1942766ce4d0SZheng Fan sal_Bool OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 1943766ce4d0SZheng Fan { 1944766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 1945766ce4d0SZheng Fan // return sal_False; 1946766ce4d0SZheng Fan 1947766ce4d0SZheng Fan DBG_ASSERT(DEFAULT_NUM_VALUSET_COUNT > nIndex, "wrong index"); 1948766ce4d0SZheng Fan if(DEFAULT_NUM_VALUSET_COUNT <= nIndex) 1949766ce4d0SZheng Fan return sal_False; 1950766ce4d0SZheng Fan 1951766ce4d0SZheng Fan const FontList* pList = 0; 1952766ce4d0SZheng Fan 1953766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 1954766ce4d0SZheng Fan if (isDefault) pItemArr=pDefaultOutlineSettingsArrs[nIndex]; 1955766ce4d0SZheng Fan 1956766ce4d0SZheng Fan //Font& rActBulletFont = lcl_GetDefaultBulletFont(); 1957766ce4d0SZheng Fan NumSettingsArr_Impl *pNumSettingsArr=pItemArr->pNumSettingsArr; 1958766ce4d0SZheng Fan 1959766ce4d0SZheng Fan NumSettings_ImplPtr pLevelSettings = 0; 1960766ce4d0SZheng Fan String sBulletCharFmtName = GetBulCharFmtName(); 1961766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1962766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1963766ce4d0SZheng Fan { 1964766ce4d0SZheng Fan if(pNumSettingsArr->Count() > i) 1965766ce4d0SZheng Fan pLevelSettings = pNumSettingsArr->GetObject(i); 1966766ce4d0SZheng Fan 1967766ce4d0SZheng Fan if(!pLevelSettings) 1968766ce4d0SZheng Fan break; 1969766ce4d0SZheng Fan 1970766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1971766ce4d0SZheng Fan //aFmt.SetBulletFont(&pLevelSettings->aFont); 1972766ce4d0SZheng Fan Font& rActBulletFont = lcl_GetDefaultBulletFont(); 1973766ce4d0SZheng Fan if (pLevelSettings->nNumberType !=aFmt.GetNumberingType()) isResetSize=true; 1974766ce4d0SZheng Fan aFmt.SetNumberingType( pLevelSettings->nNumberType ); 1975766ce4d0SZheng Fan sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering; 1976766ce4d0SZheng Fan if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) 1977766ce4d0SZheng Fan { 1978766ce4d0SZheng Fan if( pLevelSettings->sBulletFont.getLength() && 1979766ce4d0SZheng Fan pLevelSettings->sBulletFont.compareTo(rActBulletFont.GetName())) 1980766ce4d0SZheng Fan { 1981766ce4d0SZheng Fan //search for the font 1982766ce4d0SZheng Fan if(!pList) 1983766ce4d0SZheng Fan { 1984766ce4d0SZheng Fan SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); 1985766ce4d0SZheng Fan const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pCurDocShell->GetItem( SID_ATTR_CHAR_FONTLIST ); 1986766ce4d0SZheng Fan pList = pFontListItem ? pFontListItem->GetFontList() : 0; 1987766ce4d0SZheng Fan } 1988766ce4d0SZheng Fan if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) ) 1989766ce4d0SZheng Fan { 1990766ce4d0SZheng Fan FontInfo aInfo = pList->Get(pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE); 1991766ce4d0SZheng Fan Font aFont(aInfo); 1992766ce4d0SZheng Fan aFmt.SetBulletFont(&aFont); 1993766ce4d0SZheng Fan } 1994766ce4d0SZheng Fan else 1995766ce4d0SZheng Fan { 1996766ce4d0SZheng Fan //if it cannot be found then create a new one 1997766ce4d0SZheng Fan Font aCreateFont( pLevelSettings->sBulletFont,String(), Size( 0, 14 ) ); 1998766ce4d0SZheng Fan aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); 1999766ce4d0SZheng Fan aCreateFont.SetFamily( FAMILY_DONTKNOW ); 2000766ce4d0SZheng Fan aCreateFont.SetPitch( PITCH_DONTKNOW ); 2001766ce4d0SZheng Fan aCreateFont.SetWeight( WEIGHT_DONTKNOW ); 2002766ce4d0SZheng Fan aCreateFont.SetTransparent( sal_True ); 2003766ce4d0SZheng Fan aFmt.SetBulletFont( &aCreateFont ); 2004766ce4d0SZheng Fan } 2005766ce4d0SZheng Fan }else 2006766ce4d0SZheng Fan aFmt.SetBulletFont( &rActBulletFont ); 2007766ce4d0SZheng Fan 2008766ce4d0SZheng Fan sal_Unicode cChar = 0; 2009766ce4d0SZheng Fan if( pLevelSettings->sBulletChar.getLength() ) 2010766ce4d0SZheng Fan cChar = pLevelSettings->sBulletChar.getStr()[0]; 2011766ce4d0SZheng Fan if( Application::GetSettings().GetLayoutRTL() ) 2012766ce4d0SZheng Fan { 2013766ce4d0SZheng Fan if( 0 == i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] ) 2014766ce4d0SZheng Fan cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[5]; 2015766ce4d0SZheng Fan else if( 1 == i ) 2016766ce4d0SZheng Fan { 2017766ce4d0SZheng Fan const SvxNumberFormat& numberFmt = aNum.GetLevel(0); 2018766ce4d0SZheng Fan if( numberFmt.GetBulletChar() == BulletsTypeMgr::aDynamicRTLBulletTypes[5] ) 2019766ce4d0SZheng Fan cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[4]; 2020766ce4d0SZheng Fan } 2021766ce4d0SZheng Fan } 2022766ce4d0SZheng Fan 2023766ce4d0SZheng Fan aFmt.SetBulletChar(cChar); 2024766ce4d0SZheng Fan aFmt.SetCharFmtName( sBulletCharFmtName ); 2025766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(45); 2026766ce4d0SZheng Fan }else if ((aFmt.GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { 2027766ce4d0SZheng Fan if (pLevelSettings->pBrushItem) { 2028766ce4d0SZheng Fan const Graphic* pGrf = pLevelSettings->pBrushItem->GetGraphic();; 2029766ce4d0SZheng Fan Size aSize = pLevelSettings->aSize; 2030766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 2031766ce4d0SZheng Fan if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); 2032766ce4d0SZheng Fan else { 2033766ce4d0SZheng Fan if (aSize.Width()==0 && aSize.Height()==0 && pGrf) { 2034766ce4d0SZheng Fan aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf ); 2035766ce4d0SZheng Fan } 2036766ce4d0SZheng Fan } 2037766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 2038766ce4d0SZheng Fan aFmt.SetGraphicBrush( pLevelSettings->pBrushItem, &aSize, &eOrient ); 2039766ce4d0SZheng Fan } 2040766ce4d0SZheng Fan } else 2041766ce4d0SZheng Fan { 2042766ce4d0SZheng Fan aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? aNum.GetLevelCount() : 0)); 2043766ce4d0SZheng Fan aFmt.SetCharFmtName(sBulletCharFmtName); 2044766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(100); 2045766ce4d0SZheng Fan } 2046766ce4d0SZheng Fan if(pNumSettingsArr->Count() > i) { 2047766ce4d0SZheng Fan aFmt.SetLabelFollowedBy(pLevelSettings->eLabelFollowedBy); 2048766ce4d0SZheng Fan aFmt.SetListtabPos(pLevelSettings->nTabValue); 2049766ce4d0SZheng Fan aFmt.SetNumAdjust(pLevelSettings->eNumAlign); 2050766ce4d0SZheng Fan aFmt.SetFirstLineIndent(pLevelSettings->nNumAlignAt); 2051766ce4d0SZheng Fan aFmt.SetIndentAt(pLevelSettings->nNumIndentAt); 2052766ce4d0SZheng Fan } 2053766ce4d0SZheng Fan aFmt.SetPrefix(pLevelSettings->sPrefix); 2054766ce4d0SZheng Fan aFmt.SetSuffix(pLevelSettings->sSuffix); 2055766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 2056766ce4d0SZheng Fan } 2057766ce4d0SZheng Fan 2058766ce4d0SZheng Fan return sal_True; 2059766ce4d0SZheng Fan } 2060766ce4d0SZheng Fan String OutlineTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 2061766ce4d0SZheng Fan { 2062766ce4d0SZheng Fan String sRet; 2063766ce4d0SZheng Fan sal_uInt16 nLength = 0; 2064766ce4d0SZheng Fan nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 2065766ce4d0SZheng Fan 2066766ce4d0SZheng Fan if ( nIndex >= nLength ) 2067766ce4d0SZheng Fan return sRet; 2068766ce4d0SZheng Fan else 2069766ce4d0SZheng Fan { 2070766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 2071766ce4d0SZheng Fan if (isDefault) pItemArr = pDefaultOutlineSettingsArrs[nIndex]; 2072766ce4d0SZheng Fan if ( pItemArr ) 2073766ce4d0SZheng Fan { 2074766ce4d0SZheng Fan sRet = pItemArr->sDescription; 2075766ce4d0SZheng Fan }; 2076766ce4d0SZheng Fan } 2077766ce4d0SZheng Fan return sRet; 2078766ce4d0SZheng Fan } 2079766ce4d0SZheng Fan sal_Bool OutlineTypeMgr::IsCustomized(sal_uInt16 nIndex) 2080766ce4d0SZheng Fan { 2081766ce4d0SZheng Fan sal_Bool bRet = sal_False; 2082766ce4d0SZheng Fan 2083766ce4d0SZheng Fan sal_uInt16 nLength = 0; 2084766ce4d0SZheng Fan nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 2085766ce4d0SZheng Fan 2086766ce4d0SZheng Fan if ( nIndex >= nLength ) 2087766ce4d0SZheng Fan return bRet; 2088766ce4d0SZheng Fan else 2089766ce4d0SZheng Fan { 2090766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 2091766ce4d0SZheng Fan if ( pItemArr ) 2092766ce4d0SZheng Fan { 2093766ce4d0SZheng Fan bRet = pItemArr->bIsCustomized; 2094766ce4d0SZheng Fan }; 2095766ce4d0SZheng Fan } 2096766ce4d0SZheng Fan 2097766ce4d0SZheng Fan return bRet; 2098766ce4d0SZheng Fan } 2099766ce4d0SZheng Fan 2100766ce4d0SZheng Fan 2101766ce4d0SZheng Fan }} 2102