11ff378efSZheng Fan /************************************************************** 2766ce4d0SZheng Fan * 31ff378efSZheng Fan * Licensed to the Apache Software Foundation (ASF) under one 41ff378efSZheng Fan * or more contributor license agreements. See the NOTICE file 51ff378efSZheng Fan * distributed with this work for additional information 61ff378efSZheng Fan * regarding copyright ownership. The ASF licenses this file 71ff378efSZheng Fan * to you under the Apache License, Version 2.0 (the 81ff378efSZheng Fan * "License"); you may not use this file except in compliance 91ff378efSZheng Fan * with the License. You may obtain a copy of the License at 101ff378efSZheng Fan * 111ff378efSZheng Fan * http://www.apache.org/licenses/LICENSE-2.0 121ff378efSZheng Fan * 131ff378efSZheng Fan * Unless required by applicable law or agreed to in writing, 141ff378efSZheng Fan * software distributed under the License is distributed on an 151ff378efSZheng Fan * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161ff378efSZheng Fan * KIND, either express or implied. See the License for the 171ff378efSZheng Fan * specific language governing permissions and limitations 181ff378efSZheng Fan * under the License. 191ff378efSZheng Fan * 201ff378efSZheng 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); 2131ff378efSZheng 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 { 304*0deba7fbSSteve Yin //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 //sal_uInt16 nLength = 0; 390766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 391766ce4d0SZheng Fan { 392766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 393766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < nLength; i++) 394766ce4d0SZheng Fan { 395766ce4d0SZheng Fan if ( cChar == aDynamicRTLBulletTypes[i] || 396766ce4d0SZheng Fan (cChar == 9830 && 57356 == aDynamicRTLBulletTypes[i]) || 397766ce4d0SZheng Fan (cChar == 9632 && 57354 == aDynamicRTLBulletTypes[i]) ) 398766ce4d0SZheng Fan { 399766ce4d0SZheng Fan return i+1; 400766ce4d0SZheng Fan } 401766ce4d0SZheng Fan } 402766ce4d0SZheng Fan } else 403766ce4d0SZheng Fan { 404766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 405766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < nLength; i++) 406766ce4d0SZheng Fan { 407766ce4d0SZheng Fan if ( cChar == aDynamicBulletTypes[i] || 408766ce4d0SZheng Fan (cChar == 9830 && 57356 == aDynamicBulletTypes[i]) || 409766ce4d0SZheng Fan (cChar == 9632 && 57354 == aDynamicBulletTypes[i]) ) 410766ce4d0SZheng Fan { 411766ce4d0SZheng Fan return i+1; 412766ce4d0SZheng Fan } 413766ce4d0SZheng Fan } 414766ce4d0SZheng Fan }*/ 415766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 416766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) 417766ce4d0SZheng Fan { 418766ce4d0SZheng Fan if ( (cChar == pActualBullets[i]->cBulletChar|| 419766ce4d0SZheng Fan (cChar == 9830 && 57356 == pActualBullets[i]->cBulletChar) || 420766ce4d0SZheng Fan (cChar == 9632 && 57354 == pActualBullets[i]->cBulletChar)))// && pFont && (pFont->GetName().CompareTo(pActualBullets[i]->aFont.GetName())==COMPARE_EQUAL)) 421766ce4d0SZheng Fan { 422766ce4d0SZheng Fan return i+1; 423766ce4d0SZheng Fan } 424766ce4d0SZheng Fan } 425766ce4d0SZheng Fan 426766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 427766ce4d0SZheng Fan } 428766ce4d0SZheng Fan 429766ce4d0SZheng Fan sal_Bool BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 430766ce4d0SZheng Fan { 431766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 432766ce4d0SZheng Fan return sal_False; 433766ce4d0SZheng Fan 434766ce4d0SZheng Fan if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 435766ce4d0SZheng Fan return sal_False; 436766ce4d0SZheng Fan 437766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 438766ce4d0SZheng Fan 439766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 440766ce4d0SZheng Fan return sal_False; 441766ce4d0SZheng Fan 442766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 443766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 444766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 445766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 446766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 447766ce4d0SZheng Fan { 448766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 449766ce4d0SZheng Fan 450766ce4d0SZheng Fan if ( nIndex >= nLength ) 451766ce4d0SZheng Fan return sal_False; 452766ce4d0SZheng Fan 453766ce4d0SZheng Fan aDynamicRTLBulletTypes[nIndex] = cChar; 454766ce4d0SZheng Fan } else 455766ce4d0SZheng Fan { 456766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 457766ce4d0SZheng Fan 458766ce4d0SZheng Fan if ( nIndex >= nLength ) 459766ce4d0SZheng Fan return sal_False; 460766ce4d0SZheng Fan 461766ce4d0SZheng Fan aDynamicBulletTypes[nIndex] = cChar; 462766ce4d0SZheng Fan }*/ 463766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 464766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 465766ce4d0SZheng Fan return sal_False; 466766ce4d0SZheng Fan 467766ce4d0SZheng Fan pActualBullets[nIndex]->cBulletChar = cChar; 468766ce4d0SZheng Fan if ( pFont ) 469766ce4d0SZheng Fan pActualBullets[nIndex]->aFont = *pFont; 470766ce4d0SZheng Fan pActualBullets[nIndex]->bIsCustomized = sal_True; 471766ce4d0SZheng Fan 472766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 473766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 474766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 475766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 476766ce4d0SZheng Fan pActualBullets[nIndex]->sDescription = aStrFromRES; 477766ce4d0SZheng Fan 478766ce4d0SZheng Fan return sal_True; 479766ce4d0SZheng Fan } 480766ce4d0SZheng Fan 4819fe9aa9aSPavel Janík sal_Bool BulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool /* isDefault */,sal_Bool isResetSize) 482766ce4d0SZheng Fan { 483766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 484766ce4d0SZheng Fan // return sal_False; 485766ce4d0SZheng Fan 486766ce4d0SZheng Fan sal_Unicode cChar; 487766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 488766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 489766ce4d0SZheng Fan { 490766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 491766ce4d0SZheng Fan 492766ce4d0SZheng Fan if ( nIndex >= nLength ) 493766ce4d0SZheng Fan return sal_False; 494766ce4d0SZheng Fan 495766ce4d0SZheng Fan cChar = aDynamicRTLBulletTypes[nIndex]; 496766ce4d0SZheng Fan }else 497766ce4d0SZheng Fan { 498766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 499766ce4d0SZheng Fan 500766ce4d0SZheng Fan if ( nIndex >= nLength ) 501766ce4d0SZheng Fan return sal_False; 502766ce4d0SZheng Fan 503766ce4d0SZheng Fan cChar = aDynamicBulletTypes[nIndex]; 504766ce4d0SZheng Fan }*/ 505766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 506766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 507766ce4d0SZheng Fan return sal_False; 508766ce4d0SZheng Fan cChar = pActualBullets[nIndex]->cBulletChar; 509766ce4d0SZheng Fan //Font& rActBulletFont = lcl_GetDefaultBulletFont(); 510766ce4d0SZheng Fan Font rActBulletFont = pActualBullets[nIndex]->aFont; 511766ce4d0SZheng Fan 512766ce4d0SZheng Fan sal_uInt16 nMask = 1; 513766ce4d0SZheng Fan String sBulletCharFmtName = GetBulCharFmtName(); 514766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 515766ce4d0SZheng Fan { 516766ce4d0SZheng Fan if(mLevel & nMask) 517766ce4d0SZheng Fan { 518766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 519766ce4d0SZheng Fan aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); 520766ce4d0SZheng Fan aFmt.SetBulletFont(&rActBulletFont); 521766ce4d0SZheng Fan aFmt.SetBulletChar(cChar ); 522766ce4d0SZheng Fan aFmt.SetCharFmtName(sBulletCharFmtName); 523766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(45); 524766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 525766ce4d0SZheng Fan } 526766ce4d0SZheng Fan nMask <<= 1; 527766ce4d0SZheng Fan } 528766ce4d0SZheng Fan 529766ce4d0SZheng Fan return sal_True; 530766ce4d0SZheng Fan } 531766ce4d0SZheng Fan 5329fe9aa9aSPavel Janík String BulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool /* isDefault */) 533766ce4d0SZheng Fan { 534766ce4d0SZheng Fan String sRet; 535766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 536766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 537766ce4d0SZheng Fan 538766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 539766ce4d0SZheng Fan return sRet; 540766ce4d0SZheng Fan else 541766ce4d0SZheng Fan sRet = pActualBullets[nIndex]->sDescription; 542766ce4d0SZheng Fan 543766ce4d0SZheng Fan return sRet; 544766ce4d0SZheng Fan } 545766ce4d0SZheng Fan sal_Bool BulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) 546766ce4d0SZheng Fan { 547766ce4d0SZheng Fan sal_Bool bRet = sal_False; 548766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 549766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 550766ce4d0SZheng Fan 551766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 552766ce4d0SZheng Fan bRet = sal_False; 553766ce4d0SZheng Fan else 554766ce4d0SZheng Fan bRet = pActualBullets[nIndex]->bIsCustomized; 555766ce4d0SZheng Fan 556766ce4d0SZheng Fan return bRet; 557766ce4d0SZheng Fan } 558766ce4d0SZheng Fan 559766ce4d0SZheng Fan sal_Unicode BulletsTypeMgr::GetBulChar(sal_uInt16 nIndex) 560766ce4d0SZheng Fan { 561766ce4d0SZheng Fan sal_Unicode cChar; 562766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 563766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 564766ce4d0SZheng Fan 565766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 566766ce4d0SZheng Fan cChar = ' '; 567766ce4d0SZheng Fan else 568766ce4d0SZheng Fan cChar = pActualBullets[nIndex]->cBulletChar; 569766ce4d0SZheng Fan 570766ce4d0SZheng Fan /*if( Application::GetSettings().GetLayoutRTL() ) 571766ce4d0SZheng Fan { 572766ce4d0SZheng Fan nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); 573766ce4d0SZheng Fan 574766ce4d0SZheng Fan if ( nIndex >= nLength ) 575766ce4d0SZheng Fan cChar = ' '; 576766ce4d0SZheng Fan else 577766ce4d0SZheng Fan cChar = aDynamicRTLBulletTypes[nIndex]; 578766ce4d0SZheng Fan }else 579766ce4d0SZheng Fan { 580766ce4d0SZheng Fan nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); 581766ce4d0SZheng Fan 582766ce4d0SZheng Fan if ( nIndex >= nLength ) 583766ce4d0SZheng Fan cChar = ' '; 584766ce4d0SZheng Fan else 585766ce4d0SZheng Fan cChar = aDynamicBulletTypes[nIndex]; 586766ce4d0SZheng Fan }*/ 587766ce4d0SZheng Fan 588766ce4d0SZheng Fan return cChar; 589766ce4d0SZheng Fan } 590766ce4d0SZheng Fan Font BulletsTypeMgr::GetBulCharFont(sal_uInt16 nIndex) 591766ce4d0SZheng Fan { 592766ce4d0SZheng Fan Font aRet; 593766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 594766ce4d0SZheng Fan aRet = lcl_GetDefaultBulletFont(); 595766ce4d0SZheng Fan else 596766ce4d0SZheng Fan aRet = pActualBullets[nIndex]->aFont; 597766ce4d0SZheng Fan 598766ce4d0SZheng Fan return aRet; 599766ce4d0SZheng Fan } 600766ce4d0SZheng Fan /*************************************************************************************************** 601766ce4d0SZheng Fan **********************Graphic Bullet Type lib*********************************************************** 602766ce4d0SZheng Fan ****************************************************************************************************/ 603766ce4d0SZheng Fan GraphyicBulletsTypeMgr* GraphyicBulletsTypeMgr::_instance = 0; 604766ce4d0SZheng Fan GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType): 605766ce4d0SZheng Fan NBOTypeMgrBase(aType) 606766ce4d0SZheng Fan { 607766ce4d0SZheng Fan Init(); 608766ce4d0SZheng Fan } 609766ce4d0SZheng Fan 610766ce4d0SZheng Fan GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): 611766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg) 612766ce4d0SZheng Fan { 613766ce4d0SZheng Fan Init(); 614766ce4d0SZheng Fan } 615766ce4d0SZheng Fan GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTypeMgr): 616766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr) 617766ce4d0SZheng Fan { 618766ce4d0SZheng Fan for (sal_uInt16 i=0;i< aTypeMgr.aGrfDataLst.Count();i++) 619766ce4d0SZheng Fan { 620766ce4d0SZheng Fan GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); 621766ce4d0SZheng Fan GrfBulDataRelation* pSrcEntry = (GrfBulDataRelation*)(aTypeMgr.aGrfDataLst.GetObject(i)); 622766ce4d0SZheng Fan if ( pEntry && pSrcEntry) 623766ce4d0SZheng Fan { 624766ce4d0SZheng Fan pEntry->bIsCustomized = pSrcEntry->bIsCustomized; 625766ce4d0SZheng Fan pEntry->nTabIndex = pSrcEntry->nTabIndex; 626766ce4d0SZheng Fan pEntry->nGallaryIndex = pSrcEntry->nGallaryIndex; 627766ce4d0SZheng Fan pEntry->sGrfName = pSrcEntry->sGrfName; 628766ce4d0SZheng Fan pEntry->sDescription = pSrcEntry->sDescription; 629766ce4d0SZheng Fan aGrfDataLst.Insert( pEntry, LIST_APPEND ); 630766ce4d0SZheng Fan } 631766ce4d0SZheng Fan } 632766ce4d0SZheng Fan } 633766ce4d0SZheng Fan void GraphyicBulletsTypeMgr::Init() 634766ce4d0SZheng Fan { 635766ce4d0SZheng Fan List aGrfNames; 636766ce4d0SZheng Fan GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); 637766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aGrfNames.Count(); i++) 638766ce4d0SZheng Fan { 639766ce4d0SZheng Fan String* pGrfNm = (String*) aGrfNames.GetObject(i); 640766ce4d0SZheng Fan INetURLObject aObj(*pGrfNm); 641766ce4d0SZheng Fan if(aObj.GetProtocol() == INET_PROT_FILE) 642766ce4d0SZheng Fan *pGrfNm = aObj.PathToFileName(); 643766ce4d0SZheng Fan 644766ce4d0SZheng Fan GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS); 645766ce4d0SZheng Fan pEntry->nTabIndex = i+1; 646766ce4d0SZheng Fan pEntry->nGallaryIndex = i; 647766ce4d0SZheng Fan pEntry->sGrfName = *pGrfNm; 648766ce4d0SZheng Fan 649766ce4d0SZheng Fan if( i < MAX_VALUESET_GRAPHIC ) 650766ce4d0SZheng Fan { 651766ce4d0SZheng Fan pEntry->sDescription = SVX_RESSTR( RID_SVXSTR_GRAPHICS_DESCRIPTIONS + i ); 652766ce4d0SZheng Fan }else 653766ce4d0SZheng Fan { 654766ce4d0SZheng Fan pEntry->sDescription = *pGrfNm; 655766ce4d0SZheng Fan } 656766ce4d0SZheng Fan 657766ce4d0SZheng Fan aGrfDataLst.Insert( pEntry, LIST_APPEND ); 658766ce4d0SZheng Fan } 659766ce4d0SZheng Fan } 6609fe9aa9aSPavel Janík sal_uInt16 GraphyicBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 /* nFromIndex */) 661766ce4d0SZheng Fan { 662766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 663766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 664766ce4d0SZheng Fan 665766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 666766ce4d0SZheng Fan 667766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 668766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 669766ce4d0SZheng Fan 670766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 671766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 672766ce4d0SZheng Fan const Graphic* pGrf = 0; 673766ce4d0SZheng Fan if ( pBrsh ) 674766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 675766ce4d0SZheng Fan 676766ce4d0SZheng Fan if ( pGrf ) 677766ce4d0SZheng Fan { 678766ce4d0SZheng Fan Graphic aGraphic; 679766ce4d0SZheng Fan for(sal_uInt16 i=0;i<aGrfDataLst.Count();i++) 680766ce4d0SZheng Fan { 681766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(i); 682766ce4d0SZheng Fan sal_Bool bExist = sal_False; 683766ce4d0SZheng Fan if ( pEntry) // && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) 684766ce4d0SZheng Fan bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pEntry->nGallaryIndex,&aGraphic); 685766ce4d0SZheng Fan if (bExist) { 686766ce4d0SZheng Fan Bitmap aSum=pGrf->GetBitmap(); 687766ce4d0SZheng Fan Bitmap aSum1=aGraphic.GetBitmap(); 688766ce4d0SZheng Fan if (aSum.IsEqual(aSum1)) 689766ce4d0SZheng Fan return pEntry->nTabIndex; 690766ce4d0SZheng Fan } 691766ce4d0SZheng Fan } 692766ce4d0SZheng Fan } 693766ce4d0SZheng Fan 694766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 695766ce4d0SZheng Fan } 696766ce4d0SZheng Fan 697766ce4d0SZheng Fan sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 698766ce4d0SZheng Fan { 699766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) 700766ce4d0SZheng Fan return sal_False; 701766ce4d0SZheng Fan 702766ce4d0SZheng Fan if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 703766ce4d0SZheng Fan return sal_False; 704766ce4d0SZheng Fan 705766ce4d0SZheng Fan if ( nIndex >= aGrfDataLst.Count() ) 706766ce4d0SZheng Fan return sal_False; 707766ce4d0SZheng Fan 708766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 709766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 710766ce4d0SZheng Fan return sal_False; 711766ce4d0SZheng Fan 712766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 713766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 714766ce4d0SZheng Fan const Graphic* pGrf = 0; 715766ce4d0SZheng Fan if ( pBrsh ) 716766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 717766ce4d0SZheng Fan else 718766ce4d0SZheng Fan return sal_False; 719766ce4d0SZheng Fan 720766ce4d0SZheng Fan String sEmpty; 721766ce4d0SZheng Fan if ( pGrf ) 722766ce4d0SZheng Fan { 723766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 724766ce4d0SZheng Fan //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); 725766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 726766ce4d0SZheng Fan if ( pGrfName ) 727766ce4d0SZheng Fan pEntry->sGrfName = *pGrfName; 728766ce4d0SZheng Fan //pEntry->sDescription = sEmpty; 729766ce4d0SZheng Fan pEntry->nGallaryIndex = (sal_uInt16)0xFFFF; 730766ce4d0SZheng Fan pEntry->bIsCustomized = sal_True; 731766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 732766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 733766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 734766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 735766ce4d0SZheng Fan pEntry->sDescription = aStrFromRES; 736766ce4d0SZheng Fan }else 737766ce4d0SZheng Fan { 738766ce4d0SZheng Fan return sal_False; 739766ce4d0SZheng Fan } 740766ce4d0SZheng Fan 741766ce4d0SZheng Fan return sal_True; 742766ce4d0SZheng Fan } 743766ce4d0SZheng Fan 7449fe9aa9aSPavel Janík sal_Bool GraphyicBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool /* isDefault */,sal_Bool /* isResetSize */) 745766ce4d0SZheng Fan { 746766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 747766ce4d0SZheng Fan // return sal_False; 748766ce4d0SZheng Fan 749766ce4d0SZheng Fan if ( nIndex >= aGrfDataLst.Count() ) 750766ce4d0SZheng Fan return sal_False; 751766ce4d0SZheng Fan 752766ce4d0SZheng Fan String sGrfName; 753766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 754766ce4d0SZheng Fan sGrfName= pEntry->sGrfName; 755766ce4d0SZheng Fan 756766ce4d0SZheng Fan sal_uInt16 nMask = 1; 757766ce4d0SZheng Fan String aEmptyStr; 758766ce4d0SZheng Fan sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; 759766ce4d0SZheng Fan String sNumCharFmtName = GetBulCharFmtName(); 760766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 761766ce4d0SZheng Fan { 762766ce4d0SZheng Fan if(mLevel & nMask) 763766ce4d0SZheng Fan { 764766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 765766ce4d0SZheng Fan aFmt.SetNumberingType(nSetNumberingType); 766766ce4d0SZheng Fan aFmt.SetPrefix( aEmptyStr ); 767766ce4d0SZheng Fan aFmt.SetSuffix( aEmptyStr ); 768766ce4d0SZheng Fan aFmt.SetCharFmtName( sNumCharFmtName ); 769766ce4d0SZheng Fan 770766ce4d0SZheng Fan Graphic aGraphic; 771766ce4d0SZheng Fan if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pEntry->nGallaryIndex, &aGraphic)) 772766ce4d0SZheng Fan { 773766ce4d0SZheng Fan Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); 774766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 775766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 776766ce4d0SZheng Fan SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); 777766ce4d0SZheng Fan aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); 778766ce4d0SZheng Fan } 779766ce4d0SZheng Fan else// if(pGrfName) 780766ce4d0SZheng Fan aFmt.SetGraphic( sGrfName ); 781766ce4d0SZheng Fan 782766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 783766ce4d0SZheng Fan } 784766ce4d0SZheng Fan nMask <<= 1 ; 785766ce4d0SZheng Fan } 786766ce4d0SZheng Fan 787766ce4d0SZheng Fan return sal_True; 788766ce4d0SZheng Fan } 7899fe9aa9aSPavel Janík String GraphyicBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool /* isDefault */) 790766ce4d0SZheng Fan { 791766ce4d0SZheng Fan String sRet; 792766ce4d0SZheng Fan sal_uInt16 nLength = 0; 793766ce4d0SZheng Fan nLength = aGrfDataLst.Count() ; 794766ce4d0SZheng Fan 795766ce4d0SZheng Fan if ( nIndex >= nLength ) 796766ce4d0SZheng Fan return sRet; 797766ce4d0SZheng Fan else 798766ce4d0SZheng Fan { 799766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 800766ce4d0SZheng Fan if ( pEntry ) 801766ce4d0SZheng Fan { 802766ce4d0SZheng Fan sRet = pEntry->sDescription; 803766ce4d0SZheng Fan }; 804766ce4d0SZheng Fan } 805766ce4d0SZheng Fan return sRet; 806766ce4d0SZheng Fan } 807766ce4d0SZheng Fan sal_Bool GraphyicBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) 808766ce4d0SZheng Fan { 809766ce4d0SZheng Fan sal_Bool bRet = sal_False; 810766ce4d0SZheng Fan 811766ce4d0SZheng Fan sal_uInt16 nLength = 0; 812766ce4d0SZheng Fan nLength = aGrfDataLst.Count() ; 813766ce4d0SZheng Fan 814766ce4d0SZheng Fan if ( nIndex >= nLength ) 815766ce4d0SZheng Fan return bRet; 816766ce4d0SZheng Fan else 817766ce4d0SZheng Fan { 818766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 819766ce4d0SZheng Fan if ( pEntry ) 820766ce4d0SZheng Fan { 821766ce4d0SZheng Fan bRet = pEntry->bIsCustomized; 822766ce4d0SZheng Fan }; 823766ce4d0SZheng Fan } 824766ce4d0SZheng Fan 825766ce4d0SZheng Fan return bRet; 826766ce4d0SZheng Fan } 827766ce4d0SZheng Fan String GraphyicBulletsTypeMgr::GetGrfName(sal_uInt16 nIndex) 828766ce4d0SZheng Fan { 829766ce4d0SZheng Fan String sRet; 830766ce4d0SZheng Fan if ( nIndex < aGrfDataLst.Count() ) 831766ce4d0SZheng Fan { 832766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) aGrfDataLst.GetObject(nIndex); 833766ce4d0SZheng Fan if ( pEntry ) 834766ce4d0SZheng Fan { 835766ce4d0SZheng Fan sRet = pEntry->sGrfName; 836766ce4d0SZheng Fan } 837766ce4d0SZheng Fan } 838766ce4d0SZheng Fan 839766ce4d0SZheng Fan return sRet; 840766ce4d0SZheng Fan } 841766ce4d0SZheng Fan /*************************************************************************************************** 842766ce4d0SZheng Fan **********************Mix Bullets Type lib************************************************************** 843766ce4d0SZheng Fan ****************************************************************************************************/ 844766ce4d0SZheng Fan MixBulletsTypeMgr* MixBulletsTypeMgr::_instance = 0; 845766ce4d0SZheng Fan MixBulletsSettings_Impl* MixBulletsTypeMgr::pActualBullets[] ={0,0,0,0,0,0,0,0}; 846766ce4d0SZheng Fan MixBulletsSettings_Impl* MixBulletsTypeMgr::pDefaultActualBullets[] ={0,0,0,0,0,0,0,0}; 847766ce4d0SZheng Fan 848766ce4d0SZheng Fan MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType): 849766ce4d0SZheng Fan NBOTypeMgrBase(aType) 850766ce4d0SZheng Fan { 851766ce4d0SZheng Fan Init(); 852766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) 853766ce4d0SZheng Fan { 854766ce4d0SZheng Fan pDefaultActualBullets[nItem] = pActualBullets[nItem]; 855766ce4d0SZheng Fan } 856766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 857766ce4d0SZheng Fan Init(); 858766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.sya")); 859766ce4d0SZheng Fan } 860766ce4d0SZheng Fan 861766ce4d0SZheng Fan MixBulletsTypeMgr::MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg): 862766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg) 863766ce4d0SZheng Fan { 864766ce4d0SZheng Fan Init(); 865766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_BULLET_TYPES; nItem++ ) 866766ce4d0SZheng Fan { 867766ce4d0SZheng Fan pDefaultActualBullets[nItem] = pActualBullets[nItem]; 868766ce4d0SZheng Fan } 869766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 870766ce4d0SZheng Fan Init(); 871766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.sya")); 872766ce4d0SZheng Fan } 873766ce4d0SZheng Fan 874766ce4d0SZheng Fan MixBulletsTypeMgr::MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr): 875766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr) 876766ce4d0SZheng Fan { 877766ce4d0SZheng Fan for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++) 878766ce4d0SZheng Fan { 879766ce4d0SZheng Fan if ( aTypeMgr.pActualBullets[i]->eType == eNBType::BULLETS ) 880766ce4d0SZheng Fan { 881766ce4d0SZheng Fan pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; 882766ce4d0SZheng Fan pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display 883766ce4d0SZheng Fan pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; 884766ce4d0SZheng Fan pActualBullets[i]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 885766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->cBulletChar; 886766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->aFont; 887766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->sDescription = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; 888766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->bIsCustomized = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; 889766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->eType = ((BulletsSettings_Impl*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; 890766ce4d0SZheng Fan }else if ( aTypeMgr.pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) 891766ce4d0SZheng Fan { 892766ce4d0SZheng Fan pActualBullets[i]->eType = aTypeMgr.pActualBullets[i]->eType; 893766ce4d0SZheng Fan pActualBullets[i]->nIndex = aTypeMgr.pActualBullets[i]->nIndex; //index in the tab page display 894766ce4d0SZheng Fan pActualBullets[i]->nIndexDefault = aTypeMgr.pActualBullets[i]->nIndexDefault; 895766ce4d0SZheng Fan pActualBullets[i]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 896766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sGrfName = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sGrfName; 897766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->sDescription = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->sDescription; 898766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->bIsCustomized = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized; 899766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->eType = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->eType; 900766ce4d0SZheng Fan if ( ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->bIsCustomized && ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj != NULL) 901766ce4d0SZheng Fan { 902766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[i]->pBullets))->pGrfObj = ((GrfBulDataRelation*)(aTypeMgr.pActualBullets[i]->pBullets))->pGrfObj; 903766ce4d0SZheng Fan } 904766ce4d0SZheng Fan } 905766ce4d0SZheng Fan } 906766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.sya")); 907766ce4d0SZheng Fan } 908766ce4d0SZheng Fan void MixBulletsTypeMgr::Init() 909766ce4d0SZheng Fan { 910766ce4d0SZheng Fan BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); 911766ce4d0SZheng Fan if ( pBTMgr ) 912766ce4d0SZheng Fan { 913766ce4d0SZheng Fan //Index 1 914766ce4d0SZheng Fan pActualBullets[0] = new MixBulletsSettings_Impl(eNBType::BULLETS); 915766ce4d0SZheng Fan pActualBullets[0]->eType = eNBType::BULLETS; 916766ce4d0SZheng Fan pActualBullets[0]->nIndex = 0+1; //index in the tab page display,decrease 1 to the index within arr 917766ce4d0SZheng Fan pActualBullets[0]->nIndexDefault = 2; //index in the tab page display,decrease 1 to the index within arr 918766ce4d0SZheng Fan pActualBullets[0]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 919766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[0]->nIndexDefault-1); 920766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[0]->nIndexDefault-1); 921766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[0]->nIndexDefault-1); 922766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[0]->nIndexDefault-1); 923766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[0]->pBullets))->eType = eNBType::BULLETS; 924766ce4d0SZheng Fan 925766ce4d0SZheng Fan //Index 2 926766ce4d0SZheng Fan pActualBullets[1] = new MixBulletsSettings_Impl(eNBType::BULLETS); 927766ce4d0SZheng Fan pActualBullets[1]->eType = eNBType::BULLETS; 928766ce4d0SZheng Fan pActualBullets[1]->nIndex = 1+1; //index in the tab page display,decrease 1 to the index within arr 929766ce4d0SZheng Fan pActualBullets[1]->nIndexDefault = 3; //index in the tab page display,decrease 1 to the index within arr 930766ce4d0SZheng Fan pActualBullets[1]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 931766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[1]->nIndexDefault-1); 932766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[1]->nIndexDefault-1); 933766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[1]->nIndexDefault-1); 934766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[1]->nIndexDefault-1); 935766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[1]->pBullets))->eType = eNBType::BULLETS; 936766ce4d0SZheng Fan 937766ce4d0SZheng Fan //Index 3 938766ce4d0SZheng Fan pActualBullets[2] = new MixBulletsSettings_Impl(eNBType::BULLETS); 939766ce4d0SZheng Fan pActualBullets[2]->eType = eNBType::BULLETS; 940766ce4d0SZheng Fan pActualBullets[2]->nIndex = 2+1; //index in the tab page display,decrease 1 to the index within arr 941766ce4d0SZheng Fan pActualBullets[2]->nIndexDefault = 4; //index in the tab page display,decrease 1 to the index within arr 942766ce4d0SZheng Fan pActualBullets[2]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 943766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[2]->nIndexDefault-1); 944766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[2]->nIndexDefault-1); 945766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[2]->nIndexDefault-1); 946766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[2]->nIndexDefault-1); 947766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[2]->pBullets))->eType = eNBType::BULLETS; 948766ce4d0SZheng Fan 949766ce4d0SZheng Fan //Index 4 950766ce4d0SZheng Fan pActualBullets[3] = new MixBulletsSettings_Impl(eNBType::BULLETS); 951766ce4d0SZheng Fan pActualBullets[3]->eType = eNBType::BULLETS; 952766ce4d0SZheng Fan pActualBullets[3]->nIndex = 3+1; //index in the tab page display,decrease 1 to the index within arr 953766ce4d0SZheng Fan pActualBullets[3]->nIndexDefault = 5; //index in the tab page display,decrease 1 to the index within arr 954766ce4d0SZheng Fan pActualBullets[3]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 955766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[3]->nIndexDefault-1); 956766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[3]->nIndexDefault-1); 957766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[3]->nIndexDefault-1); 958766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[3]->nIndexDefault-1); 959766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[3]->pBullets))->eType = eNBType::BULLETS; 960766ce4d0SZheng Fan 961766ce4d0SZheng Fan //Index 5 962766ce4d0SZheng Fan pActualBullets[4] = new MixBulletsSettings_Impl(eNBType::BULLETS); 963766ce4d0SZheng Fan pActualBullets[4]->eType = eNBType::BULLETS; 964766ce4d0SZheng Fan pActualBullets[4]->nIndex = 4+1; //index in the tab page display,decrease 1 to the index within arr 965766ce4d0SZheng Fan pActualBullets[4]->nIndexDefault = 6; //index in the tab page display,decrease 1 to the index within arr 966766ce4d0SZheng Fan pActualBullets[4]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 967766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[4]->nIndexDefault-1); 968766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[4]->nIndexDefault-1); 969766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[4]->nIndexDefault-1); 970766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[4]->nIndexDefault-1); 971766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[4]->pBullets))->eType = eNBType::BULLETS; 972766ce4d0SZheng Fan 973766ce4d0SZheng Fan //Index 6 974766ce4d0SZheng Fan pActualBullets[5] = new MixBulletsSettings_Impl(eNBType::BULLETS); 975766ce4d0SZheng Fan pActualBullets[5]->eType = eNBType::BULLETS; 976766ce4d0SZheng Fan pActualBullets[5]->nIndex = 5+1; //index in the tab page display,decrease 1 to the index within arr 977766ce4d0SZheng Fan pActualBullets[5]->nIndexDefault = 8; //index in the tab page display,decrease 1 to the index within arr 978766ce4d0SZheng Fan pActualBullets[5]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 979766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->cBulletChar = pBTMgr->GetBulChar(pActualBullets[5]->nIndexDefault-1); 980766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->aFont = pBTMgr->GetBulCharFont(pActualBullets[5]->nIndexDefault-1); 981766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->sDescription = pBTMgr->GetDescription(pActualBullets[5]->nIndexDefault-1); 982766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->bIsCustomized = pBTMgr->IsCustomized(pActualBullets[5]->nIndexDefault-1); 983766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[5]->pBullets))->eType = eNBType::BULLETS; 984766ce4d0SZheng Fan } 985766ce4d0SZheng Fan 986766ce4d0SZheng Fan GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); 987766ce4d0SZheng Fan if ( mGrfTMgr ) 988766ce4d0SZheng Fan { 989766ce4d0SZheng Fan //Index 7 990766ce4d0SZheng Fan pActualBullets[6] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); 991766ce4d0SZheng Fan pActualBullets[6]->eType = eNBType::GRAPHICBULLETS; 992766ce4d0SZheng Fan pActualBullets[6]->nIndex = 6+1; //index in the tab page display,decrease 1 to the index within arr 993766ce4d0SZheng Fan pActualBullets[6]->nIndexDefault = 9; //index in the tab page display,decrease 1 to the index within arr 994766ce4d0SZheng Fan pActualBullets[6]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 995766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[6]->nIndexDefault); 996766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[6]->nIndexDefault); 997766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[6]->nIndexDefault); 998766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[6]->pBullets))->eType = eNBType::GRAPHICBULLETS; 999766ce4d0SZheng Fan 1000766ce4d0SZheng Fan //Index 8 1001766ce4d0SZheng Fan pActualBullets[7] = new MixBulletsSettings_Impl(eNBType::GRAPHICBULLETS); 1002766ce4d0SZheng Fan pActualBullets[7]->eType = eNBType::GRAPHICBULLETS; 1003766ce4d0SZheng Fan pActualBullets[7]->nIndex = 7+1; //index in the tab page display,decrease 1 to the index within arr 1004766ce4d0SZheng Fan pActualBullets[7]->nIndexDefault = 23; //index in the tab page display,decrease 1 to the index within arr 1005766ce4d0SZheng Fan pActualBullets[7]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 1006766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sGrfName = mGrfTMgr->GetGrfName(pActualBullets[7]->nIndexDefault); 1007766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->sDescription = mGrfTMgr->GetDescription(pActualBullets[7]->nIndexDefault); 1008766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->bIsCustomized = mGrfTMgr->IsCustomized(pActualBullets[7]->nIndexDefault); 1009766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[7]->pBullets))->eType = eNBType::GRAPHICBULLETS; 1010766ce4d0SZheng Fan } 1011766ce4d0SZheng Fan 1012766ce4d0SZheng Fan } 1013766ce4d0SZheng Fan sal_uInt16 MixBulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 1014766ce4d0SZheng Fan { 1015766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 1016766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1017766ce4d0SZheng Fan //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; 1018766ce4d0SZheng Fan 1019766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1020766ce4d0SZheng Fan 1021766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1022766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1023766ce4d0SZheng Fan 1024766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1025766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1026766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL) 1027766ce4d0SZheng Fan { 1028766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1029766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1030766ce4d0SZheng Fan String sName = pFont?pFont->GetName():String(); 1031766ce4d0SZheng Fan 1032766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) 1033766ce4d0SZheng Fan { 1034766ce4d0SZheng Fan if ( pActualBullets[i]->eType == eNBType::BULLETS ) 1035766ce4d0SZheng Fan { 1036766ce4d0SZheng Fan String ssName = ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName(); 1037766ce4d0SZheng Fan if ( (cChar == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar|| 1038766ce4d0SZheng Fan (cChar == 9830 && 57356 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar) || 1039766ce4d0SZheng Fan (cChar == 9632 && 57354 == ((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->cBulletChar)))//&& 1040766ce4d0SZheng Fan //(pFont && pFont->GetName().CompareTo(((BulletsSettings_Impl*)(pActualBullets[i]->pBullets))->aFont.GetName())==COMPARE_EQUAL) ) 1041766ce4d0SZheng Fan { 1042766ce4d0SZheng Fan return pActualBullets[i]->nIndex; 1043766ce4d0SZheng Fan } 1044766ce4d0SZheng Fan } 1045766ce4d0SZheng Fan } 1046766ce4d0SZheng Fan }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) 1047766ce4d0SZheng Fan { 1048766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 1049766ce4d0SZheng Fan const Graphic* pGrf = 0; 1050766ce4d0SZheng Fan if ( pBrsh ) 1051766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 1052766ce4d0SZheng Fan 1053766ce4d0SZheng Fan if ( pGrf ) 1054766ce4d0SZheng Fan { 1055766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) 1056766ce4d0SZheng Fan { 1057766ce4d0SZheng Fan if ( pActualBullets[i]->eType == eNBType::GRAPHICBULLETS ) 1058766ce4d0SZheng Fan { 1059766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[i]->pBullets); 1060766ce4d0SZheng Fan //sal_Bool bExist = sal_False; 1061766ce4d0SZheng Fan if ( pEntry && pActualBullets[i]->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj) 1062766ce4d0SZheng Fan { 1063766ce4d0SZheng Fan if ( pEntry->pGrfObj->GetBitmap().IsEqual(pGrf->GetBitmap())) 1064766ce4d0SZheng Fan { 1065766ce4d0SZheng Fan return pActualBullets[i]->nIndex; 1066766ce4d0SZheng Fan } 1067766ce4d0SZheng Fan }else { //if ( pEntry && pGrfName && pEntry->sGrfName.CompareTo(*pGrfName)==COMPARE_EQUAL ) 1068766ce4d0SZheng Fan //bExist = GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault-1,pSrGrf); 1069766ce4d0SZheng Fan Graphic aSrGrf; 1070766ce4d0SZheng Fan if (pEntry) 1071766ce4d0SZheng Fan GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, pActualBullets[i]->nIndexDefault,&aSrGrf); 1072766ce4d0SZheng Fan Bitmap aSum=pGrf->GetBitmap(); 1073766ce4d0SZheng Fan Bitmap aSum1=aSrGrf.GetBitmap(); 1074766ce4d0SZheng Fan if (aSum.IsEqual(aSum1)) 1075766ce4d0SZheng Fan return pActualBullets[i]->nIndex; 1076766ce4d0SZheng Fan } 1077766ce4d0SZheng Fan } 1078766ce4d0SZheng Fan } 1079766ce4d0SZheng Fan } 1080766ce4d0SZheng Fan } 1081766ce4d0SZheng Fan 1082766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1083766ce4d0SZheng Fan } 1084766ce4d0SZheng Fan 1085766ce4d0SZheng Fan sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 1086766ce4d0SZheng Fan { 1087766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0 || nIndex>=DEFAULT_BULLET_TYPES) 1088766ce4d0SZheng Fan return sal_False; 1089766ce4d0SZheng Fan 1090766ce4d0SZheng Fan //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 1091766ce4d0SZheng Fan // return sal_False; 1092766ce4d0SZheng Fan 1093766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1094766ce4d0SZheng Fan 1095766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1096766ce4d0SZheng Fan return sal_False; 1097766ce4d0SZheng Fan 1098766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1099766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1100766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL && pActualBullets[nIndex]->eType == eNBType::BULLETS ) 1101766ce4d0SZheng Fan { 1102766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1103766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1104766ce4d0SZheng Fan BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); 1105766ce4d0SZheng Fan pEntry->cBulletChar = cChar; 1106766ce4d0SZheng Fan pEntry->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); 1107766ce4d0SZheng Fan pEntry->bIsCustomized = sal_True; 1108766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1109766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1110766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1111766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1112766ce4d0SZheng Fan pEntry->sDescription = aStrFromRES; 1113766ce4d0SZheng Fan 1114766ce4d0SZheng Fan }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP && pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS ) 1115766ce4d0SZheng Fan { 1116766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 1117766ce4d0SZheng Fan const Graphic* pGrf = 0; 1118766ce4d0SZheng Fan if ( pBrsh ) 1119766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 1120766ce4d0SZheng Fan else 1121766ce4d0SZheng Fan return sal_False; 1122766ce4d0SZheng Fan 1123766ce4d0SZheng Fan String sEmpty; 1124766ce4d0SZheng Fan if ( pGrf ) 1125766ce4d0SZheng Fan { 1126766ce4d0SZheng Fan const String* pGrfName = pBrsh->GetGraphicLink(); 1127766ce4d0SZheng Fan //String* pGrfName = (String*)(pBrsh->GetGraphicLink()); 1128766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); 1129766ce4d0SZheng Fan if ( pGrfName ) 1130766ce4d0SZheng Fan pEntry->sGrfName = *pGrfName; 1131766ce4d0SZheng Fan GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); 1132766ce4d0SZheng Fan if ( mGrfTMgr ) 1133766ce4d0SZheng Fan { 1134766ce4d0SZheng Fan //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1135766ce4d0SZheng Fan //if ( nDIndex != (sal_uInt16)0xFFFF) 1136766ce4d0SZheng Fan //{ 1137766ce4d0SZheng Fan // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; 1138766ce4d0SZheng Fan // sEmpty = mGrfTMgr->GetDescription( nDIndex -1); 1139766ce4d0SZheng Fan //}else 1140766ce4d0SZheng Fan { 1141766ce4d0SZheng Fan pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; 1142766ce4d0SZheng Fan sEmpty = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1143766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1144766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1145766ce4d0SZheng Fan sEmpty.SearchAndReplace(aReplace,sNUM); 1146766ce4d0SZheng Fan //pEntry->pGrfObj = pGrf; 1147766ce4d0SZheng Fan pEntry->pGrfObj = new Graphic(*pGrf); 1148766ce4d0SZheng Fan pEntry->aSize = aFmt.GetGraphicSize(); 1149766ce4d0SZheng Fan pEntry->aSize = OutputDevice::LogicToLogic(pEntry->aSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); 1150766ce4d0SZheng Fan sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1151766ce4d0SZheng Fan if (nDIndex!=(sal_uInt16)0xFFFF) pEntry->aSize=Size(0,0); 1152766ce4d0SZheng Fan } 1153766ce4d0SZheng Fan } 1154766ce4d0SZheng Fan pEntry->sDescription = sEmpty; 1155766ce4d0SZheng Fan pEntry->bIsCustomized = sal_True; 1156766ce4d0SZheng Fan }else 1157766ce4d0SZheng Fan { 1158766ce4d0SZheng Fan return sal_False; 1159766ce4d0SZheng Fan } 1160766ce4d0SZheng Fan }else 1161766ce4d0SZheng Fan { 1162766ce4d0SZheng Fan delete pActualBullets[nIndex]->pBullets; 1163766ce4d0SZheng Fan pActualBullets[nIndex]->pBullets = 0; 1164766ce4d0SZheng Fan if ( eNumType == SVX_NUM_CHAR_SPECIAL ) 1165766ce4d0SZheng Fan { 1166766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1167766ce4d0SZheng Fan const Font* pFont = aFmt.GetBulletFont(); 1168766ce4d0SZheng Fan pActualBullets[nIndex]->eType = eNBType::BULLETS; 1169766ce4d0SZheng Fan pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr 1170766ce4d0SZheng Fan pActualBullets[nIndex]->pBullets = new BulletsSettings_Impl(eNBType::BULLETS) ; 1171766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->cBulletChar = cChar; 1172766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->aFont = pFont?*pFont:lcl_GetDefaultBulletFont(); 1173766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; 1174766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::BULLETS; 1175766ce4d0SZheng Fan BulletsTypeMgr* pBTMgr = BulletsTypeMgr::GetInstance(); 1176766ce4d0SZheng Fan if ( pBTMgr ) 1177766ce4d0SZheng Fan { 1178766ce4d0SZheng Fan //sal_uInt16 nDIndex = pBTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1179766ce4d0SZheng Fan //if ( nDIndex != (sal_uInt16)0xFFFF) 1180766ce4d0SZheng Fan //{ 1181766ce4d0SZheng Fan // pActualBullets[nIndex]->nIndexDefault = nDIndex -1; 1182766ce4d0SZheng Fan // ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = pBTMgr->GetDescription(nDIndex - 1); 1183766ce4d0SZheng Fan //}else 1184766ce4d0SZheng Fan { 1185766ce4d0SZheng Fan pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; 1186766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1187766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1188766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1189766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1190766ce4d0SZheng Fan ((BulletsSettings_Impl*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; 1191766ce4d0SZheng Fan } 1192766ce4d0SZheng Fan } 1193766ce4d0SZheng Fan }else if ( (eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) 1194766ce4d0SZheng Fan { 1195766ce4d0SZheng Fan const SvxBrushItem* pBrsh = aFmt.GetBrush(); 1196766ce4d0SZheng Fan const Graphic* pGrf = 0; 1197766ce4d0SZheng Fan if ( pBrsh ) 1198766ce4d0SZheng Fan pGrf = pBrsh->GetGraphic(); 1199766ce4d0SZheng Fan else 1200766ce4d0SZheng Fan return sal_False; 1201766ce4d0SZheng Fan 1202766ce4d0SZheng Fan String sEmpty; 1203766ce4d0SZheng Fan const String* pGrfName = 0; 1204766ce4d0SZheng Fan if ( pGrf ) 1205766ce4d0SZheng Fan { 1206766ce4d0SZheng Fan pGrfName = pBrsh->GetGraphicLink(); 1207766ce4d0SZheng Fan 1208766ce4d0SZheng Fan pActualBullets[nIndex]->eType = eNBType::GRAPHICBULLETS; 1209766ce4d0SZheng Fan pActualBullets[nIndex]->nIndex = nIndex+1; //index in the tab page display,decrease 1 to the index within arr 1210766ce4d0SZheng Fan pActualBullets[nIndex]->pBullets = new GrfBulDataRelation(eNBType::GRAPHICBULLETS) ; 1211766ce4d0SZheng Fan if (pGrfName) 1212766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sGrfName = *pGrfName; 1213766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->bIsCustomized = sal_True; 1214766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->eType = eNBType::GRAPHICBULLETS; 1215766ce4d0SZheng Fan GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance(); 1216766ce4d0SZheng Fan if ( mGrfTMgr ) 1217766ce4d0SZheng Fan { 1218766ce4d0SZheng Fan //sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1219766ce4d0SZheng Fan //if ( nDIndex != (sal_uInt16)0xFFFF) 1220766ce4d0SZheng Fan //{ 1221766ce4d0SZheng Fan // pActualBullets[nIndex]->nIndexDefault = nDIndex - 1; 1222766ce4d0SZheng Fan // ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = mGrfTMgr->GetDescription(nDIndex - 1); 1223766ce4d0SZheng Fan //}else 1224766ce4d0SZheng Fan { 1225766ce4d0SZheng Fan pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF; 1226766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION)); 1227766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1228766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1229766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1230766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->sDescription = aStrFromRES; 1231766ce4d0SZheng Fan //((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = pGrf; 1232766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); 1233766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->pGrfObj = new Graphic(*pGrf); 1234766ce4d0SZheng Fan Size aTmpSize = aFmt.GetGraphicSize(); 1235766ce4d0SZheng Fan aTmpSize = OutputDevice::LogicToLogic(aTmpSize,(MapUnit)GetMapUnit(),MAP_100TH_MM); 1236766ce4d0SZheng Fan sal_uInt16 nDIndex = mGrfTMgr->GetNBOIndexForNumRule(aNum,mLevel); 1237766ce4d0SZheng Fan if (nDIndex!=(sal_uInt16)0xFFFF) aTmpSize=Size(0,0); 1238766ce4d0SZheng Fan ((GrfBulDataRelation*)(pActualBullets[nIndex]->pBullets))->aSize = aTmpSize; 1239766ce4d0SZheng Fan 1240766ce4d0SZheng Fan } 1241766ce4d0SZheng Fan } 1242766ce4d0SZheng Fan } 1243766ce4d0SZheng Fan } 1244766ce4d0SZheng Fan } 1245766ce4d0SZheng Fan SvxNumRule aTmpRule1(aNum); 1246766ce4d0SZheng Fan ApplyNumRule(aTmpRule1,nIndex,mLevel,true); 1247766ce4d0SZheng Fan if (GetNBOIndexForNumRule(aTmpRule1,mLevel,nIndex)==nIndex+1) { 1248766ce4d0SZheng Fan if (pActualBullets[nIndex]->eType == eNBType::BULLETS) { 1249766ce4d0SZheng Fan BulletsSettings_Impl* pEntry = (BulletsSettings_Impl*) (pActualBullets[nIndex]->pBullets); 1250766ce4d0SZheng Fan pEntry->bIsCustomized = false; 1251766ce4d0SZheng Fan pEntry->sDescription = GetDescription(nIndex,true); 1252766ce4d0SZheng Fan } 1253766ce4d0SZheng Fan if (pActualBullets[nIndex]->eType == eNBType::GRAPHICBULLETS) { 1254766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets); 1255766ce4d0SZheng Fan pEntry->bIsCustomized = false; 1256766ce4d0SZheng Fan pEntry->sDescription = GetDescription(nIndex,true); 1257766ce4d0SZheng Fan } 1258766ce4d0SZheng Fan } 1259766ce4d0SZheng Fan ImplStore(String::CreateFromAscii("standard.sya")); 1260766ce4d0SZheng Fan return sal_True; 1261766ce4d0SZheng Fan } 1262766ce4d0SZheng Fan 1263766ce4d0SZheng Fan sal_Bool MixBulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 1264766ce4d0SZheng Fan { 1265766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF || nIndex>=DEFAULT_BULLET_TYPES ) 1266766ce4d0SZheng Fan if ( nIndex>=DEFAULT_BULLET_TYPES ) 1267766ce4d0SZheng Fan return sal_False; 1268766ce4d0SZheng Fan MixBulletsSettings_Impl* pCurrentBullets = pActualBullets[nIndex]; 1269766ce4d0SZheng Fan if (isDefault) pCurrentBullets=pDefaultActualBullets[nIndex]; 1270766ce4d0SZheng Fan 1271766ce4d0SZheng Fan if ( pCurrentBullets->eType == eNBType::BULLETS ) 1272766ce4d0SZheng Fan { 1273766ce4d0SZheng Fan sal_Unicode cChar; 1274766ce4d0SZheng Fan cChar = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->cBulletChar; 1275766ce4d0SZheng Fan 1276766ce4d0SZheng Fan //Font& rActBulletFont = lcl_GetDefaultBulletFont(); 1277766ce4d0SZheng Fan Font rActBulletFont = ((BulletsSettings_Impl*)(pCurrentBullets->pBullets))->aFont; 1278766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1279766ce4d0SZheng Fan String sBulletCharFmtName = GetBulCharFmtName(); 1280766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1281766ce4d0SZheng Fan { 1282766ce4d0SZheng Fan if(mLevel & nMask) 1283766ce4d0SZheng Fan { 1284766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1285766ce4d0SZheng Fan if (SVX_NUM_CHAR_SPECIAL !=aFmt.GetNumberingType()) isResetSize=true; 1286766ce4d0SZheng Fan aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); 1287766ce4d0SZheng Fan aFmt.SetBulletFont(&rActBulletFont); 1288766ce4d0SZheng Fan aFmt.SetBulletChar(cChar ); 12891ff378efSZheng Fan aFmt.SetCharFmtName(sBulletCharFmtName); 1290766ce4d0SZheng Fan String aEmptyStr; 1291766ce4d0SZheng Fan aFmt.SetPrefix( aEmptyStr ); 1292766ce4d0SZheng Fan aFmt.SetSuffix( aEmptyStr ); 1293766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(45); 1294766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 1295766ce4d0SZheng Fan } 1296766ce4d0SZheng Fan nMask <<= 1; 1297766ce4d0SZheng Fan } 1298766ce4d0SZheng Fan }else if ( pCurrentBullets->eType == eNBType::GRAPHICBULLETS ) 1299766ce4d0SZheng Fan { 1300766ce4d0SZheng Fan String sGrfName; 1301766ce4d0SZheng Fan GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pCurrentBullets->pBullets); 1302766ce4d0SZheng Fan sGrfName= pEntry->sGrfName; 1303766ce4d0SZheng Fan 1304766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1305766ce4d0SZheng Fan String aEmptyStr; 1306766ce4d0SZheng Fan sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; 1307766ce4d0SZheng Fan String sNumCharFmtName = GetBulCharFmtName(); 1308766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1309766ce4d0SZheng Fan { 1310766ce4d0SZheng Fan if(mLevel & nMask) 1311766ce4d0SZheng Fan { 1312766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1313766ce4d0SZheng Fan if (SVX_NUM_BITMAP !=aFmt.GetNumberingType()) isResetSize=true; 1314766ce4d0SZheng Fan aFmt.SetNumberingType(nSetNumberingType); 1315766ce4d0SZheng Fan aFmt.SetPrefix( aEmptyStr ); 1316766ce4d0SZheng Fan aFmt.SetSuffix( aEmptyStr ); 1317766ce4d0SZheng Fan aFmt.SetCharFmtName( sNumCharFmtName ); 1318766ce4d0SZheng Fan if ( pCurrentBullets->nIndexDefault == (sal_uInt16)0xFFFF && pEntry->pGrfObj ) 1319766ce4d0SZheng Fan { 1320766ce4d0SZheng Fan Size aSize = pEntry->aSize; 1321766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 1322766ce4d0SZheng Fan if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); 1323766ce4d0SZheng Fan else { 1324766ce4d0SZheng Fan if (aSize.Width()==0 && aSize.Height()==0) { 1325766ce4d0SZheng Fan aSize = SvxNumberFormat::GetGraphicSizeMM100( pEntry->pGrfObj ); 1326766ce4d0SZheng Fan } 1327766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 1328766ce4d0SZheng Fan } 1329766ce4d0SZheng Fan SvxBrushItem aBrush(*(pEntry->pGrfObj), GPOS_AREA, SID_ATTR_BRUSH ); 1330766ce4d0SZheng Fan aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); 1331766ce4d0SZheng Fan }else 1332766ce4d0SZheng Fan { 1333766ce4d0SZheng Fan Graphic aGraphic; 1334766ce4d0SZheng Fan if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, pCurrentBullets->nIndexDefault, &aGraphic)) 1335766ce4d0SZheng Fan { 1336766ce4d0SZheng Fan Size aSize = pEntry->aSize; 1337766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 1338766ce4d0SZheng Fan if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); 1339766ce4d0SZheng Fan else { 1340766ce4d0SZheng Fan if (aSize.Width()==0 && aSize.Height()==0) { 1341766ce4d0SZheng Fan aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); 1342766ce4d0SZheng Fan } 1343766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 1344766ce4d0SZheng Fan } 1345766ce4d0SZheng Fan SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); 1346766ce4d0SZheng Fan aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); 1347766ce4d0SZheng Fan }else 1348766ce4d0SZheng Fan aFmt.SetGraphic( sGrfName ); 1349766ce4d0SZheng Fan } 1350766ce4d0SZheng Fan 1351766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 1352766ce4d0SZheng Fan } 1353766ce4d0SZheng Fan nMask <<= 1 ; 1354766ce4d0SZheng Fan } 1355766ce4d0SZheng Fan } 1356766ce4d0SZheng Fan 1357766ce4d0SZheng Fan return sal_True; 1358766ce4d0SZheng Fan } 1359766ce4d0SZheng Fan 1360766ce4d0SZheng Fan String MixBulletsTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 1361766ce4d0SZheng Fan { 1362766ce4d0SZheng Fan String sRet; 1363766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 1364766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 1365766ce4d0SZheng Fan 1366766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 1367766ce4d0SZheng Fan return sRet; 1368766ce4d0SZheng Fan else 1369766ce4d0SZheng Fan sRet = pActualBullets[nIndex]->pBullets->sDescription; 1370766ce4d0SZheng Fan if (isDefault) sRet = pDefaultActualBullets[nIndex]->pBullets->sDescription; 1371766ce4d0SZheng Fan return sRet; 1372766ce4d0SZheng Fan } 1373766ce4d0SZheng Fan sal_Bool MixBulletsTypeMgr::IsCustomized(sal_uInt16 nIndex) 1374766ce4d0SZheng Fan { 1375766ce4d0SZheng Fan sal_Bool bRet = sal_False; 1376766ce4d0SZheng Fan //sal_uInt16 nLength = 0; 1377766ce4d0SZheng Fan //nLength = sizeof(pActualBullets)/sizeof(BulletsSettings_Impl); 1378766ce4d0SZheng Fan 1379766ce4d0SZheng Fan if ( nIndex >= DEFAULT_BULLET_TYPES ) 1380766ce4d0SZheng Fan bRet = sal_False; 1381766ce4d0SZheng Fan else 1382766ce4d0SZheng Fan bRet = pActualBullets[nIndex]->pBullets->bIsCustomized; 1383766ce4d0SZheng Fan 1384766ce4d0SZheng Fan return bRet; 1385766ce4d0SZheng Fan } 1386766ce4d0SZheng Fan /*************************************************************************************************** 1387766ce4d0SZheng Fan **********************Numbering Type lib************************************************************** 1388766ce4d0SZheng Fan ****************************************************************************************************/ 1389766ce4d0SZheng Fan NumberingTypeMgr* NumberingTypeMgr::_instance = 0; 1390766ce4d0SZheng Fan 1391766ce4d0SZheng Fan NumberingTypeMgr::NumberingTypeMgr(const NBOType aType): 1392766ce4d0SZheng Fan NBOTypeMgrBase(aType), 1393766ce4d0SZheng Fan //pNumSettingsArr( new NumSettingsArr_Impl ), 1394766ce4d0SZheng Fan pNumberSettingsArr (new NumberSettingsArr_Impl) 1395766ce4d0SZheng Fan { 1396766ce4d0SZheng Fan Init(); 1397766ce4d0SZheng Fan pDefaultNumberSettingsArr = pNumberSettingsArr; 1398766ce4d0SZheng Fan pNumberSettingsArr = new NumberSettingsArr_Impl; 1399766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1400766ce4d0SZheng Fan Init(); 1401766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syb")); 1402766ce4d0SZheng Fan } 1403766ce4d0SZheng Fan 1404766ce4d0SZheng Fan NumberingTypeMgr::NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg): 1405766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg), 1406766ce4d0SZheng Fan //pNumSettingsArr( new NumSettingsArr_Impl ), 1407766ce4d0SZheng Fan pNumberSettingsArr (new NumberSettingsArr_Impl) 1408766ce4d0SZheng Fan { 1409766ce4d0SZheng Fan Init(); 1410766ce4d0SZheng Fan pDefaultNumberSettingsArr = pNumberSettingsArr; 1411766ce4d0SZheng Fan pNumberSettingsArr = new NumberSettingsArr_Impl; 1412766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1413766ce4d0SZheng Fan Init(); 1414766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syb")); 1415766ce4d0SZheng Fan } 1416766ce4d0SZheng Fan 1417766ce4d0SZheng Fan NumberingTypeMgr::NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr): 1418766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr), 1419766ce4d0SZheng Fan //pNumSettingsArr( new NumSettingsArr_Impl ), 1420766ce4d0SZheng Fan pNumberSettingsArr (new NumberSettingsArr_Impl) 1421766ce4d0SZheng Fan { 1422766ce4d0SZheng Fan /* 1423766ce4d0SZheng Fan for(sal_uInt16 i=0;i<aTypeMgr.GetNumCount();i++) 1424766ce4d0SZheng Fan { 1425766ce4d0SZheng Fan NumberSettings_Impl* _pSet = aTypeMgr.GetNumSettingByIndex(i); 1426766ce4d0SZheng Fan if ( _pSet ) 1427766ce4d0SZheng Fan { 1428766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->nIndex = _pSet->nIndex; 1429766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->nIndexDefault = _pSet->nIndexDefault; 1430766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->sDescription = _pSet->sDescription; 1431766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->bIsCustomized = _pSet->bIsCustomized; 1432766ce4d0SZheng Fan if ( _pSet->pNumSetting ) 1433766ce4d0SZheng Fan { 1434766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nNumberType = _pSet->pNumSetting->nNumberType; 1435766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nParentNumbering = _pSet->pNumSetting->nParentNumbering; 1436766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sPrefix = _pSet->pNumSetting->sPrefix; 1437766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sSuffix = _pSet->pNumSetting->sSuffix; 1438766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletChar = _pSet->pNumSetting->sBulletChar; 1439766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->sBulletFont = _pSet->pNumSetting->sBulletFont; 1440766ce4d0SZheng Fan 1441766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->eLabelFollowedBy = _pSet->pNumSetting->eLabelFollowedBy; 1442766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nTabValue = _pSet->pNumSetting->nTabValue; 1443766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->eNumAlign = _pSet->pNumSetting->eNumAlign; 1444766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nNumAlignAt = _pSet->pNumSetting->nNumAlignAt; 1445766ce4d0SZheng Fan pNumberSettingsArr->GetObject(i)->pNumSetting->nNumIndentAt = _pSet->pNumSetting->nNumIndentAt; 1446766ce4d0SZheng Fan } 1447766ce4d0SZheng Fan } 1448766ce4d0SZheng Fan } 1449766ce4d0SZheng Fan */ 1450766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syb")); 1451766ce4d0SZheng Fan } 1452766ce4d0SZheng Fan 1453766ce4d0SZheng Fan void NumberingTypeMgr::Init() 1454766ce4d0SZheng Fan { 1455766ce4d0SZheng Fan Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); 1456766ce4d0SZheng Fan Reference < XInterface > xI = xMSF->createInstance( 1457766ce4d0SZheng Fan ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); 1458766ce4d0SZheng Fan Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); 1459766ce4d0SZheng Fan 1460766ce4d0SZheng Fan if(xDefNum.is()) 1461766ce4d0SZheng Fan { 1462766ce4d0SZheng Fan Sequence< Sequence< PropertyValue > > aNumberings; 1463766ce4d0SZheng Fan LanguageType eLang = Application::GetSettings().GetLanguage(); 1464766ce4d0SZheng Fan Locale aLocale = SvxCreateLocale(eLang); 1465766ce4d0SZheng Fan try 1466766ce4d0SZheng Fan { 1467766ce4d0SZheng Fan aNumberings = xDefNum->getDefaultContinuousNumberingLevels( aLocale ); 1468766ce4d0SZheng Fan 1469766ce4d0SZheng Fan sal_Int32 nLength = aNumberings.getLength() > DEFAULT_NUM_VALUSET_COUNT ? DEFAULT_NUM_VALUSET_COUNT :aNumberings.getLength(); 1470766ce4d0SZheng Fan 1471766ce4d0SZheng Fan const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray(); 1472766ce4d0SZheng Fan for(sal_Int32 i = 0; i < nLength; i++) 1473766ce4d0SZheng Fan { 1474766ce4d0SZheng Fan NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(pValuesArr[i]); 1475766ce4d0SZheng Fan NumberSettings_Impl* pNumEntry = new NumberSettings_Impl; 1476766ce4d0SZheng Fan pNumEntry->nIndex = i + 1; 1477766ce4d0SZheng Fan pNumEntry->nIndexDefault = i; 1478766ce4d0SZheng Fan pNumEntry->pNumSetting = pNew; 1479766ce4d0SZheng Fan //SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i )); 1480766ce4d0SZheng Fan { 1481766ce4d0SZheng Fan String sText; 1482766ce4d0SZheng Fan //const OUString sValue(C2U("Value")); 1483766ce4d0SZheng Fan Reference<XNumberingFormatter> xFormatter(xDefNum, UNO_QUERY); 1484766ce4d0SZheng Fan if(xFormatter.is() && aNumberings.getLength() > i) 1485766ce4d0SZheng Fan { 1486766ce4d0SZheng Fan 1487766ce4d0SZheng Fan for (sal_uInt16 j=0;j<3;j++) 1488766ce4d0SZheng Fan { 1489766ce4d0SZheng Fan Sequence<PropertyValue> aLevel = aNumberings.getConstArray()[i]; 1490766ce4d0SZheng Fan try 1491766ce4d0SZheng Fan { 1492766ce4d0SZheng Fan aLevel.realloc(aLevel.getLength() + 1); 1493766ce4d0SZheng Fan PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1]; 1494766ce4d0SZheng Fan rValue.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value")); 1495766ce4d0SZheng Fan rValue.Value <<= (sal_Int32)(j + 1); 1496766ce4d0SZheng Fan 1497766ce4d0SZheng Fan if (j!=0) 1498766ce4d0SZheng Fan sText += String::CreateFromAscii(" "); 1499766ce4d0SZheng Fan 1500766ce4d0SZheng Fan sText+=String(xFormatter->makeNumberingString( aLevel, aLocale )); 1501766ce4d0SZheng Fan } 1502766ce4d0SZheng Fan catch(Exception&) 1503766ce4d0SZheng Fan { 1504766ce4d0SZheng Fan DBG_ERROR("Exception in DefaultNumberingProvider::makeNumberingString"); 1505766ce4d0SZheng Fan } 1506766ce4d0SZheng Fan } 1507766ce4d0SZheng Fan } 1508766ce4d0SZheng Fan String aStrFromRES(SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS)); 1509766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%NUMBERINGSAMPLE"); 1510766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sText); 1511766ce4d0SZheng Fan pNumEntry->sDescription = aStrFromRES; 1512766ce4d0SZheng Fan } 1513766ce4d0SZheng Fan //End modification 1514766ce4d0SZheng Fan 1515766ce4d0SZheng Fan //pNumEntry->sDescription = SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTION_0 + i ); 1516766ce4d0SZheng Fan pNumberSettingsArr->Insert(pNumEntry, pNumberSettingsArr->Count()); 1517766ce4d0SZheng Fan } 1518766ce4d0SZheng Fan } 1519766ce4d0SZheng Fan catch(Exception&) 1520766ce4d0SZheng Fan { 1521766ce4d0SZheng Fan } 1522766ce4d0SZheng Fan } 1523766ce4d0SZheng Fan } 1524766ce4d0SZheng Fan 1525766ce4d0SZheng Fan sal_uInt16 NumberingTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) 1526766ce4d0SZheng Fan { 1527766ce4d0SZheng Fan if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) 1528766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1529766ce4d0SZheng Fan 1530766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1531766ce4d0SZheng Fan 1532766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1533766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1534766ce4d0SZheng Fan 1535766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1536766ce4d0SZheng Fan String sPreFix = aFmt.GetPrefix(); 1537766ce4d0SZheng Fan String sSuffix = aFmt.GetSuffix(); 1538766ce4d0SZheng Fan String sEmpty; 1539766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1540766ce4d0SZheng Fan 1541766ce4d0SZheng Fan sal_uInt16 nCount = pNumberSettingsArr->Count(); 1542766ce4d0SZheng Fan for(sal_uInt16 i = nFromIndex; i < nCount; i++) 1543766ce4d0SZheng Fan { 1544766ce4d0SZheng Fan NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(i); 1545766ce4d0SZheng Fan sal_Int16 eNType = _pSet->pNumSetting->nNumberType; 1546766ce4d0SZheng Fan String sLocalPreFix = _pSet->pNumSetting->sPrefix.getStr(); 1547766ce4d0SZheng Fan String sLocalSuffix = _pSet->pNumSetting->sSuffix.getStr(); 1548766ce4d0SZheng Fan if (sPreFix.CompareTo(sLocalPreFix)==COMPARE_EQUAL && 1549766ce4d0SZheng Fan sSuffix.CompareTo(sLocalSuffix)==COMPARE_EQUAL && 1550766ce4d0SZheng Fan eNumType == eNType ) 1551766ce4d0SZheng Fan { 1552766ce4d0SZheng Fan return i+1; 1553766ce4d0SZheng Fan } 1554766ce4d0SZheng Fan } 1555766ce4d0SZheng Fan 1556766ce4d0SZheng Fan 1557766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1558766ce4d0SZheng Fan } 1559766ce4d0SZheng Fan 1560766ce4d0SZheng Fan sal_Bool NumberingTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 1561766ce4d0SZheng Fan { 1562766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) 1563766ce4d0SZheng Fan // return sal_False; 1564766ce4d0SZheng Fan 1565766ce4d0SZheng Fan //if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) 1566766ce4d0SZheng Fan // return sal_False; 1567766ce4d0SZheng Fan 1568766ce4d0SZheng Fan sal_uInt16 nActLv = IsSingleLevel(mLevel); 1569766ce4d0SZheng Fan 1570766ce4d0SZheng Fan if ( nActLv == (sal_uInt16)0xFFFF ) 1571766ce4d0SZheng Fan return sal_False; 1572766ce4d0SZheng Fan 1573766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); 1574766ce4d0SZheng Fan //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix()).getStr()[0]; 1575766ce4d0SZheng Fan //sal_Unicode cSuffix = rtl::OUString(aFmt.GetSuffix()).getStr()[0]; 1576766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1577766ce4d0SZheng Fan 1578766ce4d0SZheng Fan sal_uInt16 nCount = pNumberSettingsArr->Count(); 1579766ce4d0SZheng Fan if ( nIndex >= nCount ) 1580766ce4d0SZheng Fan return sal_False; 1581766ce4d0SZheng Fan 1582766ce4d0SZheng Fan NumberSettings_ImplPtr _pSet = pNumberSettingsArr->GetObject(nIndex); 1583766ce4d0SZheng Fan 1584766ce4d0SZheng Fan _pSet->pNumSetting->sPrefix = aFmt.GetPrefix(); 1585766ce4d0SZheng Fan _pSet->pNumSetting->sSuffix = aFmt.GetSuffix(); 1586766ce4d0SZheng Fan _pSet->pNumSetting->nNumberType = eNumType; 1587766ce4d0SZheng Fan _pSet->bIsCustomized = sal_True; 1588766ce4d0SZheng Fan 1589766ce4d0SZheng Fan SvxNumRule aTmpRule1(aNum); 1590766ce4d0SZheng Fan SvxNumRule aTmpRule2(aNum); 1591766ce4d0SZheng Fan ApplyNumRule(aTmpRule1,nIndex,mLevel,true); 1592766ce4d0SZheng Fan ApplyNumRule(aTmpRule2,nIndex,mLevel,false); 1593766ce4d0SZheng Fan if (aTmpRule1==aTmpRule2) _pSet->bIsCustomized=false; 1594766ce4d0SZheng Fan if (_pSet->bIsCustomized) { 1595766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_NUMBERING_DESCRIPTION)); 1596766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1597766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1598766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1599766ce4d0SZheng Fan _pSet->sDescription = aStrFromRES; 1600766ce4d0SZheng Fan } else { 1601766ce4d0SZheng Fan _pSet->sDescription = GetDescription(nIndex,true); 1602766ce4d0SZheng Fan } 1603766ce4d0SZheng Fan ImplStore(String::CreateFromAscii("standard.syb")); 1604766ce4d0SZheng Fan return sal_True; 1605766ce4d0SZheng Fan } 1606766ce4d0SZheng Fan 1607766ce4d0SZheng Fan sal_Bool NumberingTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel,sal_Bool isDefault,sal_Bool isResetSize) 1608766ce4d0SZheng Fan { 1609766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 1610766ce4d0SZheng Fan // return sal_False; 1611766ce4d0SZheng Fan 1612766ce4d0SZheng Fan //DBG_ASSERT(pNumSettingsArr->Count() > nIndex, "wrong index"); 1613766ce4d0SZheng Fan if(pNumberSettingsArr->Count() <= nIndex) 1614766ce4d0SZheng Fan return sal_False; 1615766ce4d0SZheng Fan NumberSettingsArr_Impl* pCurrentNumberSettingsArr=pNumberSettingsArr; 1616766ce4d0SZheng Fan if (isDefault) pCurrentNumberSettingsArr=pDefaultNumberSettingsArr; 1617766ce4d0SZheng Fan NumberSettings_ImplPtr _pSet = pCurrentNumberSettingsArr->GetObject(nIndex); 1618766ce4d0SZheng Fan sal_Int16 eNewType = _pSet->pNumSetting->nNumberType; 1619766ce4d0SZheng Fan 1620766ce4d0SZheng Fan sal_uInt16 nMask = 1; 1621766ce4d0SZheng Fan String sNumCharFmtName = GetBulCharFmtName(); 1622766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1623766ce4d0SZheng Fan { 1624766ce4d0SZheng Fan if(mLevel & nMask) 1625766ce4d0SZheng Fan { 1626766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1627766ce4d0SZheng Fan if (eNewType!=aFmt.GetNumberingType()) isResetSize=true; 1628766ce4d0SZheng Fan aFmt.SetNumberingType(eNewType); 1629766ce4d0SZheng Fan aFmt.SetPrefix(_pSet->pNumSetting->sPrefix); 1630766ce4d0SZheng Fan aFmt.SetSuffix(_pSet->pNumSetting->sSuffix); 1631766ce4d0SZheng Fan 1632766ce4d0SZheng Fan aFmt.SetCharFmtName(sNumCharFmtName); 1633766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(100); 1634766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 1635766ce4d0SZheng Fan } 1636766ce4d0SZheng Fan nMask <<= 1 ; 1637766ce4d0SZheng Fan } 1638766ce4d0SZheng Fan 1639766ce4d0SZheng Fan return sal_True; 1640766ce4d0SZheng Fan } 1641766ce4d0SZheng Fan String NumberingTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 1642766ce4d0SZheng Fan { 1643766ce4d0SZheng Fan String sRet; 1644766ce4d0SZheng Fan sal_uInt16 nLength = 0; 1645766ce4d0SZheng Fan nLength = pNumberSettingsArr->Count(); 1646766ce4d0SZheng Fan 1647766ce4d0SZheng Fan if ( nIndex >= nLength ) 1648766ce4d0SZheng Fan return sRet; 1649766ce4d0SZheng Fan else 1650766ce4d0SZheng Fan sRet = pNumberSettingsArr->GetObject(nIndex)->sDescription; 1651766ce4d0SZheng Fan if (isDefault) sRet = pDefaultNumberSettingsArr->GetObject(nIndex)->sDescription; 1652766ce4d0SZheng Fan 1653766ce4d0SZheng Fan return sRet; 1654766ce4d0SZheng Fan } 1655766ce4d0SZheng Fan sal_Bool NumberingTypeMgr::IsCustomized(sal_uInt16 nIndex) 1656766ce4d0SZheng Fan { 1657766ce4d0SZheng Fan sal_Bool bRet = sal_False; 1658766ce4d0SZheng Fan sal_uInt16 nLength = 0; 1659766ce4d0SZheng Fan nLength = pNumberSettingsArr->Count(); 1660766ce4d0SZheng Fan 1661766ce4d0SZheng Fan if ( nIndex >= nLength ) 1662766ce4d0SZheng Fan bRet = sal_False; 1663766ce4d0SZheng Fan else 1664766ce4d0SZheng Fan bRet = pNumberSettingsArr->GetObject(nIndex)->bIsCustomized; 1665766ce4d0SZheng Fan 1666766ce4d0SZheng Fan return bRet; 1667766ce4d0SZheng Fan } 1668766ce4d0SZheng Fan sal_uInt16 NumberingTypeMgr::GetNumCount() const 1669766ce4d0SZheng Fan { 1670766ce4d0SZheng Fan sal_uInt16 nRet = 0; 1671766ce4d0SZheng Fan if ( pNumberSettingsArr ) 1672766ce4d0SZheng Fan nRet = pNumberSettingsArr->Count(); 1673766ce4d0SZheng Fan 1674766ce4d0SZheng Fan return nRet; 1675766ce4d0SZheng Fan } 1676766ce4d0SZheng Fan NumberSettings_Impl* NumberingTypeMgr::GetNumSettingByIndex(sal_uInt16 nIndex) const 1677766ce4d0SZheng Fan { 1678766ce4d0SZheng Fan NumberSettings_Impl* pRet = 0; 1679766ce4d0SZheng Fan if ( pNumberSettingsArr && nIndex< pNumberSettingsArr->Count() ) 1680766ce4d0SZheng Fan { 1681766ce4d0SZheng Fan pRet = pNumberSettingsArr->GetObject(nIndex); 1682766ce4d0SZheng Fan } 1683766ce4d0SZheng Fan 1684766ce4d0SZheng Fan return pRet; 1685766ce4d0SZheng Fan } 1686766ce4d0SZheng Fan /*************************************************************************************************** 1687766ce4d0SZheng Fan **********************Multi-level /Outline Type lib******************************************************* 1688766ce4d0SZheng Fan ****************************************************************************************************/ 1689766ce4d0SZheng Fan OutlineTypeMgr* OutlineTypeMgr::_instance = 0; 1690766ce4d0SZheng Fan 1691766ce4d0SZheng Fan OutlineTypeMgr::OutlineTypeMgr(const NBOType aType): 1692766ce4d0SZheng Fan NBOTypeMgrBase(aType)//, 1693766ce4d0SZheng Fan //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT] ) 1694766ce4d0SZheng Fan { 1695766ce4d0SZheng Fan Init(); 1696766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) 1697766ce4d0SZheng Fan { 1698766ce4d0SZheng Fan pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; 1699766ce4d0SZheng Fan } 1700766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1701766ce4d0SZheng Fan Init(); 1702766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syc")); 1703766ce4d0SZheng Fan } 1704766ce4d0SZheng Fan 1705766ce4d0SZheng Fan OutlineTypeMgr::OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg): 1706766ce4d0SZheng Fan NBOTypeMgrBase(aType,pArg)//, 1707766ce4d0SZheng Fan //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) 1708766ce4d0SZheng Fan { 1709766ce4d0SZheng Fan Init(); 1710766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) 1711766ce4d0SZheng Fan { 1712766ce4d0SZheng Fan pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; 1713766ce4d0SZheng Fan } 1714766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1715766ce4d0SZheng Fan Init(); 1716766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syc")); 1717766ce4d0SZheng Fan } 1718766ce4d0SZheng Fan 1719766ce4d0SZheng Fan OutlineTypeMgr::OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr): 1720766ce4d0SZheng Fan NBOTypeMgrBase(aTypeMgr)//, 1721766ce4d0SZheng Fan //pNumSettingsArrs( new NumSettingsArr_Impl[DEFAULT_NUM_VALUSET_COUNT]) 1722766ce4d0SZheng Fan { 1723766ce4d0SZheng Fan Init(); 1724766ce4d0SZheng Fan for(sal_Int32 nItem = 0; nItem < DEFAULT_NUM_VALUSET_COUNT; nItem++ ) 1725766ce4d0SZheng Fan { 1726766ce4d0SZheng Fan pDefaultOutlineSettingsArrs[nItem] = pOutlineSettingsArrs[nItem]; 1727766ce4d0SZheng Fan } 1728766ce4d0SZheng Fan //Initial the first time to store the default value. Then do it again for customized value 1729766ce4d0SZheng Fan Init(); 1730766ce4d0SZheng Fan ImplLoad(String::CreateFromAscii("standard.syc")); 1731766ce4d0SZheng Fan } 1732766ce4d0SZheng Fan 1733766ce4d0SZheng Fan void OutlineTypeMgr::Init() 1734766ce4d0SZheng Fan { 1735766ce4d0SZheng Fan Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); 1736766ce4d0SZheng Fan Reference < XInterface > xI = xMSF->createInstance( 1737766ce4d0SZheng Fan ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) ); 1738766ce4d0SZheng Fan Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY); 1739766ce4d0SZheng Fan 1740766ce4d0SZheng Fan if(xDefNum.is()) 1741766ce4d0SZheng Fan { 1742766ce4d0SZheng Fan Sequence<Reference<XIndexAccess> > aOutlineAccess; 1743766ce4d0SZheng Fan LanguageType eLang = Application::GetSettings().GetLanguage(); 1744766ce4d0SZheng Fan Locale aLocale = SvxCreateLocale(eLang); 1745766ce4d0SZheng Fan try 1746766ce4d0SZheng Fan { 1747766ce4d0SZheng Fan aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); 1748766ce4d0SZheng Fan 1749766ce4d0SZheng Fan SvxNumRule aDefNumRule( NUM_BULLET_REL_SIZE|NUM_CONTINUOUS|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT,10, sal_False , 1750766ce4d0SZheng Fan SVX_RULETYPE_NUMBERING,SvxNumberFormat::LABEL_ALIGNMENT); 1751766ce4d0SZheng Fan 1752766ce4d0SZheng Fan for(sal_Int32 nItem = 0; 1753766ce4d0SZheng Fan nItem < aOutlineAccess.getLength() && nItem < DEFAULT_NUM_VALUSET_COUNT; 1754766ce4d0SZheng Fan nItem++ ) 1755766ce4d0SZheng Fan { 1756766ce4d0SZheng Fan pOutlineSettingsArrs[ nItem ] = new OutlineSettings_Impl; 1757766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[ nItem ]; 1758766ce4d0SZheng Fan pItemArr->sDescription = SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 + nItem ); 1759766ce4d0SZheng Fan pItemArr->pNumSettingsArr = new NumSettingsArr_Impl; 1760766ce4d0SZheng Fan Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem]; 1761766ce4d0SZheng Fan for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) 1762766ce4d0SZheng Fan { 1763766ce4d0SZheng Fan Any aValueAny = xLevel->getByIndex(nLevel); 1764766ce4d0SZheng Fan Sequence<PropertyValue> aLevelProps; 1765766ce4d0SZheng Fan aValueAny >>= aLevelProps; 1766766ce4d0SZheng Fan NumSettings_ImplPtr pNew = lcl_CreateNumberingSettingsPtr(aLevelProps); 1767766ce4d0SZheng Fan SvxNumberFormat aNumFmt( aDefNumRule.GetLevel( nLevel) ); 1768766ce4d0SZheng Fan pNew->eLabelFollowedBy = aNumFmt.GetLabelFollowedBy(); 1769766ce4d0SZheng Fan pNew->nTabValue = aNumFmt.GetListtabPos(); 1770766ce4d0SZheng Fan pNew->eNumAlign = aNumFmt.GetNumAdjust(); 1771766ce4d0SZheng Fan pNew->nNumAlignAt = aNumFmt.GetFirstLineIndent(); 1772766ce4d0SZheng Fan pNew->nNumIndentAt = aNumFmt.GetIndentAt(); 1773766ce4d0SZheng Fan pItemArr->pNumSettingsArr->Insert( pNew, pItemArr->pNumSettingsArr->Count() ); 1774766ce4d0SZheng Fan } 1775766ce4d0SZheng Fan } 1776766ce4d0SZheng Fan } 1777766ce4d0SZheng Fan catch(Exception&) 1778766ce4d0SZheng Fan { 1779766ce4d0SZheng Fan } 1780766ce4d0SZheng Fan } 1781766ce4d0SZheng Fan } 1782766ce4d0SZheng Fan 17839fe9aa9aSPavel Janík sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /* mLevel */,sal_uInt16 nFromIndex) 1784766ce4d0SZheng Fan { 1785766ce4d0SZheng Fan sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 1786766ce4d0SZheng Fan for(sal_uInt16 iDex = nFromIndex; iDex < nLength; iDex++) 1787766ce4d0SZheng Fan { 1788766ce4d0SZheng Fan sal_Bool bNotMatch = sal_False; 1789766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[iDex]; 1790766ce4d0SZheng Fan sal_uInt16 nCount = pItemArr->pNumSettingsArr->Count(); 1791766ce4d0SZheng Fan for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) 1792766ce4d0SZheng Fan { 1793766ce4d0SZheng Fan NumSettings_ImplPtr _pSet = pItemArr->pNumSettingsArr->GetObject(iLevel); 1794766ce4d0SZheng Fan sal_Int16 eNType = _pSet->nNumberType; 1795766ce4d0SZheng Fan 1796766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); 1797766ce4d0SZheng Fan String sPreFix = aFmt.GetPrefix(); 1798766ce4d0SZheng Fan String sSuffix = aFmt.GetSuffix(); 1799766ce4d0SZheng Fan String sEmpty; 1800766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1801766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL) 1802766ce4d0SZheng Fan { 1803766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1804766ce4d0SZheng Fan sal_Unicode ccChar = _pSet->sBulletChar.getStr()[0]; 1805766ce4d0SZheng Fan rtl::OUString sFont = _pSet->sBulletFont; 1806766ce4d0SZheng Fan if ( !((cChar == ccChar) && //pFont && sFont.compareTo(pFont->GetName()) && 1807766ce4d0SZheng Fan _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && 1808766ce4d0SZheng Fan _pSet->nTabValue == aFmt.GetListtabPos() && 1809766ce4d0SZheng Fan _pSet->eNumAlign == aFmt.GetNumAdjust() && 1810766ce4d0SZheng Fan _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && 1811766ce4d0SZheng Fan _pSet->nNumIndentAt == aFmt.GetIndentAt())) 1812766ce4d0SZheng Fan { 1813766ce4d0SZheng Fan bNotMatch = sal_True; 1814766ce4d0SZheng Fan break; 1815766ce4d0SZheng Fan } 1816766ce4d0SZheng Fan }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { 1817766ce4d0SZheng Fan const SvxBrushItem* pBrsh1 = aFmt.GetBrush(); 1818766ce4d0SZheng Fan const SvxBrushItem* pBrsh2 = _pSet->pBrushItem; 1819766ce4d0SZheng Fan sal_Bool bIsMatch = false; 1820766ce4d0SZheng Fan if (pBrsh1==pBrsh2) bIsMatch = true; 1821766ce4d0SZheng Fan if (pBrsh1 && pBrsh2) { 1822766ce4d0SZheng Fan const Graphic* pGrf1 = pBrsh1->GetGraphic();; 1823766ce4d0SZheng Fan const Graphic* pGrf2 = pBrsh2->GetGraphic();; 1824766ce4d0SZheng Fan if (pGrf1==pGrf2) bIsMatch = true; 1825766ce4d0SZheng Fan if (pGrf1 && pGrf2) { 1826766ce4d0SZheng Fan if ( pGrf1->GetBitmap().IsEqual(pGrf2->GetBitmap()) && 1827766ce4d0SZheng Fan _pSet->aSize==aFmt.GetGraphicSize()) 1828766ce4d0SZheng Fan bIsMatch = true; 1829766ce4d0SZheng Fan } 1830766ce4d0SZheng Fan } 1831766ce4d0SZheng Fan if (!bIsMatch) { 1832766ce4d0SZheng Fan bNotMatch = sal_True; 1833766ce4d0SZheng Fan break; 1834766ce4d0SZheng Fan } 1835766ce4d0SZheng Fan } else 1836766ce4d0SZheng Fan { 1837766ce4d0SZheng Fan if (!((sPreFix.CompareTo(_pSet->sPrefix.getStr())==COMPARE_EQUAL) && 1838766ce4d0SZheng Fan ( sSuffix.CompareTo(_pSet->sSuffix.getStr())==COMPARE_EQUAL ) && 1839766ce4d0SZheng Fan eNumType == eNType && 1840766ce4d0SZheng Fan _pSet->eLabelFollowedBy == aFmt.GetLabelFollowedBy() && 1841766ce4d0SZheng Fan _pSet->nTabValue == aFmt.GetListtabPos() && 1842766ce4d0SZheng Fan _pSet->eNumAlign == aFmt.GetNumAdjust() && 1843766ce4d0SZheng Fan _pSet->nNumAlignAt == aFmt.GetFirstLineIndent() && 1844766ce4d0SZheng Fan _pSet->nNumIndentAt == aFmt.GetIndentAt())) 1845766ce4d0SZheng Fan { 1846766ce4d0SZheng Fan bNotMatch = sal_True; 1847766ce4d0SZheng Fan break; 1848766ce4d0SZheng Fan } 1849766ce4d0SZheng Fan } 1850766ce4d0SZheng Fan } 1851766ce4d0SZheng Fan if ( !bNotMatch ) 1852766ce4d0SZheng Fan return iDex+1; 1853766ce4d0SZheng Fan } 1854766ce4d0SZheng Fan 1855766ce4d0SZheng Fan 1856766ce4d0SZheng Fan return (sal_uInt16)0xFFFF; 1857766ce4d0SZheng Fan } 1858766ce4d0SZheng Fan 1859766ce4d0SZheng Fan sal_Bool OutlineTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel) 1860766ce4d0SZheng Fan { 1861766ce4d0SZheng Fan //if ( mLevel == 0 || mLevel == (sal_uInt16)0xFFFF ) 1862766ce4d0SZheng Fan // return sal_False; 1863766ce4d0SZheng Fan 1864766ce4d0SZheng Fan sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 1865766ce4d0SZheng Fan if ( nIndex >= nLength ) 1866766ce4d0SZheng Fan return sal_False; 1867766ce4d0SZheng Fan 1868766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 1869766ce4d0SZheng Fan sal_uInt16 nCount = pItemArr->pNumSettingsArr->Count(); 1870766ce4d0SZheng Fan for (sal_uInt16 iLevel=0;iLevel < nCount;iLevel++) 1871766ce4d0SZheng Fan { 1872766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(iLevel)); 1873766ce4d0SZheng Fan sal_Int16 eNumType = aFmt.GetNumberingType(); 1874766ce4d0SZheng Fan 1875766ce4d0SZheng Fan NumSettings_ImplPtr _pSet = pItemArr->pNumSettingsArr->GetObject(iLevel); 1876766ce4d0SZheng Fan 1877766ce4d0SZheng Fan _pSet->eLabelFollowedBy = aFmt.GetLabelFollowedBy(); 1878766ce4d0SZheng Fan _pSet->nTabValue = aFmt.GetListtabPos(); 1879766ce4d0SZheng Fan _pSet->eNumAlign = aFmt.GetNumAdjust(); 1880766ce4d0SZheng Fan _pSet->nNumAlignAt = aFmt.GetFirstLineIndent(); 1881766ce4d0SZheng Fan _pSet->nNumIndentAt = aFmt.GetIndentAt(); 1882766ce4d0SZheng Fan 1883766ce4d0SZheng Fan if( eNumType == SVX_NUM_CHAR_SPECIAL) 1884766ce4d0SZheng Fan { 1885766ce4d0SZheng Fan sal_Unicode cChar = aFmt.GetBulletChar(); 1886766ce4d0SZheng Fan OUString sChar(cChar); 1887766ce4d0SZheng Fan _pSet->sBulletChar = sChar;//OUString(cChar); 1888766ce4d0SZheng Fan if ( aFmt.GetBulletFont() ) 1889766ce4d0SZheng Fan _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); 1890766ce4d0SZheng Fan _pSet->nNumberType = eNumType; 1891766ce4d0SZheng Fan pItemArr->bIsCustomized = sal_True; 1892766ce4d0SZheng Fan }else if ((eNumType&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { 1893766ce4d0SZheng Fan if (_pSet->pBrushItem) { 1894766ce4d0SZheng Fan delete (_pSet->pBrushItem); 1895766ce4d0SZheng Fan _pSet->pBrushItem=NULL; 1896766ce4d0SZheng Fan } 1897766ce4d0SZheng Fan if (aFmt.GetBrush()) 1898766ce4d0SZheng Fan _pSet->pBrushItem = new SvxBrushItem(*aFmt.GetBrush()); 1899766ce4d0SZheng Fan _pSet->aSize = aFmt.GetGraphicSize(); 1900766ce4d0SZheng Fan _pSet->nNumberType = eNumType; 1901766ce4d0SZheng Fan } else 1902766ce4d0SZheng Fan { 1903766ce4d0SZheng Fan _pSet->sPrefix = aFmt.GetPrefix(); 1904766ce4d0SZheng Fan _pSet->sSuffix = aFmt.GetSuffix(); 1905766ce4d0SZheng Fan _pSet->nNumberType = eNumType; 1906766ce4d0SZheng Fan if ( aFmt.GetBulletFont() ) 1907766ce4d0SZheng Fan _pSet->sBulletFont = rtl::OUString(aFmt.GetBulletFont()->GetName()); 1908766ce4d0SZheng Fan pItemArr->bIsCustomized = sal_True; 1909766ce4d0SZheng Fan } 1910766ce4d0SZheng Fan } 1911766ce4d0SZheng Fan SvxNumRule aTmpRule1(aNum); 1912766ce4d0SZheng Fan SvxNumRule aTmpRule2(aNum); 1913766ce4d0SZheng Fan ApplyNumRule(aTmpRule1,nIndex,mLevel,true); 1914766ce4d0SZheng Fan ApplyNumRule(aTmpRule2,nIndex,mLevel,false); 1915766ce4d0SZheng Fan if (aTmpRule1==aTmpRule2) pItemArr->bIsCustomized=false; 1916766ce4d0SZheng Fan if (pItemArr->bIsCustomized) { 1917766ce4d0SZheng Fan String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_MULTILEVEL_DESCRIPTION)); 1918766ce4d0SZheng Fan String aReplace = String::CreateFromAscii("%LIST_NUM"); 1919766ce4d0SZheng Fan String sNUM = String::CreateFromInt32( nIndex + 1 ); 1920766ce4d0SZheng Fan aStrFromRES.SearchAndReplace(aReplace,sNUM); 1921766ce4d0SZheng Fan pItemArr->sDescription = aStrFromRES; 1922766ce4d0SZheng Fan } else { 1923766ce4d0SZheng Fan pItemArr->sDescription = GetDescription(nIndex,true); 1924766ce4d0SZheng Fan } 1925766ce4d0SZheng Fan ImplStore(String::CreateFromAscii("standard.syc")); 1926766ce4d0SZheng Fan return sal_True; 1927766ce4d0SZheng Fan } 1928766ce4d0SZheng Fan 19299fe9aa9aSPavel Janík sal_Bool OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 /* mLevel */,sal_Bool isDefault,sal_Bool isResetSize) 1930766ce4d0SZheng Fan { 1931766ce4d0SZheng Fan //if ( mLevel == (sal_uInt16)0xFFFF ) 1932766ce4d0SZheng Fan // return sal_False; 1933766ce4d0SZheng Fan 1934766ce4d0SZheng Fan DBG_ASSERT(DEFAULT_NUM_VALUSET_COUNT > nIndex, "wrong index"); 1935766ce4d0SZheng Fan if(DEFAULT_NUM_VALUSET_COUNT <= nIndex) 1936766ce4d0SZheng Fan return sal_False; 1937766ce4d0SZheng Fan 1938766ce4d0SZheng Fan const FontList* pList = 0; 1939766ce4d0SZheng Fan 1940766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 1941766ce4d0SZheng Fan if (isDefault) pItemArr=pDefaultOutlineSettingsArrs[nIndex]; 1942766ce4d0SZheng Fan 1943766ce4d0SZheng Fan //Font& rActBulletFont = lcl_GetDefaultBulletFont(); 1944766ce4d0SZheng Fan NumSettingsArr_Impl *pNumSettingsArr=pItemArr->pNumSettingsArr; 1945766ce4d0SZheng Fan 1946766ce4d0SZheng Fan NumSettings_ImplPtr pLevelSettings = 0; 1947766ce4d0SZheng Fan String sBulletCharFmtName = GetBulCharFmtName(); 1948766ce4d0SZheng Fan for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++) 1949766ce4d0SZheng Fan { 1950766ce4d0SZheng Fan if(pNumSettingsArr->Count() > i) 1951766ce4d0SZheng Fan pLevelSettings = pNumSettingsArr->GetObject(i); 1952766ce4d0SZheng Fan 1953766ce4d0SZheng Fan if(!pLevelSettings) 1954766ce4d0SZheng Fan break; 1955766ce4d0SZheng Fan 1956766ce4d0SZheng Fan SvxNumberFormat aFmt(aNum.GetLevel(i)); 1957766ce4d0SZheng Fan //aFmt.SetBulletFont(&pLevelSettings->aFont); 1958766ce4d0SZheng Fan Font& rActBulletFont = lcl_GetDefaultBulletFont(); 1959766ce4d0SZheng Fan if (pLevelSettings->nNumberType !=aFmt.GetNumberingType()) isResetSize=true; 1960766ce4d0SZheng Fan aFmt.SetNumberingType( pLevelSettings->nNumberType ); 1961766ce4d0SZheng Fan sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering; 1962766ce4d0SZheng Fan if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) 1963766ce4d0SZheng Fan { 1964766ce4d0SZheng Fan if( pLevelSettings->sBulletFont.getLength() && 1965766ce4d0SZheng Fan pLevelSettings->sBulletFont.compareTo(rActBulletFont.GetName())) 1966766ce4d0SZheng Fan { 1967766ce4d0SZheng Fan //search for the font 1968766ce4d0SZheng Fan if(!pList) 1969766ce4d0SZheng Fan { 1970766ce4d0SZheng Fan SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); 1971766ce4d0SZheng Fan const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pCurDocShell->GetItem( SID_ATTR_CHAR_FONTLIST ); 1972766ce4d0SZheng Fan pList = pFontListItem ? pFontListItem->GetFontList() : 0; 1973766ce4d0SZheng Fan } 1974766ce4d0SZheng Fan if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) ) 1975766ce4d0SZheng Fan { 1976766ce4d0SZheng Fan FontInfo aInfo = pList->Get(pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE); 1977766ce4d0SZheng Fan Font aFont(aInfo); 1978766ce4d0SZheng Fan aFmt.SetBulletFont(&aFont); 1979766ce4d0SZheng Fan } 1980766ce4d0SZheng Fan else 1981766ce4d0SZheng Fan { 1982766ce4d0SZheng Fan //if it cannot be found then create a new one 1983766ce4d0SZheng Fan Font aCreateFont( pLevelSettings->sBulletFont,String(), Size( 0, 14 ) ); 1984766ce4d0SZheng Fan aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); 1985766ce4d0SZheng Fan aCreateFont.SetFamily( FAMILY_DONTKNOW ); 1986766ce4d0SZheng Fan aCreateFont.SetPitch( PITCH_DONTKNOW ); 1987766ce4d0SZheng Fan aCreateFont.SetWeight( WEIGHT_DONTKNOW ); 1988766ce4d0SZheng Fan aCreateFont.SetTransparent( sal_True ); 1989766ce4d0SZheng Fan aFmt.SetBulletFont( &aCreateFont ); 1990766ce4d0SZheng Fan } 1991766ce4d0SZheng Fan }else 1992766ce4d0SZheng Fan aFmt.SetBulletFont( &rActBulletFont ); 1993766ce4d0SZheng Fan 1994766ce4d0SZheng Fan sal_Unicode cChar = 0; 1995766ce4d0SZheng Fan if( pLevelSettings->sBulletChar.getLength() ) 1996766ce4d0SZheng Fan cChar = pLevelSettings->sBulletChar.getStr()[0]; 1997766ce4d0SZheng Fan if( Application::GetSettings().GetLayoutRTL() ) 1998766ce4d0SZheng Fan { 1999766ce4d0SZheng Fan if( 0 == i && cChar == BulletsTypeMgr::aDynamicBulletTypes[5] ) 2000766ce4d0SZheng Fan cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[5]; 2001766ce4d0SZheng Fan else if( 1 == i ) 2002766ce4d0SZheng Fan { 2003766ce4d0SZheng Fan const SvxNumberFormat& numberFmt = aNum.GetLevel(0); 2004766ce4d0SZheng Fan if( numberFmt.GetBulletChar() == BulletsTypeMgr::aDynamicRTLBulletTypes[5] ) 2005766ce4d0SZheng Fan cChar = BulletsTypeMgr::aDynamicRTLBulletTypes[4]; 2006766ce4d0SZheng Fan } 2007766ce4d0SZheng Fan } 2008766ce4d0SZheng Fan 2009766ce4d0SZheng Fan aFmt.SetBulletChar(cChar); 2010766ce4d0SZheng Fan aFmt.SetCharFmtName( sBulletCharFmtName ); 2011766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(45); 2012766ce4d0SZheng Fan }else if ((aFmt.GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) { 2013766ce4d0SZheng Fan if (pLevelSettings->pBrushItem) { 2014766ce4d0SZheng Fan const Graphic* pGrf = pLevelSettings->pBrushItem->GetGraphic();; 2015766ce4d0SZheng Fan Size aSize = pLevelSettings->aSize; 2016766ce4d0SZheng Fan sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; 2017766ce4d0SZheng Fan if (!isResetSize && aFmt.GetGraphicSize()!=Size(0,0)) aSize=aFmt.GetGraphicSize(); 2018766ce4d0SZheng Fan else { 2019766ce4d0SZheng Fan if (aSize.Width()==0 && aSize.Height()==0 && pGrf) { 2020766ce4d0SZheng Fan aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf ); 2021766ce4d0SZheng Fan } 2022766ce4d0SZheng Fan } 2023766ce4d0SZheng Fan aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)GetMapUnit()); 2024766ce4d0SZheng Fan aFmt.SetGraphicBrush( pLevelSettings->pBrushItem, &aSize, &eOrient ); 2025766ce4d0SZheng Fan } 2026766ce4d0SZheng Fan } else 2027766ce4d0SZheng Fan { 2028766ce4d0SZheng Fan aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? aNum.GetLevelCount() : 0)); 2029766ce4d0SZheng Fan aFmt.SetCharFmtName(sBulletCharFmtName); 2030766ce4d0SZheng Fan if (isResetSize) aFmt.SetBulletRelSize(100); 2031766ce4d0SZheng Fan } 2032766ce4d0SZheng Fan if(pNumSettingsArr->Count() > i) { 2033766ce4d0SZheng Fan aFmt.SetLabelFollowedBy(pLevelSettings->eLabelFollowedBy); 2034766ce4d0SZheng Fan aFmt.SetListtabPos(pLevelSettings->nTabValue); 2035766ce4d0SZheng Fan aFmt.SetNumAdjust(pLevelSettings->eNumAlign); 2036766ce4d0SZheng Fan aFmt.SetFirstLineIndent(pLevelSettings->nNumAlignAt); 2037766ce4d0SZheng Fan aFmt.SetIndentAt(pLevelSettings->nNumIndentAt); 2038766ce4d0SZheng Fan } 2039766ce4d0SZheng Fan aFmt.SetPrefix(pLevelSettings->sPrefix); 2040766ce4d0SZheng Fan aFmt.SetSuffix(pLevelSettings->sSuffix); 2041766ce4d0SZheng Fan aNum.SetLevel(i, aFmt); 2042766ce4d0SZheng Fan } 2043766ce4d0SZheng Fan 2044766ce4d0SZheng Fan return sal_True; 2045766ce4d0SZheng Fan } 2046766ce4d0SZheng Fan String OutlineTypeMgr::GetDescription(sal_uInt16 nIndex,sal_Bool isDefault) 2047766ce4d0SZheng Fan { 2048766ce4d0SZheng Fan String sRet; 2049766ce4d0SZheng Fan sal_uInt16 nLength = 0; 2050766ce4d0SZheng Fan nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 2051766ce4d0SZheng Fan 2052766ce4d0SZheng Fan if ( nIndex >= nLength ) 2053766ce4d0SZheng Fan return sRet; 2054766ce4d0SZheng Fan else 2055766ce4d0SZheng Fan { 2056766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 2057766ce4d0SZheng Fan if (isDefault) pItemArr = pDefaultOutlineSettingsArrs[nIndex]; 2058766ce4d0SZheng Fan if ( pItemArr ) 2059766ce4d0SZheng Fan { 2060766ce4d0SZheng Fan sRet = pItemArr->sDescription; 2061766ce4d0SZheng Fan }; 2062766ce4d0SZheng Fan } 2063766ce4d0SZheng Fan return sRet; 2064766ce4d0SZheng Fan } 2065766ce4d0SZheng Fan sal_Bool OutlineTypeMgr::IsCustomized(sal_uInt16 nIndex) 2066766ce4d0SZheng Fan { 2067766ce4d0SZheng Fan sal_Bool bRet = sal_False; 2068766ce4d0SZheng Fan 2069766ce4d0SZheng Fan sal_uInt16 nLength = 0; 2070766ce4d0SZheng Fan nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); 2071766ce4d0SZheng Fan 2072766ce4d0SZheng Fan if ( nIndex >= nLength ) 2073766ce4d0SZheng Fan return bRet; 2074766ce4d0SZheng Fan else 2075766ce4d0SZheng Fan { 2076766ce4d0SZheng Fan OutlineSettings_Impl* pItemArr = pOutlineSettingsArrs[nIndex]; 2077766ce4d0SZheng Fan if ( pItemArr ) 2078766ce4d0SZheng Fan { 2079766ce4d0SZheng Fan bRet = pItemArr->bIsCustomized; 2080766ce4d0SZheng Fan }; 2081766ce4d0SZheng Fan } 2082766ce4d0SZheng Fan 2083766ce4d0SZheng Fan return bRet; 2084766ce4d0SZheng Fan } 2085766ce4d0SZheng Fan 2086766ce4d0SZheng Fan 2087766ce4d0SZheng Fan }} 2088