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