1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_cui.hxx"
31 // include ---------------------------------------------------------------
33 #include <sfx2/app.hxx>
34 #include <tools/shl.hxx>
35 #include <svtools/ruler.hxx>
36 #include <svx/dialogs.hrc>
37 #include <svx/dialogs.hrc>
39 #define _SVX_TABSTPGE_CXX
42 #include "tabstpge.hrc"
43 #include <editeng/lrspitem.hxx>
44 #include "tabstpge.hxx"
45 #include <dialmgr.hxx>
46 #include "svx/dlgutil.hxx"
47 #include <sfx2/module.hxx>
48 #include <svl/cjkoptions.hxx>
49 #include <unotools/localedatawrapper.hxx>
50 #include <comphelper/processfactory.hxx>
51 #include <sfx2/request.hxx> //CHINA001
52 #include <svl/intitem.hxx> //add CHINA001
54 // class TabWin_Impl -----------------------------------------------------
56 class TabWin_Impl
: public Window
62 TabWin_Impl( Window
* pParent
, const ResId
& rId
, sal_uInt16 nStyle
) :
63 Window( pParent
, rId
),
64 nTabStyle( nStyle
) {}
66 virtual void Paint( const Rectangle
& rRect
);
69 // static ----------------------------------------------------------------
71 static sal_uInt16 pRanges
[] =
74 SID_ATTR_TABSTOP_OFFSET
,
78 // C-Funktion ------------------------------------------------------------
80 void FillUpWithDefTabs_Impl( long nDefDist
, SvxTabStopItem
& rTabs
)
85 SvxTabStop
aSwTabStop( nDefDist
, SVX_TAB_ADJUST_DEFAULT
);
86 rTabs
.Insert( aSwTabStop
);
90 // class TabWin_Impl -----------------------------------------------------
92 void TabWin_Impl::Paint( const Rectangle
& )
96 Size aSize
= GetOutputSizePixel();
97 aPnt
.X() = aSize
.Width() / 2;
98 aPnt
.Y() = aSize
.Height() / 2;
99 Ruler::DrawTab( this, aPnt
, nTabStyle
);
102 // class SvxTabulatorTabPage ---------------------------------------------
104 SvxTabulatorTabPage::SvxTabulatorTabPage( Window
* pParent
,
105 const SfxItemSet
& rAttr
):
107 SfxTabPage( pParent
, CUI_RES( RID_SVXPAGE_TABULATOR
), rAttr
),
109 aTabLabel ( this, CUI_RES( FL_TABPOS
) ),
110 aTabBox ( this, CUI_RES( ED_TABPOS
) ),
111 aTabLabelVert ( this, CUI_RES( FL_TABPOS_VERT
) ),
112 aTabTypeLabel ( this, CUI_RES( FL_TABTYPE
) ),
113 aLeftTab ( this, CUI_RES( BTN_TABTYPE_LEFT
) ),
114 aRightTab ( this, CUI_RES( BTN_TABTYPE_RIGHT
) ),
115 aCenterTab ( this, CUI_RES( BTN_TABTYPE_CENTER
) ),
116 aDezTab ( this, CUI_RES( BTN_TABTYPE_DECIMAL
) ),
117 pLeftWin ( new TabWin_Impl( this, CUI_RES( WIN_TABLEFT
), (sal_uInt16
)(RULER_TAB_LEFT
|WB_HORZ
) ) ),
118 pRightWin ( new TabWin_Impl( this, CUI_RES( WIN_TABRIGHT
), (sal_uInt16
)(RULER_TAB_RIGHT
|WB_HORZ
) ) ),
119 pCenterWin ( new TabWin_Impl( this, CUI_RES( WIN_TABCENTER
), (sal_uInt16
)(RULER_TAB_CENTER
|WB_HORZ
) ) ),
120 pDezWin ( new TabWin_Impl( this, CUI_RES( WIN_TABDECIMAL
), (sal_uInt16
)(RULER_TAB_DECIMAL
|WB_HORZ
) ) ),
121 aDezCharLabel ( this, CUI_RES( FT_TABTYPE_DECCHAR
) ),
122 aDezChar ( this, CUI_RES( ED_TABTYPE_DECCHAR
) ),
123 aFillLabel ( this, CUI_RES( FL_FILLCHAR
) ),
124 aNoFillChar ( this, CUI_RES( BTN_FILLCHAR_NO
) ),
125 aFillPoints ( this, CUI_RES( BTN_FILLCHAR_POINTS
) ),
126 aFillDashLine ( this, CUI_RES( BTN_FILLCHAR_DASHLINE
) ),
127 aFillSolidLine ( this, CUI_RES( BTN_FILLCHAR_UNDERSCORE
) ),
128 aFillSpecial ( this, CUI_RES( BTN_FILLCHAR_OTHER
) ),
129 aFillChar ( this, CUI_RES( ED_FILLCHAR_OTHER
) ),
130 aNewBtn ( this, CUI_RES( BTN_NEW
) ),
131 aDelAllBtn ( this, CUI_RES( BTN_DELALL
) ),
132 aDelBtn ( this, CUI_RES( BTN_DEL
) ),
135 aNewTabs ( 0, 0, SVX_TAB_ADJUST_LEFT
, GetWhich( SID_ATTR_TABSTOP
) ),
137 eDefUnit( FUNIT_100TH_MM
),
141 SvtCJKOptions aCJKOptions
;
142 if(aCJKOptions
.IsAsianTypographyEnabled())
144 aLeftTab
.SetText(String(CUI_RES( ST_LEFTTAB_ASIAN
)));
145 aRightTab
.SetText(String(CUI_RES( ST_RIGHTTAB_ASIAN
)));
148 aFillChar
.SetAccessibleName(String(CUI_RES( ST_FILLCHAR_OTHER
)));
149 // diese Page braucht ExchangeSupport
150 SetExchangeSupport();
154 FieldUnit eFUnit
= GetModuleFieldUnit( rAttr
);
155 SetFieldUnit( aTabBox
, eFUnit
);
157 // Buttons initialisieren
158 aNewBtn
.SetClickHdl( LINK( this,SvxTabulatorTabPage
, NewHdl_Impl
) );
159 aDelBtn
.SetClickHdl( LINK( this,SvxTabulatorTabPage
, DelHdl_Impl
) );
160 aDelAllBtn
.SetClickHdl( LINK( this,SvxTabulatorTabPage
, DelAllHdl_Impl
) );
162 Link aLink
= LINK( this, SvxTabulatorTabPage
, TabTypeCheckHdl_Impl
);
163 aLeftTab
.SetClickHdl( aLink
);
164 aRightTab
.SetClickHdl( aLink
);
165 aDezTab
.SetClickHdl( aLink
);
166 aCenterTab
.SetClickHdl( aLink
);
168 aDezChar
.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage
, GetDezCharHdl_Impl
) );
169 aDezChar
.SetMaxTextLen(1);
171 aDezCharLabel
.Disable();
173 aLink
= LINK( this, SvxTabulatorTabPage
, FillTypeCheckHdl_Impl
);
174 aNoFillChar
.SetClickHdl( aLink
);
175 aFillPoints
.SetClickHdl( aLink
);
176 aFillDashLine
.SetClickHdl( aLink
);
177 aFillSolidLine
.SetClickHdl( aLink
);
178 aFillSpecial
.SetClickHdl( aLink
);
179 aFillChar
.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage
, GetFillCharHdl_Impl
) );
180 aFillChar
.SetMaxTextLen(1);
183 aTabBox
.SetDoubleClickHdl( LINK( this, SvxTabulatorTabPage
, SelectHdl_Impl
) );
184 aTabBox
.SetModifyHdl( LINK( this, SvxTabulatorTabPage
, ModifyHdl_Impl
) );
186 aLeftTab
.SetAccessibleRelationMemberOf( &aTabTypeLabel
);
187 aRightTab
.SetAccessibleRelationMemberOf( &aTabTypeLabel
);
188 aCenterTab
.SetAccessibleRelationMemberOf( &aTabTypeLabel
);
189 aDezTab
.SetAccessibleRelationMemberOf( &aTabTypeLabel
);
190 aDezCharLabel
.SetAccessibleRelationMemberOf( &aTabTypeLabel
);
191 aDezChar
.SetAccessibleRelationMemberOf( &aTabTypeLabel
);
193 aNoFillChar
.SetAccessibleRelationMemberOf( &aFillLabel
);
194 aFillPoints
.SetAccessibleRelationMemberOf( &aFillLabel
);
195 aFillDashLine
.SetAccessibleRelationMemberOf( &aFillLabel
);
196 aFillSolidLine
.SetAccessibleRelationMemberOf( &aFillLabel
);
197 aFillSpecial
.SetAccessibleRelationMemberOf( &aFillLabel
);
198 aFillChar
.SetAccessibleRelationMemberOf( &aFillLabel
);
200 aFillChar
.SetAccessibleRelationLabeledBy(&aFillSpecial
);
202 // das Default-Dezimalzeichen vom System holen
203 LocaleDataWrapper
aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
204 aAktTab
.GetDecimal() = aLocaleWrapper
.getNumDecimalSep().GetChar(0);
208 // -----------------------------------------------------------------------
210 SvxTabulatorTabPage::~SvxTabulatorTabPage()
218 // -----------------------------------------------------------------------
220 sal_uInt16
* SvxTabulatorTabPage::GetRanges()
225 // -----------------------------------------------------------------------
227 sal_Bool
SvxTabulatorTabPage::FillItemSet( SfxItemSet
& rSet
)
229 sal_Bool bModified
= sal_False
;
231 // Hier die Werte aus den Controls eintueten
232 if ( aNewBtn
.IsEnabled() )
235 // call at first the LoseFocus-Handler
236 GetDezCharHdl_Impl( &aDezChar
);
237 GetFillCharHdl_Impl( &aFillChar
);
239 FillUpWithDefTabs_Impl( nDefDist
, aNewTabs
);
240 SfxItemPool
* pPool
= rSet
.GetPool();
241 MapUnit eUnit
= (MapUnit
)pPool
->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
242 const SfxPoolItem
* pOld
= GetOldItem( rSet
, SID_ATTR_TABSTOP
);
244 if ( MAP_100TH_MM
!= eUnit
)
246 // Wenn sich im ItemSet ein LRSpaceItem mit negativen Erstzeileneinzug
247 // befindet, muss im TabStopItem auf der Position 0 ein DefTab sein.
248 const SfxPoolItem
* pLRSpace
;
249 // wenn nicht im neuen Set, dann vielleicht im alten
251 rSet
.GetItemState( GetWhich( SID_ATTR_LRSPACE
), sal_True
, &pLRSpace
) )
252 pLRSpace
= GetOldItem( rSet
, SID_ATTR_LRSPACE
);
254 if ( pLRSpace
&& ( (SvxLRSpaceItem
*)pLRSpace
)->GetTxtFirstLineOfst() < 0 )
256 SvxTabStop
aNull( 0, SVX_TAB_ADJUST_DEFAULT
);
257 aNewTabs
.Insert( aNull
);
260 SvxTabStopItem
aTmp( aNewTabs
);
261 aTmp
.Remove( 0, aTmp
.Count() );
263 for ( sal_uInt16 i
= 0; i
< aNewTabs
.Count(); ++i
)
265 SvxTabStop aTmpStop
= aNewTabs
[i
];
266 aTmpStop
.GetTabPos() =
267 LogicToLogic( aTmpStop
.GetTabPos(), MAP_100TH_MM
, eUnit
);
268 aTmp
.Insert( aTmpStop
);
271 if ( !pOld
|| !( *( (SvxTabStopItem
*)pOld
) == aTmp
) )
274 bModified
= sal_True
;
277 else if ( !pOld
|| !( *( (SvxTabStopItem
*)pOld
) == aNewTabs
) )
279 rSet
.Put( aNewTabs
);
280 bModified
= sal_True
;
285 // -----------------------------------------------------------------------
287 SfxTabPage
* SvxTabulatorTabPage::Create( Window
* pParent
,
288 const SfxItemSet
& rSet
)
290 return ( new SvxTabulatorTabPage( pParent
, rSet
) );
293 // -----------------------------------------------------------------------
295 void SvxTabulatorTabPage::Reset( const SfxItemSet
& rSet
)
297 SfxItemPool
* pPool
= rSet
.GetPool();
298 MapUnit eUnit
= (MapUnit
)pPool
->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
301 const SfxPoolItem
* pItem
= GetItem( rSet
, SID_ATTR_TABSTOP
);
305 if ( MAP_100TH_MM
!= eUnit
)
307 SvxTabStopItem
aTmp( *( (const SvxTabStopItem
*)pItem
) );
308 aNewTabs
.Remove( 0, aNewTabs
.Count() );
310 for ( sal_uInt16 i
= 0; i
< aTmp
.Count(); ++i
)
312 SvxTabStop aTmpStop
= aTmp
[i
];
313 aTmpStop
.GetTabPos() =
314 LogicToLogic( aTmpStop
.GetTabPos(), eUnit
, MAP_100TH_MM
);
315 aNewTabs
.Insert( aTmpStop
);
319 aNewTabs
= *( (const SvxTabStopItem
*)pItem
);
322 aNewTabs
.Remove( 0, aNewTabs
.Count() );
324 // Default-Tab - Abstand
325 nDefDist
= SVX_TAB_DEFDIST
;
326 pItem
= GetItem( rSet
, SID_ATTR_TABSTOP_DEFAULTS
);
329 nDefDist
= LogicToLogic(
330 (long)((const SfxUInt16Item
*)pItem
)->GetValue(), eUnit
, MAP_100TH_MM
);
332 // Aktuell selektierte Tab-Pos
333 sal_uInt16 nTabPos
= 0;
334 pItem
= GetItem( rSet
, SID_ATTR_TABSTOP_POS
);
337 nTabPos
= ( (const SfxUInt16Item
*)pItem
)->GetValue();
339 InitTabPos_Impl( nTabPos
);
342 // -----------------------------------------------------------------------
344 void SvxTabulatorTabPage::DisableControls( const sal_uInt16 nFlag
)
346 if ( ( TABTYPE_LEFT
& nFlag
) == TABTYPE_LEFT
)
351 if ( ( TABTYPE_RIGHT
& nFlag
) == TABTYPE_RIGHT
)
354 pRightWin
->Disable();
356 if ( ( TABTYPE_CENTER
& nFlag
) == TABTYPE_CENTER
)
358 aCenterTab
.Disable();
359 pCenterWin
->Disable();
361 if ( ( TABTYPE_DEZIMAL
& nFlag
) == TABTYPE_DEZIMAL
)
365 aDezCharLabel
.Disable();
368 if ( ( TABTYPE_ALL
& nFlag
) == TABTYPE_ALL
)
369 aTabTypeLabel
.Disable();
370 if ( ( TABFILL_NONE
& nFlag
) == TABFILL_NONE
)
371 aNoFillChar
.Disable();
372 if ( ( TABFILL_POINT
& nFlag
) == TABFILL_POINT
)
373 aFillPoints
.Disable();
374 if ( ( TABFILL_DASHLINE
& nFlag
) == TABFILL_DASHLINE
)
375 aFillDashLine
.Disable();
376 if ( ( TABFILL_SOLIDLINE
& nFlag
) == TABFILL_SOLIDLINE
)
377 aFillSolidLine
.Disable();
378 if ( ( TABFILL_SPECIAL
& nFlag
) == TABFILL_SPECIAL
)
380 aFillSpecial
.Disable();
383 if ( ( TABFILL_ALL
& nFlag
) == TABFILL_ALL
)
384 aFillLabel
.Disable();
387 // -----------------------------------------------------------------------
389 int SvxTabulatorTabPage::DeactivatePage( SfxItemSet
* _pSet
)
392 FillItemSet( *_pSet
);
396 // -----------------------------------------------------------------------
398 void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos
)
403 const SfxPoolItem
* pItem
= 0;
404 if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET
, sal_True
, &pItem
)
407 nOffset
= ( (const SfxInt32Item
*)pItem
)->GetValue();
408 MapUnit eUnit
= (MapUnit
)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
409 nOffset
= OutputDevice::LogicToLogic( nOffset
, eUnit
, MAP_100TH_MM
);
412 // Aktuelle TabPos korrigieren und Defaults-Tabs
413 for ( sal_uInt16 i
= 0; i
< aNewTabs
.Count(); i
++ )
415 if ( aNewTabs
[i
].GetAdjustment() != SVX_TAB_ADJUST_DEFAULT
)
417 aTabBox
.InsertValue( aTabBox
.Normalize(
418 aNewTabs
[i
].GetTabPos() + nOffset
), eDefUnit
);
421 aNewTabs
.Remove( i
-- );
424 // aktuellen Tabulator auswaehlen
425 const sal_uInt16 nSize
= aNewTabs
.Count();
427 if ( nTabPos
>= nSize
)
430 // alle RadioButtons erstmal ausschalten
431 aLeftTab
.Check( sal_True
);
432 aNoFillChar
.Check( sal_True
);
434 if( aTabBox
.GetEntryCount() > 0 )
436 aTabBox
.SetText( aTabBox
.GetEntry( nTabPos
) );
437 aAktTab
= aNewTabs
[nTabPos
];
439 SetFillAndTabType_Impl();
444 { // kein Eintrag dann ist 0 der Default-Wert
445 aTabBox
.SetValue( 0, eDefUnit
);
452 // -----------------------------------------------------------------------
454 void SvxTabulatorTabPage::SetFillAndTabType_Impl()
456 RadioButton
* pTypeBtn
= 0;
457 RadioButton
* pFillBtn
= 0;
460 aDezCharLabel
.Disable();
462 if ( aAktTab
.GetAdjustment() == SVX_TAB_ADJUST_LEFT
)
463 pTypeBtn
= &aLeftTab
;
464 else if ( aAktTab
.GetAdjustment() == SVX_TAB_ADJUST_RIGHT
)
465 pTypeBtn
= &aRightTab
;
466 else if ( aAktTab
.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL
)
470 aDezCharLabel
.Enable();
471 aDezChar
.SetText( String( (sal_Unicode
)aAktTab
.GetDecimal() ) );
473 else if ( aAktTab
.GetAdjustment() == SVX_TAB_ADJUST_CENTER
)
474 pTypeBtn
= &aCenterTab
;
480 aFillChar
.SetText( String() );
482 if ( aAktTab
.GetFill() == ' ' )
483 pFillBtn
= &aNoFillChar
;
484 else if ( aAktTab
.GetFill() == '-' )
485 pFillBtn
= &aFillDashLine
;
486 else if ( aAktTab
.GetFill() == '_' )
487 pFillBtn
= &aFillSolidLine
;
488 else if ( aAktTab
.GetFill() == '.' )
489 pFillBtn
= &aFillPoints
;
492 pFillBtn
= &aFillSpecial
;
494 aFillChar
.SetText( String( (sal_Unicode
)aAktTab
.GetFill() ) );
499 // -----------------------------------------------------------------------
501 IMPL_LINK( SvxTabulatorTabPage
, NewHdl_Impl
, Button
*, pBtn
)
503 // Einen neuen Hinzufuegen und Selectieren
504 // Wert aus der Anzeige holen
505 long nVal
= static_cast<long>(aTabBox
.Denormalize( aTabBox
.GetValue( eDefUnit
) ));
507 // Wenn der pBtn == 0 && der Value == 0 dann keinen Tab Erzeugen
508 // weil ueber OK erzeugt
509 if ( nVal
== 0 && pBtn
== 0 )
513 const SfxPoolItem
* pItem
= 0;
515 if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET
, sal_True
, &pItem
) ==
518 nOffset
= ( (const SfxInt32Item
*)pItem
)->GetValue();
519 MapUnit eUnit
= (MapUnit
)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
520 nOffset
= OutputDevice::LogicToLogic( nOffset
, eUnit
, MAP_100TH_MM
);
522 const long nReal
= nVal
- nOffset
;
523 sal_uInt16 nSize
= aTabBox
.GetEntryCount();
526 for( i
= 0; i
< nSize
; i
++ )
528 if ( nReal
< aNewTabs
[i
].GetTabPos() )
532 // ListBox-Eintrag vornehmen
533 aTabBox
.InsertValue( aTabBox
.Normalize( nVal
), eDefUnit
, i
);
534 aAktTab
.GetTabPos() = nReal
;
535 SvxTabAdjust eAdj
= SVX_TAB_ADJUST_LEFT
;
537 if ( aRightTab
.IsChecked() )
538 eAdj
= SVX_TAB_ADJUST_RIGHT
;
539 else if ( aCenterTab
.IsChecked() )
540 eAdj
= SVX_TAB_ADJUST_CENTER
;
541 else if ( aDezTab
.IsChecked() )
542 eAdj
= SVX_TAB_ADJUST_DECIMAL
;
544 aAktTab
.GetAdjustment() = eAdj
;
545 aNewTabs
.Insert( aAktTab
);
551 // falls kein RadioButton geclickt wurde,
552 // muss trotzdem geputtet werden
554 // set the selection into the position Edit
555 aTabBox
.SetSelection(Selection(0, aTabBox
.GetText().Len()));
559 // -----------------------------------------------------------------------
561 IMPL_LINK( SvxTabulatorTabPage
, DelHdl_Impl
, Button
*, EMPTYARG
)
563 sal_uInt16 nPos
= aTabBox
.GetValuePos( aTabBox
.GetValue() );
565 if ( nPos
== COMBOBOX_ENTRY_NOTFOUND
)
568 if ( aTabBox
.GetEntryCount() == 1 )
575 aTabBox
.RemoveEntry( nPos
);
576 aNewTabs
.Remove( nPos
);
578 // aAktTab neu setzen
579 const sal_uInt16 nSize
= aNewTabs
.Count();
584 nPos
= ( ( nSize
- 1 ) >= nPos
) ? nPos
: nPos
- 1;
585 aTabBox
.SetValue( aTabBox
.GetValue( nPos
) );
586 aAktTab
= aNewTabs
[nPos
];
589 // Falls keine Tabs Enable Disable Controls
590 if ( aTabBox
.GetEntryCount() == 0 )
597 // falls kein RadioButton geclickt wurde,
598 // muss trotzdem geputtet werden
603 // -----------------------------------------------------------------------
605 IMPL_LINK( SvxTabulatorTabPage
, DelAllHdl_Impl
, Button
*, EMPTYARG
)
607 if ( aNewTabs
.Count() )
609 aNewTabs
= SvxTabStopItem( 0 );
612 // damit in FillItemSet() geputtet wird
618 // -----------------------------------------------------------------------
620 IMPL_LINK( SvxTabulatorTabPage
, TabTypeCheckHdl_Impl
, RadioButton
*, pBox
)
625 aDezCharLabel
.Disable();
626 aDezChar
.SetText( String() );
628 if ( pBox
== &aLeftTab
)
629 eAdj
= SVX_TAB_ADJUST_LEFT
;
630 else if ( pBox
== &aRightTab
)
631 eAdj
= SVX_TAB_ADJUST_RIGHT
;
632 else if ( pBox
== &aCenterTab
)
633 eAdj
= SVX_TAB_ADJUST_CENTER
;
636 eAdj
= SVX_TAB_ADJUST_DECIMAL
;
638 aDezCharLabel
.Enable();
639 aDezChar
.SetText( String( (sal_Unicode
)aAktTab
.GetDecimal() ) );
642 aAktTab
.GetAdjustment() = eAdj
;
643 sal_uInt16 nPos
= aTabBox
.GetValuePos( aTabBox
.GetValue( eDefUnit
), eDefUnit
);
645 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
647 aNewTabs
.Remove( nPos
);
648 aNewTabs
.Insert( aAktTab
);
653 // -----------------------------------------------------------------------
655 IMPL_LINK( SvxTabulatorTabPage
, FillTypeCheckHdl_Impl
, RadioButton
*, pBox
)
658 sal_uInt8 cFill
= ' ';
659 aFillChar
.SetText( String() );
662 if( pBox
== &aFillSpecial
)
664 else if ( pBox
== &aNoFillChar
)
666 else if ( pBox
== &aFillSolidLine
)
668 else if ( pBox
== &aFillPoints
)
670 else if ( pBox
== &aFillDashLine
)
673 aAktTab
.GetFill() = cFill
;
674 sal_uInt16 nPos
= aTabBox
.GetValuePos( aTabBox
.GetValue( eDefUnit
), eDefUnit
);
676 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
678 aNewTabs
.Remove( nPos
);
679 aNewTabs
.Insert( aAktTab
);
684 // -----------------------------------------------------------------------
686 IMPL_LINK( SvxTabulatorTabPage
, GetFillCharHdl_Impl
, Edit
*, pEdit
)
688 String
aChar( pEdit
->GetText() );
690 if ( aChar
.Len() > 0 )
691 aAktTab
.GetFill() = aChar
.GetChar( 0 );
693 const sal_uInt16 nPos
= aTabBox
.GetValuePos( aTabBox
.GetValue( eDefUnit
), eDefUnit
);
694 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
696 aNewTabs
.Remove( nPos
);
697 aNewTabs
.Insert( aAktTab
);
702 // -----------------------------------------------------------------------
704 IMPL_LINK( SvxTabulatorTabPage
, GetDezCharHdl_Impl
, Edit
*, pEdit
)
706 String
aChar( pEdit
->GetText() );
707 if ( aChar
.Len() > 0 && ( aChar
.GetChar( 0 ) >= ' '))
708 aAktTab
.GetDecimal() = aChar
.GetChar( 0 );
710 sal_uInt16 nPos
= aTabBox
.GetValuePos( aTabBox
.GetValue( eDefUnit
), eDefUnit
);
711 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
713 aNewTabs
.Remove( nPos
);
714 aNewTabs
.Insert( aAktTab
);
719 // -----------------------------------------------------------------------
721 IMPL_LINK( SvxTabulatorTabPage
, SelectHdl_Impl
, MetricBox
*, EMPTYARG
)
723 sal_uInt16 nPos
= aTabBox
.GetValuePos( aTabBox
.GetValue( eDefUnit
), eDefUnit
);
724 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
726 aAktTab
= aNewTabs
[nPos
];
728 SetFillAndTabType_Impl();
733 // -----------------------------------------------------------------------
735 IMPL_LINK( SvxTabulatorTabPage
, ModifyHdl_Impl
, MetricBox
*, EMPTYARG
)
737 sal_uInt16 nPos
= aTabBox
.GetValuePos( aTabBox
.GetValue( eDefUnit
), eDefUnit
);
738 if ( nPos
!= COMBOBOX_ENTRY_NOTFOUND
)
740 aAktTab
= aNewTabs
[nPos
];
741 SetFillAndTabType_Impl();
743 aAktTab
.GetTabPos() =
744 static_cast<long>(aTabBox
.Denormalize( aTabBox
.GetValue( eDefUnit
) ));
755 void SvxTabulatorTabPage::PageCreated(SfxAllItemSet aSet
)
757 SFX_ITEMSET_ARG (&aSet
,pControlItem
,SfxUInt16Item
,SID_SVXTABULATORTABPAGE_CONTROLFLAGS
,sal_False
);
759 DisableControls(pControlItem
->GetValue());