Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include <com/sun/star/text/HoriOrientation.hpp>
21 : : #include <com/sun/star/text/VertOrientation.hpp>
22 : : #include <com/sun/star/text/RelOrientation.hpp>
23 : :
24 : : #include <numpages.hxx>
25 : : #include <numpages.hrc>
26 : : #include <dialmgr.hxx>
27 : : #include <tools/shl.hxx>
28 : : #include <i18npool/mslangid.hxx>
29 : : #include <helpid.hrc>
30 : : #include <editeng/numitem.hxx>
31 : : #include <svl/eitem.hxx>
32 : : #include <vcl/svapp.hxx>
33 : : #include <svx/gallery.hxx>
34 : : #include <svl/urihelper.hxx>
35 : : #include <editeng/brshitem.hxx>
36 : : #include <svl/intitem.hxx>
37 : : #include <sfx2/objsh.hxx>
38 : : #include <vcl/graph.hxx>
39 : : #include <vcl/msgbox.hxx>
40 : : #include "cuicharmap.hxx"
41 : : #include <editeng/flstitem.hxx>
42 : : #include <svx/dlgutil.hxx>
43 : : #include <svx/xtable.hxx>
44 : : #include <svx/drawitem.hxx>
45 : : #include <svx/numvset.hxx>
46 : : #include <svx/htmlmode.hxx>
47 : : #include <unotools/pathoptions.hxx>
48 : : #include <svtools/ctrltool.hxx>
49 : : #include <editeng/unolingu.hxx>
50 : : #include <com/sun/star/style/NumberingType.hpp>
51 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
52 : : #include <com/sun/star/container/XIndexAccess.hpp>
53 : : #include <com/sun/star/text/DefaultNumberingProvider.hpp>
54 : : #include <com/sun/star/text/XDefaultNumberingProvider.hpp>
55 : : #include <com/sun/star/text/XNumberingFormatter.hpp>
56 : : #include <com/sun/star/beans/PropertyValue.hpp>
57 : : #include <comphelper/processfactory.hxx>
58 : : #include <com/sun/star/text/XNumberingTypeInfo.hpp>
59 : : #include <svx/dialmgr.hxx>
60 : : #include <svx/dialogs.hrc>
61 : : #include <comphelper/componentcontext.hxx>
62 : :
63 : : #include <algorithm>
64 : : #include <vector>
65 : : #include "sfx2/opengrf.hxx"
66 : :
67 : : #include <cuires.hrc>
68 : : #include <sfx2/request.hxx>
69 : : #include <svl/aeitem.hxx>
70 : : #include <svl/stritem.hxx>
71 : : #include <svl/slstitm.hxx>
72 : :
73 : : using namespace com::sun::star;
74 : : using namespace com::sun::star::uno;
75 : : using namespace com::sun::star::beans;
76 : : using namespace com::sun::star::lang;
77 : : using namespace com::sun::star::i18n;
78 : : using namespace com::sun::star::text;
79 : : using namespace com::sun::star::container;
80 : : using namespace com::sun::star::style;
81 : : using rtl::OUString;
82 : :
83 : : #define NUM_PAGETYPE_BULLET 0
84 : : #define NUM_PAGETYPE_SINGLENUM 1
85 : : #define NUM_PAGETYPE_NUM 2
86 : : #define NUM_PAGETYPE_BMP 3
87 : : #define PAGETYPE_USER_START 10
88 : :
89 : : #define SHOW_NUMBERING 0
90 : : #define SHOW_BULLET 1
91 : : #define SHOW_BITMAP 2
92 : :
93 : : #define MAX_BMP_WIDTH 16
94 : : #define MAX_BMP_HEIGHT 16
95 : :
96 : : static sal_Bool bLastRelative = sal_False;
97 : : static const sal_Char cNumberingType[] = "NumberingType";
98 : : static const sal_Char cParentNumbering[] = "ParentNumbering";
99 : : static const sal_Char cPrefix[] = "Prefix";
100 : : static const sal_Char cSuffix[] = "Suffix";
101 : : static const sal_Char cBulletChar[] = "BulletChar";
102 : : static const sal_Char cBulletFontName[] = "BulletFontName";
103 : :
104 : 0 : Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider()
105 : : {
106 [ # # ]: 0 : Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
107 [ # # ]: 0 : Reference<XDefaultNumberingProvider> xRet = text::DefaultNumberingProvider::create(xContext);
108 : 0 : return xRet;
109 : : }
110 : :
111 : 0 : SvxNumSettings_Impl* lcl_CreateNumSettingsPtr(const Sequence<PropertyValue>& rLevelProps)
112 : : {
113 : 0 : const PropertyValue* pValues = rLevelProps.getConstArray();
114 : 0 : SvxNumSettings_Impl* pNew = new SvxNumSettings_Impl;
115 [ # # ]: 0 : for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++)
116 : : {
117 [ # # ]: 0 : if ( pValues[j].Name == cNumberingType )
118 : 0 : pValues[j].Value >>= pNew->nNumberType;
119 [ # # ]: 0 : else if ( pValues[j].Name == cPrefix )
120 : 0 : pValues[j].Value >>= pNew->sPrefix;
121 [ # # ]: 0 : else if ( pValues[j].Name == cSuffix )
122 : 0 : pValues[j].Value >>= pNew->sSuffix;
123 [ # # ]: 0 : else if ( pValues[j].Name == cParentNumbering )
124 : 0 : pValues[j].Value >>= pNew->nParentNumbering;
125 [ # # ]: 0 : else if ( pValues[j].Name == cBulletChar )
126 : 0 : pValues[j].Value >>= pNew->sBulletChar;
127 [ # # ]: 0 : else if ( pValues[j].Name == cBulletFontName )
128 : 0 : pValues[j].Value >>= pNew->sBulletFont;
129 : : }
130 : 0 : return pNew;
131 : : }
132 : :
133 : : // the selection of bullets from the StarSymbol
134 : : static const sal_Unicode aBulletTypes[] =
135 : : {
136 : : 0x2022,
137 : : 0x25cf,
138 : : 0xe00c,
139 : : 0xe00a,
140 : : 0x2794,
141 : : 0x27a2,
142 : : 0x2717,
143 : : 0x2714
144 : : };
145 : :
146 : : static sal_Char const aNumChar[] =
147 : : {
148 : : 'A', //CHARS_UPPER_LETTER
149 : : 'a', //CHARS_LOWER_LETTER
150 : : 'I', //ROMAN_UPPER
151 : : 'i', //ROMAN_LOWER
152 : : '1', //ARABIC
153 : : ' '
154 : : };
155 : :
156 : : // Is one of the masked formats set?
157 : 0 : sal_Bool lcl_IsNumFmtSet(SvxNumRule* pNum, sal_uInt16 nLevelMask)
158 : : {
159 : 0 : sal_Bool bRet = sal_False;
160 : 0 : sal_uInt16 nMask = 1;
161 [ # # ][ # # ]: 0 : for( sal_uInt16 i = 0; i < SVX_MAX_NUM && !bRet; i++ )
[ # # ]
162 : : {
163 [ # # ]: 0 : if(nLevelMask & nMask)
164 : 0 : bRet |= 0 != pNum->Get( i );
165 : 0 : nMask <<= 1 ;
166 : : }
167 : 0 : return bRet;
168 : : }
169 : :
170 : 0 : Font& lcl_GetDefaultBulletFont()
171 : : {
172 : : static sal_Bool bInit = 0;
173 : : static Font aDefBulletFont( rtl::OUString("StarSymbol"),
174 [ # # ][ # # ]: 0 : String(), Size( 0, 14 ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
175 [ # # ]: 0 : if(!bInit)
176 : : {
177 : 0 : aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
178 : 0 : aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
179 : 0 : aDefBulletFont.SetPitch( PITCH_DONTKNOW );
180 : 0 : aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
181 : 0 : aDefBulletFont.SetTransparent( sal_True );
182 : 0 : bInit = sal_True;
183 : : }
184 : 0 : return aDefBulletFont;
185 : : }
186 : :
187 : 0 : SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent,
188 : : const SfxItemSet& rSet) :
189 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_SINGLE_NUM ), rSet ),
190 [ # # ]: 0 : aValuesFL( this, CUI_RES(FL_VALUES) ),
191 [ # # ][ # # ]: 0 : pExamplesVS( new SvxNumValueSet(this, CUI_RES(VS_VALUES), NUM_PAGETYPE_SINGLENUM )),
192 : : pActNum(0),
193 : : pSaveNum(0),
194 : : nActNumLvl( USHRT_MAX ),
195 : : bModified(sal_False),
196 : : bPreset(sal_False),
197 [ # # ][ # # ]: 0 : nNumItemId(SID_ATTR_NUMBERING_RULE)
[ # # ][ # # ]
[ # # ]
198 : : {
199 [ # # ]: 0 : FreeResource();
200 : 0 : SetExchangeSupport();
201 [ # # ]: 0 : pExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl));
202 [ # # ]: 0 : pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl));
203 [ # # ]: 0 : pExamplesVS->SetHelpId(HID_VALUESET_SINGLENUM );
204 : :
205 [ # # ]: 0 : Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
206 [ # # ]: 0 : if(xDefNum.is())
207 : : {
208 [ # # ]: 0 : Sequence< Sequence< PropertyValue > > aNumberings;
209 [ # # ][ # # ]: 0 : LanguageType eLang = Application::GetSettings().GetLanguage();
210 [ # # ]: 0 : Locale aLocale = SvxCreateLocale(eLang);
211 : : try
212 : : {
213 : : aNumberings =
214 [ # # ][ # # ]: 0 : xDefNum->getDefaultContinuousNumberingLevels( aLocale );
[ # # ]
[ # # # # ]
215 : :
216 : :
217 [ # # ]: 0 : sal_Int32 nLength = aNumberings.getLength() > NUM_VALUSET_COUNT ? NUM_VALUSET_COUNT :aNumberings.getLength();
218 : :
219 : 0 : const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray();
220 [ # # ]: 0 : for(sal_Int32 i = 0; i < nLength; i++)
221 : : {
222 [ # # ]: 0 : SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]);
223 [ # # ]: 0 : aNumSettingsArr.push_back(pNew);
224 : : }
225 : : }
226 [ # # ]: 0 : catch(Exception&)
227 : : {
228 : : }
229 [ # # ]: 0 : Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
230 [ # # ][ # # ]: 0 : pExamplesVS->SetNumberingSettings(aNumberings, xFormat, aLocale);
231 : 0 : }
232 : 0 : }
233 : :
234 [ # # ][ # # ]: 0 : SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage()
[ # # ]
235 : : {
236 [ # # ][ # # ]: 0 : delete pActNum;
237 [ # # ][ # # ]: 0 : delete pExamplesVS;
238 [ # # ][ # # ]: 0 : delete pSaveNum;
239 [ # # ]: 0 : }
240 : :
241 : 0 : SfxTabPage* SvxSingleNumPickTabPage::Create( Window* pParent,
242 : : const SfxItemSet& rAttrSet)
243 : : {
244 [ # # ]: 0 : return new SvxSingleNumPickTabPage(pParent, rAttrSet);
245 : : }
246 : :
247 : 0 : sal_Bool SvxSingleNumPickTabPage::FillItemSet( SfxItemSet& rSet )
248 : : {
249 [ # # ][ # # ]: 0 : if( (bPreset || bModified) && pSaveNum)
[ # # ]
250 : : {
251 : 0 : *pSaveNum = *pActNum;
252 [ # # ]: 0 : rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
253 [ # # ]: 0 : rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
254 : : }
255 : :
256 : 0 : return bModified;
257 : : }
258 : :
259 : 0 : void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
260 : : {
261 : : const SfxPoolItem* pItem;
262 : 0 : bPreset = sal_False;
263 : 0 : sal_Bool bIsPreset = sal_False;
264 : 0 : const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
265 [ # # ]: 0 : if(pExampleSet)
266 : : {
267 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
268 : 0 : bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
269 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
270 : 0 : nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
271 : : }
272 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
273 : : {
274 [ # # ][ # # ]: 0 : delete pSaveNum;
275 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
276 : : }
277 [ # # ][ # # ]: 0 : if(*pSaveNum != *pActNum)
278 : : {
279 [ # # ]: 0 : *pActNum = *pSaveNum;
280 [ # # ]: 0 : pExamplesVS->SetNoSelection();
281 : : }
282 : :
283 [ # # ][ # # ]: 0 : if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
[ # # ][ # # ]
[ # # ]
284 : : {
285 [ # # ]: 0 : pExamplesVS->SelectItem(1);
286 [ # # ]: 0 : NumSelectHdl_Impl(pExamplesVS);
287 : 0 : bPreset = sal_True;
288 : : }
289 : 0 : bPreset |= bIsPreset;
290 : :
291 : 0 : bModified = sal_False;
292 : 0 : }
293 : :
294 : 0 : int SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet)
295 : : {
296 [ # # ]: 0 : if(_pSet)
297 : 0 : FillItemSet(*_pSet);
298 : 0 : return sal_True;
299 : : }
300 : :
301 : 0 : void SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet )
302 : : {
303 : : const SfxPoolItem* pItem;
304 : :
305 : : // in Draw the item exists as WhichId, in Writer only as SlotId
306 [ # # ]: 0 : SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
307 [ # # ]: 0 : if(eState != SFX_ITEM_SET)
308 : : {
309 [ # # ]: 0 : nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
310 [ # # ]: 0 : eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
311 : :
312 [ # # ]: 0 : if( eState != SFX_ITEM_SET )
313 : : {
314 [ # # ]: 0 : pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
315 : 0 : eState = SFX_ITEM_SET;
316 : : }
317 : : }
318 : : DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
319 [ # # ][ # # ]: 0 : delete pSaveNum;
320 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
321 : :
322 [ # # ]: 0 : if(!pActNum)
323 [ # # ][ # # ]: 0 : pActNum = new SvxNumRule(*pSaveNum);
324 [ # # ][ # # ]: 0 : else if(*pSaveNum != *pActNum)
325 [ # # ]: 0 : *pActNum = *pSaveNum;
326 : 0 : }
327 : :
328 : 0 : IMPL_LINK_NOARG(SvxSingleNumPickTabPage, NumSelectHdl_Impl)
329 : : {
330 [ # # ]: 0 : if(pActNum)
331 : : {
332 : 0 : bPreset = sal_False;
333 : 0 : bModified = sal_True;
334 : 0 : sal_uInt16 nIdx = pExamplesVS->GetSelectItemId() - 1;
335 : : DBG_ASSERT(aNumSettingsArr.size() > nIdx, "wrong index");
336 [ # # ]: 0 : if(aNumSettingsArr.size() <= nIdx)
337 : 0 : return 0;
338 : 0 : SvxNumSettings_Impl* _pSet = &aNumSettingsArr[nIdx];
339 : 0 : sal_Int16 eNewType = _pSet->nNumberType;
340 [ # # ]: 0 : const sal_Unicode cLocalPrefix = !_pSet->sPrefix.isEmpty() ? _pSet->sPrefix.getStr()[0] : 0;
341 [ # # ]: 0 : const sal_Unicode cLocalSuffix = !_pSet->sSuffix.isEmpty() ? _pSet->sSuffix.getStr()[0] : 0;
342 : :
343 : 0 : sal_uInt16 nMask = 1;
344 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
345 : : {
346 [ # # ]: 0 : if(nActNumLvl & nMask)
347 : : {
348 [ # # ][ # # ]: 0 : SvxNumberFormat aFmt(pActNum->GetLevel(i));
349 : 0 : aFmt.SetNumberingType(eNewType);
350 [ # # ]: 0 : String aEmptyStr;
351 [ # # ]: 0 : if(cLocalPrefix == ' ')
352 [ # # ]: 0 : aFmt.SetPrefix( aEmptyStr );
353 : : else
354 : 0 : aFmt.SetPrefix(_pSet->sPrefix);
355 [ # # ]: 0 : if(cLocalSuffix == ' ')
356 [ # # ]: 0 : aFmt.SetSuffix( aEmptyStr );
357 : : else
358 : 0 : aFmt.SetSuffix(_pSet->sSuffix);
359 [ # # ]: 0 : aFmt.SetCharFmtName(sNumCharFmtName);
360 : : // #62069# // #92724#
361 : 0 : aFmt.SetBulletRelSize(100);
362 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aFmt);
[ # # ]
363 : : }
364 : 0 : nMask <<= 1 ;
365 : : }
366 : : }
367 : 0 : return 0;
368 : : }
369 : :
370 : 0 : IMPL_LINK_NOARG(SvxSingleNumPickTabPage, DoubleClickHdl_Impl)
371 : : {
372 : 0 : NumSelectHdl_Impl(pExamplesVS);
373 : 0 : OKButton& rOk = GetTabDialog()->GetOKButton();
374 : 0 : rOk.GetClickHdl().Call(&rOk);
375 : 0 : return 0;
376 : : }
377 : :
378 : :
379 : 0 : SvxBulletPickTabPage::SvxBulletPickTabPage(Window* pParent,
380 : : const SfxItemSet& rSet) :
381 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_BULLET ), rSet ),
382 [ # # ]: 0 : aValuesFL( this, CUI_RES(FL_VALUES) ),
383 [ # # ][ # # ]: 0 : pExamplesVS( new SvxNumValueSet(this, CUI_RES(VS_VALUES), NUM_PAGETYPE_BULLET )),
384 : : pActNum(0),
385 : : pSaveNum(0),
386 : : nActNumLvl( USHRT_MAX ),
387 : : bModified(sal_False),
388 : : bPreset(sal_False),
389 [ # # ][ # # ]: 0 : nNumItemId(SID_ATTR_NUMBERING_RULE)
[ # # ][ # # ]
390 : : {
391 [ # # ]: 0 : FreeResource();
392 : 0 : SetExchangeSupport();
393 [ # # ]: 0 : pExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl));
394 [ # # ]: 0 : pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl));
395 [ # # ]: 0 : pExamplesVS->SetHelpId(HID_VALUESET_BULLET );
396 : :
397 : 0 : }
398 : :
399 [ # # ][ # # ]: 0 : SvxBulletPickTabPage::~SvxBulletPickTabPage()
400 : : {
401 [ # # ][ # # ]: 0 : delete pActNum;
402 [ # # ][ # # ]: 0 : delete pExamplesVS;
403 [ # # ][ # # ]: 0 : delete pSaveNum;
404 [ # # ]: 0 : }
405 : :
406 : 0 : SfxTabPage* SvxBulletPickTabPage::Create( Window* pParent,
407 : : const SfxItemSet& rAttrSet)
408 : : {
409 [ # # ]: 0 : return new SvxBulletPickTabPage(pParent, rAttrSet);
410 : : }
411 : :
412 : 0 : sal_Bool SvxBulletPickTabPage::FillItemSet( SfxItemSet& rSet )
413 : : {
414 [ # # ][ # # ]: 0 : if( (bPreset || bModified) && pActNum)
[ # # ]
415 : : {
416 : 0 : *pSaveNum = *pActNum;
417 [ # # ]: 0 : rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
418 [ # # ]: 0 : rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
419 : : }
420 : 0 : return bModified;
421 : : }
422 : :
423 : 0 : void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet)
424 : : {
425 : : const SfxPoolItem* pItem;
426 : 0 : bPreset = sal_False;
427 : 0 : sal_Bool bIsPreset = sal_False;
428 : 0 : const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
429 [ # # ]: 0 : if(pExampleSet)
430 : : {
431 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
432 : 0 : bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
433 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
434 : 0 : nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
435 : : }
436 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
437 : : {
438 [ # # ][ # # ]: 0 : delete pSaveNum;
439 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
440 : : }
441 [ # # ][ # # ]: 0 : if(*pSaveNum != *pActNum)
442 : : {
443 [ # # ]: 0 : *pActNum = *pSaveNum;
444 [ # # ]: 0 : pExamplesVS->SetNoSelection();
445 : : }
446 : :
447 [ # # ][ # # ]: 0 : if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
[ # # ][ # # ]
[ # # ]
448 : : {
449 [ # # ]: 0 : pExamplesVS->SelectItem(1);
450 [ # # ]: 0 : NumSelectHdl_Impl(pExamplesVS);
451 : 0 : bPreset = sal_True;
452 : : }
453 : 0 : bPreset |= bIsPreset;
454 : 0 : bModified = sal_False;
455 : 0 : }
456 : :
457 : 0 : int SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet)
458 : : {
459 [ # # ]: 0 : if(_pSet)
460 : 0 : FillItemSet(*_pSet);
461 : 0 : return sal_True;
462 : : }
463 : :
464 : 0 : void SvxBulletPickTabPage::Reset( const SfxItemSet& rSet )
465 : : {
466 : : const SfxPoolItem* pItem;
467 : : // in Draw the item exists as WhichId, in Writer only as SlotId
468 [ # # ]: 0 : SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
469 [ # # ]: 0 : if(eState != SFX_ITEM_SET)
470 : : {
471 [ # # ]: 0 : nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
472 [ # # ]: 0 : eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
473 : :
474 [ # # ]: 0 : if( eState != SFX_ITEM_SET )
475 : : {
476 [ # # ]: 0 : pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
477 : 0 : eState = SFX_ITEM_SET;
478 : : }
479 : :
480 : : }
481 : : DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
482 [ # # ][ # # ]: 0 : delete pSaveNum;
483 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
484 : :
485 [ # # ]: 0 : if(!pActNum)
486 [ # # ][ # # ]: 0 : pActNum = new SvxNumRule(*pSaveNum);
487 [ # # ][ # # ]: 0 : else if(*pSaveNum != *pActNum)
488 [ # # ]: 0 : *pActNum = *pSaveNum;
489 : 0 : }
490 : :
491 : 0 : IMPL_LINK_NOARG(SvxBulletPickTabPage, NumSelectHdl_Impl)
492 : : {
493 [ # # ]: 0 : if(pActNum)
494 : : {
495 : 0 : bPreset = sal_False;
496 : 0 : bModified = sal_True;
497 : 0 : sal_Unicode cChar = aBulletTypes[pExamplesVS->GetSelectItemId() - 1];
498 : 0 : Font& rActBulletFont = lcl_GetDefaultBulletFont();
499 : :
500 : 0 : sal_uInt16 nMask = 1;
501 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
502 : : {
503 [ # # ]: 0 : if(nActNumLvl & nMask)
504 : : {
505 [ # # ][ # # ]: 0 : SvxNumberFormat aFmt(pActNum->GetLevel(i));
506 : 0 : aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL );
507 : : // #i93908# clear suffix for bullet lists
508 : 0 : aFmt.SetPrefix(::rtl::OUString());
509 : 0 : aFmt.SetSuffix(::rtl::OUString());
510 [ # # ]: 0 : aFmt.SetBulletFont(&rActBulletFont);
511 : 0 : aFmt.SetBulletChar(cChar );
512 [ # # ]: 0 : aFmt.SetCharFmtName(sBulletCharFmtName);
513 : : // #62069# // #92724#
514 : 0 : aFmt.SetBulletRelSize(45);
515 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aFmt);
516 : : }
517 : 0 : nMask <<= 1;
518 : : }
519 : : }
520 : :
521 : 0 : return 0;
522 : : }
523 : :
524 : :
525 : 0 : IMPL_LINK_NOARG(SvxBulletPickTabPage, DoubleClickHdl_Impl)
526 : : {
527 : 0 : NumSelectHdl_Impl(pExamplesVS);
528 : 0 : OKButton& rOk = GetTabDialog()->GetOKButton();
529 : 0 : rOk.GetClickHdl().Call(&rOk);
530 : 0 : return 0;
531 : : }
532 : :
533 : :
534 : 0 : void SvxBulletPickTabPage::PageCreated(SfxAllItemSet aSet)
535 : : {
536 : :
537 : 0 : SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
538 : :
539 [ # # ]: 0 : if (pBulletCharFmt)
540 : 0 : SetCharFmtName( pBulletCharFmt->GetValue());
541 : :
542 : :
543 : 0 : }
544 : :
545 : :
546 : 0 : SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent,
547 : : const SfxItemSet& rSet) :
548 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_NUM ), rSet ),
549 [ # # ]: 0 : aValuesFL( this, CUI_RES(FL_VALUES) ),
550 [ # # ][ # # ]: 0 : pExamplesVS( new SvxNumValueSet(this, CUI_RES(VS_VALUES), NUM_PAGETYPE_NUM )),
551 : : pActNum(0),
552 : : pSaveNum(0),
553 : : nActNumLvl( USHRT_MAX ),
554 : : nNumItemId(SID_ATTR_NUMBERING_RULE),
555 : : bModified(sal_False),
556 [ # # ][ # # ]: 0 : bPreset(sal_False)
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
[ # # ]
557 : : {
558 : :
559 [ # # ]: 0 : FreeResource();
560 : :
561 : 0 : SetExchangeSupport();
562 : :
563 [ # # ]: 0 : pExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl));
564 [ # # ]: 0 : pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl));
565 [ # # ]: 0 : pExamplesVS->SetHelpId(HID_VALUESET_NUM );
566 : :
567 [ # # ]: 0 : Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
568 [ # # ]: 0 : if(xDefNum.is())
569 : : {
570 [ # # ]: 0 : Sequence<Reference<XIndexAccess> > aOutlineAccess;
571 [ # # ][ # # ]: 0 : LanguageType eLang = Application::GetSettings().GetLanguage();
572 [ # # ]: 0 : Locale aLocale = SvxCreateLocale(eLang);
573 : : try
574 : : {
575 [ # # ][ # # ]: 0 : aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale );
[ # # ][ # # ]
576 : :
577 [ # # ][ # # ]: 0 : for(sal_Int32 nItem = 0;
[ # # ]
578 : 0 : nItem < aOutlineAccess.getLength() && nItem < NUM_VALUSET_COUNT;
579 : : nItem++ )
580 : : {
581 : 0 : SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ];
582 : :
583 : 0 : Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem];
584 [ # # ][ # # ]: 0 : for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++)
[ # # ][ # # ]
[ # # ]
585 : : {
586 [ # # ][ # # ]: 0 : Any aValueAny = xLevel->getByIndex(nLevel);
587 [ # # ]: 0 : Sequence<PropertyValue> aLevelProps;
588 [ # # ]: 0 : aValueAny >>= aLevelProps;
589 [ # # ]: 0 : SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(aLevelProps);
590 [ # # ]: 0 : rItemArr.push_back( pNew );
591 [ # # ]: 0 : }
592 [ # # ]: 0 : }
593 : : }
594 [ # # ]: 0 : catch(Exception&)
595 : : {
596 : : }
597 [ # # ]: 0 : Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
598 [ # # ][ # # ]: 0 : pExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, aLocale);
599 : 0 : }
600 [ # # # # ]: 0 : }
601 : :
602 [ # # ][ # # ]: 0 : SvxNumPickTabPage::~SvxNumPickTabPage()
[ # # ][ # # ]
603 : : {
604 [ # # ][ # # ]: 0 : delete pActNum;
605 [ # # ][ # # ]: 0 : delete pExamplesVS;
606 [ # # ][ # # ]: 0 : delete pSaveNum;
607 [ # # ][ # # ]: 0 : }
[ # # ]
[ # # # # ]
608 : :
609 : 0 : SfxTabPage* SvxNumPickTabPage::Create( Window* pParent,
610 : : const SfxItemSet& rAttrSet)
611 : : {
612 [ # # ]: 0 : return new SvxNumPickTabPage(pParent, rAttrSet);
613 : : }
614 : :
615 : 0 : sal_Bool SvxNumPickTabPage::FillItemSet( SfxItemSet& rSet )
616 : : {
617 [ # # ][ # # ]: 0 : if( (bPreset || bModified) && pActNum)
[ # # ]
618 : : {
619 : 0 : *pSaveNum = *pActNum;
620 [ # # ]: 0 : rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
621 [ # # ]: 0 : rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
622 : : }
623 : 0 : return bModified;
624 : : }
625 : :
626 : 0 : void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
627 : : {
628 : : const SfxPoolItem* pItem;
629 : 0 : bPreset = sal_False;
630 : 0 : sal_Bool bIsPreset = sal_False;
631 : 0 : const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
632 [ # # ]: 0 : if(pExampleSet)
633 : : {
634 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
635 : 0 : bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
636 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
637 : 0 : nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
638 : : }
639 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
640 : : {
641 [ # # ][ # # ]: 0 : delete pSaveNum;
642 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
643 : : }
644 [ # # ][ # # ]: 0 : if(*pSaveNum != *pActNum)
645 : : {
646 [ # # ]: 0 : *pActNum = *pSaveNum;
647 [ # # ]: 0 : pExamplesVS->SetNoSelection();
648 : : }
649 : :
650 [ # # ][ # # ]: 0 : if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
[ # # ][ # # ]
[ # # ]
651 : : {
652 [ # # ]: 0 : pExamplesVS->SelectItem(1);
653 [ # # ]: 0 : NumSelectHdl_Impl(pExamplesVS);
654 : 0 : bPreset = sal_True;
655 : : }
656 : 0 : bPreset |= bIsPreset;
657 : 0 : bModified = sal_False;
658 : 0 : }
659 : :
660 : 0 : int SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet)
661 : : {
662 [ # # ]: 0 : if(_pSet)
663 : 0 : FillItemSet(*_pSet);
664 : 0 : return sal_True;
665 : : }
666 : :
667 : 0 : void SvxNumPickTabPage::Reset( const SfxItemSet& rSet )
668 : : {
669 : : const SfxPoolItem* pItem;
670 : : // in Draw the item exists as WhichId, in Writer only as SlotId
671 [ # # ]: 0 : SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
672 [ # # ]: 0 : if(eState != SFX_ITEM_SET)
673 : : {
674 [ # # ]: 0 : nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
675 [ # # ]: 0 : eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
676 : :
677 [ # # ]: 0 : if( eState != SFX_ITEM_SET )
678 : : {
679 [ # # ]: 0 : pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
680 : 0 : eState = SFX_ITEM_SET;
681 : : }
682 : :
683 : : }
684 : : DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
685 [ # # ][ # # ]: 0 : delete pSaveNum;
686 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
687 : :
688 [ # # ]: 0 : if(!pActNum)
689 [ # # ][ # # ]: 0 : pActNum = new SvxNumRule(*pSaveNum);
690 [ # # ][ # # ]: 0 : else if(*pSaveNum != *pActNum)
691 [ # # ]: 0 : *pActNum = *pSaveNum;
692 : :
693 : 0 : }
694 : :
695 : : // all levels are changed here
696 : 0 : IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl)
697 : : {
698 [ # # ]: 0 : if(pActNum)
699 : : {
700 : 0 : bPreset = sal_False;
701 : 0 : bModified = sal_True;
702 : :
703 : 0 : const FontList* pList = 0;
704 : :
705 : 0 : SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[pExamplesVS->GetSelectItemId() - 1];
706 : :
707 : 0 : Font& rActBulletFont = lcl_GetDefaultBulletFont();
708 : 0 : SvxNumSettings_Impl* pLevelSettings = 0;
709 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
710 : : {
711 [ # # ]: 0 : if(rItemArr.size() > i)
712 [ # # ]: 0 : pLevelSettings = &rItemArr[i];
713 [ # # ]: 0 : if(!pLevelSettings)
714 : : break;
715 [ # # ][ # # ]: 0 : SvxNumberFormat aFmt(pActNum->GetLevel(i));
716 : 0 : aFmt.SetNumberingType( pLevelSettings->nNumberType );
717 : 0 : sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering;
718 [ # # ]: 0 : if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
719 : : {
720 : : // #i93908# clear suffix for bullet lists
721 : 0 : aFmt.SetPrefix(::rtl::OUString());
722 : 0 : aFmt.SetSuffix(::rtl::OUString());
723 [ # # ]: 0 : if( !pLevelSettings->sBulletFont.isEmpty() &&
[ # # # # ]
724 : : pLevelSettings->sBulletFont.compareTo(
725 [ # # ][ # # ]: 0 : rActBulletFont.GetName()))
[ # # ][ # # ]
726 : : {
727 : : //search for the font
728 [ # # ]: 0 : if(!pList)
729 : : {
730 [ # # ]: 0 : SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
731 : : const SvxFontListItem* pFontListItem =
732 : : (const SvxFontListItem* )pCurDocShell
733 [ # # ]: 0 : ->GetItem( SID_ATTR_CHAR_FONTLIST );
734 [ # # ]: 0 : pList = pFontListItem ? pFontListItem->GetFontList() : 0;
735 : : }
736 [ # # ][ # # ]: 0 : if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
737 : : {
738 : : FontInfo aInfo = pList->Get(
739 [ # # ][ # # ]: 0 : pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE);
[ # # ]
740 [ # # ]: 0 : Font aFont(aInfo);
741 [ # # ][ # # ]: 0 : aFmt.SetBulletFont(&aFont);
[ # # ]
742 : : }
743 : : else
744 : : {
745 : : //if it cannot be found then create a new one
746 : : Font aCreateFont( pLevelSettings->sBulletFont,
747 [ # # ][ # # ]: 0 : String(), Size( 0, 14 ) );
[ # # ][ # # ]
[ # # ]
748 [ # # ]: 0 : aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
749 [ # # ]: 0 : aCreateFont.SetFamily( FAMILY_DONTKNOW );
750 [ # # ]: 0 : aCreateFont.SetPitch( PITCH_DONTKNOW );
751 [ # # ]: 0 : aCreateFont.SetWeight( WEIGHT_DONTKNOW );
752 [ # # ]: 0 : aCreateFont.SetTransparent( sal_True );
753 [ # # ][ # # ]: 0 : aFmt.SetBulletFont( &aCreateFont );
754 : : }
755 : : }
756 : : else
757 [ # # ]: 0 : aFmt.SetBulletFont( &rActBulletFont );
758 : :
759 : 0 : aFmt.SetBulletChar( !pLevelSettings->sBulletChar.isEmpty()
760 : 0 : ? pLevelSettings->sBulletChar.getStr()[0]
761 [ # # ]: 0 : : 0 );
762 [ # # ]: 0 : aFmt.SetCharFmtName( sBulletCharFmtName );
763 : : // #62069# // #92724#
764 : 0 : aFmt.SetBulletRelSize(45);
765 : : }
766 : : else
767 : : {
768 [ # # ]: 0 : aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 0));
769 [ # # ]: 0 : aFmt.SetCharFmtName(sNumCharFmtName);
770 : : // #62069# // #92724#
771 : 0 : aFmt.SetBulletRelSize(100);
772 : : // #i93908#
773 : 0 : aFmt.SetPrefix(pLevelSettings->sPrefix);
774 : 0 : aFmt.SetSuffix(pLevelSettings->sSuffix);
775 : : }
776 [ # # ]: 0 : pActNum->SetLevel(i, aFmt);
777 [ # # ]: 0 : }
778 : : }
779 : 0 : return 0;
780 : : }
781 : :
782 : 0 : IMPL_LINK_NOARG(SvxNumPickTabPage, DoubleClickHdl_Impl)
783 : : {
784 : 0 : NumSelectHdl_Impl(pExamplesVS);
785 : 0 : OKButton& rOk = GetTabDialog()->GetOKButton();
786 : 0 : rOk.GetClickHdl().Call(&rOk);
787 : 0 : return 0;
788 : : }
789 : :
790 : 0 : void SvxNumPickTabPage::PageCreated(SfxAllItemSet aSet)
791 : : {
792 : 0 : SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False);
793 : 0 : SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
794 : :
795 : :
796 [ # # ][ # # ]: 0 : if (pNumCharFmt &&pBulletCharFmt)
797 : 0 : SetCharFmtNames( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
798 : 0 : }
799 : :
800 : :
801 : 0 : SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent,
802 : : const SfxItemSet& rSet) :
803 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_BMP ), rSet ),
804 [ # # ]: 0 : aValuesFL( this, CUI_RES(FL_VALUES) ),
805 [ # # ][ # # ]: 0 : pExamplesVS( new SvxBmpNumValueSet(this, CUI_RES(VS_VALUES)/*, aGrfNames*/ )),
806 [ # # ]: 0 : aErrorText( this, CUI_RES(FT_ERROR)),
807 [ # # ]: 0 : aLinkedCB( this, CUI_RES(CB_LINKED)),
808 : : pActNum(0),
809 : : pSaveNum(0),
810 : : nActNumLvl( USHRT_MAX ),
811 : : nNumItemId(SID_ATTR_NUMBERING_RULE),
812 : : bModified(sal_False),
813 [ # # ][ # # ]: 0 : bPreset(sal_False)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
814 : : {
815 [ # # ]: 0 : FreeResource();
816 : 0 : SetExchangeSupport();
817 [ # # ][ # # ]: 0 : eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
818 [ # # ]: 0 : pExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl));
819 [ # # ]: 0 : pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl));
820 [ # # ]: 0 : aLinkedCB.SetClickHdl(LINK(this, SvxBitmapPickTabPage, LinkBmpHdl_Impl));
821 : :
822 : : // determine graphic name
823 [ # # ]: 0 : GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
824 [ # # ]: 0 : pExamplesVS->SetHelpId(HID_VALUESET_NUMBMP );
825 : :
826 : 0 : sal_uInt16 i = 0;
827 [ # # ][ # # ]: 0 : for(std::vector<String>::iterator it = aGrfNames.begin(); it != aGrfNames.end(); ++it, ++i)
[ # # ]
828 : : {
829 [ # # ]: 0 : pExamplesVS->InsertItem( i + 1, i);
830 : :
831 [ # # ][ # # ]: 0 : INetURLObject aObj(*it);
[ # # ]
832 [ # # ]: 0 : if(aObj.GetProtocol() == INET_PROT_FILE)
833 [ # # ][ # # ]: 0 : *it = aObj.PathToFileName();
[ # # ]
834 : :
835 [ # # ][ # # ]: 0 : pExamplesVS->SetItemText( i + 1, *it );
836 [ # # ]: 0 : }
837 : :
838 [ # # ]: 0 : if(aGrfNames.empty())
839 : : {
840 [ # # ]: 0 : aErrorText.Show();
841 : : }
842 : : else
843 : : {
844 [ # # ]: 0 : pExamplesVS->Show();
845 [ # # ]: 0 : pExamplesVS->Format();
846 : : }
847 : :
848 [ # # ]: 0 : pExamplesVS->SetAccessibleRelationMemberOf( &aValuesFL );
849 : 0 : }
850 : :
851 [ # # ][ # # ]: 0 : SvxBitmapPickTabPage::~SvxBitmapPickTabPage()
[ # # ][ # # ]
852 : : {
853 [ # # ][ # # ]: 0 : delete pExamplesVS;
854 [ # # ][ # # ]: 0 : delete pActNum;
855 [ # # ][ # # ]: 0 : delete pSaveNum;
856 [ # # ]: 0 : }
857 : :
858 : 0 : SfxTabPage* SvxBitmapPickTabPage::Create( Window* pParent,
859 : : const SfxItemSet& rAttrSet)
860 : : {
861 [ # # ]: 0 : return new SvxBitmapPickTabPage(pParent, rAttrSet);
862 : : }
863 : :
864 : 0 : void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet)
865 : : {
866 : : const SfxPoolItem* pItem;
867 : 0 : bPreset = sal_False;
868 : 0 : sal_Bool bIsPreset = sal_False;
869 : 0 : const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
870 [ # # ]: 0 : if(pExampleSet)
871 : : {
872 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
873 : 0 : bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
874 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
875 : 0 : nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
876 : : }
877 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
878 : : {
879 [ # # ][ # # ]: 0 : delete pSaveNum;
880 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
881 : : }
882 [ # # ][ # # ]: 0 : if(*pSaveNum != *pActNum)
883 : : {
884 [ # # ]: 0 : *pActNum = *pSaveNum;
885 [ # # ]: 0 : pExamplesVS->SetNoSelection();
886 : : }
887 : :
888 [ # # ][ # # ]: 0 : if(!aGrfNames.empty() &&
[ # # ][ # # ]
[ # # ]
889 [ # # ]: 0 : (pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)))
890 : : {
891 [ # # ]: 0 : pExamplesVS->SelectItem(1);
892 [ # # ]: 0 : NumSelectHdl_Impl(pExamplesVS);
893 : 0 : bPreset = sal_True;
894 : : }
895 : 0 : bPreset |= bIsPreset;
896 : 0 : bModified = sal_False;
897 : 0 : }
898 : :
899 : 0 : int SvxBitmapPickTabPage::DeactivatePage(SfxItemSet *_pSet)
900 : : {
901 [ # # ]: 0 : if(_pSet)
902 : 0 : FillItemSet(*_pSet);
903 : 0 : return sal_True;
904 : : }
905 : :
906 : 0 : sal_Bool SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet )
907 : : {
908 [ # # ]: 0 : if ( aGrfNames.empty() )
909 : : {
910 : 0 : return sal_False;
911 : : }
912 [ # # ][ # # ]: 0 : if( (bPreset || bModified) && pActNum)
[ # # ]
913 : : {
914 : 0 : *pSaveNum = *pActNum;
915 [ # # ]: 0 : rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
916 [ # # ]: 0 : rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
917 : : }
918 : :
919 : 0 : return bModified;
920 : : }
921 : :
922 : 0 : void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet )
923 : : {
924 : : const SfxPoolItem* pItem;
925 : : // in Draw the item exists as WhichId, in Writer only as SlotId
926 [ # # ]: 0 : SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
927 [ # # ]: 0 : if(eState != SFX_ITEM_SET)
928 : : {
929 [ # # ]: 0 : nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
930 [ # # ]: 0 : eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
931 : :
932 [ # # ]: 0 : if( eState != SFX_ITEM_SET )
933 : : {
934 [ # # ]: 0 : pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
935 : 0 : eState = SFX_ITEM_SET;
936 : : }
937 : :
938 : : }
939 : : DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
940 [ # # ][ # # ]: 0 : delete pSaveNum;
941 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
942 : :
943 [ # # ]: 0 : if(!pActNum)
944 [ # # ][ # # ]: 0 : pActNum = new SvxNumRule(*pSaveNum);
945 [ # # ][ # # ]: 0 : else if(*pSaveNum != *pActNum)
946 [ # # ]: 0 : *pActNum = *pSaveNum;
947 [ # # ]: 0 : if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP))
948 : : {
949 [ # # ]: 0 : aLinkedCB.Check(sal_False);
950 [ # # ]: 0 : aLinkedCB.Enable(sal_False);
951 : : }
952 [ # # ]: 0 : else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP))
953 : : {
954 [ # # ]: 0 : aLinkedCB.Check(sal_True);
955 [ # # ]: 0 : aLinkedCB.Enable(sal_False);
956 : : }
957 : 0 : }
958 : :
959 : 0 : IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl)
960 : : {
961 [ # # ]: 0 : if(pActNum)
962 : : {
963 : 0 : bPreset = sal_False;
964 : 0 : bModified = sal_True;
965 : 0 : sal_uInt16 nIdx = pExamplesVS->GetSelectItemId() - 1;
966 : :
967 : 0 : sal_uInt16 nMask = 1;
968 [ # # ]: 0 : String aEmptyStr;
969 : 0 : sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP;
970 [ # # ][ # # ]: 0 : if(aLinkedCB.IsChecked())
971 : 0 : nSetNumberingType |= LINK_TOKEN;
972 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
973 : : {
974 [ # # ]: 0 : if(nActNumLvl & nMask)
975 : : {
976 [ # # ][ # # ]: 0 : SvxNumberFormat aFmt(pActNum->GetLevel(i));
977 : 0 : aFmt.SetNumberingType(nSetNumberingType);
978 [ # # ]: 0 : aFmt.SetPrefix( aEmptyStr );
979 [ # # ]: 0 : aFmt.SetSuffix( aEmptyStr );
980 [ # # ]: 0 : aFmt.SetCharFmtName( sNumCharFmtName );
981 : :
982 [ # # ]: 0 : Graphic aGraphic;
983 [ # # ][ # # ]: 0 : if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nIdx, &aGraphic))
984 : : {
985 [ # # ]: 0 : Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
986 : 0 : sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;
987 [ # # ][ # # ]: 0 : aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit);
[ # # ][ # # ]
[ # # ]
988 [ # # ]: 0 : SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH );
989 [ # # ][ # # ]: 0 : aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );
990 : : }
991 [ # # ]: 0 : else if(aGrfNames.size() > nIdx)
992 [ # # ][ # # ]: 0 : aFmt.SetGraphic( aGrfNames[nIdx] );
993 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aFmt);
[ # # ]
994 : : }
995 : 0 : nMask <<= 1 ;
996 [ # # ]: 0 : }
997 : : }
998 : :
999 : 0 : return 0;
1000 : : }
1001 : :
1002 : 0 : IMPL_LINK_NOARG(SvxBitmapPickTabPage, DoubleClickHdl_Impl)
1003 : : {
1004 : 0 : NumSelectHdl_Impl(pExamplesVS);
1005 : 0 : OKButton& rOk = GetTabDialog()->GetOKButton();
1006 : 0 : rOk.GetClickHdl().Call(&rOk);
1007 : 0 : return 0;
1008 : : }
1009 : :
1010 : 0 : IMPL_LINK_NOARG(SvxBitmapPickTabPage, LinkBmpHdl_Impl)
1011 : : {
1012 [ # # ]: 0 : if(!pExamplesVS->IsNoSelection())
1013 : : {
1014 : 0 : NumSelectHdl_Impl(pExamplesVS);
1015 : : }
1016 : 0 : return 0;
1017 : : }
1018 : :
1019 : : // static
1020 : 0 : void SvxNumOptionsTabPage::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 nDoNotRemove )
1021 : : {
1022 : :
1023 [ # # ]: 0 : Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
1024 [ # # ]: 0 : Reference<XNumberingTypeInfo> xInfo(xDefNum, UNO_QUERY);
1025 : :
1026 : : // Extended numbering schemes present in the resource but not offered by
1027 : : // the i18n framework per configuration must be removed from the listbox.
1028 : : // Do not remove a special entry matching nDoNotRemove.
1029 : 0 : const sal_uInt16 nDontRemove = 0xffff;
1030 [ # # ][ # # ]: 0 : ::std::vector< sal_uInt16> aRemove( rFmtLB.GetEntryCount(), nDontRemove);
1031 [ # # ]: 0 : for (size_t i=0; i<aRemove.size(); ++i)
1032 : : {
1033 : : sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)rFmtLB.GetEntryData(
1034 [ # # ]: 0 : sal::static_int_cast< sal_uInt16 >(i));
1035 [ # # ][ # # ]: 0 : if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N && nEntryData != nDoNotRemove)
1036 [ # # ]: 0 : aRemove[i] = nEntryData;
1037 : : }
1038 [ # # ]: 0 : if(xInfo.is())
1039 : : {
1040 [ # # ][ # # ]: 0 : Sequence<sal_Int16> aTypes = xInfo->getSupportedNumberingTypes( );
1041 : 0 : const sal_Int16* pTypes = aTypes.getConstArray();
1042 [ # # ]: 0 : for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
1043 : : {
1044 : 0 : sal_Int16 nCurrent = pTypes[nType];
1045 [ # # ]: 0 : if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
1046 : : {
1047 : 0 : sal_Bool bInsert = sal_True;
1048 [ # # ][ # # ]: 0 : for(sal_uInt16 nEntry = 0; nEntry < rFmtLB.GetEntryCount(); nEntry++)
1049 : : {
1050 [ # # ]: 0 : sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)rFmtLB.GetEntryData(nEntry);
1051 [ # # ]: 0 : if(nEntryData == (sal_uInt16) nCurrent)
1052 : : {
1053 : 0 : bInsert = sal_False;
1054 [ # # ]: 0 : aRemove[nEntry] = nDontRemove;
1055 : 0 : break;
1056 : : }
1057 : : }
1058 [ # # ]: 0 : if(bInsert)
1059 : : {
1060 [ # # ][ # # ]: 0 : OUString aIdent = xInfo->getNumberingIdentifier( nCurrent );
1061 [ # # ][ # # ]: 0 : sal_uInt16 nPos = rFmtLB.InsertEntry(aIdent);
[ # # ]
1062 [ # # ]: 0 : rFmtLB.SetEntryData(nPos,(void*)(sal_uLong)nCurrent);
1063 : : }
1064 : : }
1065 [ # # ]: 0 : }
1066 : : }
1067 [ # # ]: 0 : for (size_t i=0; i<aRemove.size(); ++i)
1068 : : {
1069 [ # # ][ # # ]: 0 : if (aRemove[i] != nDontRemove)
1070 : : {
1071 [ # # ][ # # ]: 0 : sal_uInt16 nPos = rFmtLB.GetEntryPos( (void*)(sal_uLong)aRemove[i]);
1072 [ # # ]: 0 : rFmtLB.RemoveEntry( nPos);
1073 : : }
1074 : 0 : }
1075 : 0 : }
1076 : :
1077 : : // tabpage numeration options
1078 : : #define NUM_NO_GRAPHIC 1000
1079 : 0 : SvxNumOptionsTabPage::SvxNumOptionsTabPage(Window* pParent,
1080 : : const SfxItemSet& rSet) :
1081 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_NUM_OPTIONS ), rSet ),
1082 : :
1083 [ # # ]: 0 : aFormatFL( this, CUI_RES(FL_FORMAT )),
1084 [ # # ]: 0 : aLevelFT( this, CUI_RES(FT_LEVEL )),
1085 [ # # ]: 0 : aLevelLB( this, CUI_RES(LB_LEVEL )),
1086 [ # # ]: 0 : aFmtFT( this, CUI_RES(FT_FMT )),
1087 [ # # ]: 0 : aFmtLB( this, CUI_RES(LB_FMT )),
1088 [ # # ]: 0 : aPrefixFT( this, CUI_RES(FT_PREFIX )),
1089 [ # # ]: 0 : aPrefixED( this, CUI_RES(ED_PREFIX )),
1090 [ # # ]: 0 : aSuffixFT( this, CUI_RES(FT_SUFFIX )),
1091 [ # # ]: 0 : aSuffixED( this, CUI_RES(ED_SUFFIX )),
1092 [ # # ]: 0 : aCharFmtFT( this, CUI_RES(FT_CHARFMT )),
1093 [ # # ]: 0 : aCharFmtLB( this, CUI_RES(LB_CHARFMT )),
1094 [ # # ]: 0 : aBulColorFT( this, CUI_RES(FT_BUL_COLOR)),
1095 [ # # ]: 0 : aBulColLB( this, CUI_RES(LB_BUL_COLOR)),
1096 [ # # ]: 0 : aBulRelSizeFT( this, CUI_RES(FT_BUL_REL_SIZE)),
1097 [ # # ]: 0 : aBulRelSizeMF( this, CUI_RES(MF_BUL_REL_SIZE)),
1098 [ # # ]: 0 : aAllLevelFT( this, CUI_RES(FT_ALL_LEVEL)),
1099 [ # # ]: 0 : aAllLevelNF( this, CUI_RES(NF_ALL_LEVEL)),
1100 [ # # ]: 0 : aStartFT( this, CUI_RES(FT_START )),
1101 [ # # ]: 0 : aStartED( this, CUI_RES(ED_START )),
1102 [ # # ]: 0 : aBulletPB( this, CUI_RES(PB_BULLET )),
1103 [ # # ]: 0 : aAlignFT( this, CUI_RES(FT_ALIGN )),
1104 [ # # ]: 0 : aAlignLB( this, CUI_RES(LB_ALIGN )),
1105 [ # # ]: 0 : aBitmapFT( this, CUI_RES(FT_BITMAP )),
1106 [ # # ]: 0 : aBitmapMB( this, CUI_RES(MB_BITMAP )),
1107 [ # # ]: 0 : aSizeFT( this, CUI_RES(FT_SIZE )),
1108 [ # # ]: 0 : aWidthMF( this, CUI_RES(MF_WIDTH )),
1109 [ # # ]: 0 : aMultFT( this, CUI_RES(FT_MULT )),
1110 [ # # ]: 0 : aHeightMF( this, CUI_RES(MF_HEIGHT )),
1111 [ # # ]: 0 : aRatioCB( this, CUI_RES(CB_RATIO )),
1112 [ # # ]: 0 : aOrientFT( this, CUI_RES(FT_ORIENT )),
1113 [ # # ]: 0 : aOrientLB( this, CUI_RES(LB_ORIENT )),
1114 [ # # ]: 0 : aSameLevelFL( this, CUI_RES(FL_SAME_LEVEL)),
1115 [ # # ]: 0 : aSameLevelCB( this, CUI_RES(CB_SAME_LEVEL)),
1116 [ # # ][ # # ]: 0 : pPreviewWIN( new SvxNumberingPreview(this, CUI_RES(WIN_PREVIEW ))),
1117 : : pActNum(0),
1118 : : pSaveNum(0),
1119 : : bLastWidthModified(sal_False),
1120 : : bModified(sal_False),
1121 : : bPreset(sal_False),
1122 : : bAutomaticCharStyles(sal_True),
1123 : : bHTMLMode(sal_False),
1124 : : bMenuButtonInitialized(sal_False),
1125 [ # # ]: 0 : sBullet(CUI_RES(STR_BULLET)),
1126 : : nBullet(0xff),
1127 : : nActNumLvl(USHRT_MAX),
1128 [ # # ][ # # ]: 0 : nNumItemId(SID_ATTR_NUMBERING_RULE)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1129 : : {
1130 [ # # ][ # # ]: 0 : sStartWith = aStartFT.GetText();
[ # # ]
1131 [ # # ][ # # ]: 0 : pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
[ # # ]
1132 : 0 : SetExchangeSupport();
1133 [ # # ][ # # ]: 0 : aActBulletFont = lcl_GetDefaultBulletFont();
1134 : :
1135 [ # # ]: 0 : aBulletPB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl));
1136 [ # # ]: 0 : aFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl));
1137 [ # # ]: 0 : aBitmapMB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, GraphicHdl_Impl));
1138 [ # # ]: 0 : aLevelLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, LevelHdl_Impl));
1139 [ # # ]: 0 : aCharFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, CharFmtHdl_Impl));
1140 [ # # ]: 0 : aWidthMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
1141 [ # # ]: 0 : aHeightMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
1142 [ # # ]: 0 : aRatioCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, RatioHdl_Impl));
1143 [ # # ]: 0 : aStartED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1144 [ # # ]: 0 : aPrefixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1145 [ # # ]: 0 : aSuffixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1146 [ # # ]: 0 : aAllLevelNF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, AllLevelHdl_Impl));
1147 [ # # ]: 0 : aOrientLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, OrientHdl_Impl));
1148 [ # # ]: 0 : aSameLevelCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl));
1149 [ # # ]: 0 : aBulRelSizeMF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl));
1150 [ # # ]: 0 : aBulColLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, BulColorHdl_Impl));
1151 [ # # ]: 0 : aInvalidateTimer.SetTimeoutHdl(LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl));
1152 [ # # ]: 0 : aInvalidateTimer.SetTimeout(50);
1153 : :
1154 [ # # ]: 0 : aBitmapMB.GetPopupMenu()->SetHighlightHdl(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl));
1155 [ # # ][ # # ]: 0 : PopupMenu* pPopup = new PopupMenu;
1156 [ # # ]: 0 : aBitmapMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
1157 : :
1158 [ # # ][ # # ]: 0 : pPopup->InsertItem( NUM_NO_GRAPHIC, String(CUI_RES(ST_POPUP_EMPTY_ENTRY)) );
[ # # ][ # # ]
1159 [ # # ]: 0 : pPopup->EnableItem( NUM_NO_GRAPHIC, sal_False );
1160 : :
1161 [ # # ][ # # ]: 0 : eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
1162 : :
1163 [ # # ]: 0 : aBitmapMB.SetAccessibleRelationLabeledBy( &aBitmapFT );
1164 : :
1165 [ # # ]: 0 : FreeResource();
1166 : :
1167 : : // Get advanced numbering types from the component.
1168 : : // Watch out for the ugly 0x88/*SVX_NUM_BITMAP|0x80*/ to not remove that.
1169 [ # # ]: 0 : GetI18nNumbering( aFmtLB, (SVX_NUM_BITMAP | 0x80));
1170 : :
1171 [ # # ]: 0 : aBulletPB.SetAccessibleRelationMemberOf(&aFormatFL);
1172 [ # # ]: 0 : aBulletPB.SetAccessibleRelationLabeledBy(&aStartFT);
1173 [ # # ][ # # ]: 0 : aBulletPB.SetAccessibleName(aStartFT.GetText());
[ # # ]
1174 : 0 : }
1175 : :
1176 [ # # ][ # # ]: 0 : SvxNumOptionsTabPage::~SvxNumOptionsTabPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1177 : : {
1178 [ # # ][ # # ]: 0 : delete aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
[ # # ]
1179 [ # # ][ # # ]: 0 : delete pActNum;
1180 [ # # ][ # # ]: 0 : delete pPreviewWIN;
1181 [ # # ][ # # ]: 0 : delete pSaveNum;
1182 [ # # ]: 0 : }
1183 : :
1184 : 0 : void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric)
1185 : : {
1186 [ # # ]: 0 : if(eMetric == FUNIT_MM)
1187 : : {
1188 : 0 : aWidthMF .SetDecimalDigits(1);
1189 : 0 : aHeightMF .SetDecimalDigits(1);
1190 : : }
1191 : 0 : aWidthMF .SetUnit( eMetric );
1192 : 0 : aHeightMF .SetUnit( eMetric );
1193 : 0 : }
1194 : :
1195 : 0 : SfxTabPage* SvxNumOptionsTabPage::Create( Window* pParent,
1196 : : const SfxItemSet& rAttrSet)
1197 : : {
1198 [ # # ]: 0 : return new SvxNumOptionsTabPage(pParent, rAttrSet);
1199 : : };
1200 : :
1201 : 0 : void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet)
1202 : : {
1203 : : const SfxPoolItem* pItem;
1204 : 0 : const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
1205 : 0 : sal_uInt16 nTmpNumLvl = USHRT_MAX;
1206 [ # # ]: 0 : if(pExampleSet)
1207 : : {
1208 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
1209 : 0 : bPreset = ((const SfxBoolItem*)pItem)->GetValue();
1210 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
1211 : 0 : nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
1212 : : }
1213 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
1214 : : {
1215 [ # # ][ # # ]: 0 : delete pSaveNum;
1216 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
1217 : : }
1218 : : //
1219 [ # # ][ # # ]: 0 : bModified = (!pActNum->Get( 0 ) || bPreset);
[ # # ]
1220 [ # # ][ # # ]: 0 : if(*pActNum != *pSaveNum ||
[ # # ][ # # ]
1221 : : nActNumLvl != nTmpNumLvl)
1222 : : {
1223 : 0 : nActNumLvl = nTmpNumLvl;
1224 : 0 : sal_uInt16 nMask = 1;
1225 [ # # ]: 0 : aLevelLB.SetUpdateMode(sal_False);
1226 [ # # ]: 0 : aLevelLB.SetNoSelection();
1227 [ # # ]: 0 : aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX);
1228 [ # # ]: 0 : if(nActNumLvl != USHRT_MAX)
1229 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1230 : : {
1231 [ # # ]: 0 : if(nActNumLvl & nMask)
1232 [ # # ]: 0 : aLevelLB.SelectEntryPos( i, sal_True);
1233 : 0 : nMask <<= 1 ;
1234 : : }
1235 [ # # ]: 0 : aLevelLB.SetUpdateMode(sal_True);
1236 [ # # ]: 0 : *pActNum = *pSaveNum;
1237 [ # # ]: 0 : InitControls();
1238 : : }
1239 : :
1240 : 0 : }
1241 : :
1242 : 0 : int SvxNumOptionsTabPage::DeactivatePage(SfxItemSet * _pSet)
1243 : : {
1244 [ # # ]: 0 : if(_pSet)
1245 : 0 : FillItemSet(*_pSet);
1246 : 0 : return sal_True;
1247 : : }
1248 : :
1249 : 0 : sal_Bool SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet )
1250 : : {
1251 [ # # ]: 0 : rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
1252 [ # # ][ # # ]: 0 : if(bModified && pActNum)
1253 : : {
1254 : 0 : *pSaveNum = *pActNum;
1255 [ # # ]: 0 : rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
1256 [ # # ]: 0 : rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, sal_False));
1257 : : }
1258 : 0 : return bModified;
1259 : : };
1260 : :
1261 : 0 : void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet )
1262 : : {
1263 : : const SfxPoolItem* pItem;
1264 : : // in Draw the item exists as WhichId, in Writer only as SlotId
1265 [ # # ]: 0 : SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
1266 [ # # ]: 0 : if(eState != SFX_ITEM_SET)
1267 : : {
1268 [ # # ]: 0 : nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
1269 [ # # ]: 0 : eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
1270 : :
1271 [ # # ]: 0 : if( eState != SFX_ITEM_SET )
1272 : : {
1273 [ # # ]: 0 : pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
1274 : 0 : eState = SFX_ITEM_SET;
1275 : : }
1276 : :
1277 : : }
1278 : : DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
1279 [ # # ][ # # ]: 0 : delete pSaveNum;
1280 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
1281 : :
1282 : : // insert levels
1283 [ # # ][ # # ]: 0 : if(!aLevelLB.GetEntryCount())
1284 : : {
1285 [ # # ]: 0 : for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++)
1286 [ # # ][ # # ]: 0 : aLevelLB.InsertEntry( UniString::CreateFromInt32(i));
[ # # ]
1287 [ # # ]: 0 : if(pSaveNum->GetLevelCount() > 1)
1288 : : {
1289 [ # # ]: 0 : String sEntry(rtl::OUString("1 - "));
1290 [ # # ][ # # ]: 0 : sEntry += UniString::CreateFromInt32( pSaveNum->GetLevelCount() );
[ # # ]
1291 [ # # ]: 0 : aLevelLB.InsertEntry(sEntry);
1292 [ # # ][ # # ]: 0 : aLevelLB.SelectEntry(sEntry);
1293 : : }
1294 : : else
1295 [ # # ]: 0 : aLevelLB.SelectEntryPos(0);
1296 : : }
1297 : : else
1298 [ # # ][ # # ]: 0 : aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1);
1299 : :
1300 : 0 : sal_uInt16 nMask = 1;
1301 [ # # ]: 0 : aLevelLB.SetUpdateMode(sal_False);
1302 [ # # ]: 0 : aLevelLB.SetNoSelection();
1303 [ # # ]: 0 : if(nActNumLvl == USHRT_MAX)
1304 : : {
1305 [ # # ]: 0 : aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), sal_True);
1306 : : }
1307 : : else
1308 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++)
1309 : : {
1310 [ # # ]: 0 : if(nActNumLvl & nMask)
1311 [ # # ]: 0 : aLevelLB.SelectEntryPos( i, sal_True);
1312 : 0 : nMask <<= 1 ;
1313 : : }
1314 [ # # ]: 0 : aLevelLB.SetUpdateMode(sal_True);
1315 : :
1316 [ # # ]: 0 : if(!pActNum)
1317 [ # # ][ # # ]: 0 : pActNum = new SvxNumRule(*pSaveNum);
1318 [ # # ][ # # ]: 0 : else if(*pSaveNum != *pActNum)
1319 [ # # ]: 0 : *pActNum = *pSaveNum;
1320 [ # # ]: 0 : pPreviewWIN->SetNumRule(pActNum);
1321 [ # # ]: 0 : aSameLevelCB.Check(pActNum->IsContinuousNumbering());
1322 : :
1323 : : // fill ColorListBox as needed
1324 [ # # ]: 0 : if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) )
1325 : : {
1326 [ # # ]: 0 : SfxObjectShell* pDocSh = SfxObjectShell::Current();
1327 : : DBG_ASSERT( pDocSh, "DocShell not found!" );
1328 : 0 : XColorListRef pColorTable;
1329 [ # # ]: 0 : if ( pDocSh )
1330 : : {
1331 [ # # ]: 0 : pItem = pDocSh->GetItem( SID_COLOR_TABLE );
1332 [ # # ]: 0 : if ( pItem )
1333 [ # # ][ # # ]: 0 : pColorTable = ( (SvxColorListItem*)pItem )->GetColorList();
1334 : : }
1335 : :
1336 [ # # ]: 0 : if ( !pColorTable.is() )
1337 [ # # ][ # # ]: 0 : pColorTable = XColorList::CreateStdColorList();
1338 : :
1339 [ # # ][ # # ]: 0 : aBulColLB.InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC ));
[ # # ][ # # ]
[ # # ]
1340 : :
1341 [ # # ][ # # ]: 0 : for ( long i = 0; i < pColorTable->Count(); i++ )
1342 : : {
1343 [ # # ]: 0 : XColorEntry* pEntry = pColorTable->GetColor(i);
1344 [ # # ]: 0 : aBulColLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
1345 : 0 : }
1346 : : }
1347 : :
1348 : : SfxObjectShell* pShell;
1349 [ # # ][ # # ]: 0 : if ( SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False, &pItem )
[ # # ][ # # ]
[ # # ][ # # ]
1350 : : || ( 0 != ( pShell = SfxObjectShell::Current()) &&
1351 [ # # ]: 0 : 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) )
1352 : : {
1353 : 0 : sal_uInt16 nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
1354 : 0 : bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON);
1355 : : }
1356 : :
1357 : 0 : sal_Bool bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE);
1358 [ # # ]: 0 : aCharFmtFT.Show(bCharFmt);
1359 [ # # ]: 0 : aCharFmtLB.Show(bCharFmt);
1360 : :
1361 : 0 : sal_Bool bContinuous = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
1362 : :
1363 [ # # ][ # # ]: 0 : sal_Bool bAllLevel = bContinuous && !bHTMLMode;
1364 [ # # ]: 0 : aAllLevelFT.Show(bAllLevel);
1365 [ # # ]: 0 : aAllLevelNF.Show(bAllLevel);
1366 : :
1367 [ # # ]: 0 : aSameLevelFL.Show(bContinuous);
1368 [ # # ]: 0 : aSameLevelCB.Show(bContinuous);
1369 : : // again misusage: in Draw there is numeration only until the bitmap
1370 : : // without SVX_NUM_NUMBER_NONE
1371 : : //remove types that are unsupported by Draw/Impress
1372 [ # # ]: 0 : if(!bContinuous)
1373 : : {
1374 [ # # ]: 0 : sal_uInt16 nFmtCount = aFmtLB.GetEntryCount();
1375 [ # # ]: 0 : for(sal_uInt16 i = nFmtCount; i; i--)
1376 : : {
1377 [ # # ]: 0 : sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData(i - 1);
1378 [ # # ]: 0 : if(/*SVX_NUM_NUMBER_NONE == nEntryData ||*/
1379 : : ((SVX_NUM_BITMAP|LINK_TOKEN) == nEntryData))
1380 [ # # ]: 0 : aFmtLB.RemoveEntry(i - 1);
1381 : : }
1382 : : }
1383 : : //one must be enabled
1384 [ # # ]: 0 : if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP))
1385 : : {
1386 : 0 : long nData = SVX_NUM_BITMAP|LINK_TOKEN;
1387 [ # # ]: 0 : sal_uInt16 nPos = aFmtLB.GetEntryPos((void*)nData);
1388 [ # # ]: 0 : if(LISTBOX_ENTRY_NOTFOUND != nPos)
1389 [ # # ]: 0 : aFmtLB.RemoveEntry(nPos);
1390 : : }
1391 [ # # ]: 0 : else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP))
1392 : : {
1393 : 0 : long nData = SVX_NUM_BITMAP;
1394 [ # # ]: 0 : sal_uInt16 nPos = aFmtLB.GetEntryPos((void*)nData);
1395 [ # # ]: 0 : if(LISTBOX_ENTRY_NOTFOUND != nPos)
1396 [ # # ]: 0 : aFmtLB.RemoveEntry(nPos);
1397 : : }
1398 [ # # ]: 0 : if(pActNum->IsFeatureSupported(NUM_SYMBOL_ALIGNMENT))
1399 : : {
1400 [ # # ]: 0 : aAlignFT.Show();
1401 [ # # ]: 0 : aAlignLB.Show();
1402 [ # # ]: 0 : Size aSz(aFormatFL.GetSizePixel());
1403 [ # # ]: 0 : aSz.Height() = aLevelFT.GetSizePixel().Height();
1404 [ # # ]: 0 : aFormatFL.SetSizePixel(aSz);
1405 [ # # ]: 0 : aAlignLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1406 : : }
1407 : :
1408 : : // MegaHack: because of a not-fixable 'design mistake/error' in Impress
1409 : : // delete all kinds of numeric enumerations
1410 [ # # ]: 0 : if(pActNum->IsFeatureSupported(NUM_NO_NUMBERS))
1411 : : {
1412 [ # # ]: 0 : sal_uInt16 nFmtCount = aFmtLB.GetEntryCount();
1413 [ # # ]: 0 : for(sal_uInt16 i = nFmtCount; i; i--)
1414 : : {
1415 [ # # ]: 0 : sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData(i - 1);
1416 [ # # ]: 0 : if( /*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/ nEntryData <= SVX_NUM_NUMBER_NONE)
1417 [ # # ]: 0 : aFmtLB.RemoveEntry(i - 1);
1418 : : }
1419 : : }
1420 : :
1421 [ # # ]: 0 : InitControls();
1422 : 0 : bModified = sal_False;
1423 : :
1424 : 0 : }
1425 : :
1426 : 0 : void SvxNumOptionsTabPage::InitControls()
1427 : : {
1428 : 0 : sal_Bool bShowBullet = sal_True;
1429 : 0 : sal_Bool bShowBitmap = sal_True;
1430 : 0 : sal_Bool bSameType = sal_True;
1431 : 0 : sal_Bool bSameStart = sal_True;
1432 : 0 : sal_Bool bSamePrefix = sal_True;
1433 : 0 : sal_Bool bSameSuffix = sal_True;
1434 : 0 : sal_Bool bAllLevel = sal_True;
1435 : 0 : sal_Bool bSameCharFmt = sal_True;
1436 : 0 : sal_Bool bSameVOrient = sal_True;
1437 : 0 : sal_Bool bSameSize = sal_True;
1438 : 0 : sal_Bool bSameBulColor = sal_True;
1439 : 0 : sal_Bool bSameBulRelSize= sal_True;
1440 : 0 : sal_Bool bSameAdjust = sal_True;
1441 : :
1442 : : const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
1443 [ # # ]: 0 : String sFirstCharFmt;
1444 : 0 : sal_Int16 eFirstOrient = text::VertOrientation::NONE;
1445 : 0 : Size aFirstSize(0,0);
1446 : 0 : sal_uInt16 nMask = 1;
1447 : 0 : sal_uInt16 nLvl = USHRT_MAX;
1448 : 0 : sal_uInt16 nHighestLevel = 0;
1449 [ # # ]: 0 : String aEmptyStr;
1450 : :
1451 : 0 : sal_Bool bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR);
1452 : 0 : sal_Bool bBullRelSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE);
1453 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1454 : : {
1455 [ # # ]: 0 : if(nActNumLvl & nMask)
1456 : : {
1457 [ # # ]: 0 : aNumFmtArr[i] = &pActNum->GetLevel(i);
1458 : 0 : bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
1459 : 0 : bShowBitmap &= (aNumFmtArr[i]->GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP;
1460 [ # # ]: 0 : if(USHRT_MAX == nLvl)
1461 : : {
1462 : 0 : nLvl = i;
1463 [ # # ][ # # ]: 0 : sFirstCharFmt = aNumFmtArr[i]->GetCharFmtName();
1464 [ # # ]: 0 : eFirstOrient = aNumFmtArr[i]->GetVertOrient();
1465 [ # # ]: 0 : if(bShowBitmap)
1466 : 0 : aFirstSize = aNumFmtArr[i]->GetGraphicSize();
1467 : : }
1468 [ # # ]: 0 : if( i > nLvl)
1469 : : {
1470 : 0 : bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[nLvl]->GetNumberingType();
1471 : 0 : bSameStart = aNumFmtArr[i]->GetStart() == aNumFmtArr[nLvl]->GetStart();
1472 : :
1473 : 0 : bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix();
1474 : 0 : bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix();
1475 : 0 : bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels();
1476 [ # # ][ # # ]: 0 : bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFmtName();
1477 [ # # ]: 0 : bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient();
1478 [ # # ][ # # ]: 0 : if(bShowBitmap && bSameSize)
1479 : 0 : bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize;
1480 : 0 : bSameBulColor &= aNumFmtArr[i]->GetBulletColor() == aNumFmtArr[nLvl]->GetBulletColor();
1481 : 0 : bSameBulRelSize &= aNumFmtArr[i]->GetBulletRelSize() == aNumFmtArr[nLvl]->GetBulletRelSize();
1482 : 0 : bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
1483 : : }
1484 : 0 : nHighestLevel = i;
1485 : : }
1486 : : else
1487 : 0 : aNumFmtArr[i] = 0;
1488 : :
1489 : 0 : nMask <<= 1 ;
1490 : :
1491 : : }
1492 [ # # ][ # # ]: 0 : SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0);
[ # # ]
1493 [ # # ]: 0 : CheckForStartValue_Impl(aNumFmtArr[nLvl]->GetNumberingType());
1494 [ # # ]: 0 : if(bShowBitmap)
1495 : : {
1496 [ # # ][ # # ]: 0 : if(!bSameVOrient || eFirstOrient == text::VertOrientation::NONE)
1497 [ # # ]: 0 : aOrientLB.SetNoSelection();
1498 : : else
1499 : : aOrientLB.SelectEntryPos(
1500 [ # # ]: 0 : sal::static_int_cast< sal_uInt16 >(eFirstOrient - 1));
1501 : : // no text::VertOrientation::NONE
1502 : :
1503 [ # # ]: 0 : if(bSameSize)
1504 : : {
1505 [ # # ]: 0 : SetMetricValue(aHeightMF, aFirstSize.Height(), eCoreUnit);
1506 [ # # ]: 0 : SetMetricValue(aWidthMF, aFirstSize.Width(), eCoreUnit);
1507 : : }
1508 : : else
1509 : : {
1510 [ # # ]: 0 : aHeightMF.SetText(aEmptyStr);
1511 [ # # ]: 0 : aWidthMF.SetText(aEmptyStr);
1512 : : }
1513 : : }
1514 : :
1515 [ # # ]: 0 : if(bSameType)
1516 : : {
1517 : 0 : sal_uInt16 nLBData = (sal_uInt16) aNumFmtArr[nLvl]->GetNumberingType();
1518 [ # # ][ # # ]: 0 : aFmtLB.SelectEntryPos(aFmtLB.GetEntryPos( (void*)sal::static_int_cast<sal_uIntPtr>( nLBData ) ));
1519 : : }
1520 : : else
1521 [ # # ]: 0 : aFmtLB.SetNoSelection();
1522 : :
1523 [ # # ][ # # ]: 0 : aAllLevelNF.Enable(nHighestLevel > 0 && !aSameLevelCB.IsChecked());
[ # # ][ # # ]
1524 [ # # ]: 0 : aAllLevelNF.SetMax(nHighestLevel + 1);
1525 [ # # ]: 0 : if(bAllLevel)
1526 : : {
1527 [ # # ]: 0 : aAllLevelNF.SetValue(aNumFmtArr[nLvl]->GetIncludeUpperLevels());
1528 : : }
1529 : : else
1530 : : {
1531 [ # # ]: 0 : aAllLevelNF.SetText(aEmptyStr);
1532 : : }
1533 [ # # ]: 0 : if(bSameAdjust)
1534 : : {
1535 : 0 : sal_uInt16 nPos = 1; // centered
1536 [ # # ]: 0 : if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
1537 : 0 : nPos = 0;
1538 [ # # ]: 0 : else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
1539 : 0 : nPos = 2;
1540 [ # # ]: 0 : aAlignLB.SelectEntryPos(nPos);
1541 : : }
1542 : : else
1543 : : {
1544 [ # # ]: 0 : aAlignLB.SetNoSelection();
1545 : : }
1546 : :
1547 [ # # ]: 0 : if(bBullRelSize)
1548 : : {
1549 [ # # ]: 0 : if(bSameBulRelSize)
1550 [ # # ]: 0 : aBulRelSizeMF.SetValue(aNumFmtArr[nLvl]->GetBulletRelSize());
1551 : : else
1552 [ # # ]: 0 : aBulRelSizeMF.SetText(aEmptyStr);
1553 : : }
1554 [ # # ]: 0 : if(bBullColor)
1555 : : {
1556 [ # # ]: 0 : if(bSameBulColor)
1557 [ # # ]: 0 : aBulColLB.SelectEntry(aNumFmtArr[nLvl]->GetBulletColor());
1558 : : else
1559 [ # # ]: 0 : aBulColLB.SetNoSelection();
1560 : : }
1561 [ # # # # ]: 0 : switch(nBullet)
1562 : : {
1563 : : case SHOW_NUMBERING:
1564 [ # # ]: 0 : if(bSameStart)
1565 : : {
1566 [ # # ]: 0 : aStartED.SetValue(aNumFmtArr[nLvl]->GetStart());
1567 : : }
1568 : : else
1569 [ # # ]: 0 : aStartED.SetText(aEmptyStr);
1570 : 0 : break;
1571 : : case SHOW_BULLET:
1572 : 0 : break;
1573 : : case SHOW_BITMAP:
1574 : 0 : break;
1575 : : }
1576 : :
1577 [ # # ]: 0 : if(bSamePrefix)
1578 [ # # ][ # # ]: 0 : aPrefixED.SetText(aNumFmtArr[nLvl]->GetPrefix());
[ # # ]
1579 : : else
1580 [ # # ]: 0 : aPrefixED.SetText(aEmptyStr);
1581 [ # # ]: 0 : if(bSameSuffix)
1582 [ # # ][ # # ]: 0 : aSuffixED.SetText(aNumFmtArr[nLvl]->GetSuffix());
[ # # ]
1583 : : else
1584 [ # # ]: 0 : aSuffixED.SetText(aEmptyStr);
1585 : :
1586 [ # # ]: 0 : if(bSameCharFmt)
1587 : : {
1588 [ # # ]: 0 : if(sFirstCharFmt.Len())
1589 [ # # ]: 0 : aCharFmtLB.SelectEntry(sFirstCharFmt);
1590 : : else
1591 [ # # ]: 0 : aCharFmtLB.SelectEntryPos( 0 );
1592 : : }
1593 : : else
1594 [ # # ]: 0 : aCharFmtLB.SetNoSelection();
1595 : :
1596 : 0 : pPreviewWIN->SetLevel(nActNumLvl);
1597 [ # # ][ # # ]: 0 : pPreviewWIN->Invalidate();
[ # # ]
1598 : 0 : }
1599 : :
1600 : : // 0 - Number; 1 - Bullet; 2 - Bitmap
1601 : 0 : void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 nType, sal_Bool )
1602 : : {
1603 [ # # ]: 0 : if(nBullet == nType)
1604 : 0 : return;
1605 : 0 : nBullet = nType;
1606 : 0 : sal_Bool bBitmap = sal_False;
1607 : 0 : sal_Bool bBullet = sal_False;
1608 : 0 : sal_Bool bEnableBitmap = sal_False;
1609 [ # # ]: 0 : if(nType == SHOW_NUMBERING)
1610 : : {
1611 : : // switch label, memorize old text
1612 : 0 : aStartFT.SetText(sStartWith);
1613 : :
1614 : : }
1615 [ # # ]: 0 : else if(nType == SHOW_BULLET)
1616 : : {
1617 : : // switch label, memorize old text
1618 : 0 : aStartFT.SetText(sBullet);
1619 : 0 : bBullet = sal_True;
1620 : : }
1621 : : else
1622 : : {
1623 : 0 : bBitmap = sal_True;
1624 : 0 : bEnableBitmap = sal_True;
1625 : : }
1626 [ # # ][ # # ]: 0 : sal_Bool bNumeric = !(bBitmap||bBullet);
1627 : 0 : aPrefixFT.Show(bNumeric);
1628 : 0 : aPrefixED.Show(bNumeric);
1629 : 0 : aSuffixFT.Show(bNumeric);
1630 : 0 : aSuffixED.Show(bNumeric);
1631 : :
1632 : 0 : sal_Bool bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE);
1633 [ # # ][ # # ]: 0 : aCharFmtFT.Show(!bBitmap && bCharFmt);
1634 [ # # ][ # # ]: 0 : aCharFmtLB.Show(!bBitmap && bCharFmt);
1635 : :
1636 : : // this is rather misusage, as there is no own flag
1637 : : // for complete numeration
1638 : 0 : sal_Bool bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
1639 [ # # ][ # # ]: 0 : sal_Bool bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode;
[ # # ]
1640 : 0 : aAllLevelFT.Show(bAllLevel);
1641 : 0 : aAllLevelNF.Show(bAllLevel);
1642 : :
1643 : 0 : aStartFT.Show(!bBitmap);
1644 [ # # ][ # # ]: 0 : aStartED.Show(!(bBullet||bBitmap));
1645 : :
1646 : 0 : aBulletPB.Show(bBullet);
1647 : 0 : sal_Bool bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR);
1648 [ # # ][ # # ]: 0 : aBulColorFT.Show( !bBitmap && bBullColor );
1649 [ # # ][ # # ]: 0 : aBulColLB.Show( !bBitmap && bBullColor );
1650 : 0 : sal_Bool bBullResSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE);
1651 [ # # ][ # # ]: 0 : aBulRelSizeFT.Show( !bBitmap && bBullResSize );
1652 [ # # ][ # # ]: 0 : aBulRelSizeMF.Show( !bBitmap && bBullResSize );
1653 : :
1654 : 0 : aBitmapFT .Show(bBitmap);
1655 : 0 : aBitmapMB .Show(bBitmap);
1656 : :
1657 : 0 : aSizeFT .Show(bBitmap);
1658 : 0 : aWidthMF .Show(bBitmap);
1659 : 0 : aMultFT .Show(bBitmap);
1660 : 0 : aHeightMF .Show(bBitmap);
1661 : 0 : aRatioCB .Show(bBitmap);
1662 : :
1663 [ # # ][ # # ]: 0 : aOrientFT .Show(bBitmap && bAllLevelFeature);
1664 [ # # ][ # # ]: 0 : aOrientLB .Show(bBitmap && bAllLevelFeature);
1665 : :
1666 : 0 : aSizeFT .Enable(bEnableBitmap);
1667 : 0 : aWidthMF .Enable(bEnableBitmap);
1668 : 0 : aMultFT .Enable(bEnableBitmap);
1669 : 0 : aHeightMF .Enable(bEnableBitmap);
1670 : 0 : aRatioCB .Enable(bEnableBitmap);
1671 : 0 : aOrientFT .Enable(bEnableBitmap);
1672 : 0 : aOrientLB .Enable(bEnableBitmap);
1673 : :
1674 : : }
1675 : :
1676 : 0 : IMPL_LINK( SvxNumOptionsTabPage, LevelHdl_Impl, ListBox *, pBox )
1677 : : {
1678 : 0 : sal_uInt16 nSaveNumLvl = nActNumLvl;
1679 : 0 : nActNumLvl = 0;
1680 [ # # # # ]: 0 : if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) &&
[ # # ][ # # ]
1681 : 0 : (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
1682 : : {
1683 : 0 : nActNumLvl = 0xFFFF;
1684 : 0 : pBox->SetUpdateMode(sal_False);
1685 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
1686 : 0 : pBox->SelectEntryPos( i, sal_False );
1687 : 0 : pBox->SetUpdateMode(sal_True);
1688 : : }
1689 [ # # ]: 0 : else if(pBox->GetSelectEntryCount())
1690 : : {
1691 : 0 : sal_uInt16 nMask = 1;
1692 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
1693 : : {
1694 [ # # ]: 0 : if(pBox->IsEntryPosSelected( i ))
1695 : 0 : nActNumLvl |= nMask;
1696 : 0 : nMask <<= 1;
1697 : : }
1698 : 0 : pBox->SelectEntryPos( pActNum->GetLevelCount(), sal_False );
1699 : : }
1700 : : else
1701 : : {
1702 : 0 : nActNumLvl = nSaveNumLvl;
1703 : 0 : sal_uInt16 nMask = 1;
1704 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
1705 : : {
1706 [ # # ]: 0 : if(nActNumLvl & nMask)
1707 : : {
1708 : 0 : pBox->SelectEntryPos(i);
1709 : 0 : break;
1710 : : }
1711 : 0 : nMask <<=1;
1712 : : }
1713 : : }
1714 : 0 : InitControls();
1715 : 0 : return 0;
1716 : : }
1717 : :
1718 : 0 : IMPL_LINK_NOARG(SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl)
1719 : : {
1720 : 0 : pPreviewWIN->Invalidate();
1721 : 0 : return 0;
1722 : : }
1723 : :
1724 : 0 : IMPL_LINK( SvxNumOptionsTabPage, AllLevelHdl_Impl, NumericField*, pBox )
1725 : : {
1726 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1727 : : {
1728 : 0 : sal_uInt16 nMask = 1;
1729 [ # # ]: 0 : for(sal_uInt16 e = 0; e < pActNum->GetLevelCount(); e++)
1730 : : {
1731 [ # # ]: 0 : if(nActNumLvl & nMask)
1732 : : {
1733 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(e));
1734 [ # # ][ # # ]: 0 : aNumFmt.SetIncludeUpperLevels((sal_uInt8) std::min(pBox->GetValue(), sal_Int64(e + 1)) );
1735 [ # # ][ # # ]: 0 : pActNum->SetLevel(e, aNumFmt);
1736 : : }
1737 : 0 : nMask <<= 1;
1738 : : }
1739 : : }
1740 : 0 : SetModified();
1741 : 0 : return 0;
1742 : : }
1743 : :
1744 : 0 : IMPL_LINK( SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, ListBox *, pBox )
1745 : : {
1746 [ # # ]: 0 : String sSelectStyle;
1747 : 0 : sal_Bool bShowOrient = sal_False;
1748 : 0 : sal_Bool bBmp = sal_False;
1749 [ # # ]: 0 : String aEmptyStr;
1750 : 0 : sal_uInt16 nMask = 1;
1751 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1752 : : {
1753 [ # # ]: 0 : if(nActNumLvl & nMask)
1754 : : {
1755 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1756 : : // PAGEDESC does not exist
1757 [ # # ][ # # ]: 0 : sal_uInt16 nNumType = (sal_uInt16)(sal_uLong)pBox->GetEntryData(pBox->GetSelectEntryPos());
1758 : 0 : aNumFmt.SetNumberingType((sal_Int16)nNumType);
1759 : 0 : sal_uInt16 nNumberingType = aNumFmt.GetNumberingType();
1760 [ # # ]: 0 : if(SVX_NUM_BITMAP == (nNumberingType&(~LINK_TOKEN)))
1761 : : {
1762 : 0 : bBmp |= 0 != aNumFmt.GetBrush();
1763 : 0 : aNumFmt.SetIncludeUpperLevels( sal_False );
1764 [ # # ]: 0 : aNumFmt.SetSuffix( aEmptyStr );
1765 [ # # ]: 0 : aNumFmt.SetPrefix( aEmptyStr );
1766 [ # # ]: 0 : if(!bBmp)
1767 [ # # ]: 0 : aNumFmt.SetGraphic(aEmptyStr);
1768 [ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
1769 [ # # ]: 0 : SwitchNumberType(SHOW_BITMAP, bBmp );
1770 : 0 : bShowOrient = sal_True;
1771 : : }
1772 [ # # ]: 0 : else if( SVX_NUM_CHAR_SPECIAL == nNumberingType )
1773 : : {
1774 : 0 : aNumFmt.SetIncludeUpperLevels( sal_False );
1775 [ # # ]: 0 : aNumFmt.SetSuffix( aEmptyStr );
1776 [ # # ]: 0 : aNumFmt.SetPrefix( aEmptyStr );
1777 [ # # ]: 0 : if( !aNumFmt.GetBulletFont() )
1778 [ # # ]: 0 : aNumFmt.SetBulletFont(&aActBulletFont);
1779 [ # # ]: 0 : if( !aNumFmt.GetBulletChar() )
1780 : 0 : aNumFmt.SetBulletChar( SVX_DEF_BULLET );
1781 [ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
1782 [ # # ]: 0 : SwitchNumberType(SHOW_BULLET);
1783 : : // allocation of the drawing pattern is automatic
1784 [ # # ]: 0 : if(bAutomaticCharStyles)
1785 : : {
1786 [ # # ]: 0 : sSelectStyle = sBulletCharFmtName;
1787 : : }
1788 : : }
1789 : : else
1790 : : {
1791 [ # # ][ # # ]: 0 : aNumFmt.SetPrefix( aPrefixED.GetText() );
[ # # ]
1792 [ # # ][ # # ]: 0 : aNumFmt.SetSuffix( aSuffixED.GetText() );
[ # # ]
1793 [ # # ]: 0 : SwitchNumberType(SHOW_NUMBERING);
1794 [ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
1795 [ # # ]: 0 : CheckForStartValue_Impl(nNumberingType);
1796 : :
1797 : : // allocation of the drawing pattern is automatic
1798 [ # # ]: 0 : if(bAutomaticCharStyles)
1799 : : {
1800 [ # # ]: 0 : sSelectStyle = sNumCharFmtName;
1801 : : }
1802 [ # # ]: 0 : }
1803 : : }
1804 : 0 : nMask <<= 1;
1805 : : }
1806 : 0 : sal_Bool bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
1807 [ # # ][ # # ]: 0 : if(bShowOrient && bAllLevelFeature)
1808 : : {
1809 [ # # ]: 0 : aOrientFT.Show();
1810 [ # # ]: 0 : aOrientLB.Show();
1811 : : }
1812 : : else
1813 : : {
1814 [ # # ]: 0 : aOrientFT.Hide();
1815 [ # # ]: 0 : aOrientLB.Hide();
1816 : : }
1817 [ # # ]: 0 : SetModified();
1818 [ # # ]: 0 : if(sSelectStyle.Len())
1819 : : {
1820 [ # # ]: 0 : aCharFmtLB.SelectEntry(sSelectStyle);
1821 [ # # ]: 0 : CharFmtHdl_Impl(&aCharFmtLB);
1822 : 0 : bAutomaticCharStyles = sal_True;
1823 : : }
1824 [ # # ][ # # ]: 0 : return 0;
1825 : : }
1826 : :
1827 : 0 : void SvxNumOptionsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
1828 : : {
1829 : 0 : sal_Bool bIsNull = aStartED.GetValue() == 0;
1830 : : sal_Bool bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC ||
1831 : : SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType ||
1832 [ # # ][ # # ]: 0 : SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType;
[ # # ]
1833 [ # # ]: 0 : aStartED.SetMin(bNoZeroAllowed ? 1 : 0);
1834 [ # # ][ # # ]: 0 : if(bIsNull && bNoZeroAllowed)
1835 : 0 : aStartED.GetModifyHdl().Call(&aStartED);
1836 : 0 : }
1837 : :
1838 : 0 : IMPL_LINK( SvxNumOptionsTabPage, OrientHdl_Impl, ListBox *, pBox )
1839 : : {
1840 : 0 : sal_uInt16 nPos = pBox->GetSelectEntryPos();
1841 : 0 : nPos ++; // no VERT_NONE
1842 : :
1843 : 0 : sal_uInt16 nMask = 1;
1844 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1845 : : {
1846 [ # # ]: 0 : if(nActNumLvl & nMask)
1847 : : {
1848 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1849 [ # # ]: 0 : if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
1850 : : {
1851 : 0 : const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
1852 : 0 : const Size& rSize = aNumFmt.GetGraphicSize();
1853 : 0 : sal_Int16 eOrient = (sal_Int16)nPos;
1854 [ # # ]: 0 : aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient );
1855 [ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
1856 [ # # ]: 0 : }
1857 : : }
1858 : 0 : nMask <<= 1;
1859 : : }
1860 : 0 : SetModified(sal_False);
1861 : 0 : return 0;
1862 : :
1863 : : }
1864 : :
1865 : 0 : IMPL_LINK( SvxNumOptionsTabPage, SameLevelHdl_Impl, CheckBox *, pBox )
1866 : : {
1867 : 0 : sal_Bool bSet = pBox->IsChecked();
1868 : 0 : pActNum->SetContinuousNumbering(bSet);
1869 : 0 : sal_Bool bRepaint = sal_False;
1870 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1871 : : {
1872 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1873 [ # # ]: 0 : if(aNumFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE)
1874 : : {
1875 : 0 : bRepaint = sal_True;
1876 : : break;
1877 : : }
1878 [ # # ][ # # ]: 0 : }
1879 : 0 : SetModified(bRepaint);
1880 : 0 : InitControls();
1881 : 0 : return 0;
1882 : : }
1883 : :
1884 : 0 : IMPL_LINK( SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox*, pBox )
1885 : : {
1886 [ # # ]: 0 : Color nSetColor = pBox->GetSelectEntryColor();
1887 : :
1888 : 0 : sal_uInt16 nMask = 1;
1889 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1890 : : {
1891 [ # # ]: 0 : if(nActNumLvl & nMask)
1892 : : {
1893 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1894 : 0 : aNumFmt.SetBulletColor(nSetColor);
1895 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
1896 : : }
1897 : 0 : nMask <<= 1;
1898 : : }
1899 [ # # ]: 0 : SetModified();
1900 : 0 : return 0;
1901 : : }
1902 : :
1903 : 0 : IMPL_LINK( SvxNumOptionsTabPage, BulRelSizeHdl_Impl, MetricField *, pField)
1904 : : {
1905 : 0 : sal_uInt16 nRelSize = (sal_uInt16)pField->GetValue();
1906 : :
1907 : 0 : sal_uInt16 nMask = 1;
1908 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1909 : : {
1910 [ # # ]: 0 : if(nActNumLvl & nMask)
1911 : : {
1912 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1913 : 0 : aNumFmt.SetBulletRelSize(nRelSize);
1914 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
1915 : : }
1916 : 0 : nMask <<= 1;
1917 : : }
1918 : 0 : SetModified();
1919 : 0 : return 0;
1920 : : }
1921 : :
1922 : 0 : IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton )
1923 : : {
1924 : 0 : sal_uInt16 nItemId = pButton->GetCurItemId();
1925 [ # # ]: 0 : String aGrfName;
1926 : 0 : Size aSize;
1927 : 0 : sal_Bool bSucc(sal_False);
1928 [ # # ][ # # ]: 0 : SvxOpenGraphicDialog aGrfDlg( CUI_RES(RID_STR_EDIT_GRAPHIC) );
[ # # ][ # # ]
1929 : :
1930 [ # # ]: 0 : if(MN_GALLERY_ENTRY <= nItemId )
1931 : : {
1932 : 0 : sal_uInt16 idx = nItemId - MN_GALLERY_ENTRY;
1933 [ # # ]: 0 : if (idx < aGrfNames.size())
1934 : : {
1935 [ # # ][ # # ]: 0 : aGrfName = aGrfNames[idx];
1936 [ # # ]: 0 : Graphic aGraphic;
1937 [ # # ][ # # ]: 0 : if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, idx, &aGraphic))
1938 : : {
1939 [ # # ]: 0 : aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
1940 : 0 : bSucc = sal_True;
1941 [ # # ]: 0 : }
1942 : : }
1943 : : }
1944 : : else
1945 : : {
1946 [ # # ]: 0 : aGrfDlg.EnableLink( sal_False );
1947 [ # # ]: 0 : aGrfDlg.AsLink( sal_False );
1948 [ # # ][ # # ]: 0 : if ( !aGrfDlg.Execute() )
1949 : : {
1950 : : // memorize selected filter
1951 [ # # ][ # # ]: 0 : aGrfName = aGrfDlg.GetPath();
[ # # ]
1952 : :
1953 [ # # ]: 0 : Graphic aGraphic;
1954 [ # # ][ # # ]: 0 : if( !aGrfDlg.GetGraphic(aGraphic) )
1955 : : {
1956 [ # # ]: 0 : aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
1957 : 0 : bSucc = sal_True;
1958 [ # # ]: 0 : }
1959 : : }
1960 : : }
1961 [ # # ]: 0 : if(bSucc)
1962 : : {
1963 [ # # ][ # # ]: 0 : aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit);
[ # # ][ # # ]
[ # # ]
1964 : :
1965 : 0 : sal_uInt16 nMask = 1;
1966 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1967 : : {
1968 [ # # ]: 0 : if(nActNumLvl & nMask)
1969 : : {
1970 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1971 [ # # ]: 0 : aNumFmt.SetCharFmtName(sNumCharFmtName);
1972 [ # # ]: 0 : aNumFmt.SetGraphic(aGrfName);
1973 : :
1974 : : // set size for a later comparison
1975 : 0 : const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
1976 : : // initiate asynchronous loading
1977 [ # # ]: 0 : sal_Int16 eOrient = aNumFmt.GetVertOrient();
1978 [ # # ]: 0 : aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
1979 : 0 : aInitSize[i] = aNumFmt.GetGraphicSize();
1980 : :
1981 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
1982 : : }
1983 : 0 : nMask <<= 1;
1984 : : }
1985 [ # # ]: 0 : aRatioCB .Enable();
1986 [ # # ]: 0 : aSizeFT .Enable();
1987 [ # # ]: 0 : aMultFT.Enable();
1988 [ # # ]: 0 : aWidthMF .Enable();
1989 [ # # ]: 0 : aHeightMF.Enable();
1990 [ # # ]: 0 : SetMetricValue(aWidthMF, aSize.Width(), eCoreUnit);
1991 [ # # ]: 0 : SetMetricValue(aHeightMF, aSize.Height(), eCoreUnit);
1992 [ # # ]: 0 : aOrientFT.Enable();
1993 [ # # ]: 0 : aOrientLB.Enable();
1994 [ # # ]: 0 : SetModified();
1995 : : //needed due to asynchronous loading of graphics in the SvxBrushItem
1996 [ # # ]: 0 : aInvalidateTimer.Start();
1997 : : }
1998 [ # # ][ # # ]: 0 : return 0;
1999 : : }
2000 : :
2001 : 0 : IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl)
2002 : : {
2003 [ # # ]: 0 : if(!bMenuButtonInitialized)
2004 : : {
2005 : 0 : bMenuButtonInitialized = sal_True;
2006 : 0 : EnterWait();
2007 : 0 : PopupMenu* pPopup = aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
2008 : :
2009 [ # # ]: 0 : if(GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames))
2010 : : {
2011 [ # # ][ # # ]: 0 : pPopup->RemoveItem( pPopup->GetItemPos( NUM_NO_GRAPHIC ));
2012 [ # # ]: 0 : GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
2013 : :
2014 [ # # ]: 0 : Graphic aGraphic;
2015 [ # # ]: 0 : String sGrfName;
2016 [ # # ]: 0 : std::vector<String>::const_iterator it = aGrfNames.begin();
2017 [ # # ][ # # ]: 0 : for(sal_uInt16 i = 0; it != aGrfNames.end(); ++it, ++i)
[ # # ]
2018 : : {
2019 [ # # ][ # # ]: 0 : sGrfName = *it;
2020 [ # # ][ # # ]: 0 : INetURLObject aObj(sGrfName);
2021 [ # # ]: 0 : if(aObj.GetProtocol() == INET_PROT_FILE)
2022 [ # # ][ # # ]: 0 : sGrfName = aObj.PathToFileName();
2023 : :
2024 [ # # ][ # # ]: 0 : if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic))
2025 : : {
2026 [ # # ]: 0 : Bitmap aBitmap(aGraphic.GetBitmap());
2027 [ # # ]: 0 : Size aSize(aBitmap.GetSizePixel());
2028 [ # # # # ]: 0 : if(aSize.Width() > MAX_BMP_WIDTH ||
[ # # ]
2029 : 0 : aSize.Height() > MAX_BMP_HEIGHT)
2030 : : {
2031 : 0 : sal_Bool bWidth = aSize.Width() > aSize.Height();
2032 : : double nScale = bWidth ?
2033 : 0 : (double)MAX_BMP_WIDTH / (double)aSize.Width():
2034 [ # # ]: 0 : (double)MAX_BMP_HEIGHT / (double)aSize.Height();
2035 [ # # ]: 0 : aBitmap.Scale(nScale, nScale);
2036 : : }
2037 [ # # ]: 0 : Image aImage(aBitmap);
2038 : :
2039 [ # # ][ # # ]: 0 : pPopup->InsertItem(MN_GALLERY_ENTRY + i, sGrfName, aImage );
[ # # ]
2040 : : }
2041 : : else
2042 : : {
2043 [ # # ]: 0 : Image aImage;
2044 : : pPopup->InsertItem(
2045 [ # # ][ # # ]: 0 : MN_GALLERY_ENTRY + i, sGrfName, aImage );
2046 : : }
2047 [ # # ]: 0 : }
2048 [ # # ][ # # ]: 0 : GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
[ # # ]
2049 : : }
2050 : 0 : LeaveWait();
2051 : : }
2052 : 0 : return 0;
2053 : : }
2054 : :
2055 : 0 : IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl)
2056 : : {
2057 [ # # ]: 0 : SvxCharacterMap* pMap = new SvxCharacterMap( this, sal_True );
2058 : :
2059 : 0 : sal_uInt16 nMask = 1;
2060 : 0 : const Font* pFmtFont = 0;
2061 : 0 : sal_Bool bSameBullet = sal_True;
2062 : 0 : sal_Unicode cBullet = 0;
2063 : 0 : sal_Bool bFirst = sal_True;
2064 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2065 : : {
2066 [ # # ]: 0 : if(nActNumLvl & nMask)
2067 : : {
2068 : 0 : const SvxNumberFormat& rCurFmt = pActNum->GetLevel(i);
2069 [ # # ]: 0 : if(bFirst)
2070 : : {
2071 : 0 : cBullet = rCurFmt.GetBulletChar();
2072 : : }
2073 [ # # ]: 0 : else if(rCurFmt.GetBulletChar() != cBullet )
2074 : : {
2075 : 0 : bSameBullet = sal_False;
2076 : 0 : break;
2077 : : }
2078 [ # # ]: 0 : if(!pFmtFont)
2079 : 0 : pFmtFont = rCurFmt.GetBulletFont();
2080 : 0 : bFirst = sal_False;
2081 : : }
2082 : 0 : nMask <<= 1;
2083 : :
2084 : : }
2085 : :
2086 [ # # ]: 0 : if(pFmtFont)
2087 : 0 : pMap->SetCharFont(*pFmtFont);
2088 : : else
2089 : 0 : pMap->SetCharFont(aActBulletFont);
2090 [ # # ]: 0 : if(bSameBullet)
2091 : 0 : pMap->SetChar( cBullet );
2092 [ # # ]: 0 : if(pMap->Execute() == RET_OK)
2093 : : {
2094 : : // change Font Numrules
2095 : 0 : aActBulletFont = pMap->GetCharFont();
2096 : :
2097 : 0 : sal_uInt16 _nMask = 1;
2098 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2099 : : {
2100 [ # # ]: 0 : if(nActNumLvl & _nMask)
2101 : : {
2102 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2103 [ # # ]: 0 : aNumFmt.SetBulletFont(&aActBulletFont); ;
2104 [ # # ]: 0 : aNumFmt.SetBulletChar( (sal_Unicode) pMap->GetChar() );
2105 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
2106 : : }
2107 : 0 : _nMask <<= 1;
2108 : : }
2109 : :
2110 : 0 : SetModified();
2111 : : }
2112 [ # # ]: 0 : delete pMap;
2113 : 0 : return 0;
2114 : : }
2115 : :
2116 : 0 : IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, MetricField *, pField)
2117 : : {
2118 : 0 : sal_Bool bWidth = pField == &aWidthMF;
2119 : 0 : bLastWidthModified = bWidth;
2120 : 0 : sal_Bool bRatio = aRatioCB.IsChecked();
2121 : 0 : long nWidthVal = static_cast<long>(aWidthMF.Denormalize(aWidthMF.GetValue(FUNIT_100TH_MM)));
2122 : 0 : long nHeightVal = static_cast<long>(aHeightMF.Denormalize(aHeightMF.GetValue(FUNIT_100TH_MM)));
2123 : : nWidthVal = OutputDevice::LogicToLogic( nWidthVal ,
2124 : 0 : MAP_100TH_MM, (MapUnit)eCoreUnit );
2125 : : nHeightVal = OutputDevice::LogicToLogic( nHeightVal,
2126 : 0 : MAP_100TH_MM, (MapUnit)eCoreUnit);
2127 : : double fSizeRatio;
2128 : :
2129 : 0 : sal_Bool bRepaint = sal_False;
2130 : 0 : sal_uInt16 nMask = 1;
2131 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2132 : : {
2133 [ # # ]: 0 : if(nActNumLvl & nMask)
2134 : : {
2135 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2136 [ # # ]: 0 : if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
2137 : : {
2138 : 0 : Size aSize(aNumFmt.GetGraphicSize() );
2139 : 0 : Size aSaveSize(aSize);
2140 : :
2141 [ # # ]: 0 : if (aInitSize[i].Height())
2142 : 0 : fSizeRatio = (double)aInitSize[i].Width() / (double)aInitSize[i].Height();
2143 : : else
2144 : 0 : fSizeRatio = (double)1;
2145 : :
2146 [ # # ]: 0 : if(bWidth)
2147 : : {
2148 : 0 : long nDelta = nWidthVal - aInitSize[i].Width();
2149 : 0 : aSize.Width() = nWidthVal;
2150 [ # # ]: 0 : if (bRatio)
2151 : : {
2152 : 0 : aSize.Height() = aInitSize[i].Height() + (long)((double)nDelta / fSizeRatio);
2153 : : aHeightMF.SetUserValue(aHeightMF.Normalize(
2154 [ # # ]: 0 : OutputDevice::LogicToLogic( aSize.Height(), (MapUnit)eCoreUnit, MAP_100TH_MM )),
2155 [ # # ][ # # ]: 0 : FUNIT_100TH_MM);
2156 : : }
2157 : : }
2158 : : else
2159 : : {
2160 : 0 : long nDelta = nHeightVal - aInitSize[i].Height();
2161 : 0 : aSize.Height() = nHeightVal;
2162 [ # # ]: 0 : if (bRatio)
2163 : : {
2164 : 0 : aSize.Width() = aInitSize[i].Width() + (long)((double)nDelta * fSizeRatio);
2165 : : aWidthMF.SetUserValue(aWidthMF.Normalize(
2166 [ # # ]: 0 : OutputDevice::LogicToLogic( aSize.Width(), (MapUnit)eCoreUnit, MAP_100TH_MM )),
2167 [ # # ][ # # ]: 0 : FUNIT_100TH_MM);
2168 : : }
2169 : : }
2170 : 0 : const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
2171 [ # # ]: 0 : sal_Int16 eOrient = aNumFmt.GetVertOrient();
2172 [ # # ]: 0 : if(aSize != aSaveSize)
2173 : 0 : bRepaint = sal_True;
2174 [ # # ]: 0 : aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
2175 [ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
2176 [ # # ]: 0 : }
2177 : : }
2178 : 0 : nMask <<= 1;
2179 : : }
2180 : 0 : SetModified(bRepaint);
2181 : 0 : return 0;
2182 : : }
2183 : :
2184 : 0 : IMPL_LINK( SvxNumOptionsTabPage, RatioHdl_Impl, CheckBox *, pBox )
2185 : : {
2186 [ # # ]: 0 : if (pBox->IsChecked())
2187 : : {
2188 [ # # ]: 0 : if (bLastWidthModified)
2189 : 0 : SizeHdl_Impl(&aWidthMF);
2190 : : else
2191 : 0 : SizeHdl_Impl(&aHeightMF);
2192 : : }
2193 : 0 : return 0;
2194 : : }
2195 : :
2196 : 0 : IMPL_LINK_NOARG(SvxNumOptionsTabPage, CharFmtHdl_Impl)
2197 : : {
2198 : 0 : bAutomaticCharStyles = sal_False;
2199 [ # # ]: 0 : sal_uInt16 nEntryPos = aCharFmtLB.GetSelectEntryPos();
2200 [ # # ]: 0 : String sEntry = aCharFmtLB.GetSelectEntry();
2201 : 0 : sal_uInt16 nMask = 1;
2202 [ # # ]: 0 : String aEmptyStr;
2203 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2204 : : {
2205 [ # # ]: 0 : if(nActNumLvl & nMask)
2206 : : {
2207 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2208 [ # # ]: 0 : if( 0 == nEntryPos )
2209 [ # # ]: 0 : aNumFmt.SetCharFmtName(aEmptyStr);
2210 : : else
2211 : : {
2212 [ # # ]: 0 : if(SVX_NUM_BITMAP != (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
2213 [ # # ]: 0 : aNumFmt.SetCharFmtName(sEntry);
2214 : : }
2215 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
2216 : : }
2217 : 0 : nMask <<= 1;
2218 : : }
2219 [ # # ]: 0 : SetModified(sal_False);
2220 [ # # ][ # # ]: 0 : return 0;
2221 : :
2222 : : };
2223 : :
2224 : 0 : IMPL_LINK( SvxNumOptionsTabPage, EditModifyHdl_Impl, Edit *, pEdit )
2225 : : {
2226 : 0 : sal_Bool bPrefix = pEdit == &aPrefixED;
2227 : 0 : sal_Bool bSuffix = pEdit == &aSuffixED;
2228 : 0 : sal_Bool bStart = pEdit == &aStartED;
2229 : 0 : sal_uInt16 nMask = 1;
2230 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2231 : : {
2232 [ # # ]: 0 : if(nActNumLvl & nMask)
2233 : : {
2234 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2235 [ # # ]: 0 : if(bPrefix)
2236 [ # # ][ # # ]: 0 : aNumFmt.SetPrefix( aPrefixED.GetText() );
[ # # ]
2237 [ # # ]: 0 : else if(bSuffix)
2238 [ # # ][ # # ]: 0 : aNumFmt.SetSuffix( aSuffixED.GetText() );
[ # # ]
2239 [ # # ]: 0 : else if(bStart)
2240 [ # # ]: 0 : aNumFmt.SetStart( (sal_uInt16)aStartED.GetValue() );
2241 : : else //align
2242 : : {
2243 [ # # ]: 0 : sal_uInt16 nPos = aAlignLB.GetSelectEntryPos();
2244 : 0 : SvxAdjust eAdjust = SVX_ADJUST_CENTER;
2245 [ # # ]: 0 : if(nPos == 0)
2246 : 0 : eAdjust = SVX_ADJUST_LEFT;
2247 [ # # ]: 0 : else if(nPos == 2)
2248 : 0 : eAdjust = SVX_ADJUST_RIGHT;
2249 : 0 : aNumFmt.SetNumAdjust( eAdjust );
2250 : : }
2251 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
2252 : : }
2253 : 0 : nMask <<= 1;
2254 : : }
2255 : 0 : SetModified();
2256 : :
2257 : 0 : return 0;
2258 : : }
2259 : :
2260 : 0 : sal_uInt16 lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, sal_uInt16 nXStart,
2261 : : sal_uInt16 nYStart, sal_uInt16 nDivision)
2262 : : {
2263 : 0 : const SvxBrushItem* pBrushItem = rFmt.GetBrush();
2264 : 0 : sal_uInt16 nRet = 0;
2265 [ # # ]: 0 : if(pBrushItem)
2266 : : {
2267 : 0 : const Graphic* pGrf = pBrushItem->GetGraphic();
2268 [ # # ]: 0 : if(pGrf)
2269 : : {
2270 : 0 : Size aGSize( rFmt.GetGraphicSize() );
2271 : 0 : aGSize.Width() /= nDivision;
2272 : 0 : nRet = (sal_uInt16)aGSize.Width();
2273 : 0 : aGSize.Height() /= nDivision;
2274 : : pGrf->Draw( pVDev, Point(nXStart,nYStart),
2275 [ # # ][ # # ]: 0 : pVDev->PixelToLogic( aGSize ) );
2276 : : }
2277 : : }
2278 : 0 : return nRet;
2279 : :
2280 : : }
2281 : :
2282 : 0 : sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev,
2283 : : const SvxNumberFormat& rFmt, sal_uInt16 nXStart,
2284 : : sal_uInt16 nYStart, const Size& rSize)
2285 : : {
2286 [ # # ]: 0 : Font aTmpFont(pVDev->GetFont());
2287 : :
2288 : : // via Uno it's possible that no font has been set!
2289 [ # # ][ # # ]: 0 : Font aFont(rFmt.GetBulletFont() ? *rFmt.GetBulletFont() : aTmpFont);
2290 : 0 : Size aTmpSize(rSize);
2291 : 0 : aTmpSize.Width() *= rFmt.GetBulletRelSize();
2292 : 0 : aTmpSize.Width() /= 100 ;
2293 : 0 : aTmpSize.Height() *= rFmt.GetBulletRelSize();
2294 : 0 : aTmpSize.Height() /= 100 ;
2295 : : // in case of a height of zero it is drawed in original height
2296 [ # # ]: 0 : if(!aTmpSize.Height())
2297 : 0 : aTmpSize.Height() = 1;
2298 [ # # ]: 0 : aFont.SetSize(aTmpSize);
2299 [ # # ]: 0 : aFont.SetTransparent(sal_True);
2300 : 0 : Color aBulletColor = rFmt.GetBulletColor();
2301 [ # # ]: 0 : if(aBulletColor.GetColor() == COL_AUTO)
2302 [ # # ][ # # ]: 0 : aBulletColor = Color(pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK);
2303 [ # # ]: 0 : else if(aBulletColor == pVDev->GetFillColor())
2304 [ # # ]: 0 : aBulletColor.Invert();
2305 [ # # ]: 0 : aFont.SetColor(aBulletColor);
2306 [ # # ]: 0 : pVDev->SetFont( aFont );
2307 : 0 : rtl::OUString aText(rFmt.GetBulletChar());
2308 : 0 : long nY = nYStart;
2309 : 0 : nY -= ((aTmpSize.Height() - rSize.Height())/ 2);
2310 [ # # ][ # # ]: 0 : pVDev->DrawText( Point(nXStart, nY), aText );
[ # # ]
2311 [ # # ][ # # ]: 0 : sal_uInt16 nRet = (sal_uInt16)pVDev->GetTextWidth(aText);
[ # # ]
2312 : :
2313 [ # # ]: 0 : pVDev->SetFont(aTmpFont);
2314 [ # # ][ # # ]: 0 : return nRet;
2315 : : }
2316 : :
2317 : : // paint preview of numeration
2318 : 0 : void SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
2319 : : {
2320 [ # # ]: 0 : Size aSize(PixelToLogic(GetOutputSizePixel()));
2321 [ # # ]: 0 : Rectangle aRect(Point(0,0), aSize);
2322 : :
2323 : 0 : const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
2324 : 0 : const Color aBackColor = rStyleSettings.GetFieldColor();
2325 : 0 : const Color aTextColor = rStyleSettings.GetFieldTextColor();
2326 : :
2327 [ # # ][ # # ]: 0 : VirtualDevice* pVDev = new VirtualDevice(*this);
2328 [ # # ]: 0 : pVDev->EnableRTL( IsRTLEnabled() );
2329 [ # # ]: 0 : pVDev->SetMapMode(GetMapMode());
2330 [ # # ]: 0 : pVDev->SetOutputSize( aSize );
2331 : :
2332 : 0 : Color aLineColor(COL_LIGHTGRAY);
2333 [ # # ]: 0 : if(aLineColor == aBackColor)
2334 [ # # ]: 0 : aLineColor.Invert();
2335 [ # # ]: 0 : pVDev->SetLineColor(aLineColor);
2336 [ # # ]: 0 : pVDev->SetFillColor( aBackColor );
2337 [ # # ]: 0 : pVDev->DrawRect(aRect);
2338 : :
2339 [ # # ]: 0 : if(pActNum)
2340 : : {
2341 : : sal_uInt16 nWidthRelation;
2342 [ # # ]: 0 : if(nPageWidth)
2343 : : {
2344 : 0 : nWidthRelation = sal_uInt16 (nPageWidth / aSize.Width());
2345 [ # # ]: 0 : if(bPosition)
2346 : 0 : nWidthRelation = nWidthRelation * 2 / 3;
2347 : : else
2348 : 0 : nWidthRelation = nWidthRelation / 4;
2349 : : }
2350 : : else
2351 : 0 : nWidthRelation = 30; // chapter dialog
2352 : :
2353 : : // height per level
2354 : 0 : sal_uInt16 nXStep = sal::static_int_cast< sal_uInt16 >(aSize.Width() / (3 * pActNum->GetLevelCount()));
2355 [ # # ]: 0 : if(pActNum->GetLevelCount() < 10)
2356 : 0 : nXStep /= 2;
2357 : 0 : sal_uInt16 nYStart = 4;
2358 : : // the whole height mustn't be used for a single level
2359 [ # # ]: 0 : sal_uInt16 nYStep = sal::static_int_cast< sal_uInt16 >((aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5));
2360 : : aStdFont = OutputDevice::GetDefaultFont(
2361 [ # # ][ # # ]: 0 : DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE);
[ # # ][ # # ]
2362 [ # # ]: 0 : aStdFont.SetColor(aTextColor);
2363 [ # # ]: 0 : aStdFont.SetFillColor(aBackColor);
2364 : :
2365 : 0 : sal_uInt16 nFontHeight = nYStep * 6 / 10;
2366 [ # # ]: 0 : if(bPosition)
2367 : 0 : nFontHeight = nYStep * 15 / 10;
2368 [ # # ]: 0 : aStdFont.SetSize(Size( 0, nFontHeight ));
2369 : :
2370 : 0 : SvxNodeNum aNum( (sal_uInt8)0 );
2371 [ # # ]: 0 : sal_uInt16 nPreNum = pActNum->GetLevel(0).GetStart();
2372 : :
2373 [ # # ]: 0 : if(bPosition)
2374 : : {
2375 : 0 : sal_uInt16 nLineHeight = nFontHeight * 8 / 7;
2376 : 0 : sal_uInt8 nStart = 0;
2377 [ # # ]: 0 : while( !(nActLevel & (1<<nStart)) )
2378 : : {
2379 : 0 : nStart++;
2380 : : }
2381 [ # # ]: 0 : if(nStart)
2382 : 0 : nStart--;
2383 [ # # ]: 0 : sal_uInt8 nEnd = std::min( (sal_uInt8)(nStart + 3), (sal_uInt8)pActNum->GetLevelCount() );
2384 [ # # ]: 0 : for( sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel )
2385 : : {
2386 [ # # ]: 0 : const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
2387 : 0 : aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
2388 : :
2389 : 0 : sal_uInt16 nXStart( 0 );
2390 : 0 : short nTextOffset( 0 );
2391 : 0 : sal_uInt16 nNumberXPos( 0 );
2392 [ # # ][ # # ]: 0 : if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2393 : : {
2394 [ # # ]: 0 : nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
2395 [ # # ]: 0 : nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
2396 : 0 : nNumberXPos = nXStart;
2397 [ # # ]: 0 : sal_uInt16 nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
2398 : :
2399 [ # # ]: 0 : if(nFirstLineOffset <= nNumberXPos)
2400 : 0 : nNumberXPos = nNumberXPos - nFirstLineOffset;
2401 : : else
2402 : 0 : nNumberXPos = 0;
2403 : : // in draw this is valid
2404 [ # # ]: 0 : if(nTextOffset < 0)
2405 : 0 : nNumberXPos = nNumberXPos + nTextOffset;
2406 : : }
2407 [ # # ][ # # ]: 0 : else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
2408 : : {
2409 [ # # ]: 0 : const long nTmpNumberXPos( ( rFmt.GetIndentAt() +
2410 [ # # ]: 0 : rFmt.GetFirstLineIndent() ) /
2411 : 0 : nWidthRelation );
2412 [ # # ]: 0 : if ( nTmpNumberXPos < 0 )
2413 : : {
2414 : 0 : nNumberXPos = 0;
2415 : : }
2416 : : else
2417 : : {
2418 : 0 : nNumberXPos = static_cast<sal_uInt16>( nTmpNumberXPos );
2419 : : }
2420 : : }
2421 : :
2422 : 0 : sal_uInt16 nBulletWidth = 0;
2423 [ # # ]: 0 : if( SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
2424 : : {
2425 : 0 : nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev, rFmt,
2426 : : nNumberXPos,
2427 [ # # ][ # # ]: 0 : nYStart, nWidthRelation) : 0;
2428 : : }
2429 [ # # ]: 0 : else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
2430 : : {
2431 : 0 : nBulletWidth = rFmt.IsShowSymbol() ?
2432 [ # # ][ # # ]: 0 : lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0;
[ # # ]
2433 : : }
2434 : : else
2435 : : {
2436 [ # # ]: 0 : pVDev->SetFont(aStdFont);
2437 : 0 : aNum.SetLevel( nLevel );
2438 [ # # ]: 0 : if(pActNum->IsContinuousNumbering())
2439 : 0 : aNum.GetLevelVal()[nLevel] = nPreNum;
2440 [ # # ]: 0 : String aText(pActNum->MakeNumString( aNum ));
2441 [ # # ]: 0 : Font aSaveFont = pVDev->GetFont();
2442 [ # # ]: 0 : Font aColorFont(aSaveFont);
2443 : 0 : Color aTmpBulletColor = rFmt.GetBulletColor();
2444 [ # # ]: 0 : if(aTmpBulletColor.GetColor() == COL_AUTO)
2445 [ # # ][ # # ]: 0 : aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK);
2446 [ # # ]: 0 : else if(aTmpBulletColor == aBackColor)
2447 [ # # ]: 0 : aTmpBulletColor.Invert();
2448 [ # # ]: 0 : aColorFont.SetColor(aTmpBulletColor);
2449 [ # # ]: 0 : pVDev->SetFont(aColorFont);
2450 [ # # ]: 0 : pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
2451 [ # # ]: 0 : pVDev->SetFont(aSaveFont);
2452 [ # # ]: 0 : nBulletWidth = (sal_uInt16)pVDev->GetTextWidth(aText);
2453 [ # # ][ # # ]: 0 : nPreNum++;
[ # # ]
2454 : : }
2455 [ # # ][ # # ]: 0 : if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
[ # # ][ # # ]
2456 [ # # ]: 0 : rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
2457 : : {
2458 [ # # ]: 0 : pVDev->SetFont(aStdFont);
2459 : 0 : rtl::OUString aText(' ');
2460 [ # # ][ # # ]: 0 : pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
[ # # ]
2461 [ # # ][ # # ]: 0 : nBulletWidth = nBulletWidth + (sal_uInt16)pVDev->GetTextWidth(aText);
[ # # ]
2462 : : }
2463 : :
2464 : 0 : sal_uInt16 nTextXPos( 0 );
2465 [ # # ][ # # ]: 0 : if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2466 : : {
2467 : 0 : nTextXPos = nXStart;
2468 [ # # ]: 0 : if(nTextOffset < 0)
2469 : 0 : nTextXPos = nTextXPos + nTextOffset;
2470 [ # # ]: 0 : if(nNumberXPos + nBulletWidth + nTextOffset > nTextXPos )
2471 : 0 : nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
2472 : : }
2473 [ # # ][ # # ]: 0 : else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
2474 : : {
2475 [ # # ]: 0 : switch ( rFmt.GetLabelFollowedBy() )
[ # # # ]
2476 : : {
2477 : : case SvxNumberFormat::LISTTAB:
2478 : : {
2479 : : nTextXPos = static_cast<sal_uInt16>(
2480 [ # # ]: 0 : rFmt.GetListtabPos() / nWidthRelation );
2481 [ # # ]: 0 : if ( nTextXPos < nNumberXPos + nBulletWidth )
2482 : : {
2483 : 0 : nTextXPos = nNumberXPos + nBulletWidth;
2484 : : }
2485 : : }
2486 : 0 : break;
2487 : : case SvxNumberFormat::SPACE:
2488 : : case SvxNumberFormat::NOTHING:
2489 : : {
2490 : 0 : nTextXPos = nNumberXPos + nBulletWidth;
2491 : : }
2492 : 0 : break;
2493 : : }
2494 : :
2495 [ # # ]: 0 : nXStart = static_cast<sal_uInt16>( rFmt.GetIndentAt() / nWidthRelation );
2496 : : }
2497 : :
2498 [ # # ]: 0 : Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
2499 [ # # ]: 0 : pVDev->SetFillColor( aBackColor );
2500 [ # # ]: 0 : pVDev->DrawRect( aRect1 );
2501 : :
2502 [ # # ]: 0 : Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2));
2503 [ # # ]: 0 : pVDev->DrawRect( aRect2 );
2504 : 0 : nYStart += 2 * nLineHeight;
2505 : : }
2506 : : }
2507 : : else
2508 : : {
2509 : : //#i5153# painting gray or black rectangles as 'normal' numbering text
2510 [ # # ]: 0 : String sMsg( RTL_CONSTASCII_USTRINGPARAM( "Preview") );
2511 [ # # ]: 0 : long nWidth = pVDev->GetTextWidth(sMsg);
2512 [ # # ]: 0 : long nTextHeight = pVDev->GetTextHeight();
2513 : 0 : long nRectHeight = nTextHeight * 2 / 3;
2514 : 0 : long nTopOffset = nTextHeight - nRectHeight;
2515 : 0 : Color aBlackColor(COL_BLACK);
2516 [ # # ]: 0 : if(aBlackColor == aBackColor)
2517 [ # # ]: 0 : aBlackColor.Invert();
2518 : :
2519 [ # # ]: 0 : for( sal_uInt8 nLevel = 0; nLevel < pActNum->GetLevelCount();
2520 : : ++nLevel, nYStart = nYStart + nYStep )
2521 : : {
2522 [ # # ]: 0 : const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
2523 : 0 : aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
2524 : 0 : sal_uInt16 nXStart( 0 );
2525 [ # # ][ # # ]: 0 : if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2526 : : {
2527 [ # # ]: 0 : nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
2528 : : }
2529 [ # # ][ # # ]: 0 : else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
2530 : : {
2531 [ # # ]: 0 : const long nTmpXStart( ( rFmt.GetIndentAt() +
2532 [ # # ]: 0 : rFmt.GetFirstLineIndent() ) /
2533 : 0 : nWidthRelation );
2534 [ # # ]: 0 : if ( nTmpXStart < 0 )
2535 : : {
2536 : 0 : nXStart = 0;
2537 : : }
2538 : : else
2539 : : {
2540 : 0 : nXStart = static_cast<sal_uInt16>(nTmpXStart);
2541 : : }
2542 : : }
2543 : 0 : nXStart /= 2;
2544 : 0 : nXStart += 2;
2545 : 0 : sal_uInt16 nTextOffset = 2 * nXStep;
2546 [ # # ]: 0 : if( SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)) )
2547 : : {
2548 [ # # ]: 0 : if(rFmt.IsShowSymbol())
2549 : : {
2550 [ # # ]: 0 : nTextOffset = lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation);
2551 : 0 : nTextOffset = nTextOffset + nXStep;
2552 : : }
2553 : : }
2554 [ # # ]: 0 : else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
2555 : : {
2556 [ # # ]: 0 : if(rFmt.IsShowSymbol())
2557 : : {
2558 [ # # ][ # # ]: 0 : nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize());
2559 : 0 : nTextOffset = nTextOffset + nXStep;
2560 : : }
2561 : : }
2562 : : else
2563 : : {
2564 [ # # ]: 0 : Font aColorFont(aStdFont);
2565 : 0 : Color aTmpBulletColor = rFmt.GetBulletColor();
2566 [ # # ]: 0 : if(aTmpBulletColor.GetColor() == COL_AUTO)
2567 [ # # ][ # # ]: 0 : aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK);
2568 [ # # ]: 0 : else if(aTmpBulletColor == aBackColor)
2569 [ # # ]: 0 : aTmpBulletColor.Invert();
2570 [ # # ]: 0 : aColorFont.SetColor(aTmpBulletColor);
2571 [ # # ]: 0 : pVDev->SetFont(aColorFont);
2572 : 0 : aNum.SetLevel( nLevel );
2573 [ # # ]: 0 : if(pActNum->IsContinuousNumbering())
2574 : 0 : aNum.GetLevelVal()[nLevel] = nPreNum;
2575 [ # # ]: 0 : String aText(pActNum->MakeNumString( aNum ));
2576 [ # # ]: 0 : pVDev->DrawText( Point(nXStart, nYStart), aText );
2577 [ # # ]: 0 : pVDev->SetFont(aStdFont);
2578 [ # # ]: 0 : nTextOffset = (sal_uInt16)pVDev->GetTextWidth(aText);
2579 : 0 : nTextOffset = nTextOffset + nXStep;
2580 [ # # ][ # # ]: 0 : nPreNum++;
2581 : : }
2582 [ # # ]: 0 : if(pOutlineNames)
2583 : : {
2584 : : //#i5153# outline numberings still use the style names as text
2585 [ # # ]: 0 : pVDev->SetFont(aStdFont);
2586 [ # # ]: 0 : sMsg = pOutlineNames[nLevel];
2587 [ # # ]: 0 : pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg );
2588 : : }
2589 : : else
2590 : : {
2591 : : //#i5153# the selected rectangle(s) should be black
2592 [ # # ]: 0 : if( 0 != (nActLevel & (1<<nLevel)))
2593 : : {
2594 [ # # ]: 0 : pVDev->SetFillColor( aBlackColor );
2595 [ # # ]: 0 : pVDev->SetLineColor( aBlackColor );
2596 : : }
2597 : : else
2598 : : {
2599 : : //#i5153# unselected levels are gray
2600 [ # # ]: 0 : pVDev->SetFillColor( aLineColor );
2601 [ # # ]: 0 : pVDev->SetLineColor( aLineColor );
2602 : : }
2603 [ # # ]: 0 : Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight));
2604 [ # # ]: 0 : pVDev->DrawRect(aRect1);
2605 : : }
2606 [ # # ]: 0 : }
2607 : : }
2608 : : }
2609 : : DrawOutDev( Point(0,0), aSize,
2610 : : Point(0,0), aSize,
2611 [ # # ]: 0 : *pVDev );
2612 [ # # ][ # # ]: 0 : delete pVDev;
2613 : :
2614 : 0 : }
2615 : :
2616 : 0 : SvxNumPositionTabPage::SvxNumPositionTabPage(Window* pParent,
2617 : : const SfxItemSet& rSet) :
2618 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_NUM_POSITION ), rSet ),
2619 [ # # ]: 0 : aPositionFL( this, CUI_RES(FL_POSITION )),
2620 [ # # ]: 0 : aLevelFT( this, CUI_RES(FT_LEVEL )),
2621 [ # # ]: 0 : aLevelLB( this, CUI_RES(LB_LEVEL )),
2622 [ # # ]: 0 : aDistBorderFT( this, CUI_RES(FT_BORDERDIST )),
2623 [ # # ]: 0 : aDistBorderMF( this, CUI_RES(MF_BORDERDIST )),
2624 [ # # ]: 0 : aRelativeCB( this, CUI_RES(CB_RELATIVE )),
2625 [ # # ]: 0 : aIndentFT( this, CUI_RES(FT_INDENT )),
2626 [ # # ]: 0 : aIndentMF( this, CUI_RES(MF_INDENT )),
2627 [ # # ]: 0 : aDistNumFT( this, CUI_RES(FT_NUMDIST )),
2628 [ # # ]: 0 : aDistNumMF( this, CUI_RES(MF_NUMDIST )),
2629 [ # # ]: 0 : aAlignFT( this, CUI_RES(FT_ALIGN )),
2630 [ # # ]: 0 : aAlignLB( this, CUI_RES(LB_ALIGN )),
2631 [ # # ]: 0 : aLabelFollowedByFT( this, CUI_RES(FT_LABEL_FOLLOWED_BY) ),
2632 [ # # ]: 0 : aLabelFollowedByLB( this, CUI_RES(LB_LABEL_FOLLOWED_BY) ),
2633 [ # # ]: 0 : aListtabFT( this, CUI_RES(FT_LISTTAB) ),
2634 [ # # ]: 0 : aListtabMF( this, CUI_RES(MF_LISTTAB) ),
2635 [ # # ]: 0 : aAlign2FT( this, CUI_RES(FT_ALIGN_2) ),
2636 [ # # ]: 0 : aAlign2LB( this, CUI_RES(LB_ALIGN_2) ),
2637 [ # # ]: 0 : aAlignedAtFT( this, CUI_RES(FT_ALIGNED_AT) ),
2638 [ # # ]: 0 : aAlignedAtMF( this, CUI_RES(MF_ALIGNED_AT) ),
2639 [ # # ]: 0 : aIndentAtFT( this, CUI_RES(FT_INDENT_AT) ),
2640 [ # # ]: 0 : aIndentAtMF( this, CUI_RES(MF_INDENT_AT) ),
2641 [ # # ]: 0 : aStandardPB( this, CUI_RES(PB_STANDARD )),
2642 [ # # ][ # # ]: 0 : pPreviewWIN( new SvxNumberingPreview(this, CUI_RES(WIN_PREVIEW ))),
2643 : : pActNum(0),
2644 : : pSaveNum(0),
2645 : : nActNumLvl( USHRT_MAX ),
2646 : : nNumItemId(SID_ATTR_NUMBERING_RULE),
2647 : : bModified(false),
2648 : : bPreset(false),
2649 : : bInInintControl(sal_False),
2650 [ # # ][ # # ]: 0 : bLabelAlignmentPosAndSpaceModeActive( false )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2651 : : {
2652 [ # # ]: 0 : FreeResource();
2653 : 0 : SetExchangeSupport();
2654 [ # # ][ # # ]: 0 : pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
[ # # ]
2655 : :
2656 [ # # ]: 0 : aRelativeCB.Check();
2657 [ # # ]: 0 : aAlignLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
2658 [ # # ]: 0 : aAlign2LB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
2659 [ # # ][ # # ]: 0 : for ( sal_uInt16 i = 0; i < aAlignLB.GetEntryCount(); ++i )
2660 : : {
2661 [ # # ][ # # ]: 0 : aAlign2LB.InsertEntry( aAlignLB.GetEntry( i ) );
[ # # ]
2662 : : }
2663 [ # # ][ # # ]: 0 : aAlign2LB.SetDropDownLineCount( aAlign2LB.GetEntryCount() );
2664 [ # # ][ # # ]: 0 : aAlign2FT.SetText( aAlignFT.GetText() );
[ # # ]
2665 : :
2666 [ # # ]: 0 : Link aLk = LINK(this, SvxNumPositionTabPage, DistanceHdl_Impl);
2667 : :
2668 : 0 : aDistBorderMF.SetUpHdl(aLk);
2669 : 0 : aDistBorderMF.SetDownHdl(aLk);
2670 : 0 : aDistBorderMF.SetLoseFocusHdl(aLk);
2671 : :
2672 : 0 : aDistNumMF.SetUpHdl(aLk);
2673 : 0 : aDistNumMF.SetDownHdl(aLk);
2674 : 0 : aDistNumMF.SetLoseFocusHdl(aLk);
2675 : :
2676 : 0 : aIndentMF.SetUpHdl(aLk);
2677 : 0 : aIndentMF.SetDownHdl(aLk);
2678 : 0 : aIndentMF.SetLoseFocusHdl(aLk);
2679 : :
2680 [ # # ][ # # ]: 0 : aLabelFollowedByLB.SetDropDownLineCount( aLabelFollowedByLB.GetEntryCount() );
2681 [ # # ]: 0 : aLabelFollowedByLB.SetSelectHdl( LINK(this, SvxNumPositionTabPage, LabelFollowedByHdl_Impl) );
2682 : :
2683 [ # # ]: 0 : aLk = LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl);
2684 : 0 : aListtabMF.SetUpHdl(aLk);
2685 : 0 : aListtabMF.SetDownHdl(aLk);
2686 : 0 : aListtabMF.SetLoseFocusHdl(aLk);
2687 : :
2688 [ # # ]: 0 : aLk = LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl);
2689 : 0 : aAlignedAtMF.SetUpHdl(aLk);
2690 : 0 : aAlignedAtMF.SetDownHdl(aLk);
2691 : 0 : aAlignedAtMF.SetLoseFocusHdl(aLk);
2692 : :
2693 [ # # ]: 0 : aLk = LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl);
2694 : 0 : aIndentAtMF.SetUpHdl(aLk);
2695 : 0 : aIndentAtMF.SetDownHdl(aLk);
2696 : 0 : aIndentAtMF.SetLoseFocusHdl(aLk);
2697 : :
2698 [ # # ]: 0 : aLevelLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, LevelHdl_Impl));
2699 [ # # ]: 0 : aRelativeCB.SetClickHdl(LINK(this, SvxNumPositionTabPage, RelativeHdl_Impl));
2700 [ # # ]: 0 : aStandardPB.SetClickHdl(LINK(this, SvxNumPositionTabPage, StandardHdl_Impl));
2701 : :
2702 : :
2703 [ # # ]: 0 : aRelativeCB.Check(bLastRelative);
2704 : 0 : pPreviewWIN->SetPositionMode();
2705 [ # # ][ # # ]: 0 : eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
2706 : :
2707 : : #if OSL_DEBUG_LEVEL > 1
2708 : : pDebugFixedText = new FixedText(this, 0);
2709 : : pDebugFixedText->Show();
2710 : : Size aSize(200, 20);
2711 : : Point aPos(250,0);
2712 : :
2713 : : pDebugFixedText->SetPosSizePixel(aPos, aSize);
2714 : : pDebugFixedText->SetText(rtl::OUString("Das ist ein Debug-Text"));
2715 : : #endif
2716 : :
2717 [ # # ]: 0 : aStandardPB.SetAccessibleRelationMemberOf(&aPositionFL);
2718 : 0 : }
2719 : :
2720 [ # # ][ # # ]: 0 : SvxNumPositionTabPage::~SvxNumPositionTabPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2721 : : {
2722 [ # # ][ # # ]: 0 : delete pActNum;
2723 [ # # ][ # # ]: 0 : delete pPreviewWIN;
2724 [ # # ][ # # ]: 0 : delete pSaveNum;
2725 : : #if OSL_DEBUG_LEVEL > 1
2726 : : delete pDebugFixedText;
2727 : : #endif
2728 [ # # ]: 0 : }
2729 : : /*-------------------------------------------------------*/
2730 : :
2731 : : #if OSL_DEBUG_LEVEL > 1
2732 : : void lcl_PrintDebugOutput(FixedText& rFixed, const SvxNumberFormat& rNumFmt)
2733 : : {
2734 : : #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
2735 : :
2736 : : sal_Char const sHash[] = " # ";
2737 : : if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2738 : : {
2739 : : String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) );
2740 : : sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
2741 : : sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetCharTextDistance() ) );
2742 : : sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
2743 : : sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineOffset() ) );
2744 : : rFixed.SetText(sDebugText);
2745 : : }
2746 : : else if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
2747 : : {
2748 : : String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetListtabPos() ) ) );
2749 : : sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
2750 : : sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineIndent() ) );
2751 : : sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) );
2752 : : sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetIndentAt() ) );
2753 : : rFixed.SetText(sDebugText);
2754 : : }
2755 : :
2756 : : }
2757 : : #endif
2758 : :
2759 : 0 : void SvxNumPositionTabPage::InitControls()
2760 : : {
2761 : 0 : bInInintControl = sal_True;
2762 : 0 : const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive &&
2763 [ # # ][ # # ]: 0 : aRelativeCB.IsEnabled() && aRelativeCB.IsChecked();
[ # # ][ # # ]
[ # # ]
2764 [ # # ]: 0 : const bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 &&
2765 [ # # ][ # # ]: 0 : USHRT_MAX != nActNumLvl;
2766 : :
2767 : 0 : aDistBorderMF.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
2768 [ # # ][ # # ]: 0 : ( bSingleSelection || bRelative ) );
[ # # ][ # # ]
2769 : 0 : aDistBorderFT.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
2770 [ # # ][ # # ]: 0 : ( bSingleSelection || bRelative ) );
[ # # ][ # # ]
2771 : :
2772 : 0 : bool bSetDistEmpty = false;
2773 : 0 : bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
2774 : 0 : bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive;
2775 : 0 : bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive;
2776 : 0 : bool bSameAdjust = true;
2777 : :
2778 : 0 : bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive;
2779 : 0 : bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive;
2780 : 0 : bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive;
2781 : 0 : bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive;
2782 : :
2783 : : const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
2784 : 0 : sal_uInt16 nMask = 1;
2785 : 0 : sal_uInt16 nLvl = USHRT_MAX;
2786 : 0 : long nFirstBorderTextRelative = -1;
2787 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2788 : : {
2789 [ # # ]: 0 : aNumFmtArr[i] = &pActNum->GetLevel(i);
2790 [ # # ]: 0 : if(nActNumLvl & nMask)
2791 : : {
2792 [ # # ]: 0 : if(USHRT_MAX == nLvl)
2793 : 0 : nLvl = i;
2794 : :
2795 [ # # ]: 0 : if( i > nLvl)
2796 : : {
2797 : 0 : bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
2798 [ # # ]: 0 : if ( !bLabelAlignmentPosAndSpaceModeActive )
2799 : : {
2800 [ # # ]: 0 : if(bRelative)
2801 : : {
2802 [ # # ]: 0 : if(nFirstBorderTextRelative == -1)
2803 : : nFirstBorderTextRelative =
2804 [ # # ][ # # ]: 0 : (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
2805 [ # # ][ # # ]: 0 : aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
2806 : : else
2807 : : bSameDistBorderNum &= nFirstBorderTextRelative ==
2808 [ # # ][ # # ]: 0 : (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
2809 [ # # ][ # # ]: 0 : aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
2810 : : }
2811 : : else
2812 : : bSameDistBorderNum &=
2813 [ # # ][ # # ]: 0 : aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() ==
2814 [ # # ][ # # ]: 0 : aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset();
2815 : :
2816 [ # # ][ # # ]: 0 : bSameDist &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance();
2817 [ # # ][ # # ]: 0 : bSameIndent &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset();
2818 : : }
2819 : : else
2820 : : {
2821 : : bSameLabelFollowedBy &=
2822 [ # # ][ # # ]: 0 : aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy();
2823 : : bSameListtab &=
2824 [ # # ][ # # ]: 0 : aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos();
2825 : : bSameAlignAt &=
2826 [ # # ][ # # ]: 0 : ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() )
2827 [ # # ][ # # ]: 0 : == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) );
2828 : : bSameIndentAt &=
2829 [ # # ][ # # ]: 0 : aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt();
2830 : : }
2831 : : }
2832 : : }
2833 : 0 : nMask <<= 1;
2834 : :
2835 : : }
2836 [ # # ]: 0 : if (SVX_MAX_NUM <= nLvl)
2837 : : {
2838 : : OSL_ENSURE(false, "cannot happen.");
2839 : 0 : return;
2840 : : }
2841 : :
2842 [ # # ]: 0 : if(bSameDistBorderNum)
2843 : : {
2844 : : long nDistBorderNum;
2845 [ # # ]: 0 : if(bRelative)
2846 : : {
2847 [ # # ][ # # ]: 0 : nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
2848 [ # # ]: 0 : if(nLvl)
2849 [ # # ][ # # ]: 0 : nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
2850 : : }
2851 : : else
2852 : : {
2853 [ # # ][ # # ]: 0 : nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
2854 : : }
2855 [ # # ]: 0 : SetMetricValue(aDistBorderMF, nDistBorderNum, eCoreUnit);
2856 : : }
2857 : : else
2858 : 0 : bSetDistEmpty = true;
2859 : :
2860 : : #if OSL_DEBUG_LEVEL > 1
2861 : : lcl_PrintDebugOutput(*pDebugFixedText, *aNumFmtArr[nLvl]);
2862 : : #endif
2863 : :
2864 [ # # ]: 0 : const String aEmptyStr;
2865 [ # # ]: 0 : if(bSameDist)
2866 [ # # ][ # # ]: 0 : SetMetricValue(aDistNumMF, aNumFmtArr[nLvl]->GetCharTextDistance(), eCoreUnit);
2867 : : else
2868 [ # # ]: 0 : aDistNumMF.SetText(aEmptyStr);
2869 [ # # ]: 0 : if(bSameIndent)
2870 [ # # ][ # # ]: 0 : SetMetricValue(aIndentMF, - aNumFmtArr[nLvl]->GetFirstLineOffset(), eCoreUnit);
2871 : : else
2872 [ # # ]: 0 : aIndentMF.SetText(aEmptyStr);
2873 : :
2874 [ # # ]: 0 : if(bSameAdjust)
2875 : : {
2876 : 0 : sal_uInt16 nPos = 1; // centered
2877 [ # # ]: 0 : if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
2878 : 0 : nPos = 0;
2879 [ # # ]: 0 : else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
2880 : 0 : nPos = 2;
2881 [ # # ]: 0 : aAlignLB.SelectEntryPos(nPos);
2882 [ # # ]: 0 : aAlign2LB.SelectEntryPos( nPos );
2883 : : }
2884 : : else
2885 : : {
2886 [ # # ]: 0 : aAlignLB.SetNoSelection();
2887 [ # # ]: 0 : aAlign2LB.SetNoSelection();
2888 : : }
2889 : :
2890 [ # # ]: 0 : if ( bSameLabelFollowedBy )
2891 : : {
2892 : 0 : sal_uInt16 nPos = 0; // LISTTAB
2893 [ # # ][ # # ]: 0 : if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE )
2894 : : {
2895 : 0 : nPos = 1;
2896 : : }
2897 [ # # ][ # # ]: 0 : else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
2898 : : {
2899 : 0 : nPos = 2;
2900 : : }
2901 [ # # ]: 0 : aLabelFollowedByLB.SelectEntryPos( nPos );
2902 : : }
2903 : : else
2904 : : {
2905 [ # # ]: 0 : aLabelFollowedByLB.SetNoSelection();
2906 : : }
2907 : :
2908 [ # # ][ # # ]: 0 : if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
2909 : : {
2910 [ # # ]: 0 : aListtabFT.Enable( true );
2911 [ # # ]: 0 : aListtabMF.Enable( true );
2912 [ # # ]: 0 : if ( bSameListtab )
2913 : : {
2914 [ # # ][ # # ]: 0 : SetMetricValue( aListtabMF, aNumFmtArr[nLvl]->GetListtabPos(), eCoreUnit );
2915 : : }
2916 : : else
2917 : : {
2918 [ # # ]: 0 : aListtabMF.SetText(aEmptyStr);
2919 : : }
2920 : : }
2921 : : else
2922 : : {
2923 [ # # ]: 0 : aListtabFT.Enable( false );
2924 [ # # ]: 0 : aListtabMF.Enable( false );
2925 [ # # ]: 0 : aListtabMF.SetText(aEmptyStr);
2926 : : }
2927 : :
2928 [ # # ]: 0 : if ( bSameAlignAt )
2929 : : {
2930 : : SetMetricValue( aAlignedAtMF,
2931 [ # # ][ # # ]: 0 : aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent(),
2932 [ # # ]: 0 : eCoreUnit );
2933 : : }
2934 : : else
2935 : : {
2936 [ # # ]: 0 : aAlignedAtMF.SetText(aEmptyStr);
2937 : : }
2938 : :
2939 [ # # ]: 0 : if ( bSameIndentAt )
2940 : : {
2941 [ # # ][ # # ]: 0 : SetMetricValue( aIndentAtMF, aNumFmtArr[nLvl]->GetIndentAt(), eCoreUnit );
2942 : : }
2943 : : else
2944 : : {
2945 [ # # ]: 0 : aIndentAtMF.SetText(aEmptyStr);
2946 : : }
2947 : :
2948 [ # # ]: 0 : if ( bSetDistEmpty )
2949 [ # # ]: 0 : aDistBorderMF.SetText(aEmptyStr);
2950 : :
2951 [ # # ]: 0 : bInInintControl = sal_False;
2952 : : }
2953 : :
2954 : 0 : void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet)
2955 : : {
2956 : : const SfxPoolItem* pItem;
2957 : 0 : sal_uInt16 nTmpNumLvl = USHRT_MAX;
2958 : 0 : const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
2959 [ # # ]: 0 : if(pExampleSet)
2960 : : {
2961 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
2962 : 0 : bPreset = ((const SfxBoolItem*)pItem)->GetValue();
2963 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
2964 : 0 : nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
2965 : : }
2966 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
2967 : : {
2968 [ # # ][ # # ]: 0 : delete pSaveNum;
2969 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
2970 : : }
2971 [ # # ][ # # ]: 0 : bModified = (!pActNum->Get( 0 ) || bPreset);
[ # # ]
2972 [ # # ][ # # ]: 0 : if(*pSaveNum != *pActNum ||
[ # # ][ # # ]
2973 : : nActNumLvl != nTmpNumLvl )
2974 : : {
2975 [ # # ]: 0 : *pActNum = *pSaveNum;
2976 : 0 : nActNumLvl = nTmpNumLvl;
2977 : 0 : sal_uInt16 nMask = 1;
2978 [ # # ]: 0 : aLevelLB.SetUpdateMode(sal_False);
2979 [ # # ]: 0 : aLevelLB.SetNoSelection();
2980 [ # # ]: 0 : aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX);
2981 [ # # ]: 0 : if(nActNumLvl != USHRT_MAX)
2982 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2983 : : {
2984 [ # # ]: 0 : if(nActNumLvl & nMask)
2985 [ # # ]: 0 : aLevelLB.SelectEntryPos( i, sal_True);
2986 : 0 : nMask <<= 1 ;
2987 : : }
2988 [ # # ]: 0 : aRelativeCB.Enable(nActNumLvl != 1);
2989 [ # # ]: 0 : aLevelLB.SetUpdateMode(sal_True);
2990 : :
2991 [ # # ]: 0 : InitPosAndSpaceMode();
2992 [ # # ]: 0 : ShowControlsDependingOnPosAndSpaceMode();
2993 : :
2994 [ # # ]: 0 : InitControls();
2995 : : }
2996 : 0 : pPreviewWIN->SetLevel(nActNumLvl);
2997 [ # # ]: 0 : pPreviewWIN->Invalidate();
2998 : 0 : }
2999 : :
3000 : 0 : int SvxNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet)
3001 : : {
3002 [ # # ]: 0 : if(_pSet)
3003 : : {
3004 [ # # ]: 0 : if(aDistBorderMF.IsEnabled())
3005 : 0 : DistanceHdl_Impl(&aDistBorderMF);
3006 : 0 : DistanceHdl_Impl(&aIndentMF);
3007 : 0 : FillItemSet(*_pSet);
3008 : : }
3009 : 0 : return sal_True;
3010 : : }
3011 : :
3012 : 0 : sal_Bool SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet )
3013 : : {
3014 [ # # ]: 0 : rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
3015 : :
3016 [ # # ][ # # ]: 0 : if(bModified && pActNum)
3017 : : {
3018 : 0 : *pSaveNum = *pActNum;
3019 [ # # ]: 0 : rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
3020 [ # # ]: 0 : rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, sal_False));
3021 : : }
3022 : 0 : return bModified;
3023 : : }
3024 : :
3025 : 0 : void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet )
3026 : : {
3027 : : const SfxPoolItem* pItem;
3028 : : // in Draw the item exists as WhichId, in Writer only as SlotId
3029 [ # # ]: 0 : SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
3030 [ # # ]: 0 : if(eState != SFX_ITEM_SET)
3031 : : {
3032 [ # # ]: 0 : nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
3033 [ # # ]: 0 : eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
3034 : :
3035 [ # # ]: 0 : if( eState != SFX_ITEM_SET )
3036 : : {
3037 [ # # ]: 0 : pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
3038 : 0 : eState = SFX_ITEM_SET;
3039 : : }
3040 : :
3041 : : }
3042 : : DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
3043 [ # # ][ # # ]: 0 : delete pSaveNum;
3044 [ # # ][ # # ]: 0 : pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
3045 : :
3046 : : // insert levels
3047 [ # # ][ # # ]: 0 : if(!aLevelLB.GetEntryCount())
3048 : : {
3049 [ # # ]: 0 : for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++)
3050 [ # # ][ # # ]: 0 : aLevelLB.InsertEntry(UniString::CreateFromInt32(i));
[ # # ]
3051 [ # # ]: 0 : if(pSaveNum->GetLevelCount() > 1)
3052 : : {
3053 [ # # ]: 0 : String sEntry(rtl::OUString("1 - "));
3054 [ # # ][ # # ]: 0 : sEntry.Append( UniString::CreateFromInt32( pSaveNum->GetLevelCount() ) );
[ # # ]
3055 [ # # ]: 0 : aLevelLB.InsertEntry(sEntry);
3056 [ # # ][ # # ]: 0 : aLevelLB.SelectEntry(sEntry);
3057 : : }
3058 : : else
3059 [ # # ]: 0 : aLevelLB.SelectEntryPos(0);
3060 : : }
3061 : : else
3062 [ # # ][ # # ]: 0 : aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1);
3063 : 0 : sal_uInt16 nMask = 1;
3064 [ # # ]: 0 : aLevelLB.SetUpdateMode(sal_False);
3065 [ # # ]: 0 : aLevelLB.SetNoSelection();
3066 [ # # ]: 0 : if(nActNumLvl == USHRT_MAX)
3067 : : {
3068 [ # # ]: 0 : aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), sal_True);
3069 : : }
3070 : : else
3071 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++)
3072 : : {
3073 [ # # ]: 0 : if(nActNumLvl & nMask)
3074 [ # # ]: 0 : aLevelLB.SelectEntryPos( i, sal_True);
3075 : 0 : nMask <<= 1;
3076 : : }
3077 [ # # ]: 0 : aLevelLB.SetUpdateMode(sal_True);
3078 : :
3079 [ # # ]: 0 : if(!pActNum)
3080 [ # # ][ # # ]: 0 : pActNum = new SvxNumRule(*pSaveNum);
3081 [ # # ][ # # ]: 0 : else if(*pSaveNum != *pActNum)
3082 [ # # ]: 0 : *pActNum = *pSaveNum;
3083 [ # # ]: 0 : pPreviewWIN->SetNumRule(pActNum);
3084 : :
3085 [ # # ]: 0 : InitPosAndSpaceMode();
3086 [ # # ]: 0 : ShowControlsDependingOnPosAndSpaceMode();
3087 : :
3088 [ # # ]: 0 : InitControls();
3089 : 0 : bModified = sal_False;
3090 : 0 : }
3091 : :
3092 : 0 : void SvxNumPositionTabPage::InitPosAndSpaceMode()
3093 : : {
3094 [ # # ]: 0 : if ( pActNum == 0 )
3095 : : {
3096 : : DBG_ASSERT( false,
3097 : : "<SvxNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" );
3098 : 0 : return;
3099 : : }
3100 : :
3101 : : SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode =
3102 : 0 : SvxNumberFormat::LABEL_ALIGNMENT;
3103 : 0 : sal_uInt16 nMask = 1;
3104 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
3105 : : {
3106 [ # # ]: 0 : if(nActNumLvl & nMask)
3107 : : {
3108 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3109 [ # # ]: 0 : ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
3110 [ # # ]: 0 : if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
3111 : : {
3112 : : break;
3113 [ # # ][ # # ]: 0 : }
3114 : : }
3115 : 0 : nMask <<= 1;
3116 : : }
3117 : :
3118 : : bLabelAlignmentPosAndSpaceModeActive =
3119 : 0 : ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
3120 : : }
3121 : :
3122 : 0 : void SvxNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
3123 : : {
3124 : 0 : aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
3125 : 0 : aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
3126 : 0 : aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive );
3127 : 0 : aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
3128 : 0 : aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
3129 : 0 : aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive &&
3130 [ # # ][ # # ]: 0 : pActNum->IsFeatureSupported(NUM_CONTINUOUS) );
3131 : 0 : aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive &&
3132 [ # # ][ # # ]: 0 : pActNum->IsFeatureSupported(NUM_CONTINUOUS));
3133 : 0 : aAlignFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
3134 : 0 : aAlignLB.Show( !bLabelAlignmentPosAndSpaceModeActive );
3135 : :
3136 : 0 : aLabelFollowedByFT.Show( bLabelAlignmentPosAndSpaceModeActive );
3137 : 0 : aLabelFollowedByLB.Show( bLabelAlignmentPosAndSpaceModeActive );
3138 : 0 : aListtabFT.Show( bLabelAlignmentPosAndSpaceModeActive );
3139 : 0 : aListtabMF.Show( bLabelAlignmentPosAndSpaceModeActive );
3140 : 0 : aAlign2FT.Show( bLabelAlignmentPosAndSpaceModeActive );
3141 : 0 : aAlign2LB.Show( bLabelAlignmentPosAndSpaceModeActive );
3142 : 0 : aAlignedAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
3143 : 0 : aAlignedAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
3144 : 0 : aIndentAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
3145 : 0 : aIndentAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
3146 : 0 : }
3147 : :
3148 : 0 : SfxTabPage* SvxNumPositionTabPage::Create( Window* pParent,
3149 : : const SfxItemSet& rAttrSet)
3150 : : {
3151 [ # # ]: 0 : return new SvxNumPositionTabPage(pParent, rAttrSet);
3152 : : }
3153 : :
3154 : 0 : void SvxNumPositionTabPage::SetMetric(FieldUnit eMetric)
3155 : : {
3156 [ # # ]: 0 : if(eMetric == FUNIT_MM)
3157 : : {
3158 : 0 : aDistBorderMF .SetDecimalDigits(1);
3159 : 0 : aDistNumMF .SetDecimalDigits(1);
3160 : 0 : aIndentMF .SetDecimalDigits(1);
3161 : 0 : aListtabMF.SetDecimalDigits(1);
3162 : 0 : aAlignedAtMF.SetDecimalDigits(1);
3163 : 0 : aIndentAtMF.SetDecimalDigits(1);
3164 : : }
3165 : 0 : aDistBorderMF .SetUnit( eMetric );
3166 : 0 : aDistNumMF .SetUnit( eMetric );
3167 : 0 : aIndentMF .SetUnit( eMetric );
3168 : 0 : aListtabMF.SetUnit( eMetric );
3169 : 0 : aAlignedAtMF.SetUnit( eMetric );
3170 : 0 : aIndentAtMF.SetUnit( eMetric );
3171 : 0 : }
3172 : :
3173 : 0 : IMPL_LINK_NOARG(SvxNumPositionTabPage, EditModifyHdl_Impl)
3174 : : {
3175 : 0 : sal_uInt16 nMask = 1;
3176 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
3177 : : {
3178 [ # # ]: 0 : if(nActNumLvl & nMask)
3179 : : {
3180 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
3181 : :
3182 [ # # ]: 0 : const sal_uInt16 nPos = aAlignLB.IsVisible()
3183 : 0 : ? aAlignLB.GetSelectEntryPos()
3184 [ # # ][ # # ]: 0 : : aAlign2LB.GetSelectEntryPos();
[ # # ]
3185 : 0 : SvxAdjust eAdjust = SVX_ADJUST_CENTER;
3186 [ # # ]: 0 : if(nPos == 0)
3187 : 0 : eAdjust = SVX_ADJUST_LEFT;
3188 [ # # ]: 0 : else if(nPos == 2)
3189 : 0 : eAdjust = SVX_ADJUST_RIGHT;
3190 : 0 : aNumFmt.SetNumAdjust( eAdjust );
3191 [ # # ][ # # ]: 0 : pActNum->SetLevel(i, aNumFmt);
3192 : : }
3193 : 0 : nMask <<= 1;
3194 : : }
3195 : 0 : SetModified();
3196 : 0 : return 0;
3197 : : }
3198 : :
3199 : 0 : IMPL_LINK( SvxNumPositionTabPage, LevelHdl_Impl, ListBox *, pBox )
3200 : : {
3201 : 0 : sal_uInt16 nSaveNumLvl = nActNumLvl;
3202 : 0 : nActNumLvl = 0;
3203 [ # # # # ]: 0 : if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) &&
[ # # ][ # # ]
3204 : 0 : (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
3205 : : {
3206 : 0 : nActNumLvl = 0xFFFF;
3207 : 0 : pBox->SetUpdateMode(sal_False);
3208 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
3209 : 0 : pBox->SelectEntryPos( i, sal_False );
3210 : 0 : pBox->SetUpdateMode(sal_True);
3211 : : }
3212 [ # # ]: 0 : else if(pBox->GetSelectEntryCount())
3213 : : {
3214 : 0 : sal_uInt16 nMask = 1;
3215 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
3216 : : {
3217 [ # # ]: 0 : if(pBox->IsEntryPosSelected( i ))
3218 : 0 : nActNumLvl |= nMask;
3219 : 0 : nMask <<= 1;
3220 : : }
3221 : 0 : pBox->SelectEntryPos( pActNum->GetLevelCount(), sal_False );
3222 : : }
3223 : : else
3224 : : {
3225 : 0 : nActNumLvl = nSaveNumLvl;
3226 : 0 : sal_uInt16 nMask = 1;
3227 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
3228 : : {
3229 [ # # ]: 0 : if(nActNumLvl & nMask)
3230 : : {
3231 : 0 : pBox->SelectEntryPos(i);
3232 : 0 : break;
3233 : : }
3234 : 0 : nMask <<=1;
3235 : : }
3236 : : }
3237 : 0 : aRelativeCB.Enable(nActNumLvl != 1);
3238 : 0 : SetModified();
3239 : 0 : InitPosAndSpaceMode();
3240 : 0 : ShowControlsDependingOnPosAndSpaceMode();
3241 : 0 : InitControls();
3242 : 0 : return 0;
3243 : : }
3244 : :
3245 : 0 : IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld )
3246 : : {
3247 [ # # ]: 0 : if(bInInintControl)
3248 : 0 : return 0;
3249 : 0 : long nValue = GetCoreValue(*pFld, eCoreUnit);
3250 : 0 : sal_uInt16 nMask = 1;
3251 : : #if OSL_DEBUG_LEVEL > 1
3252 : : sal_Bool bFirst = sal_True;
3253 : : #endif
3254 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
3255 : : {
3256 [ # # ]: 0 : if(nActNumLvl & nMask)
3257 : : {
3258 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
3259 [ # # ]: 0 : if(pFld == &aDistBorderMF)
3260 : : {
3261 : :
3262 [ # # ][ # # ]: 0 : if(aRelativeCB.IsChecked())
3263 : : {
3264 [ # # ]: 0 : if(0 == i)
3265 : : {
3266 [ # # ]: 0 : long nTmp = aNumFmt.GetFirstLineOffset();
3267 : 0 : aNumFmt.SetAbsLSpace( sal_uInt16(nValue - nTmp));
3268 : : }
3269 : : else
3270 : : {
3271 [ # # ][ # # ]: 0 : long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() +
3272 [ # # ][ # # ]: 0 : pActNum->GetLevel( i - 1 ).GetFirstLineOffset() -
3273 [ # # ][ # # ]: 0 : pActNum->GetLevel( i ).GetFirstLineOffset();
3274 : :
3275 : 0 : aNumFmt.SetAbsLSpace( sal_uInt16(nValue + nTmp));
3276 : : }
3277 : : }
3278 : : else
3279 : : {
3280 [ # # ]: 0 : aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset());
3281 : : }
3282 : : }
3283 [ # # ]: 0 : else if(pFld == &aDistNumMF)
3284 : : {
3285 : 0 : aNumFmt.SetCharTextDistance( (short)nValue );
3286 : : }
3287 [ # # ]: 0 : else if(pFld == &aIndentMF)
3288 : : {
3289 : : // together with the FirstLineOffset the AbsLSpace must be changed, too
3290 [ # # ]: 0 : long nDiff = nValue + aNumFmt.GetFirstLineOffset();
3291 [ # # ]: 0 : long nAbsLSpace = aNumFmt.GetAbsLSpace();
3292 : 0 : aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff));
3293 : 0 : aNumFmt.SetFirstLineOffset( -(short)nValue );
3294 : : }
3295 : :
3296 : : #if OSL_DEBUG_LEVEL > 1
3297 : : if(bFirst)
3298 : : lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
3299 : : bFirst = sal_False;
3300 : : #endif
3301 [ # # ][ # # ]: 0 : pActNum->SetLevel( i, aNumFmt );
3302 : : }
3303 : 0 : nMask <<= 1;
3304 : : }
3305 : :
3306 : 0 : SetModified();
3307 [ # # ]: 0 : if(!aDistBorderMF.IsEnabled())
3308 : : {
3309 [ # # ]: 0 : String aEmptyStr;
3310 [ # # ][ # # ]: 0 : aDistBorderMF.SetText(aEmptyStr);
3311 : : }
3312 : :
3313 : 0 : return 0;
3314 : : }
3315 : :
3316 : 0 : IMPL_LINK( SvxNumPositionTabPage, RelativeHdl_Impl, CheckBox *, pBox )
3317 : : {
3318 [ # # ]: 0 : sal_Bool bOn = pBox->IsChecked();
3319 [ # # ][ # # ]: 0 : sal_Bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl;
[ # # ]
3320 : 0 : sal_Bool bSetValue = sal_False;
3321 : 0 : long nValue = 0;
3322 [ # # ][ # # ]: 0 : if(bOn || bSingleSelection)
3323 : : {
3324 : 0 : sal_uInt16 nMask = 1;
3325 : 0 : sal_Bool bFirst = sal_True;
3326 : 0 : bSetValue = sal_True;
3327 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
3328 : : {
3329 [ # # ]: 0 : if(nActNumLvl & nMask)
3330 : : {
3331 [ # # ]: 0 : const SvxNumberFormat &rNumFmt = pActNum->GetLevel(i);
3332 [ # # ]: 0 : if(bFirst)
3333 : : {
3334 [ # # ][ # # ]: 0 : nValue = rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset();
3335 [ # # ][ # # ]: 0 : if(bOn && i)
3336 [ # # ][ # # ]: 0 : nValue -= (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
[ # # ][ # # ]
3337 : : }
3338 : : else
3339 : : bSetValue = nValue ==
3340 [ # # ][ # # ]: 0 : (rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset()) -
3341 [ # # ][ # # ]: 0 : (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
[ # # ][ # # ]
3342 : 0 : bFirst = sal_False;
3343 : : }
3344 : 0 : nMask <<= 1;
3345 : : }
3346 : :
3347 : : }
3348 [ # # ]: 0 : String aEmptyStr;
3349 [ # # ]: 0 : if(bSetValue)
3350 [ # # ]: 0 : SetMetricValue(aDistBorderMF, nValue, eCoreUnit);
3351 : : else
3352 [ # # ]: 0 : aDistBorderMF.SetText(aEmptyStr);
3353 [ # # ][ # # ]: 0 : aDistBorderMF.Enable(bOn || bSingleSelection);
[ # # ]
3354 [ # # ][ # # ]: 0 : aDistBorderFT.Enable(bOn || bSingleSelection);
[ # # ]
3355 : 0 : bLastRelative = bOn;
3356 [ # # ]: 0 : return 0;
3357 : : }
3358 : :
3359 : 0 : IMPL_LINK_NOARG(SvxNumPositionTabPage, LabelFollowedByHdl_Impl)
3360 : : {
3361 : : // determine value to be set at the chosen list levels
3362 : 0 : SvxNumberFormat::LabelFollowedBy eLabelFollowedBy = SvxNumberFormat::LISTTAB;
3363 : : {
3364 : 0 : const sal_uInt16 nPos = aLabelFollowedByLB.GetSelectEntryPos();
3365 [ # # ]: 0 : if ( nPos == 1 )
3366 : : {
3367 : 0 : eLabelFollowedBy = SvxNumberFormat::SPACE;
3368 : : }
3369 [ # # ]: 0 : else if ( nPos == 2 )
3370 : : {
3371 : 0 : eLabelFollowedBy = SvxNumberFormat::NOTHING;
3372 : : }
3373 : : }
3374 : :
3375 : : // set value at the chosen list levels
3376 : 0 : bool bSameListtabPos = true;
3377 : 0 : sal_uInt16 nFirstLvl = USHRT_MAX;
3378 : 0 : sal_uInt16 nMask = 1;
3379 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
3380 : : {
3381 [ # # ]: 0 : if ( nActNumLvl & nMask )
3382 : : {
3383 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3384 [ # # ]: 0 : aNumFmt.SetLabelFollowedBy( eLabelFollowedBy );
3385 [ # # ]: 0 : pActNum->SetLevel( i, aNumFmt );
3386 : :
3387 [ # # ]: 0 : if ( nFirstLvl == USHRT_MAX )
3388 : : {
3389 : 0 : nFirstLvl = i;
3390 : : }
3391 : : else
3392 : : {
3393 [ # # ]: 0 : bSameListtabPos &= aNumFmt.GetListtabPos() ==
3394 [ # # ][ # # ]: 0 : pActNum->GetLevel( nFirstLvl ).GetListtabPos();
3395 [ # # ]: 0 : }
3396 : : }
3397 : 0 : nMask <<= 1;
3398 : : }
3399 : :
3400 : : // enable/disable metric field for list tab stop position depending on
3401 : : // selected item following the list label.
3402 : 0 : aListtabFT.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
3403 : 0 : aListtabMF.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
3404 [ # # ][ # # ]: 0 : if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB )
3405 : : {
3406 : 0 : SetMetricValue( aListtabMF, pActNum->GetLevel( nFirstLvl ).GetListtabPos(), eCoreUnit );
3407 : : }
3408 : : else
3409 : : {
3410 [ # # ]: 0 : aListtabMF.SetText( String() );
3411 : : }
3412 : :
3413 : 0 : SetModified();
3414 : :
3415 : 0 : return 0;
3416 : : }
3417 : :
3418 : 0 : IMPL_LINK( SvxNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld )
3419 : : {
3420 : : // determine value to be set at the chosen list levels
3421 : 0 : const long nValue = GetCoreValue( *pFld, eCoreUnit );
3422 : :
3423 : : // set value at the chosen list levels
3424 : 0 : sal_uInt16 nMask = 1;
3425 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
3426 : : {
3427 [ # # ]: 0 : if ( nActNumLvl & nMask )
3428 : : {
3429 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3430 [ # # ]: 0 : aNumFmt.SetListtabPos( nValue );
3431 [ # # ][ # # ]: 0 : pActNum->SetLevel( i, aNumFmt );
3432 : : #if OSL_DEBUG_LEVEL > 1
3433 : : lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
3434 : : #endif
3435 : : }
3436 : 0 : nMask <<= 1;
3437 : : }
3438 : :
3439 : 0 : SetModified();
3440 : :
3441 : 0 : return 0;
3442 : : }
3443 : :
3444 : 0 : IMPL_LINK( SvxNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld )
3445 : : {
3446 : : // determine value to be set at the chosen list levels
3447 : 0 : const long nValue = GetCoreValue( *pFld, eCoreUnit );
3448 : :
3449 : : // set value at the chosen list levels
3450 : 0 : sal_uInt16 nMask = 1;
3451 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
3452 : : {
3453 [ # # ]: 0 : if ( nActNumLvl & nMask )
3454 : : {
3455 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3456 [ # # ]: 0 : const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
3457 [ # # ]: 0 : aNumFmt.SetFirstLineIndent( nFirstLineIndent );
3458 [ # # ][ # # ]: 0 : pActNum->SetLevel( i, aNumFmt );
3459 : : #if OSL_DEBUG_LEVEL > 1
3460 : : lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
3461 : : #endif
3462 : : }
3463 : 0 : nMask <<= 1;
3464 : : }
3465 : :
3466 : 0 : SetModified();
3467 : :
3468 : 0 : return 0;
3469 : : }
3470 : :
3471 : 0 : IMPL_LINK( SvxNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld )
3472 : : {
3473 : : // determine value to be set at the chosen list levels
3474 : 0 : const long nValue = GetCoreValue( *pFld, eCoreUnit );
3475 : :
3476 : : // set value at the chosen list levels
3477 : 0 : sal_uInt16 nMask = 1;
3478 [ # # ]: 0 : for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
3479 : : {
3480 [ # # ]: 0 : if ( nActNumLvl & nMask )
3481 : : {
3482 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3483 [ # # ]: 0 : const long nAlignedAt = aNumFmt.GetIndentAt() +
3484 [ # # ]: 0 : aNumFmt.GetFirstLineIndent();
3485 [ # # ]: 0 : aNumFmt.SetIndentAt( nValue );
3486 : 0 : const long nNewFirstLineIndent = nAlignedAt - nValue;
3487 [ # # ]: 0 : aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
3488 [ # # ][ # # ]: 0 : pActNum->SetLevel( i, aNumFmt );
3489 : : #if OSL_DEBUG_LEVEL > 1
3490 : : lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt);
3491 : : #endif
3492 : : }
3493 : 0 : nMask <<= 1;
3494 : : }
3495 : :
3496 : 0 : SetModified();
3497 : :
3498 : 0 : return 0;
3499 : : }
3500 : :
3501 : 0 : IMPL_LINK_NOARG(SvxNumPositionTabPage, StandardHdl_Impl)
3502 : : {
3503 : 0 : sal_uInt16 nMask = 1;
3504 : : SvxNumRule aTmpNumRule( pActNum->GetFeatureFlags(),
3505 : 0 : pActNum->GetLevelCount(),
3506 : 0 : pActNum->IsContinuousNumbering(),
3507 : : SVX_RULETYPE_NUMBERING,
3508 [ # # ]: 0 : pActNum->GetLevel( 0 ).GetPositionAndSpaceMode() );
[ # # # # ]
3509 [ # # ]: 0 : for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
3510 : : {
3511 [ # # ]: 0 : if(nActNumLvl & nMask)
3512 : : {
3513 [ # # ][ # # ]: 0 : SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
3514 [ # # ][ # # ]: 0 : SvxNumberFormat aTempFmt(aTmpNumRule.GetLevel( i ));
3515 [ # # ][ # # ]: 0 : aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() );
3516 [ # # ][ # # ]: 0 : if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
3517 : : {
3518 [ # # ]: 0 : aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace() );
3519 [ # # ]: 0 : aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() );
3520 [ # # ]: 0 : aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() );
3521 : : }
3522 [ # # ][ # # ]: 0 : else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
3523 : : {
3524 : 0 : aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() );
3525 [ # # ][ # # ]: 0 : aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() );
3526 [ # # ][ # # ]: 0 : aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() );
3527 [ # # ][ # # ]: 0 : aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() );
3528 [ # # ][ # # ]: 0 : aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() );
3529 : : }
3530 : :
3531 [ # # ][ # # ]: 0 : pActNum->SetLevel( i, aNumFmt );
[ # # ]
3532 : : }
3533 : 0 : nMask <<= 1;
3534 : : }
3535 : :
3536 [ # # ]: 0 : InitControls();
3537 [ # # ]: 0 : SetModified();
3538 [ # # ]: 0 : return 0;
3539 : : }
3540 : :
3541 : 0 : void SvxNumPositionTabPage::SetModified(sal_Bool bRepaint)
3542 : : {
3543 : 0 : bModified = sal_True;
3544 [ # # ]: 0 : if(bRepaint)
3545 : : {
3546 : 0 : pPreviewWIN->SetLevel(nActNumLvl);
3547 : 0 : pPreviewWIN->Invalidate();
3548 : : }
3549 : 0 : }
3550 : :
3551 : 0 : void SvxNumOptionsTabPage::SetModified(sal_Bool bRepaint)
3552 : : {
3553 : 0 : bModified = sal_True;
3554 [ # # ]: 0 : if(bRepaint)
3555 : : {
3556 : 0 : pPreviewWIN->SetLevel(nActNumLvl);
3557 : 0 : pPreviewWIN->Invalidate();
3558 : : }
3559 : 0 : }
3560 : :
3561 : :
3562 : 0 : void SvxNumOptionsTabPage::PageCreated(SfxAllItemSet aSet)
3563 : : {
3564 : 0 : SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_CHAR_FMT_LIST_BOX,sal_False);
3565 : 0 : SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False);
3566 : 0 : SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
3567 : 0 : SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False);
3568 : :
3569 [ # # ][ # # ]: 0 : if (pNumCharFmt &&pBulletCharFmt)
3570 : 0 : SetCharFmts( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
3571 : :
3572 [ # # ]: 0 : if (pListItem)
3573 : : {
3574 : 0 : ListBox& myCharFmtLB = GetCharFmtListBox();
3575 : 0 : const std::vector<String> &aList = (pListItem)->GetList();
3576 : 0 : sal_uInt32 nCount = aList.size();;
3577 [ # # ]: 0 : for(sal_uInt32 i = 0; i < nCount; i++)
3578 : 0 : myCharFmtLB.InsertEntry(aList[i]);
3579 : : }
3580 [ # # ]: 0 : if (pMetricItem)
3581 : 0 : SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
3582 : 0 : }
3583 : :
3584 : 0 : void SvxNumPositionTabPage::PageCreated(SfxAllItemSet aSet)
3585 : : {
3586 : 0 : SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False);
3587 : :
3588 [ # # ]: 0 : if (pMetricItem)
3589 : 0 : SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
3590 : 0 : }
3591 : :
3592 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|