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