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 INCLUDED_CUI_SOURCE_INC_NUMFMT_HXX
20 : #define INCLUDED_CUI_SOURCE_INC_NUMFMT_HXX
21 :
22 :
23 :
24 : #include <rtl/ustring.hxx>
25 : #include <sfx2/tabdlg.hxx>
26 : #include <svx/langbox.hxx>
27 : #include <svx/fontlb.hxx>
28 : #include <tools/color.hxx>
29 : #include <vcl/fixed.hxx>
30 : #include <vcl/lstbox.hxx>
31 : #include <vcl/edit.hxx>
32 : #include <vcl/toolbox.hxx>
33 : #include <vcl/field.hxx>
34 : #include <vcl/window.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 : OUString 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 ) SAL_OVERRIDE;
55 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
56 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
57 :
58 : public:
59 : SvxNumberPreview(Window* pParent, WinBits nStyle = WB_BORDER);
60 :
61 : void NotifyChange( const OUString& rPrevStr, const Color* pColor = NULL );
62 : };
63 :
64 :
65 :
66 : class SvxNumberFormatTabPage : public SfxTabPage
67 : {
68 : using SfxTabPage::DeactivatePage;
69 :
70 : public:
71 : virtual ~SvxNumberFormatTabPage();
72 :
73 : static SfxTabPage* Create( Window* pParent,
74 : const SfxItemSet& rAttrSet );
75 : static sal_uInt16* GetRanges();
76 :
77 : virtual bool FillItemSet( SfxItemSet& rSet ) SAL_OVERRIDE;
78 : virtual void Reset( const SfxItemSet& rSet ) SAL_OVERRIDE;
79 : virtual int DeactivatePage ( SfxItemSet* pSet = NULL ) SAL_OVERRIDE;
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 bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
88 : virtual void PageCreated (SfxAllItemSet aSet) SAL_OVERRIDE;
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 : VclContainer* m_pFormatCodeFrame;
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 : OUString sAutomaticEntry;
130 :
131 : Window* pLastActivWindow;
132 :
133 : void Init_Impl();
134 : void FillCurrencyBox();
135 : void FillFormatListBox_Impl( std::vector<OUString>& rEntries );
136 : void UpdateOptions_Impl( sal_Bool bCheckCatChange );
137 : void UpdateFormatListBox_Impl( sal_uInt16 bCat, sal_Bool bUpdateEdit );
138 : void Obstructing();
139 : void EnableBySourceFormat_Impl();
140 : void SetCategory( sal_uInt16 nPos );
141 : OUString GetExpColorString( Color*& rpPreviewColor, const OUString& aFormatStr, short nTmpCatPos );
142 : void MakePreviewText( const OUString& rFormat );
143 : void ChangePreviewText( sal_uInt16 nPos );
144 : void AddAutomaticLanguage_Impl(LanguageType eAutoLang, sal_Bool bSelect);
145 : // Handler
146 : DECL_LINK( LostFocusHdl_Impl, Edit* pEd );
147 : DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* pLb );
148 : DECL_LINK( SelFormatHdl_Impl, void * );
149 : DECL_LINK( ClickHdl_Impl, PushButton* pIB );
150 : DECL_LINK( EditHdl_Impl, Edit* pEdFormat );
151 : DECL_LINK( OptHdl_Impl, void * );
152 : DECL_LINK(TimeHdl_Impl, void *);
153 : };
154 :
155 : #endif
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|