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