1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_CUI_SOURCE_INC_NUMFMT_HXX
20 #define INCLUDED_CUI_SOURCE_INC_NUMFMT_HXX
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>
38 class SvxNumberFormatShell
;
39 class SvxNumberInfoItem
;
44 class SvxNumberPreview
: public vcl::Window
51 void InitSettings( bool bForeground
, bool bBackground
);
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
;
59 SvxNumberPreview(vcl::Window
* pParent
, WinBits nStyle
= WB_BORDER
);
61 void NotifyChange( const OUString
& rPrevStr
, const Color
* pColor
= NULL
);
66 class SvxNumberFormatTabPage
: public SfxTabPage
68 friend class VclPtr
<SvxNumberFormatTabPage
>;
69 using SfxTabPage::DeactivatePage
;
70 static const sal_uInt16 pRanges
[];
73 virtual ~SvxNumberFormatTabPage();
74 virtual void dispose() SAL_OVERRIDE
;
76 static VclPtr
<SfxTabPage
> Create( vcl::Window
* pParent
,
77 const SfxItemSet
* rAttrSet
);
78 // Returns area information.
79 static const sal_uInt16
* GetRanges() { return pRanges
; }
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
;
85 void SetInfoItem( const SvxNumberInfoItem
& rItem
);
86 void SetNumberFormatList( const SvxNumberInfoItem
& rItem
)
87 { SetInfoItem( rItem
); }
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
;
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
;
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
;
119 VclPtr
<FixedText
> m_pFtComment
;
120 VclPtr
<Edit
> m_pEdComment
;
121 Timer aResetWinTimer
;
124 SvxNumberInfoItem
* pNumItem
;
125 SvxNumberFormatShell
* pNumFmtShell
;
126 sal_uLong nInitFormat
;
129 bool bNumItemFlag
; ///< for handling with DocShell
131 short nFixedCategory
;
133 OUString sAutomaticEntry
;
134 OUString sThousandSeparator
;
135 OUString sEngineeringNotation
;
137 VclPtr
<vcl::Window
> pLastActivWindow
;
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();
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
);
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);
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */