LibreOffice Module cui (master)  1
numfmt.hxx
Go to the documentation of this file.
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 #include <rtl/ustring.hxx>
24 #include <sfx2/tabdlg.hxx>
25 #include <svx/langbox.hxx>
26 #include <tools/color.hxx>
27 #include <vcl/customweld.hxx>
28 #include <vcl/weld.hxx>
29 
31 class SvxNumberInfoItem;
32 class vector;
33 
34 
36 {
37 private:
38  OUString aPrevStr;
40  sal_Int32 mnPos;
42 
43 protected:
44  virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
45 
46 public:
48 
49  void NotifyChange( const OUString& rPrevStr, const Color* pColor = nullptr );
50 
51  virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
52  {
53  CustomWidgetController::SetDrawingArea(pDrawingArea);
54  pDrawingArea->set_size_request(-1, pDrawingArea->get_text_height() * 3);
55  }
56 };
57 
59 {
62  static const sal_uInt16 pRanges[];
63 
64 public:
65  virtual ~SvxNumberFormatTabPage() override;
66  virtual void dispose() override;
67 
68  static VclPtr<SfxTabPage> Create( TabPageParent pParent,
69  const SfxItemSet* rAttrSet );
70  // Returns area information.
71  static const sal_uInt16* GetRanges() { return pRanges; }
72 
73  virtual bool FillItemSet( SfxItemSet* rSet ) override;
74  virtual void Reset( const SfxItemSet* rSet ) override;
75  virtual DeactivateRC DeactivatePage ( SfxItemSet* pSet ) override;
76 
77  void HideLanguage(bool bFlag=true);
78  virtual void PageCreated(const SfxAllItemSet& aSet) override;
79 private:
80  SvxNumberFormatTabPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs);
81 
82  std::unique_ptr<SvxNumberInfoItem> pNumItem;
83  std::unique_ptr<SvxNumberFormatShell> pNumFmtShell;
85 
86  bool bNumItemFlag;
90 
93 
95  std::unique_ptr<weld::Label> m_xFtCategory;
96  std::unique_ptr<weld::TreeView> m_xLbCategory;
97  std::unique_ptr<weld::Label> m_xFtFormat;
98  std::unique_ptr<weld::ComboBox> m_xLbCurrency;
99  std::unique_ptr<weld::TreeView> m_xLbFormat;
100  std::unique_ptr<weld::Label> m_xFtLanguage;
101  std::unique_ptr<weld::CheckButton> m_xCbSourceFormat;
102  std::unique_ptr<weld::Label> m_xFtOptions;
103  std::unique_ptr<weld::Label> m_xFtDecimals;
104  std::unique_ptr<weld::SpinButton> m_xEdDecimals;
105  std::unique_ptr<weld::Label> m_xFtDenominator;
106  std::unique_ptr<weld::SpinButton> m_xEdDenominator;
107  std::unique_ptr<weld::CheckButton> m_xBtnNegRed;
108  std::unique_ptr<weld::Label> m_xFtLeadZeroes;
109  std::unique_ptr<weld::SpinButton> m_xEdLeadZeroes;
110  std::unique_ptr<weld::CheckButton> m_xBtnThousand;
111  std::unique_ptr<weld::CheckButton> m_xBtnEngineering;
112  std::unique_ptr<weld::Widget> m_xFormatCodeFrame;
113  std::unique_ptr<weld::Entry> m_xEdFormat;
114  std::unique_ptr<weld::Button> m_xIbAdd;
115  std::unique_ptr<weld::Button> m_xIbInfo;
116  std::unique_ptr<weld::Button> m_xIbRemove;
117  std::unique_ptr<weld::Label> m_xFtComment;
118  std::unique_ptr<weld::Entry> m_xEdComment;
119  std::unique_ptr<LanguageBox> m_xLbLanguage;
120  std::unique_ptr<weld::CustomWeld> m_xWndPreview;
121 
122  void Init_Impl();
123  void FillCurrencyBox();
124  void FillFormatListBox_Impl( std::vector<OUString>& rEntries );
125  void UpdateOptions_Impl( bool bCheckCatChange );
126  void UpdateFormatListBox_Impl( bool bCat, bool bUpdateEdit );
129  void Obstructing();
131  void SetCategory( sal_uInt16 nPos );
132  OUString GetExpColorString( Color*& rpPreviewColor, const OUString& aFormatStr, short nTmpCatPos );
133  void MakePreviewText( const OUString& rFormat );
134  void ChangePreviewText( sal_uInt16 nPos );
135  void AddAutomaticLanguage_Impl(LanguageType eAutoLang, bool bSelect);
136  bool Click_Impl(weld::Button& rIB);
137  // Handler
138  DECL_LINK(LostFocusHdl_Impl, weld::Widget&, void);
139  DECL_LINK(DoubleClickHdl_Impl, weld::TreeView&, void);
140  DECL_LINK(SelFormatListBoxHdl_Impl, weld::ComboBox&, void);
141  DECL_LINK(SelFormatTreeListBoxHdl_Impl, weld::TreeView&, void);
142  DECL_LINK(SelFormatClickHdl_Impl, weld::Button&, void);
144  DECL_LINK(ClickHdl_Impl, weld::Button&, void);
145  DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
146  DECL_LINK(OptEditHdl_Impl, weld::SpinButton&, void);
147  DECL_LINK(OptClickHdl_Impl, weld::Button&, void);
148  DECL_LINK(TimeHdl_Impl, Timer*, void);
149  void EditHdl_Impl(const weld::Entry*);
150  void OptHdl_Impl(const weld::Widget*);
151 
152  // set and get currency, taking into account if the legacy
153  // automatic currency entry exists
154  void set_active_currency(sal_Int32 nCurCurrencyEntryPos);
155  sal_uInt32 get_active_currency() const;
156 
157 };
158 
159 #endif
160 
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool Click_Impl(weld::Button &rIB)
Definition: numfmt.cxx:1290
std::unique_ptr< weld::CustomWeld > m_xWndPreview
Definition: numfmt.hxx:120
std::unique_ptr< SvxNumberFormatShell > pNumFmtShell
Definition: numfmt.hxx:83
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: numfmt.cxx:138
std::unique_ptr< weld::Label > m_xFtOptions
Definition: numfmt.hxx:102
void HideLanguage(bool bFlag=true)
Definition: numfmt.cxx:657
std::unique_ptr< weld::Label > m_xFtLanguage
Definition: numfmt.hxx:100
Color aPrevCol
Definition: numfmt.hxx:39
const SfxItemSet * pSet
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: numfmt.hxx:51
OUString aPrevStr
Definition: numfmt.hxx:38
OUString sAutomaticCurrencyEntry
Definition: numfmt.hxx:92
std::unique_ptr< weld::Widget > m_xFormatCodeFrame
Definition: numfmt.hxx:112
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: numfmt.cxx:775
OUString GetExpColorString(Color *&rpPreviewColor, const OUString &aFormatStr, short nTmpCatPos)
Definition: numfmt.cxx:1631
sal_uIntPtr sal_uLong
std::unique_ptr< weld::CheckButton > m_xBtnNegRed
Definition: numfmt.hxx:107
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: numfmt.cxx:1737
void OptHdl_Impl(const weld::Widget *)
Definition: numfmt.cxx:1541
sal_uLong nInitFormat
Definition: numfmt.hxx:84
std::unique_ptr< weld::Button > m_xIbInfo
Definition: numfmt.hxx:115
void EnableBySourceFormat_Impl()
Definition: numfmt.cxx:620
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: numfmt.cxx:676
SvxNumberFormatTabPage(TabPageParent pParent, const SfxItemSet &rCoreAttrs)
Definition: numfmt.cxx:194
void NotifyChange(const OUString &rPrevStr, const Color *pColor=nullptr)
Definition: numfmt.cxx:97
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet)
void SelFormatHdl_Impl(weld::Widget *)
Definition: numfmt.cxx:1171
sal_uInt16 sal_Unicode
static const sal_uInt16 pRanges[]
Definition: numfmt.hxx:62
std::unique_ptr< SvxNumberInfoItem > pNumItem
Definition: numfmt.hxx:82
std::unique_ptr< weld::CheckButton > m_xBtnEngineering
Definition: numfmt.hxx:111
std::unique_ptr< LanguageBox > m_xLbLanguage
Definition: numfmt.hxx:119
std::unique_ptr< weld::TreeView > m_xLbCategory
Definition: numfmt.hxx:96
void FillFormatListBox_Impl(std::vector< OUString > &rEntries)
Definition: numfmt.cxx:782
void UpdateThousandEngineeringCheckBox()
Change visible checkbox according to category format if scientific format "Engineering notation" else...
Definition: numfmt.cxx:1097
std::unique_ptr< weld::CheckButton > m_xCbSourceFormat
Definition: numfmt.hxx:101
bool bNumItemFlag
for handling with DocShell
Definition: numfmt.hxx:86
std::unique_ptr< weld::Label > m_xFtComment
Definition: numfmt.hxx:117
std::unique_ptr< weld::ComboBox > m_xLbCurrency
Definition: numfmt.hxx:98
std::unique_ptr< weld::Entry > m_xEdFormat
Definition: numfmt.hxx:113
void SetCategory(sal_uInt16 nPos)
Definition: numfmt.cxx:1700
std::unique_ptr< weld::Label > m_xFtDecimals
Definition: numfmt.hxx:103
virtual void Reset(const SfxItemSet *rSet) override
Definition: numfmt.cxx:363
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: numfmt.cxx:321
virtual void dispose() override
Definition: numfmt.cxx:250
sal_Int32 mnPos
Definition: numfmt.hxx:40
std::unique_ptr< weld::Label > m_xFtFormat
Definition: numfmt.hxx:97
static const sal_uInt16 * GetRanges()
Definition: numfmt.hxx:71
std::unique_ptr< weld::Button > m_xIbRemove
Definition: numfmt.hxx:116
std::unique_ptr< weld::Label > m_xFtCategory
Definition: numfmt.hxx:95
void MakePreviewText(const OUString &rFormat)
Definition: numfmt.cxx:1667
sal_Unicode mnChar
Definition: numfmt.hxx:41
void set_active_currency(sal_Int32 nCurCurrencyEntryPos)
Definition: numfmt.cxx:340
void EditHdl_Impl(const weld::Entry *)
Definition: numfmt.cxx:1465
std::unique_ptr< weld::CheckButton > m_xBtnThousand
Definition: numfmt.hxx:110
std::unique_ptr< weld::Button > m_xIbAdd
Definition: numfmt.hxx:114
std::unique_ptr< weld::Entry > m_xEdComment
Definition: numfmt.hxx:118
std::unique_ptr< weld::Label > m_xFtLeadZeroes
Definition: numfmt.hxx:108
virtual int get_text_height() const =0
std::unique_ptr< weld::SpinButton > m_xEdLeadZeroes
Definition: numfmt.hxx:109
DECL_LINK(LostFocusHdl_Impl, weld::Widget &, void)
std::unique_ptr< weld::SpinButton > m_xEdDecimals
Definition: numfmt.hxx:104
DeactivateRC
bool bLegacyAutomaticCurrency
Definition: numfmt.hxx:88
std::unique_ptr< weld::TreeView > m_xLbFormat
Definition: numfmt.hxx:99
void UpdateDecimalsDenominatorEditBox()
Change visible Edit box and Fixed text according to category format if fraction format "Denominator p...
Definition: numfmt.cxx:1111
sal_uInt32 get_active_currency() const
Definition: numfmt.cxx:354
void UpdateFormatListBox_Impl(bool bCat, bool bUpdateEdit)
Definition: numfmt.cxx:998
virtual void set_size_request(int nWidth, int nHeight)=0
void UpdateOptions_Impl(bool bCheckCatChange)
Definition: numfmt.cxx:856
virtual ~SvxNumberFormatTabPage() override
Definition: numfmt.cxx:245
void AddAutomaticLanguage_Impl(LanguageType eAutoLang, bool bSelect)
Definition: numfmt.cxx:1729
OUString sAutomaticLangEntry
Definition: numfmt.hxx:91
SvxNumberPreview m_aWndPreview
Definition: numfmt.hxx:94
void ChangePreviewText(sal_uInt16 nPos)
Definition: numfmt.cxx:1675
std::unique_ptr< weld::Label > m_xFtDenominator
Definition: numfmt.hxx:105
std::unique_ptr< weld::SpinButton > m_xEdDenominator
Definition: numfmt.hxx:106