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