Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef _SVX_NUMFMT_HXX
20 : #define _SVX_NUMFMT_HXX
21 :
22 : //------------------------------------------------------------------------
23 :
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>
35 :
36 : //------------------------------------------------------------------------
37 :
38 : class SvxNumberFormatShell;
39 : class SvxNumberInfoItem;
40 : class vector;
41 :
42 : //------------------------------------------------------------------------
43 :
44 0 : class SvxNumberPreview : public Window
45 : {
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 );
52 :
53 : protected:
54 : virtual void Paint( const Rectangle& rRect );
55 : virtual void StateChanged( StateChangedType nStateChange );
56 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
57 :
58 : public:
59 : SvxNumberPreview(Window* pParent, WinBits nStyle = WB_BORDER);
60 :
61 : void NotifyChange( const String& rPrevStr, const Color* pColor = NULL );
62 : };
63 :
64 : // -----------------------------------------------------------------------
65 :
66 : class SvxNumberFormatTabPage : public SfxTabPage
67 : {
68 : using SfxTabPage::DeactivatePage;
69 :
70 : public:
71 : ~SvxNumberFormatTabPage();
72 :
73 : static SfxTabPage* Create( Window* pParent,
74 : const SfxItemSet& rAttrSet );
75 : static sal_uInt16* GetRanges();
76 :
77 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
78 : virtual void Reset( const SfxItemSet& rSet );
79 : virtual int DeactivatePage ( SfxItemSet* pSet = NULL );
80 :
81 : void SetInfoItem( const SvxNumberInfoItem& rItem );
82 0 : void SetNumberFormatList( const SvxNumberInfoItem& rItem )
83 0 : { SetInfoItem( rItem ); }
84 :
85 : void SetOkHdl( const Link& rOkHandler );
86 : void HideLanguage(sal_Bool nFlag=sal_True);
87 : virtual long PreNotify( NotifyEvent& rNEvt );
88 : virtual void PageCreated (SfxAllItemSet aSet);
89 : private:
90 : SvxNumberFormatTabPage( Window* pParent,
91 : const SfxItemSet& rCoreAttrs );
92 : FixedText* m_pFtCategory;
93 : ListBox* m_pLbCategory;
94 : FixedText* m_pFtFormat;
95 : ListBox* m_pLbCurrency;
96 : SvxFontListBox* m_pLbFormat;
97 : FixedText* m_pFtLanguage;
98 : SvxLanguageBox* m_pLbLanguage;
99 : CheckBox* m_pCbSourceFormat;
100 : SvxNumberPreview* m_pWndPreview;
101 : FixedText* m_pFtOptions;
102 : FixedText* m_pFtDecimals;
103 : NumericField* m_pEdDecimals;
104 : CheckBox* m_pBtnNegRed;
105 : FixedText* m_pFtLeadZeroes;
106 : NumericField* m_pEdLeadZeroes;
107 : CheckBox* m_pBtnThousand;
108 :
109 : FixedText* m_pFtEdFormat;
110 : Edit* m_pEdFormat;
111 : PushButton* m_pIbAdd;
112 : PushButton* m_pIbInfo;
113 : PushButton* m_pIbRemove;
114 :
115 : FixedText* m_pFtComment;
116 : Edit* m_pEdComment;
117 : Timer aResetWinTimer;
118 :
119 :
120 : SvxNumberInfoItem* pNumItem;
121 : SvxNumberFormatShell* pNumFmtShell;
122 : sal_uLong nInitFormat;
123 : Link fnOkHdl;
124 :
125 : sal_Bool bNumItemFlag; ///< for handling with DocShell
126 : sal_Bool bOneAreaFlag;
127 : short nFixedCategory;
128 :
129 : String sAutomaticEntry;
130 :
131 : Window* pLastActivWindow;
132 :
133 : void Init_Impl();
134 : void FillCurrencyBox();
135 : void FillFormatListBox_Impl( std::vector<String*>& rEntries );
136 : void UpdateOptions_Impl( sal_Bool bCheckCatChange );
137 : void UpdateFormatListBox_Impl( sal_uInt16 bCat, sal_Bool bUpdateEdit );
138 : void DeleteEntryList_Impl( std::vector<String*>& rEntries );
139 : void Obstructing();
140 : void EnableBySourceFormat_Impl();
141 : void SetCategory( sal_uInt16 nPos );
142 : String GetExpColorString( Color*& rpPreviewColor, const String& aFormatStr, short nTmpCatPos );
143 : void MakePreviewText( const String& rFormat );
144 : void ChangePreviewText( sal_uInt16 nPos );
145 : void AddAutomaticLanguage_Impl(LanguageType eAutoLang, sal_Bool bSelect);
146 : // Handler
147 : DECL_LINK( LostFocusHdl_Impl, Edit* pEd );
148 : DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* pLb );
149 : DECL_LINK( SelFormatHdl_Impl, void * );
150 : DECL_LINK( ClickHdl_Impl, PushButton* pIB );
151 : DECL_LINK( EditHdl_Impl, Edit* pEdFormat );
152 : DECL_LINK( OptHdl_Impl, void * );
153 : DECL_LINK(TimeHdl_Impl, void *);
154 : };
155 :
156 : #endif
157 :
158 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|