Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / cui / source / inc / numfmt.hxx
blob0328b092069eb79266d59f9a3b515e42f77945a6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _SVX_NUMFMT_HXX
20 #define _SVX_NUMFMT_HXX
22 //------------------------------------------------------------------------
24 #include <vcl/window.hxx>
25 #include <tools/color.hxx>
26 #include <tools/string.hxx>
27 #include <sfx2/tabdlg.hxx>
28 #include <vcl/fixed.hxx>
29 #include <vcl/lstbox.hxx>
30 #include <vcl/edit.hxx>
31 #include <vcl/toolbox.hxx>
32 #include <vcl/field.hxx>
33 #include <svx/langbox.hxx>
34 #include <svx/fontlb.hxx>
36 //------------------------------------------------------------------------
38 class SvxNumberFormatShell;
39 class SvxNumberInfoItem;
40 class vector;
42 //------------------------------------------------------------------------
44 class SvxNumberPreviewImpl : public Window
46 private:
47 String aPrevStr;
48 Color aPrevCol;
49 sal_Int32 mnPos;
50 sal_Unicode mnChar;
51 void InitSettings( sal_Bool bForeground, sal_Bool bBackground );
53 protected:
54 virtual void Paint( const Rectangle& rRect );
55 virtual void StateChanged( StateChangedType nStateChange );
56 virtual void DataChanged( const DataChangedEvent& rDCEvt );
58 public:
59 SvxNumberPreviewImpl( Window* pParent, const ResId& rResId );
60 ~SvxNumberPreviewImpl();
62 void NotifyChange( const String& rPrevStr, const Color* pColor = NULL );
65 // -----------------------------------------------------------------------
67 class SvxNumberFormatTabPage : public SfxTabPage
69 using SfxTabPage::DeactivatePage;
71 public:
72 ~SvxNumberFormatTabPage();
74 static SfxTabPage* Create( Window* pParent,
75 const SfxItemSet& rAttrSet );
76 static sal_uInt16* GetRanges();
78 virtual sal_Bool FillItemSet( SfxItemSet& rSet );
79 virtual void Reset( const SfxItemSet& rSet );
80 virtual int DeactivatePage ( SfxItemSet* pSet = NULL );
82 void SetInfoItem( const SvxNumberInfoItem& rItem );
83 void SetNumberFormatList( const SvxNumberInfoItem& rItem )
84 { SetInfoItem( rItem ); }
86 void SetOkHdl( const Link& rOkHandler );
87 void HideLanguage(sal_Bool nFlag=sal_True);
88 virtual long PreNotify( NotifyEvent& rNEvt );
89 virtual void PageCreated (SfxAllItemSet aSet);
90 private:
91 SvxNumberFormatTabPage( Window* pParent,
92 const SfxItemSet& rCoreAttrs );
93 FixedText aFtCategory;
94 ListBox aLbCategory;
95 FixedText aFtFormat;
96 ListBox aLbCurrency;
97 SvxFontListBox aLbFormat;
98 FixedText aFtLanguage;
99 SvxLanguageBox aLbLanguage;
100 CheckBox aCbSourceFormat;
101 SvxNumberPreviewImpl aWndPreview;
102 FixedLine aFlOptions;
103 FixedText aFtDecimals;
104 NumericField aEdDecimals;
105 CheckBox aBtnNegRed;
106 FixedText aFtLeadZeroes;
107 NumericField aEdLeadZeroes;
108 CheckBox aBtnThousand;
110 FixedText aFtEdFormat;
111 Edit aEdFormat;
112 ImageButton aIbAdd;
113 ImageButton aIbInfo;
114 ImageButton aIbRemove;
116 FixedText aFtComment;
117 Edit aEdComment;
118 Timer aResetWinTimer;
121 SvxNumberInfoItem* pNumItem;
122 SvxNumberFormatShell* pNumFmtShell;
123 sal_uLong nInitFormat;
124 Link fnOkHdl;
126 sal_Bool bNumItemFlag; ///< for handling with DocShell
127 sal_Bool bOneAreaFlag;
128 short nFixedCategory;
130 long nCatHeight;
132 long nCurFormatY;
133 long nCurFormatHeight;
134 long nStdFormatY;
135 long nStdFormatHeight;
136 String sAutomaticEntry;
138 Window* pLastActivWindow;
140 #ifdef _SVX_NUMFMT_CXX
141 void Init_Impl();
142 void FillCurrencyBox();
143 void FillFormatListBox_Impl( std::vector<String*>& rEntries );
144 void UpdateOptions_Impl( sal_Bool bCheckCatChange );
145 void UpdateFormatListBox_Impl( sal_uInt16 bCat, sal_Bool bUpdateEdit );
146 void DeleteEntryList_Impl( std::vector<String*>& rEntries );
147 void Obstructing();
148 void EnableBySourceFormat_Impl();
149 void SetCategory( sal_uInt16 nPos );
150 String GetExpColorString( Color*& rpPreviewColor, const String& aFormatStr, short nTmpCatPos );
151 void MakePreviewText( const String& rFormat );
152 void ChangePreviewText( sal_uInt16 nPos );
153 void AddAutomaticLanguage_Impl(LanguageType eAutoLang, sal_Bool bSelect);
154 // Handler
155 DECL_LINK( LostFocusHdl_Impl, Edit* pEd );
156 DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* pLb );
157 DECL_LINK( SelFormatHdl_Impl, void * );
158 DECL_LINK( ClickHdl_Impl, ImageButton* pIB );
159 DECL_LINK( EditHdl_Impl, Edit* pEdFormat );
160 DECL_LINK( OptHdl_Impl, void * );
161 DECL_LINK(TimeHdl_Impl, void *);
163 #endif
166 #endif
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */