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