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