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 vcl::Window
45 : {
46 : private:
47 : OUString aPrevStr;
48 : Color aPrevCol;
49 : sal_Int32 mnPos;
50 : sal_Unicode mnChar;
51 : void InitSettings( bool bForeground, bool bBackground );
52 :
53 : protected:
54 : virtual void Paint( vcl::RenderContext& /*rRenderContext*/, 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(vcl::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 : friend class VclPtr<SvxNumberFormatTabPage>;
69 : using SfxTabPage::DeactivatePage;
70 : static const sal_uInt16 pRanges[];
71 :
72 : public:
73 : virtual ~SvxNumberFormatTabPage();
74 : virtual void dispose() SAL_OVERRIDE;
75 :
76 : static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
77 : const SfxItemSet* rAttrSet );
78 : // Returns area information.
79 0 : static const sal_uInt16* GetRanges() { return pRanges; }
80 :
81 : virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
82 : virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
83 : virtual sfxpg DeactivatePage ( SfxItemSet* pSet = NULL ) SAL_OVERRIDE;
84 :
85 : void SetInfoItem( const SvxNumberInfoItem& rItem );
86 0 : void SetNumberFormatList( const SvxNumberInfoItem& rItem )
87 0 : { SetInfoItem( rItem ); }
88 :
89 : void SetOkHdl( const Link<>& rOkHandler );
90 : void HideLanguage(bool nFlag=true);
91 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
92 : virtual void PageCreated(const SfxAllItemSet& aSet) SAL_OVERRIDE;
93 : private:
94 : SvxNumberFormatTabPage( vcl::Window* pParent,
95 : const SfxItemSet& rCoreAttrs );
96 : VclPtr<FixedText> m_pFtCategory;
97 : VclPtr<ListBox> m_pLbCategory;
98 : VclPtr<FixedText> m_pFtFormat;
99 : VclPtr<ListBox> m_pLbCurrency;
100 : VclPtr<SvxFontListBox> m_pLbFormat;
101 : VclPtr<FixedText> m_pFtLanguage;
102 : VclPtr<SvxLanguageBox> m_pLbLanguage;
103 : VclPtr<CheckBox> m_pCbSourceFormat;
104 : VclPtr<SvxNumberPreview> m_pWndPreview;
105 : VclPtr<FixedText> m_pFtOptions;
106 : VclPtr<FixedText> m_pFtDecimals;
107 : VclPtr<NumericField> m_pEdDecimals;
108 : VclPtr<CheckBox> m_pBtnNegRed;
109 : VclPtr<FixedText> m_pFtLeadZeroes;
110 : VclPtr<NumericField> m_pEdLeadZeroes;
111 : VclPtr<CheckBox> m_pBtnThousand;
112 :
113 : VclPtr<VclContainer> m_pFormatCodeFrame;
114 : VclPtr<Edit> m_pEdFormat;
115 : VclPtr<PushButton> m_pIbAdd;
116 : VclPtr<PushButton> m_pIbInfo;
117 : VclPtr<PushButton> m_pIbRemove;
118 :
119 : VclPtr<FixedText> m_pFtComment;
120 : VclPtr<Edit> m_pEdComment;
121 : Timer aResetWinTimer;
122 :
123 :
124 : SvxNumberInfoItem* pNumItem;
125 : SvxNumberFormatShell* pNumFmtShell;
126 : sal_uLong nInitFormat;
127 : Link<> fnOkHdl;
128 :
129 : bool bNumItemFlag; ///< for handling with DocShell
130 : bool bOneAreaFlag;
131 : short nFixedCategory;
132 :
133 : OUString sAutomaticEntry;
134 : OUString sThousandSeparator;
135 : OUString sEngineeringNotation;
136 :
137 : VclPtr<vcl::Window> pLastActivWindow;
138 :
139 : void Init_Impl();
140 : void FillCurrencyBox();
141 : void FillFormatListBox_Impl( std::vector<OUString>& rEntries );
142 : void UpdateOptions_Impl( bool bCheckCatChange );
143 : void UpdateFormatListBox_Impl( bool bCat, bool bUpdateEdit );
144 : void UpdateThousandEngineeringText();
145 : void Obstructing();
146 : void EnableBySourceFormat_Impl();
147 : void SetCategory( sal_uInt16 nPos );
148 : OUString GetExpColorString( Color*& rpPreviewColor, const OUString& aFormatStr, short nTmpCatPos );
149 : void MakePreviewText( const OUString& rFormat );
150 : void ChangePreviewText( sal_uInt16 nPos );
151 : void AddAutomaticLanguage_Impl(LanguageType eAutoLang, bool bSelect);
152 : // Handler
153 : DECL_LINK( LostFocusHdl_Impl, Edit* );
154 : DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* );
155 : DECL_LINK( SelFormatHdl_Impl, void * );
156 : DECL_LINK( ClickHdl_Impl, PushButton* );
157 : DECL_LINK( EditHdl_Impl, Edit* );
158 : DECL_LINK( OptHdl_Impl, void * );
159 : DECL_LINK_TYPED(TimeHdl_Impl, Timer *, void);
160 : };
161 :
162 : #endif
163 :
164 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|