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