merge the formfield patch from ooo-build
[ooovba.git] / svx / source / cui / tabstpge.cxx
blob24a4a1ba901c2fbbff04c49ba3ddab68af5e6488
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tabstpge.cxx,v $
10 * $Revision: 1.27 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
36 #endif
38 // include ---------------------------------------------------------------
41 #include <sfx2/app.hxx>
42 #include <tools/shl.hxx>
43 #include <svtools/ruler.hxx>
45 #define _SVX_TABSTPGE_CXX
47 #include <svx/dialogs.hrc>
48 #include "tabstpge.hrc"
50 #include <svx/lrspitem.hxx>
51 #include "tabstpge.hxx"
52 #include <svx/dialmgr.hxx>
53 #include "dlgutil.hxx"
54 #include <sfx2/module.hxx>
55 #include <svtools/cjkoptions.hxx>
56 #include <unotools/localedatawrapper.hxx>
57 #ifndef _UNOTOOLS_PROCESSFACTORY_HXX
58 #include <comphelper/processfactory.hxx>
59 #endif
60 #include <sfx2/request.hxx> //CHINA001
61 #include <svx/svxids.hrc> //add CHINA001
62 #include <svtools/intitem.hxx> //add CHINA001
65 // class TabWin_Impl -----------------------------------------------------
67 class TabWin_Impl : public Window
69 private:
70 USHORT nTabStyle;
72 public:
73 TabWin_Impl( Window* pParent, const ResId& rId, USHORT nStyle ) :
74 Window( pParent, rId ),
75 nTabStyle( nStyle ) {}
77 virtual void Paint( const Rectangle& rRect );
80 // static ----------------------------------------------------------------
82 static USHORT pRanges[] =
84 SID_ATTR_TABSTOP,
85 SID_ATTR_TABSTOP_OFFSET,
89 // C-Funktion ------------------------------------------------------------
91 void FillUpWithDefTabs_Impl( long nDefDist, SvxTabStopItem& rTabs )
93 if( rTabs.Count() )
94 return;
96 SvxTabStop aSwTabStop( nDefDist, SVX_TAB_ADJUST_DEFAULT );
97 rTabs.Insert( aSwTabStop );
101 // class TabWin_Impl -----------------------------------------------------
103 void TabWin_Impl::Paint( const Rectangle& )
105 // Tabulatoren malen
106 Point aPnt;
107 Size aSize = GetOutputSizePixel();
108 aPnt.X() = aSize.Width() / 2;
109 aPnt.Y() = aSize.Height() / 2;
110 Ruler::DrawTab( this, aPnt, nTabStyle );
113 // class SvxTabulatorTabPage ---------------------------------------------
115 SvxTabulatorTabPage::SvxTabulatorTabPage( Window* pParent,
116 const SfxItemSet& rAttr ):
118 SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_TABULATOR ), rAttr ),
120 aTabBox ( this, SVX_RES( ED_TABPOS ) ),
121 aTabLabel ( this, SVX_RES( FL_TABPOS ) ),
122 aTabLabelVert ( this, SVX_RES( FL_TABPOS_VERT ) ),
123 aLeftTab ( this, SVX_RES( BTN_TABTYPE_LEFT ) ),
124 aRightTab ( this, SVX_RES( BTN_TABTYPE_RIGHT ) ),
125 aCenterTab ( this, SVX_RES( BTN_TABTYPE_CENTER ) ),
126 aDezTab ( this, SVX_RES( BTN_TABTYPE_DECIMAL ) ),
127 pLeftWin ( new TabWin_Impl( this, SVX_RES( WIN_TABLEFT ), (USHORT)(RULER_TAB_LEFT|WB_HORZ) ) ),
128 pRightWin ( new TabWin_Impl( this, SVX_RES( WIN_TABRIGHT ), (USHORT)(RULER_TAB_RIGHT|WB_HORZ) ) ),
129 pCenterWin ( new TabWin_Impl( this, SVX_RES( WIN_TABCENTER ), (USHORT)(RULER_TAB_CENTER|WB_HORZ) ) ),
130 pDezWin ( new TabWin_Impl( this, SVX_RES( WIN_TABDECIMAL ), (USHORT)(RULER_TAB_DECIMAL|WB_HORZ) ) ),
131 aDezCharLabel ( this, SVX_RES( FT_TABTYPE_DECCHAR ) ),
132 aDezChar ( this, SVX_RES( ED_TABTYPE_DECCHAR ) ),
133 aTabTypeLabel ( this, SVX_RES( FL_TABTYPE ) ),
134 aNoFillChar ( this, SVX_RES( BTN_FILLCHAR_NO ) ),
135 aFillPoints ( this, SVX_RES( BTN_FILLCHAR_POINTS ) ),
136 aFillDashLine ( this, SVX_RES( BTN_FILLCHAR_DASHLINE ) ),
137 aFillSolidLine ( this, SVX_RES( BTN_FILLCHAR_UNDERSCORE ) ),
138 aFillSpecial ( this, SVX_RES( BTN_FILLCHAR_OTHER ) ),
139 aFillChar ( this, SVX_RES( ED_FILLCHAR_OTHER ) ),
140 aFillLabel ( this, SVX_RES( FL_FILLCHAR ) ),
141 aNewBtn ( this, SVX_RES( BTN_NEW ) ),
142 aDelAllBtn ( this, SVX_RES( BTN_DELALL ) ),
143 aDelBtn ( this, SVX_RES( BTN_DEL ) ),
145 aAktTab ( 0 ),
146 aNewTabs ( 0, 0, SVX_TAB_ADJUST_LEFT, GetWhich( SID_ATTR_TABSTOP ) ),
147 nDefDist ( 0 ),
148 eDefUnit( FUNIT_100TH_MM ),
149 bCheck ( FALSE )
152 SvtCJKOptions aCJKOptions;
153 if(aCJKOptions.IsAsianTypographyEnabled())
155 aLeftTab .SetText(String(SVX_RES( ST_LEFTTAB_ASIAN )));
156 aRightTab .SetText(String(SVX_RES( ST_RIGHTTAB_ASIAN )));
159 // diese Page braucht ExchangeSupport
160 SetExchangeSupport();
163 // Metrik einstellen
164 FieldUnit eFUnit = GetModuleFieldUnit( &rAttr );
165 SetFieldUnit( aTabBox, eFUnit );
167 // Buttons initialisieren
168 aNewBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, NewHdl_Impl ) );
169 aDelBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelHdl_Impl ) );
170 aDelAllBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelAllHdl_Impl ) );
172 Link aLink = LINK( this, SvxTabulatorTabPage, TabTypeCheckHdl_Impl );
173 aLeftTab.SetClickHdl( aLink );
174 aRightTab.SetClickHdl( aLink );
175 aDezTab.SetClickHdl( aLink );
176 aCenterTab.SetClickHdl( aLink );
178 aDezChar.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetDezCharHdl_Impl ) );
179 aDezChar.SetMaxTextLen(1);
180 aDezChar.Disable();
181 aDezCharLabel.Disable();
183 aLink = LINK( this, SvxTabulatorTabPage, FillTypeCheckHdl_Impl );
184 aNoFillChar.SetClickHdl( aLink );
185 aFillPoints.SetClickHdl( aLink );
186 aFillDashLine.SetClickHdl( aLink );
187 aFillSolidLine.SetClickHdl( aLink );
188 aFillSpecial.SetClickHdl( aLink );
189 aFillChar.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetFillCharHdl_Impl ) );
190 aFillChar.SetMaxTextLen(1);
191 aFillChar.Disable();
193 aTabBox.SetDoubleClickHdl( LINK( this, SvxTabulatorTabPage, SelectHdl_Impl ) );
194 aTabBox.SetModifyHdl( LINK( this, SvxTabulatorTabPage, ModifyHdl_Impl ) );
196 // das Default-Dezimalzeichen vom System holen
197 LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
198 aAktTab.GetDecimal() = aLocaleWrapper.getNumDecimalSep().GetChar(0);
199 FreeResource();
202 // -----------------------------------------------------------------------
204 SvxTabulatorTabPage::~SvxTabulatorTabPage()
206 delete pLeftWin;
207 delete pRightWin;
208 delete pCenterWin;
209 delete pDezWin;
212 // -----------------------------------------------------------------------
214 USHORT* SvxTabulatorTabPage::GetRanges()
216 return pRanges;
219 // -----------------------------------------------------------------------
221 BOOL SvxTabulatorTabPage::FillItemSet( SfxItemSet& rSet )
223 BOOL bModified = FALSE;
225 // Hier die Werte aus den Controls eintueten
226 if ( aNewBtn.IsEnabled() )
227 NewHdl_Impl( 0 );
229 // call at first the LoseFocus-Handler
230 GetDezCharHdl_Impl( &aDezChar );
231 GetFillCharHdl_Impl( &aFillChar );
233 FillUpWithDefTabs_Impl( nDefDist, aNewTabs );
234 SfxItemPool* pPool = rSet.GetPool();
235 MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
236 const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_TABSTOP );
238 if ( MAP_100TH_MM != eUnit )
240 // Wenn sich im ItemSet ein LRSpaceItem mit negativen Erstzeileneinzug
241 // befindet, muss im TabStopItem auf der Position 0 ein DefTab sein.
242 const SfxPoolItem* pLRSpace;
243 // wenn nicht im neuen Set, dann vielleicht im alten
244 if ( SFX_ITEM_SET !=
245 rSet.GetItemState( GetWhich( SID_ATTR_LRSPACE ), TRUE, &pLRSpace ) )
246 pLRSpace = GetOldItem( rSet, SID_ATTR_LRSPACE );
248 if ( pLRSpace && ( (SvxLRSpaceItem*)pLRSpace )->GetTxtFirstLineOfst() < 0 )
250 SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT );
251 aNewTabs.Insert( aNull );
254 SvxTabStopItem aTmp( aNewTabs );
255 aTmp.Remove( 0, aTmp.Count() );
257 for ( USHORT i = 0; i < aNewTabs.Count(); ++i )
259 SvxTabStop aTmpStop = aNewTabs[i];
260 aTmpStop.GetTabPos() =
261 LogicToLogic( aTmpStop.GetTabPos(), MAP_100TH_MM, eUnit );
262 aTmp.Insert( aTmpStop );
265 if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aTmp ) )
267 rSet.Put( aTmp );
268 bModified = TRUE;
271 else if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aNewTabs ) )
273 rSet.Put( aNewTabs );
274 bModified = TRUE;
276 return bModified;
279 // -----------------------------------------------------------------------
281 SfxTabPage* SvxTabulatorTabPage::Create( Window* pParent,
282 const SfxItemSet& rSet)
284 return ( new SvxTabulatorTabPage( pParent, rSet ) );
287 // -----------------------------------------------------------------------
289 void SvxTabulatorTabPage::Reset( const SfxItemSet& rSet )
291 SfxItemPool* pPool = rSet.GetPool();
292 MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
294 // Aktuelle Tabs
295 const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TABSTOP );
297 if ( pItem )
299 if ( MAP_100TH_MM != eUnit )
301 SvxTabStopItem aTmp( *( (const SvxTabStopItem*)pItem ) );
302 aNewTabs.Remove( 0, aNewTabs.Count() );
304 for ( USHORT i = 0; i < aTmp.Count(); ++i )
306 SvxTabStop aTmpStop = aTmp[i];
307 aTmpStop.GetTabPos() =
308 LogicToLogic( aTmpStop.GetTabPos(), eUnit, MAP_100TH_MM );
309 aNewTabs.Insert( aTmpStop );
312 else
313 aNewTabs = *( (const SvxTabStopItem*)pItem );
315 else
316 aNewTabs.Remove( 0, aNewTabs.Count() );
318 // Default-Tab - Abstand
319 nDefDist = SVX_TAB_DEFDIST;
320 pItem = GetItem( rSet, SID_ATTR_TABSTOP_DEFAULTS );
322 if ( pItem )
323 nDefDist = LogicToLogic(
324 (long)((const SfxUInt16Item*)pItem)->GetValue(), eUnit, MAP_100TH_MM );
326 // Aktuell selektierte Tab-Pos
327 USHORT nTabPos = 0;
328 pItem = GetItem( rSet, SID_ATTR_TABSTOP_POS );
330 if ( pItem )
331 nTabPos = ( (const SfxUInt16Item*)pItem )->GetValue();
333 InitTabPos_Impl( nTabPos );
336 // -----------------------------------------------------------------------
338 void SvxTabulatorTabPage::DisableControls( const USHORT nFlag )
340 if ( ( TABTYPE_LEFT & nFlag ) == TABTYPE_LEFT )
342 aLeftTab.Disable();
343 pLeftWin->Disable();
345 if ( ( TABTYPE_RIGHT & nFlag ) == TABTYPE_RIGHT )
347 aRightTab.Disable();
348 pRightWin->Disable();
350 if ( ( TABTYPE_CENTER & nFlag ) == TABTYPE_CENTER )
352 aCenterTab.Disable();
353 pCenterWin->Disable();
355 if ( ( TABTYPE_DEZIMAL & nFlag ) == TABTYPE_DEZIMAL )
357 aDezTab.Disable();
358 pDezWin->Disable();
359 aDezCharLabel.Disable();
360 aDezChar.Disable();
362 if ( ( TABTYPE_ALL & nFlag ) == TABTYPE_ALL )
363 aTabTypeLabel.Disable();
364 if ( ( TABFILL_NONE & nFlag ) == TABFILL_NONE )
365 aNoFillChar.Disable();
366 if ( ( TABFILL_POINT & nFlag ) == TABFILL_POINT )
367 aFillPoints.Disable();
368 if ( ( TABFILL_DASHLINE & nFlag ) == TABFILL_DASHLINE )
369 aFillDashLine.Disable();
370 if ( ( TABFILL_SOLIDLINE & nFlag ) == TABFILL_SOLIDLINE )
371 aFillSolidLine.Disable();
372 if ( ( TABFILL_SPECIAL & nFlag ) == TABFILL_SPECIAL )
374 aFillSpecial.Disable();
375 aFillChar.Disable();
377 if ( ( TABFILL_ALL & nFlag ) == TABFILL_ALL )
378 aFillLabel.Disable();
381 // -----------------------------------------------------------------------
383 int SvxTabulatorTabPage::DeactivatePage( SfxItemSet* _pSet )
385 if ( _pSet )
386 FillItemSet( *_pSet );
387 return LEAVE_PAGE;
390 // -----------------------------------------------------------------------
392 void SvxTabulatorTabPage::InitTabPos_Impl( USHORT nTabPos )
394 aTabBox.Clear();
396 long nOffset = 0;
397 const SfxPoolItem* pItem = 0;
398 if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, TRUE, &pItem )
399 == SFX_ITEM_SET )
401 nOffset = ( (const SfxInt32Item*)pItem )->GetValue();
402 MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
403 nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM );
406 // Aktuelle TabPos korrigieren und Defaults-Tabs
407 for ( USHORT i = 0; i < aNewTabs.Count(); i++ )
409 if ( aNewTabs[i].GetAdjustment() != SVX_TAB_ADJUST_DEFAULT )
411 aTabBox.InsertValue( aTabBox.Normalize(
412 aNewTabs[i].GetTabPos() + nOffset ), eDefUnit );
414 else
415 aNewTabs.Remove( i-- );
418 // aktuellen Tabulator auswaehlen
419 const USHORT nSize = aNewTabs.Count();
421 if ( nTabPos >= nSize )
422 nTabPos = 0;
424 // alle RadioButtons erstmal ausschalten
425 aLeftTab.Check( TRUE );
426 aNoFillChar.Check( TRUE );
428 if( aTabBox.GetEntryCount() > 0 )
430 aTabBox.SetText( aTabBox.GetEntry( nTabPos ) );
431 aAktTab = aNewTabs[nTabPos];
433 SetFillAndTabType_Impl();
434 aNewBtn.Disable();
435 aDelBtn.Enable();
437 else
438 { // kein Eintrag dann ist 0 der Default-Wert
439 aTabBox.SetValue( 0, eDefUnit );
441 aNewBtn.Enable();
442 aDelBtn.Disable();
446 // -----------------------------------------------------------------------
448 void SvxTabulatorTabPage::SetFillAndTabType_Impl()
450 RadioButton* pTypeBtn = 0;
451 RadioButton* pFillBtn = 0;
453 aDezChar.Disable();
454 aDezCharLabel.Disable();
456 if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_LEFT )
457 pTypeBtn = &aLeftTab;
458 else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_RIGHT )
459 pTypeBtn = &aRightTab;
460 else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL )
462 pTypeBtn = &aDezTab;
463 aDezChar.Enable();
464 aDezCharLabel.Enable();
465 aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) );
467 else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_CENTER )
468 pTypeBtn = &aCenterTab;
470 if ( pTypeBtn )
471 pTypeBtn->Check();
473 aFillChar.Disable();
474 aFillChar.SetText( String() );
476 if ( aAktTab.GetFill() == ' ' )
477 pFillBtn = &aNoFillChar;
478 else if ( aAktTab.GetFill() == '-' )
479 pFillBtn = &aFillDashLine;
480 else if ( aAktTab.GetFill() == '_' )
481 pFillBtn = &aFillSolidLine;
482 else if ( aAktTab.GetFill() == '.' )
483 pFillBtn = &aFillPoints;
484 else
486 pFillBtn = &aFillSpecial;
487 aFillChar.Enable();
488 aFillChar.SetText( String( (sal_Unicode)aAktTab.GetFill() ) );
490 pFillBtn->Check();
493 // -----------------------------------------------------------------------
495 IMPL_LINK( SvxTabulatorTabPage, NewHdl_Impl, Button *, pBtn )
497 // Einen neuen Hinzufuegen und Selectieren
498 // Wert aus der Anzeige holen
499 long nVal = static_cast<long>(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) ));
501 // Wenn der pBtn == 0 && der Value == 0 dann keinen Tab Erzeugen
502 // weil ueber OK erzeugt
503 if ( nVal == 0 && pBtn == 0 )
504 return 0;
506 long nOffset = 0;
507 const SfxPoolItem* pItem = 0;
509 if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, TRUE, &pItem ) ==
510 SFX_ITEM_SET )
512 nOffset = ( (const SfxInt32Item*)pItem )->GetValue();
513 MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
514 nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM );
516 const long nReal = nVal - nOffset;
517 USHORT nSize = aTabBox.GetEntryCount();
519 USHORT i;
520 for( i = 0; i < nSize; i++ )
522 if ( nReal < aNewTabs[i].GetTabPos() )
523 break;
526 // ListBox-Eintrag vornehmen
527 aTabBox.InsertValue( aTabBox.Normalize( nVal ), eDefUnit, i );
528 aAktTab.GetTabPos() = nReal;
529 SvxTabAdjust eAdj = SVX_TAB_ADJUST_LEFT;
531 if ( aRightTab.IsChecked() )
532 eAdj = SVX_TAB_ADJUST_RIGHT;
533 else if ( aCenterTab.IsChecked() )
534 eAdj = SVX_TAB_ADJUST_CENTER;
535 else if ( aDezTab.IsChecked() )
536 eAdj = SVX_TAB_ADJUST_DECIMAL;
538 aAktTab.GetAdjustment() = eAdj;
539 aNewTabs.Insert( aAktTab );
541 aNewBtn.Disable();
542 aDelBtn.Enable();
543 aTabBox.GrabFocus();
545 // falls kein RadioButton geclickt wurde,
546 // muss trotzdem geputtet werden
547 bCheck |= TRUE;
548 // set the selection into the position Edit
549 aTabBox.SetSelection(Selection(0, aTabBox.GetText().Len()));
550 return 0;
553 // -----------------------------------------------------------------------
555 IMPL_LINK( SvxTabulatorTabPage, DelHdl_Impl, Button *, EMPTYARG )
557 USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue() );
559 if ( nPos == COMBOBOX_ENTRY_NOTFOUND )
560 return 0;
562 if ( aTabBox.GetEntryCount() == 1 )
564 DelAllHdl_Impl( 0 );
565 return 0;
568 // Tab loeschen
569 aTabBox.RemoveEntry( nPos );
570 aNewTabs.Remove( nPos );
572 // aAktTab neu setzen
573 const USHORT nSize = aNewTabs.Count();
575 if ( nSize > 0 )
577 // Pos korrigieren
578 nPos = ( ( nSize - 1 ) >= nPos) ? nPos : nPos - 1;
579 aTabBox.SetValue( aTabBox.GetValue( nPos ) );
580 aAktTab = aNewTabs[nPos];
583 // Falls keine Tabs Enable Disable Controls
584 if ( aTabBox.GetEntryCount() == 0 )
586 aDelBtn.Disable();
587 aNewBtn.Enable();
588 aTabBox.GrabFocus();
591 // falls kein RadioButton geclickt wurde,
592 // muss trotzdem geputtet werden
593 bCheck |= TRUE;
594 return 0;
597 // -----------------------------------------------------------------------
599 IMPL_LINK( SvxTabulatorTabPage, DelAllHdl_Impl, Button *, EMPTYARG )
601 if ( aNewTabs.Count() )
603 aNewTabs = SvxTabStopItem( 0 );
604 InitTabPos_Impl();
606 // damit in FillItemSet() geputtet wird
607 bCheck |= TRUE;
609 return 0;
612 // -----------------------------------------------------------------------
614 IMPL_LINK( SvxTabulatorTabPage, TabTypeCheckHdl_Impl, RadioButton *, pBox )
616 bCheck |= TRUE;
617 SvxTabAdjust eAdj;
618 aDezChar.Disable();
619 aDezCharLabel.Disable();
620 aDezChar.SetText( String() );
622 if ( pBox == &aLeftTab )
623 eAdj = SVX_TAB_ADJUST_LEFT;
624 else if ( pBox == &aRightTab )
625 eAdj = SVX_TAB_ADJUST_RIGHT;
626 else if ( pBox == &aCenterTab )
627 eAdj = SVX_TAB_ADJUST_CENTER;
628 else
630 eAdj = SVX_TAB_ADJUST_DECIMAL;
631 aDezChar.Enable();
632 aDezCharLabel.Enable();
633 aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) );
636 aAktTab.GetAdjustment() = eAdj;
637 USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
639 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
641 aNewTabs.Remove( nPos );
642 aNewTabs.Insert( aAktTab );
644 return 0;
647 // -----------------------------------------------------------------------
649 IMPL_LINK( SvxTabulatorTabPage, FillTypeCheckHdl_Impl, RadioButton *, pBox )
651 bCheck |= TRUE;
652 BYTE cFill = ' ';
653 aFillChar.SetText( String() );
654 aFillChar.Disable();
656 if( pBox == &aFillSpecial )
657 aFillChar.Enable();
658 else if ( pBox == &aNoFillChar )
659 cFill = ' ';
660 else if ( pBox == &aFillSolidLine )
661 cFill = '_';
662 else if ( pBox == &aFillPoints )
663 cFill = '.';
664 else if ( pBox == &aFillDashLine )
665 cFill = '-';
667 aAktTab.GetFill() = cFill;
668 USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
670 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
672 aNewTabs.Remove( nPos );
673 aNewTabs.Insert( aAktTab );
675 return 0;
678 // -----------------------------------------------------------------------
680 IMPL_LINK( SvxTabulatorTabPage, GetFillCharHdl_Impl, Edit *, pEdit )
682 String aChar( pEdit->GetText() );
684 if ( aChar.Len() > 0 )
685 aAktTab.GetFill() = aChar.GetChar( 0 );
687 const USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit);
688 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
690 aNewTabs.Remove( nPos );
691 aNewTabs.Insert( aAktTab );
693 return 0;
696 // -----------------------------------------------------------------------
698 IMPL_LINK( SvxTabulatorTabPage, GetDezCharHdl_Impl, Edit *, pEdit )
700 String aChar( pEdit->GetText() );
701 if ( aChar.Len() > 0 && ( aChar.GetChar( 0 ) >= ' '))
702 aAktTab.GetDecimal() = aChar.GetChar( 0 );
704 USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
705 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
707 aNewTabs.Remove( nPos );
708 aNewTabs.Insert( aAktTab );
710 return 0;
713 // -----------------------------------------------------------------------
715 IMPL_LINK( SvxTabulatorTabPage, SelectHdl_Impl, MetricBox *, EMPTYARG )
717 USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
718 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
720 aAktTab = aNewTabs[nPos];
721 aNewBtn.Disable();
722 SetFillAndTabType_Impl();
724 return 0;
727 // -----------------------------------------------------------------------
729 IMPL_LINK( SvxTabulatorTabPage, ModifyHdl_Impl, MetricBox *, EMPTYARG )
731 USHORT nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
732 if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
734 aAktTab = aNewTabs[nPos];
735 SetFillAndTabType_Impl();
737 aAktTab.GetTabPos() =
738 static_cast<long>(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) ));
740 aNewBtn.Disable();
741 aDelBtn.Enable();
742 return 0;
744 aNewBtn.Enable();
745 aDelBtn.Disable();
746 return 0;
748 //add CHINA001 Begin
749 void SvxTabulatorTabPage::PageCreated(SfxAllItemSet aSet)
751 SFX_ITEMSET_ARG (&aSet,pControlItem,SfxUInt16Item,SID_SVXTABULATORTABPAGE_CONTROLFLAGS,sal_False);
752 if (pControlItem)
753 DisableControls(pControlItem->GetValue());
755 //end of CHINA001