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