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 
36  svl::Items<SID_ATTR_TABSTOP, SID_ATTR_TABSTOP_OFFSET>);
37 
38 static 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 
48 void 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(*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 
206 std::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 
310 void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos )
311 {
312  m_xTabBox->clear();
313 
314  tools::Long nOffset = 0;
315  const SfxPoolItem* pItem = nullptr;
316  if (GetItemSet().GetItemState(SID_ATTR_TABSTOP_OFFSET, true, &pItem) == SfxItemState::SET)
317  {
318  nOffset = static_cast<const SfxInt32Item*>(pItem)->GetValue();
319  MapUnit eUnit = GetItemSet().GetPool()->GetMetric(GetWhich(SID_ATTR_TABSTOP));
320  nOffset = OutputDevice::LogicToLogic(nOffset, eUnit, MapUnit::Map100thMM);
321  }
322 
323  // Correct current TabPos and default tabs
324  for ( sal_uInt16 i = 0; i < aNewTabs->Count(); i++ )
325  {
326  if ( (*aNewTabs)[i].GetAdjustment() != SvxTabAdjust::Default )
327  {
328  m_xTabSpin->set_value(m_xTabSpin->normalize((*aNewTabs)[i].GetTabPos() + nOffset ), eDefUnit);
329  m_xTabBox->append_text(m_xTabSpin->get_text());
330  }
331  else
332  {
333  aNewTabs->Remove( i-- );
334  }
335  }
336 
337  // Select current tabulator
338  const sal_uInt16 nSize = aNewTabs->Count();
339 
340  if ( nTabPos >= nSize )
341  nTabPos = 0;
342 
343  // Switch off all RadioButtons for a start
344  m_xLeftTab->set_active(true);
345  m_xNoFillChar->set_active(true);
346 
347  if (m_xTabBox->get_count() > 0)
348  {
349  m_xTabBox->set_active(nTabPos);
350  aCurrentTab = (*aNewTabs)[nTabPos];
351 
353  m_xNewBtn->set_sensitive(false);
354  m_xDelBtn->set_sensitive(true);
355  }
356  else
357  { // If no entry, 0 is the default value
358  m_xTabSpin->set_value(0, eDefUnit);
359  m_xTabBox->set_entry_text(m_xTabSpin->get_text());
360 
361  m_xNewBtn->set_sensitive(true);
362  m_xDelBtn->set_sensitive(false);
363  }
364 }
365 
367 {
368  weld::RadioButton* pTypeBtn = nullptr;
369  weld::RadioButton* pFillBtn = nullptr;
370 
371  m_xDezChar->set_sensitive(false);
372  m_xDezCharLabel->set_sensitive(false);
373 
374  if ( aCurrentTab.GetAdjustment() == SvxTabAdjust::Left )
375  pTypeBtn = m_xLeftTab.get();
376  else if ( aCurrentTab.GetAdjustment() == SvxTabAdjust::Right )
377  pTypeBtn = m_xRightTab.get();
378  else if ( aCurrentTab.GetAdjustment() == SvxTabAdjust::Decimal )
379  {
380  pTypeBtn = m_xDezTab.get();
381  m_xDezChar->set_sensitive(true);
382  m_xDezCharLabel->set_sensitive(true);
383  m_xDezChar->set_text(OUString(aCurrentTab.GetDecimal()));
384  }
385  else if ( aCurrentTab.GetAdjustment() == SvxTabAdjust::Center )
386  pTypeBtn = m_xCenterTab.get();
387 
388  if (pTypeBtn)
389  pTypeBtn->set_active(true);
390 
391  m_xFillChar->set_sensitive(false);
392  m_xFillChar->set_text("");
393 
394  if ( aCurrentTab.GetFill() == ' ' )
395  pFillBtn = m_xNoFillChar.get();
396  else if ( aCurrentTab.GetFill() == '-' )
397  pFillBtn = m_xFillDashLine.get();
398  else if ( aCurrentTab.GetFill() == '_' )
399  pFillBtn = m_xFillSolidLine.get();
400  else if ( aCurrentTab.GetFill() == '.' )
401  pFillBtn = m_xFillPoints.get();
402  else
403  {
404  pFillBtn = m_xFillSpecial.get();
405  m_xFillChar->set_sensitive(true);
406  m_xFillChar->set_text(OUString(aCurrentTab.GetFill()));
407  }
408  pFillBtn->set_active(true);
409 }
410 
411 IMPL_LINK(SvxTabulatorTabPage, NewHdl_Impl, weld::Button&, rBtn, void)
412 {
413  NewHdl_Impl(&rBtn);
414 }
415 
417 {
418  // Add a new one and select it
419  // Get the value from the display
420  ReformatHdl_Impl(*m_xTabBox);
421  m_xTabSpin->set_text(m_xTabBox->get_active_text());
422  auto nVal = m_xTabSpin->denormalize(m_xTabSpin->get_value(eDefUnit));
423 
424  // If the pBtn == 0 && the value == 0 then do not create a tab, because we create via OK
425  if (nVal == 0 && pBtn == nullptr)
426  return;
427 
428  tools::Long nOffset = 0;
429  const SfxPoolItem* pItem = nullptr;
430 
431  if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, true, &pItem ) ==
432  SfxItemState::SET )
433  {
434  nOffset = static_cast<const SfxInt32Item*>(pItem)->GetValue();
435  MapUnit eUnit = GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
436  nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MapUnit::Map100thMM );
437  }
438  const tools::Long nReal = nVal - nOffset;
439  sal_Int32 nSize = m_xTabBox->get_count();
440 
441  sal_Int32 i;
442  for( i = 0; i < nSize; i++ )
443  {
444  if ( nReal < (*aNewTabs)[i].GetTabPos() )
445  break;
446  }
447 
448  // Make ListBox entry
449  m_xTabSpin->set_value(m_xTabSpin->normalize(nVal), eDefUnit);
450  m_xTabBox->insert_text(i, m_xTabSpin->get_text());
451 
452  aCurrentTab.GetTabPos() = nReal;
453  SvxTabAdjust eAdj = SvxTabAdjust::Left;
454 
455  if (m_xRightTab->get_active())
456  eAdj = SvxTabAdjust::Right;
457  else if (m_xCenterTab->get_active())
458  eAdj = SvxTabAdjust::Center;
459  else if (m_xDezTab->get_active())
460  eAdj = SvxTabAdjust::Decimal;
461 
462  aCurrentTab.GetAdjustment() = eAdj;
463  aNewTabs->Insert( aCurrentTab );
464 
465  m_xNewBtn->set_sensitive(false);
466  m_xDelBtn->set_sensitive(true);
467  m_xTabBox->grab_focus();
468 
469  // Set the selection into the position Edit
470  m_xTabBox->select_entry_region(0, -1);
471 }
472 
474 {
475  return m_xTabBox->find_text(FormatTab());
476 }
477 
479 {
480  int nPos = FindCurrentTab();
481  if (nPos == -1)
482  return;
483 
484  if (m_xTabBox->get_count() == 1)
485  {
486  DelAllHdl_Impl(*m_xDelAllBtn);
487  return;
488  }
489 
490  // Delete Tab
491  m_xTabBox->remove(nPos);
492  aNewTabs->Remove( nPos );
493 
494  // Reset aCurrentTab
495  const sal_uInt16 nSize = aNewTabs->Count();
496 
497  if ( nSize > 0 )
498  {
499  // Correct Pos
500  nPos = ( ( nSize - 1 ) >= nPos) ? nPos : nPos - 1;
501  m_xTabBox->set_active(nPos);
502  aCurrentTab = (*aNewTabs)[nPos];
503  }
504 
505  // If no Tabs Enable Disable Controls
506  if (m_xTabBox->get_count() == 0)
507  {
508  m_xDelBtn->set_sensitive(false);
509  m_xNewBtn->set_sensitive(true);
510  m_xTabBox->grab_focus();
511  }
512 }
513 
515 {
516  if ( aNewTabs->Count() )
517  {
518  aNewTabs = std::make_unique<SvxTabStopItem>(GetWhich(SID_ATTR_TABSTOP));
519  InitTabPos_Impl();
520  }
521 }
522 
523 IMPL_LINK(SvxTabulatorTabPage, TabTypeCheckHdl_Impl, weld::Toggleable&, rBox, void)
524 {
525  if (!rBox.get_active())
526  return;
527 
528  SvxTabAdjust eAdj;
529  m_xDezChar->set_sensitive(false);
530  m_xDezCharLabel->set_sensitive(false);
531  m_xDezChar->set_text("");
532 
533  if (&rBox == m_xLeftTab.get())
534  eAdj = SvxTabAdjust::Left;
535  else if (&rBox == m_xRightTab.get())
536  eAdj = SvxTabAdjust::Right;
537  else if (&rBox == m_xCenterTab.get())
538  eAdj = SvxTabAdjust::Center;
539  else
540  {
541  eAdj = SvxTabAdjust::Decimal;
542  m_xDezChar->set_sensitive(true);
543  m_xDezCharLabel->set_sensitive(true);
544  m_xDezChar->set_text(OUString(aCurrentTab.GetDecimal()));
545  }
546 
547  aCurrentTab.GetAdjustment() = eAdj;
548  int nPos = FindCurrentTab();
549  if (nPos != -1)
550  {
551  aNewTabs->Remove( nPos );
552  aNewTabs->Insert( aCurrentTab );
553  }
554 }
555 
556 IMPL_LINK(SvxTabulatorTabPage, FillTypeCheckHdl_Impl, weld::Toggleable&, rBox, void)
557 {
558  if (!rBox.get_active())
559  return;
560 
561  sal_uInt8 cFill = ' ';
562  m_xFillChar->set_text( "" );
563  m_xFillChar->set_sensitive(false);
564 
565  if (&rBox == m_xFillSpecial.get())
566  m_xFillChar->set_sensitive(true);
567  else if (&rBox == m_xNoFillChar.get())
568  cFill = ' ';
569  else if (&rBox == m_xFillSolidLine.get())
570  cFill = '_';
571  else if (&rBox == m_xFillPoints.get())
572  cFill = '.';
573  else if (&rBox == m_xFillDashLine.get())
574  cFill = '-';
575 
576  aCurrentTab.GetFill() = cFill;
577  int nPos = FindCurrentTab();
578  if (nPos != -1)
579  {
580  aNewTabs->Remove( nPos );
581  aNewTabs->Insert( aCurrentTab );
582  }
583 }
584 
585 IMPL_LINK_NOARG(SvxTabulatorTabPage, GetFillCharHdl_Impl, weld::Widget&, void)
586 {
587  OUString aChar(m_xFillChar->get_text());
588  if ( !aChar.isEmpty() )
589  aCurrentTab.GetFill() = aChar[0];
590 
591  const int nPos = FindCurrentTab();
592  if (nPos != -1)
593  {
594  aNewTabs->Remove( nPos );
595  aNewTabs->Insert( aCurrentTab );
596  }
597 }
598 
600 {
601  OUString aChar(m_xDezChar->get_text());
602  if ( !aChar.isEmpty() && ( aChar[0] >= ' '))
603  aCurrentTab.GetDecimal() = aChar[0];
604 
605  const int nPos = FindCurrentTab();
606  if (nPos != -1)
607  {
608  aNewTabs->Remove( nPos );
609  aNewTabs->Insert( aCurrentTab );
610  }
611 }
612 
614 {
615  const int nPos = FindCurrentTab();
616  if (nPos != -1)
617  {
618  aCurrentTab = (*aNewTabs)[nPos];
619  m_xNewBtn->set_sensitive(false);
620  SetFillAndTabType_Impl();
621  }
622  return true;
623 }
624 
626 {
627  m_xTabSpin->set_text(m_xTabBox->get_active_text());
628  m_xTabSpin->reformat();
629  return m_xTabSpin->get_text();
630 }
631 
633 {
634  m_xTabBox->set_entry_text(FormatTab());
635 }
636 
638 {
639  const int nPos = FindCurrentTab();
640  if (nPos != -1)
641  {
642  aCurrentTab = (*aNewTabs)[nPos];
643  SetFillAndTabType_Impl();
644 
645  m_xTabSpin->set_text(m_xTabBox->get_active_text());
646  aCurrentTab.GetTabPos() = m_xTabSpin->denormalize(m_xTabSpin->get_value(eDefUnit));
647  m_xNewBtn->set_sensitive(false);
648  m_xDelBtn->set_sensitive(true);
649  return;
650  }
651  m_xNewBtn->set_sensitive(true);
652  m_xDelBtn->set_sensitive(false);
653 }
654 
656 {
657  const SfxUInt16Item* pControlItem = aSet.GetItem<SfxUInt16Item>(SID_SVXTABULATORTABPAGE_DISABLEFLAGS, false);
658  if (pControlItem)
659  DisableControls(static_cast<TabulatorDisableFlags>(pControlItem->GetValue()));
660 }
661 
662 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
TabWin_Impl m_aCenterWin
Definition: tabstpge.hxx:86
bool Insert(const SvxTabStop &rTab)
FieldUnit
sal_uInt16 Count() const
TabulatorDisableFlags
virtual ~SvxTabulatorTabPage() override
Definition: tabstpge.cxx:138
SAL_WARN_UNUSED_RESULT 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:58
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
long Long
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
void SetFillAndTabType_Impl()
Definition: tabstpge.cxx:366
sal_uInt16 GetValue() const
std::unique_ptr< weld::RadioButton > m_xFillPoints
Definition: tabstpge.hxx:103
std::unique_ptr< weld::EntryTreeView > m_xTabBox
Definition: tabstpge.hxx:92
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: tabstpge.cxx:655
std::unique_ptr< SvxTabStopItem > aNewTabs
Definition: tabstpge.hxx:81
std::unique_ptr< weld::CustomWeld > m_xCenterWin
Definition: tabstpge.hxx:118
constexpr sal_uInt16 RULER_TAB_RIGHT
constexpr sal_uInt16 RULER_TAB_DECIMAL
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tabstpge.cxx:303
void DisableControls(const TabulatorDisableFlags nFlag)
Definition: tabstpge.cxx:260
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:94
constexpr FieldUnit eDefUnit
Definition: tabstpge.cxx:33
constexpr tools::Long Width() const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
void InitTabPos_Impl(sal_uInt16 nPos=0)
Definition: tabstpge.cxx:310
OUString FormatTab()
Definition: tabstpge.cxx:625
std::unique_ptr< weld::Entry > m_xDezChar
Definition: tabstpge.hxx:99
std::unique_ptr< weld::Button > m_xDelAllBtn
Definition: tabstpge.hxx:110
std::unique_ptr< weld::MetricSpinButton > m_xTabSpin
Definition: tabstpge.hxx:90
IMPL_LINK_NOARG(SvxTabulatorTabPage, DelHdl_Impl, weld::Button &, void)
Definition: tabstpge.cxx:478
void SetExchangeSupport()
sal_Int32 & GetTabPos()
TabWin_Impl m_aLeftWin
Definition: tabstpge.hxx:84
sal_Unicode & GetDecimal()
std::unique_ptr< weld::RadioButton > m_xFillDashLine
Definition: tabstpge.hxx:104
IMPL_LINK(SvxTabulatorTabPage, NewHdl_Impl, weld::Button &, rBtn, void)
Definition: tabstpge.cxx:411
constexpr sal_uInt16 RULER_TAB_CENTER
static void FillUpWithDefTabs_Impl(tools::Long nDefDist, SvxTabStopItem &rTabs)
Definition: tabstpge.cxx:38
std::unique_ptr< weld::CustomWeld > m_xRightWin
Definition: tabstpge.hxx:117
SvxTabAdjust & GetAdjustment()
const SfxItemSet & GetItemSet() const
std::unique_ptr< weld::RadioButton > m_xRightTab
Definition: tabstpge.hxx:95
tools::Long nDefDist
Definition: tabstpge.hxx:82
virtual tools::Long GetValue() const override
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
const OUString & getNumDecimalSep() const
TabWin_Impl m_aDezWin
Definition: tabstpge.hxx:87
std::unique_ptr< weld::RadioButton > m_xNoFillChar
Definition: tabstpge.hxx:102
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
std::unique_ptr< weld::Label > m_xDezCharLabel
Definition: tabstpge.hxx:100
void NewHdl_Impl(const weld::Button *)
Definition: tabstpge.cxx:416
std::unique_ptr< weld::RadioButton > m_xFillSpecial
Definition: tabstpge.hxx:106
std::unique_ptr< weld::RadioButton > m_xCenterTab
Definition: tabstpge.hxx:96
virtual void set_active(bool active)=0
const Color & GetFontColor() const
bool IsAsianTypographyEnabled()
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
const AllSettings & GetSettings() const
std::unique_ptr< weld::RadioButton > m_xDezTab
Definition: tabstpge.hxx:97
std::unique_ptr< weld::CustomWeld > m_xDezWin
Definition: tabstpge.hxx:119
SfxItemPool * GetPool() const
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: tabstpge.cxx:206
std::unique_ptr< weld::Container > m_xFillFrame
Definition: tabstpge.hxx:114
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< weld::RadioButton > m_xFillSolidLine
Definition: tabstpge.hxx:105
std::unique_ptr< weld::Container > m_xTypeFrame
Definition: tabstpge.hxx:113
TabWin_Impl m_aRightWin
Definition: tabstpge.hxx:85
std::unique_ptr< weld::Entry > m_xFillChar
Definition: tabstpge.hxx:107
sal_Unicode & GetFill()
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: tabstpge.cxx:48
constexpr tools::Long Height() const
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 const WhichRangesContainer pRanges
Definition: tabstpge.hxx:61
DeactivateRC
std::unique_ptr< weld::Button > m_xDelBtn
Definition: tabstpge.hxx:111
std::unique_ptr< weld::CustomWeld > m_xLeftWin
Definition: tabstpge.hxx:116
virtual void Reset(const SfxItemSet *rSet) override
Definition: tabstpge.cxx:211
MapUnit
Left
constexpr sal_uInt16 RULER_TAB_LEFT
void SetTabStyle(sal_uInt16 nStyle)
Definition: tabstpge.hxx:44
std::unique_ptr< weld::Button > m_xNewBtn
Definition: tabstpge.hxx:109
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
WinBits const WB_HORZ
sal_uInt16 nTabStyle
Definition: tabstpge.hxx:35
sal_uInt16 nPos
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
SvxTabStop aCurrentTab
Definition: tabstpge.hxx:80
SvxTabAdjust
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: tabstpge.cxx:149