update dev300-m58
[ooovba.git] / svx / source / cui / numfmt.hxx
blobc41ef12f92f8de42dc0750f44dce8fcc6f905cdf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: numfmt.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVX_NUMFMT_HXX
31 #define _SVX_NUMFMT_HXX
33 //------------------------------------------------------------------------
35 #include <vcl/window.hxx>
36 #include <tools/color.hxx>
37 #include <tools/string.hxx>
38 #include <sfx2/tabdlg.hxx>
40 #ifndef _FIXED_HXX //autogen
41 #include <vcl/fixed.hxx>
42 #endif
44 #ifndef _LSTBOX_HXX //autogen
45 #include <vcl/lstbox.hxx>
46 #endif
48 #ifndef _EDIT_HXX //autogen
49 #include <vcl/edit.hxx>
50 #endif
52 #ifndef _TOOLBOX_HXX //autogen
53 #include <vcl/toolbox.hxx>
54 #endif
56 #ifndef _FIELD_HXX //autogen
57 #include <vcl/field.hxx>
58 #endif
59 #include <svx/langbox.hxx>
60 #include "fontlb.hxx"
62 //CHINA001 #define SVX_NUMVAL_STANDARD -1234.12345678901234
63 //CHINA001 #define SVX_NUMVAL_CURRENCY -1234
64 //CHINA001 #define SVX_NUMVAL_PERCENT -0.1295
65 //CHINA001 #define SVX_NUMVAL_TIME 36525.5678935185
66 //CHINA001 #define SVX_NUMVAL_DATE 36525.5678935185
67 //CHINA001 #define SVX_NUMVAL_BOOLEAN 1
69 //------------------------------------------------------------------------
71 class SvxNumberFormatShell;
72 class SvxNumberInfoItem;
74 //------------------------------------------------------------------------
76 class SvxNumberPreviewImpl : public Window
78 private:
79 String aPrevStr;
80 Color aPrevCol;
82 void InitSettings( BOOL bForeground, BOOL bBackground );
84 protected:
85 virtual void Paint( const Rectangle& rRect );
86 virtual void StateChanged( StateChangedType nStateChange );
87 virtual void DataChanged( const DataChangedEvent& rDCEvt );
89 public:
90 SvxNumberPreviewImpl( Window* pParent, const ResId& rResId );
91 ~SvxNumberPreviewImpl();
93 void NotifyChange( const String& rPrevStr, const Color* pColor = NULL );
96 // -----------------------------------------------------------------------
98 #include <sfx2/layout.hxx>
99 #include <layout/layout-pre.hxx>
101 class SvxNumberFormatTabPage : public SfxTabPage
103 using SfxTabPage::DeactivatePage;
105 public:
106 ~SvxNumberFormatTabPage();
108 #undef SfxTabPage
109 #define SfxTabPage ::SfxTabPage
110 static SfxTabPage* Create( Window* pParent,
111 const SfxItemSet& rAttrSet );
112 static USHORT* GetRanges();
114 virtual BOOL FillItemSet( SfxItemSet& rSet );
115 virtual void Reset( const SfxItemSet& rSet );
116 virtual int DeactivatePage ( SfxItemSet* pSet = NULL );
118 void SetInfoItem( const SvxNumberInfoItem& rItem );
119 void SetNumberFormatList( const SvxNumberInfoItem& rItem )
120 { SetInfoItem( rItem ); }
122 void SetOkHdl( const Link& rOkHandler );
123 void HideLanguage(BOOL nFlag=TRUE);
124 virtual long PreNotify( NotifyEvent& rNEvt );
125 virtual void PageCreated (SfxAllItemSet aSet); //add CHINA001
126 private:
127 SvxNumberFormatTabPage( Window* pParent,
128 const SfxItemSet& rCoreAttrs );
129 FixedText aFtCategory;
130 ListBox aLbCategory;
131 FixedText aFtFormat;
132 ListBox aLbCurrency;
133 SvxFontListBox aLbFormat;
134 FixedText aFtLanguage;
135 SvxLanguageBox aLbLanguage;
136 CheckBox aCbSourceFormat;
138 FixedText aFtDecimals;
139 NumericField aEdDecimals;
140 FixedText aFtLeadZeroes;
141 NumericField aEdLeadZeroes;
142 CheckBox aBtnNegRed;
143 CheckBox aBtnThousand;
144 FixedLine aFlOptions;
146 FixedText aFtEdFormat;
147 Edit aEdFormat;
148 ImageButton aIbAdd;
149 ImageButton aIbInfo;
150 ImageButton aIbRemove;
152 FixedText aFtComment;
153 Edit aEdComment;
154 Timer aResetWinTimer;
156 SvxNumberPreviewImpl aWndPreview;
158 SvxNumberInfoItem* pNumItem;
159 SvxNumberFormatShell* pNumFmtShell;
160 ULONG nInitFormat;
161 Link fnOkHdl;
163 BOOL bNumItemFlag; //Fuer Handling mit DocShell
164 BOOL bOneAreaFlag;
165 short nFixedCategory;
167 long nCatHeight;
169 long nCurFormatY;
170 long nCurFormatHeight;
171 long nStdFormatY;
172 long nStdFormatHeight;
173 LocalizedString aStrEurope;
174 LocalizedString sAutomaticEntry;
176 Window* pLastActivWindow;
178 #ifdef _SVX_NUMFMT_CXX
179 void Init_Impl();
180 void FillCurrencyBox();
181 void FillFormatListBox_Impl( SvxDelStrgs& rEntries );
182 void UpdateOptions_Impl( BOOL bCheckCatChange );
183 void UpdateFormatListBox_Impl( USHORT bCat, BOOL bUpdateEdit );
184 void DeleteEntryList_Impl( SvxDelStrgs& rEntries );
185 void Obstructing();
186 void EnableBySourceFormat_Impl();
187 void SetCategory( USHORT nPos );
188 String GetExpColorString( Color*& rpPreviewColor, const String& aFormatStr, short nTmpCatPos );
189 void MakePreviewText( const String& rFormat );
190 void ChangePreviewText( USHORT nPos );
191 void AddAutomaticLanguage_Impl(LanguageType eAutoLang, BOOL bSelect);
192 // Handler
193 DECL_LINK( LostFocusHdl_Impl, Edit* pEd );
194 DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* pLb );
195 DECL_LINK( SelFormatHdl_Impl, void * );
196 DECL_LINK( ClickHdl_Impl, ImageButton* pIB );
197 DECL_LINK( EditHdl_Impl, Edit* pEdFormat );
198 DECL_LINK( OptHdl_Impl, void * );
199 DECL_LINK( TimeHdl_Impl, Timer * );
201 #endif
204 #include <layout/layout-post.hxx>
206 #endif