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