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