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 <svx/dialogs.hrc>
23 #include <vcl/settings.hxx>
24 #include <vcl/builderfactory.hxx>
27 #include <editeng/lrspitem.hxx>
28 #include "tabstpge.hxx"
29 #include <dialmgr.hxx>
30 #include "svx/dlgutil.hxx"
31 #include <sfx2/module.hxx>
32 #include <svl/cjkoptions.hxx>
33 #include <unotools/localedatawrapper.hxx>
34 #include <comphelper/processfactory.hxx>
35 #include <sfx2/request.hxx>
36 #include <svl/intitem.hxx>
38 // class TabWin_Impl -----------------------------------------------------
40 class TabWin_Impl
: public vcl::Window
42 VclPtr
<SvxTabulatorTabPage
> mpPage
;
48 TabWin_Impl(vcl::Window
* pParent
, WinBits nBits
)
49 : Window(pParent
, nBits
)
54 virtual ~TabWin_Impl() { disposeOnce(); }
55 virtual void dispose() SAL_OVERRIDE
{ mpPage
.clear(); vcl::Window::dispose(); }
57 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
59 void SetTabulatorTabPage(SvxTabulatorTabPage
* pPage
) { mpPage
= pPage
; }
60 void SetTabStyle(sal_uInt16 nStyle
) {nTabStyle
= nStyle
; }
63 VCL_BUILDER_FACTORY_ARGS(TabWin_Impl
, 0)
65 const sal_uInt16
SvxTabulatorTabPage::pRanges
[] =
68 SID_ATTR_TABSTOP_OFFSET
,
72 void FillUpWithDefTabs_Impl( long nDefDist
, SvxTabStopItem
& rTabs
)
77 SvxTabStop
aSwTabStop( nDefDist
, SVX_TAB_ADJUST_DEFAULT
);
78 rTabs
.Insert( aSwTabStop
);
82 void TabWin_Impl::Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
&)
86 Size
aSize(GetOutputSizePixel());
87 aPoint
.X() = aSize
.Width() / 2;
88 aPoint
.Y() = aSize
.Height() / 2;
89 Ruler::DrawTab(rRenderContext
, rRenderContext
.GetSettings().GetStyleSettings().GetFontColor(), aPoint
, nTabStyle
);
92 SvxTabulatorTabPage::SvxTabulatorTabPage(vcl::Window
* pParent
, const SfxItemSet
& rAttr
)
93 : SfxTabPage(pParent
, "ParagraphTabsPage","cui/ui/paratabspage.ui", &rAttr
)
95 , aNewTabs(0, 0, SVX_TAB_ADJUST_LEFT
, GetWhich(SID_ATTR_TABSTOP
))
97 , eDefUnit(FUNIT_100TH_MM
)
100 get(m_pTabBox
,"ED_TABPOS");
102 get(m_pLeftWin
,"drawingareaWIN_TABLEFT");
103 get(m_pRightWin
,"drawingareaWIN_TABRIGHT");
104 get(m_pCenterWin
,"drawingareaWIN_TABCENTER");
105 get(m_pDezWin
,"drawingareaWIN_TABDECIMAL");
106 m_pLeftWin
->SetTabulatorTabPage(this);
107 m_pRightWin
->SetTabulatorTabPage(this);
108 m_pCenterWin
->SetTabulatorTabPage(this);
109 m_pDezWin
->SetTabulatorTabPage(this);
110 m_pLeftWin
->SetTabStyle((sal_uInt16
)(RULER_TAB_LEFT
|WB_HORZ
));
111 m_pRightWin
->SetTabStyle((sal_uInt16
)(RULER_TAB_RIGHT
|WB_HORZ
));
112 m_pCenterWin
->SetTabStyle((sal_uInt16
)(RULER_TAB_CENTER
|WB_HORZ
));
113 m_pDezWin
->SetTabStyle((sal_uInt16
)(RULER_TAB_DECIMAL
|WB_HORZ
));
115 SvtCJKOptions aCJKOptions
;
116 get(m_pLeftTab
, aCJKOptions
.IsAsianTypographyEnabled() ? "radiobuttonST_LEFTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_LEFT");
117 get(m_pRightTab
, aCJKOptions
.IsAsianTypographyEnabled() ? "radiobuttonST_RIGHTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_RIGHT");
118 m_pLeftTab
->Show(true);
119 m_pRightTab
->Show(true);
120 get(m_pCenterTab
,"radiobuttonBTN_TABTYPE_CENTER");
121 get(m_pDezTab
,"radiobuttonBTN_TABTYPE_DECIMAL");
122 get(m_pDezChar
,"entryED_TABTYPE_DECCHAR");
123 get(m_pDezCharLabel
,"labelFT_TABTYPE_DECCHAR");
124 //lower radio buttons
125 get(m_pNoFillChar
,"radiobuttonBTN_FILLCHAR_NO");
126 get(m_pFillPoints
,"radiobuttonBTN_FILLCHAR_POINTS");
127 get(m_pFillDashLine
,"radiobuttonBTN_FILLCHAR_DASHLINE");
128 get(m_pFillSolidLine
,"radiobuttonBTN_FILLCHAR_UNDERSCORE");
129 get(m_pFillSpecial
,"radiobuttonBTN_FILLCHAR_OTHER");
130 get(m_pFillChar
,"entryED_FILLCHAR_OTHER");
132 get(m_pNewBtn
,"buttonBTN_NEW");
133 get(m_pDelAllBtn
,"buttonBTN_DELALL");
134 get(m_pDelBtn
,"buttonBTN_DEL");
136 get(m_pTypeFrame
, "frameFL_TABTYPE");
137 get(m_pFillFrame
, "frameFL_FILLCHAR");
139 // This page needs ExchangeSupport
140 SetExchangeSupport();
143 FieldUnit eFUnit
= GetModuleFieldUnit( rAttr
);
144 SetFieldUnit( *m_pTabBox
, eFUnit
);
146 // Initialize buttons
147 m_pNewBtn
->SetClickHdl( LINK( this,SvxTabulatorTabPage
, NewHdl_Impl
) );
148 m_pDelBtn
->SetClickHdl( LINK( this,SvxTabulatorTabPage
, DelHdl_Impl
) );
149 m_pDelAllBtn
->SetClickHdl( LINK( this,SvxTabulatorTabPage
, DelAllHdl_Impl
) );
151 Link
<> aLink
= LINK( this, SvxTabulatorTabPage
, TabTypeCheckHdl_Impl
);
152 m_pLeftTab
->SetClickHdl( aLink
);
153 m_pRightTab
->SetClickHdl( aLink
);
154 m_pDezTab
->SetClickHdl( aLink
);
155 m_pCenterTab
->SetClickHdl( aLink
);
157 m_pDezChar
->SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage
, GetDezCharHdl_Impl
) );
158 m_pDezChar
->Disable();
159 m_pDezCharLabel
->Disable();
161 aLink
= LINK( this, SvxTabulatorTabPage
, FillTypeCheckHdl_Impl
);
162 m_pNoFillChar
->SetClickHdl( aLink
);
163 m_pFillPoints
->SetClickHdl( aLink
);
164 m_pFillDashLine
->SetClickHdl( aLink
);
165 m_pFillSolidLine
->SetClickHdl( aLink
);
166 m_pFillSpecial
->SetClickHdl( aLink
);
167 m_pFillChar
->SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage
, GetFillCharHdl_Impl
) );
168 m_pFillChar
->Disable();
170 m_pTabBox
->SetDoubleClickHdl( LINK( this, SvxTabulatorTabPage
, SelectHdl_Impl
) );
171 m_pTabBox
->SetModifyHdl( LINK( this, SvxTabulatorTabPage
, ModifyHdl_Impl
) );
173 // Get the default decimal char from the system
174 const LocaleDataWrapper
& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
175 aAktTab
.GetDecimal() = rLocaleWrapper
.getNumDecimalSep()[0];
178 SvxTabulatorTabPage::~SvxTabulatorTabPage()
183 void SvxTabulatorTabPage::dispose()
188 m_pCenterTab
.clear();
192 m_pCenterWin
.clear();
194 m_pDezCharLabel
.clear();
196 m_pNoFillChar
.clear();
197 m_pFillPoints
.clear();
198 m_pFillDashLine
.clear();
199 m_pFillSolidLine
.clear();
200 m_pFillSpecial
.clear();
203 m_pDelAllBtn
.clear();
205 m_pTypeFrame
.clear();
206 m_pFillFrame
.clear();
207 SfxTabPage::dispose();
210 bool SvxTabulatorTabPage::FillItemSet(SfxItemSet
* rSet
)
212 bool bModified
= false;
214 // Put the controls' values in here
215 if (m_pNewBtn
->IsEnabled())
218 // Call the LoseFocus-Handler first
219 GetDezCharHdl_Impl(m_pDezChar
);
220 GetFillCharHdl_Impl(m_pFillChar
);
222 FillUpWithDefTabs_Impl(nDefDist
, aNewTabs
);
223 SfxItemPool
* pPool
= rSet
->GetPool();
224 MapUnit eUnit
= (MapUnit
)pPool
->GetMetric(GetWhich(SID_ATTR_TABSTOP
));
225 const SfxPoolItem
* pOld
= GetOldItem(*rSet
, SID_ATTR_TABSTOP
);
227 if (MAP_100TH_MM
!= eUnit
)
229 // If the ItemSet contains a LRSpaceItem with negative first line indent,
230 // the TabStopItem needs to have a DefTab at position 0.
231 const SfxPoolItem
* pLRSpace
;
232 // If not in the new set, then maybe in the old one
233 if (SfxItemState::SET
!= rSet
->GetItemState(GetWhich(SID_ATTR_LRSPACE
), true, &pLRSpace
))
234 pLRSpace
= GetOldItem(*rSet
, SID_ATTR_LRSPACE
);
236 if (pLRSpace
&& static_cast<const SvxLRSpaceItem
*>(pLRSpace
)->GetTextFirstLineOfst() < 0)
238 SvxTabStop
aNull(0, SVX_TAB_ADJUST_DEFAULT
);
239 aNewTabs
.Insert(aNull
);
242 SvxTabStopItem
aTmp(aNewTabs
);
243 aTmp
.Remove(0, aTmp
.Count());
245 for (sal_uInt16 i
= 0; i
< aNewTabs
.Count(); ++i
)
247 SvxTabStop aTmpStop
= aNewTabs
[i
];
248 aTmpStop
.GetTabPos() = LogicToLogic(aTmpStop
.GetTabPos(), MAP_100TH_MM
, eUnit
);
249 aTmp
.Insert(aTmpStop
);
252 if (!pOld
|| !(*static_cast<const SvxTabStopItem
*>(pOld
) == aTmp
))
258 else if (!pOld
|| !( *static_cast<const SvxTabStopItem
*>(pOld
) == aNewTabs
))
266 VclPtr
<SfxTabPage
> SvxTabulatorTabPage::Create(vcl::Window
* pParent
, const SfxItemSet
* rSet
)
268 return VclPtr
<SvxTabulatorTabPage
>::Create(pParent
, *rSet
);
271 void SvxTabulatorTabPage::Reset(const SfxItemSet
* rSet
)
273 SfxItemPool
* pPool
= rSet
->GetPool();
274 MapUnit eUnit
= (MapUnit
)pPool
->GetMetric(GetWhich(SID_ATTR_TABSTOP
));
277 const SfxPoolItem
* pItem
= GetItem(*rSet
, SID_ATTR_TABSTOP
);
281 if (MAP_100TH_MM
!= eUnit
)
283 SvxTabStopItem
aTmp(*static_cast<const SvxTabStopItem
*>(pItem
));
284 aNewTabs
.Remove(0, aNewTabs
.Count());
286 for (sal_uInt16 i
= 0; i
< aTmp
.Count(); ++i
)
288 SvxTabStop aTmpStop
= aTmp
[i
];
289 aTmpStop
.GetTabPos() = LogicToLogic(aTmpStop
.GetTabPos(), eUnit
, MAP_100TH_MM
);
290 aNewTabs
.Insert(aTmpStop
);
294 aNewTabs
= *static_cast<const SvxTabStopItem
*>(pItem
);
297 aNewTabs
.Remove(0, aNewTabs
.Count());
299 // Defaul tab distance
300 nDefDist
= SVX_TAB_DEFDIST
;
301 pItem
= GetItem(*rSet
, SID_ATTR_TABSTOP_DEFAULTS
);
304 nDefDist
= LogicToLogic(long(static_cast<const SfxUInt16Item
*>(pItem
)->GetValue()), eUnit
, MAP_100TH_MM
);
306 // Tab pos currently selected
307 sal_uInt16 nTabPos
= 0;
308 pItem
= GetItem(*rSet
, SID_ATTR_TABSTOP_POS
);
311 nTabPos
= static_cast<const SfxUInt16Item
*>(pItem
)->GetValue();
313 InitTabPos_Impl(nTabPos
);
316 void SvxTabulatorTabPage::DisableControls(const sal_uInt16 nFlag
)
318 if ((TABTYPE_LEFT
& nFlag
) == TABTYPE_LEFT
)
320 m_pLeftTab
->Disable();
321 m_pLeftWin
->Disable();
323 if ( ( TABTYPE_RIGHT
& nFlag
) == TABTYPE_RIGHT
)
325 m_pRightTab
->Disable();
326 m_pRightWin
->Disable();
328 if ( ( TABTYPE_CENTER
& nFlag
) == TABTYPE_CENTER
)
330 m_pCenterTab
->Disable();
331 m_pCenterWin
->Disable();
333 if ( ( TABTYPE_DEZIMAL
& nFlag
) == TABTYPE_DEZIMAL
)
335 m_pDezTab
->Disable();
336 m_pDezWin
->Disable();
337 m_pDezCharLabel
->Disable();
338 m_pDezChar
->Disable();
340 if ( ( TABTYPE_ALL
& nFlag
) == TABTYPE_ALL
)
341 m_pTypeFrame
->Disable();
342 if ( ( TABFILL_NONE
& nFlag
) == TABFILL_NONE
)
343 m_pNoFillChar
->Disable();
344 if ( ( TABFILL_POINT
& nFlag
) == TABFILL_POINT
)
345 m_pFillPoints
->Disable();
346 if ( ( TABFILL_DASHLINE
& nFlag
) == TABFILL_DASHLINE
)
347 m_pFillDashLine
->Disable();
348 if ( ( TABFILL_SOLIDLINE
& nFlag
) == TABFILL_SOLIDLINE
)
349 m_pFillSolidLine
->Disable();
350 if ( ( TABFILL_SPECIAL
& nFlag
) == TABFILL_SPECIAL
)
352 m_pFillSpecial
->Disable();
353 m_pFillChar
->Disable();
355 if ( ( TABFILL_ALL
& nFlag
) == TABFILL_ALL
)
356 m_pFillFrame
->Disable();
359 SfxTabPage::sfxpg
SvxTabulatorTabPage::DeactivatePage( SfxItemSet
* _pSet
)
362 FillItemSet( _pSet
);
366 void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos
)
371 const SfxPoolItem
* pItem
= 0;
372 if (GetItemSet().GetItemState(SID_ATTR_TABSTOP_OFFSET
, true, &pItem
) == SfxItemState::SET
)
374 nOffset
= static_cast<const SfxInt32Item
*>(pItem
)->GetValue();
375 MapUnit eUnit
= (MapUnit
)GetItemSet().GetPool()->GetMetric(GetWhich(SID_ATTR_TABSTOP
));
376 nOffset
= OutputDevice::LogicToLogic(nOffset
, eUnit
, MAP_100TH_MM
);
379 // Correct current TabPos and default tabs
380 for ( sal_uInt16 i
= 0; i
< aNewTabs
.Count(); i
++ )
382 if ( aNewTabs
[i
].GetAdjustment() != SVX_TAB_ADJUST_DEFAULT
)
384 m_pTabBox
->InsertValue( m_pTabBox
->Normalize(
385 aNewTabs
[i
].GetTabPos() + nOffset
), eDefUnit
);
388 aNewTabs
.Remove( i
-- );
391 // Select current tabulator
392 const sal_uInt16 nSize
= aNewTabs
.Count();
394 if ( nTabPos
>= nSize
)
397 // Switch off all RadioButtons for a start
398 m_pLeftTab
->Check( true );
399 m_pNoFillChar
->Check( true );
401 if( m_pTabBox
->GetEntryCount() > 0 )
403 m_pTabBox
->SetText( m_pTabBox
->GetEntry( nTabPos
) );
404 aAktTab
= aNewTabs
[nTabPos
];
406 SetFillAndTabType_Impl();
407 m_pNewBtn
->Disable();
411 { // If no entry, 0 is the default value
412 m_pTabBox
->SetValue( 0, eDefUnit
);
415 m_pDelBtn
->Disable();
419 void SvxTabulatorTabPage::SetFillAndTabType_Impl()
421 RadioButton
* pTypeBtn
= 0;
422 RadioButton
* pFillBtn
= 0;
424 m_pDezChar
->Disable();
425 m_pDezCharLabel
->Disable();
427 if ( aAktTab
.GetAdjustment() == SVX_TAB_ADJUST_LEFT
)
428 pTypeBtn
= m_pLeftTab
;
429 else if ( aAktTab
.GetAdjustment() == SVX_TAB_ADJUST_RIGHT
)
430 pTypeBtn
= m_pRightTab
;
431 else if ( aAktTab
.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL
)
433 pTypeBtn
= m_pDezTab
;
434 m_pDezChar
->Enable();
435 m_pDezCharLabel
->Enable();
436 m_pDezChar
->SetText( OUString( (sal_Unicode
)aAktTab
.GetDecimal() ) );
438 else if ( aAktTab
.GetAdjustment() == SVX_TAB_ADJUST_CENTER
)
439 pTypeBtn
= m_pCenterTab
;
444 m_pFillChar
->Disable();
445 m_pFillChar
->SetText( "" );
447 if ( aAktTab
.GetFill() == ' ' )
448 pFillBtn
= m_pNoFillChar
;
449 else if ( aAktTab
.GetFill() == '-' )
450 pFillBtn
= m_pFillDashLine
;
451 else if ( aAktTab
.GetFill() == '_' )
452 pFillBtn
= m_pFillSolidLine
;
453 else if ( aAktTab
.GetFill() == '.' )
454 pFillBtn
= m_pFillPoints
;
457 pFillBtn
= m_pFillSpecial
;
458 m_pFillChar
->Enable();
459 m_pFillChar
->SetText( OUString( (sal_Unicode
)aAktTab
.GetFill() ) );
464 IMPL_LINK( SvxTabulatorTabPage
, NewHdl_Impl
, Button
*, pBtn
)
466 // Add a new one and select it
467 // Get the value from the display
468 long nVal
= static_cast<long>(m_pTabBox
->Denormalize( m_pTabBox
->GetValue( eDefUnit
) ));
470 // If the pBtn == 0 && the value == 0 then do not create a tab, because we create via OK
471 if ( nVal
== 0 && pBtn
== 0 )
475 const SfxPoolItem
* pItem
= 0;
477 if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET
, true, &pItem
) ==
480 nOffset
= static_cast<const SfxInt32Item
*>(pItem
)->GetValue();
481 MapUnit eUnit
= (MapUnit
)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
482 nOffset
= OutputDevice::LogicToLogic( nOffset
, eUnit
, MAP_100TH_MM
);
484 const long nReal
= nVal
- nOffset
;
485 sal_Int32 nSize
= m_pTabBox
->GetEntryCount();
488 for( i
= 0; i
< nSize
; i
++ )
490 if ( nReal
< aNewTabs
[i
].GetTabPos() )
494 // Make ListBox entry
495 m_pTabBox
->InsertValue( m_pTabBox
->Normalize( nVal
), eDefUnit
, i
);
496 aAktTab
.GetTabPos() = nReal
;
497 SvxTabAdjust eAdj
= SVX_TAB_ADJUST_LEFT
;
499 if ( m_pRightTab
->IsChecked() )
500 eAdj
= SVX_TAB_ADJUST_RIGHT
;
501 else if ( m_pCenterTab
->IsChecked() )
502 eAdj
= SVX_TAB_ADJUST_CENTER
;
503 else if ( m_pDezTab
->IsChecked() )
504 eAdj
= SVX_TAB_ADJUST_DECIMAL
;
506 aAktTab
.GetAdjustment() = eAdj
;
507 aNewTabs
.Insert( aAktTab
);
509 m_pNewBtn
->Disable();
511 m_pTabBox
->GrabFocus();
513 // If no RadioButton was clicked, we need to put anyway
515 // Set the selection into the position Edit
516 m_pTabBox
->SetSelection(Selection(0, m_pTabBox
->GetText().getLength()));
520 IMPL_LINK_NOARG(SvxTabulatorTabPage
, DelHdl_Impl
)
522 sal_Int32 nPos
= m_pTabBox
->GetValuePos( m_pTabBox
->GetValue() );
524 if ( nPos
== COMBOBOX_ENTRY_NOTFOUND
)
527 if ( m_pTabBox
->GetEntryCount() == 1 )
534 m_pTabBox
->RemoveEntryAt(nPos
);
535 aNewTabs
.Remove( nPos
);
538 const sal_uInt16 nSize
= aNewTabs
.Count();
543 nPos
= ( ( nSize
- 1 ) >= nPos
) ? nPos
: nPos
- 1;
544 m_pTabBox
->SetValue( m_pTabBox
->GetValue( nPos
) );
545 aAktTab
= aNewTabs
[nPos
];
548 // If no Tabs Enable Disable Controls
549 if ( m_pTabBox
->GetEntryCount() == 0 )
551 m_pDelBtn
->Disable();
553 m_pTabBox
->GrabFocus();
556 // If no RadioButton was clicked, we need to put anyway
561 IMPL_LINK_NOARG(SvxTabulatorTabPage
, DelAllHdl_Impl
)
563 if ( aNewTabs
.Count() )
565 aNewTabs
= SvxTabStopItem( 0 );
568 // So that we put in FillItemSet()
574 IMPL_LINK( SvxTabulatorTabPage
, TabTypeCheckHdl_Impl
, RadioButton
*, pBox
)
578 m_pDezChar
->Disable();
579 m_pDezCharLabel
->Disable();
580 m_pDezChar
->SetText( "" );
582 if ( pBox
== m_pLeftTab
)
583 eAdj
= SVX_TAB_ADJUST_LEFT
;
584 else if ( pBox
== m_pRightTab
)
585 eAdj
= SVX_TAB_ADJUST_RIGHT
;
586 else if ( pBox
== m_pCenterTab
)
587 eAdj
= SVX_TAB_ADJUST_CENTER
;
590 eAdj
= SVX_TAB_ADJUST_DECIMAL
;
591 m_pDezChar
->Enable();
592 m_pDezCharLabel
->Enable();
593 m_pDezChar
->SetText( OUString( (sal_Unicode
)aAktTab
.GetDecimal() ) );
596 aAktTab
.GetAdjustment() = eAdj
;
597 sal_Int32 nPos
= m_pTabBox
->GetValuePos( m_pTabBox
->GetValue( eDefUnit
), eDefUnit
);
599 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
601 aNewTabs
.Remove( nPos
);
602 aNewTabs
.Insert( aAktTab
);
607 IMPL_LINK( SvxTabulatorTabPage
, FillTypeCheckHdl_Impl
, RadioButton
*, pBox
)
610 sal_uInt8 cFill
= ' ';
611 m_pFillChar
->SetText( "" );
612 m_pFillChar
->Disable();
614 if( pBox
== m_pFillSpecial
)
615 m_pFillChar
->Enable();
616 else if ( pBox
== m_pNoFillChar
)
618 else if ( pBox
== m_pFillSolidLine
)
620 else if ( pBox
== m_pFillPoints
)
622 else if ( pBox
== m_pFillDashLine
)
625 aAktTab
.GetFill() = cFill
;
626 sal_Int32 nPos
= m_pTabBox
->GetValuePos( m_pTabBox
->GetValue( eDefUnit
), eDefUnit
);
628 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
630 aNewTabs
.Remove( nPos
);
631 aNewTabs
.Insert( aAktTab
);
636 IMPL_LINK( SvxTabulatorTabPage
, GetFillCharHdl_Impl
, Edit
*, pEdit
)
638 OUString
aChar( pEdit
->GetText() );
640 if ( !aChar
.isEmpty() )
641 aAktTab
.GetFill() = aChar
[0];
643 const sal_Int32 nPos
= m_pTabBox
->GetValuePos( m_pTabBox
->GetValue( eDefUnit
), eDefUnit
);
644 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
646 aNewTabs
.Remove( nPos
);
647 aNewTabs
.Insert( aAktTab
);
652 IMPL_LINK( SvxTabulatorTabPage
, GetDezCharHdl_Impl
, Edit
*, pEdit
)
654 OUString
aChar( pEdit
->GetText() );
655 if ( !aChar
.isEmpty() && ( aChar
[0] >= ' '))
656 aAktTab
.GetDecimal() = aChar
[0];
658 sal_Int32 nPos
= m_pTabBox
->GetValuePos( m_pTabBox
->GetValue( eDefUnit
), eDefUnit
);
659 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
661 aNewTabs
.Remove( nPos
);
662 aNewTabs
.Insert( aAktTab
);
667 IMPL_LINK_NOARG(SvxTabulatorTabPage
, SelectHdl_Impl
)
669 sal_Int32 nPos
= m_pTabBox
->GetValuePos( m_pTabBox
->GetValue( eDefUnit
), eDefUnit
);
670 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
672 aAktTab
= aNewTabs
[nPos
];
673 m_pNewBtn
->Disable();
674 SetFillAndTabType_Impl();
679 IMPL_LINK_NOARG(SvxTabulatorTabPage
, ModifyHdl_Impl
)
681 sal_Int32 nPos
= m_pTabBox
->GetValuePos( m_pTabBox
->GetValue( eDefUnit
), eDefUnit
);
682 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
684 aAktTab
= aNewTabs
[nPos
];
685 SetFillAndTabType_Impl();
687 aAktTab
.GetTabPos() =
688 static_cast<long>(m_pTabBox
->Denormalize( m_pTabBox
->GetValue( eDefUnit
) ));
690 m_pNewBtn
->Disable();
695 m_pDelBtn
->Disable();
699 void SvxTabulatorTabPage::PageCreated(const SfxAllItemSet
& aSet
)
701 SFX_ITEMSET_ARG (&aSet
,pControlItem
,SfxUInt16Item
,SID_SVXTABULATORTABPAGE_CONTROLFLAGS
,false);
703 DisableControls(pControlItem
->GetValue());
706 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */