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