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 <hintids.hxx>
21 : #include <vcl/msgbox.hxx>
22 : #include <sfx2/app.hxx>
23 : #include <sfx2/imgmgr.hxx>
24 : #include <svx/gallery.hxx>
25 : #include <editeng/brushitem.hxx>
26 : #include <editeng/lrspitem.hxx>
27 : #include <editeng/numitem.hxx>
28 : #include <swvset.hxx>
29 : #include <swmodule.hxx>
30 : #include <wrtsh.hxx>
31 : #include <docsh.hxx>
32 : #include <wview.hxx>
33 : #include <uitool.hxx>
34 : #include <wdocsh.hxx>
35 : #include <uiitems.hxx>
36 : #include <docstyle.hxx>
37 : #include <charfmt.hxx>
38 : #include <uinums.hxx>
39 : #include <poolfmt.hxx>
40 : #include <shellres.hxx>
41 : #include <outline.hxx>
42 : #include <num.hxx>
43 : #include <viewopt.hxx>
44 : #include <frmmgr.hxx>
45 :
46 : #include <misc.hrc>
47 : #include <frmui.hrc>
48 : #include <globals.hrc>
49 : #include <helpid.h>
50 : #include <SwStyleNameMapper.hxx>
51 : #include <svx/svxids.hrc>
52 : #include <svx/dialogs.hrc>
53 : #include <svl/stritem.hxx>
54 : #include <svl/aeitem.hxx>
55 : #include <svl/slstitm.hxx>
56 :
57 : static sal_Bool bLastRelative = sal_False;
58 :
59 : //See cui/uiconfig/ui/numberingpositionpage.ui for effectively a duplicate
60 : //dialog to this one, except with a different preview window impl.
61 : //TODO, determine if SwNumPositionTabPage and SvxNumPositionTabPage can be
62 : //merged
63 0 : SwNumPositionTabPage::SwNumPositionTabPage(Window* pParent,
64 : const SfxItemSet& rSet)
65 : : SfxTabPage(pParent, "OutlinePositionPage",
66 : "modules/swriter/ui/outlinepositionpage.ui", rSet)
67 : , pActNum(0)
68 : , pSaveNum(0)
69 : , pWrtSh(0)
70 : , pOutlineDlg(0)
71 : , bPreset( sal_False )
72 : , bInInintControl(sal_False)
73 0 : , bLabelAlignmentPosAndSpaceModeActive( false )
74 : {
75 0 : get(m_pLevelLB, "levellb");
76 0 : m_pLevelLB->EnableMultiSelection(true);
77 0 : get(m_pPositionFrame, "numberingframe");
78 0 : get(m_pDistBorderFT, "indent");
79 0 : get(m_pDistBorderMF, "indentmf");
80 0 : get(m_pRelativeCB, "relative");
81 0 : get(m_pIndentFT, "numberingwidth");
82 0 : get(m_pIndentMF, "numberingwidthmf");
83 0 : get(m_pDistNumFT, "numdist");
84 0 : get(m_pDistNumMF, "numdistmf");
85 0 : get(m_pAlignFT, "numalign");
86 0 : get(m_pAlignLB, "numalignlb");
87 :
88 0 : get(m_pLabelFollowedByFT, "numfollowedby");
89 0 : get(m_pLabelFollowedByLB, "numfollowedbylb");
90 0 : get(m_pListtabFT, "at");
91 0 : get(m_pListtabMF, "atmf");
92 0 : get(m_pAlign2FT, "num2align");
93 0 : get(m_pAlign2LB, "num2alignlb");
94 0 : get(m_pAlignedAtFT, "alignedat");
95 0 : get(m_pAlignedAtMF, "alignedatmf");
96 0 : get(m_pIndentAtFT, "indentat");
97 0 : get(m_pIndentAtMF, "indentatmf");
98 0 : get(m_pStandardPB, "standard");
99 :
100 0 : get(m_pPreviewWIN, "preview");
101 :
102 0 : SetExchangeSupport();
103 0 : m_pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
104 :
105 0 : m_pStandardPB->SetAccessibleRelationMemberOf(m_pPositionFrame->get_label_widget());
106 :
107 :
108 0 : m_pRelativeCB->Check();
109 0 : m_pAlignLB->SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl));
110 0 : m_pAlign2LB->SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl));
111 0 : for ( sal_uInt16 i = 0; i < m_pAlignLB->GetEntryCount(); ++i )
112 : {
113 0 : m_pAlign2LB->InsertEntry( m_pAlignLB->GetEntry( i ) );
114 : }
115 0 : m_pAlign2LB->SetDropDownLineCount( m_pAlign2LB->GetEntryCount() );
116 0 : m_pAlign2FT->SetText( m_pAlignFT->GetText() );
117 :
118 0 : Link aLk = LINK(this, SwNumPositionTabPage, DistanceHdl);
119 0 : m_pDistBorderMF->SetUpHdl(aLk);
120 0 : m_pDistNumMF->SetUpHdl(aLk);
121 0 : m_pIndentMF->SetUpHdl(aLk);
122 0 : m_pDistBorderMF->SetDownHdl(aLk);
123 0 : m_pDistNumMF->SetDownHdl(aLk);
124 0 : m_pIndentMF->SetDownHdl(aLk);
125 0 : m_pDistBorderMF->SetLoseFocusHdl(aLk);
126 0 : m_pDistNumMF->SetLoseFocusHdl(aLk);
127 0 : m_pIndentMF->SetLoseFocusHdl(aLk);
128 :
129 0 : m_pLabelFollowedByLB->SetDropDownLineCount( m_pLabelFollowedByLB->GetEntryCount() );
130 0 : m_pLabelFollowedByLB->SetSelectHdl( LINK(this, SwNumPositionTabPage, LabelFollowedByHdl_Impl) );
131 :
132 0 : aLk = LINK(this, SwNumPositionTabPage, ListtabPosHdl_Impl);
133 0 : m_pListtabMF->SetUpHdl(aLk);
134 0 : m_pListtabMF->SetDownHdl(aLk);
135 0 : m_pListtabMF->SetLoseFocusHdl(aLk);
136 :
137 0 : aLk = LINK(this, SwNumPositionTabPage, AlignAtHdl_Impl);
138 0 : m_pAlignedAtMF->SetUpHdl(aLk);
139 0 : m_pAlignedAtMF->SetDownHdl(aLk);
140 0 : m_pAlignedAtMF->SetLoseFocusHdl(aLk);
141 :
142 0 : aLk = LINK(this, SwNumPositionTabPage, IndentAtHdl_Impl);
143 0 : m_pIndentAtMF->SetUpHdl(aLk);
144 0 : m_pIndentAtMF->SetDownHdl(aLk);
145 0 : m_pIndentAtMF->SetLoseFocusHdl(aLk);
146 :
147 0 : m_pLevelLB->SetSelectHdl(LINK(this, SwNumPositionTabPage, LevelHdl));
148 0 : m_pRelativeCB->SetClickHdl(LINK(this, SwNumPositionTabPage, RelativeHdl));
149 0 : m_pStandardPB->SetClickHdl(LINK(this, SwNumPositionTabPage, StandardHdl));
150 :
151 : // insert levels
152 0 : for(sal_uInt16 i = 1; i <= MAXLEVEL; i++)
153 0 : m_pLevelLB->InsertEntry(OUString::number(i));
154 0 : String sEntry(OUString("1 - "));
155 0 : sEntry += OUString::number(MAXLEVEL);
156 0 : m_pLevelLB->InsertEntry(sEntry);
157 0 : m_pLevelLB->SelectEntry(sEntry);
158 :
159 0 : m_pRelativeCB->Check(bLastRelative);
160 0 : m_pPreviewWIN->SetPositionMode();
161 0 : }
162 :
163 0 : SwNumPositionTabPage::~SwNumPositionTabPage()
164 : {
165 0 : delete pActNum;
166 0 : }
167 :
168 0 : void SwNumPositionTabPage::InitControls()
169 : {
170 0 : bInInintControl = sal_True;
171 0 : const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive &&
172 0 : m_pRelativeCB->IsEnabled() && m_pRelativeCB->IsChecked();
173 0 : const bool bSingleSelection = m_pLevelLB->GetSelectEntryCount() == 1 &&
174 0 : USHRT_MAX != nActNumLvl;
175 :
176 0 : m_pDistBorderMF->Enable( !bLabelAlignmentPosAndSpaceModeActive &&
177 0 : ( bSingleSelection || bRelative || pOutlineDlg != 0 ) );
178 0 : m_pDistBorderFT->Enable( !bLabelAlignmentPosAndSpaceModeActive &&
179 0 : ( bSingleSelection || bRelative || pOutlineDlg != 0 ) );
180 :
181 0 : bool bSetDistEmpty = false;
182 0 : bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
183 0 : bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive;
184 0 : bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive;
185 0 : bool bSameAdjust = true;
186 :
187 0 : bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive;
188 0 : bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive;
189 0 : bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive;
190 0 : bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive;
191 :
192 : const SwNumFmt* aNumFmtArr[MAXLEVEL];
193 0 : sal_uInt16 nMask = 1;
194 0 : sal_uInt16 nLvl = USHRT_MAX;
195 0 : long nFirstBorderTextRelative = -1;
196 0 : for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
197 : {
198 0 : aNumFmtArr[i] = &pActNum->Get(i);
199 0 : if(nActNumLvl & nMask)
200 : {
201 0 : if(USHRT_MAX == nLvl)
202 : {
203 0 : nLvl = i;
204 : }
205 :
206 0 : if( i > nLvl)
207 : {
208 0 : bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
209 0 : if ( !bLabelAlignmentPosAndSpaceModeActive )
210 : {
211 0 : if(bRelative)
212 : {
213 0 : if(nFirstBorderTextRelative == -1)
214 : nFirstBorderTextRelative =
215 0 : (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
216 0 : aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
217 : else
218 0 : bSameDistBorderNum &= nFirstBorderTextRelative ==
219 0 : (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
220 0 : aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
221 :
222 : }
223 : else
224 : {
225 : bSameDistBorderNum &=
226 0 : aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() ==
227 0 : aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset();
228 : }
229 :
230 0 : bSameDist &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance();
231 0 : bSameIndent &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset();
232 : }
233 : else
234 : {
235 : bSameLabelFollowedBy &=
236 0 : aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy();
237 : bSameListtab &=
238 0 : aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos();
239 : bSameAlignAt &=
240 0 : ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() )
241 0 : == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) );
242 : bSameIndentAt &=
243 0 : aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt();
244 : }
245 : }
246 : }
247 0 : nMask <<= 1;
248 :
249 : }
250 0 : if (MAXLEVEL <= nLvl)
251 : {
252 : OSL_ENSURE(false, "cannot happen.");
253 0 : return;
254 : }
255 0 : if(bSameDistBorderNum)
256 : {
257 : long nDistBorderNum;
258 0 : if(bRelative)
259 : {
260 0 : nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
261 0 : if(nLvl)
262 0 : nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
263 : }
264 : else
265 : {
266 0 : nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
267 : }
268 0 : m_pDistBorderMF->SetValue(m_pDistBorderMF->Normalize(nDistBorderNum),FUNIT_TWIP);
269 : }
270 : else
271 0 : bSetDistEmpty = sal_True;
272 :
273 0 : if(bSameDist)
274 0 : m_pDistNumMF->SetValue(m_pDistNumMF->Normalize(aNumFmtArr[nLvl]->GetCharTextDistance()), FUNIT_TWIP);
275 : else
276 0 : m_pDistNumMF->SetText(aEmptyStr);
277 0 : if(bSameIndent)
278 0 : m_pIndentMF->SetValue(m_pIndentMF->Normalize(-aNumFmtArr[nLvl]->GetFirstLineOffset()), FUNIT_TWIP);
279 : else
280 0 : m_pIndentMF->SetText(aEmptyStr);
281 :
282 0 : if(bSameAdjust)
283 : {
284 0 : sal_uInt16 nPos = 1; // centered
285 0 : if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
286 0 : nPos = 0;
287 0 : else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
288 0 : nPos = 2;
289 0 : m_pAlignLB->SelectEntryPos(nPos);
290 0 : m_pAlign2LB->SelectEntryPos( nPos );
291 : }
292 : else
293 : {
294 0 : m_pAlignLB->SetNoSelection();
295 0 : m_pAlign2LB->SetNoSelection();
296 : }
297 :
298 0 : if ( bSameLabelFollowedBy )
299 : {
300 0 : sal_uInt16 nPos = 0; // LISTTAB
301 0 : if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE )
302 : {
303 0 : nPos = 1;
304 : }
305 0 : else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
306 : {
307 0 : nPos = 2;
308 : }
309 0 : m_pLabelFollowedByLB->SelectEntryPos( nPos );
310 : }
311 : else
312 : {
313 0 : m_pLabelFollowedByLB->SetNoSelection();
314 : }
315 :
316 0 : if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
317 : {
318 0 : m_pListtabFT->Enable( true );
319 0 : m_pListtabMF->Enable( true );
320 0 : if ( bSameListtab )
321 : {
322 0 : m_pListtabMF->SetValue(m_pListtabMF->Normalize(aNumFmtArr[nLvl]->GetListtabPos()),FUNIT_TWIP);
323 : }
324 : else
325 : {
326 0 : m_pListtabMF->SetText(aEmptyStr);
327 : }
328 : }
329 : else
330 : {
331 0 : m_pListtabFT->Enable( false );
332 0 : m_pListtabMF->Enable( false );
333 0 : m_pListtabMF->SetText(aEmptyStr);
334 : }
335 :
336 0 : if ( bSameAlignAt )
337 : {
338 : m_pAlignedAtMF->SetValue(
339 0 : m_pAlignedAtMF->Normalize( aNumFmtArr[nLvl]->GetIndentAt() +
340 0 : aNumFmtArr[nLvl]->GetFirstLineIndent()),
341 0 : FUNIT_TWIP );
342 : }
343 : else
344 : {
345 0 : m_pAlignedAtMF->SetText(aEmptyStr);
346 : }
347 :
348 0 : if ( bSameIndentAt )
349 : {
350 : m_pIndentAtMF->SetValue(
351 0 : m_pIndentAtMF->Normalize( aNumFmtArr[nLvl]->GetIndentAt()), FUNIT_TWIP );
352 : }
353 : else
354 : {
355 0 : m_pIndentAtMF->SetText(aEmptyStr);
356 : }
357 :
358 0 : if(sal_True == bSetDistEmpty)
359 0 : m_pDistBorderMF->SetText(aEmptyStr);
360 :
361 0 : bInInintControl = sal_False;
362 : }
363 :
364 0 : void SwNumPositionTabPage::ActivatePage(const SfxItemSet& )
365 : {
366 : const SfxPoolItem* pItem;
367 : sal_uInt16 nTmpNumLvl =
368 0 : pOutlineDlg ? pOutlineDlg->GetActNumLevel() : 0;
369 0 : const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
370 0 : if(pExampleSet && pExampleSet->GetItemState(FN_PARAM_NUM_PRESET, sal_False, &pItem))
371 : {
372 0 : bPreset = ((const SfxBoolItem*)pItem)->GetValue();
373 : }
374 0 : bModified = (!pActNum->GetNumFmt( 0 ) || bPreset);
375 0 : if(*pActNum != *pSaveNum ||
376 0 : nActNumLvl != nTmpNumLvl )
377 : {
378 0 : *pActNum = *pSaveNum;
379 0 : nActNumLvl = nTmpNumLvl;
380 0 : sal_uInt16 nMask = 1;
381 0 : m_pLevelLB->SetUpdateMode(sal_False);
382 0 : m_pLevelLB->SetNoSelection();
383 0 : m_pLevelLB->SelectEntryPos( MAXLEVEL, nActNumLvl == USHRT_MAX);
384 0 : if(nActNumLvl != USHRT_MAX)
385 0 : for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
386 : {
387 0 : if(nActNumLvl & nMask)
388 0 : m_pLevelLB->SelectEntryPos( i, sal_True);
389 0 : nMask <<= 1 ;
390 : }
391 0 : m_pLevelLB->SetUpdateMode(sal_True);
392 :
393 0 : InitPosAndSpaceMode();
394 0 : ShowControlsDependingOnPosAndSpaceMode();
395 :
396 0 : InitControls();
397 : }
398 0 : m_pRelativeCB->Enable(1 != nActNumLvl);
399 0 : m_pPreviewWIN->Invalidate();
400 0 : }
401 :
402 0 : int SwNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet)
403 : {
404 0 : SwOutlineTabDialog::SetActNumLevel(nActNumLvl);
405 0 : if(_pSet)
406 0 : FillItemSet(*_pSet);
407 0 : return sal_True;
408 :
409 : }
410 :
411 0 : sal_Bool SwNumPositionTabPage::FillItemSet( SfxItemSet& rSet )
412 : {
413 0 : if(pOutlineDlg)
414 0 : *pOutlineDlg->GetNumRule() = *pActNum;
415 0 : else if(bModified && pActNum)
416 : {
417 0 : *pSaveNum = *pActNum;
418 0 : rSet.Put(SwUINumRuleItem( *pSaveNum ));
419 0 : rSet.Put(SfxBoolItem(FN_PARAM_NUM_PRESET, sal_False));
420 : }
421 0 : return bModified;
422 : }
423 :
424 0 : void SwNumPositionTabPage::Reset( const SfxItemSet& rSet )
425 : {
426 : const SfxPoolItem* pItem;
427 0 : if(pOutlineDlg)
428 : {
429 0 : pSaveNum = pOutlineDlg->GetNumRule();
430 0 : m_pLevelLB->EnableMultiSelection(sal_False);
431 : }
432 0 : else if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_ACT_NUMBER, sal_False, &pItem))
433 0 : pSaveNum = ((SwUINumRuleItem*)pItem)->GetNumRule();
434 :
435 0 : nActNumLvl = SwOutlineTabDialog::GetActNumLevel();
436 0 : sal_uInt16 nMask = 1;
437 0 : m_pLevelLB->SetUpdateMode(sal_False);
438 0 : m_pLevelLB->SetNoSelection();
439 0 : if(nActNumLvl == USHRT_MAX)
440 : {
441 0 : m_pLevelLB->SelectEntryPos( MAXLEVEL, sal_True);
442 : }
443 : else
444 0 : for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
445 : {
446 0 : if(nActNumLvl & nMask)
447 0 : m_pLevelLB->SelectEntryPos( i, sal_True);
448 0 : nMask <<= 1;
449 : }
450 0 : m_pLevelLB->SetUpdateMode(sal_True);
451 :
452 0 : if(!pActNum)
453 0 : pActNum = new SwNumRule(*pSaveNum);
454 0 : else if(*pSaveNum != *pActNum)
455 0 : *pActNum = *pSaveNum;
456 0 : m_pPreviewWIN->SetNumRule(pActNum);
457 0 : InitPosAndSpaceMode();
458 0 : ShowControlsDependingOnPosAndSpaceMode();
459 0 : InitControls();
460 0 : bModified = sal_False;
461 0 : }
462 :
463 0 : void SwNumPositionTabPage::InitPosAndSpaceMode()
464 : {
465 0 : if ( pActNum == 0 )
466 : {
467 : OSL_FAIL( "<SwNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" );
468 0 : return;
469 : }
470 :
471 : SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode =
472 0 : SvxNumberFormat::LABEL_ALIGNMENT;
473 0 : sal_uInt16 nMask = 1;
474 0 : for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
475 : {
476 0 : if(nActNumLvl & nMask)
477 : {
478 0 : SvxNumberFormat aNumFmt( pActNum->Get(i) );
479 0 : ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
480 0 : if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
481 : {
482 0 : break;
483 0 : }
484 : }
485 0 : nMask <<= 1;
486 : }
487 :
488 : bLabelAlignmentPosAndSpaceModeActive =
489 0 : ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
490 : }
491 :
492 0 : void SwNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
493 : {
494 0 : m_pDistBorderFT->Show( !bLabelAlignmentPosAndSpaceModeActive );
495 0 : m_pDistBorderMF->Show( !bLabelAlignmentPosAndSpaceModeActive );
496 0 : m_pRelativeCB->Show( !bLabelAlignmentPosAndSpaceModeActive );
497 0 : m_pIndentFT->Show( !bLabelAlignmentPosAndSpaceModeActive );
498 0 : m_pIndentMF->Show( !bLabelAlignmentPosAndSpaceModeActive );
499 0 : m_pDistNumFT->Show( !bLabelAlignmentPosAndSpaceModeActive );
500 0 : m_pDistNumMF->Show( !bLabelAlignmentPosAndSpaceModeActive );
501 0 : m_pAlignFT->Show( !bLabelAlignmentPosAndSpaceModeActive );
502 0 : m_pAlignLB->Show( !bLabelAlignmentPosAndSpaceModeActive );
503 :
504 0 : m_pLabelFollowedByFT->Show( bLabelAlignmentPosAndSpaceModeActive );
505 0 : m_pLabelFollowedByLB->Show( bLabelAlignmentPosAndSpaceModeActive );
506 0 : m_pListtabFT->Show( bLabelAlignmentPosAndSpaceModeActive );
507 0 : m_pListtabMF->Show( bLabelAlignmentPosAndSpaceModeActive );
508 0 : m_pAlign2FT->Show( bLabelAlignmentPosAndSpaceModeActive );
509 0 : m_pAlign2LB->Show( bLabelAlignmentPosAndSpaceModeActive );
510 0 : m_pAlignedAtFT->Show( bLabelAlignmentPosAndSpaceModeActive );
511 0 : m_pAlignedAtMF->Show( bLabelAlignmentPosAndSpaceModeActive );
512 0 : m_pIndentAtFT->Show( bLabelAlignmentPosAndSpaceModeActive );
513 0 : m_pIndentAtMF->Show( bLabelAlignmentPosAndSpaceModeActive );
514 0 : }
515 :
516 0 : SfxTabPage* SwNumPositionTabPage::Create( Window* pParent,
517 : const SfxItemSet& rAttrSet)
518 : {
519 0 : return new SwNumPositionTabPage(pParent, rAttrSet);
520 : }
521 :
522 0 : void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh)
523 : {
524 0 : pWrtSh = pSh;
525 :
526 0 : const SwTwips nWidth = pWrtSh->GetAnyCurRect(RECT_FRM).Width();
527 :
528 0 : m_pDistBorderMF->SetMax(m_pDistBorderMF->Normalize( nWidth ), FUNIT_TWIP );
529 0 : m_pDistNumMF->SetMax(m_pDistNumMF->Normalize( nWidth ), FUNIT_TWIP);
530 0 : m_pIndentMF->SetMax(m_pIndentMF->Normalize( nWidth ), FUNIT_TWIP );
531 0 : m_pListtabMF->SetMax(m_pListtabMF->Normalize( nWidth ), FUNIT_TWIP );
532 0 : m_pAlignedAtMF->SetMax(m_pAlignedAtMF->Normalize( nWidth ), FUNIT_TWIP );
533 0 : m_pIndentAtMF->SetMax(m_pIndentAtMF->Normalize( nWidth ), FUNIT_TWIP );
534 0 : const SwTwips nLast2 = nWidth /2;
535 0 : m_pDistBorderMF->SetLast( m_pDistBorderMF->Normalize( nLast2 ), FUNIT_TWIP );
536 0 : m_pDistNumMF->SetLast(m_pDistNumMF->Normalize( nLast2 ), FUNIT_TWIP);
537 0 : m_pIndentMF->SetLast(m_pIndentMF->Normalize( nLast2 ), FUNIT_TWIP );
538 0 : m_pListtabMF->SetLast(m_pListtabMF->Normalize( nLast2 ), FUNIT_TWIP );
539 0 : m_pAlignedAtMF->SetLast(m_pAlignedAtMF->Normalize( nLast2 ), FUNIT_TWIP );
540 0 : m_pIndentAtMF->SetLast(m_pIndentAtMF->Normalize( nLast2 ), FUNIT_TWIP );
541 :
542 0 : const SwRect& rPrtRect = pWrtSh->GetAnyCurRect(RECT_PAGE);
543 0 : m_pPreviewWIN->SetPageWidth(rPrtRect.Width());
544 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &pWrtSh->GetView()));
545 0 : if(eMetric == FUNIT_MM)
546 : {
547 0 : m_pDistBorderMF->SetDecimalDigits(1);
548 0 : m_pDistNumMF->SetDecimalDigits(1);
549 0 : m_pIndentMF->SetDecimalDigits(1);
550 0 : m_pListtabMF->SetDecimalDigits(1);
551 0 : m_pAlignedAtMF->SetDecimalDigits(1);
552 0 : m_pIndentAtMF->SetDecimalDigits(1);
553 : }
554 0 : m_pDistBorderMF->SetUnit( eMetric );
555 0 : m_pDistNumMF->SetUnit( eMetric );
556 0 : m_pIndentMF->SetUnit( eMetric );
557 0 : m_pListtabMF->SetUnit( eMetric );
558 0 : m_pAlignedAtMF->SetUnit( eMetric );
559 0 : m_pIndentAtMF->SetUnit( eMetric );
560 0 : }
561 :
562 0 : IMPL_LINK_NOARG(SwNumPositionTabPage, EditModifyHdl)
563 : {
564 0 : sal_uInt16 nMask = 1;
565 0 : for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
566 : {
567 0 : if(nActNumLvl & nMask)
568 : {
569 0 : SwNumFmt aNumFmt(pActNum->Get(i));
570 :
571 0 : const sal_uInt16 nPos = m_pAlignLB->IsVisible()
572 0 : ? m_pAlignLB->GetSelectEntryPos()
573 0 : : m_pAlign2LB->GetSelectEntryPos();
574 0 : SvxAdjust eAdjust = SVX_ADJUST_CENTER;
575 0 : if(nPos == 0)
576 0 : eAdjust = SVX_ADJUST_LEFT;
577 0 : else if(nPos == 2)
578 0 : eAdjust = SVX_ADJUST_RIGHT;
579 0 : aNumFmt.SetNumAdjust( eAdjust );
580 0 : pActNum->Set(i, aNumFmt);
581 : }
582 0 : nMask <<= 1;
583 : }
584 0 : SetModified();
585 0 : return 0;
586 : }
587 :
588 0 : IMPL_LINK( SwNumPositionTabPage, LevelHdl, ListBox *, pBox )
589 : {
590 0 : sal_uInt16 nSaveNumLvl = nActNumLvl;
591 0 : nActNumLvl = 0;
592 0 : if(pBox->IsEntryPosSelected( MAXLEVEL ) &&
593 0 : (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
594 : {
595 0 : nActNumLvl = 0xFFFF;
596 0 : pBox->SetUpdateMode(sal_False);
597 0 : for( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
598 0 : pBox->SelectEntryPos( i, sal_False );
599 0 : pBox->SetUpdateMode(sal_True);
600 : }
601 0 : else if(pBox->GetSelectEntryCount())
602 : {
603 0 : sal_uInt16 nMask = 1;
604 0 : for( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
605 : {
606 0 : if(pBox->IsEntryPosSelected( i ))
607 0 : nActNumLvl |= nMask;
608 0 : nMask <<= 1;
609 : }
610 0 : pBox->SelectEntryPos( MAXLEVEL, sal_False );
611 : }
612 : else
613 : {
614 0 : nActNumLvl = nSaveNumLvl;
615 0 : sal_uInt16 nMask = 1;
616 0 : for( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
617 : {
618 0 : if(nActNumLvl & nMask)
619 : {
620 0 : pBox->SelectEntryPos(i);
621 0 : break;
622 : }
623 0 : nMask <<=1;
624 : }
625 : }
626 0 : m_pRelativeCB->Enable(1 != nActNumLvl);
627 0 : SetModified();
628 0 : InitPosAndSpaceMode();
629 0 : ShowControlsDependingOnPosAndSpaceMode();
630 0 : InitControls();
631 0 : return 0;
632 : }
633 :
634 0 : IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pFld )
635 : {
636 0 : if(bInInintControl)
637 0 : return 0;
638 0 : long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
639 0 : sal_uInt16 nMask = 1;
640 0 : for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
641 : {
642 0 : if(nActNumLvl & nMask)
643 : {
644 0 : SwNumFmt aNumFmt( pActNum->Get( i ) );
645 0 : if(pFld == m_pDistBorderMF)
646 : {
647 :
648 0 : if(m_pRelativeCB->IsChecked() && m_pRelativeCB->IsEnabled())
649 : {
650 0 : if(0 == i)
651 : {
652 0 : long nTmp = aNumFmt.GetFirstLineOffset();
653 0 : aNumFmt.SetAbsLSpace( sal_uInt16(nValue - nTmp));
654 : }
655 : else
656 : {
657 0 : long nTmp = pActNum->Get( i - 1 ).GetAbsLSpace() +
658 0 : pActNum->Get( i - 1 ).GetFirstLineOffset() -
659 0 : pActNum->Get( i ).GetFirstLineOffset();
660 :
661 0 : aNumFmt.SetAbsLSpace( sal_uInt16(nValue + nTmp));
662 : }
663 : }
664 : else
665 : {
666 0 : aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset());
667 : }
668 : }
669 0 : else if (pFld == m_pDistNumMF)
670 : {
671 0 : aNumFmt.SetCharTextDistance( (short)nValue );
672 : }
673 0 : else if (pFld == m_pIndentMF)
674 : {
675 : // now AbsLSpace also has to be modified by FirstLineOffset
676 0 : long nDiff = nValue + aNumFmt.GetFirstLineOffset();
677 0 : long nAbsLSpace = aNumFmt.GetAbsLSpace();
678 0 : aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff));
679 0 : aNumFmt.SetFirstLineOffset( -(short)nValue );
680 : }
681 :
682 0 : pActNum->Set( i, aNumFmt );
683 : }
684 0 : nMask <<= 1;
685 : }
686 :
687 0 : SetModified();
688 0 : if(!m_pDistBorderMF->IsEnabled())
689 0 : m_pDistBorderMF->SetText(aEmptyStr);
690 :
691 0 : return 0;
692 : }
693 :
694 0 : IMPL_LINK( SwNumPositionTabPage, RelativeHdl, CheckBox *, pBox )
695 : {
696 0 : sal_Bool bOn = pBox->IsChecked();
697 0 : bool bSingleSelection = m_pLevelLB->GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl;
698 0 : bool bSetValue = false;
699 0 : long nValue = 0;
700 0 : if(bOn || bSingleSelection)
701 : {
702 0 : sal_uInt16 nMask = 1;
703 0 : bool bFirst = true;
704 0 : bSetValue = true;
705 0 : for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
706 : {
707 0 : if(nActNumLvl & nMask)
708 : {
709 0 : const SwNumFmt &rNumFmt = pActNum->Get(i);
710 0 : if(bFirst)
711 : {
712 0 : nValue = rNumFmt.GetAbsLSpace();
713 0 : if(bOn && i)
714 0 : nValue -= pActNum->Get(i - 1).GetAbsLSpace();
715 : }
716 : else
717 0 : bSetValue = nValue == rNumFmt.GetAbsLSpace() - pActNum->Get(i - 1).GetAbsLSpace();
718 0 : bFirst = false;
719 : }
720 0 : nMask <<= 1;
721 : }
722 :
723 : }
724 0 : if(bSetValue)
725 0 : m_pDistBorderMF->SetValue(m_pDistBorderMF->Normalize(nValue), FUNIT_TWIP);
726 : else
727 0 : m_pDistBorderMF->SetText(aEmptyStr);
728 0 : m_pDistBorderMF->Enable(bOn || bSingleSelection||0 != pOutlineDlg);
729 0 : bLastRelative = bOn;
730 0 : return 0;
731 : }
732 :
733 0 : IMPL_LINK_NOARG(SwNumPositionTabPage, LabelFollowedByHdl_Impl)
734 : {
735 : // determine value to be set at the chosen list levels
736 0 : SvxNumberFormat::LabelFollowedBy eLabelFollowedBy = SvxNumberFormat::LISTTAB;
737 : {
738 0 : const sal_uInt16 nPos = m_pLabelFollowedByLB->GetSelectEntryPos();
739 0 : if ( nPos == 1 )
740 : {
741 0 : eLabelFollowedBy = SvxNumberFormat::SPACE;
742 : }
743 0 : else if ( nPos == 2 )
744 : {
745 0 : eLabelFollowedBy = SvxNumberFormat::NOTHING;
746 : }
747 : }
748 :
749 : // set value at the chosen list levels
750 0 : bool bSameListtabPos = true;
751 0 : sal_uInt16 nFirstLvl = USHRT_MAX;
752 0 : sal_uInt16 nMask = 1;
753 0 : for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
754 : {
755 0 : if ( nActNumLvl & nMask )
756 : {
757 0 : SwNumFmt aNumFmt( pActNum->Get(i) );
758 0 : aNumFmt.SetLabelFollowedBy( eLabelFollowedBy );
759 0 : pActNum->Set( i, aNumFmt );
760 :
761 0 : if ( nFirstLvl == USHRT_MAX )
762 : {
763 0 : nFirstLvl = i;
764 : }
765 : else
766 : {
767 0 : bSameListtabPos &= aNumFmt.GetListtabPos() ==
768 0 : pActNum->Get( nFirstLvl ).GetListtabPos();
769 0 : }
770 : }
771 0 : nMask <<= 1;
772 : }
773 :
774 : // enable/disable metric field for list tab stop position depending on
775 : // selected item following the list label.
776 0 : m_pListtabFT->Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
777 0 : m_pListtabMF->Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
778 0 : if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB )
779 : {
780 : m_pListtabMF->SetValue(
781 0 : m_pListtabMF->Normalize( pActNum->Get( nFirstLvl ).GetListtabPos() ),
782 0 : FUNIT_TWIP );
783 : }
784 : else
785 : {
786 0 : m_pListtabMF->SetText( String() );
787 : }
788 :
789 0 : SetModified();
790 :
791 0 : return 0;
792 : }
793 :
794 0 : IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld )
795 : {
796 : // determine value to be set at the chosen list levels
797 0 : const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
798 :
799 : // set value at the chosen list levels
800 0 : sal_uInt16 nMask = 1;
801 0 : for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
802 : {
803 0 : if ( nActNumLvl & nMask )
804 : {
805 0 : SwNumFmt aNumFmt( pActNum->Get(i) );
806 0 : aNumFmt.SetListtabPos( nValue );
807 0 : pActNum->Set( i, aNumFmt );
808 : }
809 0 : nMask <<= 1;
810 : }
811 :
812 0 : SetModified();
813 :
814 0 : return 0;
815 : }
816 :
817 0 : IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld )
818 : {
819 : // determine value to be set at the chosen list levels
820 0 : const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
821 :
822 : // set value at the chosen list levels
823 0 : sal_uInt16 nMask = 1;
824 0 : for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
825 : {
826 0 : if ( nActNumLvl & nMask )
827 : {
828 0 : SwNumFmt aNumFmt( pActNum->Get(i) );
829 0 : const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
830 0 : aNumFmt.SetFirstLineIndent( nFirstLineIndent );
831 0 : pActNum->Set( i, aNumFmt );
832 : }
833 0 : nMask <<= 1;
834 : }
835 :
836 0 : SetModified();
837 :
838 0 : return 0;
839 : }
840 :
841 0 : IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld )
842 : {
843 : // determine value to be set at the chosen list levels
844 0 : const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
845 :
846 : // set value at the chosen list levels
847 0 : sal_uInt16 nMask = 1;
848 0 : for( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
849 : {
850 0 : if ( nActNumLvl & nMask )
851 : {
852 0 : SwNumFmt aNumFmt( pActNum->Get(i) );
853 0 : const long nAlignedAt = aNumFmt.GetIndentAt() +
854 0 : aNumFmt.GetFirstLineIndent();
855 0 : aNumFmt.SetIndentAt( nValue );
856 0 : const long nNewFirstLineIndent = nAlignedAt - nValue;
857 0 : aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
858 0 : pActNum->Set( i, aNumFmt );
859 : }
860 0 : nMask <<= 1;
861 : }
862 :
863 0 : SetModified();
864 :
865 0 : return 0;
866 : }
867 :
868 0 : IMPL_LINK_NOARG(SwNumPositionTabPage, StandardHdl)
869 : {
870 0 : sal_uInt16 nMask = 1;
871 0 : for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
872 : {
873 0 : if(nActNumLvl & nMask)
874 : {
875 0 : SwNumFmt aNumFmt( pActNum->Get( i ) );
876 : SwNumRule aTmpNumRule( pWrtSh->GetUniqueNumRuleName(),
877 : aNumFmt.GetPositionAndSpaceMode(),
878 0 : pOutlineDlg ? OUTLINE_RULE : NUM_RULE );
879 0 : SwNumFmt aTempFmt(aTmpNumRule.Get( i ));
880 0 : aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() );
881 0 : if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
882 : {
883 0 : aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace());
884 0 : aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() );
885 0 : aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() );
886 : }
887 0 : else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
888 : {
889 0 : aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() );
890 0 : aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() );
891 0 : aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() );
892 0 : aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() );
893 0 : aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() );
894 : }
895 0 : pActNum->Set( i, aNumFmt );
896 : }
897 0 : nMask <<= 1;
898 : }
899 :
900 0 : InitControls();
901 0 : SetModified();
902 0 : return 0;
903 : }
904 :
905 : #ifdef DBG_UTIL
906 : void SwNumPositionTabPage::SetModified(sal_Bool bRepaint)
907 : {
908 : bModified = sal_True;
909 : if(bRepaint)
910 : {
911 : m_pPreviewWIN->SetLevel(nActNumLvl);
912 : m_pPreviewWIN->Invalidate();
913 : }
914 : }
915 : #endif
916 :
917 0 : SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(Window* pParent,
918 : const SfxItemSet* pSwItemSet, SwWrtShell & rSh)
919 : : SfxTabDialog(pParent, "BulletsAndNumberingDialog",
920 : "modules/swriter/ui/bulletsandnumbering.ui",
921 : pSwItemSet, sal_False)
922 0 : , rWrtSh(rSh)
923 : {
924 0 : GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl));
925 0 : GetUserButton()->Enable(rWrtSh.GetCurNumRule() != NULL);
926 0 : m_nSingleNumPageId = AddTabPage("singlenum", RID_SVXPAGE_PICK_SINGLE_NUM );
927 0 : m_nBulletPageId = AddTabPage("bullets", RID_SVXPAGE_PICK_BULLET );
928 0 : AddTabPage("outlinenum", RID_SVXPAGE_PICK_NUM );
929 0 : AddTabPage("graphics", RID_SVXPAGE_PICK_BMP );
930 0 : m_nOptionsPageId = AddTabPage("options", RID_SVXPAGE_NUM_OPTIONS );
931 0 : m_nPositionPageId = AddTabPage("position", RID_SVXPAGE_NUM_POSITION );
932 0 : }
933 :
934 0 : SwSvxNumBulletTabDialog::~SwSvxNumBulletTabDialog()
935 : {
936 0 : }
937 :
938 0 : void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
939 : {
940 : // set styles' names and metric
941 0 : String sNumCharFmt, sBulletCharFmt;
942 0 : SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt );
943 0 : SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt );
944 :
945 0 : if (nPageId == m_nSingleNumPageId)
946 : {
947 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
948 0 : aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
949 0 : aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
950 0 : rPage.PageCreated(aSet);
951 : }
952 0 : else if (nPageId == m_nBulletPageId)
953 : {
954 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
955 0 : aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
956 0 : rPage.PageCreated(aSet);
957 : }
958 0 : else if (nPageId == m_nOptionsPageId)
959 : {
960 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
961 0 : aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
962 0 : aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
963 : // collect char styles
964 0 : ListBox rCharFmtLB(this);
965 0 : rCharFmtLB.Clear();
966 0 : rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
967 0 : SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
968 0 : ::FillCharStyleListBox(rCharFmtLB, pDocShell);
969 :
970 0 : std::vector<OUString> aList;
971 0 : for(sal_uInt16 j = 0; j < rCharFmtLB.GetEntryCount(); j++)
972 0 : aList.push_back( rCharFmtLB.GetEntry(j) );
973 :
974 0 : aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
975 :
976 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
977 0 : aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) );
978 0 : rPage.PageCreated(aSet);
979 : }
980 0 : else if (nPageId == m_nPositionPageId)
981 : {
982 0 : SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
983 0 : FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
984 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
985 0 : aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)) );
986 0 : rPage.PageCreated(aSet);
987 0 : }
988 0 : }
989 :
990 0 : short SwSvxNumBulletTabDialog::Ok()
991 : {
992 0 : short nRet = SfxTabDialog::Ok();
993 0 : pExampleSet->ClearItem(SID_PARAM_NUM_PRESET);
994 0 : return nRet;
995 : }
996 :
997 0 : IMPL_LINK_NOARG(SwSvxNumBulletTabDialog, RemoveNumberingHdl)
998 : {
999 0 : EndDialog(RET_USER);
1000 0 : return 0;
1001 0 : }
1002 :
1003 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|