1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
28 #include <editeng/lrspitem.hxx>
29 #include <tabstpge.hxx>
30 #include <svx/dlgutil.hxx>
31 #include <sfx2/module.hxx>
32 #include <svl/cjkoptions.hxx>
33 #include <unotools/localedatawrapper.hxx>
34 #include <sfx2/request.hxx>
35 #include <svl/intitem.hxx>
37 constexpr FieldUnit eDefUnit
= FieldUnit::MM_100TH
;
39 const sal_uInt16
SvxTabulatorTabPage::pRanges
[] =
42 SID_ATTR_TABSTOP_OFFSET
,
46 static void FillUpWithDefTabs_Impl( long nDefDist
, SvxTabStopItem
& rTabs
)
51 SvxTabStop
aSwTabStop( nDefDist
, SvxTabAdjust::Default
);
52 rTabs
.Insert( aSwTabStop
);
56 void TabWin_Impl::Paint(vcl::RenderContext
& rRenderContext
, const ::tools::Rectangle
&)
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
);
66 SvxTabulatorTabPage::SvxTabulatorTabPage(TabPageParent pParent
, const SfxItemSet
& rAttr
)
67 : SfxTabPage(pParent
, "cui/ui/paratabspage.ui", "ParagraphTabsPage", &rAttr
)
69 , aNewTabs(std::make_unique
<SvxTabStopItem
>(0, 0, SvxTabAdjust::Left
, GetWhich(SID_ATTR_TABSTOP
)))
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"))
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"))
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
))
96 m_aLeftWin
.SetTabStyle(sal_uInt16(RULER_TAB_LEFT
|WB_HORZ
));
97 m_aRightWin
.SetTabStyle(sal_uInt16(RULER_TAB_RIGHT
|WB_HORZ
));
98 m_aCenterWin
.SetTabStyle(sal_uInt16(RULER_TAB_CENTER
|WB_HORZ
));
99 m_aDezWin
.SetTabStyle(sal_uInt16(RULER_TAB_DECIMAL
|WB_HORZ
));
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");
107 // This page needs ExchangeSupport
108 SetExchangeSupport();
111 FieldUnit eFUnit
= GetModuleFieldUnit( rAttr
);
112 SetFieldUnit(*m_xTabSpin
, eFUnit
);
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
));
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
);
125 m_xDezChar
->connect_focus_out(LINK(this, SvxTabulatorTabPage
, GetDezCharHdl_Impl
));
126 m_xDezChar
->set_sensitive(false);
127 m_xDezCharLabel
->set_sensitive(false);
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);
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
));
142 // Get the default decimal char from the system
143 const LocaleDataWrapper
& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
144 aCurrentTab
.GetDecimal() = rLocaleWrapper
.getNumDecimalSep()[0];
147 SvxTabulatorTabPage::~SvxTabulatorTabPage()
152 void SvxTabulatorTabPage::dispose()
155 m_xCenterWin
.reset();
161 SfxTabPage::dispose();
164 bool SvxTabulatorTabPage::FillItemSet(SfxItemSet
* rSet
)
166 bool bModified
= false;
168 // Put the controls' values in here
169 if (m_xNewBtn
->get_sensitive())
170 NewHdl_Impl(nullptr);
172 // Call the LoseFocus-Handler first
173 GetDezCharHdl_Impl(*m_xDezChar
);
174 GetFillCharHdl_Impl(*m_xFillChar
);
176 FillUpWithDefTabs_Impl(nDefDist
, *aNewTabs
);
177 SfxItemPool
* pPool
= rSet
->GetPool();
178 MapUnit eUnit
= pPool
->GetMetric(GetWhich(SID_ATTR_TABSTOP
));
179 const SfxPoolItem
* pOld
= GetOldItem(*rSet
, SID_ATTR_TABSTOP
);
181 if (MapUnit::Map100thMM
!= eUnit
)
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
);
190 if (pLRSpace
&& static_cast<const SvxLRSpaceItem
*>(pLRSpace
)->GetTextFirstLineOfst() < 0)
192 SvxTabStop
aNull(0, SvxTabAdjust::Default
);
193 aNewTabs
->Insert(aNull
);
196 std::unique_ptr
<SvxTabStopItem
> aTmp(static_cast<SvxTabStopItem
*>(aNewTabs
->Clone()));
197 aTmp
->Remove(0, aTmp
->Count());
199 for (sal_uInt16 i
= 0; i
< aNewTabs
->Count(); ++i
)
201 SvxTabStop aTmpStop
= (*aNewTabs
)[i
];
202 aTmpStop
.GetTabPos() = LogicToLogic(aTmpStop
.GetTabPos(), MapUnit::Map100thMM
, eUnit
);
203 aTmp
->Insert(aTmpStop
);
206 if (!pOld
|| *static_cast<const SvxTabStopItem
*>(pOld
) != *aTmp
)
212 else if (!pOld
|| *static_cast<const SvxTabStopItem
*>(pOld
) != *aNewTabs
)
214 rSet
->Put(*aNewTabs
);
221 VclPtr
<SfxTabPage
> SvxTabulatorTabPage::Create(TabPageParent pParent
, const SfxItemSet
* rSet
)
223 return VclPtr
<SvxTabulatorTabPage
>::Create(pParent
, *rSet
);
226 void SvxTabulatorTabPage::Reset(const SfxItemSet
* rSet
)
228 SfxItemPool
* pPool
= rSet
->GetPool();
229 MapUnit eUnit
= pPool
->GetMetric(GetWhich(SID_ATTR_TABSTOP
));
232 const SfxPoolItem
* pItem
= GetItem(*rSet
, SID_ATTR_TABSTOP
);
236 if (MapUnit::Map100thMM
!= eUnit
)
238 std::unique_ptr
<SvxTabStopItem
> aTmp(static_cast<SvxTabStopItem
*>(pItem
->Clone()));
239 aNewTabs
->Remove(0, aNewTabs
->Count());
241 for (sal_uInt16 i
= 0; i
< aTmp
->Count(); ++i
)
243 SvxTabStop aTmpStop
= (*aTmp
)[i
];
244 aTmpStop
.GetTabPos() = LogicToLogic(aTmpStop
.GetTabPos(), eUnit
, MapUnit::Map100thMM
);
245 aNewTabs
->Insert(aTmpStop
);
250 aNewTabs
.reset(static_cast<SvxTabStopItem
*>(pItem
->Clone()));
255 aNewTabs
->Remove(0, aNewTabs
->Count());
258 // Default tab distance
259 nDefDist
= SVX_TAB_DEFDIST
;
260 pItem
= GetItem(*rSet
, SID_ATTR_TABSTOP_DEFAULTS
);
263 nDefDist
= LogicToLogic(long(static_cast<const SfxUInt16Item
*>(pItem
)->GetValue()), eUnit
, MapUnit::Map100thMM
);
265 // Tab pos currently selected
266 sal_uInt16 nTabPos
= 0;
267 pItem
= GetItem(*rSet
, SID_ATTR_TABSTOP_POS
);
270 nTabPos
= static_cast<const SfxUInt16Item
*>(pItem
)->GetValue();
272 InitTabPos_Impl(nTabPos
);
275 void SvxTabulatorTabPage::DisableControls(const TabulatorDisableFlags nFlag
)
277 if (TabulatorDisableFlags::TypeLeft
& nFlag
)
279 m_xLeftTab
->set_sensitive(false);
280 m_xLeftWin
->set_sensitive(false);
282 if (TabulatorDisableFlags::TypeRight
& nFlag
)
284 m_xRightTab
->set_sensitive(false);
285 m_xRightWin
->set_sensitive(false);
287 if (TabulatorDisableFlags::TypeCenter
& nFlag
)
289 m_xCenterTab
->set_sensitive(false);
290 m_xCenterWin
->set_sensitive(false);
292 if (TabulatorDisableFlags::TypeDecimal
& nFlag
)
294 m_xDezTab
->set_sensitive(false);
295 m_xDezWin
->set_sensitive(false);
296 m_xDezCharLabel
->set_sensitive(false);
297 m_xDezChar
->set_sensitive(false);
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
)
311 m_xFillSpecial
->set_sensitive(false);
312 m_xFillChar
->set_sensitive(false);
314 if (TabulatorDisableFlags::FillMask
& nFlag
)
315 m_xFillFrame
->set_sensitive(false);
318 DeactivateRC
SvxTabulatorTabPage::DeactivatePage( SfxItemSet
* _pSet
)
321 FillItemSet( _pSet
);
322 return DeactivateRC::LeavePage
;
325 void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos
)
330 const SfxPoolItem
* pItem
= nullptr;
331 if (GetItemSet().GetItemState(SID_ATTR_TABSTOP_OFFSET
, true, &pItem
) == SfxItemState::SET
)
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
);
338 // Correct current TabPos and default tabs
339 for ( sal_uInt16 i
= 0; i
< aNewTabs
->Count(); i
++ )
341 if ( (*aNewTabs
)[i
].GetAdjustment() != SvxTabAdjust::Default
)
343 m_xTabSpin
->set_value(m_xTabSpin
->normalize((*aNewTabs
)[i
].GetTabPos() + nOffset
), eDefUnit
);
344 m_xTabBox
->append_text(m_xTabSpin
->get_text());
348 aNewTabs
->Remove( i
-- );
352 // Select current tabulator
353 const sal_uInt16 nSize
= aNewTabs
->Count();
355 if ( nTabPos
>= nSize
)
358 // Switch off all RadioButtons for a start
359 m_xLeftTab
->set_active(true);
360 m_xNoFillChar
->set_active(true);
362 if (m_xTabBox
->get_count() > 0)
364 m_xTabBox
->set_active(nTabPos
);
365 aCurrentTab
= (*aNewTabs
)[nTabPos
];
367 SetFillAndTabType_Impl();
368 m_xNewBtn
->set_sensitive(false);
369 m_xDelBtn
->set_sensitive(true);
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());
376 m_xNewBtn
->set_sensitive(true);
377 m_xDelBtn
->set_sensitive(false);
381 void SvxTabulatorTabPage::SetFillAndTabType_Impl()
383 weld::RadioButton
* pTypeBtn
= nullptr;
384 weld::RadioButton
* pFillBtn
= nullptr;
386 m_xDezChar
->set_sensitive(false);
387 m_xDezCharLabel
->set_sensitive(false);
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
)
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()));
400 else if ( aCurrentTab
.GetAdjustment() == SvxTabAdjust::Center
)
401 pTypeBtn
= m_xCenterTab
.get();
404 pTypeBtn
->set_active(true);
406 m_xFillChar
->set_sensitive(false);
407 m_xFillChar
->set_text("");
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();
419 pFillBtn
= m_xFillSpecial
.get();
420 m_xFillChar
->set_sensitive(true);
421 m_xFillChar
->set_text(OUString(aCurrentTab
.GetFill()));
423 pFillBtn
->set_active(true);
426 IMPL_LINK(SvxTabulatorTabPage
, NewHdl_Impl
, weld::Button
&, rBtn
, void)
431 void SvxTabulatorTabPage::NewHdl_Impl(const weld::Button
* pBtn
)
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
));
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)
444 const SfxPoolItem
* pItem
= nullptr;
446 if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET
, true, &pItem
) ==
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
);
453 const long nReal
= nVal
- nOffset
;
454 sal_Int32 nSize
= m_xTabBox
->get_count();
457 for( i
= 0; i
< nSize
; i
++ )
459 if ( nReal
< (*aNewTabs
)[i
].GetTabPos() )
463 // Make ListBox entry
464 m_xTabSpin
->set_value(m_xTabSpin
->normalize(nVal
), eDefUnit
);
465 m_xTabBox
->insert_text(i
, m_xTabSpin
->get_text());
467 aCurrentTab
.GetTabPos() = nReal
;
468 SvxTabAdjust eAdj
= SvxTabAdjust::Left
;
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
;
477 aCurrentTab
.GetAdjustment() = eAdj
;
478 aNewTabs
->Insert( aCurrentTab
);
480 m_xNewBtn
->set_sensitive(false);
481 m_xDelBtn
->set_sensitive(true);
482 m_xTabBox
->grab_focus();
484 // Set the selection into the position Edit
485 m_xTabBox
->select_entry_region(0, -1);
488 int SvxTabulatorTabPage::FindCurrentTab()
490 return m_xTabBox
->find_text(FormatTab());
493 IMPL_LINK_NOARG(SvxTabulatorTabPage
, DelHdl_Impl
, weld::Button
&, void)
495 int nPos
= FindCurrentTab();
499 if (m_xTabBox
->get_count() == 1)
501 DelAllHdl_Impl(*m_xDelAllBtn
);
506 m_xTabBox
->remove(nPos
);
507 aNewTabs
->Remove( nPos
);
510 const sal_uInt16 nSize
= aNewTabs
->Count();
515 nPos
= ( ( nSize
- 1 ) >= nPos
) ? nPos
: nPos
- 1;
516 m_xTabBox
->set_active(nPos
);
517 aCurrentTab
= (*aNewTabs
)[nPos
];
520 // If no Tabs Enable Disable Controls
521 if (m_xTabBox
->get_count() == 0)
523 m_xDelBtn
->set_sensitive(false);
524 m_xNewBtn
->set_sensitive(true);
525 m_xTabBox
->grab_focus();
529 IMPL_LINK_NOARG(SvxTabulatorTabPage
, DelAllHdl_Impl
, weld::Button
&, void)
531 if ( aNewTabs
->Count() )
533 aNewTabs
= std::make_unique
<SvxTabStopItem
>( 0 );
538 IMPL_LINK(SvxTabulatorTabPage
, TabTypeCheckHdl_Impl
, weld::ToggleButton
&, rBox
, void)
540 if (!rBox
.get_active())
544 m_xDezChar
->set_sensitive(false);
545 m_xDezCharLabel
->set_sensitive(false);
546 m_xDezChar
->set_text("");
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
;
556 eAdj
= SvxTabAdjust::Decimal
;
557 m_xDezChar
->set_sensitive(true);
558 m_xDezCharLabel
->set_sensitive(true);
559 m_xDezChar
->set_text(OUString(aCurrentTab
.GetDecimal()));
562 aCurrentTab
.GetAdjustment() = eAdj
;
563 int nPos
= FindCurrentTab();
566 aNewTabs
->Remove( nPos
);
567 aNewTabs
->Insert( aCurrentTab
);
571 IMPL_LINK(SvxTabulatorTabPage
, FillTypeCheckHdl_Impl
, weld::ToggleButton
&, rBox
, void)
573 if (!rBox
.get_active())
576 sal_uInt8 cFill
= ' ';
577 m_xFillChar
->set_text( "" );
578 m_xFillChar
->set_sensitive(false);
580 if (&rBox
== m_xFillSpecial
.get())
581 m_xFillChar
->set_sensitive(true);
582 else if (&rBox
== m_xNoFillChar
.get())
584 else if (&rBox
== m_xFillSolidLine
.get())
586 else if (&rBox
== m_xFillPoints
.get())
588 else if (&rBox
== m_xFillDashLine
.get())
591 aCurrentTab
.GetFill() = cFill
;
592 int nPos
= FindCurrentTab();
595 aNewTabs
->Remove( nPos
);
596 aNewTabs
->Insert( aCurrentTab
);
600 IMPL_LINK_NOARG(SvxTabulatorTabPage
, GetFillCharHdl_Impl
, weld::Widget
&, void)
602 OUString
aChar(m_xFillChar
->get_text());
603 if ( !aChar
.isEmpty() )
604 aCurrentTab
.GetFill() = aChar
[0];
606 const int nPos
= FindCurrentTab();
609 aNewTabs
->Remove( nPos
);
610 aNewTabs
->Insert( aCurrentTab
);
614 IMPL_LINK_NOARG(SvxTabulatorTabPage
, GetDezCharHdl_Impl
, weld::Widget
&, void)
616 OUString
aChar(m_xDezChar
->get_text());
617 if ( !aChar
.isEmpty() && ( aChar
[0] >= ' '))
618 aCurrentTab
.GetDecimal() = aChar
[0];
620 const int nPos
= FindCurrentTab();
623 aNewTabs
->Remove( nPos
);
624 aNewTabs
->Insert( aCurrentTab
);
628 IMPL_LINK_NOARG(SvxTabulatorTabPage
, SelectHdl_Impl
, weld::TreeView
&, void)
630 const int nPos
= FindCurrentTab();
633 aCurrentTab
= (*aNewTabs
)[nPos
];
634 m_xNewBtn
->set_sensitive(false);
635 SetFillAndTabType_Impl();
639 OUString
SvxTabulatorTabPage::FormatTab()
641 m_xTabSpin
->set_text(m_xTabBox
->get_active_text());
642 m_xTabSpin
->reformat();
643 return m_xTabSpin
->get_text();
646 IMPL_LINK_NOARG(SvxTabulatorTabPage
, ReformatHdl_Impl
, weld::Widget
&, void)
648 m_xTabBox
->set_entry_text(FormatTab());
651 IMPL_LINK_NOARG(SvxTabulatorTabPage
, ModifyHdl_Impl
, weld::ComboBox
&, void)
653 const int nPos
= FindCurrentTab();
656 aCurrentTab
= (*aNewTabs
)[nPos
];
657 SetFillAndTabType_Impl();
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);
665 m_xNewBtn
->set_sensitive(true);
666 m_xDelBtn
->set_sensitive(false);
669 void SvxTabulatorTabPage::PageCreated(const SfxAllItemSet
& aSet
)
671 const SfxUInt16Item
* pControlItem
= aSet
.GetItem
<SfxUInt16Item
>(SID_SVXTABULATORTABPAGE_DISABLEFLAGS
, false);
673 DisableControls(static_cast<TabulatorDisableFlags
>(pControlItem
->GetValue()));
676 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */