LibreOffice Module cui (master) 1
tabstpge.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 <svtools/ruler.hxx>
21#include <svtools/unitconv.hxx>
22#include <svx/svxids.hrc>
23#include <vcl/settings.hxx>
24#include <vcl/svapp.hxx>
25
26#include <editeng/lrspitem.hxx>
27#include <tabstpge.hxx>
28#include <svx/dlgutil.hxx>
29#include <svl/cjkoptions.hxx>
31#include <svl/intitem.hxx>
32
33constexpr FieldUnit eDefUnit = FieldUnit::MM_100TH;
34
36 svl::Items<SID_ATTR_TABSTOP, SID_ATTR_TABSTOP_OFFSET>);
37
38static void FillUpWithDefTabs_Impl( tools::Long nDefDist, SvxTabStopItem& rTabs )
39{
40 if( rTabs.Count() )
41 return;
42 {
43 SvxTabStop aSwTabStop( nDefDist, SvxTabAdjust::Default );
44 rTabs.Insert( aSwTabStop );
45 }
46}
47
48void TabWin_Impl::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
49{
50 // Paint tabulators
51 Point aPoint;
52 Size aSize(GetOutputSizePixel());
53 aPoint.setX( aSize.Width() / 2 );
54 aPoint.setY( aSize.Height() / 2 );
55 Ruler::DrawTab(rRenderContext, rRenderContext.GetSettings().GetStyleSettings().GetFontColor(), aPoint, nTabStyle);
56}
57
59 : SfxTabPage(pPage, pController, "cui/ui/paratabspage.ui", "ParagraphTabsPage", &rAttr)
60 , aCurrentTab(0)
61 , aNewTabs(std::make_unique<SvxTabStopItem>(0, 0, SvxTabAdjust::Left, GetWhich(SID_ATTR_TABSTOP)))
62 , nDefDist(0)
63 , m_xTabSpin(m_xBuilder->weld_metric_spin_button("SP_TABPOS", FieldUnit::CM))
64 , m_xTabBox(m_xBuilder->weld_entry_tree_view("tabgrid", "ED_TABPOS", "LB_TABPOS"))
65 , m_xCenterTab(m_xBuilder->weld_radio_button("radiobuttonBTN_TABTYPE_CENTER"))
66 , m_xDezTab(m_xBuilder->weld_radio_button("radiobuttonBTN_TABTYPE_DECIMAL"))
67 , m_xDezChar(m_xBuilder->weld_entry("entryED_TABTYPE_DECCHAR"))
68 , m_xDezCharLabel(m_xBuilder->weld_label("labelFT_TABTYPE_DECCHAR"))
69 // lower radio buttons
70 , m_xNoFillChar(m_xBuilder->weld_radio_button("radiobuttonBTN_FILLCHAR_NO"))
71 , m_xFillPoints(m_xBuilder->weld_radio_button("radiobuttonBTN_FILLCHAR_POINTS"))
72 , m_xFillDashLine(m_xBuilder->weld_radio_button("radiobuttonBTN_FILLCHAR_DASHLINE"))
73 , m_xFillSolidLine(m_xBuilder->weld_radio_button("radiobuttonBTN_FILLCHAR_UNDERSCORE"))
74 , m_xFillSpecial(m_xBuilder->weld_radio_button("radiobuttonBTN_FILLCHAR_OTHER"))
75 , m_xFillChar(m_xBuilder->weld_entry("entryED_FILLCHAR_OTHER"))
76 // button bar
77 , m_xNewBtn(m_xBuilder->weld_button("buttonBTN_NEW"))
78 , m_xDelAllBtn(m_xBuilder->weld_button("buttonBTN_DELALL"))
79 , m_xDelBtn(m_xBuilder->weld_button("buttonBTN_DEL"))
80 , m_xTypeFrame(m_xBuilder->weld_container("frameFL_TABTYPE"))
81 , m_xFillFrame(m_xBuilder->weld_container("frameFL_FILLCHAR"))
82 // the tab images
83 , m_xLeftWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWIN_TABLEFT", m_aLeftWin))
84 , m_xRightWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWIN_TABRIGHT", m_aRightWin))
85 , m_xCenterWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWIN_TABCENTER", m_aCenterWin))
86 , m_xDezWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWIN_TABDECIMAL", m_aDezWin))
87{
92 //upper radiobuttons
93 m_xLeftTab = m_xBuilder->weld_radio_button(SvtCJKOptions::IsAsianTypographyEnabled() ? "radiobuttonST_LEFTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_LEFT");
94 m_xRightTab = m_xBuilder->weld_radio_button(SvtCJKOptions::IsAsianTypographyEnabled() ? "radiobuttonST_RIGHTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_RIGHT");
95 m_xLeftTab->show();
96 m_xRightTab->show();
97
98 // This page needs ExchangeSupport
100
101 // Set metric
102 FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
103 SetFieldUnit(*m_xTabSpin, eFUnit);
104
105 // Initialize buttons
106 m_xNewBtn->connect_clicked(LINK(this,SvxTabulatorTabPage, NewHdl_Impl));
107 m_xDelBtn->connect_clicked(LINK(this,SvxTabulatorTabPage, DelHdl_Impl));
108 m_xDelAllBtn->connect_clicked(LINK(this,SvxTabulatorTabPage, DelAllHdl_Impl));
109
110 Link<weld::Toggleable&,void> aLink = LINK(this, SvxTabulatorTabPage, TabTypeCheckHdl_Impl);
111 m_xLeftTab->connect_toggled(aLink);
112 m_xRightTab->connect_toggled(aLink);
113 m_xDezTab->connect_toggled(aLink);
114 m_xCenterTab->connect_toggled(aLink);
115
116 m_xDezChar->connect_focus_out(LINK(this, SvxTabulatorTabPage, GetDezCharHdl_Impl));
117 m_xDezChar->set_sensitive(false);
118 m_xDezCharLabel->set_sensitive(false);
119
120 aLink = LINK(this, SvxTabulatorTabPage, FillTypeCheckHdl_Impl);
121 m_xNoFillChar->connect_toggled(aLink);
122 m_xFillPoints->connect_toggled(aLink);
123 m_xFillDashLine->connect_toggled(aLink);
124 m_xFillSolidLine->connect_toggled(aLink);
125 m_xFillSpecial->connect_toggled(aLink);
126 m_xFillChar->connect_focus_out(LINK(this, SvxTabulatorTabPage, GetFillCharHdl_Impl));
127 m_xFillChar->set_sensitive(false);
128
129 m_xTabBox->connect_row_activated(LINK(this, SvxTabulatorTabPage, SelectHdl_Impl));
130 m_xTabBox->connect_changed(LINK(this, SvxTabulatorTabPage, ModifyHdl_Impl));
131 m_xTabBox->connect_focus_out(LINK(this, SvxTabulatorTabPage, ReformatHdl_Impl));
132
133 // Get the default decimal char from the system
135 aCurrentTab.GetDecimal() = rLocaleWrapper.getNumDecimalSep()[0];
136}
137
139{
140 m_xDezWin.reset();
141 m_xCenterWin.reset();
142 m_xRightWin.reset();
143 m_xLeftWin.reset();
144 m_xFillChar.reset();
145 m_xDezChar.reset();
146 m_xTabBox.reset();
147}
148
150{
151 bool bModified = false;
152
153 // Put the controls' values in here
154 if (m_xNewBtn->get_sensitive())
155 NewHdl_Impl(nullptr);
156
157 // Call the LoseFocus-Handler first
158 GetDezCharHdl_Impl(*m_xDezChar);
159 GetFillCharHdl_Impl(*m_xFillChar);
160
162 SfxItemPool* pPool = rSet->GetPool();
163 MapUnit eUnit = pPool->GetMetric(GetWhich(SID_ATTR_TABSTOP));
164 const SfxPoolItem* pOld = GetOldItem(*rSet, SID_ATTR_TABSTOP);
165
166 if (MapUnit::Map100thMM != eUnit)
167 {
168 // If the ItemSet contains a LRSpaceItem with negative first line indent,
169 // the TabStopItem needs to have a DefTab at position 0.
170 const SfxPoolItem* pLRSpace;
171 // If not in the new set, then maybe in the old one
172 if (SfxItemState::SET != rSet->GetItemState(GetWhich(SID_ATTR_LRSPACE), true, &pLRSpace))
173 pLRSpace = GetOldItem(*rSet, SID_ATTR_LRSPACE);
174
175 if (pLRSpace && static_cast<const SvxLRSpaceItem*>(pLRSpace)->GetTextFirstLineOffset() < 0)
176 {
177 SvxTabStop aNull(0, SvxTabAdjust::Default);
178 aNewTabs->Insert(aNull);
179 }
180
181 std::unique_ptr<SvxTabStopItem> aTmp(aNewTabs->Clone());
182 aTmp->Remove(0, aTmp->Count());
183
184 for (sal_uInt16 i = 0; i < aNewTabs->Count(); ++i)
185 {
186 SvxTabStop aTmpStop = (*aNewTabs)[i];
187 aTmpStop.GetTabPos() = OutputDevice::LogicToLogic(aTmpStop.GetTabPos(), MapUnit::Map100thMM, eUnit);
188 aTmp->Insert(aTmpStop);
189 }
190
191 if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != *aTmp)
192 {
193 rSet->Put(std::move(aTmp));
194 bModified = true;
195 }
196 }
197 else if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != *aNewTabs)
198 {
199 rSet->Put(*aNewTabs);
200 bModified = true;
201 }
202
203 return bModified;
204}
205
206std::unique_ptr<SfxTabPage> SvxTabulatorTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
207{
208 return std::make_unique<SvxTabulatorTabPage>(pPage, pController, *rSet);
209}
210
212{
213 SfxItemPool* pPool = rSet->GetPool();
214 MapUnit eUnit = pPool->GetMetric(GetWhich(SID_ATTR_TABSTOP));
215
216 // Current tabs
217 const SfxPoolItem* pItem = GetItem(*rSet, SID_ATTR_TABSTOP);
218
219 if (pItem)
220 {
221 if (MapUnit::Map100thMM != eUnit)
222 {
223 std::unique_ptr<SvxTabStopItem> aTmp(static_cast<SvxTabStopItem*>(pItem->Clone()));
224 aNewTabs->Remove(0, aNewTabs->Count());
225
226 for (sal_uInt16 i = 0; i < aTmp->Count(); ++i)
227 {
228 SvxTabStop aTmpStop = (*aTmp)[i];
229 aTmpStop.GetTabPos() = OutputDevice::LogicToLogic(aTmpStop.GetTabPos(), eUnit, MapUnit::Map100thMM);
230 aNewTabs->Insert(aTmpStop);
231 }
232 }
233 else
234 {
235 aNewTabs.reset(static_cast<SvxTabStopItem*>(pItem->Clone()));
236 }
237 }
238 else
239 {
240 aNewTabs->Remove(0, aNewTabs->Count());
241 }
242
243 // Default tab distance
245 pItem = GetItem(*rSet, SID_ATTR_TABSTOP_DEFAULTS);
246
247 if (pItem)
248 nDefDist = OutputDevice::LogicToLogic(tools::Long(static_cast<const SfxUInt16Item*>(pItem)->GetValue()), eUnit, MapUnit::Map100thMM);
249
250 // Tab pos currently selected
251 sal_uInt16 nTabPos = 0;
252 pItem = GetItem(*rSet, SID_ATTR_TABSTOP_POS);
253
254 if (pItem)
255 nTabPos = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
256
257 InitTabPos_Impl(nTabPos);
258}
259
261{
262 if (TabulatorDisableFlags::TypeLeft & nFlag)
263 {
264 m_xLeftTab->set_sensitive(false);
265 m_xLeftWin->set_sensitive(false);
266 }
267 if (TabulatorDisableFlags::TypeRight & nFlag)
268 {
269 m_xRightTab->set_sensitive(false);
270 m_xRightWin->set_sensitive(false);
271 }
272 if (TabulatorDisableFlags::TypeCenter & nFlag)
273 {
274 m_xCenterTab->set_sensitive(false);
275 m_xCenterWin->set_sensitive(false);
276 }
277 if (TabulatorDisableFlags::TypeDecimal & nFlag)
278 {
279 m_xDezTab->set_sensitive(false);
280 m_xDezWin->set_sensitive(false);
281 m_xDezCharLabel->set_sensitive(false);
282 m_xDezChar->set_sensitive(false);
283 }
284 if (TabulatorDisableFlags::TypeMask & nFlag)
285 m_xTypeFrame->set_sensitive(false);
286 if (TabulatorDisableFlags::FillNone & nFlag)
287 m_xNoFillChar->set_sensitive(false);
288 if (TabulatorDisableFlags::FillPoint & nFlag)
289 m_xFillPoints->set_sensitive(false);
290 if (TabulatorDisableFlags::FillDashLine & nFlag)
291 m_xFillDashLine->set_sensitive(false);
292 if (TabulatorDisableFlags::FillSolidLine & nFlag)
293 m_xFillSolidLine->set_sensitive(false);
294 if (TabulatorDisableFlags::FillSpecial & nFlag)
295 {
296 m_xFillSpecial->set_sensitive(false);
297 m_xFillChar->set_sensitive(false);
298 }
299 if (TabulatorDisableFlags::FillMask & nFlag)
300 m_xFillFrame->set_sensitive(false);
301}
302
304{
305 if ( _pSet )
306 FillItemSet( _pSet );
307 return DeactivateRC::LeavePage;
308}
309
310void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos )
311{
312 m_xTabBox->clear();
313
314 tools::Long nOffset = 0;
315 if (const SfxInt32Item* pOffSetItem = GetItemSet().GetItemIfSet(SID_ATTR_TABSTOP_OFFSET))
316 {
317 nOffset = pOffSetItem->GetValue();
318 MapUnit eUnit = GetItemSet().GetPool()->GetMetric(GetWhich(SID_ATTR_TABSTOP));
319 nOffset = OutputDevice::LogicToLogic(nOffset, eUnit, MapUnit::Map100thMM);
320 }
321
322 // Correct current TabPos and default tabs
323 for ( sal_uInt16 i = 0; i < aNewTabs->Count(); i++ )
324 {
325 if ( (*aNewTabs)[i].GetAdjustment() != SvxTabAdjust::Default )
326 {
327 m_xTabSpin->set_value(m_xTabSpin->normalize((*aNewTabs)[i].GetTabPos() + nOffset ), eDefUnit);
328 m_xTabBox->append_text(m_xTabSpin->get_text());
329 }
330 else
331 {
332 aNewTabs->Remove( i-- );
333 }
334 }
335
336 // Select current tabulator
337 const sal_uInt16 nSize = aNewTabs->Count();
338
339 if ( nTabPos >= nSize )
340 nTabPos = 0;
341
342 // Switch off all RadioButtons for a start
343 m_xLeftTab->set_active(true);
344 m_xNoFillChar->set_active(true);
345
346 if (m_xTabBox->get_count() > 0)
347 {
348 m_xTabBox->set_active(nTabPos);
349 aCurrentTab = (*aNewTabs)[nTabPos];
350
352 m_xNewBtn->set_sensitive(false);
353 m_xDelBtn->set_sensitive(true);
354 }
355 else
356 { // If no entry, 0 is the default value
357 m_xTabSpin->set_value(0, eDefUnit);
358 m_xTabBox->set_entry_text(m_xTabSpin->get_text());
359
360 m_xNewBtn->set_sensitive(true);
361 m_xDelBtn->set_sensitive(false);
362 }
363}
364
366{
367 weld::RadioButton* pTypeBtn = nullptr;
368 weld::RadioButton* pFillBtn = nullptr;
369
370 m_xDezChar->set_sensitive(false);
371 m_xDezCharLabel->set_sensitive(false);
372
373 if ( aCurrentTab.GetAdjustment() == SvxTabAdjust::Left )
374 pTypeBtn = m_xLeftTab.get();
375 else if ( aCurrentTab.GetAdjustment() == SvxTabAdjust::Right )
376 pTypeBtn = m_xRightTab.get();
377 else if ( aCurrentTab.GetAdjustment() == SvxTabAdjust::Decimal )
378 {
379 pTypeBtn = m_xDezTab.get();
380 m_xDezChar->set_sensitive(true);
381 m_xDezCharLabel->set_sensitive(true);
382 m_xDezChar->set_text(OUString(aCurrentTab.GetDecimal()));
383 }
384 else if ( aCurrentTab.GetAdjustment() == SvxTabAdjust::Center )
385 pTypeBtn = m_xCenterTab.get();
386
387 if (pTypeBtn)
388 pTypeBtn->set_active(true);
389
390 m_xFillChar->set_sensitive(false);
391 m_xFillChar->set_text("");
392
393 if ( aCurrentTab.GetFill() == ' ' )
394 pFillBtn = m_xNoFillChar.get();
395 else if ( aCurrentTab.GetFill() == '-' )
396 pFillBtn = m_xFillDashLine.get();
397 else if ( aCurrentTab.GetFill() == '_' )
398 pFillBtn = m_xFillSolidLine.get();
399 else if ( aCurrentTab.GetFill() == '.' )
400 pFillBtn = m_xFillPoints.get();
401 else
402 {
403 pFillBtn = m_xFillSpecial.get();
404 m_xFillChar->set_sensitive(true);
405 m_xFillChar->set_text(OUString(aCurrentTab.GetFill()));
406 }
407 pFillBtn->set_active(true);
408}
409
410IMPL_LINK(SvxTabulatorTabPage, NewHdl_Impl, weld::Button&, rBtn, void)
411{
412 NewHdl_Impl(&rBtn);
413}
414
416{
417 // Add a new one and select it
418 // Get the value from the display
419 ReformatHdl_Impl(*m_xTabBox);
420 m_xTabSpin->set_text(m_xTabBox->get_active_text());
421 auto nVal = m_xTabSpin->denormalize(m_xTabSpin->get_value(eDefUnit));
422
423 // If the pBtn == 0 && the value == 0 then do not create a tab, because we create via OK
424 if (nVal == 0 && pBtn == nullptr)
425 return;
426
427 tools::Long nOffset = 0;
428
429 if ( const SfxInt32Item* pOffsetItem = GetItemSet().GetItemIfSet( SID_ATTR_TABSTOP_OFFSET ) )
430 {
431 nOffset = pOffsetItem->GetValue();
432 MapUnit eUnit = GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
433 nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MapUnit::Map100thMM );
434 }
435 const tools::Long nReal = nVal - nOffset;
436 sal_Int32 nSize = m_xTabBox->get_count();
437
438 sal_Int32 i;
439 for( i = 0; i < nSize; i++ )
440 {
441 if ( nReal < (*aNewTabs)[i].GetTabPos() )
442 break;
443 }
444
445 // Make ListBox entry
446 m_xTabSpin->set_value(m_xTabSpin->normalize(nVal), eDefUnit);
447 m_xTabBox->insert_text(i, m_xTabSpin->get_text());
448
449 aCurrentTab.GetTabPos() = nReal;
450 SvxTabAdjust eAdj = SvxTabAdjust::Left;
451
452 if (m_xRightTab->get_active())
453 eAdj = SvxTabAdjust::Right;
454 else if (m_xCenterTab->get_active())
455 eAdj = SvxTabAdjust::Center;
456 else if (m_xDezTab->get_active())
457 eAdj = SvxTabAdjust::Decimal;
458
459 aCurrentTab.GetAdjustment() = eAdj;
460 aNewTabs->Insert( aCurrentTab );
461
462 m_xNewBtn->set_sensitive(false);
463 m_xDelBtn->set_sensitive(true);
464 m_xTabBox->grab_focus();
465
466 // Set the selection into the position Edit
467 m_xTabBox->select_entry_region(0, -1);
468}
469
471{
472 return m_xTabBox->find_text(FormatTab());
473}
474
476{
477 int nPos = FindCurrentTab();
478 if (nPos == -1)
479 return;
480
481 if (m_xTabBox->get_count() == 1)
482 {
483 DelAllHdl_Impl(*m_xDelAllBtn);
484 return;
485 }
486
487 // Delete Tab
488 m_xTabBox->remove(nPos);
489 aNewTabs->Remove( nPos );
490
491 // Reset aCurrentTab
492 const sal_uInt16 nSize = aNewTabs->Count();
493
494 if ( nSize > 0 )
495 {
496 // Correct Pos
497 nPos = ( ( nSize - 1 ) >= nPos) ? nPos : nPos - 1;
498 m_xTabBox->set_active(nPos);
499 aCurrentTab = (*aNewTabs)[nPos];
500 }
501
502 // If no Tabs Enable Disable Controls
503 if (m_xTabBox->get_count() == 0)
504 {
505 m_xDelBtn->set_sensitive(false);
506 m_xNewBtn->set_sensitive(true);
507 m_xTabBox->grab_focus();
508 }
509}
510
512{
513 if ( aNewTabs->Count() )
514 {
515 aNewTabs = std::make_unique<SvxTabStopItem>(GetWhich(SID_ATTR_TABSTOP));
516 InitTabPos_Impl();
517 }
518}
519
520IMPL_LINK(SvxTabulatorTabPage, TabTypeCheckHdl_Impl, weld::Toggleable&, rBox, void)
521{
522 if (!rBox.get_active())
523 return;
524
525 SvxTabAdjust eAdj;
526 m_xDezChar->set_sensitive(false);
527 m_xDezCharLabel->set_sensitive(false);
528 m_xDezChar->set_text("");
529
530 if (&rBox == m_xLeftTab.get())
531 eAdj = SvxTabAdjust::Left;
532 else if (&rBox == m_xRightTab.get())
533 eAdj = SvxTabAdjust::Right;
534 else if (&rBox == m_xCenterTab.get())
535 eAdj = SvxTabAdjust::Center;
536 else
537 {
538 eAdj = SvxTabAdjust::Decimal;
539 m_xDezChar->set_sensitive(true);
540 m_xDezCharLabel->set_sensitive(true);
541 m_xDezChar->set_text(OUString(aCurrentTab.GetDecimal()));
542 }
543
544 aCurrentTab.GetAdjustment() = eAdj;
545 int nPos = FindCurrentTab();
546 if (nPos != -1)
547 {
548 aNewTabs->Remove( nPos );
549 aNewTabs->Insert( aCurrentTab );
550 }
551}
552
553IMPL_LINK(SvxTabulatorTabPage, FillTypeCheckHdl_Impl, weld::Toggleable&, rBox, void)
554{
555 if (!rBox.get_active())
556 return;
557
558 sal_uInt8 cFill = ' ';
559 m_xFillChar->set_text( "" );
560 m_xFillChar->set_sensitive(false);
561
562 if (&rBox == m_xFillSpecial.get())
563 m_xFillChar->set_sensitive(true);
564 else if (&rBox == m_xNoFillChar.get())
565 cFill = ' ';
566 else if (&rBox == m_xFillSolidLine.get())
567 cFill = '_';
568 else if (&rBox == m_xFillPoints.get())
569 cFill = '.';
570 else if (&rBox == m_xFillDashLine.get())
571 cFill = '-';
572
573 aCurrentTab.GetFill() = cFill;
574 int nPos = FindCurrentTab();
575 if (nPos != -1)
576 {
577 aNewTabs->Remove( nPos );
578 aNewTabs->Insert( aCurrentTab );
579 }
580}
581
583{
584 OUString aChar(m_xFillChar->get_text());
585 if ( !aChar.isEmpty() )
586 aCurrentTab.GetFill() = aChar[0];
587
588 const int nPos = FindCurrentTab();
589 if (nPos != -1)
590 {
591 aNewTabs->Remove( nPos );
592 aNewTabs->Insert( aCurrentTab );
593 }
594}
595
597{
598 OUString aChar(m_xDezChar->get_text());
599 if ( !aChar.isEmpty() && ( aChar[0] >= ' '))
600 aCurrentTab.GetDecimal() = aChar[0];
601
602 const int nPos = FindCurrentTab();
603 if (nPos != -1)
604 {
605 aNewTabs->Remove( nPos );
606 aNewTabs->Insert( aCurrentTab );
607 }
608}
609
611{
612 const int nPos = FindCurrentTab();
613 if (nPos != -1)
614 {
615 aCurrentTab = (*aNewTabs)[nPos];
616 m_xNewBtn->set_sensitive(false);
617 SetFillAndTabType_Impl();
618 }
619 return true;
620}
621
623{
624 m_xTabSpin->set_text(m_xTabBox->get_active_text());
625 m_xTabSpin->reformat();
626 return m_xTabSpin->get_text();
627}
628
630{
631 m_xTabBox->set_entry_text(FormatTab());
632}
633
635{
636 const int nPos = FindCurrentTab();
637 if (nPos != -1)
638 {
639 aCurrentTab = (*aNewTabs)[nPos];
640 SetFillAndTabType_Impl();
641
642 m_xTabSpin->set_text(m_xTabBox->get_active_text());
643 aCurrentTab.GetTabPos() = m_xTabSpin->denormalize(m_xTabSpin->get_value(eDefUnit));
644 m_xNewBtn->set_sensitive(false);
645 m_xDelBtn->set_sensitive(true);
646 return;
647 }
648 m_xNewBtn->set_sensitive(true);
649 m_xDelBtn->set_sensitive(false);
650}
651
653{
654 const SfxUInt16Item* pControlItem = aSet.GetItem<SfxUInt16Item>(SID_SVXTABULATORTABPAGE_DISABLEFLAGS, false);
655 if (pControlItem)
656 DisableControls(static_cast<TabulatorDisableFlags>(pControlItem->GetValue()));
657}
658
659/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define GetWhich(nSlot)
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
sal_uInt16 GetValue() const
const OUString & getNumDecimalSep() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
const AllSettings & GetSettings() const
static void DrawTab(vcl::RenderContext &rRenderContext, const Color &rFillColor, const Point &rPos, sal_uInt16 nStyle)
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
SfxItemPool * GetPool() 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)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
const SfxItemSet & GetItemSet() const
void SetExchangeSupport()
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetFontColor() const
sal_uInt16 Count() const
bool Insert(const SvxTabStop &rTab)
sal_Unicode & GetFill()
sal_Int32 & GetTabPos()
sal_Unicode & GetDecimal()
SvxTabAdjust & GetAdjustment()
TabWin_Impl m_aRightWin
Definition: tabstpge.hxx:85
std::unique_ptr< weld::RadioButton > m_xLeftTab
Definition: tabstpge.hxx:94
void DisableControls(const TabulatorDisableFlags nFlag)
Definition: tabstpge.cxx:260
SvxTabulatorTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: tabstpge.cxx:58
std::unique_ptr< weld::RadioButton > m_xNoFillChar
Definition: tabstpge.hxx:102
OUString FormatTab()
Definition: tabstpge.cxx:622
std::unique_ptr< SvxTabStopItem > aNewTabs
Definition: tabstpge.hxx:81
std::unique_ptr< weld::RadioButton > m_xRightTab
Definition: tabstpge.hxx:95
std::unique_ptr< weld::Entry > m_xFillChar
Definition: tabstpge.hxx:107
std::unique_ptr< weld::CustomWeld > m_xCenterWin
Definition: tabstpge.hxx:118
std::unique_ptr< weld::Button > m_xDelBtn
Definition: tabstpge.hxx:111
std::unique_ptr< weld::Button > m_xDelAllBtn
Definition: tabstpge.hxx:110
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: tabstpge.cxx:149
void InitTabPos_Impl(sal_uInt16 nPos=0)
Definition: tabstpge.cxx:310
std::unique_ptr< weld::RadioButton > m_xFillSolidLine
Definition: tabstpge.hxx:105
tools::Long nDefDist
Definition: tabstpge.hxx:82
std::unique_ptr< weld::Label > m_xDezCharLabel
Definition: tabstpge.hxx:100
std::unique_ptr< weld::CustomWeld > m_xRightWin
Definition: tabstpge.hxx:117
virtual ~SvxTabulatorTabPage() override
Definition: tabstpge.cxx:138
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tabstpge.cxx:303
static const WhichRangesContainer pRanges
Definition: tabstpge.hxx:61
void NewHdl_Impl(const weld::Button *)
Definition: tabstpge.cxx:415
std::unique_ptr< weld::CustomWeld > m_xLeftWin
Definition: tabstpge.hxx:116
SvxTabStop aCurrentTab
Definition: tabstpge.hxx:80
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: tabstpge.cxx:652
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: tabstpge.cxx:206
std::unique_ptr< weld::MetricSpinButton > m_xTabSpin
Definition: tabstpge.hxx:90
TabWin_Impl m_aCenterWin
Definition: tabstpge.hxx:86
std::unique_ptr< weld::EntryTreeView > m_xTabBox
Definition: tabstpge.hxx:92
std::unique_ptr< weld::RadioButton > m_xFillDashLine
Definition: tabstpge.hxx:104
std::unique_ptr< weld::CustomWeld > m_xDezWin
Definition: tabstpge.hxx:119
virtual void Reset(const SfxItemSet *rSet) override
Definition: tabstpge.cxx:211
std::unique_ptr< weld::RadioButton > m_xCenterTab
Definition: tabstpge.hxx:96
TabWin_Impl m_aLeftWin
Definition: tabstpge.hxx:84
std::unique_ptr< weld::Container > m_xFillFrame
Definition: tabstpge.hxx:114
std::unique_ptr< weld::Entry > m_xDezChar
Definition: tabstpge.hxx:99
std::unique_ptr< weld::Button > m_xNewBtn
Definition: tabstpge.hxx:109
std::unique_ptr< weld::RadioButton > m_xFillSpecial
Definition: tabstpge.hxx:106
void SetFillAndTabType_Impl()
Definition: tabstpge.cxx:365
std::unique_ptr< weld::RadioButton > m_xFillPoints
Definition: tabstpge.hxx:103
std::unique_ptr< weld::Container > m_xTypeFrame
Definition: tabstpge.hxx:113
std::unique_ptr< weld::RadioButton > m_xDezTab
Definition: tabstpge.hxx:97
TabWin_Impl m_aDezWin
Definition: tabstpge.hxx:87
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: tabstpge.cxx:48
sal_uInt16 nTabStyle
Definition: tabstpge.hxx:35
void SetTabStyle(sal_uInt16 nStyle)
Definition: tabstpge.hxx:44
Size const & GetOutputSizePixel() const
virtual void set_active(bool active)=0
virtual tools::Long GetValue() const override
SVXCORE_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet &)
TabulatorDisableFlags
FieldUnit
sal_uInt16 nPos
MapUnit
bool IsAsianTypographyEnabled()
int i
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
long Long
constexpr sal_uInt16 RULER_TAB_CENTER
constexpr sal_uInt16 RULER_TAB_RIGHT
constexpr sal_uInt16 RULER_TAB_LEFT
constexpr sal_uInt16 RULER_TAB_DECIMAL
static SfxItemSet & rSet
SvxTabAdjust
DeactivateRC
IMPL_LINK(SvxTabulatorTabPage, NewHdl_Impl, weld::Button &, rBtn, void)
Definition: tabstpge.cxx:410
IMPL_LINK_NOARG(SvxTabulatorTabPage, DelHdl_Impl, weld::Button &, void)
Definition: tabstpge.cxx:475
constexpr FieldUnit eDefUnit
Definition: tabstpge.cxx:33
static void FillUpWithDefTabs_Impl(tools::Long nDefDist, SvxTabStopItem &rTabs)
Definition: tabstpge.cxx:38
Left
#define SVX_TAB_DEFDIST
unsigned char sal_uInt8
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)
WinBits const WB_HORZ