LibreOffice Module cui (master)  1
numpages.cxx
Go to the documentation of this file.
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 <dialmgr.hxx>
26 #include <tools/mapunit.hxx>
28 #include <i18nlangtag/mslangid.hxx>
29 #include <editeng/numitem.hxx>
30 #include <svl/eitem.hxx>
31 #include <vcl/svapp.hxx>
32 #include <svx/colorbox.hxx>
33 #include <svx/strarray.hxx>
34 #include <svx/gallery.hxx>
35 #include <svx/ucsubset.hxx>
36 #include <svl/urihelper.hxx>
37 #include <editeng/brushitem.hxx>
38 #include <svl/intitem.hxx>
39 #include <sfx2/objsh.hxx>
40 #include <vcl/graph.hxx>
41 #include <vcl/settings.hxx>
42 #include <cui/cuicharmap.hxx>
43 #include <editeng/flstitem.hxx>
44 #include <svx/dlgutil.hxx>
45 #include <svx/xtable.hxx>
46 #include <svx/drawitem.hxx>
47 #include <svx/numvset.hxx>
48 #include <sfx2/htmlmode.hxx>
49 #include <unotools/pathoptions.hxx>
50 #include <svtools/ctrltool.hxx>
51 #include <svtools/unitconv.hxx>
52 #include <editeng/unolingu.hxx>
53 #include <com/sun/star/style/NumberingType.hpp>
54 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
55 #include <com/sun/star/container/XIndexAccess.hpp>
56 #include <com/sun/star/text/DefaultNumberingProvider.hpp>
57 #include <com/sun/star/text/XDefaultNumberingProvider.hpp>
58 #include <com/sun/star/text/XNumberingFormatter.hpp>
59 #include <com/sun/star/beans/PropertyValue.hpp>
61 #include <com/sun/star/text/XNumberingTypeInfo.hpp>
62 #include <svx/dialogs.hrc>
63 #include <svx/svxids.hrc>
64 
65 #include <algorithm>
66 #include <memory>
67 #include <vector>
68 #include <sfx2/opengrf.hxx>
69 
70 #include <strings.hrc>
71 #include <sfx2/request.hxx>
72 #include <svl/aeitem.hxx>
73 #include <svl/stritem.hxx>
74 #include <svl/slstitm.hxx>
75 #include <sfx2/filedlghelper.hxx>
76 #include <svx/gallery1.hxx>
77 #include <svx/galtheme.hxx>
79 #include <com/sun/star/ucb/SimpleFileAccess.hpp>
80 #include <rtl/ustring.h>
81 #include <sal/log.hxx>
82 #include <vcl/cvtgrf.hxx>
83 #include <vcl/graphicfilter.hxx>
85 
86 using namespace css;
87 using namespace css::uno;
88 using namespace css::beans;
89 using namespace css::lang;
90 using namespace css::i18n;
91 using namespace css::text;
92 using namespace css::container;
93 using namespace css::style;
94 
95 #define SHOW_NUMBERING 0
96 #define SHOW_BULLET 1
97 #define SHOW_BITMAP 2
98 
99 #define MAX_BMP_WIDTH 16
100 #define MAX_BMP_HEIGHT 16
101 #define SEARCHPATH_DELIMITER u';'
102 #define SEARCHFILENAME_DELIMITER u'/'
103 
104 static bool bLastRelative = false;
105 
107 {
108  const PropertyValue* pValues = rLevelProps.getConstArray();
110  for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++)
111  {
112  if ( pValues[j].Name == "NumberingType" )
113  {
114  sal_Int16 nTmp;
115  if (pValues[j].Value >>= nTmp)
116  pNew->nNumberType = static_cast<SvxNumType>(nTmp);
117  }
118  else if ( pValues[j].Name == "Prefix" )
119  pValues[j].Value >>= pNew->sPrefix;
120  else if ( pValues[j].Name == "Suffix" )
121  pValues[j].Value >>= pNew->sSuffix;
122  else if ( pValues[j].Name == "ParentNumbering" )
123  pValues[j].Value >>= pNew->nParentNumbering;
124  else if ( pValues[j].Name == "BulletChar" )
125  pValues[j].Value >>= pNew->sBulletChar;
126  else if ( pValues[j].Name == "BulletFontName" )
127  pValues[j].Value >>= pNew->sBulletFont;
128  }
129  return pNew;
130 }
131 
132 // the selection of bullets from the OpenSymbol
133 static const sal_Unicode aBulletTypes[] =
134 {
135  0x2022,
136  0x25cf,
137  0xe00c,
138  0xe00a,
139  0x2794,
140  0x27a2,
141  0x2717,
142  0x2714
143 };
144 
145 // Is one of the masked formats set?
146 static bool lcl_IsNumFmtSet(SvxNumRule const * pNum, sal_uInt16 nLevelMask)
147 {
148  bool bRet = false;
149  sal_uInt16 nMask = 1;
150  for( sal_uInt16 i = 0; i < SVX_MAX_NUM && !bRet; i++ )
151  {
152  if(nLevelMask & nMask)
153  bRet |= nullptr != pNum->Get( i );
154  nMask <<= 1 ;
155  }
156  return bRet;
157 }
158 
160 {
161  static vcl::Font aDefBulletFont = [&]()
162  {
163  vcl::Font tmp("OpenSymbol", "", Size(0, 14));
164  tmp.SetCharSet( RTL_TEXTENCODING_SYMBOL );
165  tmp.SetFamily( FAMILY_DONTKNOW );
166  tmp.SetPitch( PITCH_DONTKNOW );
167  tmp.SetWeight( WEIGHT_DONTKNOW );
168  tmp.SetTransparent( true );
169  return tmp;
170  }();
171  return aDefBulletFont;
172 }
173 
175  : SfxTabPage(pParent, "cui/ui/picknumberingpage.ui", "PickNumberingPage", &rSet)
176  , nActNumLvl(SAL_MAX_UINT16)
177  , bModified(false)
178  , bPreset(false)
179  , nNumItemId(SID_ATTR_NUMBERING_RULE)
180  , m_xExamplesVS(new NumValueSet(nullptr))
181  , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS))
182 {
184  m_xExamplesVS->init(NumberingPageType::SINGLENUM);
185  m_xExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl));
186  m_xExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl));
187 
188  Reference<XDefaultNumberingProvider> xDefNum = SvxNumOptionsTabPageHelper::GetNumberingProvider();
189  if(xDefNum.is())
190  {
191  Sequence< Sequence< PropertyValue > > aNumberings;
193  try
194  {
195  aNumberings =
196  xDefNum->getDefaultContinuousNumberingLevels( rLocale );
197 
198 
199  sal_Int32 nLength = std::min<sal_Int32>(aNumberings.getLength(), NUM_VALUSET_COUNT);
200 
201  const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray();
202  for(sal_Int32 i = 0; i < nLength; i++)
203  {
204  SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]);
205  aNumSettingsArr.push_back(std::unique_ptr<SvxNumSettings_Impl>(pNew));
206  }
207  }
208  catch(const Exception&)
209  {
210  }
211  Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
212  m_xExamplesVS->SetNumberingSettings(aNumberings, xFormat, rLocale);
213  }
214 }
215 
217 {
218  disposeOnce();
219 }
220 
222 {
223  m_xExamplesVSWin.reset();
224  m_xExamplesVS.reset();
226 }
227 
229  const SfxItemSet* rAttrSet)
230 {
231  return VclPtr<SvxSingleNumPickTabPage>::Create(pParent, *rAttrSet);
232 }
233 
235 {
236  if( (bPreset || bModified) && pSaveNum)
237  {
238  *pSaveNum = *pActNum;
240  rSet->Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
241  }
242 
243  return bModified;
244 }
245 
247 {
248  const SfxPoolItem* pItem;
249  bPreset = false;
250  bool bIsPreset = false;
251  const SfxItemSet* pExampleSet = GetDialogExampleSet();
252  if(pExampleSet)
253  {
254  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
255  bIsPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
256  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
257  nActNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
258  }
259  if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
260  {
261  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
262  }
263  if(pActNum && *pSaveNum != *pActNum)
264  {
265  *pActNum = *pSaveNum;
266  m_xExamplesVS->SetNoSelection();
267  }
268 
269  if(pActNum && (!lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset))
270  {
271  m_xExamplesVS->SelectItem(1);
272  NumSelectHdl_Impl(m_xExamplesVS.get());
273  bPreset = true;
274  }
275  bPreset |= bIsPreset;
276 
277  bModified = false;
278 }
279 
281 {
282  if(_pSet)
283  FillItemSet(_pSet);
284  return DeactivateRC::LeavePage;
285 }
286 
288 {
289  const SfxPoolItem* pItem;
290 
291  // in Draw the item exists as WhichId, in Writer only as SlotId
292  SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
293  if(eState != SfxItemState::SET)
294  {
295  nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
296  eState = rSet->GetItemState(nNumItemId, false, &pItem);
297 
298  if( eState != SfxItemState::SET )
299  {
300  pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
301  eState = SfxItemState::SET;
302  }
303  }
304  DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
305  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
306 
307  if(!pActNum)
308  pActNum.reset( new SvxNumRule(*pSaveNum) );
309  else if(*pSaveNum != *pActNum)
310  *pActNum = *pSaveNum;
311 }
312 
314 {
315  if(pActNum)
316  {
317  bPreset = false;
318  bModified = true;
319  sal_uInt16 nIdx = m_xExamplesVS->GetSelectedItemId() - 1;
320  DBG_ASSERT(aNumSettingsArr.size() > nIdx, "wrong index");
321  if(aNumSettingsArr.size() <= nIdx)
322  return;
323  SvxNumSettings_Impl* _pSet = aNumSettingsArr[nIdx].get();
324  SvxNumType eNewType = _pSet->nNumberType;
325  const sal_Unicode cLocalPrefix = !_pSet->sPrefix.isEmpty() ? _pSet->sPrefix[0] : 0;
326  const sal_Unicode cLocalSuffix = !_pSet->sSuffix.isEmpty() ? _pSet->sSuffix[0] : 0;
327 
328  sal_uInt16 nMask = 1;
329  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
330  {
331  if(nActNumLvl & nMask)
332  {
333  SvxNumberFormat aFmt(pActNum->GetLevel(i));
334  aFmt.SetNumberingType(eNewType);
335  if(cLocalPrefix == ' ')
336  aFmt.SetPrefix( "" );
337  else
338  aFmt.SetPrefix(_pSet->sPrefix);
339  if(cLocalSuffix == ' ')
340  aFmt.SetSuffix( "" );
341  else
342  aFmt.SetSuffix(_pSet->sSuffix);
343  aFmt.SetCharFormatName("");
344  aFmt.SetBulletRelSize(100);
345  pActNum->SetLevel(i, aFmt);
346  }
347  nMask <<= 1;
348  }
349  }
350 }
351 
353 {
354  NumSelectHdl_Impl(m_xExamplesVS.get());
355  weld::Button& rOk = GetDialogController()->GetOKButton();
356  rOk.clicked();
357 }
358 
360  : SfxTabPage(pParent, "cui/ui/pickbulletpage.ui", "PickBulletPage", &rSet)
361  , nActNumLvl(SAL_MAX_UINT16)
362  , bModified(false)
363  , bPreset(false)
364  , nNumItemId(SID_ATTR_NUMBERING_RULE)
365  , m_xExamplesVS(new NumValueSet(nullptr))
366  , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS))
367 {
369  m_xExamplesVS->init(NumberingPageType::BULLET);
370  m_xExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl));
371  m_xExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl));
372 }
373 
375 {
376  disposeOnce();
377 }
378 
380 {
381  m_xExamplesVSWin.reset();
382  m_xExamplesVS.reset();
384 }
385 
387  const SfxItemSet* rAttrSet)
388 {
389  return VclPtr<SvxBulletPickTabPage>::Create(pParent, *rAttrSet);
390 }
391 
393 {
394  if( (bPreset || bModified) && pActNum)
395  {
396  *pSaveNum = *pActNum;
398  rSet->Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
399  }
400  return bModified;
401 }
402 
404 {
405  const SfxPoolItem* pItem;
406  bPreset = false;
407  bool bIsPreset = false;
408  const SfxItemSet* pExampleSet = GetDialogExampleSet();
409  if(pExampleSet)
410  {
411  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
412  bIsPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
413  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
414  nActNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
415  }
416  if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
417  {
418  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
419  }
420  if(pActNum && *pSaveNum != *pActNum)
421  {
422  *pActNum = *pSaveNum;
423  m_xExamplesVS->SetNoSelection();
424  }
425 
426  if(pActNum && (!lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset))
427  {
428  m_xExamplesVS->SelectItem(1);
429  NumSelectHdl_Impl(m_xExamplesVS.get());
430  bPreset = true;
431  }
432  bPreset |= bIsPreset;
433  bModified = false;
434 }
435 
437 {
438  if(_pSet)
439  FillItemSet(_pSet);
440  return DeactivateRC::LeavePage;
441 }
442 
444 {
445  const SfxPoolItem* pItem;
446  // in Draw the item exists as WhichId, in Writer only as SlotId
447  SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
448  if(eState != SfxItemState::SET)
449  {
450  nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
451  eState = rSet->GetItemState(nNumItemId, false, &pItem);
452 
453  if( eState != SfxItemState::SET )
454  {
455  pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
456  eState = SfxItemState::SET;
457  }
458 
459  }
460  DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
461  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
462 
463  if(!pActNum)
464  pActNum.reset( new SvxNumRule(*pSaveNum) );
465  else if(*pSaveNum != *pActNum)
466  *pActNum = *pSaveNum;
467 }
468 
470 {
471  if(pActNum)
472  {
473  bPreset = false;
474  bModified = true;
475  sal_Unicode cChar = aBulletTypes[m_xExamplesVS->GetSelectedItemId() - 1];
476  const vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont();
477 
478  sal_uInt16 nMask = 1;
479  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
480  {
481  if(nActNumLvl & nMask)
482  {
483  SvxNumberFormat aFmt(pActNum->GetLevel(i));
485  // #i93908# clear suffix for bullet lists
486  aFmt.SetPrefix( OUString() );
487  aFmt.SetSuffix( OUString() );
488  aFmt.SetBulletFont(&rActBulletFont);
489  aFmt.SetBulletChar(cChar );
490  aFmt.SetCharFormatName(sBulletCharFormatName);
491  aFmt.SetBulletRelSize(45);
492  pActNum->SetLevel(i, aFmt);
493  }
494  nMask <<= 1;
495  }
496  }
497 }
498 
499 IMPL_LINK_NOARG(SvxBulletPickTabPage, DoubleClickHdl_Impl, SvtValueSet*, void)
500 {
501  NumSelectHdl_Impl(m_xExamplesVS.get());
502  weld::Button& rOk = GetDialogController()->GetOKButton();
503  rOk.clicked();
504 }
505 
507 {
508  const SfxStringItem* pBulletCharFmt = aSet.GetItem<SfxStringItem>(SID_BULLET_CHAR_FMT, false);
509 
510  if (pBulletCharFmt)
511  sBulletCharFormatName = pBulletCharFmt->GetValue();
512 }
513 
515  : SfxTabPage(pParent, "cui/ui/pickoutlinepage.ui", "PickOutlinePage", &rSet)
516  , nActNumLvl(SAL_MAX_UINT16)
517  , nNumItemId(SID_ATTR_NUMBERING_RULE)
518  , bModified(false)
519  , bPreset(false)
520  , m_xExamplesVS(new NumValueSet(nullptr))
521  , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS))
522 {
524 
525  m_xExamplesVS->init(NumberingPageType::OUTLINE);
526  m_xExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl));
527  m_xExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl));
528 
529  Reference<XDefaultNumberingProvider> xDefNum = SvxNumOptionsTabPageHelper::GetNumberingProvider();
530  if(xDefNum.is())
531  {
532  Sequence<Reference<XIndexAccess> > aOutlineAccess;
534  try
535  {
536  aOutlineAccess = xDefNum->getDefaultOutlineNumberings( rLocale );
537 
538  for(sal_Int32 nItem = 0;
539  nItem < aOutlineAccess.getLength() && nItem < NUM_VALUSET_COUNT;
540  nItem++ )
541  {
542  SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ];
543 
544  Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem];
545  for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++)
546  {
547  Any aValueAny = xLevel->getByIndex(nLevel);
548  Sequence<PropertyValue> aLevelProps;
549  aValueAny >>= aLevelProps;
550  SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(aLevelProps);
551  rItemArr.push_back( std::unique_ptr<SvxNumSettings_Impl>(pNew) );
552  }
553  }
554  }
555  catch(const Exception&)
556  {
557  }
558  Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
559  m_xExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, rLocale);
560  }
561 }
562 
564 {
565  disposeOnce();
566 }
567 
569 {
570  m_xExamplesVSWin.reset();
571  m_xExamplesVS.reset();
573 }
574 
576  const SfxItemSet* rAttrSet)
577 {
578  return VclPtr<SvxNumPickTabPage>::Create(pParent, *rAttrSet);
579 }
580 
582 {
583  if( (bPreset || bModified) && pActNum)
584  {
585  *pSaveNum = *pActNum;
587  rSet->Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
588  }
589  return bModified;
590 }
591 
593 {
594  const SfxPoolItem* pItem;
595  bPreset = false;
596  bool bIsPreset = false;
597  const SfxItemSet* pExampleSet = GetDialogExampleSet();
598  if(pExampleSet)
599  {
600  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
601  bIsPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
602  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
603  nActNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
604  }
605  if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
606  {
607  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
608  }
609  if(pActNum && *pSaveNum != *pActNum)
610  {
611  *pActNum = *pSaveNum;
612  m_xExamplesVS->SetNoSelection();
613  }
614 
615  if(pActNum && (!lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset))
616  {
617  m_xExamplesVS->SelectItem(1);
618  NumSelectHdl_Impl(m_xExamplesVS.get());
619  bPreset = true;
620  }
621  bPreset |= bIsPreset;
622  bModified = false;
623 }
624 
626 {
627  if(_pSet)
628  FillItemSet(_pSet);
629  return DeactivateRC::LeavePage;
630 }
631 
633 {
634  const SfxPoolItem* pItem;
635  // in Draw the item exists as WhichId, in Writer only as SlotId
636  SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
637  if(eState != SfxItemState::SET)
638  {
639  nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
640  eState = rSet->GetItemState(nNumItemId, false, &pItem);
641 
642  if( eState != SfxItemState::SET )
643  {
644  pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
645  eState = SfxItemState::SET;
646  }
647 
648  }
649  DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
650  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
651 
652  if(!pActNum)
653  pActNum.reset( new SvxNumRule(*pSaveNum) );
654  else if(*pSaveNum != *pActNum)
655  *pActNum = *pSaveNum;
656 
657 }
658 
659 // all levels are changed here
660 IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, SvtValueSet*, void)
661 {
662  if(pActNum)
663  {
664  bPreset = false;
665  bModified = true;
666 
667  const FontList* pList = nullptr;
668 
669  SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[m_xExamplesVS->GetSelectedItemId() - 1];
670 
671  const vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont();
672  SvxNumSettings_Impl* pLevelSettings = nullptr;
673  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
674  {
675  if(rItemArr.size() > i)
676  pLevelSettings = rItemArr[i].get();
677  if(!pLevelSettings)
678  break;
679  SvxNumberFormat aFmt(pActNum->GetLevel(i));
680  aFmt.SetNumberingType( pLevelSettings->nNumberType );
681  sal_uInt16 nUpperLevelOrChar = static_cast<sal_uInt16>(pLevelSettings->nParentNumbering);
682  if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
683  {
684  // #i93908# clear suffix for bullet lists
685  aFmt.SetPrefix(OUString());
686  aFmt.SetSuffix(OUString());
687  if( !pLevelSettings->sBulletFont.isEmpty() &&
688  pLevelSettings->sBulletFont != rActBulletFont.GetFamilyName())
689  {
690  //search for the font
691  if(!pList)
692  {
693  SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
694  const SvxFontListItem* pFontListItem =
695  static_cast<const SvxFontListItem*>( pCurDocShell
696  ->GetItem( SID_ATTR_CHAR_FONTLIST ));
697  pList = pFontListItem ? pFontListItem->GetFontList() : nullptr;
698  }
699  if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) )
700  {
701  FontMetric aFontMetric = pList->Get(
702  pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE);
703  vcl::Font aFont(aFontMetric);
704  aFmt.SetBulletFont(&aFont);
705  }
706  else
707  {
708  //if it cannot be found then create a new one
709  vcl::Font aCreateFont( pLevelSettings->sBulletFont,
710  OUString(), Size( 0, 14 ) );
711  aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
712  aCreateFont.SetFamily( FAMILY_DONTKNOW );
713  aCreateFont.SetPitch( PITCH_DONTKNOW );
714  aCreateFont.SetWeight( WEIGHT_DONTKNOW );
715  aCreateFont.SetTransparent( true );
716  aFmt.SetBulletFont( &aCreateFont );
717  }
718  }
719  else
720  aFmt.SetBulletFont( &rActBulletFont );
721 
722  aFmt.SetBulletChar( !pLevelSettings->sBulletChar.isEmpty()
723  ? pLevelSettings->sBulletChar[0]
724  : 0 );
725  aFmt.SetCharFormatName( sBulletCharFormatName );
726  aFmt.SetBulletRelSize(45);
727  }
728  else
729  {
730  aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 0));
731  aFmt.SetCharFormatName(sNumCharFmtName);
732  aFmt.SetBulletRelSize(100);
733  // #i93908#
734  aFmt.SetPrefix(pLevelSettings->sPrefix);
735  aFmt.SetSuffix(pLevelSettings->sSuffix);
736  }
737  pActNum->SetLevel(i, aFmt);
738  }
739  }
740 }
741 
742 IMPL_LINK_NOARG(SvxNumPickTabPage, DoubleClickHdl_Impl, SvtValueSet*, void)
743 {
744  NumSelectHdl_Impl(m_xExamplesVS.get());
745  weld::Button& rOk = GetDialogController()->GetOKButton();
746  rOk.clicked();
747 }
748 
750 {
751  const SfxStringItem* pNumCharFmt = aSet.GetItem<SfxStringItem>(SID_NUM_CHAR_FMT, false);
752  const SfxStringItem* pBulletCharFmt = aSet.GetItem<SfxStringItem>(SID_BULLET_CHAR_FMT, false);
753 
754 
755  if (pNumCharFmt &&pBulletCharFmt)
756  SetCharFormatNames( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
757 }
758 
760  : SfxTabPage(pParent, "cui/ui/pickgraphicpage.ui", "PickGraphicPage", &rSet)
761  , nActNumLvl(SAL_MAX_UINT16)
762  , nNumItemId(SID_ATTR_NUMBERING_RULE)
763  , bModified(false)
764  , bPreset(false)
765  , m_xErrorText(m_xBuilder->weld_label("errorft"))
766  , m_xBtBrowseFile(m_xBuilder->weld_button("browseBtn"))
767  , m_xExamplesVS(new SvxBmpNumValueSet(m_xBuilder->weld_scrolled_window("valuesetwin")))
768  , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, "valueset", *m_xExamplesVS))
769 {
771 
772  m_xExamplesVS->init();
773  m_xExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl));
774  m_xExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl));
775  m_xBtBrowseFile->connect_clicked(LINK(this, SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl));
776 
777  eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
778 
779  // determine graphic name
781 
782  size_t i = 0;
783  for (auto & grfName : aGrfNames)
784  {
785  m_xExamplesVS->InsertItem( i + 1, i);
786 
787  INetURLObject aObj(grfName);
788  if(aObj.GetProtocol() == INetProtocol::File)
789  grfName = aObj.PathToFileName();
790 
791  m_xExamplesVS->SetItemText( i + 1, grfName );
792  ++i;
793  }
794 
795  if(aGrfNames.empty())
796  {
797  m_xErrorText->show();
798  }
799  else
800  {
801  m_xExamplesVS->Show();
802  m_xExamplesVS->SetFormat();
803  m_xExamplesVS->Invalidate();
804  }
805 }
806 
808 {
809  disposeOnce();
810 }
811 
813 {
814  m_xExamplesVSWin.reset();
815  m_xExamplesVS.reset();
817 }
818 
820  const SfxItemSet* rAttrSet)
821 {
822  return VclPtr<SvxBitmapPickTabPage>::Create(pParent, *rAttrSet);
823 }
824 
826 {
827  const SfxPoolItem* pItem;
828  bPreset = false;
829  bool bIsPreset = false;
830  const SfxItemSet* pExampleSet = GetDialogExampleSet();
831  if(pExampleSet)
832  {
833  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
834  bIsPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
835  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
836  nActNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
837  }
838  if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
839  {
840  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
841  }
842  if(pActNum && *pSaveNum != *pActNum)
843  {
844  *pActNum = *pSaveNum;
845  m_xExamplesVS->SetNoSelection();
846  }
847 
848  if(!aGrfNames.empty() &&
849  (pActNum && (!lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset)))
850  {
851  m_xExamplesVS->SelectItem(1);
852  NumSelectHdl_Impl(m_xExamplesVS.get());
853  bPreset = true;
854  }
855  bPreset |= bIsPreset;
856  bModified = false;
857 }
858 
860 {
861  if(_pSet)
862  FillItemSet(_pSet);
863  return DeactivateRC::LeavePage;
864 }
865 
867 {
868  if ( aGrfNames.empty() )
869  {
870  return false;
871  }
872  if( (bPreset || bModified) && pActNum)
873  {
874  *pSaveNum = *pActNum;
876  rSet->Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
877  }
878 
879  return bModified;
880 }
881 
883 {
884  const SfxPoolItem* pItem;
885  // in Draw the item exists as WhichId, in Writer only as SlotId
886  SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
887  if(eState != SfxItemState::SET)
888  {
889  nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
890  eState = rSet->GetItemState(nNumItemId, false, &pItem);
891 
892  if( eState != SfxItemState::SET )
893  {
894  pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
895  eState = SfxItemState::SET;
896  }
897 
898  }
899  DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
900  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
901 
902  if(!pActNum)
903  pActNum.reset( new SvxNumRule(*pSaveNum) );
904  else if(*pSaveNum != *pActNum)
905  *pActNum = *pSaveNum;
906 }
907 
909 {
910  if(pActNum)
911  {
912  bPreset = false;
913  bModified = true;
914  sal_uInt16 nIdx = m_xExamplesVS->GetSelectedItemId() - 1;
915 
916  sal_uInt16 nMask = 1;
917  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
918  {
919  if(nActNumLvl & nMask)
920  {
921  SvxNumberFormat aFmt(pActNum->GetLevel(i));
923  aFmt.SetPrefix( "" );
924  aFmt.SetSuffix( "" );
925  aFmt.SetCharFormatName( "" );
926 
927  Graphic aGraphic;
929  {
930  Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
931  sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;
932  aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(eCoreUnit));
933  SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH );
934  aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );
935  }
936  else if(aGrfNames.size() > nIdx)
937  aFmt.SetGraphic( aGrfNames[nIdx] );
938  pActNum->SetLevel(i, aFmt);
939  }
940  nMask <<= 1;
941  }
942  }
943 }
944 
945 IMPL_LINK_NOARG(SvxBitmapPickTabPage, DoubleClickHdl_Impl, SvtValueSet*, void)
946 {
947  NumSelectHdl_Impl(m_xExamplesVS.get());
948  weld::Button& rOk = GetDialogController()->GetOKButton();
949  rOk.clicked();
950 }
951 
952 IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, void)
953 {
954  sfx2::FileDialogHelper aFileDialog(0, FileDialogFlags::NONE, GetDialogFrameWeld());
955  aFileDialog.SetTitle(CuiResId(RID_SVXSTR_ADD_IMAGE));
956  if ( aFileDialog.Execute() != ERRCODE_NONE )
957  return;
958 
959  OUString aPath = SvtPathOptions().GetGalleryPath();
960  OUString aPathToken = aPath.getToken( 1 , SEARCHPATH_DELIMITER );
961 
962  OUString aUserImageURL = aFileDialog.GetPath();
963 
964  OUString aFileName;
965  const sal_Int32 nPos {aUserImageURL.lastIndexOf(SEARCHFILENAME_DELIMITER)+1};
966  if (nPos<=0)
967  aFileName = aUserImageURL;
968  else if (nPos<aUserImageURL.getLength())
969  aFileName = aUserImageURL.copy(nPos);
970 
971  OUString aUserGalleryURL = aPathToken + "/" + aFileName;
972  INetURLObject aURL( aUserImageURL );
973  DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
974 
975  GraphicDescriptor aDescriptor(aURL);
976  if (aDescriptor.Detect())
977  {
978  uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
979  uno::Reference<ucb::XSimpleFileAccess3> xSimpleFileAccess(
980  ucb::SimpleFileAccess::create( ::comphelper::getComponentContext(xFactory) ) );
981  if ( xSimpleFileAccess->exists( aUserImageURL ))
982  {
983  xSimpleFileAccess->copy( aUserImageURL, aUserGalleryURL );
984  INetURLObject gURL( aUserGalleryURL );
985  std::unique_ptr<SvStream> pIn(::utl::UcbStreamHelper::CreateStream(
986  gURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ ));
987  if ( pIn )
988  {
989  Graphic aGraphic;
990  GraphicConverter::Import( *pIn, aGraphic );
991 
992  BitmapEx aBitmap = aGraphic.GetBitmapEx();
993  long nPixelX = aBitmap.GetSizePixel().Width();
994  long nPixelY = aBitmap.GetSizePixel().Height();
995  double ratio = nPixelY/static_cast<double>(nPixelX);
996  if(nPixelX > 30)
997  {
998  nPixelX = 30;
999  nPixelY = static_cast<long>(nPixelX*ratio);
1000  }
1001  if(nPixelY > 30)
1002  {
1003  nPixelY = 30;
1004  nPixelX = static_cast<long>(nPixelY/ratio);
1005  }
1006 
1007  aBitmap.Scale( Size( nPixelX, nPixelY ), BmpScaleFlag::Fast );
1008  Graphic aScaledGraphic( aBitmap );
1010 
1011  Sequence< PropertyValue > aFilterData( 2 );
1012  aFilterData[ 0 ].Name = "Compression";
1013  aFilterData[ 0 ].Value <<= sal_Int32(-1) ;
1014  aFilterData[ 1 ].Name = "Quality";
1015  aFilterData[ 1 ].Value <<= sal_Int32(1);
1016 
1017  sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( gURL.GetFileExtension() );
1018  rFilter.ExportGraphic( aScaledGraphic, gURL , nFilterFormat, &aFilterData );
1020 
1021  aGrfNames.push_back(aUserGalleryURL);
1022  size_t i = 0;
1023  for (auto & grfName : aGrfNames)
1024  {
1025  m_xExamplesVS->InsertItem( i + 1, i);
1026  INetURLObject aObj(grfName);
1027  if(aObj.GetProtocol() == INetProtocol::File)
1028  grfName = aObj.PathToFileName();
1029  m_xExamplesVS->SetItemText( i + 1, grfName );
1030  ++i;
1031  }
1032 
1033  if(aGrfNames.empty())
1034  {
1035  m_xErrorText->show();
1036  }
1037  else
1038  {
1039  m_xExamplesVS->Show();
1040  m_xExamplesVS->SetFormat();
1041  }
1042 
1043  }
1044  }
1045 
1046  }
1047 }
1048 
1049 // tabpage numbering options
1051  const SfxItemSet& rSet)
1052  : SfxTabPage(pParent, "cui/ui/numberingoptionspage.ui", "NumberingOptionsPage", &rSet)
1053  , bLastWidthModified(false)
1054  , bModified(false)
1055  , bPreset(false)
1056  , bAutomaticCharStyles(true)
1057  , bHTMLMode(false)
1058  , nBullet(0xff)
1059  , nActNumLvl(1)
1060  , nNumItemId(SID_ATTR_NUMBERING_RULE)
1061  , m_xGrid(m_xBuilder->weld_widget("grid2"))
1062  , m_xLevelLB(m_xBuilder->weld_tree_view("levellb"))
1063  , m_xFmtLB(m_xBuilder->weld_combo_box("numfmtlb"))
1064  , m_xSeparatorFT(m_xBuilder->weld_label("separator"))
1065  , m_xPrefixFT(m_xBuilder->weld_label("prefixft"))
1066  , m_xPrefixED(m_xBuilder->weld_entry("prefix"))
1067  , m_xSuffixFT(m_xBuilder->weld_label("suffixft"))
1068  , m_xSuffixED(m_xBuilder->weld_entry("suffix"))
1069  , m_xCharFmtFT(m_xBuilder->weld_label("charstyleft"))
1070  , m_xCharFmtLB(m_xBuilder->weld_combo_box("charstyle"))
1071  , m_xBulColorFT(m_xBuilder->weld_label("colorft"))
1072  , m_xBulColLB(new ColorListBox(m_xBuilder->weld_menu_button("color"), pParent.GetFrameWeld()))
1073  , m_xBulRelSizeFT(m_xBuilder->weld_label("relsizeft"))
1074  , m_xBulRelSizeMF(m_xBuilder->weld_metric_spin_button("relsize", FieldUnit::PERCENT))
1075  , m_xAllLevelFT(m_xBuilder->weld_label("sublevelsft"))
1076  , m_xAllLevelNF(m_xBuilder->weld_spin_button("sublevels"))
1077  , m_xStartFT(m_xBuilder->weld_label("startatft"))
1078  , m_xStartED(m_xBuilder->weld_spin_button("startat"))
1079  , m_xBulletFT(m_xBuilder->weld_label("bulletft"))
1080  , m_xBulletPB(m_xBuilder->weld_button("bullet"))
1081  , m_xBitmapFT(m_xBuilder->weld_label("bitmapft"))
1082  , m_xBitmapMB(m_xBuilder->weld_menu_button("bitmap"))
1083  , m_xWidthFT(m_xBuilder->weld_label("widthft"))
1084  , m_xWidthMF(m_xBuilder->weld_metric_spin_button("widthmf", FieldUnit::CM))
1085  , m_xHeightFT(m_xBuilder->weld_label("heightft"))
1086  , m_xHeightMF(m_xBuilder->weld_metric_spin_button("heightmf", FieldUnit::CM))
1087  , m_xRatioCB(m_xBuilder->weld_check_button("keepratio"))
1088  , m_xOrientFT(m_xBuilder->weld_label("orientft"))
1089  , m_xOrientLB(m_xBuilder->weld_combo_box("orientlb"))
1090  , m_xAllLevelsFrame(m_xBuilder->weld_widget("levelsframe"))
1091  , m_xSameLevelCB(m_xBuilder->weld_check_button("allsame"))
1092  , m_xPreviewWIN(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWIN))
1093 {
1094  m_xBulColLB->SetSlotId(SID_ATTR_CHAR_COLOR);
1095  m_xBulRelSizeMF->set_min(SVX_NUM_REL_SIZE_MIN, FieldUnit::PERCENT);
1096  m_xBulRelSizeMF->set_increments(5, 50, FieldUnit::PERCENT);
1099 
1100  m_xBulletPB->connect_clicked(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl));
1101  m_xFmtLB->connect_changed(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl));
1102  m_xBitmapMB->connect_selected(LINK(this, SvxNumOptionsTabPage, GraphicHdl_Impl));
1103  m_xBitmapMB->connect_toggled(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl));
1104  m_xLevelLB->set_selection_mode(SelectionMode::Multiple);
1105  m_xLevelLB->connect_changed(LINK(this, SvxNumOptionsTabPage, LevelHdl_Impl));
1106  m_xCharFmtLB->connect_changed(LINK(this, SvxNumOptionsTabPage, CharFmtHdl_Impl));
1107  m_xWidthMF->connect_value_changed(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
1108  m_xHeightMF->connect_value_changed(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
1109  m_xRatioCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, RatioHdl_Impl));
1110  m_xStartED->connect_changed(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1111  m_xPrefixED->connect_changed(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1112  m_xSuffixED->connect_changed(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
1113  m_xAllLevelNF->connect_value_changed(LINK(this,SvxNumOptionsTabPage, AllLevelHdl_Impl));
1114  m_xOrientLB->connect_changed(LINK(this, SvxNumOptionsTabPage, OrientHdl_Impl));
1115  m_xSameLevelCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl));
1116  m_xBulRelSizeMF->connect_value_changed(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl));
1117  m_xBulColLB->SetSelectHdl(LINK(this, SvxNumOptionsTabPage, BulColorHdl_Impl));
1118  aInvalidateTimer.SetInvokeHandler(LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl));
1120 
1121  eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
1122 
1123  // Fill ListBox with predefined / translated numbering types.
1124  sal_uInt32 nCount = SvxNumberingTypeTable::Count();
1125  for (sal_uInt32 i = 0; i < nCount; ++i)
1126  {
1128  }
1129 
1130  // Get advanced numbering types from the component.
1131  // Watch out for the ugly
1132  // 136 == 0x88 == SVX_NUM_BITMAP|0x80 == SVX_NUM_BITMAP|LINK_TOKEN
1133  // to not remove that.
1135 
1136  m_xFmtLB->set_active(0);
1137 
1138  m_xCharFmtLB->set_size_request(m_xCharFmtLB->get_approximate_digit_width() * 10, -1);
1139  Size aSize(m_xGrid->get_preferred_size());
1140  m_xGrid->set_size_request(aSize.Width(), -1);
1141 }
1142 
1144 {
1145  disposeOnce();
1146 }
1147 
1149 {
1150  m_xPreviewWIN.reset();
1151  m_xBulColLB.reset();
1152  pActNum.reset();
1153  pSaveNum.reset();
1155 }
1156 
1158 {
1159  if(eMetric == FieldUnit::MM)
1160  {
1161  m_xWidthMF->set_digits(1);
1162  m_xHeightMF->set_digits(1);
1163  }
1164  m_xWidthMF->set_unit(eMetric);
1165  m_xHeightMF->set_unit(eMetric);
1166 }
1167 
1169  const SfxItemSet* rAttrSet)
1170 {
1171  return VclPtr<SvxNumOptionsTabPage>::Create(pParent, *rAttrSet);
1172 };
1173 
1175 {
1176  const SfxPoolItem* pItem;
1177  const SfxItemSet* pExampleSet = GetDialogExampleSet();
1178  sal_uInt16 nTmpNumLvl = 1;
1179  if(pExampleSet)
1180  {
1181  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
1182  bPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1183  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
1184  nTmpNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1185  }
1186  if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
1187  {
1188  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
1189  }
1190 
1191  bModified = (!pActNum->Get( 0 ) || bPreset);
1192  if(*pActNum != *pSaveNum ||
1193  nActNumLvl != nTmpNumLvl)
1194  {
1195  nActNumLvl = nTmpNumLvl;
1196  sal_uInt16 nMask = 1;
1197  if (nActNumLvl == SAL_MAX_UINT16)
1198  m_xLevelLB->select(pActNum->GetLevelCount());
1199  if(nActNumLvl != SAL_MAX_UINT16)
1200  {
1201  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1202  {
1203  if(nActNumLvl & nMask)
1204  m_xLevelLB->select(i);
1205  nMask <<= 1 ;
1206  }
1207  }
1208  *pActNum = *pSaveNum;
1209 
1210  InitControls();
1211  }
1212 }
1213 
1215 {
1216  if(_pSet)
1217  FillItemSet(_pSet);
1218  return DeactivateRC::LeavePage;
1219 }
1220 
1222 {
1223  rSet->Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
1224  if(bModified && pActNum)
1225  {
1226  *pSaveNum = *pActNum;
1228  rSet->Put(SfxBoolItem(SID_PARAM_NUM_PRESET, false));
1229  }
1230  return bModified;
1231 };
1232 
1234 {
1235  const SfxPoolItem* pItem;
1236  // in Draw the item exists as WhichId, in Writer only as SlotId
1237  SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
1238  if(eState != SfxItemState::SET)
1239  {
1240  nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
1241  eState = rSet->GetItemState(nNumItemId, false, &pItem);
1242 
1243  if( eState != SfxItemState::SET )
1244  {
1245  pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
1246  eState = SfxItemState::SET;
1247  }
1248 
1249  }
1250  DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
1251  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
1252 
1253  // insert levels
1254  if (!m_xLevelLB->n_children())
1255  {
1256  for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++)
1257  m_xLevelLB->append_text(OUString::number(i));
1258  if(pSaveNum->GetLevelCount() > 1)
1259  {
1260  OUString sEntry = "1 - " + OUString::number( pSaveNum->GetLevelCount() );
1261  m_xLevelLB->append_text(sEntry);
1262  m_xLevelLB->select_text(sEntry);
1263  }
1264  else
1265  m_xLevelLB->select(0);
1266  }
1267  else
1268  m_xLevelLB->select(m_xLevelLB->n_children() - 1);
1269 
1270  sal_uInt16 nMask = 1;
1271  m_xLevelLB->unselect_all();
1272  if (nActNumLvl == SAL_MAX_UINT16)
1273  {
1274  m_xLevelLB->select( pSaveNum->GetLevelCount() );
1275  }
1276  else
1277  {
1278  for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++)
1279  {
1280  if(nActNumLvl & nMask)
1281  m_xLevelLB->select( i );
1282  nMask <<= 1 ;
1283  }
1284  }
1285 
1286  if(!pActNum)
1287  pActNum.reset( new SvxNumRule(*pSaveNum) );
1288  else if(*pSaveNum != *pActNum)
1289  *pActNum = *pSaveNum;
1291  m_xSameLevelCB->set_active(pActNum->IsContinuousNumbering());
1292 
1293  SfxObjectShell* pShell;
1294  if ( SfxItemState::SET == rSet->GetItemState( SID_HTML_MODE, false, &pItem )
1295  || ( nullptr != ( pShell = SfxObjectShell::Current()) &&
1296  nullptr != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) )
1297  {
1298  sal_uInt16 nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1299  bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON);
1300  }
1301 
1302  bool bCharFmt = pActNum->IsFeatureSupported(SvxNumRuleFlags::CHAR_STYLE);
1303  m_xCharFmtFT->set_visible(bCharFmt);
1304  m_xCharFmtLB->set_visible(bCharFmt);
1305 
1306  bool bContinuous = pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);
1307 
1308  bool bAllLevel = bContinuous && !bHTMLMode;
1309  m_xAllLevelFT->set_visible(bAllLevel);
1310  m_xAllLevelNF->set_visible(bAllLevel);
1311 
1312  m_xAllLevelsFrame->set_visible(bContinuous);
1313 
1314  // again misusage: in Draw there is numeration only until the bitmap
1315  // without SVX_NUM_NUMBER_NONE
1316  //remove types that are unsupported by Draw/Impress
1317  if(!bContinuous)
1318  {
1319  sal_Int32 nFmtCount = m_xFmtLB->get_count();
1320  for(sal_Int32 i = nFmtCount; i; i--)
1321  {
1322  sal_uInt16 nEntryData = m_xFmtLB->get_id(i - 1).toUInt32();
1323  if(/*SVX_NUM_NUMBER_NONE == nEntryData ||*/
1324  (SVX_NUM_BITMAP|LINK_TOKEN) == nEntryData)
1325  m_xFmtLB->remove(i - 1);
1326  }
1327  }
1328  //one must be enabled
1329  if(!pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_LINKED_BMP))
1330  {
1331  auto nPos = m_xFmtLB->find_id(OUString::number(SVX_NUM_BITMAP|LINK_TOKEN));
1332  if (nPos != -1)
1333  m_xFmtLB->remove(nPos);
1334  }
1335  else if(!pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_EMBEDDED_BMP))
1336  {
1337  auto nPos = m_xFmtLB->find_id(OUString::number(SVX_NUM_BITMAP));
1338  if (nPos != -1)
1339  m_xFmtLB->remove(nPos);
1340  }
1341 
1342  // MegaHack: because of a not-fixable 'design mistake/error' in Impress
1343  // delete all kinds of numeric enumerations
1344  if(pActNum->IsFeatureSupported(SvxNumRuleFlags::NO_NUMBERS))
1345  {
1346  sal_Int32 nFmtCount = m_xFmtLB->get_count();
1347  for(sal_Int32 i = nFmtCount; i; i--)
1348  {
1349  sal_uInt16 nEntryData = m_xFmtLB->get_id(i - 1).toUInt32();
1350  if( /*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/ nEntryData <= SVX_NUM_NUMBER_NONE)
1351  m_xFmtLB->remove(i - 1);
1352  }
1353  }
1354 
1355  InitControls();
1356  bModified = false;
1357 }
1358 
1360 {
1361  bool bShowBullet = true;
1362  bool bShowBitmap = true;
1363  bool bSameType = true;
1364  bool bSameStart = true;
1365  bool bSamePrefix = true;
1366  bool bSameSuffix = true;
1367  bool bAllLevel = true;
1368  bool bSameCharFmt = true;
1369  bool bSameVOrient = true;
1370  bool bSameSize = true;
1371  bool bSameBulColor = true;
1372  bool bSameBulRelSize= true;
1373 
1374  const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
1375  OUString sFirstCharFmt;
1376  sal_Int16 eFirstOrient = text::VertOrientation::NONE;
1377  Size aFirstSize(0,0);
1378  sal_uInt16 nMask = 1;
1379  sal_uInt16 nLvl = SAL_MAX_UINT16;
1380  sal_uInt16 nHighestLevel = 0;
1381 
1382  bool bBullColor = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_COLOR);
1383  bool bBullRelSize = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE);
1384  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1385  {
1386  if(nActNumLvl & nMask)
1387  {
1388  aNumFmtArr[i] = &pActNum->GetLevel(i);
1389  bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
1390  bShowBitmap &= (aNumFmtArr[i]->GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP;
1391  if(SAL_MAX_UINT16 == nLvl)
1392  {
1393  nLvl = i;
1394  sFirstCharFmt = aNumFmtArr[i]->GetCharFormatName();
1395  eFirstOrient = aNumFmtArr[i]->GetVertOrient();
1396  if(bShowBitmap)
1397  aFirstSize = aNumFmtArr[i]->GetGraphicSize();
1398  }
1399  if( i > nLvl)
1400  {
1401  bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[nLvl]->GetNumberingType();
1402  bSameStart = aNumFmtArr[i]->GetStart() == aNumFmtArr[nLvl]->GetStart();
1403 
1404  bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix();
1405  bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix();
1406  bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels();
1407  bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFormatName();
1408  bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient();
1409  if(bShowBitmap && bSameSize)
1410  bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize;
1411  bSameBulColor &= aNumFmtArr[i]->GetBulletColor() == aNumFmtArr[nLvl]->GetBulletColor();
1412  bSameBulRelSize &= aNumFmtArr[i]->GetBulletRelSize() == aNumFmtArr[nLvl]->GetBulletRelSize();
1413  }
1414  nHighestLevel = i;
1415  }
1416  else
1417  aNumFmtArr[i] = nullptr;
1418 
1419  nMask <<= 1 ;
1420  }
1421  SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0);
1422 
1423  sal_uInt16 nNumberingType;
1424  if (nLvl != SAL_MAX_UINT16)
1425  nNumberingType = aNumFmtArr[nLvl]->GetNumberingType();
1426  else
1427  {
1428  nNumberingType = SVX_NUM_NUMBER_NONE;
1429  bAllLevel = false;
1430  bSameBulRelSize = false;
1431  bSameBulColor = false;
1432  bSameStart = false;
1433  bSamePrefix = false;
1434  bSameSuffix = false;
1435  }
1436 
1437  CheckForStartValue_Impl(nNumberingType);
1438 
1439  if(bShowBitmap)
1440  {
1441  if(!bSameVOrient || eFirstOrient == text::VertOrientation::NONE)
1442  m_xOrientLB->set_active(-1);
1443  else
1444  m_xOrientLB->set_active(
1445  sal::static_int_cast< sal_Int32 >(eFirstOrient - 1));
1446  // no text::VertOrientation::NONE
1447 
1448  if(bSameSize)
1449  {
1450  SetMetricValue(*m_xHeightMF, aFirstSize.Height(), eCoreUnit);
1451  SetMetricValue(*m_xWidthMF, aFirstSize.Width(), eCoreUnit);
1452  }
1453  else
1454  {
1455  m_xHeightMF->set_text("");
1456  m_xWidthMF->set_text("");
1457  }
1458  }
1459 
1460  if(bSameType)
1461  {
1462  sal_uInt16 nLBData = nNumberingType;
1463  m_xFmtLB->set_active_id(OUString::number(nLBData));
1464  }
1465  else
1466  m_xFmtLB->set_active(-1);
1467 
1468  m_xAllLevelNF->set_sensitive(nHighestLevel > 0 && !m_xSameLevelCB->get_active());
1469  m_xAllLevelNF->set_max(nHighestLevel + 1);
1470  if(bAllLevel)
1471  {
1472  m_xAllLevelNF->set_value(aNumFmtArr[nLvl]->GetIncludeUpperLevels());
1473  }
1474  else
1475  {
1476  m_xAllLevelNF->set_text("");
1477  }
1478 
1479  if(bBullRelSize)
1480  {
1481  if(bSameBulRelSize)
1482  m_xBulRelSizeMF->set_value(aNumFmtArr[nLvl]->GetBulletRelSize(), FieldUnit::PERCENT);
1483  else
1484  m_xBulRelSizeMF->set_text("");
1485  }
1486  if(bBullColor)
1487  {
1488  if(bSameBulColor)
1489  m_xBulColLB->SelectEntry(aNumFmtArr[nLvl]->GetBulletColor());
1490  else
1491  m_xBulColLB->SetNoSelection();
1492  }
1493  switch(nBullet)
1494  {
1495  case SHOW_NUMBERING:
1496  if(bSameStart)
1497  {
1498  m_xStartED->set_value(aNumFmtArr[nLvl]->GetStart());
1499  }
1500  else
1501  m_xStartED->set_text("");
1502  break;
1503  case SHOW_BULLET:
1504  break;
1505  case SHOW_BITMAP:
1506  break;
1507  }
1508 
1509  if(bSamePrefix)
1510  m_xPrefixED->set_text(aNumFmtArr[nLvl]->GetPrefix());
1511  else
1512  m_xPrefixED->set_text("");
1513  if(bSameSuffix)
1514  m_xSuffixED->set_text(aNumFmtArr[nLvl]->GetSuffix());
1515  else
1516  m_xSuffixED->set_text("");
1517 
1518  if(bSameCharFmt)
1519  {
1520  if (!sFirstCharFmt.isEmpty())
1521  m_xCharFmtLB->set_active_text(sFirstCharFmt);
1522  else
1523  m_xCharFmtLB->set_active(0);
1524  }
1525  else
1526  m_xCharFmtLB->set_active(-1);
1527 
1530 }
1531 
1532 // 0 - Number; 1 - Bullet; 2 - Bitmap
1534 {
1535  if(nBullet == nType)
1536  return;
1537  nBullet = nType;
1538  bool bBullet = (nType == SHOW_BULLET);
1539  bool bBitmap = (nType == SHOW_BITMAP);
1540  bool bEnableBitmap = (nType == SHOW_BITMAP);
1541  bool bNumeric = !(bBitmap||bBullet);
1542  m_xSeparatorFT->set_visible(bNumeric);
1543  m_xPrefixFT->set_visible(bNumeric);
1544  m_xPrefixED->set_visible(bNumeric);
1545  m_xSuffixFT->set_visible(bNumeric);
1546  m_xSuffixED->set_visible(bNumeric);
1547 
1548  bool bCharFmt = pActNum->IsFeatureSupported(SvxNumRuleFlags::CHAR_STYLE);
1549  m_xCharFmtFT->set_visible(!bBitmap && bCharFmt);
1550  m_xCharFmtLB->set_visible(!bBitmap && bCharFmt);
1551 
1552  // this is rather misusage, as there is no own flag
1553  // for complete numeration
1554  bool bAllLevelFeature = pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);
1555  bool bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode;
1556  m_xAllLevelFT->set_visible(bAllLevel);
1557  m_xAllLevelNF->set_visible(bAllLevel);
1558 
1559  m_xStartFT->set_visible(!(bBullet||bBitmap));
1560  m_xStartED->set_visible(!(bBullet||bBitmap));
1561 
1562  m_xBulletFT->set_visible(bBullet);
1563  m_xBulletPB->set_visible(bBullet);
1564  bool bBullColor = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_COLOR);
1565  m_xBulColorFT->set_visible(!bBitmap && bBullColor);
1566  m_xBulColLB->set_visible(!bBitmap && bBullColor);
1567  bool bBullResSize = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE);
1568  m_xBulRelSizeFT->set_visible(!bBitmap && bBullResSize);
1569  m_xBulRelSizeMF->set_visible(!bBitmap && bBullResSize);
1570 
1571  m_xBitmapFT->set_visible(bBitmap);
1572  m_xBitmapMB->set_visible(bBitmap);
1573 
1574  m_xWidthFT->set_visible(bBitmap);
1575  m_xWidthMF->set_visible(bBitmap);
1576  m_xHeightFT->set_visible(bBitmap);
1577  m_xHeightMF->set_visible(bBitmap);
1578  m_xRatioCB->set_visible(bBitmap);
1579 
1580  m_xOrientFT->set_visible(bBitmap && bAllLevelFeature);
1581  m_xOrientLB->set_visible(bBitmap && bAllLevelFeature);
1582 
1583  m_xWidthFT->set_sensitive(bEnableBitmap);
1584  m_xWidthMF->set_sensitive(bEnableBitmap);
1585  m_xHeightFT->set_sensitive(bEnableBitmap);
1586  m_xHeightMF->set_sensitive(bEnableBitmap);
1587  m_xRatioCB->set_sensitive(bEnableBitmap);
1588  m_xOrientFT->set_sensitive(bEnableBitmap);
1589  m_xOrientLB->set_sensitive(bEnableBitmap);
1590 }
1591 
1592 IMPL_LINK(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView&, rBox, void)
1593 {
1594  sal_uInt16 nSaveNumLvl = nActNumLvl;
1595  nActNumLvl = 0;
1596  auto aSelectedRows = rBox.get_selected_rows();
1597  if (std::find(aSelectedRows.begin(), aSelectedRows.end(), pActNum->GetLevelCount()) != aSelectedRows.end() &&
1598  (aSelectedRows.size() == 1 || nSaveNumLvl != 0xffff))
1599  {
1600  nActNumLvl = 0xFFFF;
1601  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
1602  rBox.unselect(i);
1603  }
1604  else if (!aSelectedRows.empty())
1605  {
1606  sal_uInt16 nMask = 1;
1607  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
1608  {
1609  if (std::find(aSelectedRows.begin(), aSelectedRows.end(), i) != aSelectedRows.end())
1610  nActNumLvl |= nMask;
1611  nMask <<= 1;
1612  }
1613  rBox.unselect(pActNum->GetLevelCount());
1614  }
1615  else
1616  {
1617  nActNumLvl = nSaveNumLvl;
1618  sal_uInt16 nMask = 1;
1619  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
1620  {
1621  if(nActNumLvl & nMask)
1622  {
1623  rBox.select(i);
1624  break;
1625  }
1626  nMask <<=1;
1627  }
1628  }
1629  InitControls();
1630 }
1631 
1632 IMPL_LINK_NOARG(SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl, Timer *, void)
1633 {
1634  m_aPreviewWIN.Invalidate();
1635 }
1636 
1637 IMPL_LINK(SvxNumOptionsTabPage, AllLevelHdl_Impl, weld::SpinButton&, rBox, void)
1638 {
1639  sal_uInt16 nMask = 1;
1640  for(sal_uInt16 e = 0; e < pActNum->GetLevelCount(); e++)
1641  {
1642  if(nActNumLvl & nMask)
1643  {
1644  SvxNumberFormat aNumFmt(pActNum->GetLevel(e));
1645  aNumFmt.SetIncludeUpperLevels(static_cast<sal_uInt8>(std::min(rBox.get_value(), int(e + 1))) );
1646  pActNum->SetLevel(e, aNumFmt);
1647  }
1648  nMask <<= 1;
1649  }
1650  SetModified();
1651 }
1652 
1653 IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox, void)
1654 {
1655  OUString sSelectStyle;
1656  bool bShowOrient = false;
1657  bool bBmp = false;
1658  sal_uInt16 nMask = 1;
1659  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1660  {
1661  if(nActNumLvl & nMask)
1662  {
1663  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1664  // PAGEDESC does not exist
1665  SvxNumType nNumType = static_cast<SvxNumType>(rBox.get_active_id().toUInt32());
1666  aNumFmt.SetNumberingType(nNumType);
1667  sal_uInt16 nNumberingType = aNumFmt.GetNumberingType();
1668  if(SVX_NUM_BITMAP == (nNumberingType&(~LINK_TOKEN)))
1669  {
1670  bBmp |= nullptr != aNumFmt.GetBrush();
1671  aNumFmt.SetIncludeUpperLevels( 0 );
1672  aNumFmt.SetSuffix( "" );
1673  aNumFmt.SetPrefix( "" );
1674  if(!bBmp)
1675  aNumFmt.SetGraphic("");
1676  pActNum->SetLevel(i, aNumFmt);
1677  SwitchNumberType(SHOW_BITMAP);
1678  bShowOrient = true;
1679  }
1680  else if( SVX_NUM_CHAR_SPECIAL == nNumberingType )
1681  {
1682  aNumFmt.SetIncludeUpperLevels( 0 );
1683  aNumFmt.SetSuffix( "" );
1684  aNumFmt.SetPrefix( "" );
1685  if( !aNumFmt.GetBulletFont() )
1686  aNumFmt.SetBulletFont(&aActBulletFont);
1687  if( !aNumFmt.GetBulletChar() )
1688  aNumFmt.SetBulletChar( SVX_DEF_BULLET );
1689  pActNum->SetLevel(i, aNumFmt);
1690  SwitchNumberType(SHOW_BULLET);
1691  // allocation of the drawing pattern is automatic
1692  if(bAutomaticCharStyles)
1693  {
1694  sSelectStyle = m_sBulletCharFormatName;
1695  }
1696  }
1697  else
1698  {
1699  aNumFmt.SetPrefix( m_xPrefixED->get_text() );
1700  aNumFmt.SetSuffix( m_xSuffixED->get_text() );
1701  SwitchNumberType(SHOW_NUMBERING);
1702  pActNum->SetLevel(i, aNumFmt);
1703  CheckForStartValue_Impl(nNumberingType);
1704 
1705  // allocation of the drawing pattern is automatic
1706  if(bAutomaticCharStyles)
1707  {
1708  sSelectStyle = m_sNumCharFmtName;
1709  }
1710  }
1711  }
1712  nMask <<= 1;
1713  }
1714  bool bAllLevelFeature = pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);
1715  if(bShowOrient && bAllLevelFeature)
1716  {
1717  m_xOrientFT->show();
1718  m_xOrientLB->show();
1719  }
1720  else
1721  {
1722  m_xOrientFT->hide();
1723  m_xOrientLB->hide();
1724  }
1725  SetModified();
1726  if(!sSelectStyle.isEmpty())
1727  {
1728  m_xCharFmtLB->set_active_text(sSelectStyle);
1729  CharFmtHdl_Impl(*m_xCharFmtLB);
1730  bAutomaticCharStyles = true;
1731  }
1732 }
1733 
1734 void SvxNumOptionsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
1735 {
1736  bool bIsNull = m_xStartED->get_value() == 0;
1737  bool bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC ||
1738  SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType ||
1739  SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType;
1740  m_xStartED->set_min(bNoZeroAllowed ? 1 : 0);
1741  if (bIsNull && bNoZeroAllowed)
1743 }
1744 
1745 IMPL_LINK(SvxNumOptionsTabPage, OrientHdl_Impl, weld::ComboBox&, rBox, void)
1746 {
1747  sal_Int32 nPos = rBox.get_active();
1748  nPos ++; // no VERT_NONE
1749 
1750  sal_uInt16 nMask = 1;
1751  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1752  {
1753  if(nActNumLvl & nMask)
1754  {
1755  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1756  if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
1757  {
1758  const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
1759  const Size& rSize = aNumFmt.GetGraphicSize();
1760  sal_Int16 eOrient = static_cast<sal_Int16>(nPos);
1761  aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient );
1762  pActNum->SetLevel(i, aNumFmt);
1763  }
1764  }
1765  nMask <<= 1;
1766  }
1767  SetModified(false);
1768 }
1769 
1770 IMPL_LINK(SvxNumOptionsTabPage, SameLevelHdl_Impl, weld::ToggleButton&, rBox, void)
1771 {
1772  bool bSet = rBox.get_active();
1773  pActNum->SetContinuousNumbering(bSet);
1774  bool bRepaint = false;
1775  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1776  {
1777  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1778  if(aNumFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE)
1779  {
1780  bRepaint = true;
1781  break;
1782  }
1783  }
1784  SetModified(bRepaint);
1785  InitControls();
1786 }
1787 
1788 IMPL_LINK(SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox&, rColorBox, void)
1789 {
1790  Color nSetColor = rColorBox.GetSelectEntryColor();
1791 
1792  sal_uInt16 nMask = 1;
1793  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1794  {
1795  if(nActNumLvl & nMask)
1796  {
1797  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1798  aNumFmt.SetBulletColor(nSetColor);
1799  pActNum->SetLevel(i, aNumFmt);
1800  }
1801  nMask <<= 1;
1802  }
1803  SetModified();
1804 }
1805 
1806 IMPL_LINK(SvxNumOptionsTabPage, BulRelSizeHdl_Impl, weld::MetricSpinButton&, rField, void)
1807 {
1808  sal_uInt16 nRelSize = rField.get_value(FieldUnit::PERCENT);
1809 
1810  sal_uInt16 nMask = 1;
1811  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1812  {
1813  if(nActNumLvl & nMask)
1814  {
1815  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1816  aNumFmt.SetBulletRelSize(nRelSize);
1817  pActNum->SetLevel(i, aNumFmt);
1818  }
1819  nMask <<= 1;
1820  }
1821  SetModified();
1822 }
1823 
1824 IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OString&, rIdent, void)
1825 {
1826  OUString aGrfName;
1827  Size aSize;
1828  bool bSucc(false);
1829  SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_SVXSTR_EDIT_GRAPHIC), GetDialogFrameWeld());
1830 
1831  OString sNumber;
1832  if (rIdent.startsWith("gallery", &sNumber))
1833  {
1834  auto idx = sNumber.toUInt32();
1835  if (idx < aGrfNames.size())
1836  {
1837  aGrfName = aGrfNames[idx];
1838  Graphic aGraphic;
1840  {
1841  aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
1842  bSucc = true;
1843  }
1844  }
1845  }
1846  else if (rIdent == "fromfile")
1847  {
1848  aGrfDlg.EnableLink( false );
1849  aGrfDlg.AsLink( false );
1850  if ( !aGrfDlg.Execute() )
1851  {
1852  // memorize selected filter
1853  aGrfName = aGrfDlg.GetPath();
1854 
1855  Graphic aGraphic;
1856  if( !aGrfDlg.GetGraphic(aGraphic) )
1857  {
1858  aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
1859  bSucc = true;
1860  }
1861  }
1862  }
1863  if(bSucc)
1864  {
1865  aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(eCoreUnit));
1866 
1867  sal_uInt16 nMask = 1;
1868  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1869  {
1870  if(nActNumLvl & nMask)
1871  {
1872  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
1873  aNumFmt.SetCharFormatName(m_sNumCharFmtName);
1874  aNumFmt.SetGraphic(aGrfName);
1875 
1876  // set size for a later comparison
1877  const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
1878  // initiate asynchronous loading
1879  sal_Int16 eOrient = aNumFmt.GetVertOrient();
1880  aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
1881  aInitSize[i] = aNumFmt.GetGraphicSize();
1882 
1883  pActNum->SetLevel(i, aNumFmt);
1884  }
1885  nMask <<= 1;
1886  }
1887  m_xRatioCB->set_sensitive(true);
1888  m_xWidthFT->set_sensitive(true);
1889  m_xHeightFT->set_sensitive(true);
1890  m_xWidthMF->set_sensitive(true);
1891  m_xHeightMF->set_sensitive(true);
1892  SetMetricValue(*m_xWidthMF, aSize.Width(), eCoreUnit);
1893  SetMetricValue(*m_xHeightMF, aSize.Height(), eCoreUnit);
1894  m_xOrientFT->set_sensitive(true);
1895  m_xOrientLB->set_sensitive(true);
1896  SetModified();
1897  //needed due to asynchronous loading of graphics in the SvxBrushItem
1898  aInvalidateTimer.Start();
1899  }
1900 }
1901 
1903 {
1904  if (!m_xGalleryMenu)
1905  {
1906  m_xGalleryMenu = m_xBuilder->weld_menu("gallerysubmenu");
1907  weld::WaitObject aWait(GetDialogFrameWeld());
1908 
1910  {
1912 
1913  Graphic aGraphic;
1914  OUString sGrfName;
1916  size_t i = 0;
1917  for (auto & grfName : aGrfNames)
1918  {
1919  sGrfName = grfName;
1920  OUString sItemId = "gallery" + OUString::number(i);
1921  INetURLObject aObj(sGrfName);
1922  if(aObj.GetProtocol() == INetProtocol::File)
1923  sGrfName = aObj.PathToFileName();
1925  {
1926  BitmapEx aBitmap(aGraphic.GetBitmapEx());
1927  Size aSize(aBitmap.GetSizePixel());
1928  if(aSize.Width() > MAX_BMP_WIDTH ||
1929  aSize.Height() > MAX_BMP_HEIGHT)
1930  {
1931  bool bWidth = aSize.Width() > aSize.Height();
1932  double nScale = bWidth ?
1933  double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()):
1934  double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height());
1935  aBitmap.Scale(nScale, nScale);
1936  }
1937  pVD->SetOutputSizePixel(aBitmap.GetSizePixel(), false);
1938  pVD->DrawBitmapEx(Point(), aBitmap);
1939  m_xGalleryMenu->append(sItemId, sGrfName, *pVD);
1940  }
1941  else
1942  {
1943  m_xGalleryMenu->append(sItemId, sGrfName);
1944  }
1945  ++i;
1946  }
1948  }
1949  }
1950 }
1951 
1953 {
1954  SvxCharacterMap aMap(GetDialogFrameWeld(), nullptr, nullptr);
1955 
1956  sal_uInt16 nMask = 1;
1957  const vcl::Font* pFmtFont = nullptr;
1958  bool bSameBullet = true;
1959  sal_Unicode cBullet = 0;
1960  bool bFirst = true;
1961  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1962  {
1963  if(nActNumLvl & nMask)
1964  {
1965  const SvxNumberFormat& rCurFmt = pActNum->GetLevel(i);
1966  if(bFirst)
1967  {
1968  cBullet = rCurFmt.GetBulletChar();
1969  }
1970  else if(rCurFmt.GetBulletChar() != cBullet )
1971  {
1972  bSameBullet = false;
1973  break;
1974  }
1975  if(!pFmtFont)
1976  pFmtFont = rCurFmt.GetBulletFont();
1977  bFirst = false;
1978  }
1979  nMask <<= 1;
1980 
1981  }
1982 
1983  if (pFmtFont)
1984  aMap.SetCharFont(*pFmtFont);
1985  else
1986  aMap.SetCharFont(aActBulletFont);
1987  if (bSameBullet)
1988  aMap.SetChar(cBullet);
1989  if (aMap.run() == RET_OK)
1990  {
1991  // change Font Numrules
1992  aActBulletFont = aMap.GetCharFont();
1993 
1994  sal_uInt16 _nMask = 1;
1995  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
1996  {
1997  if(nActNumLvl & _nMask)
1998  {
1999  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2000  aNumFmt.SetBulletFont(&aActBulletFont);
2001  aNumFmt.SetBulletChar( static_cast<sal_Unicode>(aMap.GetChar()) );
2002  pActNum->SetLevel(i, aNumFmt);
2003  }
2004  _nMask <<= 1;
2005  }
2006 
2007  SetModified();
2008  }
2009 }
2010 
2012 {
2013  bool bWidth = &rField == m_xWidthMF.get();
2014  bLastWidthModified = bWidth;
2015  bool bRatio = m_xRatioCB->get_active();
2016  long nWidthVal = static_cast<long>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FieldUnit::MM_100TH)));
2017  long nHeightVal = static_cast<long>(m_xHeightMF->denormalize(m_xHeightMF->get_value(FieldUnit::MM_100TH)));
2018  nWidthVal = OutputDevice::LogicToLogic( nWidthVal ,
2019  MapUnit::Map100thMM, eCoreUnit );
2020  nHeightVal = OutputDevice::LogicToLogic( nHeightVal,
2021  MapUnit::Map100thMM, eCoreUnit);
2022  double fSizeRatio;
2023 
2024  bool bRepaint = false;
2025  sal_uInt16 nMask = 1;
2026  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2027  {
2028  if(nActNumLvl & nMask)
2029  {
2030  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2031  if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
2032  {
2033  Size aSize(aNumFmt.GetGraphicSize() );
2034  Size aSaveSize(aSize);
2035 
2036  if (aInitSize[i].Height())
2037  fSizeRatio = static_cast<double>(aInitSize[i].Width()) / static_cast<double>(aInitSize[i].Height());
2038  else
2039  fSizeRatio = double(1);
2040 
2041  if(bWidth)
2042  {
2043  long nDelta = nWidthVal - aInitSize[i].Width();
2044  aSize.setWidth( nWidthVal );
2045  if (bRatio)
2046  {
2047  aSize.setHeight( aInitSize[i].Height() + static_cast<long>(static_cast<double>(nDelta) / fSizeRatio) );
2048  m_xHeightMF->set_value(m_xHeightMF->normalize(
2049  OutputDevice::LogicToLogic( aSize.Height(), eCoreUnit, MapUnit::Map100thMM )),
2050  FieldUnit::MM_100TH);
2051  }
2052  }
2053  else
2054  {
2055  long nDelta = nHeightVal - aInitSize[i].Height();
2056  aSize.setHeight( nHeightVal );
2057  if (bRatio)
2058  {
2059  aSize.setWidth( aInitSize[i].Width() + static_cast<long>(static_cast<double>(nDelta) * fSizeRatio) );
2060  m_xWidthMF->set_value(m_xWidthMF->normalize(
2061  OutputDevice::LogicToLogic( aSize.Width(), eCoreUnit, MapUnit::Map100thMM )),
2062  FieldUnit::MM_100TH);
2063  }
2064  }
2065  const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
2066  sal_Int16 eOrient = aNumFmt.GetVertOrient();
2067  if(aSize != aSaveSize)
2068  bRepaint = true;
2069  aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
2070  pActNum->SetLevel(i, aNumFmt);
2071  }
2072  }
2073  nMask <<= 1;
2074  }
2075  SetModified(bRepaint);
2076 }
2077 
2079 {
2080  if (rBox.get_active())
2081  {
2082  if (bLastWidthModified)
2083  SizeHdl_Impl(*m_xWidthMF);
2084  else
2085  SizeHdl_Impl(*m_xHeightMF);
2086  }
2087 }
2088 
2090 {
2091  bAutomaticCharStyles = false;
2092  sal_Int32 nEntryPos = m_xCharFmtLB->get_active();
2093  OUString sEntry = m_xCharFmtLB->get_active_text();
2094  sal_uInt16 nMask = 1;
2095  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2096  {
2097  if(nActNumLvl & nMask)
2098  {
2099  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2100  if( 0 == nEntryPos )
2101  aNumFmt.SetCharFormatName("");
2102  else
2103  {
2104  if(SVX_NUM_BITMAP != (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
2105  aNumFmt.SetCharFormatName(sEntry);
2106  }
2107  pActNum->SetLevel(i, aNumFmt);
2108  }
2109  nMask <<= 1;
2110  }
2111  SetModified(false);
2112 };
2113 
2115 {
2116  EditModifyHdl_Impl(nullptr);
2117 }
2118 
2119 IMPL_LINK(SvxNumOptionsTabPage, EditModifyHdl_Impl, weld::Entry&, rEdit, void)
2120 {
2121  EditModifyHdl_Impl(&rEdit);
2122 }
2123 
2125 {
2126  bool bPrefix = pEdit == m_xPrefixED.get();
2127  bool bSuffix = pEdit == m_xSuffixED.get();
2128  bool bStart = pEdit == m_xStartED.get();
2129  sal_uInt16 nMask = 1;
2130  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2131  {
2132  if(nActNumLvl & nMask)
2133  {
2134  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2135  if(bPrefix)
2136  aNumFmt.SetPrefix(m_xPrefixED->get_text());
2137  else if(bSuffix)
2138  aNumFmt.SetSuffix(m_xSuffixED->get_text());
2139  else if(bStart)
2140  aNumFmt.SetStart(m_xStartED->get_value());
2141  pActNum->SetLevel(i, aNumFmt);
2142  }
2143  nMask <<= 1;
2144  }
2145  SetModified();
2146 }
2147 
2148 static long lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, long nXStart,
2149  long nYMiddle, long nDivision)
2150 {
2151  const SvxBrushItem* pBrushItem = rFmt.GetBrush();
2152  long nRet = 0;
2153  if(pBrushItem)
2154  {
2155  const Graphic* pGrf = pBrushItem->GetGraphic();
2156  if(pGrf)
2157  {
2158  Size aGSize( rFmt.GetGraphicSize() );
2159  aGSize.setWidth( aGSize.Width() / nDivision );
2160  nRet = aGSize.Width();
2161  aGSize.setHeight( aGSize.Height() / nDivision );
2162  pGrf->Draw( pVDev, Point(nXStart,nYMiddle - ( aGSize.Height() / 2) ),
2163  pVDev->PixelToLogic( aGSize ) );
2164  }
2165  }
2166  return nRet;
2167 
2168 }
2169 
2170 static long lcl_DrawBullet(VirtualDevice* pVDev,
2171  const SvxNumberFormat& rFmt, long nXStart,
2172  long nYStart, const Size& rSize)
2173 {
2174  vcl::Font aTmpFont(pVDev->GetFont());
2175 
2176  // via Uno it's possible that no font has been set!
2177  vcl::Font aFont(rFmt.GetBulletFont() ? *rFmt.GetBulletFont() : aTmpFont);
2178  Size aTmpSize(rSize);
2179  aTmpSize.setWidth( aTmpSize.Width() * ( rFmt.GetBulletRelSize()) );
2180  aTmpSize.setWidth( aTmpSize.Width() / 100 ) ;
2181  aTmpSize.setHeight( aTmpSize.Height() * ( rFmt.GetBulletRelSize()) );
2182  aTmpSize.setHeight( aTmpSize.Height() / 100 ) ;
2183  // in case of a height of zero it is drawn in original height
2184  if(!aTmpSize.Height())
2185  aTmpSize.setHeight( 1 );
2186  aFont.SetFontSize(aTmpSize);
2187  aFont.SetTransparent(true);
2188  Color aBulletColor = rFmt.GetBulletColor();
2189  if(aBulletColor == COL_AUTO)
2190  aBulletColor = pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK;
2191  else if(aBulletColor == pVDev->GetFillColor())
2192  aBulletColor.Invert();
2193  aFont.SetColor(aBulletColor);
2194  pVDev->SetFont( aFont );
2195  OUString aText(rFmt.GetBulletChar());
2196  long nY = nYStart;
2197  nY -= ((aTmpSize.Height() - rSize.Height())/ 2);
2198  pVDev->DrawText( Point(nXStart, nY), aText );
2199  long nRet = pVDev->GetTextWidth(aText);
2200 
2201  pVDev->SetFont(aTmpFont);
2202  return nRet;
2203 }
2204 
2206  : pActNum(nullptr)
2207  , bPosition(false)
2208  , nActLevel(SAL_MAX_UINT16)
2209 {
2210 }
2211 
2212 // paint preview of numeration
2213 void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& /*rRect*/)
2214 {
2215  Size aSize(rRenderContext.PixelToLogic(GetOutputSizePixel()));
2216 
2217  const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
2218  const Color aBackColor = rStyleSettings.GetFieldColor();
2219  const Color aTextColor = rStyleSettings.GetFieldTextColor();
2220 
2221  ScopedVclPtrInstance<VirtualDevice> pVDev(rRenderContext);
2222  pVDev->EnableRTL(rRenderContext.IsRTLEnabled());
2223  pVDev->SetMapMode(rRenderContext.GetMapMode());
2224  pVDev->SetOutputSize(aSize);
2225 
2226  Color aLineColor(COL_LIGHTGRAY);
2227  if (aLineColor == aBackColor)
2228  aLineColor.Invert();
2229  pVDev->SetLineColor(aLineColor);
2230  pVDev->SetFillColor(aBackColor);
2231 
2232  if (pActNum)
2233  {
2234  long nWidthRelation = 30; // chapter dialog
2235 
2236  // height per level
2237  long nXStep = aSize.Width() / (3 * pActNum->GetLevelCount());
2238  if (pActNum->GetLevelCount() < 10)
2239  nXStep /= 2;
2240  long nYStart = 4;
2241  // the whole height mustn't be used for a single level
2242  long nYStep = (aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5);
2243 
2244  aStdFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, MsLangId::getSystemLanguage(), GetDefaultFontFlags::OnlyOne);
2245  aStdFont.SetColor(aTextColor);
2246  aStdFont.SetFillColor(aBackColor);
2247 
2248  long nFontHeight = nYStep * 6 / 10;
2249  if (bPosition)
2250  nFontHeight = nYStep * 15 / 10;
2251  aStdFont.SetFontSize(Size( 0, nFontHeight ));
2252 
2253  SvxNodeNum aNum;
2254  sal_uInt16 nPreNum = pActNum->GetLevel(0).GetStart();
2255 
2256  if (bPosition)
2257  {
2258  long nLineHeight = nFontHeight * 8 / 7;
2259  sal_uInt8 nStart = 0;
2260  while (!(nActLevel & (1<<nStart)))
2261  {
2262  nStart++;
2263  }
2264  if (nStart)
2265  nStart--;
2266  sal_uInt8 nEnd = std::min(sal_uInt8(nStart + 3), sal_uInt8(pActNum->GetLevelCount()));
2267  for (sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel)
2268  {
2269  const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
2270  aNum.GetLevelVal()[nLevel] = rFmt.GetStart();
2271 
2272  long nXStart( 0 );
2273  short nTextOffset( 0 );
2274  long nNumberXPos( 0 );
2276  {
2277  nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
2278  nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
2279  nNumberXPos = nXStart;
2280  long nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
2281 
2282  if (nFirstLineOffset <= nNumberXPos)
2283  nNumberXPos = nNumberXPos - nFirstLineOffset;
2284  else
2285  nNumberXPos = 0;
2286  // in draw this is valid
2287  if (nTextOffset < 0)
2288  nNumberXPos = nNumberXPos + nTextOffset;
2289  }
2291  {
2292  const long nTmpNumberXPos((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
2293  if (nTmpNumberXPos < 0)
2294  {
2295  nNumberXPos = 0;
2296  }
2297  else
2298  {
2299  nNumberXPos = nTmpNumberXPos;
2300  }
2301  }
2302 
2303  long nBulletWidth = 0;
2304  if (SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
2305  {
2306  long nYMiddle = nYStart + ( nFontHeight / 2 );
2307  nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev.get(), rFmt, nNumberXPos, nYMiddle, nWidthRelation) : 0;
2308  }
2309  else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
2310  {
2311  nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawBullet(pVDev.get(), rFmt, nNumberXPos, nYStart, aStdFont.GetFontSize()) : 0;
2312  }
2313  else
2314  {
2315  pVDev->SetFont(aStdFont);
2316  aNum.SetLevel(nLevel);
2318  aNum.GetLevelVal()[nLevel] = nPreNum;
2319  OUString aText(pActNum->MakeNumString( aNum ));
2320  vcl::Font aSaveFont = pVDev->GetFont();
2321  vcl::Font aColorFont(aSaveFont);
2322  Color aTmpBulletColor = rFmt.GetBulletColor();
2323  if (aTmpBulletColor == COL_AUTO)
2324  aTmpBulletColor = aBackColor.IsDark() ? COL_WHITE : COL_BLACK;
2325  else if (aTmpBulletColor == aBackColor)
2326  aTmpBulletColor.Invert();
2327  aColorFont.SetColor(aTmpBulletColor);
2328  pVDev->SetFont(aColorFont);
2329  pVDev->DrawText(Point(nNumberXPos, nYStart), aText);
2330  pVDev->SetFont(aSaveFont);
2331  nBulletWidth = pVDev->GetTextWidth(aText);
2332  nPreNum++;
2333  }
2336  {
2337  pVDev->SetFont(aStdFont);
2338  OUString aText(' ');
2339  pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
2340  nBulletWidth = nBulletWidth + pVDev->GetTextWidth(aText);
2341  }
2342 
2343  long nTextXPos( 0 );
2345  {
2346  nTextXPos = nXStart;
2347  if (nTextOffset < 0)
2348  nTextXPos = nTextXPos + nTextOffset;
2349  if (nNumberXPos + nBulletWidth + nTextOffset > nTextXPos)
2350  nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
2351  }
2353  {
2354  switch (rFmt.GetLabelFollowedBy())
2355  {
2357  {
2358  nTextXPos = rFmt.GetListtabPos() / nWidthRelation;
2359  if (nTextXPos < nNumberXPos + nBulletWidth)
2360  {
2361  nTextXPos = nNumberXPos + nBulletWidth;
2362  }
2363  }
2364  break;
2368  {
2369  nTextXPos = nNumberXPos + nBulletWidth;
2370  }
2371  break;
2372  }
2373 
2374  nXStart = rFmt.GetIndentAt() / nWidthRelation;
2375  }
2376 
2377  ::tools::Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
2378  pVDev->SetFillColor(aBackColor);
2379  pVDev->DrawRect(aRect1);
2380 
2381  ::tools::Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2));
2382  pVDev->DrawRect(aRect2);
2383  nYStart += 2 * nLineHeight;
2384  }
2385  }
2386  else
2387  {
2388  //#i5153# painting gray or black rectangles as 'normal' numbering text
2389  long nWidth = pVDev->GetTextWidth("Preview");
2390  long nTextHeight = pVDev->GetTextHeight();
2391  long nRectHeight = nTextHeight * 2 / 3;
2392  long nTopOffset = nTextHeight - nRectHeight;
2393  Color aBlackColor(COL_BLACK);
2394  if (aBlackColor == aBackColor)
2395  aBlackColor.Invert();
2396 
2397  for (sal_uInt16 nLevel = 0; nLevel < pActNum->GetLevelCount(); ++nLevel, nYStart = nYStart + nYStep)
2398  {
2399  const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
2400  aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
2401  long nXStart( 0 );
2402  pVDev->SetFillColor( aBackColor );
2403 
2405  {
2406  nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
2407  }
2409  {
2410  const long nTmpXStart((rFmt.GetIndentAt() + rFmt.GetFirstLineIndent() ) / nWidthRelation);
2411  if (nTmpXStart < 0)
2412  {
2413  nXStart = 0;
2414  }
2415  else
2416  {
2417  nXStart = nTmpXStart;
2418  }
2419  }
2420  nXStart /= 2;
2421  nXStart += 2;
2422  long nTextOffset = 2 * nXStep;
2423  if (SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)))
2424  {
2425  if (rFmt.IsShowSymbol())
2426  {
2427  long nYMiddle = nYStart + ( nFontHeight / 2 );
2428  nTextOffset = lcl_DrawGraphic(pVDev.get(), rFmt, nXStart, nYMiddle, nWidthRelation);
2429  nTextOffset = nTextOffset + nXStep;
2430  }
2431  }
2432  else if (SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
2433  {
2434  if (rFmt.IsShowSymbol())
2435  {
2436  nTextOffset = lcl_DrawBullet(pVDev.get(), rFmt, nXStart, nYStart, aStdFont.GetFontSize());
2437  nTextOffset = nTextOffset + nXStep;
2438  }
2439  }
2440  else
2441  {
2442  vcl::Font aFont(aStdFont);
2443  Size aTmpSize(aStdFont.GetFontSize());
2444  if(pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE))
2445  {
2446  aTmpSize.setWidth( aTmpSize.Width() * ( rFmt.GetBulletRelSize()) );
2447  aTmpSize.setWidth( aTmpSize.Width() / 100 ) ;
2448  aTmpSize.setHeight( aTmpSize.Height() * ( rFmt.GetBulletRelSize()) );
2449  aTmpSize.setHeight( aTmpSize.Height() / 100 ) ;
2450  }
2451  if(!aTmpSize.Height())
2452  aTmpSize.setHeight( 1 );
2453  aFont.SetFontSize(aTmpSize);
2454  Color aTmpBulletColor = rFmt.GetBulletColor();
2455  if (aTmpBulletColor == COL_AUTO)
2456  aTmpBulletColor = aBackColor.IsDark() ? COL_WHITE : COL_BLACK;
2457  else if (aTmpBulletColor == aBackColor)
2458  aTmpBulletColor.Invert();
2459  aFont.SetColor(aTmpBulletColor);
2460  pVDev->SetFont(aFont);
2461  aNum.SetLevel( nLevel );
2463  aNum.GetLevelVal()[nLevel] = nPreNum;
2464  OUString aText(pActNum->MakeNumString(aNum));
2465  long nY = nYStart;
2466  nY -= (pVDev->GetTextHeight() - nTextHeight - pVDev->GetFontMetric().GetDescent());
2467  pVDev->DrawText(Point(nXStart, nY), aText);
2468  nTextOffset = pVDev->GetTextWidth(aText);
2469  nTextOffset = nTextOffset + nXStep;
2470  nPreNum++;
2471  pVDev->SetFont(aStdFont);
2472  }
2473  //#i5153# the selected rectangle(s) should be black
2474  if (0 != (nActLevel & (1<<nLevel)))
2475  {
2476  pVDev->SetFillColor( aBlackColor );
2477  pVDev->SetLineColor( aBlackColor );
2478  }
2479  else
2480  {
2481  //#i5153# unselected levels are gray
2482  pVDev->SetFillColor( aLineColor );
2483  pVDev->SetLineColor( aLineColor );
2484  }
2485  ::tools::Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight));
2486  pVDev->DrawRect(aRect1);
2487  }
2488  }
2489  }
2490  rRenderContext.DrawOutDev(Point(), aSize, Point(), aSize, *pVDev);
2491 }
2492 
2493 
2494 //See uiconfig/swriter/ui/outlinepositionpage.ui for effectively a duplicate
2495 //dialog to this one, except with a different preview window impl.
2496 //TODO, determine if SwNumPositionTabPage and SvxNumPositionTabPage can be
2497 //merged
2499  : SfxTabPage(pParent, "cui/ui/numberingpositionpage.ui", "NumberingPositionPage", &rSet)
2500  , nActNumLvl(1)
2501  , nNumItemId(SID_ATTR_NUMBERING_RULE)
2502  , bModified(false)
2503  , bPreset(false)
2504  , bInInintControl(false)
2505  , bLabelAlignmentPosAndSpaceModeActive(false)
2506  , m_xLevelLB(m_xBuilder->weld_tree_view("levellb"))
2507  , m_xDistBorderFT(m_xBuilder->weld_label("indent"))
2508  , m_xDistBorderMF(m_xBuilder->weld_metric_spin_button("indentmf", FieldUnit::CM))
2509  , m_xRelativeCB(m_xBuilder->weld_check_button("relative"))
2510  , m_xIndentFT(m_xBuilder->weld_label("numberingwidth"))
2511  , m_xIndentMF(m_xBuilder->weld_metric_spin_button("numberingwidthmf", FieldUnit::CM))
2512  , m_xDistNumFT(m_xBuilder->weld_label("numdist"))
2513  , m_xDistNumMF(m_xBuilder->weld_metric_spin_button("numdistmf", FieldUnit::CM))
2514  , m_xAlignFT(m_xBuilder->weld_label("numalign"))
2515  , m_xAlignLB(m_xBuilder->weld_combo_box("numalignlb"))
2516  , m_xLabelFollowedByFT(m_xBuilder->weld_label("numfollowedby"))
2517  , m_xLabelFollowedByLB(m_xBuilder->weld_combo_box("numfollowedbylb"))
2518  , m_xListtabFT(m_xBuilder->weld_label("at"))
2519  , m_xListtabMF(m_xBuilder->weld_metric_spin_button("atmf", FieldUnit::CM))
2520  , m_xAlign2FT(m_xBuilder->weld_label("num2align"))
2521  , m_xAlign2LB(m_xBuilder->weld_combo_box("num2alignlb"))
2522  , m_xAlignedAtFT(m_xBuilder->weld_label("alignedat"))
2523  , m_xAlignedAtMF(m_xBuilder->weld_metric_spin_button("alignedatmf", FieldUnit::CM))
2524  , m_xIndentAtFT(m_xBuilder->weld_label("indentat"))
2525  , m_xIndentAtMF(m_xBuilder->weld_metric_spin_button("indentatmf", FieldUnit::CM))
2526  , m_xStandardPB(m_xBuilder->weld_button("standard"))
2527  , m_xPreviewWIN(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWIN))
2528 {
2530 
2531  m_xAlignedAtMF->set_range(0, SAL_MAX_INT32, FieldUnit::NONE);
2532  m_xListtabMF->set_range(0, SAL_MAX_INT32, FieldUnit::NONE);
2533  m_xIndentAtMF->set_range(0, SAL_MAX_INT32, FieldUnit::NONE);
2534 
2535  m_xRelativeCB->set_active(true);
2536  m_xAlignLB->connect_changed(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
2537  m_xAlign2LB->connect_changed(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
2538  for ( sal_Int32 i = 0; i < m_xAlignLB->get_count(); ++i )
2539  {
2540  m_xAlign2LB->append_text(m_xAlignLB->get_text(i));
2541  }
2542 
2543  Link<weld::MetricSpinButton&,void> aLk3 = LINK(this, SvxNumPositionTabPage, DistanceHdl_Impl);
2544  m_xDistBorderMF->connect_value_changed(aLk3);
2545  m_xDistNumMF->connect_value_changed(aLk3);
2546  m_xIndentMF->connect_value_changed(aLk3);
2547 
2548  m_xLabelFollowedByLB->connect_changed(LINK(this, SvxNumPositionTabPage, LabelFollowedByHdl_Impl));
2549 
2550  m_xListtabMF->connect_value_changed(LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl));
2551  m_xAlignedAtMF->connect_value_changed(LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl));
2552  m_xIndentAtMF->connect_value_changed(LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl));
2553 
2554  m_xLevelLB->set_selection_mode(SelectionMode::Multiple);
2555  m_xLevelLB->connect_changed(LINK(this, SvxNumPositionTabPage, LevelHdl_Impl));
2556  m_xRelativeCB->connect_toggled(LINK(this, SvxNumPositionTabPage, RelativeHdl_Impl));
2557  m_xStandardPB->connect_clicked(LINK(this, SvxNumPositionTabPage, StandardHdl_Impl));
2558 
2559  m_xRelativeCB->set_active(bLastRelative);
2561  eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
2562 }
2563 
2565 {
2566  disposeOnce();
2567 }
2568 
2570 {
2571  m_xPreviewWIN.reset();
2573 }
2574 
2575 /*-------------------------------------------------------*/
2576 
2578 {
2579  bInInintControl = true;
2580  const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive &&
2581  m_xRelativeCB->get_sensitive() && m_xRelativeCB->get_active();
2582  const bool bSingleSelection = m_xLevelLB->count_selected_rows() == 1 &&
2584 
2586  ( bSingleSelection || bRelative ) );
2588  ( bSingleSelection || bRelative ) );
2589 
2590  bool bSetDistEmpty = false;
2591  bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
2592  bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive;
2593  bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive;
2594  bool bSameAdjust = true;
2595 
2596  bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive;
2597  bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive;
2598  bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive;
2599  bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive;
2600 
2601  const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
2602  sal_uInt16 nMask = 1;
2603  sal_uInt16 nLvl = SAL_MAX_UINT16;
2604  long nFirstBorderTextRelative = -1;
2605  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2606  {
2607  aNumFmtArr[i] = &pActNum->GetLevel(i);
2608  if(nActNumLvl & nMask)
2609  {
2610  if(SAL_MAX_UINT16 == nLvl)
2611  nLvl = i;
2612 
2613  if( i > nLvl)
2614  {
2615  bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
2617  {
2618  if(bRelative)
2619  {
2620  if(nFirstBorderTextRelative == -1)
2621  nFirstBorderTextRelative =
2622  (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
2623  aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
2624  else
2625  bSameDistBorderNum &= nFirstBorderTextRelative ==
2626  (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
2627  aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
2628  }
2629  else
2630  bSameDistBorderNum &=
2631  aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() ==
2632  aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset();
2633 
2634  bSameDist &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance();
2635  bSameIndent &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset();
2636  }
2637  else
2638  {
2639  bSameLabelFollowedBy &=
2640  aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy();
2641  bSameListtab &=
2642  aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos();
2643  bSameAlignAt &=
2644  ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() )
2645  == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) );
2646  bSameIndentAt &=
2647  aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt();
2648  }
2649  }
2650  }
2651  nMask <<= 1;
2652 
2653  }
2654  if (SVX_MAX_NUM <= nLvl)
2655  {
2656  OSL_ENSURE(false, "cannot happen.");
2657  return;
2658  }
2659 
2660  if(bSameDistBorderNum)
2661  {
2662  long nDistBorderNum;
2663  if(bRelative)
2664  {
2665  nDistBorderNum = static_cast<long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
2666  if(nLvl)
2667  nDistBorderNum -= static_cast<long>(aNumFmtArr[nLvl - 1]->GetAbsLSpace())+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
2668  }
2669  else
2670  {
2671  nDistBorderNum = static_cast<long>(aNumFmtArr[nLvl]->GetAbsLSpace())+ aNumFmtArr[nLvl]->GetFirstLineOffset();
2672  }
2673  SetMetricValue(*m_xDistBorderMF, nDistBorderNum, eCoreUnit);
2674  }
2675  else
2676  bSetDistEmpty = true;
2677 
2678  if(bSameDist)
2679  SetMetricValue(*m_xDistNumMF, aNumFmtArr[nLvl]->GetCharTextDistance(), eCoreUnit);
2680  else
2681  m_xDistNumMF->set_text("");
2682  if(bSameIndent)
2683  SetMetricValue(*m_xIndentMF, - aNumFmtArr[nLvl]->GetFirstLineOffset(), eCoreUnit);
2684  else
2685  m_xIndentMF->set_text("");
2686 
2687  if(bSameAdjust)
2688  {
2689  sal_Int32 nPos = 1; // centered
2690  if(aNumFmtArr[nLvl]->GetNumAdjust() == SvxAdjust::Left)
2691  nPos = 0;
2692  else if(aNumFmtArr[nLvl]->GetNumAdjust() == SvxAdjust::Right)
2693  nPos = 2;
2694  m_xAlignLB->set_active(nPos);
2695  m_xAlign2LB->set_active(nPos);
2696  }
2697  else
2698  {
2699  m_xAlignLB->set_active(-1);
2700  m_xAlign2LB->set_active(-1);
2701  }
2702 
2703  if ( bSameLabelFollowedBy )
2704  {
2705  sal_Int32 nPos = 0; // LISTTAB
2706  if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE )
2707  {
2708  nPos = 1;
2709  }
2710  else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
2711  {
2712  nPos = 2;
2713  }
2714  else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NEWLINE )
2715  {
2716  nPos = 3;
2717  }
2718  m_xLabelFollowedByLB->set_active(nPos);
2719  }
2720  else
2721  {
2722  m_xLabelFollowedByLB->set_active(-1);
2723  }
2724 
2725  if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
2726  {
2727  m_xListtabFT->set_sensitive(true);
2728  m_xListtabMF->set_sensitive(true);
2729  if ( bSameListtab )
2730  {
2731  SetMetricValue(*m_xListtabMF, aNumFmtArr[nLvl]->GetListtabPos(), eCoreUnit);
2732  }
2733  else
2734  {
2735  m_xListtabMF->set_text("");
2736  }
2737  }
2738  else
2739  {
2740  m_xListtabFT->set_sensitive(false);
2741  m_xListtabMF->set_sensitive(false);
2742  m_xListtabMF->set_text("");
2743  }
2744 
2745  if ( bSameAlignAt )
2746  {
2748  aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent(),
2749  eCoreUnit);
2750  }
2751  else
2752  {
2753  m_xAlignedAtMF->set_text("");
2754  }
2755 
2756  if ( bSameIndentAt )
2757  {
2758  SetMetricValue(*m_xIndentAtMF, aNumFmtArr[nLvl]->GetIndentAt(), eCoreUnit);
2759  }
2760  else
2761  {
2762  m_xIndentAtMF->set_text("");
2763  }
2764 
2765  if ( bSetDistEmpty )
2766  m_xDistBorderMF->set_text("");
2767 
2768  bInInintControl = false;
2769 }
2770 
2772 {
2773  const SfxPoolItem* pItem;
2774  sal_uInt16 nTmpNumLvl = 1;
2775  const SfxItemSet* pExampleSet = GetDialogExampleSet();
2776  if(pExampleSet)
2777  {
2778  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
2779  bPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
2780  if(SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
2781  nTmpNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
2782  }
2783  if(SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
2784  {
2785  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
2786  }
2787  bModified = (!pActNum->Get( 0 ) || bPreset);
2788  if(*pSaveNum != *pActNum ||
2789  nActNumLvl != nTmpNumLvl )
2790  {
2791  *pActNum = *pSaveNum;
2792  nActNumLvl = nTmpNumLvl;
2793  sal_uInt16 nMask = 1;
2794  m_xLevelLB->unselect_all();
2795  if (nActNumLvl == SAL_MAX_UINT16)
2796  m_xLevelLB->select(pActNum->GetLevelCount());
2797  if (nActNumLvl != SAL_MAX_UINT16)
2798  for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2799  {
2800  if (nActNumLvl & nMask)
2801  m_xLevelLB->select(i);
2802  nMask <<= 1 ;
2803  }
2804  m_xRelativeCB->set_sensitive(nActNumLvl != 1);
2805 
2808 
2809  InitControls();
2810  }
2813 }
2814 
2816 {
2817  if(_pSet)
2818  {
2819  if (m_xDistBorderMF->get_sensitive())
2820  DistanceHdl_Impl(*m_xDistBorderMF);
2821  DistanceHdl_Impl(*m_xIndentMF);
2822  FillItemSet(_pSet);
2823  }
2824  return DeactivateRC::LeavePage;
2825 }
2826 
2828 {
2829  rSet->Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
2830 
2831  if(bModified && pActNum)
2832  {
2833  *pSaveNum = *pActNum;
2835  rSet->Put(SfxBoolItem(SID_PARAM_NUM_PRESET, false));
2836  }
2837  return bModified;
2838 }
2839 
2841 {
2842  const SfxPoolItem* pItem;
2843  // in Draw the item exists as WhichId, in Writer only as SlotId
2844  SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
2845  if(eState != SfxItemState::SET)
2846  {
2847  nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
2848  eState = rSet->GetItemState(nNumItemId, false, &pItem);
2849 
2850  if( eState != SfxItemState::SET )
2851  {
2852  pItem = &static_cast< const SvxNumBulletItem& >( rSet->Get( nNumItemId ) );
2853  eState = SfxItemState::SET;
2854  }
2855 
2856  }
2857  DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
2858  pSaveNum.reset( new SvxNumRule(*static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()) );
2859 
2860  // insert levels
2861  if (!m_xLevelLB->count_selected_rows())
2862  {
2863  for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++)
2864  m_xLevelLB->append_text(OUString::number(i));
2865  if(pSaveNum->GetLevelCount() > 1)
2866  {
2867  OUString sEntry = "1 - " + OUString::number( pSaveNum->GetLevelCount() );
2868  m_xLevelLB->append_text(sEntry);
2869  m_xLevelLB->select_text(sEntry);
2870  }
2871  else
2872  m_xLevelLB->select(0);
2873  }
2874  else
2875  m_xLevelLB->select(m_xLevelLB->count_selected_rows() - 1);
2876  sal_uInt16 nMask = 1;
2877  m_xLevelLB->unselect_all();
2878  if (nActNumLvl == SAL_MAX_UINT16)
2879  {
2880  m_xLevelLB->select(pSaveNum->GetLevelCount());
2881  }
2882  else
2883  {
2884  for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++)
2885  {
2886  if(nActNumLvl & nMask)
2887  m_xLevelLB->select(i);
2888  nMask <<= 1;
2889  }
2890  }
2891 
2892  if(!pActNum)
2893  pActNum.reset( new SvxNumRule(*pSaveNum) );
2894  else if(*pSaveNum != *pActNum)
2895  *pActNum = *pSaveNum;
2897 
2900 
2901  InitControls();
2902  bModified = false;
2903 }
2904 
2906 {
2907  if ( pActNum == nullptr )
2908  {
2909  SAL_WARN( "cui.tabpages",
2910  "<SvxNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" );
2911  return;
2912  }
2913 
2916  sal_uInt16 nMask = 1;
2917  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
2918  {
2919  if(nActNumLvl & nMask)
2920  {
2921  SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
2922  ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
2923  if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2924  {
2925  break;
2926  }
2927  }
2928  nMask <<= 1;
2929  }
2930 
2932  ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
2933 }
2934 
2936 {
2943  pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS) );
2945  pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS));
2948 
2959 }
2960 
2962  const SfxItemSet* rAttrSet)
2963 {
2964  return VclPtr<SvxNumPositionTabPage>::Create(pParent, *rAttrSet);
2965 }
2966 
2968 {
2969  if (eMetric == FieldUnit::MM)
2970  {
2971  m_xDistBorderMF->set_digits(1);
2972  m_xDistNumMF->set_digits(1);
2973  m_xIndentMF->set_digits(1);
2974  m_xListtabMF->set_digits(1);
2975  m_xAlignedAtMF->set_digits(1);
2976  m_xIndentAtMF->set_digits(1);
2977  }
2978  m_xDistBorderMF->set_unit(eMetric);
2979  m_xDistNumMF->set_unit(eMetric);
2980  m_xIndentMF->set_unit(eMetric);
2981  m_xListtabMF->set_unit(eMetric);
2982  m_xAlignedAtMF->set_unit(eMetric);
2983  m_xIndentAtMF->set_unit(eMetric);
2984 }
2985 
2987 {
2988  sal_uInt16 nMask = 1;
2989  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
2990  {
2991  if(nActNumLvl & nMask)
2992  {
2993  SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
2994 
2995  const sal_Int32 nPos = m_xAlignLB->get_visible()
2996  ? m_xAlignLB->get_active()
2997  : m_xAlign2LB->get_active();
2998  SvxAdjust eAdjust = SvxAdjust::Center;
2999  if(nPos == 0)
3000  eAdjust = SvxAdjust::Left;
3001  else if(nPos == 2)
3002  eAdjust = SvxAdjust::Right;
3003  aNumFmt.SetNumAdjust( eAdjust );
3004  pActNum->SetLevel(i, aNumFmt);
3005  }
3006  nMask <<= 1;
3007  }
3008  SetModified();
3009 }
3010 
3011 IMPL_LINK(SvxNumPositionTabPage, LevelHdl_Impl, weld::TreeView&, rBox, void)
3012 {
3013  sal_uInt16 nSaveNumLvl = nActNumLvl;
3014  nActNumLvl = 0;
3015  std::vector<int> aSelectedRows = rBox.get_selected_rows();
3016  if (std::find(aSelectedRows.begin(), aSelectedRows.end(), pActNum->GetLevelCount()) != aSelectedRows.end() &&
3017  (aSelectedRows.size() == 1 || nSaveNumLvl != 0xffff))
3018  {
3019  nActNumLvl = 0xFFFF;
3020  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
3021  rBox.unselect(i);
3022  }
3023  else if (!aSelectedRows.empty())
3024  {
3025  sal_uInt16 nMask = 1;
3026  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
3027  {
3028  if (std::find(aSelectedRows.begin(), aSelectedRows.end(), i) != aSelectedRows.end())
3029  nActNumLvl |= nMask;
3030  nMask <<= 1;
3031  }
3032  rBox.unselect(pActNum->GetLevelCount());
3033  }
3034  else
3035  {
3036  nActNumLvl = nSaveNumLvl;
3037  sal_uInt16 nMask = 1;
3038  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
3039  {
3040  if(nActNumLvl & nMask)
3041  {
3042  rBox.select(i);
3043  break;
3044  }
3045  nMask <<=1;
3046  }
3047  }
3048  m_xRelativeCB->set_sensitive(nActNumLvl != 1);
3049  SetModified();
3050  InitPosAndSpaceMode();
3051  ShowControlsDependingOnPosAndSpaceMode();
3052  InitControls();
3053 }
3054 
3056 {
3057  if(bInInintControl)
3058  return;
3059  long nValue = GetCoreValue(rFld, eCoreUnit);
3060  sal_uInt16 nMask = 1;
3061  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
3062  {
3063  if(nActNumLvl & nMask)
3064  {
3065  SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
3066  if (&rFld == m_xDistBorderMF.get())
3067  {
3068 
3069  if (m_xRelativeCB->get_active())
3070  {
3071  if(0 == i)
3072  {
3073  auto const nTmp = aNumFmt.GetFirstLineOffset();
3074  aNumFmt.SetAbsLSpace( nValue - nTmp);
3075  }
3076  else
3077  {
3078  long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() +
3079  pActNum->GetLevel( i - 1 ).GetFirstLineOffset() -
3080  pActNum->GetLevel( i ).GetFirstLineOffset();
3081 
3082  aNumFmt.SetAbsLSpace( nValue + nTmp);
3083  }
3084  }
3085  else
3086  {
3087  aNumFmt.SetAbsLSpace( nValue - aNumFmt.GetFirstLineOffset());
3088  }
3089  }
3090  else if (&rFld == m_xDistNumMF.get())
3091  {
3092  aNumFmt.SetCharTextDistance( static_cast<short>(nValue) );
3093  }
3094  else if (&rFld == m_xIndentMF.get())
3095  {
3096  // together with the FirstLineOffset the AbsLSpace must be changed, too
3097  long nDiff = nValue + aNumFmt.GetFirstLineOffset();
3098  auto const nAbsLSpace = aNumFmt.GetAbsLSpace();
3099  aNumFmt.SetAbsLSpace(nAbsLSpace + nDiff);
3100  aNumFmt.SetFirstLineOffset( -nValue );
3101  }
3102 
3103  pActNum->SetLevel( i, aNumFmt );
3104  }
3105  nMask <<= 1;
3106  }
3107 
3108  SetModified();
3109  if (!m_xDistBorderMF->get_sensitive())
3110  {
3111  m_xDistBorderMF->set_text("");
3112  }
3113 }
3114 
3115 IMPL_LINK(SvxNumPositionTabPage, RelativeHdl_Impl, weld::ToggleButton&, rBox, void)
3116 {
3117  bool bOn = rBox.get_active();
3118  bool bSingleSelection = m_xLevelLB->count_selected_rows() == 1 && SAL_MAX_UINT16 != nActNumLvl;
3119  bool bSetValue = false;
3120  long nValue = 0;
3121  if(bOn || bSingleSelection)
3122  {
3123  sal_uInt16 nMask = 1;
3124  bool bFirst = true;
3125  bSetValue = true;
3126  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
3127  {
3128  if(nActNumLvl & nMask)
3129  {
3130  const SvxNumberFormat &rNumFmt = pActNum->GetLevel(i);
3131  if(bFirst)
3132  {
3133  nValue = rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset();
3134  if(bOn && i)
3135  nValue -= (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
3136  }
3137  else
3138  bSetValue = nValue ==
3139  (rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset()) -
3140  (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
3141  bFirst = false;
3142  }
3143  nMask <<= 1;
3144  }
3145 
3146  }
3147  if(bSetValue)
3148  SetMetricValue(*m_xDistBorderMF, nValue, eCoreUnit);
3149  else
3150  m_xDistBorderMF->set_text("");
3151  m_xDistBorderMF->set_sensitive(bOn || bSingleSelection);
3152  m_xDistBorderFT->set_sensitive(bOn || bSingleSelection);
3153  bLastRelative = bOn;
3154 }
3155 
3156 IMPL_LINK_NOARG(SvxNumPositionTabPage, LabelFollowedByHdl_Impl, weld::ComboBox&, void)
3157 {
3158  // determine value to be set at the chosen list levels
3160  {
3161  const auto nPos = m_xLabelFollowedByLB->get_active();
3162  if ( nPos == 1 )
3163  {
3164  eLabelFollowedBy = SvxNumberFormat::SPACE;
3165  }
3166  else if ( nPos == 2 )
3167  {
3168  eLabelFollowedBy = SvxNumberFormat::NOTHING;
3169  }
3170  else if ( nPos == 3 )
3171  {
3172  eLabelFollowedBy = SvxNumberFormat::NEWLINE;
3173  }
3174  }
3175 
3176  // set value at the chosen list levels
3177  bool bSameListtabPos = true;
3178  sal_uInt16 nFirstLvl = SAL_MAX_UINT16;
3179  sal_uInt16 nMask = 1;
3180  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
3181  {
3182  if ( nActNumLvl & nMask )
3183  {
3184  SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3185  aNumFmt.SetLabelFollowedBy( eLabelFollowedBy );
3186  pActNum->SetLevel( i, aNumFmt );
3187 
3188  if ( nFirstLvl == SAL_MAX_UINT16 )
3189  {
3190  nFirstLvl = i;
3191  }
3192  else
3193  {
3194  bSameListtabPos &= aNumFmt.GetListtabPos() ==
3195  pActNum->GetLevel( nFirstLvl ).GetListtabPos();
3196  }
3197  }
3198  nMask <<= 1;
3199  }
3200 
3201  // enable/disable metric field for list tab stop position depending on
3202  // selected item following the list label.
3203  m_xListtabFT->set_sensitive( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
3204  m_xListtabMF->set_sensitive( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
3205  if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB )
3206  {
3207  SetMetricValue(*m_xListtabMF, pActNum->GetLevel( nFirstLvl ).GetListtabPos(), eCoreUnit);
3208  }
3209  else
3210  {
3211  m_xListtabMF->set_text(OUString());
3212  }
3213 
3214  SetModified();
3215 }
3216 
3217 IMPL_LINK(SvxNumPositionTabPage, ListtabPosHdl_Impl, weld::MetricSpinButton&, rFld, void)
3218 {
3219  // determine value to be set at the chosen list levels
3220  const long nValue = GetCoreValue(rFld, eCoreUnit);
3221 
3222  // set value at the chosen list levels
3223  sal_uInt16 nMask = 1;
3224  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
3225  {
3226  if ( nActNumLvl & nMask )
3227  {
3228  SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3229  aNumFmt.SetListtabPos( nValue );
3230  pActNum->SetLevel( i, aNumFmt );
3231  }
3232  nMask <<= 1;
3233  }
3234 
3235  SetModified();
3236 }
3237 
3239 {
3240  // determine value to be set at the chosen list levels
3241  const long nValue = GetCoreValue(rFld, eCoreUnit);
3242 
3243  // set value at the chosen list levels
3244  sal_uInt16 nMask = 1;
3245  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
3246  {
3247  if ( nActNumLvl & nMask )
3248  {
3249  SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3250  const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
3251  aNumFmt.SetFirstLineIndent( nFirstLineIndent );
3252  pActNum->SetLevel( i, aNumFmt );
3253  }
3254  nMask <<= 1;
3255  }
3256 
3257  SetModified();
3258 }
3259 
3261 {
3262  // determine value to be set at the chosen list levels
3263  const long nValue = GetCoreValue(rFld, eCoreUnit);
3264 
3265  // set value at the chosen list levels
3266  sal_uInt16 nMask = 1;
3267  for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
3268  {
3269  if ( nActNumLvl & nMask )
3270  {
3271  SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
3272  const long nAlignedAt = aNumFmt.GetIndentAt() +
3273  aNumFmt.GetFirstLineIndent();
3274  aNumFmt.SetIndentAt( nValue );
3275  const long nNewFirstLineIndent = nAlignedAt - nValue;
3276  aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
3277  pActNum->SetLevel( i, aNumFmt );
3278  }
3279  nMask <<= 1;
3280  }
3281 
3282  SetModified();
3283 }
3284 
3286 {
3287  sal_uInt16 nMask = 1;
3288  SvxNumRule aTmpNumRule( pActNum->GetFeatureFlags(),
3289  pActNum->GetLevelCount(),
3290  pActNum->IsContinuousNumbering(),
3291  SvxNumRuleType::NUMBERING,
3292  pActNum->GetLevel( 0 ).GetPositionAndSpaceMode() );
3293  for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
3294  {
3295  if(nActNumLvl & nMask)
3296  {
3297  SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
3298  const SvxNumberFormat& aTempFmt(aTmpNumRule.GetLevel( i ));
3299  aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() );
3300  if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
3301  {
3302  aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace() );
3303  aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() );
3304  aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() );
3305  }
3306  else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
3307  {
3308  aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() );
3309  aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() );
3310  aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() );
3311  aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() );
3312  aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() );
3313  }
3314 
3315  pActNum->SetLevel( i, aNumFmt );
3316  }
3317  nMask <<= 1;
3318  }
3319 
3320  InitControls();
3321  SetModified();
3322 }
3323 
3325 {
3326  bModified = true;
3329 }
3330 
3332 {
3333  bModified = true;
3334  if (bRepaint)
3335  {
3338  }
3339 }
3340 
3342 {
3343  const SfxStringListItem* pListItem = aSet.GetItem<SfxStringListItem>(SID_CHAR_FMT_LIST_BOX, false);
3344  const SfxStringItem* pNumCharFmt = aSet.GetItem<SfxStringItem>(SID_NUM_CHAR_FMT, false);
3345  const SfxStringItem* pBulletCharFmt = aSet.GetItem<SfxStringItem>(SID_BULLET_CHAR_FMT, false);
3346  const SfxAllEnumItem* pMetricItem = aSet.GetItem<SfxAllEnumItem>(SID_METRIC_ITEM, false);
3347 
3348  if (pNumCharFmt &&pBulletCharFmt)
3349  SetCharFmts( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
3350 
3351  if (pListItem)
3352  {
3353  const std::vector<OUString> &aList = pListItem->GetList();
3354  sal_uInt32 nCount = aList.size();
3355  for(sal_uInt32 i = 0; i < nCount; i++)
3356  m_xCharFmtLB->append_text(aList[i]);
3357  }
3358  if (pMetricItem)
3359  SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
3360 }
3361 
3363 {
3364  const SfxAllEnumItem* pMetricItem = aSet.GetItem<SfxAllEnumItem>(SID_METRIC_ITEM, false);
3365 
3366  if (pMetricItem)
3367  SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
3368 }
3369 
3370 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetFamily(FontFamily)
std::unique_ptr< weld::Label > m_xErrorText
Definition: numpages.hxx:187
std::unique_ptr< weld::Label > m_xDistNumFT
Definition: numpages.hxx:351
SvxNumType GetNumberingType() const
long Width() const
#define SHOW_NUMBERING
Definition: numpages.cxx:95
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
SvxSingleNumPickTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: numpages.cxx:174
void SetFillColor(const Color &)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
SVX_NUM_CHARS_UPPER_LETTER_N
FieldUnit
void SetLabelFollowedBy(const LabelFollowedBy eLabelFollowedBy)
virtual void dispose() override
Definition: numpages.cxx:812
static bool FillObjList(const OUString &rThemeName, std::vector< OUString > &rObjList)
sal_uInt16 nActNumLvl
Definition: numpages.hxx:99
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: numpages.cxx:825
std::unique_ptr< weld::Label > m_xBulColorFT
Definition: numpages.hxx:250
void SetFontSize(const Size &)
ErrCode GetGraphic(Graphic &) const
std::unique_ptr< weld::MenuButton > m_xBitmapMB
Definition: numpages.hxx:261
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
void SetCharFmts(const OUString &rNumName, const OUString &rBulletName)
Definition: numpages.hxx:313
#define SVX_NUM_REL_SIZE_MIN
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: numpages.cxx:2815
const OUString & GetFamilyName() const
const Color & GetBulletColor() const
std::unique_ptr< weld::CustomWeld > m_xExamplesVSWin
Definition: numpages.hxx:190
long GetFirstLineIndent() const
std::unique_ptr< weld::CustomWeld > m_xExamplesVSWin
Definition: numpages.hxx:73
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: numpages.cxx:2961
std::unique_ptr< weld::Label > m_xAllLevelFT
Definition: numpages.hxx:254
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: numpages.cxx:228
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: numpages.cxx:246
std::string GetValue
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
virtual void dispose() override
Definition: numpages.cxx:2569
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: numpages.cxx:436
long Height() const
sal_uInt16 GetBulletRelSize() const
#define NUM_VALUSET_COUNT
Definition: numpages.hxx:127
void SetPositionAndSpaceMode(SvxNumPositionAndSpaceMode ePositionAndSpaceMode)
std::unique_ptr< weld::Label > m_xAlign2FT
Definition: numpages.hxx:361
SvxNumSettingsArr_Impl aNumSettingsArrays[NUM_VALUSET_COUNT]
Definition: numpages.hxx:138
const SvxBrushItem * GetBrush() const
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: numpages.cxx:1168
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
OUString GetPath() const
const sal_uInt16 * GetLevelVal() const
std::unique_ptr< weld::Label > m_xDistBorderFT
Definition: numpages.hxx:346
void SetNumRule(const SvxNumRule *pNum)
SVX_NUM_NUMBER_NONE
std::unique_ptr< SvxNumRule > pActNum
Definition: numpages.hxx:220
FAMILY_DONTKNOW
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
void SetPrefix(const OUString &rSet)
std::unique_ptr< weld::Widget > m_xAllLevelsFrame
Definition: numpages.hxx:269
IMPL_LINK_NOARG(SvxSingleNumPickTabPage, NumSelectHdl_Impl, SvtValueSet *, void)
Definition: numpages.cxx:313
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
void SetChar(sal_UCS4)
Definition: cuicharmap.cxx:203
const SvxNumberFormat * Get(sal_uInt16 nLevel) const
SvxBitmapPickTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: numpages.cxx:759
std::unique_ptr< SvxNumRule > pActNum
Definition: numpages.hxx:64
void SetWeight(FontWeight)
std::unique_ptr< weld::CheckButton > m_xRelativeCB
Definition: numpages.hxx:348
std::unique_ptr< weld::ComboBox > m_xLabelFollowedByLB
Definition: numpages.hxx:358
std::unique_ptr< weld::MetricSpinButton > m_xHeightMF
Definition: numpages.hxx:265
sal_uInt8 GetIncludeUpperLevels() const
static bool BeginLocking(const OUString &rThemeName)
vcl::Font aActBulletFont
Definition: numpages.hxx:232
std::unique_ptr< weld::Label > m_xBitmapFT
Definition: numpages.hxx:260
const MapMode & GetMapMode() const
virtual ~SvxSingleNumPickTabPage() override
Definition: numpages.cxx:216
OUString sBulletCharFormatName
Definition: numpages.hxx:104
std::unique_ptr< weld::CustomWeld > m_xPreviewWIN
Definition: numpages.hxx:272
std::unique_ptr< weld::CustomWeld > m_xPreviewWIN
Definition: numpages.hxx:368
const vcl::Font & GetCharFont() const
Definition: cuicharmap.hxx:156
void SetCharSet(rtl_TextEncoding)
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: numpages.cxx:403
static SfxObjectShell * Current()
OUString Name
static const sal_Unicode aBulletTypes[]
Definition: numpages.cxx:133
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
void SetIncludeUpperLevels(sal_uInt8 nSet)
static bool EndLocking(const OUString &rThemeName)
OUString GetPath() const
std::unique_ptr< SvxNumRule > pActNum
Definition: numpages.hxx:330
std::unique_ptr< SvxNumRule > pSaveNum
Definition: numpages.hxx:331
static int GetValue(sal_uInt32 i)
virtual ~SvxNumPickTabPage() override
Definition: numpages.cxx:563
SvxNumPositionTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: numpages.cxx:2498
#define MAX_BMP_WIDTH
Definition: numpages.cxx:99
static Size GetGraphicSizeMM100(const Graphic *pGraphic)
bool IsAvailable(const OUString &rName) const
std::unique_ptr< weld::Label > m_xStartFT
Definition: numpages.hxx:256
sal_uInt16 nActNumLvl
Definition: numpages.hxx:235
virtual void dispose() override
Definition: numpages.cxx:221
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
Size const & GetOutputSizePixel() const
virtual void Reset(const SfxItemSet *rSet) override
Definition: numpages.cxx:1233
SvxNumType
static OUString GetString(sal_uInt32 i)
OUString PathToFileName() const
std::unique_ptr< weld::CustomWeld > m_xExamplesVSWin
Definition: numpages.hxx:107
Value
std::unique_ptr< weld::Button > m_xBulletPB
Definition: numpages.hxx:259
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
std::unique_ptr< SvxNumRule > pSaveNum
Definition: numpages.hxx:65
sal_uInt16 sal_Unicode
std::unique_ptr< weld::ComboBox > m_xAlign2LB
Definition: numpages.hxx:362
std::unique_ptr< weld::ComboBox > m_xAlignLB
Definition: numpages.hxx:354
std::unique_ptr< weld::MetricSpinButton > m_xListtabMF
Definition: numpages.hxx:360
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
std::unique_ptr< SvxBmpNumValueSet > m_xExamplesVS
Definition: numpages.hxx:189
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: numpages.cxx:1221
#define SAL_MAX_UINT16
const vcl::Font & GetFont() const
SvxNumberingPreview m_aPreviewWIN
Definition: numpages.hxx:342
std::unique_ptr< weld::Label > m_xBulRelSizeFT
Definition: numpages.hxx:252
std::unique_ptr< weld::Label > m_xHeightFT
Definition: numpages.hxx:264
std::unique_ptr< weld::Label > m_xBulletFT
Definition: numpages.hxx:258
std::unique_ptr< weld::TreeView > m_xLevelLB
Definition: numpages.hxx:241
void SetExchangeSupport()
weld::Window * GetFrameWeld(SfxFrame *pFrame)
void SetBulletRelSize(sal_uInt16 nSet)
virtual void Reset(const SfxItemSet *rSet) override
Definition: numpages.cxx:882
void SetCharFormatName(const OUString &rSet)
SVX_NUM_ARABIC
std::unique_ptr< weld::Label > m_xSuffixFT
Definition: numpages.hxx:246
FontMetric Get(const OUString &rName, const OUString &rStyleName) const
short GetCharTextDistance() const
sal_uInt16 nNumItemId
Definition: numpages.hxx:143
sal_uInt16 GetExportFormatNumberForShortName(const OUString &rShortName)
std::unique_ptr< SvxNumRule > pSaveNum
Definition: numpages.hxx:141
virtual void dispose() override
Definition: numpages.cxx:568
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: numpages.cxx:386
virtual void dispose() override
Definition: numpages.cxx:1148
std::unique_ptr< weld::Button > m_xBtBrowseFile
Definition: numpages.hxx:188
std::unique_ptr< weld::MetricSpinButton > m_xDistBorderMF
Definition: numpages.hxx:347
virtual void Reset(const SfxItemSet *rSet) override
Definition: numpages.cxx:2840
void CheckForStartValue_Impl(sal_uInt16 nNumberingType)
Definition: numpages.cxx:1734
const Graphic * GetGraphic(OUString const &referer=OUString()) const
sal_uInt16 nNumItemId
Definition: numpages.hxx:182
const OUString & GetPrefix() const
std::unique_ptr< weld::CustomWeld > m_xExamplesVSWin
Definition: numpages.hxx:148
virtual void dispose() override
const OUString & GetSuffix() const
OUString sBulletChar
Definition: numpages.hxx:47
void SetPitch(FontPitch ePitch)
const LanguageTag & GetLanguageTag() const
std::unique_ptr< SvxNumRule > pActNum
Definition: numpages.hxx:179
std::unique_ptr< weld::Button > m_xStandardPB
Definition: numpages.hxx:367
static long lcl_DrawGraphic(VirtualDevice *pVDev, const SvxNumberFormat &rFmt, long nXStart, long nYMiddle, long nDivision)
Definition: numpages.cxx:2148
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: numpages.cxx:3341
SVX_NUM_BITMAP
void Invert()
SVX_NUM_CHAR_SPECIAL
WEIGHT_DONTKNOW
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
static LanguageType getSystemLanguage()
void SetLevel(sal_uInt16 nSet)
void SetModified(bool bRepaint=true)
Definition: numpages.cxx:3331
void SetListtabPos(const long nListtabPos)
bool IsFeatureSupported(SvxNumRuleFlags nFeature) const
IMPL_LINK(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView &, rBox, void)
Definition: numpages.cxx:1592
#define SEARCHPATH_DELIMITER
Definition: numpages.cxx:101
bool IsRTLEnabled() const
#define SAL_MAX_INT32
void Draw(OutputDevice *pOutDev, const Point &rDestPt) const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: numpages.cxx:625
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
SvxAdjust
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: numpages.cxx:2213
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: numpages.cxx:2771
LabelFollowedBy GetLabelFollowedBy() const
void SetBulletFont(const vcl::Font *pFont)
sal_Int32 GetAbsLSpace() const
void SetMetric(FieldUnit eSet)
Definition: numpages.cxx:2967
std::unique_ptr< weld::Label > m_xCharFmtFT
Definition: numpages.hxx:248
bool IsDark() const
#define SEARCHFILENAME_DELIMITER
Definition: numpages.cxx:102
#define SHOW_BULLET
Definition: numpages.cxx:96
static bool GetGraphicObj(const OUString &rThemeName, sal_uInt32 nPos, Graphic *pGraphic)
static bool InsertURL(const OUString &rThemeName, const OUString &rURL)
std::unique_ptr< SvxNumRule > pSaveNum
Definition: numpages.hxx:98
int i
const OUString & GetValue() const
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
HTMLMODE_ON
static SvxNumSettings_Impl * lcl_CreateNumSettingsPtr(const Sequence< PropertyValue > &rLevelProps)
Definition: numpages.cxx:106
std::unique_ptr< weld::ComboBox > m_xOrientLB
Definition: numpages.hxx:268
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: numpages.cxx:234
std::unique_ptr< weld::SpinButton > m_xStartED
Definition: numpages.hxx:257
const vcl::Font * GetBulletFont() const
std::unique_ptr< SvxNumRule > pSaveNum
Definition: numpages.hxx:221
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: numpages.cxx:3362
SvxNumberingPreview m_aPreviewWIN
Definition: numpages.hxx:239
OUString MakeNumString(const SvxNodeNum &) const
WEIGHT_NORMAL
const SvxNumberFormat & GetLevel(sal_uInt16 nLevel) const
sal_uInt16 GetLevelCount() const
static sal_uInt32 Count()
static const vcl::Font & lcl_GetDefaultBulletFont()
Definition: numpages.cxx:159
#define SHOW_BITMAP
Definition: numpages.cxx:97
virtual void dispose() override
Definition: numpages.cxx:379
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: numpages.cxx:581
virtual void Reset(const SfxItemSet *rSet) override
Definition: numpages.cxx:632
std::unique_ptr< weld::MetricSpinButton > m_xIndentAtMF
Definition: numpages.hxx:366
const Size & GetFontSize() const
PITCH_DONTKNOW
std::unique_ptr< weld::Widget > m_xGrid
Definition: numpages.hxx:240
static Reference< XDefaultNumberingProvider > GetNumberingProvider()
std::unique_ptr< SvxNumRule > pActNum
Definition: numpages.hxx:140
std::unique_ptr< weld::Label > m_xIndentFT
Definition: numpages.hxx:349
SvxAdjust GetNumAdjust() const
void SetCharFormatNames(const OUString &rCharName, const OUString &rBulName)
Definition: numpages.hxx:166
std::unique_ptr< weld::Label > m_xPrefixFT
Definition: numpages.hxx:244
std::unique_ptr< weld::MetricSpinButton > m_xIndentMF
Definition: numpages.hxx:350
const AllSettings & GetSettings() const
sal_uInt16 nActNumLvl
Definition: numpages.hxx:181
void SwitchNumberType(sal_uInt8 nType)
To switch between the numbering type 0 - Number; 1 - Bullet; 2 - Bitmap;.
Definition: numpages.cxx:1533
sal_uInt16 GetStart() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
std::unique_ptr< weld::Entry > m_xSuffixED
Definition: numpages.hxx:247
ITALIC_NONE
void ShowControlsDependingOnPosAndSpaceMode()
Definition: numpages.cxx:2935
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
SvxNumSettingsArr_Impl aNumSettingsArr
Definition: numpages.hxx:63
std::unique_ptr< NumValueSet > m_xExamplesVS
Definition: numpages.hxx:106
GPOS_AREA
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
void SetTimeout(sal_uInt64 nTimeoutMs)
bool bLabelAlignmentPosAndSpaceModeActive
Definition: numpages.hxx:340
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: numpages.cxx:749
sal_uInt16 nNumItemId
Definition: numpages.hxx:102
static ErrCode Import(SvStream &rIStm, Graphic &rGraphic, ConvertDataFormat nFormat=ConvertDataFormat::Unknown)
SfxItemPool * GetPool() const
std::unique_ptr< weld::Label > m_xListtabFT
Definition: numpages.hxx:359
SVX_NUM_CHARS_LOWER_LETTER_N
ErrCode ExportGraphic(const Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
const SfxItemSet * GetDialogExampleSet() const
std::vector< OUString > & GetList()
OUString CuiResId(const char *pKey)
Definition: cuiresmgr.cxx:23
void EditModifyHdl_Impl(const weld::Entry *)
Definition: numpages.cxx:2124
virtual ~SvxNumPositionTabPage() override
Definition: numpages.cxx:2564
SvxNumOptionsTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: numpages.cxx:1050
void SetTitle(const OUString &rNewTitle)
std::unique_ptr< NumValueSet > m_xExamplesVS
Definition: numpages.hxx:72
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: numpages.cxx:392
void SetColor(const Color &)
static bool bLastRelative
Definition: numpages.cxx:104
virtual short run() override
Definition: cuicharmap.cxx:182
Point PixelToLogic(const Point &rDevicePt) const
std::unique_ptr< weld::Label > m_xLabelFollowedByFT
Definition: numpages.hxx:357
long GetIndentAt() const
virtual void Reset(const SfxItemSet *rSet) override
Definition: numpages.cxx:443
std::unique_ptr< weld::Label > m_xIndentAtFT
Definition: numpages.hxx:365
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
std::unique_ptr< weld::Label > m_xWidthFT
Definition: numpages.hxx:262
std::unique_ptr< SvxNumRule > pActNum
Definition: numpages.hxx:97
SvxNumPickTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: numpages.cxx:514
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool IsContinuousNumbering() const
std::unique_ptr< weld::Label > m_xOrientFT
Definition: numpages.hxx:267
TabPage for complete numeration.
Definition: numpages.hxx:130
std::unique_ptr< weld::Entry > m_xPrefixED
Definition: numpages.hxx:245
std::unique_ptr< weld::MetricSpinButton > m_xBulRelSizeMF
Definition: numpages.hxx:253
SvxBulletPickTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: numpages.cxx:359
const Size & GetGraphicSize() const
SfxItemState
weld::Entry & rEdit
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: numpages.cxx:592
std::vector< std::unique_ptr< SvxNumSettings_Impl > > SvxNumSettingsArr_Impl
Definition: numpages.hxx:55
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
std::unique_ptr< weld::ComboBox > m_xCharFmtLB
Definition: numpages.hxx:249
#define ERRCODE_NONE
virtual ~SvxBitmapPickTabPage() override
Definition: numpages.cxx:807
#define LINK_TOKEN
unsigned char sal_uInt8
sal_uInt16 nNumItemId
Definition: numpages.hxx:334
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: numpages.cxx:2827
void SetFont(const vcl::Font &rNewFont)
void clicked()
void SetTransparent(bool bTransparent)
static bool lcl_IsNumFmtSet(SvxNumRule const *pNum, sal_uInt16 nLevelMask)
Definition: numpages.cxx:146
virtual OUString GetCharFormatName() const
sal_uInt16 nActNumLvl
Definition: numpages.hxx:142
SvxNumType nNumberType
Definition: numpages.hxx:43
INetProtocol GetProtocol() const
RET_OK
std::unique_ptr< weld::CheckButton > m_xSameLevelCB
Definition: numpages.hxx:271
static VclPtr< reference_type > Create(Arg &&...arg)
OUString GetFileExtension() const
static long lcl_DrawBullet(VirtualDevice *pVDev, const SvxNumberFormat &rFmt, long nXStart, long nYStart, const Size &rSize)
Definition: numpages.cxx:2170
const OUString & GetGalleryPath() const
std::vector< OUString > aGrfNames
Definition: numpages.hxx:177
void SetMetric(FieldUnit eSet)
Definition: numpages.cxx:1157
const OUString PERCENT("Percent")
#define SVX_MAX_NUM
std::unique_ptr< weld::MetricSpinButton > m_xDistNumMF
Definition: numpages.hxx:352
void SetInvokeHandler(const Link< Timer *, void > &rLink)
void SetCharFont(const vcl::Font &rFont)
Definition: cuicharmap.cxx:571
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: numpages.cxx:819
void SetLevel(sal_uInt8 nVal)
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
std::unique_ptr< weld::ComboBox > m_xFmtLB
Definition: numpages.hxx:242
long GetListtabPos() const
virtual ~SvxBulletPickTabPage() override
Definition: numpages.cxx:374
sal_Int32 GetFirstLineOffset() const
bool IsShowSymbol() const
#define SVX_DEF_BULLET
long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
sal_Unicode GetBulletChar() const
std::unique_ptr< weld::SpinButton > m_xAllLevelNF
Definition: numpages.hxx:255
#define MAX_BMP_HEIGHT
Definition: numpages.cxx:100
DeactivateRC
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: numpages.cxx:280
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: numpages.cxx:866
virtual ~SvxNumOptionsTabPage() override
Definition: numpages.cxx:1143
static GraphicFilter & GetGraphicFilter()
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: numpages.cxx:506
reference_type * get() const
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: numpages.cxx:575
sal_UCS4 GetChar() const
Definition: cuicharmap.cxx:209
#define SAL_WARN(area, stream)
std::unique_ptr< weld::TreeView > m_xLevelLB
Definition: numpages.hxx:343
The main purpose of this dialog is to enable the use of characters that are not easily accessible fro...
Definition: cuicharmap.hxx:71
std::unique_ptr< SvxNumRule > pSaveNum
Definition: numpages.hxx:180
OUString sBulletFont
Definition: numpages.hxx:48
sal_uInt16 nActNumLvl
Definition: numpages.hxx:333
static void GetI18nNumbering(ListBox &rFmtLB, sal_uInt16 nDoNotRemove)
std::unique_ptr< weld::Label > m_xAlignFT
Definition: numpages.hxx:353
std::unique_ptr< weld::Label > m_xAlignedAtFT
Definition: numpages.hxx:363
const FontList * GetFontList() const
std::unique_ptr< ColorListBox > m_xBulColLB
Definition: numpages.hxx:251
void SetNumberingType(SvxNumType nSet)
sal_Int32 const nLength
std::unique_ptr< weld::CheckButton > m_xRatioCB
Definition: numpages.hxx:266
const Size & GetSizePixel() const
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: numpages.cxx:1174
std::unique_ptr< weld::MetricSpinButton > m_xAlignedAtMF
Definition: numpages.hxx:364
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
std::unique_ptr< weld::Label > m_xSeparatorFT
Definition: numpages.hxx:243
sal_Int32 nPos
std::unique_ptr< weld::MetricSpinButton > m_xWidthMF
Definition: numpages.hxx:263
void setWidth(long nWidth)
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
std::unique_ptr< NumValueSet > m_xExamplesVS
Definition: numpages.hxx:147
void SetBulletColor(Color nSet)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: numpages.cxx:1214
sal_uInt16 nNumItemId
Definition: numpages.hxx:236
sal_Int16 GetVertOrient() const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: numpages.cxx:859
SAL_DLLPRIVATE void DrawOutDev(const Point &, const Size &, const Point &, const Size &, const Printer &)=delete
const SvxNumRule * pActNum
const Color & GetFillColor() const
virtual void Reset(const SfxItemSet *rSet) override
Definition: numpages.cxx:287
sal_uInt16 GetValue() const