xref: /AOO41X/main/cui/source/tabpages/numfmt.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #if !ENABLE_LAYOUT_EXPERIMENTAL
29*cdf0e10cSrcweir //#undef ENABLE_LAYOUT
30*cdf0e10cSrcweir #endif
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
33*cdf0e10cSrcweir #include "precompiled_cui.hxx"
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir // include ---------------------------------------------------------------
36*cdf0e10cSrcweir #include <svl/eitem.hxx>
37*cdf0e10cSrcweir #include <svl/intitem.hxx>
38*cdf0e10cSrcweir #include <sfx2/objsh.hxx>
39*cdf0e10cSrcweir #include <vcl/svapp.hxx>
40*cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx>
41*cdf0e10cSrcweir #include <i18npool/lang.h>
42*cdf0e10cSrcweir #include <svx/dialogs.hrc>
43*cdf0e10cSrcweir #define _SVSTDARR_STRINGS
44*cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR
45*cdf0e10cSrcweir #include <svl/svstdarr.hxx>
46*cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #define _SVX_NUMFMT_CXX
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #include <cuires.hrc>
51*cdf0e10cSrcweir #include "numfmt.hrc"
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir #include <svx/numinf.hxx>
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir #include "numfmt.hxx"
56*cdf0e10cSrcweir #include <svx/numfmtsh.hxx>
57*cdf0e10cSrcweir #include <dialmgr.hxx>
58*cdf0e10cSrcweir #include <sfx2/request.hxx> //CHINA001
59*cdf0e10cSrcweir #include <sfx2/app.hxx> //CHINA001
60*cdf0e10cSrcweir #include <sfx2/basedlgs.hxx>
61*cdf0e10cSrcweir #include "svx/flagsdef.hxx" //CHINA001
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir #define NUMKEY_UNDEFINED SAL_MAX_UINT32
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir // static ----------------------------------------------------------------
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir static sal_uInt16 pRanges[] =
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir 	SID_ATTR_NUMBERFORMAT_VALUE,
70*cdf0e10cSrcweir 	SID_ATTR_NUMBERFORMAT_INFO,
71*cdf0e10cSrcweir 	SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
72*cdf0e10cSrcweir 	SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
73*cdf0e10cSrcweir     SID_ATTR_NUMBERFORMAT_ONE_AREA,
74*cdf0e10cSrcweir     SID_ATTR_NUMBERFORMAT_ONE_AREA,
75*cdf0e10cSrcweir     SID_ATTR_NUMBERFORMAT_SOURCE,
76*cdf0e10cSrcweir     SID_ATTR_NUMBERFORMAT_SOURCE,
77*cdf0e10cSrcweir 	0
78*cdf0e10cSrcweir };
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir /*************************************************************************
81*cdf0e10cSrcweir #*	Methode:		SvxNumberPreviewImpl					Datum:02.10.97
82*cdf0e10cSrcweir #*------------------------------------------------------------------------
83*cdf0e10cSrcweir #*
84*cdf0e10cSrcweir #*  Klasse:		SvxNumberPreview
85*cdf0e10cSrcweir #*
86*cdf0e10cSrcweir #*  Funktion:	Konstruktor der Klasse SvxNumberPreviewImpl
87*cdf0e10cSrcweir #*
88*cdf0e10cSrcweir #*  Input:		Fenster, Resource-ID
89*cdf0e10cSrcweir #*
90*cdf0e10cSrcweir #*	Output:		---
91*cdf0e10cSrcweir #*
92*cdf0e10cSrcweir #************************************************************************/
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir SvxNumberPreviewImpl::SvxNumberPreviewImpl( Window* pParent, const ResId& rResId ) :
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	Window( pParent, rResId )
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir 	Font aFont( GetFont() );
100*cdf0e10cSrcweir 	aFont.SetTransparent( sal_True );
101*cdf0e10cSrcweir 	aFont.SetColor( Application::GetSettings().GetStyleSettings().GetFieldColor() );
102*cdf0e10cSrcweir 	SetFont( aFont );
103*cdf0e10cSrcweir 	InitSettings( sal_True, sal_True );
104*cdf0e10cSrcweir     SetBorderStyle( WINDOW_BORDER_MONO );
105*cdf0e10cSrcweir }
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir /*************************************************************************
108*cdf0e10cSrcweir #*	Methode:		SvxNumberPreviewImpl					Datum:02.10.97
109*cdf0e10cSrcweir #*------------------------------------------------------------------------
110*cdf0e10cSrcweir #*
111*cdf0e10cSrcweir #*  Klasse:		SvxNumberPreview
112*cdf0e10cSrcweir #*
113*cdf0e10cSrcweir #*  Funktion:	Destruktor der Klasse SvxNumberPreviewImpl
114*cdf0e10cSrcweir #*
115*cdf0e10cSrcweir #*  Input:		---
116*cdf0e10cSrcweir #*
117*cdf0e10cSrcweir #*	Output:		---
118*cdf0e10cSrcweir #*
119*cdf0e10cSrcweir #************************************************************************/
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir SvxNumberPreviewImpl::~SvxNumberPreviewImpl()
122*cdf0e10cSrcweir {
123*cdf0e10cSrcweir }
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir /*************************************************************************
126*cdf0e10cSrcweir #*	Methode:		NotifyChange							Datum:02.10.97
127*cdf0e10cSrcweir #*------------------------------------------------------------------------
128*cdf0e10cSrcweir #*
129*cdf0e10cSrcweir #*  Klasse:		SvxNumberPreviewImpl
130*cdf0e10cSrcweir #*
131*cdf0e10cSrcweir #*  Funktion:	Funktion fuer das Aendern des Preview- Strings
132*cdf0e10cSrcweir #*
133*cdf0e10cSrcweir #*  Input:		String, Farbe
134*cdf0e10cSrcweir #*
135*cdf0e10cSrcweir #*	Output:		---
136*cdf0e10cSrcweir #*
137*cdf0e10cSrcweir #************************************************************************/
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir void SvxNumberPreviewImpl::NotifyChange( const String& rPrevStr,
140*cdf0e10cSrcweir                                          const Color* pColor )
141*cdf0e10cSrcweir {
142*cdf0e10cSrcweir 	aPrevStr = rPrevStr;
143*cdf0e10cSrcweir 	svtools::ColorConfig aColorConfig;
144*cdf0e10cSrcweir 	Color aWindowTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
145*cdf0e10cSrcweir     aPrevCol = pColor ? *pColor : aWindowTextColor;
146*cdf0e10cSrcweir 	Invalidate();
147*cdf0e10cSrcweir 	Update();
148*cdf0e10cSrcweir }
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir /*************************************************************************
151*cdf0e10cSrcweir #*	Methode:		Paint									Datum:02.10.97
152*cdf0e10cSrcweir #*------------------------------------------------------------------------
153*cdf0e10cSrcweir #*
154*cdf0e10cSrcweir #*  Klasse:		SvxNumberPreviewImpl
155*cdf0e10cSrcweir #*
156*cdf0e10cSrcweir #*  Funktion:	Funktion fuer das neu zeichnen des Fensters.
157*cdf0e10cSrcweir #*
158*cdf0e10cSrcweir #*  Input:		---
159*cdf0e10cSrcweir #*
160*cdf0e10cSrcweir #*	Output:		---
161*cdf0e10cSrcweir #*
162*cdf0e10cSrcweir #************************************************************************/
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir void SvxNumberPreviewImpl::Paint( const Rectangle& )
165*cdf0e10cSrcweir {
166*cdf0e10cSrcweir 	Font	aDrawFont	= GetFont();
167*cdf0e10cSrcweir 	Size	aSzWnd		= GetOutputSizePixel();
168*cdf0e10cSrcweir 	Point	aPosText	= Point( (aSzWnd.Width()  - GetTextWidth( aPrevStr )) /2,
169*cdf0e10cSrcweir 								 (aSzWnd.Height() - GetTextHeight())/2 );
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	aDrawFont.SetColor( aPrevCol );
172*cdf0e10cSrcweir 	SetFont( aDrawFont );
173*cdf0e10cSrcweir 	DrawText( aPosText, aPrevStr );
174*cdf0e10cSrcweir }
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir // -----------------------------------------------------------------------
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir void SvxNumberPreviewImpl::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
179*cdf0e10cSrcweir {
180*cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 	if ( bForeground )
183*cdf0e10cSrcweir 	{
184*cdf0e10cSrcweir 		svtools::ColorConfig aColorConfig;
185*cdf0e10cSrcweir 		Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 		if ( IsControlForeground() )
188*cdf0e10cSrcweir 			aTextColor = GetControlForeground();
189*cdf0e10cSrcweir 		SetTextColor( aTextColor );
190*cdf0e10cSrcweir 	}
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 	if ( bBackground )
193*cdf0e10cSrcweir 	{
194*cdf0e10cSrcweir 		if ( IsControlBackground() )
195*cdf0e10cSrcweir 			SetBackground( GetControlBackground() );
196*cdf0e10cSrcweir 		else
197*cdf0e10cSrcweir 			SetBackground( rStyleSettings.GetWindowColor() );
198*cdf0e10cSrcweir 	}
199*cdf0e10cSrcweir 	Invalidate();
200*cdf0e10cSrcweir }
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir // -----------------------------------------------------------------------
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir void SvxNumberPreviewImpl::StateChanged( StateChangedType nType )
205*cdf0e10cSrcweir {
206*cdf0e10cSrcweir 	if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
207*cdf0e10cSrcweir 		InitSettings( sal_True, sal_False );
208*cdf0e10cSrcweir 	else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
209*cdf0e10cSrcweir 		InitSettings( sal_False, sal_True );
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 	Window::StateChanged( nType );
212*cdf0e10cSrcweir }
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir // -----------------------------------------------------------------------
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir void SvxNumberPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt )
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir 	Window::DataChanged( rDCEvt );
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir 	if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
221*cdf0e10cSrcweir 		InitSettings( sal_True, sal_True );
222*cdf0e10cSrcweir }
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir // class SvxNumberFormatTabPage ------------------------------------------
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir #define REMOVE_DONTKNOW() \
227*cdf0e10cSrcweir 	if ( !aFtLanguage.IsEnabled() )										\
228*cdf0e10cSrcweir 	{																	\
229*cdf0e10cSrcweir 		aFtLanguage	.Enable();											\
230*cdf0e10cSrcweir 		aLbLanguage	.Enable();											\
231*cdf0e10cSrcweir 		aLbLanguage	.SelectLanguage( pNumFmtShell->GetCurLanguage() );	\
232*cdf0e10cSrcweir 	}
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir #define HDL(hdl) LINK( this, SvxNumberFormatTabPage, hdl )
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir #include <layout/layout-pre.hxx>
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir #if ENABLE_LAYOUT
239*cdf0e10cSrcweir #undef CUI_RES
240*cdf0e10cSrcweir #define CUI_RES(x) #x
241*cdf0e10cSrcweir #define CUI_RES_PLAIN(x) ResId (x, CUI_MGR ())
242*cdf0e10cSrcweir #define THIS_CUI_RES(x) this, #x
243*cdf0e10cSrcweir #undef SfxTabPage
244*cdf0e10cSrcweir #define SfxTabPage( parent, id, args ) SfxTabPage( parent, "number-format.xml", id, &args )
245*cdf0e10cSrcweir #else /* !ENABLE_LAYOUT */
246*cdf0e10cSrcweir #define CUI_RES_PLAIN CUI_RES
247*cdf0e10cSrcweir #define THIS_CUI_RES CUI_RES
248*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT */
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir SvxNumberFormatTabPage::SvxNumberFormatTabPage( Window*				pParent,
251*cdf0e10cSrcweir 												const SfxItemSet&	rCoreAttrs )
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 	:	SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_NUMBERFORMAT ), rCoreAttrs ),
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir         aFtCategory     ( this, CUI_RES( FT_CATEGORY ) ),
256*cdf0e10cSrcweir 		aLbCategory		( this, CUI_RES( LB_CATEGORY ) ),
257*cdf0e10cSrcweir 		aFtFormat		( this, CUI_RES( FT_FORMAT ) ),
258*cdf0e10cSrcweir 		aLbCurrency		( this, CUI_RES( LB_CURRENCY) ),
259*cdf0e10cSrcweir 		aLbFormat		( this, CUI_RES( LB_FORMAT ) ),
260*cdf0e10cSrcweir         aFtLanguage     ( this, CUI_RES( FT_LANGUAGE ) ),
261*cdf0e10cSrcweir         aLbLanguage     ( this, CUI_RES( LB_LANGUAGE ), sal_False ),
262*cdf0e10cSrcweir         aCbSourceFormat ( this, CUI_RES( CB_SOURCEFORMAT ) ),
263*cdf0e10cSrcweir #if ENABLE_LAYOUT
264*cdf0e10cSrcweir 		aWndPreview     ( LAYOUT_THIS_WINDOW(this), CUI_RES_PLAIN( WND_NUMBER_PREVIEW ) ),
265*cdf0e10cSrcweir #else
266*cdf0e10cSrcweir 		aWndPreview     ( this, CUI_RES_PLAIN( WND_NUMBER_PREVIEW ) ),
267*cdf0e10cSrcweir #endif
268*cdf0e10cSrcweir         aFlOptions      ( this, CUI_RES( FL_OPTIONS ) ),
269*cdf0e10cSrcweir         aFtDecimals     ( this, CUI_RES( FT_DECIMALS ) ),
270*cdf0e10cSrcweir         aEdDecimals     ( this, CUI_RES( ED_DECIMALS ) ),
271*cdf0e10cSrcweir         aBtnNegRed      ( this, CUI_RES( BTN_NEGRED ) ),
272*cdf0e10cSrcweir         aFtLeadZeroes   ( this, CUI_RES( FT_LEADZEROES ) ),
273*cdf0e10cSrcweir         aEdLeadZeroes   ( this, CUI_RES( ED_LEADZEROES ) ),
274*cdf0e10cSrcweir         aBtnThousand    ( this, CUI_RES( BTN_THOUSAND ) ),
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir         aFtEdFormat     ( this, CUI_RES( FT_EDFORMAT ) ),
277*cdf0e10cSrcweir 		aEdFormat		( this, CUI_RES( ED_FORMAT ) ),
278*cdf0e10cSrcweir         aIbAdd          ( this, CUI_RES( IB_ADD       ) ),
279*cdf0e10cSrcweir         aIbInfo         ( this, CUI_RES( IB_INFO      ) ),
280*cdf0e10cSrcweir         aIbRemove       ( this, CUI_RES( IB_REMOVE    ) ),
281*cdf0e10cSrcweir         aFtComment      ( this, CUI_RES( FT_COMMENT ) ),
282*cdf0e10cSrcweir         aEdComment      ( this, CUI_RES( ED_COMMENT ) ),
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir         pNumItem        ( NULL ),
285*cdf0e10cSrcweir         pNumFmtShell    ( NULL ),
286*cdf0e10cSrcweir         nInitFormat     ( ULONG_MAX ),
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir         sAutomaticEntry ( THIS_CUI_RES( STR_AUTO_ENTRY)),
289*cdf0e10cSrcweir         pLastActivWindow( NULL )
290*cdf0e10cSrcweir {
291*cdf0e10cSrcweir #if ENABLE_LAYOUT
292*cdf0e10cSrcweir     aLbFormat.Clear ();
293*cdf0e10cSrcweir #endif /* ENABLE_LAYOUT */
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 	Init_Impl();
296*cdf0e10cSrcweir 	SetExchangeSupport(); // diese Page braucht ExchangeSupport
297*cdf0e10cSrcweir 	FreeResource();
298*cdf0e10cSrcweir 	nFixedCategory=-1;
299*cdf0e10cSrcweir }
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir SvxNumberFormatTabPage::~SvxNumberFormatTabPage()
302*cdf0e10cSrcweir {
303*cdf0e10cSrcweir 	delete pNumFmtShell;
304*cdf0e10cSrcweir 	delete pNumItem;
305*cdf0e10cSrcweir }
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir void SvxNumberFormatTabPage::Init_Impl()
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir 	ImageList				aIconList( CUI_RES_PLAIN ( IL_ICON ) );
310*cdf0e10cSrcweir 	ImageList				aIconListHC( CUI_RES_PLAIN ( IL_ICON_HC ) );
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir 	bNumItemFlag=sal_True;
313*cdf0e10cSrcweir 	bOneAreaFlag=sal_False;
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 	nCatHeight=aLbCategory.GetSizePixel().Height();
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 	nCurFormatY		=aLbFormat.GetPosPixel().Y();
318*cdf0e10cSrcweir 	nCurFormatHeight=aLbFormat.GetSizePixel().Height();
319*cdf0e10cSrcweir 	nStdFormatY		=aLbCurrency.GetPosPixel().Y();
320*cdf0e10cSrcweir 	nStdFormatHeight=nCurFormatY-nStdFormatY+nCurFormatHeight;
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 	aIbAdd.		SetModeImage( aIconList.GetImage( IID_ADD ) );
323*cdf0e10cSrcweir 	aIbAdd.		SetModeImage( aIconListHC.GetImage( IID_ADD ), BMP_COLOR_HIGHCONTRAST );
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir 	aIbRemove.	SetModeImage( aIconList.GetImage( IID_REMOVE ) );
326*cdf0e10cSrcweir 	aIbRemove.	SetModeImage( aIconListHC.GetImage( IID_REMOVE ), BMP_COLOR_HIGHCONTRAST );
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir 	aIbInfo.	SetModeImage( aIconList.GetImage( IID_INFO ) );
329*cdf0e10cSrcweir 	aIbInfo.	SetModeImage( aIconListHC.GetImage( IID_INFO ), BMP_COLOR_HIGHCONTRAST );
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir 	aIbAdd.Enable(sal_False );
332*cdf0e10cSrcweir 	aIbRemove.Enable(sal_False );
333*cdf0e10cSrcweir 	aIbInfo.Enable(sal_False );
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir 	aEdComment.SetText(aLbCategory.GetEntry(1));	//String fuer Benutzerdefiniert
336*cdf0e10cSrcweir 														//holen
337*cdf0e10cSrcweir 	aEdComment.Hide();
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir     aCbSourceFormat.Check( sal_False );
340*cdf0e10cSrcweir     aCbSourceFormat.Disable();
341*cdf0e10cSrcweir     aCbSourceFormat.Hide();
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir // Handler verbinden
344*cdf0e10cSrcweir 	Link aLink = LINK( this, SvxNumberFormatTabPage, SelFormatHdl_Impl );
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir 	aLbCategory		.SetSelectHdl( aLink );
347*cdf0e10cSrcweir 	aLbFormat		.SetSelectHdl( aLink );
348*cdf0e10cSrcweir 	aLbLanguage		.SetSelectHdl( aLink );
349*cdf0e10cSrcweir 	aLbCurrency		.SetSelectHdl( aLink );
350*cdf0e10cSrcweir     aCbSourceFormat .SetClickHdl( aLink );
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 	aLink = LINK( this, SvxNumberFormatTabPage, OptHdl_Impl );
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir 	aEdDecimals		.SetModifyHdl( aLink );
355*cdf0e10cSrcweir 	aEdLeadZeroes	.SetModifyHdl( aLink );
356*cdf0e10cSrcweir 	aBtnNegRed		.SetClickHdl( aLink );
357*cdf0e10cSrcweir 	aBtnThousand	.SetClickHdl( aLink );
358*cdf0e10cSrcweir 	aLbFormat		.SetDoubleClickHdl( HDL( DoubleClickHdl_Impl ) );
359*cdf0e10cSrcweir 	aEdFormat		.SetModifyHdl( HDL( EditHdl_Impl ) );
360*cdf0e10cSrcweir 	aIbAdd.SetClickHdl( HDL( ClickHdl_Impl ) );
361*cdf0e10cSrcweir 	aIbRemove.SetClickHdl( HDL( ClickHdl_Impl ) );
362*cdf0e10cSrcweir 	aIbInfo.SetClickHdl( HDL( ClickHdl_Impl ) );
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir 	aLink = LINK( this, SvxNumberFormatTabPage, LostFocusHdl_Impl);
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir 	aEdComment		.SetLoseFocusHdl( aLink);
367*cdf0e10cSrcweir 	aResetWinTimer	.SetTimeoutHdl(LINK( this, SvxNumberFormatTabPage, TimeHdl_Impl));
368*cdf0e10cSrcweir 	aResetWinTimer	.SetTimeout( 10);
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir 	// Sprachen-ListBox initialisieren
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir 	aLbLanguage.InsertLanguage( LANGUAGE_SYSTEM );
373*cdf0e10cSrcweir 	// Don't list ambiguous locales where we won't be able to convert the
374*cdf0e10cSrcweir 	// LanguageType back to an identical Language_Country name and therefore
375*cdf0e10cSrcweir 	// couldn't load the i18n LocaleData. Show DebugMsg in non-PRODUCT version.
376*cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< sal_uInt16 > xLang =
377*cdf0e10cSrcweir 		LocaleDataWrapper::getInstalledLanguageTypes();
378*cdf0e10cSrcweir 	sal_Int32 nCount = xLang.getLength();
379*cdf0e10cSrcweir 	for ( sal_Int32 i=0; i<nCount; i++ )
380*cdf0e10cSrcweir 	{
381*cdf0e10cSrcweir 		aLbLanguage.InsertLanguage( xLang[i] );
382*cdf0e10cSrcweir 	}
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 	aIbAdd.SetAccessibleRelationLabeledBy( &aFtEdFormat );
385*cdf0e10cSrcweir 	aIbInfo.SetAccessibleRelationLabeledBy( &aFtEdFormat );
386*cdf0e10cSrcweir 	aIbRemove.SetAccessibleRelationLabeledBy( &aFtEdFormat );
387*cdf0e10cSrcweir 	aIbAdd.SetAccessibleRelationMemberOf( &aIbAdd );
388*cdf0e10cSrcweir 	aIbInfo.SetAccessibleRelationMemberOf( &aIbInfo );
389*cdf0e10cSrcweir 	aIbRemove.SetAccessibleRelationMemberOf( &aIbRemove );
390*cdf0e10cSrcweir }
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir /*************************************************************************
393*cdf0e10cSrcweir #*	Methode:		GetRanges								Datum:02.10.97
394*cdf0e10cSrcweir #*------------------------------------------------------------------------
395*cdf0e10cSrcweir #*
396*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
397*cdf0e10cSrcweir #*
398*cdf0e10cSrcweir #*  Funktion:	Liefert Bereichsangaben zurueck.
399*cdf0e10cSrcweir #*
400*cdf0e10cSrcweir #*  Input:		---
401*cdf0e10cSrcweir #*
402*cdf0e10cSrcweir #*	Output:		Bereich
403*cdf0e10cSrcweir #*
404*cdf0e10cSrcweir #************************************************************************/
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir sal_uInt16* SvxNumberFormatTabPage::GetRanges()
407*cdf0e10cSrcweir {
408*cdf0e10cSrcweir 	return pRanges;
409*cdf0e10cSrcweir }
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir /*************************************************************************
413*cdf0e10cSrcweir #*	Methode:		Create									Datum:02.10.97
414*cdf0e10cSrcweir #*------------------------------------------------------------------------
415*cdf0e10cSrcweir #*
416*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
417*cdf0e10cSrcweir #*
418*cdf0e10cSrcweir #*  Funktion:	Erzeugt eine neue Zahlenformat- Seite.
419*cdf0e10cSrcweir #*
420*cdf0e10cSrcweir #*  Input:		Fenster, SfxItemSet
421*cdf0e10cSrcweir #*
422*cdf0e10cSrcweir #*	Output:		neue TabPage
423*cdf0e10cSrcweir #*
424*cdf0e10cSrcweir #************************************************************************/
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir SfxTabPage*	SvxNumberFormatTabPage::Create( Window* pParent,
427*cdf0e10cSrcweir 											const SfxItemSet& rAttrSet )
428*cdf0e10cSrcweir {
429*cdf0e10cSrcweir 	return ( new SvxNumberFormatTabPage( pParent, rAttrSet ) );
430*cdf0e10cSrcweir }
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir 
433*cdf0e10cSrcweir /*************************************************************************
434*cdf0e10cSrcweir #*	Methode:		Reset									Datum:02.10.97
435*cdf0e10cSrcweir #*------------------------------------------------------------------------
436*cdf0e10cSrcweir #*
437*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
438*cdf0e10cSrcweir #*
439*cdf0e10cSrcweir #*  Funktion:	Die Attribute des Dialogs werden mit Hilfe
440*cdf0e10cSrcweir #*				des Itemsets neu eingestellt.
441*cdf0e10cSrcweir #*
442*cdf0e10cSrcweir #*  Input:		SfxItemSet
443*cdf0e10cSrcweir #*
444*cdf0e10cSrcweir #*	Output:		---
445*cdf0e10cSrcweir #*
446*cdf0e10cSrcweir #************************************************************************/
447*cdf0e10cSrcweir 
448*cdf0e10cSrcweir void SvxNumberFormatTabPage::Reset( const SfxItemSet& rSet )
449*cdf0e10cSrcweir {
450*cdf0e10cSrcweir 	const SfxUInt32Item*		pValFmtAttr		= NULL;
451*cdf0e10cSrcweir 	const SfxPoolItem*			pItem			= NULL;
452*cdf0e10cSrcweir     const SfxBoolItem*          pAutoEntryAttr = NULL;
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir 	sal_uInt16						nCatLbSelPos	= 0;
455*cdf0e10cSrcweir 	sal_uInt16						nFmtLbSelPos	= 0;
456*cdf0e10cSrcweir 	LanguageType				eLangType		= LANGUAGE_DONTKNOW;
457*cdf0e10cSrcweir 	SvxDelStrgs					aFmtEntryList;
458*cdf0e10cSrcweir 	SvxNumberValueType			eValType		= SVX_VALUE_TYPE_UNDEFINED;
459*cdf0e10cSrcweir 	double						nValDouble		= 0;
460*cdf0e10cSrcweir 	String						aValString;
461*cdf0e10cSrcweir 	SfxItemState				eState			= SFX_ITEM_DONTCARE;
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir 	eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_NOLANGUAGE ),sal_True,&pItem);
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 	if(eState==SFX_ITEM_SET)
467*cdf0e10cSrcweir 	{
468*cdf0e10cSrcweir         const SfxBoolItem* pBoolLangItem = (const SfxBoolItem*)
469*cdf0e10cSrcweir 					  GetItem( rSet, SID_ATTR_NUMBERFORMAT_NOLANGUAGE);
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir 		if(pBoolLangItem!=NULL && pBoolLangItem->GetValue())
472*cdf0e10cSrcweir 		{
473*cdf0e10cSrcweir 			HideLanguage();
474*cdf0e10cSrcweir 		}
475*cdf0e10cSrcweir 		else
476*cdf0e10cSrcweir 		{
477*cdf0e10cSrcweir 			HideLanguage(sal_False);
478*cdf0e10cSrcweir 		}
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir 	}
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir 	eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_INFO ),sal_True,&pItem);
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir 	if(eState==SFX_ITEM_SET)
485*cdf0e10cSrcweir 	{
486*cdf0e10cSrcweir 		if(pNumItem==NULL)
487*cdf0e10cSrcweir 		{
488*cdf0e10cSrcweir 			bNumItemFlag=sal_True;
489*cdf0e10cSrcweir 			pNumItem= (SvxNumberInfoItem *) pItem->Clone();
490*cdf0e10cSrcweir 		}
491*cdf0e10cSrcweir 		else
492*cdf0e10cSrcweir 		{
493*cdf0e10cSrcweir 			bNumItemFlag=sal_False;
494*cdf0e10cSrcweir 		}
495*cdf0e10cSrcweir 	}
496*cdf0e10cSrcweir 	else
497*cdf0e10cSrcweir 	{
498*cdf0e10cSrcweir 		bNumItemFlag=sal_False;
499*cdf0e10cSrcweir 	}
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir 	eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ONE_AREA ));
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir 	if(eState==SFX_ITEM_SET)
505*cdf0e10cSrcweir 	{
506*cdf0e10cSrcweir         const SfxBoolItem* pBoolItem = (const SfxBoolItem*)
507*cdf0e10cSrcweir 					  GetItem( rSet, SID_ATTR_NUMBERFORMAT_ONE_AREA);
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir 		if(pBoolItem!=NULL)
510*cdf0e10cSrcweir 		{
511*cdf0e10cSrcweir 			bOneAreaFlag= pBoolItem->GetValue();
512*cdf0e10cSrcweir 		}
513*cdf0e10cSrcweir 	}
514*cdf0e10cSrcweir 	//bOneAreaFlag=sal_True; //@@ Debug-Test
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir     eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE ) );
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir     if ( eState == SFX_ITEM_SET )
519*cdf0e10cSrcweir 	{
520*cdf0e10cSrcweir         const SfxBoolItem* pBoolItem = (const SfxBoolItem*)
521*cdf0e10cSrcweir                       GetItem( rSet, SID_ATTR_NUMBERFORMAT_SOURCE );
522*cdf0e10cSrcweir         if ( pBoolItem )
523*cdf0e10cSrcweir             aCbSourceFormat.Check( pBoolItem->GetValue() );
524*cdf0e10cSrcweir         else
525*cdf0e10cSrcweir             aCbSourceFormat.Check( sal_False );
526*cdf0e10cSrcweir         aCbSourceFormat.Enable();
527*cdf0e10cSrcweir         aCbSourceFormat.Show();
528*cdf0e10cSrcweir 	}
529*cdf0e10cSrcweir     else
530*cdf0e10cSrcweir     {
531*cdf0e10cSrcweir         sal_Bool bInit = sal_False;     // set to sal_True for debug test
532*cdf0e10cSrcweir         aCbSourceFormat.Check( bInit );
533*cdf0e10cSrcweir         aCbSourceFormat.Enable( bInit );
534*cdf0e10cSrcweir         aCbSourceFormat.Show( bInit );
535*cdf0e10cSrcweir     }
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir 	// pNumItem muss von aussen gesetzt worden sein!
538*cdf0e10cSrcweir 	DBG_ASSERT( pNumItem, "No NumberInfo, no NumberFormatter, good bye.CRASH. :-(" );
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir 	// aktuellen Zahlenformat-Tabellenindex holen
541*cdf0e10cSrcweir 	eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ) );
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir 	if ( SFX_ITEM_DONTCARE != eState )
544*cdf0e10cSrcweir 		pValFmtAttr = (const SfxUInt32Item*)
545*cdf0e10cSrcweir 					  GetItem( rSet, SID_ATTR_NUMBERFORMAT_VALUE );
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir 	eValType = pNumItem->GetValueType();
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir 	switch ( eValType )
550*cdf0e10cSrcweir 	{
551*cdf0e10cSrcweir 		case SVX_VALUE_TYPE_STRING:
552*cdf0e10cSrcweir 			aValString = pNumItem->GetValueString();
553*cdf0e10cSrcweir 			break;
554*cdf0e10cSrcweir 		case SVX_VALUE_TYPE_NUMBER:
555*cdf0e10cSrcweir 			//	#50441# string may be set in addition to the value
556*cdf0e10cSrcweir 			aValString = pNumItem->GetValueString();
557*cdf0e10cSrcweir 			nValDouble = pNumItem->GetValueDouble();
558*cdf0e10cSrcweir 			break;
559*cdf0e10cSrcweir 		case SVX_VALUE_TYPE_UNDEFINED:
560*cdf0e10cSrcweir 		default:
561*cdf0e10cSrcweir 			break;
562*cdf0e10cSrcweir 	}
563*cdf0e10cSrcweir 
564*cdf0e10cSrcweir 	// nun sind alle Informationen fuer die Formatierer-Shell beisammen:
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir 	if ( pNumFmtShell )
567*cdf0e10cSrcweir 		 delete pNumFmtShell;	// ggF. alte Shell loeschen (==Reset)
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir 	nInitFormat = ( pValFmtAttr )				// Init-Key merken
570*cdf0e10cSrcweir 					? pValFmtAttr->GetValue()	// (fuer FillItemSet())
571*cdf0e10cSrcweir 					: ULONG_MAX;				// == DONT_KNOW
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir 
574*cdf0e10cSrcweir 	if ( eValType == SVX_VALUE_TYPE_STRING )
575*cdf0e10cSrcweir 		pNumFmtShell =SvxNumberFormatShell::Create(
576*cdf0e10cSrcweir 								pNumItem->GetNumberFormatter(),
577*cdf0e10cSrcweir 								(pValFmtAttr) ? nInitFormat : 0L,
578*cdf0e10cSrcweir 								eValType,
579*cdf0e10cSrcweir 								aValString );
580*cdf0e10cSrcweir 	else
581*cdf0e10cSrcweir 		pNumFmtShell =SvxNumberFormatShell::Create(
582*cdf0e10cSrcweir 								pNumItem->GetNumberFormatter(),
583*cdf0e10cSrcweir 								(pValFmtAttr) ? nInitFormat : 0L,
584*cdf0e10cSrcweir 								eValType,
585*cdf0e10cSrcweir 								nValDouble,
586*cdf0e10cSrcweir 								&aValString );
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir 	FillCurrencyBox();
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir     String aPrevString;
591*cdf0e10cSrcweir     Color* pDummy = NULL;
592*cdf0e10cSrcweir     pNumFmtShell->GetInitSettings( nCatLbSelPos, eLangType, nFmtLbSelPos,
593*cdf0e10cSrcweir                                    aFmtEntryList, aPrevString, pDummy );
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir 	aLbCurrency.SelectEntryPos((sal_uInt16)pNumFmtShell->GetCurrencySymbol());
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir 	nFixedCategory=nCatLbSelPos;
598*cdf0e10cSrcweir 	if(bOneAreaFlag)
599*cdf0e10cSrcweir 	{
600*cdf0e10cSrcweir         String sFixedCategory=aLbCategory.GetEntry(nFixedCategory);
601*cdf0e10cSrcweir 		aLbCategory.Clear();
602*cdf0e10cSrcweir         aLbCategory.InsertEntry(sFixedCategory);
603*cdf0e10cSrcweir 		SetCategory(0);
604*cdf0e10cSrcweir 	}
605*cdf0e10cSrcweir 	else
606*cdf0e10cSrcweir 	{
607*cdf0e10cSrcweir 		SetCategory(nCatLbSelPos );
608*cdf0e10cSrcweir 	}
609*cdf0e10cSrcweir     eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ADD_AUTO ) );
610*cdf0e10cSrcweir     if(SFX_ITEM_SET == eState)
611*cdf0e10cSrcweir          pAutoEntryAttr = (const SfxBoolItem*)
612*cdf0e10cSrcweir                       GetItem( rSet, SID_ATTR_NUMBERFORMAT_ADD_AUTO );
613*cdf0e10cSrcweir     // no_NO is an alias for nb_NO and normally isn't listed, we need it for
614*cdf0e10cSrcweir     // backwards compatibility, but only if the format passed is of
615*cdf0e10cSrcweir     // LanguageType no_NO.
616*cdf0e10cSrcweir     if ( eLangType == LANGUAGE_NORWEGIAN )
617*cdf0e10cSrcweir     {
618*cdf0e10cSrcweir         aLbLanguage.RemoveLanguage( eLangType );    // in case we're already called
619*cdf0e10cSrcweir         aLbLanguage.InsertLanguage( eLangType );
620*cdf0e10cSrcweir     }
621*cdf0e10cSrcweir     aLbLanguage.SelectLanguage( eLangType );
622*cdf0e10cSrcweir     if(pAutoEntryAttr)
623*cdf0e10cSrcweir         AddAutomaticLanguage_Impl(eLangType, pAutoEntryAttr->GetValue());
624*cdf0e10cSrcweir 	UpdateFormatListBox_Impl(sal_False,sal_True);
625*cdf0e10cSrcweir 
626*cdf0e10cSrcweir //! erAck 26.01.01
627*cdf0e10cSrcweir //! This spoils everything because it rematches currency formats based on
628*cdf0e10cSrcweir //! the selected aLbCurrency entry instead of the current format.
629*cdf0e10cSrcweir //! Besides that everything seems to be initialized by now, so why call it?
630*cdf0e10cSrcweir //	SelFormatHdl_Impl( &aLbCategory );
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir     if ( pValFmtAttr )
633*cdf0e10cSrcweir 	{
634*cdf0e10cSrcweir 		EditHdl_Impl( &aEdFormat ); // UpdateOptions_Impl() als Seiteneffekt
635*cdf0e10cSrcweir 	}
636*cdf0e10cSrcweir 	else	// DONT_KNOW
637*cdf0e10cSrcweir 	{
638*cdf0e10cSrcweir 		// Kategoriewechsel und direkte Eingabe sind moeglich, sonst nix:
639*cdf0e10cSrcweir 		Obstructing();
640*cdf0e10cSrcweir 	}
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir     if ( aCbSourceFormat.IsChecked() )
643*cdf0e10cSrcweir     {
644*cdf0e10cSrcweir         // everything disabled except SourceFormat checkbox
645*cdf0e10cSrcweir         EnableBySourceFormat_Impl();
646*cdf0e10cSrcweir     }
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir 	DeleteEntryList_Impl(aFmtEntryList);
649*cdf0e10cSrcweir }
650*cdf0e10cSrcweir 
651*cdf0e10cSrcweir /*************************************************************************
652*cdf0e10cSrcweir #*	Methode:		Obstructing								Datum:02.10.97
653*cdf0e10cSrcweir #*------------------------------------------------------------------------
654*cdf0e10cSrcweir #*
655*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
656*cdf0e10cSrcweir #*
657*cdf0e10cSrcweir #*  Funktion:	Sperren der Controls mit Ausnahme von Kategoriewechsel
658*cdf0e10cSrcweir #*				und direkter Eingabe.
659*cdf0e10cSrcweir #*
660*cdf0e10cSrcweir #*  Input:		---
661*cdf0e10cSrcweir #*
662*cdf0e10cSrcweir #*	Output:		---
663*cdf0e10cSrcweir #*
664*cdf0e10cSrcweir #************************************************************************/
665*cdf0e10cSrcweir void SvxNumberFormatTabPage::Obstructing()
666*cdf0e10cSrcweir {
667*cdf0e10cSrcweir 	aLbFormat		.SetNoSelection();
668*cdf0e10cSrcweir 	aLbLanguage		.SetNoSelection();
669*cdf0e10cSrcweir 	aFtLanguage		.Disable();
670*cdf0e10cSrcweir 	aLbLanguage		.Disable();
671*cdf0e10cSrcweir 
672*cdf0e10cSrcweir 	aIbAdd.Enable(sal_False );
673*cdf0e10cSrcweir 	aIbRemove.Enable(sal_False );
674*cdf0e10cSrcweir 	aIbInfo.Enable(sal_False );
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir 	aBtnNegRed		.Disable();
677*cdf0e10cSrcweir 	aBtnThousand	.Disable();
678*cdf0e10cSrcweir 	aFtLeadZeroes	.Disable();
679*cdf0e10cSrcweir 	aFtDecimals		.Disable();
680*cdf0e10cSrcweir 	aEdLeadZeroes	.Disable();
681*cdf0e10cSrcweir 	aEdDecimals		.Disable();
682*cdf0e10cSrcweir 	aFlOptions		.Disable();
683*cdf0e10cSrcweir 	aEdDecimals		.SetText( String() );
684*cdf0e10cSrcweir 	aEdLeadZeroes	.SetText( String() );
685*cdf0e10cSrcweir 	aBtnNegRed		.Check( sal_False );
686*cdf0e10cSrcweir 	aBtnThousand	.Check( sal_False );
687*cdf0e10cSrcweir     aWndPreview     .NotifyChange( String() );
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir 	aLbCategory		.SelectEntryPos( 0 );
690*cdf0e10cSrcweir 	aEdFormat		.SetText( String() );
691*cdf0e10cSrcweir 	aFtComment		.SetText( String() );
692*cdf0e10cSrcweir 	aEdComment		.SetText(aLbCategory.GetEntry(1));	//String fuer Benutzerdefiniert
693*cdf0e10cSrcweir 														//holen
694*cdf0e10cSrcweir 
695*cdf0e10cSrcweir 	aEdFormat		.GrabFocus();
696*cdf0e10cSrcweir }
697*cdf0e10cSrcweir 
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir /*************************************************************************
700*cdf0e10cSrcweir #* Enable/Disable dialog parts depending on the value of the SourceFormat
701*cdf0e10cSrcweir #* checkbox.
702*cdf0e10cSrcweir #************************************************************************/
703*cdf0e10cSrcweir void SvxNumberFormatTabPage::EnableBySourceFormat_Impl()
704*cdf0e10cSrcweir {
705*cdf0e10cSrcweir     sal_Bool bEnable = !aCbSourceFormat.IsChecked();
706*cdf0e10cSrcweir     if ( !bEnable )
707*cdf0e10cSrcweir         aCbSourceFormat.GrabFocus();
708*cdf0e10cSrcweir     aFtCategory     .Enable( bEnable );
709*cdf0e10cSrcweir     aLbCategory     .Enable( bEnable );
710*cdf0e10cSrcweir     aFtFormat       .Enable( bEnable );
711*cdf0e10cSrcweir     aLbCurrency     .Enable( bEnable );
712*cdf0e10cSrcweir     aLbFormat       .Enable( bEnable );
713*cdf0e10cSrcweir     aFtLanguage     .Enable( bEnable );
714*cdf0e10cSrcweir     aLbLanguage     .Enable( bEnable );
715*cdf0e10cSrcweir     aFtDecimals     .Enable( bEnable );
716*cdf0e10cSrcweir     aEdDecimals     .Enable( bEnable );
717*cdf0e10cSrcweir     aFtLeadZeroes   .Enable( bEnable );
718*cdf0e10cSrcweir     aEdLeadZeroes   .Enable( bEnable );
719*cdf0e10cSrcweir     aBtnNegRed      .Enable( bEnable );
720*cdf0e10cSrcweir     aBtnThousand    .Enable( bEnable );
721*cdf0e10cSrcweir     aFlOptions      .Enable( bEnable );
722*cdf0e10cSrcweir     aFtEdFormat     .Enable( bEnable );
723*cdf0e10cSrcweir     aEdFormat       .Enable( bEnable );
724*cdf0e10cSrcweir     aIbAdd          .Enable( bEnable );
725*cdf0e10cSrcweir     aIbRemove       .Enable( bEnable );
726*cdf0e10cSrcweir     aIbInfo         .Enable( bEnable );
727*cdf0e10cSrcweir     aFtComment      .Enable( bEnable );
728*cdf0e10cSrcweir     aEdComment      .Enable( bEnable );
729*cdf0e10cSrcweir     aLbFormat.Invalidate(); // #i43322#
730*cdf0e10cSrcweir }
731*cdf0e10cSrcweir 
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir /*************************************************************************
734*cdf0e10cSrcweir #*	Methode:	HideLanguage								Datum:14.05.98
735*cdf0e10cSrcweir #*------------------------------------------------------------------------
736*cdf0e10cSrcweir #*
737*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
738*cdf0e10cSrcweir #*
739*cdf0e10cSrcweir #*  Funktion:	Versteckt die Spracheinstellung:
740*cdf0e10cSrcweir #*
741*cdf0e10cSrcweir #*  Input:		sal_Bool nFlag
742*cdf0e10cSrcweir #*
743*cdf0e10cSrcweir #*	Output:		---
744*cdf0e10cSrcweir #*
745*cdf0e10cSrcweir #************************************************************************/
746*cdf0e10cSrcweir 
747*cdf0e10cSrcweir void SvxNumberFormatTabPage::HideLanguage(sal_Bool nFlag)
748*cdf0e10cSrcweir {
749*cdf0e10cSrcweir 	Size aSize=aLbCategory.GetSizePixel();
750*cdf0e10cSrcweir 
751*cdf0e10cSrcweir 	if(nFlag)
752*cdf0e10cSrcweir 	{
753*cdf0e10cSrcweir 		aSize.Height()=aLbFormat.GetSizePixel().Height();
754*cdf0e10cSrcweir 	}
755*cdf0e10cSrcweir 	else
756*cdf0e10cSrcweir 	{
757*cdf0e10cSrcweir 		aSize.Height()=nCatHeight;
758*cdf0e10cSrcweir 	}
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir 	aLbCategory.SetSizePixel(aSize);
761*cdf0e10cSrcweir 
762*cdf0e10cSrcweir 	aFtLanguage.Show(!nFlag);
763*cdf0e10cSrcweir 	aLbLanguage.Show(!nFlag);
764*cdf0e10cSrcweir }
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir /*************************************************************************
767*cdf0e10cSrcweir #*	Methode:		FillItemSet								Datum:02.10.97
768*cdf0e10cSrcweir #*------------------------------------------------------------------------
769*cdf0e10cSrcweir #*
770*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
771*cdf0e10cSrcweir #*
772*cdf0e10cSrcweir #*  Funktion:	Stellt die Attribute im ItemSet ein,
773*cdf0e10cSrcweir #*				sowie in der DocShell den numItem, wenn
774*cdf0e10cSrcweir #*				bNumItemFlag nicht gesetzt ist.
775*cdf0e10cSrcweir #*
776*cdf0e10cSrcweir #*  Input:		SfxItemSet
777*cdf0e10cSrcweir #*
778*cdf0e10cSrcweir #*	Output:		---
779*cdf0e10cSrcweir #*
780*cdf0e10cSrcweir #************************************************************************/
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir sal_Bool SvxNumberFormatTabPage::FillItemSet( SfxItemSet& rCoreAttrs )
783*cdf0e10cSrcweir {
784*cdf0e10cSrcweir     sal_Bool bDataChanged   = aFtLanguage.IsEnabled() || aCbSourceFormat.IsEnabled();
785*cdf0e10cSrcweir 	if ( bDataChanged )
786*cdf0e10cSrcweir 	{
787*cdf0e10cSrcweir         const SfxItemSet& rMyItemSet = GetItemSet();
788*cdf0e10cSrcweir 		sal_uInt16			nWhich		 = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE );
789*cdf0e10cSrcweir         SfxItemState    eItemState   = rMyItemSet.GetItemState( nWhich, sal_False );
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir         // OK chosen - Is format code input entered already taken over?
792*cdf0e10cSrcweir         // If not, simulate Add. Upon syntax error ignore input and prevent Put.
793*cdf0e10cSrcweir 		String		aFormat	= aEdFormat.GetText();
794*cdf0e10cSrcweir 		sal_uInt32 nCurKey = pNumFmtShell->GetCurNumFmtKey();
795*cdf0e10cSrcweir 
796*cdf0e10cSrcweir         if ( aIbAdd.IsEnabled() || pNumFmtShell->IsTmpCurrencyFormat(aFormat) )
797*cdf0e10cSrcweir         {   // #79599# It is not sufficient to just add the format code (or
798*cdf0e10cSrcweir             // delete it in case of bOneAreaFlag and resulting category change).
799*cdf0e10cSrcweir             // Upon switching tab pages we need all settings to be consistent
800*cdf0e10cSrcweir             // in case this page will be redisplayed later.
801*cdf0e10cSrcweir             bDataChanged = (ClickHdl_Impl( &aIbAdd ) != 0);
802*cdf0e10cSrcweir 			nCurKey = pNumFmtShell->GetCurNumFmtKey();
803*cdf0e10cSrcweir         }
804*cdf0e10cSrcweir         else if(nCurKey == NUMKEY_UNDEFINED)
805*cdf0e10cSrcweir         {   // something went wrong, e.g. in Writer #70281#
806*cdf0e10cSrcweir 			pNumFmtShell->FindEntry(aFormat, &nCurKey);
807*cdf0e10cSrcweir 		}
808*cdf0e10cSrcweir 
809*cdf0e10cSrcweir 		//---------------------------------------------------------------
810*cdf0e10cSrcweir         // Chosen format:
811*cdf0e10cSrcweir         // --------------
812*cdf0e10cSrcweir 		if ( bDataChanged )
813*cdf0e10cSrcweir 		{
814*cdf0e10cSrcweir 			bDataChanged = ( nInitFormat != nCurKey );
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir 			if (bDataChanged)
817*cdf0e10cSrcweir 			{
818*cdf0e10cSrcweir 				rCoreAttrs.Put( SfxUInt32Item( nWhich, nCurKey ) );
819*cdf0e10cSrcweir 			}
820*cdf0e10cSrcweir 			else if(SFX_ITEM_DEFAULT == eItemState)
821*cdf0e10cSrcweir 			{
822*cdf0e10cSrcweir 				rCoreAttrs.ClearItem( nWhich );
823*cdf0e10cSrcweir 			}
824*cdf0e10cSrcweir 		}
825*cdf0e10cSrcweir 
826*cdf0e10cSrcweir 		// --------------------------------------------------------------
827*cdf0e10cSrcweir         // List of changed user defined formats:
828*cdf0e10cSrcweir         // -------------------------------------
829*cdf0e10cSrcweir 		const sal_uInt32 nDelCount = pNumFmtShell->GetUpdateDataCount();
830*cdf0e10cSrcweir 
831*cdf0e10cSrcweir 		if ( nDelCount > 0 )
832*cdf0e10cSrcweir 		{
833*cdf0e10cSrcweir 			sal_uInt32*			pDelArr = new sal_uInt32[nDelCount];
834*cdf0e10cSrcweir 
835*cdf0e10cSrcweir 			pNumFmtShell->GetUpdateData( pDelArr, nDelCount );
836*cdf0e10cSrcweir 			pNumItem->SetDelFormatArray( pDelArr, nDelCount );
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir 			if(bNumItemFlag==sal_True)
839*cdf0e10cSrcweir 			{
840*cdf0e10cSrcweir 				rCoreAttrs.Put( *pNumItem );
841*cdf0e10cSrcweir 			}
842*cdf0e10cSrcweir 			else
843*cdf0e10cSrcweir 			{
844*cdf0e10cSrcweir 				SfxObjectShell*	pDocSh  = SfxObjectShell::Current();
845*cdf0e10cSrcweir 
846*cdf0e10cSrcweir 				DBG_ASSERT( pDocSh, "DocShell not found!" );
847*cdf0e10cSrcweir 
848*cdf0e10cSrcweir 
849*cdf0e10cSrcweir 				if ( pDocSh )
850*cdf0e10cSrcweir 					pDocSh->PutItem( *pNumItem );
851*cdf0e10cSrcweir 			}
852*cdf0e10cSrcweir 			delete [] pDelArr;
853*cdf0e10cSrcweir 		}
854*cdf0e10cSrcweir 
855*cdf0e10cSrcweir 		//---------------------------------------------------------------
856*cdf0e10cSrcweir         // Whether source format is to be taken or not:
857*cdf0e10cSrcweir         // --------------------------------------------
858*cdf0e10cSrcweir         if ( aCbSourceFormat.IsEnabled() )
859*cdf0e10cSrcweir         {
860*cdf0e10cSrcweir             sal_uInt16 _nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE );
861*cdf0e10cSrcweir             SfxItemState _eItemState = rMyItemSet.GetItemState( _nWhich, sal_False );
862*cdf0e10cSrcweir             const SfxBoolItem* pBoolItem = (const SfxBoolItem*)
863*cdf0e10cSrcweir                         GetItem( rMyItemSet, SID_ATTR_NUMBERFORMAT_SOURCE );
864*cdf0e10cSrcweir             sal_Bool bOld = (pBoolItem ? pBoolItem->GetValue() : sal_False);
865*cdf0e10cSrcweir             rCoreAttrs.Put( SfxBoolItem( _nWhich, aCbSourceFormat.IsChecked() ) );
866*cdf0e10cSrcweir             if ( !bDataChanged )
867*cdf0e10cSrcweir                 bDataChanged = (bOld != (sal_Bool) aCbSourceFormat.IsChecked() ||
868*cdf0e10cSrcweir                     _eItemState != SFX_ITEM_SET);
869*cdf0e10cSrcweir         }
870*cdf0e10cSrcweir 
871*cdf0e10cSrcweir         // FillItemSet is only called on OK, here we can notify the
872*cdf0e10cSrcweir         // NumberFormatShell that all new user defined formats are valid.
873*cdf0e10cSrcweir 		pNumFmtShell->ValidateNewEntries();
874*cdf0e10cSrcweir         if(aLbLanguage.IsVisible() &&
875*cdf0e10cSrcweir                 LISTBOX_ENTRY_NOTFOUND != aLbLanguage.GetEntryPos(sAutomaticEntry))
876*cdf0e10cSrcweir                 rCoreAttrs.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO,
877*cdf0e10cSrcweir                     aLbLanguage.GetSelectEntry() == sAutomaticEntry));
878*cdf0e10cSrcweir 	}
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir 	return bDataChanged;
881*cdf0e10cSrcweir }
882*cdf0e10cSrcweir 
883*cdf0e10cSrcweir 
884*cdf0e10cSrcweir int SvxNumberFormatTabPage::DeactivatePage( SfxItemSet* _pSet )
885*cdf0e10cSrcweir {
886*cdf0e10cSrcweir /*  if ( (ULONG_MAX != nInitFormat) && _pSet )
887*cdf0e10cSrcweir 	{
888*cdf0e10cSrcweir 		const sal_uLong  nCurKey    = pNumFmtShell->GetCurNumFmtKey();
889*cdf0e10cSrcweir 		const sal_uInt16 nWhich     = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE );
890*cdf0e10cSrcweir 		SfxItemState eItemState	= GetItemSet().GetItemState( nWhich, sal_False );
891*cdf0e10cSrcweir 
892*cdf0e10cSrcweir 		if ( (nInitFormat == nCurKey) && (SFX_ITEM_DEFAULT == eItemState) )
893*cdf0e10cSrcweir             _pSet->ClearItem( nWhich );
894*cdf0e10cSrcweir 		else
895*cdf0e10cSrcweir             _pSet->Put( SfxUInt32Item( nWhich, nCurKey ) );
896*cdf0e10cSrcweir 	}
897*cdf0e10cSrcweir  */
898*cdf0e10cSrcweir     if ( _pSet )
899*cdf0e10cSrcweir         FillItemSet( *_pSet );
900*cdf0e10cSrcweir 	return LEAVE_PAGE;
901*cdf0e10cSrcweir }
902*cdf0e10cSrcweir 
903*cdf0e10cSrcweir void SvxNumberFormatTabPage::SetInfoItem( const SvxNumberInfoItem& rItem )
904*cdf0e10cSrcweir {
905*cdf0e10cSrcweir 	if(pNumItem==NULL)
906*cdf0e10cSrcweir 	{
907*cdf0e10cSrcweir 		pNumItem = (SvxNumberInfoItem*)rItem.Clone();
908*cdf0e10cSrcweir 	}
909*cdf0e10cSrcweir }
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir void SvxNumberFormatTabPage::FillFormatListBox_Impl( SvxDelStrgs& rEntries )
912*cdf0e10cSrcweir {
913*cdf0e10cSrcweir 	String*		pEntry;
914*cdf0e10cSrcweir 	String		aTmpString;
915*cdf0e10cSrcweir 	String		aTmpCatString;
916*cdf0e10cSrcweir 	Font		aFont=aLbCategory.GetFont();
917*cdf0e10cSrcweir 	sal_uInt16		i = 0;
918*cdf0e10cSrcweir 	short		nTmpCatPos;
919*cdf0e10cSrcweir 	short		aPrivCat;
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir 	aLbFormat.Clear();
922*cdf0e10cSrcweir 	aLbFormat.SetUpdateMode( sal_False );
923*cdf0e10cSrcweir 
924*cdf0e10cSrcweir 	sal_uInt16  nCount = rEntries.Count();
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir 	if(nCount<1) return;
927*cdf0e10cSrcweir 
928*cdf0e10cSrcweir 	if(bOneAreaFlag)
929*cdf0e10cSrcweir 	{
930*cdf0e10cSrcweir 		nTmpCatPos=nFixedCategory;
931*cdf0e10cSrcweir 	}
932*cdf0e10cSrcweir 	else
933*cdf0e10cSrcweir 	{
934*cdf0e10cSrcweir 		nTmpCatPos=aLbCategory.GetSelectEntryPos();
935*cdf0e10cSrcweir 	}
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir 	switch (nTmpCatPos)
938*cdf0e10cSrcweir 	{
939*cdf0e10cSrcweir 		case CAT_ALL:
940*cdf0e10cSrcweir 		case CAT_TEXT:
941*cdf0e10cSrcweir 		case CAT_NUMBER:		i=1;
942*cdf0e10cSrcweir 								pEntry=rEntries[0];
943*cdf0e10cSrcweir 								if(pEntry!=NULL)
944*cdf0e10cSrcweir 								{
945*cdf0e10cSrcweir                                     if (nTmpCatPos == CAT_TEXT)
946*cdf0e10cSrcweir                                         aTmpString=*pEntry;
947*cdf0e10cSrcweir                                     else
948*cdf0e10cSrcweir                                         aTmpString = pNumFmtShell->GetStandardName();
949*cdf0e10cSrcweir 									aPrivCat=pNumFmtShell->GetCategory4Entry(0);
950*cdf0e10cSrcweir                                     aLbFormat.InsertFontEntry( aTmpString, aFont );
951*cdf0e10cSrcweir 								}
952*cdf0e10cSrcweir 								break;
953*cdf0e10cSrcweir 
954*cdf0e10cSrcweir 		default:				break;
955*cdf0e10cSrcweir 	}
956*cdf0e10cSrcweir 
957*cdf0e10cSrcweir 	if(pNumFmtShell!=NULL)
958*cdf0e10cSrcweir 	{
959*cdf0e10cSrcweir 		for ( ; i < nCount; ++i )
960*cdf0e10cSrcweir 		{
961*cdf0e10cSrcweir 			pEntry = rEntries[i];
962*cdf0e10cSrcweir 			aPrivCat=pNumFmtShell->GetCategory4Entry(i);
963*cdf0e10cSrcweir 			if(aPrivCat!=CAT_TEXT)
964*cdf0e10cSrcweir 			{
965*cdf0e10cSrcweir                 Color* pPreviewColor = NULL;
966*cdf0e10cSrcweir                 String aPreviewString( GetExpColorString( pPreviewColor, *pEntry, aPrivCat ) );
967*cdf0e10cSrcweir                 Font aEntryFont( aLbFormat.GetFont() );
968*cdf0e10cSrcweir                 aLbFormat.InsertFontEntry( aPreviewString, aEntryFont, pPreviewColor );
969*cdf0e10cSrcweir 			}
970*cdf0e10cSrcweir 			else
971*cdf0e10cSrcweir 			{
972*cdf0e10cSrcweir 				aLbFormat.InsertFontEntry(*pEntry,aFont);
973*cdf0e10cSrcweir 			}
974*cdf0e10cSrcweir 		}
975*cdf0e10cSrcweir 	}
976*cdf0e10cSrcweir 	aLbFormat.SetUpdateMode( sal_True );
977*cdf0e10cSrcweir 	DeleteEntryList_Impl(rEntries);
978*cdf0e10cSrcweir }
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir 
981*cdf0e10cSrcweir /*************************************************************************
982*cdf0e10cSrcweir #*	Methode:		DeleteEntryList_Impl					Datum:02.10.97
983*cdf0e10cSrcweir #*------------------------------------------------------------------------
984*cdf0e10cSrcweir #*
985*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
986*cdf0e10cSrcweir #*
987*cdf0e10cSrcweir #*  Funktion:	Loescht eine SvStrings- Liste
988*cdf0e10cSrcweir #*
989*cdf0e10cSrcweir #*  Input:		String-liste
990*cdf0e10cSrcweir #*
991*cdf0e10cSrcweir #*	Output:		---
992*cdf0e10cSrcweir #*
993*cdf0e10cSrcweir #************************************************************************/
994*cdf0e10cSrcweir 
995*cdf0e10cSrcweir void SvxNumberFormatTabPage::DeleteEntryList_Impl( SvxDelStrgs& rEntries )
996*cdf0e10cSrcweir {
997*cdf0e10cSrcweir 	sal_uInt16  nCount = rEntries.Count();
998*cdf0e10cSrcweir 	rEntries.DeleteAndDestroy(0,nCount);
999*cdf0e10cSrcweir }
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir 
1002*cdf0e10cSrcweir /*************************************************************************
1003*cdf0e10cSrcweir #*	Methode:		UpdateOptions_Impl						Datum:02.10.97
1004*cdf0e10cSrcweir #*------------------------------------------------------------------------
1005*cdf0e10cSrcweir #*
1006*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1007*cdf0e10cSrcweir #*
1008*cdf0e10cSrcweir #*  Funktion:	Stellt je nach eingestelltem Format die Options-
1009*cdf0e10cSrcweir #*				attribute neu ein.
1010*cdf0e10cSrcweir #*
1011*cdf0e10cSrcweir #*  Input:		Flag, ob sich die Kategorie geaendert hat.
1012*cdf0e10cSrcweir #*
1013*cdf0e10cSrcweir #*	Output:		---
1014*cdf0e10cSrcweir #*
1015*cdf0e10cSrcweir #***?********************************************************************/
1016*cdf0e10cSrcweir 
1017*cdf0e10cSrcweir void SvxNumberFormatTabPage::UpdateOptions_Impl( sal_Bool bCheckCatChange /*= sal_False*/ )
1018*cdf0e10cSrcweir {
1019*cdf0e10cSrcweir 	SvxDelStrgs	aEntryList;
1020*cdf0e10cSrcweir 	String	theFormat			= aEdFormat.GetText();
1021*cdf0e10cSrcweir 	sal_uInt16	nCurCategory		= aLbCategory.GetSelectEntryPos();
1022*cdf0e10cSrcweir 	sal_uInt16  nCategory			= nCurCategory;
1023*cdf0e10cSrcweir 	sal_uInt16	nDecimals			= 0;
1024*cdf0e10cSrcweir 	sal_uInt16	nZeroes				= 0;
1025*cdf0e10cSrcweir 	sal_Bool	bNegRed				= sal_False;
1026*cdf0e10cSrcweir 	sal_Bool	bThousand			= sal_False;
1027*cdf0e10cSrcweir 	short	nTmpCatPos;
1028*cdf0e10cSrcweir 	sal_uInt16	nCurrencyPos		=aLbCurrency.GetSelectEntryPos();
1029*cdf0e10cSrcweir 
1030*cdf0e10cSrcweir 	if(bOneAreaFlag)
1031*cdf0e10cSrcweir 	{
1032*cdf0e10cSrcweir 		nTmpCatPos=nFixedCategory;
1033*cdf0e10cSrcweir 		nCurCategory=nFixedCategory;
1034*cdf0e10cSrcweir 	}
1035*cdf0e10cSrcweir 	else
1036*cdf0e10cSrcweir 	{
1037*cdf0e10cSrcweir 		nTmpCatPos=nCurCategory;
1038*cdf0e10cSrcweir 	}
1039*cdf0e10cSrcweir 
1040*cdf0e10cSrcweir 
1041*cdf0e10cSrcweir 	pNumFmtShell->GetOptions( theFormat,
1042*cdf0e10cSrcweir 							  bThousand, bNegRed,
1043*cdf0e10cSrcweir 							  nDecimals, nZeroes,
1044*cdf0e10cSrcweir 							  nCategory );
1045*cdf0e10cSrcweir 	sal_Bool bDoIt=sal_False;
1046*cdf0e10cSrcweir 	if(nCategory==CAT_CURRENCY)
1047*cdf0e10cSrcweir 	{
1048*cdf0e10cSrcweir 		sal_uInt16 nTstPos=pNumFmtShell->FindCurrencyFormat(theFormat);
1049*cdf0e10cSrcweir 		if(nCurrencyPos!=nTstPos && nTstPos!=(sal_uInt16)-1)
1050*cdf0e10cSrcweir 		{
1051*cdf0e10cSrcweir 			aLbCurrency.SelectEntryPos(nTstPos);
1052*cdf0e10cSrcweir 			pNumFmtShell->SetCurrencySymbol(nTstPos);
1053*cdf0e10cSrcweir 			bDoIt=sal_True;
1054*cdf0e10cSrcweir 		}
1055*cdf0e10cSrcweir 	}
1056*cdf0e10cSrcweir 
1057*cdf0e10cSrcweir 
1058*cdf0e10cSrcweir 
1059*cdf0e10cSrcweir 	if ( nCategory != nCurCategory || bDoIt)
1060*cdf0e10cSrcweir 	{
1061*cdf0e10cSrcweir 		if ( bCheckCatChange )
1062*cdf0e10cSrcweir 		{
1063*cdf0e10cSrcweir 			if(bOneAreaFlag)
1064*cdf0e10cSrcweir 				SetCategory(0);
1065*cdf0e10cSrcweir 			else
1066*cdf0e10cSrcweir 				SetCategory(nCategory );
1067*cdf0e10cSrcweir 
1068*cdf0e10cSrcweir 			UpdateFormatListBox_Impl( sal_True, sal_False );
1069*cdf0e10cSrcweir 		}
1070*cdf0e10cSrcweir 	}
1071*cdf0e10cSrcweir 	else if ( aLbFormat.GetEntryCount() > 0 )
1072*cdf0e10cSrcweir 	{
1073*cdf0e10cSrcweir 		sal_uInt32 nCurEntryKey=NUMKEY_UNDEFINED;
1074*cdf0e10cSrcweir 		if(!pNumFmtShell->FindEntry( aEdFormat.GetText(),&nCurEntryKey))
1075*cdf0e10cSrcweir 		{
1076*cdf0e10cSrcweir 			aLbFormat.SetNoSelection();
1077*cdf0e10cSrcweir 		}
1078*cdf0e10cSrcweir 	}
1079*cdf0e10cSrcweir 	if(bOneAreaFlag)
1080*cdf0e10cSrcweir 	{
1081*cdf0e10cSrcweir 		nCategory=nFixedCategory;
1082*cdf0e10cSrcweir 	}
1083*cdf0e10cSrcweir 
1084*cdf0e10cSrcweir 	switch ( nCategory )
1085*cdf0e10cSrcweir 	{
1086*cdf0e10cSrcweir 		case CAT_NUMBER:
1087*cdf0e10cSrcweir 		case CAT_PERCENT:
1088*cdf0e10cSrcweir 		case CAT_CURRENCY:
1089*cdf0e10cSrcweir 			aFlOptions.Enable();
1090*cdf0e10cSrcweir 			aFtDecimals.Enable();
1091*cdf0e10cSrcweir 			aEdDecimals.Enable();
1092*cdf0e10cSrcweir 			aFtLeadZeroes.Enable();
1093*cdf0e10cSrcweir 			aEdLeadZeroes.Enable();
1094*cdf0e10cSrcweir 			aBtnNegRed.Enable();
1095*cdf0e10cSrcweir 			aBtnThousand.Enable();
1096*cdf0e10cSrcweir 			/*
1097*cdf0e10cSrcweir 			aEdDecimals	 .SetValue( nDecimals );
1098*cdf0e10cSrcweir 			aEdLeadZeroes.SetValue( nZeroes );
1099*cdf0e10cSrcweir 			*/
1100*cdf0e10cSrcweir 			aEdDecimals	 .SetText( UniString::CreateFromInt32( nDecimals ) );
1101*cdf0e10cSrcweir 			aEdLeadZeroes.SetText( UniString::CreateFromInt32( nZeroes ) );
1102*cdf0e10cSrcweir 			aBtnNegRed	 .Check( bNegRed );
1103*cdf0e10cSrcweir 			aBtnThousand .Check( bThousand );
1104*cdf0e10cSrcweir 			break;
1105*cdf0e10cSrcweir 
1106*cdf0e10cSrcweir 		case CAT_ALL:
1107*cdf0e10cSrcweir 		case CAT_USERDEFINED:
1108*cdf0e10cSrcweir 		case CAT_TEXT:
1109*cdf0e10cSrcweir 		case CAT_DATE:
1110*cdf0e10cSrcweir 		case CAT_TIME:
1111*cdf0e10cSrcweir 		case CAT_BOOLEAN:
1112*cdf0e10cSrcweir 		case CAT_SCIENTIFIC:
1113*cdf0e10cSrcweir 		case CAT_FRACTION:
1114*cdf0e10cSrcweir 		default:
1115*cdf0e10cSrcweir 			aFlOptions		.Disable();
1116*cdf0e10cSrcweir 			aFtDecimals		.Disable();
1117*cdf0e10cSrcweir 			aEdDecimals		.Disable();
1118*cdf0e10cSrcweir 			aFtLeadZeroes	.Disable();
1119*cdf0e10cSrcweir 			aEdLeadZeroes	.Disable();
1120*cdf0e10cSrcweir 			aBtnNegRed		.Disable();
1121*cdf0e10cSrcweir 			aBtnThousand	.Disable();
1122*cdf0e10cSrcweir 			aEdDecimals		.SetText( UniString::CreateFromInt32( 0 ) );
1123*cdf0e10cSrcweir 			aEdLeadZeroes	.SetText( UniString::CreateFromInt32( 0 ) );
1124*cdf0e10cSrcweir 			aBtnNegRed		.Check( sal_False );
1125*cdf0e10cSrcweir 			aBtnThousand	.Check( sal_False );
1126*cdf0e10cSrcweir 	}
1127*cdf0e10cSrcweir }
1128*cdf0e10cSrcweir 
1129*cdf0e10cSrcweir 
1130*cdf0e10cSrcweir /*************************************************************************
1131*cdf0e10cSrcweir #*	Methode:		UpdateFormatListBox_Impl				Datum:02.10.97
1132*cdf0e10cSrcweir #*------------------------------------------------------------------------
1133*cdf0e10cSrcweir #*
1134*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1135*cdf0e10cSrcweir #*
1136*cdf0e10cSrcweir #*  Funktion:	Aktualisiert die Format- Listbox und zusaetzlich
1137*cdf0e10cSrcweir #*				wird abhaengig vom bUpdateEdit- Flag der String
1138*cdf0e10cSrcweir #*				in der Editbox geaendert.
1139*cdf0e10cSrcweir #*
1140*cdf0e10cSrcweir #*  Input:		Flags fuer Kategorie und Editbox
1141*cdf0e10cSrcweir #*
1142*cdf0e10cSrcweir #*	Output:		---
1143*cdf0e10cSrcweir #*
1144*cdf0e10cSrcweir #************************************************************************/
1145*cdf0e10cSrcweir 
1146*cdf0e10cSrcweir void SvxNumberFormatTabPage::UpdateFormatListBox_Impl
1147*cdf0e10cSrcweir 	(
1148*cdf0e10cSrcweir 		sal_uInt16 bCat,		// Category oder Land/Sprache ListBox?
1149*cdf0e10cSrcweir 		sal_Bool   bUpdateEdit	// Format-Edit aktualisieren?
1150*cdf0e10cSrcweir 	)
1151*cdf0e10cSrcweir {
1152*cdf0e10cSrcweir 	SvxDelStrgs	aEntryList;
1153*cdf0e10cSrcweir 	short		nFmtLbSelPos = 0;
1154*cdf0e10cSrcweir 	short		nTmpCatPos;
1155*cdf0e10cSrcweir 
1156*cdf0e10cSrcweir 	if(bOneAreaFlag)
1157*cdf0e10cSrcweir 	{
1158*cdf0e10cSrcweir 		nTmpCatPos=nFixedCategory;
1159*cdf0e10cSrcweir 	}
1160*cdf0e10cSrcweir 	else
1161*cdf0e10cSrcweir 	{
1162*cdf0e10cSrcweir 		nTmpCatPos=aLbCategory.GetSelectEntryPos();
1163*cdf0e10cSrcweir 	}
1164*cdf0e10cSrcweir 
1165*cdf0e10cSrcweir 
1166*cdf0e10cSrcweir 	if ( bCat )
1167*cdf0e10cSrcweir 	{
1168*cdf0e10cSrcweir 		Point aPos=aLbFormat.GetPosPixel();
1169*cdf0e10cSrcweir 		Size  aSize=aLbFormat.GetSizePixel();
1170*cdf0e10cSrcweir 
1171*cdf0e10cSrcweir 		if(nTmpCatPos!=CAT_CURRENCY)
1172*cdf0e10cSrcweir 		{
1173*cdf0e10cSrcweir 			aPos.Y()=nStdFormatY;
1174*cdf0e10cSrcweir 			aSize.Height()=nStdFormatHeight;
1175*cdf0e10cSrcweir 			aLbFormat.SetPosSizePixel(aPos,aSize);
1176*cdf0e10cSrcweir #if ENABLE_LAYOUT
1177*cdf0e10cSrcweir 			aLbCurrency.Disable();
1178*cdf0e10cSrcweir #else /* !ENABLE_LAYOUT */
1179*cdf0e10cSrcweir 			aLbCurrency.Hide();
1180*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT */
1181*cdf0e10cSrcweir 		}
1182*cdf0e10cSrcweir 		else
1183*cdf0e10cSrcweir 		{
1184*cdf0e10cSrcweir 			aPos.Y()=nCurFormatY;
1185*cdf0e10cSrcweir 			aSize.Height()=nCurFormatHeight;
1186*cdf0e10cSrcweir 			aLbFormat.SetPosSizePixel(aPos,aSize);
1187*cdf0e10cSrcweir #if ENABLE_LAYOUT
1188*cdf0e10cSrcweir 			aLbCurrency.Enable();
1189*cdf0e10cSrcweir #else /* !ENABLE_LAYOUT */
1190*cdf0e10cSrcweir 			aLbCurrency.Show();
1191*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT */
1192*cdf0e10cSrcweir 		}
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir 		pNumFmtShell->CategoryChanged( nTmpCatPos,nFmtLbSelPos, aEntryList );
1195*cdf0e10cSrcweir 	}
1196*cdf0e10cSrcweir 	else
1197*cdf0e10cSrcweir 		pNumFmtShell->LanguageChanged( aLbLanguage.GetSelectLanguage(),
1198*cdf0e10cSrcweir 									   nFmtLbSelPos,aEntryList );
1199*cdf0e10cSrcweir 
1200*cdf0e10cSrcweir 	REMOVE_DONTKNOW() // ggF. UI-Enable
1201*cdf0e10cSrcweir 
1202*cdf0e10cSrcweir 
1203*cdf0e10cSrcweir 	if ( (aEntryList.Count() > 0) && (nFmtLbSelPos != SELPOS_NONE) )
1204*cdf0e10cSrcweir 	{
1205*cdf0e10cSrcweir 		if(bUpdateEdit)
1206*cdf0e10cSrcweir 		{
1207*cdf0e10cSrcweir 			String aFormat=*aEntryList[nFmtLbSelPos];
1208*cdf0e10cSrcweir 			aEdFormat.SetText(aFormat);
1209*cdf0e10cSrcweir 			aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos));
1210*cdf0e10cSrcweir 
1211*cdf0e10cSrcweir 			//@23.09.97 aEdFormat.SetText( aLbFormat.GetSelectEntry() );
1212*cdf0e10cSrcweir 		}
1213*cdf0e10cSrcweir 
1214*cdf0e10cSrcweir 		if(!bOneAreaFlag || !bCat)
1215*cdf0e10cSrcweir 		{
1216*cdf0e10cSrcweir 			FillFormatListBox_Impl( aEntryList );
1217*cdf0e10cSrcweir 			aLbFormat.SelectEntryPos( nFmtLbSelPos );
1218*cdf0e10cSrcweir 
1219*cdf0e10cSrcweir 			aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos));
1220*cdf0e10cSrcweir 			if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos))
1221*cdf0e10cSrcweir 			{
1222*cdf0e10cSrcweir 				if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0)
1223*cdf0e10cSrcweir 				{
1224*cdf0e10cSrcweir 					aFtComment.SetText(aLbCategory.GetEntry(1));
1225*cdf0e10cSrcweir 				}
1226*cdf0e10cSrcweir 			}
1227*cdf0e10cSrcweir             ChangePreviewText( (sal_uInt16)nFmtLbSelPos );
1228*cdf0e10cSrcweir 		}
1229*cdf0e10cSrcweir 
1230*cdf0e10cSrcweir 	}
1231*cdf0e10cSrcweir 	else
1232*cdf0e10cSrcweir 	{
1233*cdf0e10cSrcweir 		FillFormatListBox_Impl( aEntryList );
1234*cdf0e10cSrcweir 		if(nFmtLbSelPos != SELPOS_NONE)
1235*cdf0e10cSrcweir 		{
1236*cdf0e10cSrcweir 			aLbFormat.SelectEntryPos( (sal_uInt16)nFmtLbSelPos );
1237*cdf0e10cSrcweir 
1238*cdf0e10cSrcweir 			aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos));
1239*cdf0e10cSrcweir 			if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos))
1240*cdf0e10cSrcweir 			{
1241*cdf0e10cSrcweir 				if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0)
1242*cdf0e10cSrcweir 				{
1243*cdf0e10cSrcweir 					aFtComment.SetText(aLbCategory.GetEntry(1));
1244*cdf0e10cSrcweir 				}
1245*cdf0e10cSrcweir 			}
1246*cdf0e10cSrcweir 		}
1247*cdf0e10cSrcweir 		else
1248*cdf0e10cSrcweir 		{
1249*cdf0e10cSrcweir 			aLbFormat.SetNoSelection();
1250*cdf0e10cSrcweir 		}
1251*cdf0e10cSrcweir 
1252*cdf0e10cSrcweir 		if ( bUpdateEdit )
1253*cdf0e10cSrcweir 		{
1254*cdf0e10cSrcweir 			aEdFormat.SetText( String() );
1255*cdf0e10cSrcweir             aWndPreview.NotifyChange( String() );
1256*cdf0e10cSrcweir 		}
1257*cdf0e10cSrcweir 	}
1258*cdf0e10cSrcweir }
1259*cdf0e10cSrcweir 
1260*cdf0e10cSrcweir 
1261*cdf0e10cSrcweir /*************************************************************************
1262*cdf0e10cSrcweir #*	Handle:		DoubleClickHdl_Impl							Datum:02.10.97
1263*cdf0e10cSrcweir #*------------------------------------------------------------------------
1264*cdf0e10cSrcweir #*
1265*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1266*cdf0e10cSrcweir #*
1267*cdf0e10cSrcweir #*  Funktion:	Bei einem Doppelklick in die Format- Listbox
1268*cdf0e10cSrcweir #*				wird der Wert uebernommen und der OK-Button
1269*cdf0e10cSrcweir #*				ausgeloest
1270*cdf0e10cSrcweir #*
1271*cdf0e10cSrcweir #*  Input:		Pointer auf Listbox
1272*cdf0e10cSrcweir #*
1273*cdf0e10cSrcweir #*	Output:		---
1274*cdf0e10cSrcweir #*
1275*cdf0e10cSrcweir #************************************************************************/
1276*cdf0e10cSrcweir 
1277*cdf0e10cSrcweir IMPL_LINK( SvxNumberFormatTabPage, DoubleClickHdl_Impl, SvxFontListBox*, pLb )
1278*cdf0e10cSrcweir {
1279*cdf0e10cSrcweir 	if ( pLb == &aLbFormat )
1280*cdf0e10cSrcweir 	{
1281*cdf0e10cSrcweir 	    SelFormatHdl_Impl( pLb );
1282*cdf0e10cSrcweir 
1283*cdf0e10cSrcweir         if ( fnOkHdl.IsSet() )
1284*cdf0e10cSrcweir         {   // Uebergangsloesung, sollte von SfxTabPage angeboten werden
1285*cdf0e10cSrcweir 		    fnOkHdl.Call( NULL );
1286*cdf0e10cSrcweir         }
1287*cdf0e10cSrcweir         else
1288*cdf0e10cSrcweir         {
1289*cdf0e10cSrcweir             SfxSingleTabDialog* pParent = dynamic_cast< SfxSingleTabDialog* >( GetParent() );
1290*cdf0e10cSrcweir             OKButton* pOKButton = pParent ? pParent->GetOKButton() : NULL;
1291*cdf0e10cSrcweir             if ( pOKButton )
1292*cdf0e10cSrcweir                 pOKButton->Click();
1293*cdf0e10cSrcweir         }
1294*cdf0e10cSrcweir 	}
1295*cdf0e10cSrcweir 	return 0;
1296*cdf0e10cSrcweir }
1297*cdf0e10cSrcweir 
1298*cdf0e10cSrcweir 
1299*cdf0e10cSrcweir /*************************************************************************
1300*cdf0e10cSrcweir #*	Methode:	SelFormatHdl_Impl							Datum:02.10.97
1301*cdf0e10cSrcweir #*------------------------------------------------------------------------
1302*cdf0e10cSrcweir #*
1303*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1304*cdf0e10cSrcweir #*
1305*cdf0e10cSrcweir #*  Funktion:	Wird aufgerufen, wenn sich die Sprache, die Kategorie
1306*cdf0e10cSrcweir #*				oder das Format aendert. Dem entsprechend werden die
1307*cdf0e10cSrcweir #*				Einstellungen geaendert.
1308*cdf0e10cSrcweir #*
1309*cdf0e10cSrcweir #*  Input:		Pointer auf Listbox
1310*cdf0e10cSrcweir #*
1311*cdf0e10cSrcweir #*	Output:		---
1312*cdf0e10cSrcweir #*
1313*cdf0e10cSrcweir #************************************************************************/
1314*cdf0e10cSrcweir 
1315*cdf0e10cSrcweir IMPL_LINK( SvxNumberFormatTabPage, SelFormatHdl_Impl, void *, pLb )
1316*cdf0e10cSrcweir {
1317*cdf0e10cSrcweir     if ( (CheckBox*)pLb == &aCbSourceFormat )
1318*cdf0e10cSrcweir     {
1319*cdf0e10cSrcweir         EnableBySourceFormat_Impl();    // enable/disable everything else
1320*cdf0e10cSrcweir         if ( aCbSourceFormat.IsChecked() )
1321*cdf0e10cSrcweir             return 0;   // just disabled everything else
1322*cdf0e10cSrcweir 
1323*cdf0e10cSrcweir         // Reinit options enable/disable for current selection.
1324*cdf0e10cSrcweir 
1325*cdf0e10cSrcweir #if ENABLE_LAYOUT
1326*cdf0e10cSrcweir         if (aLbFormat.GetSelectEntryPos () == LISTBOX_ENTRY_NOTFOUND)
1327*cdf0e10cSrcweir #else /* !ENABLE_LAYOUT */
1328*cdf0e10cSrcweir         // Current category may be UserDefined with no format entries defined.
1329*cdf0e10cSrcweir         // And yes, aLbFormat is a SvxFontListBox with sal_uLong list positions,
1330*cdf0e10cSrcweir         // implementation returns a LIST_APPEND if empty, comparison with
1331*cdf0e10cSrcweir         // sal_uInt16 LISTBOX_ENTRY_NOTFOUND wouldn't match.
1332*cdf0e10cSrcweir         if ( aLbFormat.GetSelectEntryPos() == LIST_APPEND )
1333*cdf0e10cSrcweir #endif /* !ENABLE_LAYOUT */
1334*cdf0e10cSrcweir             pLb = &aLbCategory; // continue with the current category selected
1335*cdf0e10cSrcweir         else
1336*cdf0e10cSrcweir             pLb = &aLbFormat;   // continue with the current format selected
1337*cdf0e10cSrcweir     }
1338*cdf0e10cSrcweir 
1339*cdf0e10cSrcweir 	short		nTmpCatPos;
1340*cdf0e10cSrcweir 
1341*cdf0e10cSrcweir 	if(bOneAreaFlag)
1342*cdf0e10cSrcweir 	{
1343*cdf0e10cSrcweir 		nTmpCatPos=nFixedCategory;
1344*cdf0e10cSrcweir 	}
1345*cdf0e10cSrcweir 	else
1346*cdf0e10cSrcweir 	{
1347*cdf0e10cSrcweir 		nTmpCatPos=aLbCategory.GetSelectEntryPos();
1348*cdf0e10cSrcweir 	}
1349*cdf0e10cSrcweir 
1350*cdf0e10cSrcweir 	sal_uInt16 nCurrencyPos=LISTBOX_ENTRY_NOTFOUND ;
1351*cdf0e10cSrcweir 
1352*cdf0e10cSrcweir 	if(nTmpCatPos==CAT_CURRENCY && (ListBox *)pLb == &aLbCurrency )
1353*cdf0e10cSrcweir 	{
1354*cdf0e10cSrcweir 		nCurrencyPos=aLbCurrency.GetSelectEntryPos();
1355*cdf0e10cSrcweir 		pNumFmtShell->SetCurrencySymbol(nCurrencyPos);
1356*cdf0e10cSrcweir 	}
1357*cdf0e10cSrcweir 
1358*cdf0e10cSrcweir 	//--------------------------------------------------------------------
1359*cdf0e10cSrcweir 	// Format-ListBox ----------------------------------------------------
1360*cdf0e10cSrcweir 	if ( (SvxFontListBox *)pLb == &aLbFormat )
1361*cdf0e10cSrcweir 	{
1362*cdf0e10cSrcweir 		sal_uInt16	nSelPos = (sal_uInt16) aLbFormat.GetSelectEntryPos();
1363*cdf0e10cSrcweir 		String	aFormat	= aLbFormat.GetSelectEntry();
1364*cdf0e10cSrcweir 		String	aComment;
1365*cdf0e10cSrcweir 		SvxDelStrgs	aEntryList;
1366*cdf0e10cSrcweir 
1367*cdf0e10cSrcweir 		short		nFmtLbSelPos = nSelPos;
1368*cdf0e10cSrcweir 
1369*cdf0e10cSrcweir 		aFormat=pNumFmtShell->GetFormat4Entry(nSelPos);
1370*cdf0e10cSrcweir 		aComment=pNumFmtShell->GetComment4Entry(nSelPos);
1371*cdf0e10cSrcweir 		if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos))
1372*cdf0e10cSrcweir 		{
1373*cdf0e10cSrcweir 			if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0)
1374*cdf0e10cSrcweir 			{
1375*cdf0e10cSrcweir 				aComment=aLbCategory.GetEntry(1);
1376*cdf0e10cSrcweir 			}
1377*cdf0e10cSrcweir 		}
1378*cdf0e10cSrcweir 
1379*cdf0e10cSrcweir 		if ( aFormat.Len() > 0 )
1380*cdf0e10cSrcweir 		{
1381*cdf0e10cSrcweir 			if(!aEdFormat.HasFocus()) aEdFormat.SetText( aFormat );
1382*cdf0e10cSrcweir 			aFtComment.SetText(aComment);
1383*cdf0e10cSrcweir             ChangePreviewText( nSelPos );
1384*cdf0e10cSrcweir 		}
1385*cdf0e10cSrcweir 
1386*cdf0e10cSrcweir 		REMOVE_DONTKNOW() // ggF. UI-Enable
1387*cdf0e10cSrcweir 
1388*cdf0e10cSrcweir 		if ( pNumFmtShell->FindEntry( aFormat) )
1389*cdf0e10cSrcweir 		{
1390*cdf0e10cSrcweir 			aIbAdd.Enable(sal_False );
1391*cdf0e10cSrcweir 			sal_Bool bIsUserDef=pNumFmtShell->IsUserDefined( aFormat );
1392*cdf0e10cSrcweir 			aIbRemove.Enable(bIsUserDef);
1393*cdf0e10cSrcweir 			aIbInfo.Enable(bIsUserDef);
1394*cdf0e10cSrcweir 
1395*cdf0e10cSrcweir 		}
1396*cdf0e10cSrcweir 		else
1397*cdf0e10cSrcweir 		{
1398*cdf0e10cSrcweir 			aIbAdd.Enable(sal_True );
1399*cdf0e10cSrcweir 			aIbInfo.Enable(sal_True );
1400*cdf0e10cSrcweir 			aIbRemove.Enable(sal_False );
1401*cdf0e10cSrcweir 			aFtComment.SetText(aEdComment.GetText());
1402*cdf0e10cSrcweir 
1403*cdf0e10cSrcweir 		}
1404*cdf0e10cSrcweir 		UpdateOptions_Impl( sal_False );
1405*cdf0e10cSrcweir 
1406*cdf0e10cSrcweir 		//-------
1407*cdf0e10cSrcweir 		return 0;
1408*cdf0e10cSrcweir 		//-------
1409*cdf0e10cSrcweir 	}
1410*cdf0e10cSrcweir 
1411*cdf0e10cSrcweir 	//--------------------------------------------------------------------
1412*cdf0e10cSrcweir 	// Kategorie-ListBox -------------------------------------------------
1413*cdf0e10cSrcweir 	if ( pLb == &aLbCategory || pLb == &aLbCurrency)
1414*cdf0e10cSrcweir 	{
1415*cdf0e10cSrcweir 		UpdateFormatListBox_Impl( sal_True, sal_True );
1416*cdf0e10cSrcweir 		EditHdl_Impl( NULL );
1417*cdf0e10cSrcweir 		UpdateOptions_Impl( sal_False );
1418*cdf0e10cSrcweir 
1419*cdf0e10cSrcweir 		//-------
1420*cdf0e10cSrcweir 		return 0;
1421*cdf0e10cSrcweir 		//-------
1422*cdf0e10cSrcweir 	}
1423*cdf0e10cSrcweir 
1424*cdf0e10cSrcweir 	//--------------------------------------------------------------------
1425*cdf0e10cSrcweir 	// Sprache/Land-ListBox ----------------------------------------------
1426*cdf0e10cSrcweir 	if ( pLb == &aLbLanguage )
1427*cdf0e10cSrcweir 	{
1428*cdf0e10cSrcweir 		UpdateFormatListBox_Impl( sal_False, sal_True );
1429*cdf0e10cSrcweir 		EditHdl_Impl( &aEdFormat );
1430*cdf0e10cSrcweir 
1431*cdf0e10cSrcweir 		//-------
1432*cdf0e10cSrcweir 		return 0;
1433*cdf0e10cSrcweir 		//-------
1434*cdf0e10cSrcweir 	}
1435*cdf0e10cSrcweir 	return 0;
1436*cdf0e10cSrcweir }
1437*cdf0e10cSrcweir 
1438*cdf0e10cSrcweir 
1439*cdf0e10cSrcweir /*************************************************************************
1440*cdf0e10cSrcweir #*	Methode:	ClickHdl_Impl, ImageButton* pIB 			Datum:02.10.97
1441*cdf0e10cSrcweir #*------------------------------------------------------------------------
1442*cdf0e10cSrcweir #*
1443*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1444*cdf0e10cSrcweir #*
1445*cdf0e10cSrcweir #*  Funktion:	Wenn, der Hinzufuegen- oder Entfernen- Button
1446*cdf0e10cSrcweir #*				wird diese Funktion aufgerufen und die Zahlenformat-
1447*cdf0e10cSrcweir #*				Liste den entsprechend geaendert.
1448*cdf0e10cSrcweir #*
1449*cdf0e10cSrcweir #*  Input:		Toolbox- Button
1450*cdf0e10cSrcweir #*
1451*cdf0e10cSrcweir #*	Output:		---
1452*cdf0e10cSrcweir #*
1453*cdf0e10cSrcweir #************************************************************************/
1454*cdf0e10cSrcweir 
1455*cdf0e10cSrcweir IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, ImageButton*, pIB)
1456*cdf0e10cSrcweir {
1457*cdf0e10cSrcweir 	sal_Bool		bAdded = sal_False;
1458*cdf0e10cSrcweir 	sal_Bool		bDeleted = sal_False;
1459*cdf0e10cSrcweir     sal_uLong       nReturn = 0;
1460*cdf0e10cSrcweir     const sal_uLong nReturnChanged  = 0x1;  // THE boolean return value
1461*cdf0e10cSrcweir     const sal_uLong nReturnAdded    = 0x2;  // temp: format added
1462*cdf0e10cSrcweir     const sal_uLong nReturnOneArea  = 0x4;  // temp: one area but category changed => ignored
1463*cdf0e10cSrcweir 
1464*cdf0e10cSrcweir 	if(pIB==&aIbAdd)
1465*cdf0e10cSrcweir     {   // Also called from FillItemSet() if a temporary currency format has
1466*cdf0e10cSrcweir         // to be added, not only if the Add button is enabled.
1467*cdf0e10cSrcweir 		String		aFormat	= aEdFormat.GetText();
1468*cdf0e10cSrcweir 		SvxDelStrgs	aEntryList;
1469*cdf0e10cSrcweir 		SvxDelStrgs	a2EntryList;
1470*cdf0e10cSrcweir 		sal_uInt16		nCatLbSelPos = 0;
1471*cdf0e10cSrcweir 		short		nFmtLbSelPos = SELPOS_NONE;
1472*cdf0e10cSrcweir 		xub_StrLen	nErrPos=0;
1473*cdf0e10cSrcweir 
1474*cdf0e10cSrcweir 		pNumFmtShell->SetCurCurrencyEntry(NULL);
1475*cdf0e10cSrcweir 		bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos,
1476*cdf0e10cSrcweir 										  nCatLbSelPos, nFmtLbSelPos,
1477*cdf0e10cSrcweir 										  aEntryList);
1478*cdf0e10cSrcweir         if ( bAdded )
1479*cdf0e10cSrcweir             nReturn |= nReturnChanged | nReturnAdded;
1480*cdf0e10cSrcweir 
1481*cdf0e10cSrcweir 		if(pLastActivWindow== (Window *) &aEdComment)
1482*cdf0e10cSrcweir 		{
1483*cdf0e10cSrcweir 			aEdFormat.GrabFocus();
1484*cdf0e10cSrcweir 			aEdComment.Hide();
1485*cdf0e10cSrcweir 			aFtComment.Show();
1486*cdf0e10cSrcweir 			aFtComment.SetText(aEdComment.GetText());
1487*cdf0e10cSrcweir 		}
1488*cdf0e10cSrcweir 
1489*cdf0e10cSrcweir 		if ( !nErrPos ) // Syntax ok?
1490*cdf0e10cSrcweir 		{
1491*cdf0e10cSrcweir 			if(nCatLbSelPos==CAT_CURRENCY)
1492*cdf0e10cSrcweir 			{
1493*cdf0e10cSrcweir 				aLbCurrency.SelectEntryPos((sal_uInt16)pNumFmtShell->GetCurrencySymbol());
1494*cdf0e10cSrcweir 			}
1495*cdf0e10cSrcweir 
1496*cdf0e10cSrcweir 			if(bOneAreaFlag && (nFixedCategory!=nCatLbSelPos))
1497*cdf0e10cSrcweir 			{
1498*cdf0e10cSrcweir 				if(bAdded) DeleteEntryList_Impl(aEntryList);
1499*cdf0e10cSrcweir 				bDeleted = pNumFmtShell->RemoveFormat( aFormat,
1500*cdf0e10cSrcweir 											   nCatLbSelPos,
1501*cdf0e10cSrcweir 											   nFmtLbSelPos,
1502*cdf0e10cSrcweir 											   a2EntryList);
1503*cdf0e10cSrcweir 				if(bDeleted) DeleteEntryList_Impl(a2EntryList);
1504*cdf0e10cSrcweir 				aEdFormat.GrabFocus();
1505*cdf0e10cSrcweir 				aEdFormat.SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) );
1506*cdf0e10cSrcweir                 nReturn |= nReturnOneArea;
1507*cdf0e10cSrcweir 			}
1508*cdf0e10cSrcweir 			else
1509*cdf0e10cSrcweir 			{
1510*cdf0e10cSrcweir 				if ( bAdded && (nFmtLbSelPos != SELPOS_NONE) )
1511*cdf0e10cSrcweir 				{
1512*cdf0e10cSrcweir 					// Alles klar
1513*cdf0e10cSrcweir 					if(bOneAreaFlag)				  //@@ ???
1514*cdf0e10cSrcweir 						SetCategory(0);
1515*cdf0e10cSrcweir 					else
1516*cdf0e10cSrcweir 						SetCategory(nCatLbSelPos );
1517*cdf0e10cSrcweir 
1518*cdf0e10cSrcweir 					FillFormatListBox_Impl( aEntryList );
1519*cdf0e10cSrcweir 					if(aEdComment.GetText()!=aLbCategory.GetEntry(1))
1520*cdf0e10cSrcweir 					{
1521*cdf0e10cSrcweir 						pNumFmtShell->SetComment4Entry(nFmtLbSelPos,
1522*cdf0e10cSrcweir 													aEdComment.GetText());
1523*cdf0e10cSrcweir 					}
1524*cdf0e10cSrcweir 					else
1525*cdf0e10cSrcweir 					{
1526*cdf0e10cSrcweir 						pNumFmtShell->SetComment4Entry(nFmtLbSelPos,
1527*cdf0e10cSrcweir 														String());
1528*cdf0e10cSrcweir 					}
1529*cdf0e10cSrcweir 					aLbFormat.SelectEntryPos( (sal_uInt16)nFmtLbSelPos );
1530*cdf0e10cSrcweir 					aEdFormat.SetText( aFormat );
1531*cdf0e10cSrcweir 
1532*cdf0e10cSrcweir 					//aEdComment.SetText(String()); //@@ ???
1533*cdf0e10cSrcweir 					aEdComment.SetText(aLbCategory.GetEntry(1));	//String fuer Benutzerdefiniert
1534*cdf0e10cSrcweir 																	//holen
1535*cdf0e10cSrcweir                     ChangePreviewText( (sal_uInt16)nFmtLbSelPos );
1536*cdf0e10cSrcweir 				}
1537*cdf0e10cSrcweir 			}
1538*cdf0e10cSrcweir 		}
1539*cdf0e10cSrcweir 		else // Syntaxfehler
1540*cdf0e10cSrcweir 		{
1541*cdf0e10cSrcweir 			aEdFormat.GrabFocus();
1542*cdf0e10cSrcweir 			aEdFormat.SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) );
1543*cdf0e10cSrcweir 		}
1544*cdf0e10cSrcweir 		EditHdl_Impl( &aEdFormat );
1545*cdf0e10cSrcweir         nReturn = ((nReturn & nReturnOneArea) ? 0 : (nReturn & nReturnChanged));
1546*cdf0e10cSrcweir 	}
1547*cdf0e10cSrcweir 	else if(pIB==&aIbRemove)
1548*cdf0e10cSrcweir 	{
1549*cdf0e10cSrcweir 		String		aFormat	= aEdFormat.GetText();
1550*cdf0e10cSrcweir 		SvxDelStrgs	aEntryList;
1551*cdf0e10cSrcweir 		sal_uInt16		nCatLbSelPos = 0;
1552*cdf0e10cSrcweir 		short		nFmtLbSelPos = SELPOS_NONE;
1553*cdf0e10cSrcweir 
1554*cdf0e10cSrcweir 		bDeleted = pNumFmtShell->RemoveFormat( aFormat,
1555*cdf0e10cSrcweir 											   nCatLbSelPos,
1556*cdf0e10cSrcweir 											   nFmtLbSelPos,
1557*cdf0e10cSrcweir 											   aEntryList );
1558*cdf0e10cSrcweir 
1559*cdf0e10cSrcweir 		aEdComment.SetText(aLbCategory.GetEntry(1));
1560*cdf0e10cSrcweir 		if ( bDeleted )
1561*cdf0e10cSrcweir 		{
1562*cdf0e10cSrcweir 			if(nFmtLbSelPos>=0 &&  nFmtLbSelPos<aEntryList.Count())
1563*cdf0e10cSrcweir 			{
1564*cdf0e10cSrcweir 				aFormat	= *aEntryList[nFmtLbSelPos];
1565*cdf0e10cSrcweir 			}
1566*cdf0e10cSrcweir 
1567*cdf0e10cSrcweir 			FillFormatListBox_Impl( aEntryList );
1568*cdf0e10cSrcweir 
1569*cdf0e10cSrcweir 			if ( nFmtLbSelPos != SELPOS_NONE )
1570*cdf0e10cSrcweir 			{
1571*cdf0e10cSrcweir 				if(bOneAreaFlag)				  //@@ ???
1572*cdf0e10cSrcweir 						SetCategory(0);
1573*cdf0e10cSrcweir 					else
1574*cdf0e10cSrcweir 						SetCategory(nCatLbSelPos );
1575*cdf0e10cSrcweir 
1576*cdf0e10cSrcweir 				aLbFormat.SelectEntryPos( (sal_uInt16)nFmtLbSelPos );
1577*cdf0e10cSrcweir 				aEdFormat.SetText( aFormat );
1578*cdf0e10cSrcweir                 ChangePreviewText( (sal_uInt16)nFmtLbSelPos );
1579*cdf0e10cSrcweir 			}
1580*cdf0e10cSrcweir 			else
1581*cdf0e10cSrcweir 			{
1582*cdf0e10cSrcweir 				// auf "Alle/Standard" setzen
1583*cdf0e10cSrcweir 				SetCategory(0 );
1584*cdf0e10cSrcweir 				SelFormatHdl_Impl( &aLbCategory );
1585*cdf0e10cSrcweir 			}
1586*cdf0e10cSrcweir 		}
1587*cdf0e10cSrcweir 		EditHdl_Impl( &aEdFormat );
1588*cdf0e10cSrcweir 	}
1589*cdf0e10cSrcweir 	else if(pIB==&aIbInfo)
1590*cdf0e10cSrcweir 	{
1591*cdf0e10cSrcweir 		if(!(pLastActivWindow== (Window *) &aEdComment))
1592*cdf0e10cSrcweir 		{
1593*cdf0e10cSrcweir 			aEdComment.SetText(aFtComment.GetText());
1594*cdf0e10cSrcweir 			aEdComment.Show();
1595*cdf0e10cSrcweir 			aFtComment.Hide();
1596*cdf0e10cSrcweir 			aEdComment.GrabFocus();
1597*cdf0e10cSrcweir 		}
1598*cdf0e10cSrcweir 		else
1599*cdf0e10cSrcweir 		{
1600*cdf0e10cSrcweir 			aEdFormat.GrabFocus();
1601*cdf0e10cSrcweir 			aEdComment.Hide();
1602*cdf0e10cSrcweir 			aFtComment.Show();
1603*cdf0e10cSrcweir 		}
1604*cdf0e10cSrcweir 	}
1605*cdf0e10cSrcweir 
1606*cdf0e10cSrcweir     return nReturn;
1607*cdf0e10cSrcweir }
1608*cdf0e10cSrcweir 
1609*cdf0e10cSrcweir 
1610*cdf0e10cSrcweir /*************************************************************************
1611*cdf0e10cSrcweir #*	Methode:	EditHdl_Impl								Datum:02.10.97
1612*cdf0e10cSrcweir #*------------------------------------------------------------------------
1613*cdf0e10cSrcweir #*
1614*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1615*cdf0e10cSrcweir #*
1616*cdf0e10cSrcweir #*  Funktion:	Wenn der Eintrag im Eingabefeld geaendert wird,
1617*cdf0e10cSrcweir #*				so wird die Vorschau aktualisiert und
1618*cdf0e10cSrcweir #*
1619*cdf0e10cSrcweir #*  Input:		Pointer auf Editbox
1620*cdf0e10cSrcweir #*
1621*cdf0e10cSrcweir #*	Output:		---
1622*cdf0e10cSrcweir #*
1623*cdf0e10cSrcweir #************************************************************************/
1624*cdf0e10cSrcweir 
1625*cdf0e10cSrcweir IMPL_LINK( SvxNumberFormatTabPage, EditHdl_Impl, Edit*, pEdFormat )
1626*cdf0e10cSrcweir {
1627*cdf0e10cSrcweir 	sal_uInt32 nCurKey = NUMKEY_UNDEFINED;
1628*cdf0e10cSrcweir 
1629*cdf0e10cSrcweir 	if ( aEdFormat.GetText().Len() == 0 )
1630*cdf0e10cSrcweir 	{
1631*cdf0e10cSrcweir 		aIbAdd.Enable(sal_False );
1632*cdf0e10cSrcweir 		aIbRemove.Enable(sal_False );
1633*cdf0e10cSrcweir 		aIbInfo.Enable(sal_False );
1634*cdf0e10cSrcweir 		aFtComment.SetText(String());
1635*cdf0e10cSrcweir 	}
1636*cdf0e10cSrcweir 	else
1637*cdf0e10cSrcweir 	{
1638*cdf0e10cSrcweir 		String aFormat = aEdFormat.GetText();
1639*cdf0e10cSrcweir 		//aFtComment.SetText(String());
1640*cdf0e10cSrcweir         MakePreviewText( aFormat );
1641*cdf0e10cSrcweir 
1642*cdf0e10cSrcweir 		if ( pNumFmtShell->FindEntry( aFormat, &nCurKey ) )
1643*cdf0e10cSrcweir 		{
1644*cdf0e10cSrcweir 			aIbAdd.Enable(sal_False );
1645*cdf0e10cSrcweir 			sal_Bool bUserDef=pNumFmtShell->IsUserDefined( aFormat );
1646*cdf0e10cSrcweir 
1647*cdf0e10cSrcweir 			aIbRemove.Enable(bUserDef);
1648*cdf0e10cSrcweir 			aIbInfo.Enable(bUserDef);
1649*cdf0e10cSrcweir 
1650*cdf0e10cSrcweir 			if(bUserDef)
1651*cdf0e10cSrcweir 			{
1652*cdf0e10cSrcweir 				sal_uInt16 nTmpCurPos=pNumFmtShell->FindCurrencyFormat(aFormat );
1653*cdf0e10cSrcweir 
1654*cdf0e10cSrcweir 				if(nTmpCurPos!=(sal_uInt16)-1)
1655*cdf0e10cSrcweir 					aLbCurrency.SelectEntryPos(nTmpCurPos);
1656*cdf0e10cSrcweir 			}
1657*cdf0e10cSrcweir 			short nPosi=pNumFmtShell->GetListPos4Entry(aFormat);
1658*cdf0e10cSrcweir 			if(nPosi>=0)
1659*cdf0e10cSrcweir 				aLbFormat.SelectEntryPos( (sal_uInt16)nPosi);
1660*cdf0e10cSrcweir 
1661*cdf0e10cSrcweir 		}
1662*cdf0e10cSrcweir 		else
1663*cdf0e10cSrcweir 		{
1664*cdf0e10cSrcweir 
1665*cdf0e10cSrcweir 			aIbAdd.Enable(sal_True );
1666*cdf0e10cSrcweir 			aIbInfo.Enable(sal_True);
1667*cdf0e10cSrcweir 			aIbRemove.Enable(sal_False );
1668*cdf0e10cSrcweir 
1669*cdf0e10cSrcweir 			aFtComment.SetText(aEdComment.GetText());
1670*cdf0e10cSrcweir 
1671*cdf0e10cSrcweir 		}
1672*cdf0e10cSrcweir 	}
1673*cdf0e10cSrcweir 
1674*cdf0e10cSrcweir 	if ( pEdFormat )
1675*cdf0e10cSrcweir 	{
1676*cdf0e10cSrcweir 		pNumFmtShell->SetCurNumFmtKey( nCurKey );
1677*cdf0e10cSrcweir 		UpdateOptions_Impl( sal_True );
1678*cdf0e10cSrcweir 	}
1679*cdf0e10cSrcweir 
1680*cdf0e10cSrcweir 	return 0;
1681*cdf0e10cSrcweir }
1682*cdf0e10cSrcweir 
1683*cdf0e10cSrcweir 
1684*cdf0e10cSrcweir /*************************************************************************
1685*cdf0e10cSrcweir #*	Methode:		NotifyChange							Datum:02.10.97
1686*cdf0e10cSrcweir #*------------------------------------------------------------------------
1687*cdf0e10cSrcweir #*
1688*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1689*cdf0e10cSrcweir #*
1690*cdf0e10cSrcweir #*  Funktion:	Fuehrt Aenderungen in den Zahlen- Attributen durch.
1691*cdf0e10cSrcweir #*
1692*cdf0e10cSrcweir #*  Input:		Options- Controls
1693*cdf0e10cSrcweir #*
1694*cdf0e10cSrcweir #*	Output:		---
1695*cdf0e10cSrcweir #*
1696*cdf0e10cSrcweir #************************************************************************/
1697*cdf0e10cSrcweir 
1698*cdf0e10cSrcweir IMPL_LINK( SvxNumberFormatTabPage, OptHdl_Impl, void *, pOptCtrl )
1699*cdf0e10cSrcweir {
1700*cdf0e10cSrcweir 	if (   ((NumericField*)pOptCtrl == &aEdLeadZeroes)
1701*cdf0e10cSrcweir 		|| ((NumericField*)pOptCtrl == &aEdDecimals)
1702*cdf0e10cSrcweir 		|| ((CheckBox*)    pOptCtrl == &aBtnNegRed)
1703*cdf0e10cSrcweir 		|| ((CheckBox*)    pOptCtrl == &aBtnThousand) )
1704*cdf0e10cSrcweir 	{
1705*cdf0e10cSrcweir 		String		  aFormat;
1706*cdf0e10cSrcweir 		sal_Bool		  bThousand 	=    aBtnThousand.IsEnabled()
1707*cdf0e10cSrcweir 									  && aBtnThousand.IsChecked();
1708*cdf0e10cSrcweir 		sal_Bool		  bNegRed		=    aBtnNegRed.IsEnabled()
1709*cdf0e10cSrcweir 									  && aBtnNegRed.IsChecked();
1710*cdf0e10cSrcweir 		sal_uInt16		  nPrecision	= (aEdDecimals.IsEnabled())
1711*cdf0e10cSrcweir 										? (sal_uInt16)aEdDecimals.GetValue()
1712*cdf0e10cSrcweir 										: (sal_uInt16)0;
1713*cdf0e10cSrcweir 		sal_uInt16		  nLeadZeroes	= (aEdLeadZeroes.IsEnabled())
1714*cdf0e10cSrcweir 										? (sal_uInt16)aEdLeadZeroes.GetValue()
1715*cdf0e10cSrcweir 										: (sal_uInt16)0;
1716*cdf0e10cSrcweir 
1717*cdf0e10cSrcweir 		pNumFmtShell->MakeFormat( aFormat,
1718*cdf0e10cSrcweir 								  bThousand, bNegRed,
1719*cdf0e10cSrcweir 								  nPrecision, nLeadZeroes,
1720*cdf0e10cSrcweir 								  (sal_uInt16)aLbFormat.GetSelectEntryPos() );
1721*cdf0e10cSrcweir 
1722*cdf0e10cSrcweir 		aEdFormat.SetText( aFormat );
1723*cdf0e10cSrcweir 		//aFtComment.SetText(String());
1724*cdf0e10cSrcweir         MakePreviewText( aFormat );
1725*cdf0e10cSrcweir 
1726*cdf0e10cSrcweir 		if ( pNumFmtShell->FindEntry( aFormat ) )
1727*cdf0e10cSrcweir 		{
1728*cdf0e10cSrcweir 			aIbAdd.Enable(sal_False );
1729*cdf0e10cSrcweir 			sal_Bool bUserDef=pNumFmtShell->IsUserDefined( aFormat );
1730*cdf0e10cSrcweir 			aIbRemove.Enable(bUserDef);
1731*cdf0e10cSrcweir 			aIbInfo.Enable(bUserDef);
1732*cdf0e10cSrcweir 			EditHdl_Impl( &aEdFormat);
1733*cdf0e10cSrcweir 
1734*cdf0e10cSrcweir 		}
1735*cdf0e10cSrcweir 		else
1736*cdf0e10cSrcweir 		{
1737*cdf0e10cSrcweir 			EditHdl_Impl( NULL );
1738*cdf0e10cSrcweir 			aLbFormat.SetNoSelection();
1739*cdf0e10cSrcweir 		}
1740*cdf0e10cSrcweir 	}
1741*cdf0e10cSrcweir 	return 0;
1742*cdf0e10cSrcweir }
1743*cdf0e10cSrcweir 
1744*cdf0e10cSrcweir IMPL_LINK( SvxNumberFormatTabPage, TimeHdl_Impl, Timer*, EMPTYARG)
1745*cdf0e10cSrcweir {
1746*cdf0e10cSrcweir 	pLastActivWindow=NULL;
1747*cdf0e10cSrcweir 	return 0;
1748*cdf0e10cSrcweir }
1749*cdf0e10cSrcweir 
1750*cdf0e10cSrcweir 
1751*cdf0e10cSrcweir /*************************************************************************
1752*cdf0e10cSrcweir #*	Methode:	LostFocusHdl_Impl							Datum:30.10.97
1753*cdf0e10cSrcweir #*------------------------------------------------------------------------
1754*cdf0e10cSrcweir #*
1755*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1756*cdf0e10cSrcweir #*
1757*cdf0e10cSrcweir #*  Funktion:	Fuehrt Aenderungen in den Zahlen- Attributen durch.
1758*cdf0e10cSrcweir #*
1759*cdf0e10cSrcweir #*  Input:		Options- Controls
1760*cdf0e10cSrcweir #*
1761*cdf0e10cSrcweir #*	Output:		---
1762*cdf0e10cSrcweir #*
1763*cdf0e10cSrcweir #************************************************************************/
1764*cdf0e10cSrcweir 
1765*cdf0e10cSrcweir IMPL_LINK( SvxNumberFormatTabPage, LostFocusHdl_Impl, Edit *, pEd)
1766*cdf0e10cSrcweir {
1767*cdf0e10cSrcweir 	if (pEd==&aEdComment)
1768*cdf0e10cSrcweir 	{
1769*cdf0e10cSrcweir 		aResetWinTimer.Start();
1770*cdf0e10cSrcweir 		aFtComment.SetText(aEdComment.GetText());
1771*cdf0e10cSrcweir 		aEdComment.Hide();
1772*cdf0e10cSrcweir 		aFtComment.Show();
1773*cdf0e10cSrcweir 		if(!aIbAdd.IsEnabled())
1774*cdf0e10cSrcweir 		{
1775*cdf0e10cSrcweir 			sal_uInt16	nSelPos = (sal_uInt16) aLbFormat.GetSelectEntryPos();
1776*cdf0e10cSrcweir 			pNumFmtShell->SetComment4Entry(nSelPos,
1777*cdf0e10cSrcweir 										aEdComment.GetText());
1778*cdf0e10cSrcweir 			aEdComment.SetText(aLbCategory.GetEntry(1));	//String fuer Benutzerdefiniert
1779*cdf0e10cSrcweir 															//holen
1780*cdf0e10cSrcweir 		}
1781*cdf0e10cSrcweir 	}
1782*cdf0e10cSrcweir 	return 0;
1783*cdf0e10cSrcweir }
1784*cdf0e10cSrcweir 
1785*cdf0e10cSrcweir /*************************************************************************
1786*cdf0e10cSrcweir #*	Methode:		NotifyChange							Datum:02.10.97
1787*cdf0e10cSrcweir #*------------------------------------------------------------------------
1788*cdf0e10cSrcweir #*
1789*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1790*cdf0e10cSrcweir #*
1791*cdf0e10cSrcweir #*  Funktion:	Fuehrt Aenderungen in den Zahlen- Attributen durch.
1792*cdf0e10cSrcweir #*
1793*cdf0e10cSrcweir #*  Input:		Options- Controls
1794*cdf0e10cSrcweir #*
1795*cdf0e10cSrcweir #*	Output:		---
1796*cdf0e10cSrcweir #*
1797*cdf0e10cSrcweir #************************************************************************/
1798*cdf0e10cSrcweir 
1799*cdf0e10cSrcweir String SvxNumberFormatTabPage::GetExpColorString(
1800*cdf0e10cSrcweir         Color*& rpPreviewColor, const String& rFormatStr, short nTmpCatPos)
1801*cdf0e10cSrcweir {
1802*cdf0e10cSrcweir     double nVal = 0;
1803*cdf0e10cSrcweir 	switch (nTmpCatPos)
1804*cdf0e10cSrcweir 	{
1805*cdf0e10cSrcweir 		case CAT_CURRENCY:		nVal=SVX_NUMVAL_CURRENCY; break;
1806*cdf0e10cSrcweir 
1807*cdf0e10cSrcweir 		case CAT_SCIENTIFIC:
1808*cdf0e10cSrcweir 		case CAT_FRACTION:
1809*cdf0e10cSrcweir 		case CAT_NUMBER:		nVal=SVX_NUMVAL_STANDARD; break;
1810*cdf0e10cSrcweir 
1811*cdf0e10cSrcweir 		case CAT_PERCENT:		nVal=SVX_NUMVAL_PERCENT; break;
1812*cdf0e10cSrcweir 
1813*cdf0e10cSrcweir 		case CAT_ALL:			nVal=SVX_NUMVAL_STANDARD; break;
1814*cdf0e10cSrcweir 
1815*cdf0e10cSrcweir 		case CAT_TIME:			nVal=SVX_NUMVAL_TIME; break;
1816*cdf0e10cSrcweir 		case CAT_DATE:			nVal=SVX_NUMVAL_DATE; break;
1817*cdf0e10cSrcweir 
1818*cdf0e10cSrcweir 		case CAT_BOOLEAN:		nVal=SVX_NUMVAL_BOOLEAN; break;
1819*cdf0e10cSrcweir 
1820*cdf0e10cSrcweir 		case CAT_USERDEFINED:
1821*cdf0e10cSrcweir 		case CAT_TEXT:
1822*cdf0e10cSrcweir 		default:				nVal=0;break;
1823*cdf0e10cSrcweir 	}
1824*cdf0e10cSrcweir 
1825*cdf0e10cSrcweir     String aPreviewString;
1826*cdf0e10cSrcweir     pNumFmtShell->MakePrevStringFromVal( rFormatStr, aPreviewString, rpPreviewColor, nVal );
1827*cdf0e10cSrcweir 	return aPreviewString;
1828*cdf0e10cSrcweir }
1829*cdf0e10cSrcweir 
1830*cdf0e10cSrcweir void SvxNumberFormatTabPage::MakePreviewText( const String& rFormat )
1831*cdf0e10cSrcweir {
1832*cdf0e10cSrcweir     String aPreviewString;
1833*cdf0e10cSrcweir     Color* pPreviewColor = NULL;
1834*cdf0e10cSrcweir     pNumFmtShell->MakePreviewString( rFormat, aPreviewString, pPreviewColor );
1835*cdf0e10cSrcweir     aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
1836*cdf0e10cSrcweir }
1837*cdf0e10cSrcweir 
1838*cdf0e10cSrcweir void SvxNumberFormatTabPage::ChangePreviewText( sal_uInt16 nPos )
1839*cdf0e10cSrcweir {
1840*cdf0e10cSrcweir     String aPreviewString;
1841*cdf0e10cSrcweir     Color* pPreviewColor = NULL;
1842*cdf0e10cSrcweir     pNumFmtShell->FormatChanged( nPos, aPreviewString, pPreviewColor );
1843*cdf0e10cSrcweir     aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
1844*cdf0e10cSrcweir }
1845*cdf0e10cSrcweir 
1846*cdf0e10cSrcweir long SvxNumberFormatTabPage::PreNotify( NotifyEvent& rNEvt )
1847*cdf0e10cSrcweir {
1848*cdf0e10cSrcweir 	if(rNEvt.GetType()==EVENT_LOSEFOCUS)
1849*cdf0e10cSrcweir 	{
1850*cdf0e10cSrcweir         if ( rNEvt.GetWindow() == dynamic_cast< Window* >( &aEdComment ) && !aEdComment.IsVisible() )
1851*cdf0e10cSrcweir         {
1852*cdf0e10cSrcweir             pLastActivWindow = NULL;
1853*cdf0e10cSrcweir         }
1854*cdf0e10cSrcweir         else
1855*cdf0e10cSrcweir         {
1856*cdf0e10cSrcweir             pLastActivWindow = rNEvt.GetWindow();
1857*cdf0e10cSrcweir         }
1858*cdf0e10cSrcweir 	}
1859*cdf0e10cSrcweir 
1860*cdf0e10cSrcweir 	return SfxTabPage::PreNotify( rNEvt );
1861*cdf0e10cSrcweir }
1862*cdf0e10cSrcweir /*************************************************************************
1863*cdf0e10cSrcweir #*	Methode:	SetOkHdl									Datum:01.11.97
1864*cdf0e10cSrcweir #*------------------------------------------------------------------------
1865*cdf0e10cSrcweir #*
1866*cdf0e10cSrcweir #*  Klasse:		SvxNumberFormatTabPage
1867*cdf0e10cSrcweir #*
1868*cdf0e10cSrcweir #*  Funktion:	Setzt den OkHandler neu.
1869*cdf0e10cSrcweir #*
1870*cdf0e10cSrcweir #*  Input:		Neuer OkHandler
1871*cdf0e10cSrcweir #*
1872*cdf0e10cSrcweir #*	Output:		---
1873*cdf0e10cSrcweir #*
1874*cdf0e10cSrcweir #************************************************************************/
1875*cdf0e10cSrcweir 
1876*cdf0e10cSrcweir void SvxNumberFormatTabPage::SetOkHdl( const Link& rOkHandler )
1877*cdf0e10cSrcweir {
1878*cdf0e10cSrcweir 	fnOkHdl = rOkHandler;
1879*cdf0e10cSrcweir }
1880*cdf0e10cSrcweir 
1881*cdf0e10cSrcweir void SvxNumberFormatTabPage::FillCurrencyBox()
1882*cdf0e10cSrcweir {
1883*cdf0e10cSrcweir 	SvStringsDtor	aList;
1884*cdf0e10cSrcweir 	NfShCurrencyEntries rEntries;
1885*cdf0e10cSrcweir 	XubString*		pEntry = NULL;
1886*cdf0e10cSrcweir 	sal_uInt16	nPos=0;
1887*cdf0e10cSrcweir 	sal_uInt16	nSelPos=0;
1888*cdf0e10cSrcweir 
1889*cdf0e10cSrcweir 	pNumFmtShell->GetCurrencySymbols( aList, &nSelPos);
1890*cdf0e10cSrcweir 
1891*cdf0e10cSrcweir 	for(sal_uInt16 i=1;i<aList.Count();i++)
1892*cdf0e10cSrcweir 	{
1893*cdf0e10cSrcweir 		pEntry=aList[i];
1894*cdf0e10cSrcweir 		nPos=aLbCurrency.InsertEntry( *pEntry);
1895*cdf0e10cSrcweir 	}
1896*cdf0e10cSrcweir 	aLbCurrency.SelectEntryPos(nSelPos);
1897*cdf0e10cSrcweir }
1898*cdf0e10cSrcweir 
1899*cdf0e10cSrcweir void SvxNumberFormatTabPage::SetCategory(sal_uInt16 nPos)
1900*cdf0e10cSrcweir {
1901*cdf0e10cSrcweir 	sal_uInt16	nCurCategory = aLbCategory.GetSelectEntryPos();
1902*cdf0e10cSrcweir 	Point aPos=aLbFormat.GetPosPixel();
1903*cdf0e10cSrcweir 	Size  aSize=aLbFormat.GetSizePixel();
1904*cdf0e10cSrcweir 	sal_uInt16 nTmpCatPos;
1905*cdf0e10cSrcweir 
1906*cdf0e10cSrcweir 	if(bOneAreaFlag)
1907*cdf0e10cSrcweir 	{
1908*cdf0e10cSrcweir 		nTmpCatPos=nFixedCategory;
1909*cdf0e10cSrcweir 	}
1910*cdf0e10cSrcweir 	else
1911*cdf0e10cSrcweir 	{
1912*cdf0e10cSrcweir 		nTmpCatPos=nPos;
1913*cdf0e10cSrcweir 	}
1914*cdf0e10cSrcweir 
1915*cdf0e10cSrcweir 	if(aLbCategory.GetEntryCount()==1 || nCurCategory!=nPos)
1916*cdf0e10cSrcweir 	{
1917*cdf0e10cSrcweir 		if(nTmpCatPos!=CAT_CURRENCY)
1918*cdf0e10cSrcweir 		{
1919*cdf0e10cSrcweir 			aPos.Y()=nStdFormatY;
1920*cdf0e10cSrcweir 			aSize.Height()=nStdFormatHeight;
1921*cdf0e10cSrcweir 			aLbFormat.SetPosSizePixel(aPos,aSize);
1922*cdf0e10cSrcweir 			aLbCurrency.Hide();
1923*cdf0e10cSrcweir 		}
1924*cdf0e10cSrcweir 		else
1925*cdf0e10cSrcweir 		{
1926*cdf0e10cSrcweir 			aPos.Y()=nCurFormatY;
1927*cdf0e10cSrcweir 			aSize.Height()=nCurFormatHeight;
1928*cdf0e10cSrcweir 			aLbFormat.SetPosSizePixel(aPos,aSize);
1929*cdf0e10cSrcweir 			aLbCurrency.Show();
1930*cdf0e10cSrcweir 		}
1931*cdf0e10cSrcweir 	}
1932*cdf0e10cSrcweir     aLbCategory.SelectEntryPos(nPos);
1933*cdf0e10cSrcweir }
1934*cdf0e10cSrcweir /* -----------------12.11.2002 14:35-----------------
1935*cdf0e10cSrcweir  * to support Writer text field language handling an
1936*cdf0e10cSrcweir  * additional entry needs to be inserted into the ListBox
1937*cdf0e10cSrcweir  * which marks a certain language as automatically detected
1938*cdf0e10cSrcweir  * Additionally the "Default" language is removed
1939*cdf0e10cSrcweir  * --------------------------------------------------*/
1940*cdf0e10cSrcweir void SvxNumberFormatTabPage::AddAutomaticLanguage_Impl(LanguageType eAutoLang, sal_Bool bSelect)
1941*cdf0e10cSrcweir {
1942*cdf0e10cSrcweir     aLbLanguage.RemoveLanguage(LANGUAGE_SYSTEM);
1943*cdf0e10cSrcweir     sal_uInt16 nPos = aLbLanguage.InsertEntry(sAutomaticEntry);
1944*cdf0e10cSrcweir     aLbLanguage.SetEntryData(nPos, (void*)(sal_uLong)eAutoLang);
1945*cdf0e10cSrcweir     if(bSelect)
1946*cdf0e10cSrcweir 		aLbLanguage.SelectEntryPos(nPos);
1947*cdf0e10cSrcweir }
1948*cdf0e10cSrcweir 
1949*cdf0e10cSrcweir void SvxNumberFormatTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
1950*cdf0e10cSrcweir {
1951*cdf0e10cSrcweir 	SFX_ITEMSET_ARG (&aSet,pNumberInfoItem,SvxNumberInfoItem,SID_ATTR_NUMBERFORMAT_INFO,sal_False);
1952*cdf0e10cSrcweir 	SFX_ITEMSET_ARG (&aSet,pLinkItem,SfxLinkItem,SID_LINK_TYPE,sal_False);
1953*cdf0e10cSrcweir 	if (pNumberInfoItem)
1954*cdf0e10cSrcweir 		SetNumberFormatList(*pNumberInfoItem);
1955*cdf0e10cSrcweir 	if (pLinkItem)
1956*cdf0e10cSrcweir 		SetOkHdl(pLinkItem->GetValue());
1957*cdf0e10cSrcweir }
1958