xref: /aoo42x/main/cui/source/tabpages/tabstpge.cxx (revision 2ee96f1c)
1*2ee96f1cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2ee96f1cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2ee96f1cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2ee96f1cSAndrew Rist  * distributed with this work for additional information
6*2ee96f1cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2ee96f1cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2ee96f1cSAndrew Rist  * "License"); you may not use this file except in compliance
9*2ee96f1cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2ee96f1cSAndrew Rist  *
11*2ee96f1cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2ee96f1cSAndrew Rist  *
13*2ee96f1cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2ee96f1cSAndrew Rist  * software distributed under the License is distributed on an
15*2ee96f1cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2ee96f1cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2ee96f1cSAndrew Rist  * specific language governing permissions and limitations
18*2ee96f1cSAndrew Rist  * under the License.
19*2ee96f1cSAndrew Rist  *
20*2ee96f1cSAndrew Rist  *************************************************************/
21*2ee96f1cSAndrew Rist 
22*2ee96f1cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cui.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <sfx2/app.hxx>
30cdf0e10cSrcweir #include <tools/shl.hxx>
31cdf0e10cSrcweir #include <svtools/ruler.hxx>
32cdf0e10cSrcweir #include <svx/dialogs.hrc>
33cdf0e10cSrcweir #include <svx/dialogs.hrc>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #define _SVX_TABSTPGE_CXX
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <cuires.hrc>
38cdf0e10cSrcweir #include "tabstpge.hrc"
39cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
40cdf0e10cSrcweir #include "tabstpge.hxx"
41cdf0e10cSrcweir #include <dialmgr.hxx>
42cdf0e10cSrcweir #include "svx/dlgutil.hxx"
43cdf0e10cSrcweir #include <sfx2/module.hxx>
44cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
45cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx>
46cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
47cdf0e10cSrcweir #include <sfx2/request.hxx> //CHINA001
48cdf0e10cSrcweir #include <svl/intitem.hxx> //add CHINA001
49cdf0e10cSrcweir 
50cdf0e10cSrcweir // class TabWin_Impl -----------------------------------------------------
51cdf0e10cSrcweir 
52cdf0e10cSrcweir class TabWin_Impl : public Window
53cdf0e10cSrcweir {
54cdf0e10cSrcweir private:
55cdf0e10cSrcweir 	sal_uInt16  nTabStyle;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir public:
TabWin_Impl(Window * pParent,const ResId & rId,sal_uInt16 nStyle)58cdf0e10cSrcweir 	TabWin_Impl( Window* pParent, const ResId& rId, sal_uInt16 nStyle ) :
59cdf0e10cSrcweir 		Window( pParent, rId ),
60cdf0e10cSrcweir 		nTabStyle( nStyle ) {}
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 	virtual void    Paint( const Rectangle& rRect );
63cdf0e10cSrcweir };
64cdf0e10cSrcweir 
65cdf0e10cSrcweir // static ----------------------------------------------------------------
66cdf0e10cSrcweir 
67cdf0e10cSrcweir static sal_uInt16 pRanges[] =
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 	SID_ATTR_TABSTOP,
70cdf0e10cSrcweir 	SID_ATTR_TABSTOP_OFFSET,
71cdf0e10cSrcweir 	0
72cdf0e10cSrcweir };
73cdf0e10cSrcweir 
74cdf0e10cSrcweir // C-Funktion ------------------------------------------------------------
75cdf0e10cSrcweir 
FillUpWithDefTabs_Impl(long nDefDist,SvxTabStopItem & rTabs)76cdf0e10cSrcweir void FillUpWithDefTabs_Impl( long nDefDist, SvxTabStopItem& rTabs )
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	if( rTabs.Count() )
79cdf0e10cSrcweir 		return;
80cdf0e10cSrcweir 	{
81cdf0e10cSrcweir 		SvxTabStop aSwTabStop( nDefDist, SVX_TAB_ADJUST_DEFAULT );
82cdf0e10cSrcweir 		rTabs.Insert( aSwTabStop );
83cdf0e10cSrcweir 	}
84cdf0e10cSrcweir }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir // class TabWin_Impl -----------------------------------------------------
87cdf0e10cSrcweir 
Paint(const Rectangle &)88cdf0e10cSrcweir void TabWin_Impl::Paint( const Rectangle& )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 	// Tabulatoren malen
91cdf0e10cSrcweir 	Point aPnt;
92cdf0e10cSrcweir 	Size aSize = GetOutputSizePixel();
93cdf0e10cSrcweir 	aPnt.X() = aSize.Width() / 2;
94cdf0e10cSrcweir 	aPnt.Y() = aSize.Height() / 2;
95cdf0e10cSrcweir 	Ruler::DrawTab( this, aPnt, nTabStyle );
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir // class SvxTabulatorTabPage ---------------------------------------------
99cdf0e10cSrcweir 
SvxTabulatorTabPage(Window * pParent,const SfxItemSet & rAttr)100cdf0e10cSrcweir SvxTabulatorTabPage::SvxTabulatorTabPage( Window* pParent,
101cdf0e10cSrcweir 										  const SfxItemSet& rAttr ):
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_TABULATOR ), rAttr ),
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     aTabLabel       ( this, CUI_RES( FL_TABPOS ) ),
106cdf0e10cSrcweir 	aTabBox         ( this, CUI_RES( ED_TABPOS ) ),
107cdf0e10cSrcweir     aTabLabelVert   ( this, CUI_RES( FL_TABPOS_VERT ) ),
108cdf0e10cSrcweir     aTabTypeLabel   ( this, CUI_RES( FL_TABTYPE ) ),
109cdf0e10cSrcweir 	aLeftTab        ( this, CUI_RES( BTN_TABTYPE_LEFT ) ),
110cdf0e10cSrcweir 	aRightTab       ( this, CUI_RES( BTN_TABTYPE_RIGHT ) ),
111cdf0e10cSrcweir 	aCenterTab      ( this, CUI_RES( BTN_TABTYPE_CENTER ) ),
112cdf0e10cSrcweir 	aDezTab         ( this, CUI_RES( BTN_TABTYPE_DECIMAL ) ),
113cdf0e10cSrcweir     pLeftWin        ( new TabWin_Impl( this, CUI_RES( WIN_TABLEFT ), (sal_uInt16)(RULER_TAB_LEFT|WB_HORZ) ) ),
114cdf0e10cSrcweir     pRightWin       ( new TabWin_Impl( this, CUI_RES( WIN_TABRIGHT ), (sal_uInt16)(RULER_TAB_RIGHT|WB_HORZ) ) ),
115cdf0e10cSrcweir     pCenterWin      ( new TabWin_Impl( this, CUI_RES( WIN_TABCENTER ), (sal_uInt16)(RULER_TAB_CENTER|WB_HORZ) ) ),
116cdf0e10cSrcweir     pDezWin         ( new TabWin_Impl( this, CUI_RES( WIN_TABDECIMAL ), (sal_uInt16)(RULER_TAB_DECIMAL|WB_HORZ) ) ),
117cdf0e10cSrcweir     aDezCharLabel   ( this, CUI_RES( FT_TABTYPE_DECCHAR ) ),
118cdf0e10cSrcweir     aDezChar        ( this, CUI_RES( ED_TABTYPE_DECCHAR ) ),
119cdf0e10cSrcweir     aFillLabel      ( this, CUI_RES( FL_FILLCHAR ) ),
120cdf0e10cSrcweir 	aNoFillChar     ( this, CUI_RES( BTN_FILLCHAR_NO ) ),
121cdf0e10cSrcweir 	aFillPoints     ( this, CUI_RES( BTN_FILLCHAR_POINTS ) ),
122cdf0e10cSrcweir 	aFillDashLine   ( this, CUI_RES( BTN_FILLCHAR_DASHLINE ) ),
123cdf0e10cSrcweir 	aFillSolidLine  ( this, CUI_RES( BTN_FILLCHAR_UNDERSCORE ) ),
124cdf0e10cSrcweir 	aFillSpecial    ( this, CUI_RES( BTN_FILLCHAR_OTHER ) ),
125cdf0e10cSrcweir 	aFillChar       ( this, CUI_RES( ED_FILLCHAR_OTHER ) ),
126cdf0e10cSrcweir 	aNewBtn         ( this, CUI_RES( BTN_NEW ) ),
127cdf0e10cSrcweir 	aDelAllBtn      ( this, CUI_RES( BTN_DELALL ) ),
128cdf0e10cSrcweir 	aDelBtn         ( this, CUI_RES( BTN_DEL ) ),
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     aAktTab     ( 0 ),
131cdf0e10cSrcweir     aNewTabs    ( 0, 0, SVX_TAB_ADJUST_LEFT, GetWhich( SID_ATTR_TABSTOP ) ),
132cdf0e10cSrcweir     nDefDist    ( 0 ),
133cdf0e10cSrcweir     eDefUnit( FUNIT_100TH_MM ),
134cdf0e10cSrcweir     bCheck      ( sal_False )
135cdf0e10cSrcweir 
136cdf0e10cSrcweir {
137cdf0e10cSrcweir     SvtCJKOptions aCJKOptions;
138cdf0e10cSrcweir     if(aCJKOptions.IsAsianTypographyEnabled())
139cdf0e10cSrcweir     {
140cdf0e10cSrcweir         aLeftTab  .SetText(String(CUI_RES(   ST_LEFTTAB_ASIAN )));
141cdf0e10cSrcweir         aRightTab .SetText(String(CUI_RES(   ST_RIGHTTAB_ASIAN )));
142cdf0e10cSrcweir     }
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	aFillChar.SetAccessibleName(String(CUI_RES(   ST_FILLCHAR_OTHER )));
145cdf0e10cSrcweir     // diese Page braucht ExchangeSupport
146cdf0e10cSrcweir 	SetExchangeSupport();
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	// Metrik einstellen
150cdf0e10cSrcweir 	FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
151cdf0e10cSrcweir 	SetFieldUnit( aTabBox, eFUnit );
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	// Buttons initialisieren
154cdf0e10cSrcweir 	aNewBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, NewHdl_Impl ) );
155cdf0e10cSrcweir 	aDelBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelHdl_Impl ) );
156cdf0e10cSrcweir 	aDelAllBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelAllHdl_Impl ) );
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 	Link aLink = LINK( this, SvxTabulatorTabPage, TabTypeCheckHdl_Impl );
159cdf0e10cSrcweir 	aLeftTab.SetClickHdl( aLink );
160cdf0e10cSrcweir 	aRightTab.SetClickHdl( aLink );
161cdf0e10cSrcweir 	aDezTab.SetClickHdl( aLink );
162cdf0e10cSrcweir 	aCenterTab.SetClickHdl( aLink );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 	aDezChar.SetLoseFocusHdl( LINK( this,  SvxTabulatorTabPage, GetDezCharHdl_Impl ) );
165cdf0e10cSrcweir 	aDezChar.SetMaxTextLen(1);
166cdf0e10cSrcweir 	aDezChar.Disable();
167cdf0e10cSrcweir 	aDezCharLabel.Disable();
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	aLink = LINK( this, SvxTabulatorTabPage, FillTypeCheckHdl_Impl );
170cdf0e10cSrcweir 	aNoFillChar.SetClickHdl( aLink );
171cdf0e10cSrcweir 	aFillPoints.SetClickHdl( aLink );
172cdf0e10cSrcweir 	aFillDashLine.SetClickHdl( aLink );
173cdf0e10cSrcweir 	aFillSolidLine.SetClickHdl( aLink );
174cdf0e10cSrcweir 	aFillSpecial.SetClickHdl( aLink );
175cdf0e10cSrcweir 	aFillChar.SetLoseFocusHdl( LINK( this,  SvxTabulatorTabPage, GetFillCharHdl_Impl ) );
176cdf0e10cSrcweir 	aFillChar.SetMaxTextLen(1);
177cdf0e10cSrcweir 	aFillChar.Disable();
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	aTabBox.SetDoubleClickHdl( LINK( this, SvxTabulatorTabPage, SelectHdl_Impl ) );
180cdf0e10cSrcweir 	aTabBox.SetModifyHdl( LINK( this, SvxTabulatorTabPage, ModifyHdl_Impl ) );
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	aLeftTab.SetAccessibleRelationMemberOf( &aTabTypeLabel );
183cdf0e10cSrcweir 	aRightTab.SetAccessibleRelationMemberOf( &aTabTypeLabel );
184cdf0e10cSrcweir 	aCenterTab.SetAccessibleRelationMemberOf( &aTabTypeLabel );
185cdf0e10cSrcweir 	aDezTab.SetAccessibleRelationMemberOf( &aTabTypeLabel );
186cdf0e10cSrcweir 	aDezCharLabel.SetAccessibleRelationMemberOf( &aTabTypeLabel );
187cdf0e10cSrcweir 	aDezChar.SetAccessibleRelationMemberOf( &aTabTypeLabel );
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	aNoFillChar.SetAccessibleRelationMemberOf( &aFillLabel );
190cdf0e10cSrcweir 	aFillPoints.SetAccessibleRelationMemberOf( &aFillLabel );
191cdf0e10cSrcweir 	aFillDashLine.SetAccessibleRelationMemberOf( &aFillLabel );
192cdf0e10cSrcweir 	aFillSolidLine.SetAccessibleRelationMemberOf( &aFillLabel );
193cdf0e10cSrcweir 	aFillSpecial.SetAccessibleRelationMemberOf( &aFillLabel );
194cdf0e10cSrcweir 	aFillChar.SetAccessibleRelationMemberOf( &aFillLabel );
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 	aFillChar.SetAccessibleRelationLabeledBy(&aFillSpecial);
197cdf0e10cSrcweir 
198cdf0e10cSrcweir     // das Default-Dezimalzeichen vom System holen
199cdf0e10cSrcweir 	LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
200cdf0e10cSrcweir 	aAktTab.GetDecimal() = aLocaleWrapper.getNumDecimalSep().GetChar(0);
201cdf0e10cSrcweir 	FreeResource();
202cdf0e10cSrcweir }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir // -----------------------------------------------------------------------
205cdf0e10cSrcweir 
~SvxTabulatorTabPage()206cdf0e10cSrcweir SvxTabulatorTabPage::~SvxTabulatorTabPage()
207cdf0e10cSrcweir {
208cdf0e10cSrcweir 	delete pLeftWin;
209cdf0e10cSrcweir 	delete pRightWin;
210cdf0e10cSrcweir 	delete pCenterWin;
211cdf0e10cSrcweir 	delete pDezWin;
212cdf0e10cSrcweir }
213cdf0e10cSrcweir 
214cdf0e10cSrcweir // -----------------------------------------------------------------------
215cdf0e10cSrcweir 
GetRanges()216cdf0e10cSrcweir sal_uInt16* SvxTabulatorTabPage::GetRanges()
217cdf0e10cSrcweir {
218cdf0e10cSrcweir 	return pRanges;
219cdf0e10cSrcweir }
220cdf0e10cSrcweir 
221cdf0e10cSrcweir // -----------------------------------------------------------------------
222cdf0e10cSrcweir 
FillItemSet(SfxItemSet & rSet)223cdf0e10cSrcweir sal_Bool SvxTabulatorTabPage::FillItemSet( SfxItemSet& rSet )
224cdf0e10cSrcweir {
225cdf0e10cSrcweir 	sal_Bool bModified = sal_False;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 	// Hier die Werte aus den Controls eintueten
228cdf0e10cSrcweir 	if ( aNewBtn.IsEnabled() )
229cdf0e10cSrcweir 		NewHdl_Impl( 0 );
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 	// call at first the LoseFocus-Handler
232cdf0e10cSrcweir 	GetDezCharHdl_Impl( &aDezChar );
233cdf0e10cSrcweir 	GetFillCharHdl_Impl( &aFillChar );
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	FillUpWithDefTabs_Impl( nDefDist, aNewTabs );
236cdf0e10cSrcweir 	SfxItemPool* pPool = rSet.GetPool();
237cdf0e10cSrcweir 	MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
238cdf0e10cSrcweir 	const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_TABSTOP );
239cdf0e10cSrcweir 
240cdf0e10cSrcweir     if ( MAP_100TH_MM != eUnit )
241cdf0e10cSrcweir 	{
242cdf0e10cSrcweir 		// Wenn sich im ItemSet ein LRSpaceItem mit negativen Erstzeileneinzug
243cdf0e10cSrcweir 		// befindet, muss im TabStopItem auf der Position 0 ein DefTab sein.
244cdf0e10cSrcweir 		const SfxPoolItem* pLRSpace;
245cdf0e10cSrcweir 		// wenn nicht im neuen Set, dann vielleicht im alten
246cdf0e10cSrcweir 		if ( SFX_ITEM_SET !=
247cdf0e10cSrcweir 			 rSet.GetItemState( GetWhich( SID_ATTR_LRSPACE ), sal_True, &pLRSpace ) )
248cdf0e10cSrcweir 			pLRSpace = GetOldItem( rSet, SID_ATTR_LRSPACE );
249cdf0e10cSrcweir 
250cdf0e10cSrcweir 		if ( pLRSpace && ( (SvxLRSpaceItem*)pLRSpace )->GetTxtFirstLineOfst() < 0 )
251cdf0e10cSrcweir 		{
252cdf0e10cSrcweir 			SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT );
253cdf0e10cSrcweir 			aNewTabs.Insert( aNull );
254cdf0e10cSrcweir 		}
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 		SvxTabStopItem aTmp( aNewTabs );
257cdf0e10cSrcweir 		aTmp.Remove( 0, aTmp.Count() );
258cdf0e10cSrcweir 
259cdf0e10cSrcweir 		for ( sal_uInt16 i = 0; i < aNewTabs.Count(); ++i )
260cdf0e10cSrcweir 		{
261cdf0e10cSrcweir 			SvxTabStop aTmpStop = aNewTabs[i];
262cdf0e10cSrcweir 			aTmpStop.GetTabPos() =
263cdf0e10cSrcweir                 LogicToLogic( aTmpStop.GetTabPos(), MAP_100TH_MM, eUnit );
264cdf0e10cSrcweir 			aTmp.Insert( aTmpStop );
265cdf0e10cSrcweir 		}
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 		if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aTmp ) )
268cdf0e10cSrcweir 		{
269cdf0e10cSrcweir 			rSet.Put( aTmp );
270cdf0e10cSrcweir 			bModified = sal_True;
271cdf0e10cSrcweir 		}
272cdf0e10cSrcweir 	}
273cdf0e10cSrcweir 	else if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aNewTabs ) )
274cdf0e10cSrcweir 	{
275cdf0e10cSrcweir 		rSet.Put( aNewTabs );
276cdf0e10cSrcweir 		bModified = sal_True;
277cdf0e10cSrcweir 	}
278cdf0e10cSrcweir 	return bModified;
279cdf0e10cSrcweir }
280cdf0e10cSrcweir 
281cdf0e10cSrcweir // -----------------------------------------------------------------------
282cdf0e10cSrcweir 
Create(Window * pParent,const SfxItemSet & rSet)283cdf0e10cSrcweir SfxTabPage* SvxTabulatorTabPage::Create( Window* pParent,
284cdf0e10cSrcweir 										 const SfxItemSet& rSet)
285cdf0e10cSrcweir {
286cdf0e10cSrcweir 	return ( new SvxTabulatorTabPage( pParent, rSet ) );
287cdf0e10cSrcweir }
288cdf0e10cSrcweir 
289cdf0e10cSrcweir // -----------------------------------------------------------------------
290cdf0e10cSrcweir 
Reset(const SfxItemSet & rSet)291cdf0e10cSrcweir void SvxTabulatorTabPage::Reset( const SfxItemSet& rSet )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir 	SfxItemPool* pPool = rSet.GetPool();
294cdf0e10cSrcweir 	MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	// Aktuelle Tabs
297cdf0e10cSrcweir 	const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TABSTOP );
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 	if ( pItem )
300cdf0e10cSrcweir 	{
301cdf0e10cSrcweir         if ( MAP_100TH_MM != eUnit )
302cdf0e10cSrcweir 		{
303cdf0e10cSrcweir 			SvxTabStopItem aTmp( *( (const SvxTabStopItem*)pItem ) );
304cdf0e10cSrcweir 			aNewTabs.Remove( 0, aNewTabs.Count() );
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 			for ( sal_uInt16 i = 0; i < aTmp.Count(); ++i )
307cdf0e10cSrcweir 			{
308cdf0e10cSrcweir 				SvxTabStop aTmpStop = aTmp[i];
309cdf0e10cSrcweir 				aTmpStop.GetTabPos() =
310cdf0e10cSrcweir                     LogicToLogic( aTmpStop.GetTabPos(), eUnit, MAP_100TH_MM );
311cdf0e10cSrcweir 				aNewTabs.Insert( aTmpStop );
312cdf0e10cSrcweir 			}
313cdf0e10cSrcweir 		}
314cdf0e10cSrcweir 		else
315cdf0e10cSrcweir 			aNewTabs = *( (const SvxTabStopItem*)pItem );
316cdf0e10cSrcweir 	}
317cdf0e10cSrcweir 	else
318cdf0e10cSrcweir 		aNewTabs.Remove( 0, aNewTabs.Count() );
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	// Default-Tab - Abstand
321cdf0e10cSrcweir 	nDefDist = SVX_TAB_DEFDIST;
322cdf0e10cSrcweir 	pItem = GetItem( rSet, SID_ATTR_TABSTOP_DEFAULTS );
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 	if ( pItem )
325cdf0e10cSrcweir 		nDefDist = LogicToLogic(
326cdf0e10cSrcweir             (long)((const SfxUInt16Item*)pItem)->GetValue(), eUnit, MAP_100TH_MM );
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 	// Aktuell selektierte Tab-Pos
329cdf0e10cSrcweir 	sal_uInt16 nTabPos = 0;
330cdf0e10cSrcweir 	pItem = GetItem( rSet, SID_ATTR_TABSTOP_POS );
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 	if ( pItem )
333cdf0e10cSrcweir 		nTabPos = ( (const SfxUInt16Item*)pItem )->GetValue();
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 	InitTabPos_Impl( nTabPos );
336cdf0e10cSrcweir }
337cdf0e10cSrcweir 
338cdf0e10cSrcweir // -----------------------------------------------------------------------
339cdf0e10cSrcweir 
DisableControls(const sal_uInt16 nFlag)340cdf0e10cSrcweir void SvxTabulatorTabPage::DisableControls( const sal_uInt16 nFlag )
341cdf0e10cSrcweir {
342cdf0e10cSrcweir 	if ( ( TABTYPE_LEFT & nFlag ) == TABTYPE_LEFT )
343cdf0e10cSrcweir 	{
344cdf0e10cSrcweir 		aLeftTab.Disable();
345cdf0e10cSrcweir 		pLeftWin->Disable();
346cdf0e10cSrcweir 	}
347cdf0e10cSrcweir 	if ( ( TABTYPE_RIGHT & nFlag ) == TABTYPE_RIGHT )
348cdf0e10cSrcweir 	{
349cdf0e10cSrcweir 		aRightTab.Disable();
350cdf0e10cSrcweir 		pRightWin->Disable();
351cdf0e10cSrcweir 	}
352cdf0e10cSrcweir 	if ( ( TABTYPE_CENTER & nFlag ) == TABTYPE_CENTER )
353cdf0e10cSrcweir 	{
354cdf0e10cSrcweir 		aCenterTab.Disable();
355cdf0e10cSrcweir 		pCenterWin->Disable();
356cdf0e10cSrcweir 	}
357cdf0e10cSrcweir 	if ( ( TABTYPE_DEZIMAL & nFlag ) == TABTYPE_DEZIMAL )
358cdf0e10cSrcweir 	{
359cdf0e10cSrcweir 		aDezTab.Disable();
360cdf0e10cSrcweir 		pDezWin->Disable();
361cdf0e10cSrcweir 		aDezCharLabel.Disable();
362cdf0e10cSrcweir 		aDezChar.Disable();
363cdf0e10cSrcweir 	}
364cdf0e10cSrcweir 	if ( ( TABTYPE_ALL & nFlag ) == TABTYPE_ALL )
365cdf0e10cSrcweir 		aTabTypeLabel.Disable();
366cdf0e10cSrcweir 	if ( ( TABFILL_NONE & nFlag ) == TABFILL_NONE )
367cdf0e10cSrcweir 		aNoFillChar.Disable();
368cdf0e10cSrcweir 	if ( ( TABFILL_POINT & nFlag ) == TABFILL_POINT )
369cdf0e10cSrcweir 		aFillPoints.Disable();
370cdf0e10cSrcweir 	if ( ( TABFILL_DASHLINE & nFlag ) == TABFILL_DASHLINE )
371cdf0e10cSrcweir 		aFillDashLine.Disable();
372cdf0e10cSrcweir 	if ( ( TABFILL_SOLIDLINE & nFlag ) == TABFILL_SOLIDLINE )
373cdf0e10cSrcweir 		aFillSolidLine.Disable();
374cdf0e10cSrcweir 	if ( ( TABFILL_SPECIAL & nFlag ) == TABFILL_SPECIAL )
375cdf0e10cSrcweir 	{
376cdf0e10cSrcweir 		aFillSpecial.Disable();
377cdf0e10cSrcweir 		aFillChar.Disable();
378cdf0e10cSrcweir 	}
379cdf0e10cSrcweir 	if ( ( TABFILL_ALL & nFlag ) == TABFILL_ALL )
380cdf0e10cSrcweir 		aFillLabel.Disable();
381cdf0e10cSrcweir }
382cdf0e10cSrcweir 
383cdf0e10cSrcweir // -----------------------------------------------------------------------
384cdf0e10cSrcweir 
DeactivatePage(SfxItemSet * _pSet)385cdf0e10cSrcweir int SvxTabulatorTabPage::DeactivatePage( SfxItemSet* _pSet )
386cdf0e10cSrcweir {
387cdf0e10cSrcweir     if ( _pSet )
388cdf0e10cSrcweir         FillItemSet( *_pSet );
389cdf0e10cSrcweir 	return LEAVE_PAGE;
390cdf0e10cSrcweir }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir // -----------------------------------------------------------------------
393cdf0e10cSrcweir 
InitTabPos_Impl(sal_uInt16 nTabPos)394cdf0e10cSrcweir void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos )
395cdf0e10cSrcweir {
396cdf0e10cSrcweir 	aTabBox.Clear();
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     long nOffset = 0;
399cdf0e10cSrcweir     const SfxPoolItem* pItem = 0;
400cdf0e10cSrcweir     if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, sal_True, &pItem )
401cdf0e10cSrcweir             == SFX_ITEM_SET )
402cdf0e10cSrcweir     {
403cdf0e10cSrcweir         nOffset = ( (const SfxInt32Item*)pItem )->GetValue();
404cdf0e10cSrcweir         MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
405cdf0e10cSrcweir         nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM  );
406cdf0e10cSrcweir     }
407cdf0e10cSrcweir 
408cdf0e10cSrcweir     // Aktuelle TabPos korrigieren und Defaults-Tabs
409cdf0e10cSrcweir 	for ( sal_uInt16 i = 0; i < aNewTabs.Count(); i++ )
410cdf0e10cSrcweir 	{
411cdf0e10cSrcweir 		if ( aNewTabs[i].GetAdjustment() != SVX_TAB_ADJUST_DEFAULT )
412cdf0e10cSrcweir 		{
413cdf0e10cSrcweir             aTabBox.InsertValue( aTabBox.Normalize(
414cdf0e10cSrcweir 				aNewTabs[i].GetTabPos() + nOffset ), eDefUnit );
415cdf0e10cSrcweir 		}
416cdf0e10cSrcweir 		else
417cdf0e10cSrcweir 			aNewTabs.Remove( i-- );
418cdf0e10cSrcweir 	}
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 	// aktuellen Tabulator auswaehlen
421cdf0e10cSrcweir 	const sal_uInt16 nSize = aNewTabs.Count();
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 	if ( nTabPos >= nSize )
424cdf0e10cSrcweir 		nTabPos = 0;
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 	// alle RadioButtons erstmal ausschalten
427cdf0e10cSrcweir 	aLeftTab.Check( sal_True );
428cdf0e10cSrcweir 	aNoFillChar.Check( sal_True );
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 	if( aTabBox.GetEntryCount() > 0 )
431cdf0e10cSrcweir 	{
432cdf0e10cSrcweir 		aTabBox.SetText( aTabBox.GetEntry( nTabPos ) );
433cdf0e10cSrcweir 		aAktTab = aNewTabs[nTabPos];
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 		SetFillAndTabType_Impl();
436cdf0e10cSrcweir 		aNewBtn.Disable();
437cdf0e10cSrcweir 		aDelBtn.Enable();
438cdf0e10cSrcweir 	}
439cdf0e10cSrcweir 	else
440cdf0e10cSrcweir 	{   // kein Eintrag dann ist 0 der Default-Wert
441cdf0e10cSrcweir 		aTabBox.SetValue( 0, eDefUnit );
442cdf0e10cSrcweir 
443cdf0e10cSrcweir 		aNewBtn.Enable();
444cdf0e10cSrcweir 		aDelBtn.Disable();
445cdf0e10cSrcweir 	}
446cdf0e10cSrcweir }
447cdf0e10cSrcweir 
448cdf0e10cSrcweir // -----------------------------------------------------------------------
449cdf0e10cSrcweir 
SetFillAndTabType_Impl()450cdf0e10cSrcweir void SvxTabulatorTabPage::SetFillAndTabType_Impl()
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	RadioButton* pTypeBtn = 0;
453cdf0e10cSrcweir 	RadioButton* pFillBtn = 0;
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 	aDezChar.Disable();
456cdf0e10cSrcweir 	aDezCharLabel.Disable();
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 	if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_LEFT )
459cdf0e10cSrcweir 		pTypeBtn = &aLeftTab;
460cdf0e10cSrcweir 	else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_RIGHT )
461cdf0e10cSrcweir 		pTypeBtn = &aRightTab;
462cdf0e10cSrcweir 	else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL )
463cdf0e10cSrcweir 	{
464cdf0e10cSrcweir 		pTypeBtn = &aDezTab;
465cdf0e10cSrcweir 		aDezChar.Enable();
466cdf0e10cSrcweir 		aDezCharLabel.Enable();
467cdf0e10cSrcweir 		aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) );
468cdf0e10cSrcweir 	}
469cdf0e10cSrcweir 	else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_CENTER )
470cdf0e10cSrcweir 		pTypeBtn = &aCenterTab;
471cdf0e10cSrcweir 
472cdf0e10cSrcweir 	if ( pTypeBtn )
473cdf0e10cSrcweir 		pTypeBtn->Check();
474cdf0e10cSrcweir 
475cdf0e10cSrcweir 	aFillChar.Disable();
476cdf0e10cSrcweir 	aFillChar.SetText( String() );
477cdf0e10cSrcweir 
478cdf0e10cSrcweir 	if ( aAktTab.GetFill() == ' ' )
479cdf0e10cSrcweir 		pFillBtn = &aNoFillChar;
480cdf0e10cSrcweir 	else if ( aAktTab.GetFill() == '-' )
481cdf0e10cSrcweir 		pFillBtn = &aFillDashLine;
482cdf0e10cSrcweir 	else if ( aAktTab.GetFill() == '_' )
483cdf0e10cSrcweir 		pFillBtn = &aFillSolidLine;
484cdf0e10cSrcweir 	else if ( aAktTab.GetFill() == '.' )
485cdf0e10cSrcweir 		pFillBtn = &aFillPoints;
486cdf0e10cSrcweir 	else
487cdf0e10cSrcweir 	{
488cdf0e10cSrcweir 		pFillBtn = &aFillSpecial;
489cdf0e10cSrcweir 		aFillChar.Enable();
490cdf0e10cSrcweir 		aFillChar.SetText( String( (sal_Unicode)aAktTab.GetFill() ) );
491cdf0e10cSrcweir 	}
492cdf0e10cSrcweir 	pFillBtn->Check();
493cdf0e10cSrcweir }
494cdf0e10cSrcweir 
495cdf0e10cSrcweir // -----------------------------------------------------------------------
496cdf0e10cSrcweir 
IMPL_LINK(SvxTabulatorTabPage,NewHdl_Impl,Button *,pBtn)497cdf0e10cSrcweir IMPL_LINK( SvxTabulatorTabPage, NewHdl_Impl, Button *, pBtn )
498cdf0e10cSrcweir {
499cdf0e10cSrcweir 	// Einen neuen Hinzufuegen und Selectieren
500cdf0e10cSrcweir 	// Wert aus der Anzeige holen
501cdf0e10cSrcweir 	long nVal = static_cast<long>(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) ));
502cdf0e10cSrcweir 
503cdf0e10cSrcweir 	// Wenn der pBtn == 0 && der Value == 0 dann keinen Tab Erzeugen
504cdf0e10cSrcweir 	// weil ueber OK erzeugt
505cdf0e10cSrcweir 	if ( nVal == 0 && pBtn == 0 )
506cdf0e10cSrcweir 		return 0;
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 	long nOffset = 0;
509cdf0e10cSrcweir 	const SfxPoolItem* pItem = 0;
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 	if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, sal_True, &pItem ) ==
512cdf0e10cSrcweir 		 SFX_ITEM_SET )
513cdf0e10cSrcweir 	{
514cdf0e10cSrcweir 		nOffset = ( (const SfxInt32Item*)pItem )->GetValue();
515cdf0e10cSrcweir         MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
516cdf0e10cSrcweir         nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM  );
517cdf0e10cSrcweir 	}
518cdf0e10cSrcweir 	const long nReal = nVal - nOffset;
519cdf0e10cSrcweir 	sal_uInt16 nSize = aTabBox.GetEntryCount();
520cdf0e10cSrcweir 
521cdf0e10cSrcweir 	sal_uInt16 i;
522cdf0e10cSrcweir 	for( i = 0; i < nSize; i++ )
523cdf0e10cSrcweir 	{
524cdf0e10cSrcweir 		if ( nReal < aNewTabs[i].GetTabPos() )
525cdf0e10cSrcweir 			break;
526cdf0e10cSrcweir 	}
527cdf0e10cSrcweir 
528cdf0e10cSrcweir 	// ListBox-Eintrag vornehmen
529cdf0e10cSrcweir 	aTabBox.InsertValue( aTabBox.Normalize( nVal ), eDefUnit, i );
530cdf0e10cSrcweir 	aAktTab.GetTabPos() = nReal;
531cdf0e10cSrcweir 	SvxTabAdjust eAdj = SVX_TAB_ADJUST_LEFT;
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 	if ( aRightTab.IsChecked() )
534cdf0e10cSrcweir 		eAdj = SVX_TAB_ADJUST_RIGHT;
535cdf0e10cSrcweir 	else if ( aCenterTab.IsChecked() )
536cdf0e10cSrcweir 		eAdj = SVX_TAB_ADJUST_CENTER;
537cdf0e10cSrcweir 	else if ( aDezTab.IsChecked() )
538cdf0e10cSrcweir 		eAdj = SVX_TAB_ADJUST_DECIMAL;
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 	aAktTab.GetAdjustment() = eAdj;
541cdf0e10cSrcweir 	aNewTabs.Insert( aAktTab );
542cdf0e10cSrcweir 
543cdf0e10cSrcweir 	aNewBtn.Disable();
544cdf0e10cSrcweir 	aDelBtn.Enable();
545cdf0e10cSrcweir 	aTabBox.GrabFocus();
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 	// falls kein RadioButton geclickt wurde,
548cdf0e10cSrcweir 	// muss trotzdem geputtet werden
549cdf0e10cSrcweir 	bCheck |= sal_True;
550cdf0e10cSrcweir     // set the selection into the position Edit
551cdf0e10cSrcweir     aTabBox.SetSelection(Selection(0, aTabBox.GetText().Len()));
552cdf0e10cSrcweir 	return 0;
553cdf0e10cSrcweir }
554cdf0e10cSrcweir 
555cdf0e10cSrcweir // -----------------------------------------------------------------------
556cdf0e10cSrcweir 
IMPL_LINK(SvxTabulatorTabPage,DelHdl_Impl,Button *,EMPTYARG)557cdf0e10cSrcweir IMPL_LINK( SvxTabulatorTabPage, DelHdl_Impl, Button *, EMPTYARG )
558cdf0e10cSrcweir {
559cdf0e10cSrcweir 	sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue() );
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 	if ( nPos == COMBOBOX_ENTRY_NOTFOUND )
562cdf0e10cSrcweir 		return 0;
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 	if ( aTabBox.GetEntryCount() == 1 )
565cdf0e10cSrcweir 	{
566cdf0e10cSrcweir 		DelAllHdl_Impl( 0 );
567cdf0e10cSrcweir 		return 0;
568cdf0e10cSrcweir 	}
569cdf0e10cSrcweir 
570cdf0e10cSrcweir 	// Tab loeschen
571cdf0e10cSrcweir 	aTabBox.RemoveEntry( nPos );
572cdf0e10cSrcweir 	aNewTabs.Remove( nPos );
573cdf0e10cSrcweir 
574cdf0e10cSrcweir 	// aAktTab neu setzen
575cdf0e10cSrcweir 	const sal_uInt16 nSize = aNewTabs.Count();
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 	if ( nSize > 0 )
578cdf0e10cSrcweir 	{
579cdf0e10cSrcweir 		// Pos korrigieren
580cdf0e10cSrcweir 		nPos = ( ( nSize - 1 ) >= nPos) ? nPos : nPos - 1;
581cdf0e10cSrcweir 		aTabBox.SetValue( aTabBox.GetValue( nPos ) );
582cdf0e10cSrcweir 		aAktTab = aNewTabs[nPos];
583cdf0e10cSrcweir 	}
584cdf0e10cSrcweir 
585cdf0e10cSrcweir 	// Falls keine Tabs Enable Disable Controls
586cdf0e10cSrcweir 	if ( aTabBox.GetEntryCount() == 0 )
587cdf0e10cSrcweir 	{
588cdf0e10cSrcweir 		aDelBtn.Disable();
589cdf0e10cSrcweir 		aNewBtn.Enable();
590cdf0e10cSrcweir 		aTabBox.GrabFocus();
591cdf0e10cSrcweir 	}
592cdf0e10cSrcweir 
593cdf0e10cSrcweir 	// falls kein RadioButton geclickt wurde,
594cdf0e10cSrcweir 	// muss trotzdem geputtet werden
595cdf0e10cSrcweir 	bCheck |= sal_True;
596cdf0e10cSrcweir 	return 0;
597cdf0e10cSrcweir }
598cdf0e10cSrcweir 
599cdf0e10cSrcweir // -----------------------------------------------------------------------
600cdf0e10cSrcweir 
IMPL_LINK(SvxTabulatorTabPage,DelAllHdl_Impl,Button *,EMPTYARG)601cdf0e10cSrcweir IMPL_LINK( SvxTabulatorTabPage, DelAllHdl_Impl, Button *, EMPTYARG )
602cdf0e10cSrcweir {
603cdf0e10cSrcweir 	if ( aNewTabs.Count() )
604cdf0e10cSrcweir 	{
605cdf0e10cSrcweir 		aNewTabs = SvxTabStopItem( 0 );
606cdf0e10cSrcweir 		InitTabPos_Impl();
607cdf0e10cSrcweir 
608cdf0e10cSrcweir 		// damit in FillItemSet() geputtet wird
609cdf0e10cSrcweir 		bCheck |= sal_True;
610cdf0e10cSrcweir 	}
611cdf0e10cSrcweir 	return 0;
612cdf0e10cSrcweir }
613cdf0e10cSrcweir 
614cdf0e10cSrcweir // -----------------------------------------------------------------------
615cdf0e10cSrcweir 
IMPL_LINK(SvxTabulatorTabPage,TabTypeCheckHdl_Impl,RadioButton *,pBox)616cdf0e10cSrcweir IMPL_LINK( SvxTabulatorTabPage, TabTypeCheckHdl_Impl, RadioButton *, pBox )
617cdf0e10cSrcweir {
618cdf0e10cSrcweir 	bCheck |= sal_True;
619cdf0e10cSrcweir 	SvxTabAdjust eAdj;
620cdf0e10cSrcweir 	aDezChar.Disable();
621cdf0e10cSrcweir 	aDezCharLabel.Disable();
622cdf0e10cSrcweir 	aDezChar.SetText( String() );
623cdf0e10cSrcweir 
624cdf0e10cSrcweir 	if ( pBox == &aLeftTab )
625cdf0e10cSrcweir 		eAdj = SVX_TAB_ADJUST_LEFT;
626cdf0e10cSrcweir 	else if ( pBox == &aRightTab )
627cdf0e10cSrcweir 		eAdj = SVX_TAB_ADJUST_RIGHT;
628cdf0e10cSrcweir 	else if ( pBox == &aCenterTab )
629cdf0e10cSrcweir 		eAdj = SVX_TAB_ADJUST_CENTER;
630cdf0e10cSrcweir 	else
631cdf0e10cSrcweir 	{
632cdf0e10cSrcweir 		eAdj = SVX_TAB_ADJUST_DECIMAL;
633cdf0e10cSrcweir 		aDezChar.Enable();
634cdf0e10cSrcweir 		aDezCharLabel.Enable();
635cdf0e10cSrcweir 		aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) );
636cdf0e10cSrcweir 	}
637cdf0e10cSrcweir 
638cdf0e10cSrcweir 	aAktTab.GetAdjustment() = eAdj;
639cdf0e10cSrcweir 	sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
640cdf0e10cSrcweir 
641cdf0e10cSrcweir 	if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
642cdf0e10cSrcweir 	{
643cdf0e10cSrcweir 		aNewTabs.Remove( nPos );
644cdf0e10cSrcweir 		aNewTabs.Insert( aAktTab );
645cdf0e10cSrcweir 	}
646cdf0e10cSrcweir 	return 0;
647cdf0e10cSrcweir }
648cdf0e10cSrcweir 
649cdf0e10cSrcweir // -----------------------------------------------------------------------
650cdf0e10cSrcweir 
IMPL_LINK(SvxTabulatorTabPage,FillTypeCheckHdl_Impl,RadioButton *,pBox)651cdf0e10cSrcweir IMPL_LINK( SvxTabulatorTabPage, FillTypeCheckHdl_Impl, RadioButton *, pBox )
652cdf0e10cSrcweir {
653cdf0e10cSrcweir 	bCheck |= sal_True;
654cdf0e10cSrcweir 	sal_uInt8 cFill = ' ';
655cdf0e10cSrcweir 	aFillChar.SetText( String() );
656cdf0e10cSrcweir 	aFillChar.Disable();
657cdf0e10cSrcweir 
658cdf0e10cSrcweir 	if( pBox == &aFillSpecial )
659cdf0e10cSrcweir 		aFillChar.Enable();
660cdf0e10cSrcweir 	else if ( pBox == &aNoFillChar )
661cdf0e10cSrcweir 		cFill = ' ';
662cdf0e10cSrcweir 	else if ( pBox == &aFillSolidLine )
663cdf0e10cSrcweir 		cFill = '_';
664cdf0e10cSrcweir 	else if ( pBox == &aFillPoints )
665cdf0e10cSrcweir 		cFill = '.';
666cdf0e10cSrcweir 	else if ( pBox == &aFillDashLine )
667cdf0e10cSrcweir 		cFill = '-';
668cdf0e10cSrcweir 
669cdf0e10cSrcweir 	aAktTab.GetFill() = cFill;
670cdf0e10cSrcweir 	sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
671cdf0e10cSrcweir 
672cdf0e10cSrcweir 	if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
673cdf0e10cSrcweir 	{
674cdf0e10cSrcweir 		aNewTabs.Remove( nPos );
675cdf0e10cSrcweir 		aNewTabs.Insert( aAktTab );
676cdf0e10cSrcweir 	}
677cdf0e10cSrcweir 	return 0;
678cdf0e10cSrcweir }
679cdf0e10cSrcweir 
680cdf0e10cSrcweir // -----------------------------------------------------------------------
681cdf0e10cSrcweir 
IMPL_LINK(SvxTabulatorTabPage,GetFillCharHdl_Impl,Edit *,pEdit)682cdf0e10cSrcweir IMPL_LINK( SvxTabulatorTabPage, GetFillCharHdl_Impl, Edit *, pEdit )
683cdf0e10cSrcweir {
684cdf0e10cSrcweir 	String aChar( pEdit->GetText() );
685cdf0e10cSrcweir 
686cdf0e10cSrcweir 	if ( aChar.Len() > 0 )
687cdf0e10cSrcweir 		aAktTab.GetFill() = aChar.GetChar( 0 );
688cdf0e10cSrcweir 
689cdf0e10cSrcweir 	const sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit);
690cdf0e10cSrcweir 	if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
691cdf0e10cSrcweir 	{
692cdf0e10cSrcweir 		aNewTabs.Remove( nPos );
693cdf0e10cSrcweir 		aNewTabs.Insert( aAktTab );
694cdf0e10cSrcweir 	}
695cdf0e10cSrcweir 	return 0;
696cdf0e10cSrcweir }
697cdf0e10cSrcweir 
698cdf0e10cSrcweir // -----------------------------------------------------------------------
699cdf0e10cSrcweir 
IMPL_LINK(SvxTabulatorTabPage,GetDezCharHdl_Impl,Edit *,pEdit)700cdf0e10cSrcweir IMPL_LINK( SvxTabulatorTabPage, GetDezCharHdl_Impl, Edit *, pEdit )
701cdf0e10cSrcweir {
702cdf0e10cSrcweir 	String aChar( pEdit->GetText() );
703cdf0e10cSrcweir     if ( aChar.Len() > 0 && ( aChar.GetChar( 0 ) >= ' '))
704cdf0e10cSrcweir 		aAktTab.GetDecimal() = aChar.GetChar( 0 );
705cdf0e10cSrcweir 
706cdf0e10cSrcweir 	sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
707cdf0e10cSrcweir 	if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
708cdf0e10cSrcweir 	{
709cdf0e10cSrcweir 		aNewTabs.Remove( nPos );
710cdf0e10cSrcweir 		aNewTabs.Insert( aAktTab );
711cdf0e10cSrcweir 	}
712cdf0e10cSrcweir 	return 0;
713cdf0e10cSrcweir }
714cdf0e10cSrcweir 
715cdf0e10cSrcweir // -----------------------------------------------------------------------
716cdf0e10cSrcweir 
IMPL_LINK(SvxTabulatorTabPage,SelectHdl_Impl,MetricBox *,EMPTYARG)717cdf0e10cSrcweir IMPL_LINK( SvxTabulatorTabPage, SelectHdl_Impl, MetricBox *, EMPTYARG )
718cdf0e10cSrcweir {
719cdf0e10cSrcweir 	sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
720cdf0e10cSrcweir 	if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
721cdf0e10cSrcweir 	{
722cdf0e10cSrcweir 		aAktTab = aNewTabs[nPos];
723cdf0e10cSrcweir 		aNewBtn.Disable();
724cdf0e10cSrcweir 		SetFillAndTabType_Impl();
725cdf0e10cSrcweir 	}
726cdf0e10cSrcweir 	return 0;
727cdf0e10cSrcweir }
728cdf0e10cSrcweir 
729cdf0e10cSrcweir // -----------------------------------------------------------------------
730cdf0e10cSrcweir 
IMPL_LINK(SvxTabulatorTabPage,ModifyHdl_Impl,MetricBox *,EMPTYARG)731cdf0e10cSrcweir IMPL_LINK( SvxTabulatorTabPage, ModifyHdl_Impl, MetricBox *, EMPTYARG )
732cdf0e10cSrcweir {
733cdf0e10cSrcweir 	sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit );
734cdf0e10cSrcweir 	if ( nPos != COMBOBOX_ENTRY_NOTFOUND )
735cdf0e10cSrcweir 	{
736cdf0e10cSrcweir 		aAktTab = aNewTabs[nPos];
737cdf0e10cSrcweir 		SetFillAndTabType_Impl();
738cdf0e10cSrcweir 
739cdf0e10cSrcweir 		aAktTab.GetTabPos() =
740cdf0e10cSrcweir 			static_cast<long>(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) ));
741cdf0e10cSrcweir 
742cdf0e10cSrcweir 		aNewBtn.Disable();
743cdf0e10cSrcweir 		aDelBtn.Enable();
744cdf0e10cSrcweir 		return 0;
745cdf0e10cSrcweir 	}
746cdf0e10cSrcweir 	aNewBtn.Enable();
747cdf0e10cSrcweir 	aDelBtn.Disable();
748cdf0e10cSrcweir 	return 0;
749cdf0e10cSrcweir }
750cdf0e10cSrcweir //add CHINA001 Begin
PageCreated(SfxAllItemSet aSet)751cdf0e10cSrcweir void		SvxTabulatorTabPage::PageCreated(SfxAllItemSet aSet)
752cdf0e10cSrcweir {
753cdf0e10cSrcweir 	SFX_ITEMSET_ARG	(&aSet,pControlItem,SfxUInt16Item,SID_SVXTABULATORTABPAGE_CONTROLFLAGS,sal_False);
754cdf0e10cSrcweir 	if (pControlItem)
755cdf0e10cSrcweir 		DisableControls(pControlItem->GetValue());
756cdf0e10cSrcweir }
757cdf0e10cSrcweir //end of CHINA001
758