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#pragma once
20
21
22#include <rtl/ustring.hxx>
23#include <sfx2/tabdlg.hxx>
24#include <svx/langbox.hxx>
25#include <tools/color.hxx>
26#include <vcl/customweld.hxx>
27#include <vcl/weld.hxx>
28
31class vector;
32
33
35{
36private:
37 OUString aPrevStr;
39 sal_Int32 mnPos;
41
42protected:
43 virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
44
45public:
47
48 void NotifyChange( const OUString& rPrevStr, const Color* pColor = nullptr );
49
50 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
51 {
52 CustomWidgetController::SetDrawingArea(pDrawingArea);
53 pDrawingArea->set_size_request(-1, pDrawingArea->get_text_height() * 3);
54 }
55};
56
58{
60
61public:
62 SvxNumberFormatTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs);
63 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
64 const SfxItemSet* rAttrSet );
65 virtual ~SvxNumberFormatTabPage() override;
66 // Returns area information.
68
69 virtual bool FillItemSet( SfxItemSet* rSet ) override;
70 virtual void Reset( const SfxItemSet* rSet ) override;
71 virtual DeactivateRC DeactivatePage ( SfxItemSet* pSet ) override;
72
73 void HideLanguage(bool bFlag=true);
74 virtual void PageCreated(const SfxAllItemSet& aSet) override;
75
76private:
77 std::unique_ptr<SvxNumberInfoItem> pNumItem;
78 std::unique_ptr<SvxNumberFormatShell> pNumFmtShell;
79 sal_uInt32 nInitFormat;
81
86
89
91 std::unique_ptr<weld::Label> m_xFtCategory;
92 std::unique_ptr<weld::TreeView> m_xLbCategory;
93 std::unique_ptr<weld::Label> m_xFtFormat;
94 std::unique_ptr<weld::ComboBox> m_xLbCurrency;
95 std::unique_ptr<weld::TreeView> m_xLbFormat;
96 std::unique_ptr<weld::Label> m_xFtLanguage;
97 std::unique_ptr<weld::CheckButton> m_xCbSourceFormat;
98 std::unique_ptr<weld::Label> m_xFtOptions;
99 std::unique_ptr<weld::Label> m_xFtDecimals;
100 std::unique_ptr<weld::SpinButton> m_xEdDecimals;
101 std::unique_ptr<weld::Label> m_xFtDenominator;
102 std::unique_ptr<weld::SpinButton> m_xEdDenominator;
103 std::unique_ptr<weld::CheckButton> m_xBtnNegRed;
104 std::unique_ptr<weld::Label> m_xFtLeadZeroes;
105 std::unique_ptr<weld::SpinButton> m_xEdLeadZeroes;
106 std::unique_ptr<weld::CheckButton> m_xBtnThousand;
107 std::unique_ptr<weld::CheckButton> m_xBtnEngineering;
108 std::unique_ptr<weld::Widget> m_xFormatCodeFrame;
109 std::unique_ptr<weld::Entry> m_xEdFormat;
110 std::unique_ptr<weld::Button> m_xIbAdd;
111 std::unique_ptr<weld::Button> m_xIbInfo;
112 std::unique_ptr<weld::Button> m_xIbRemove;
113 std::unique_ptr<weld::Label> m_xFtComment;
114 std::unique_ptr<weld::Entry> m_xEdComment;
115 std::unique_ptr<SvxLanguageBox> m_xLbLanguage;
116 std::unique_ptr<weld::CustomWeld> m_xWndPreview;
117
118 void Init_Impl();
119 void FillCurrencyBox();
120 void FillFormatListBox_Impl( std::vector<OUString>& rEntries );
121 void UpdateOptions_Impl( bool bCheckCatChange );
122 void UpdateFormatListBox_Impl( bool bCat, bool bUpdateEdit );
125 void Obstructing();
127 void SetCategory( sal_uInt16 nPos );
128 OUString GetExpColorString( const Color*& rpPreviewColor, const OUString& aFormatStr, short nTmpCatPos );
129 void MakePreviewText( const OUString& rFormat );
130 void ChangePreviewText( sal_uInt16 nPos );
131 void AddAutomaticLanguage_Impl(LanguageType eAutoLang, bool bSelect);
132 bool Click_Impl(const weld::Button& rIB);
133 // Handler
134 DECL_LINK(LostFocusHdl_Impl, weld::Widget&, void);
135 DECL_LINK(DoubleClickHdl_Impl, weld::TreeView&, bool);
136 DECL_LINK(SelFormatListBoxHdl_Impl, weld::ComboBox&, void);
137 DECL_LINK(SelFormatTreeListBoxHdl_Impl, weld::TreeView&, void);
138 DECL_LINK(SelFormatClickHdl_Impl, weld::Toggleable&, void);
140 DECL_LINK(ClickHdl_Impl, weld::Button&, void);
141 DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
142 DECL_LINK(OptEditHdl_Impl, weld::SpinButton&, void);
143 DECL_LINK(OptClickHdl_Impl, weld::Toggleable&, void);
144 void EditHdl_Impl(const weld::Entry*);
145 void OptHdl_Impl(const weld::Widget*);
146
147 // set and get currency, taking into account if the legacy
148 // automatic currency entry exists
149 void set_active_currency(sal_Int32 nCurCurrencyEntryPos);
150 sal_uInt32 get_active_currency() const;
151
152};
153
154/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxItemSet * pSet
void UpdateFormatListBox_Impl(bool bCat, bool bUpdateEdit)
Definition: numfmt.cxx:978
std::unique_ptr< weld::CheckButton > m_xCbSourceFormat
Definition: numfmt.hxx:97
void AddAutomaticLanguage_Impl(LanguageType eAutoLang, bool bSelect)
Definition: numfmt.cxx:1745
DECL_LINK(ClickHdl_Impl, weld::Button &, void)
std::unique_ptr< weld::CheckButton > m_xBtnNegRed
Definition: numfmt.hxx:103
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: numfmt.cxx:1753
void FillFormatListBox_Impl(std::vector< OUString > &rEntries)
Definition: numfmt.cxx:761
OUString sAutomaticLangEntry
Definition: numfmt.hxx:87
std::unique_ptr< weld::TreeView > m_xLbCategory
Definition: numfmt.hxx:92
DECL_LINK(EditModifyHdl_Impl, weld::Entry &, void)
DECL_LINK(LostFocusHdl_Impl, weld::Widget &, void)
std::unique_ptr< weld::CustomWeld > m_xWndPreview
Definition: numfmt.hxx:116
std::unique_ptr< weld::CheckButton > m_xBtnThousand
Definition: numfmt.hxx:106
std::unique_ptr< SvxLanguageBox > m_xLbLanguage
Definition: numfmt.hxx:115
void UpdateOptions_Impl(bool bCheckCatChange)
Definition: numfmt.cxx:835
std::unique_ptr< weld::Label > m_xFtComment
Definition: numfmt.hxx:113
std::unique_ptr< weld::Button > m_xIbRemove
Definition: numfmt.hxx:112
virtual void Reset(const SfxItemSet *rSet) override
Definition: numfmt.cxx:349
void ChangePreviewText(sal_uInt16 nPos)
Definition: numfmt.cxx:1691
std::unique_ptr< weld::Widget > m_xFormatCodeFrame
Definition: numfmt.hxx:108
void SelFormatHdl_Impl(weld::Widget *)
Definition: numfmt.cxx:1151
SvxNumberPreview m_aWndPreview
Definition: numfmt.hxx:90
DECL_LINK(SelFormatListBoxHdl_Impl, weld::ComboBox &, void)
void set_active_currency(sal_Int32 nCurCurrencyEntryPos)
Definition: numfmt.cxx:326
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: numfmt.cxx:307
std::unique_ptr< SvxNumberInfoItem > pNumItem
Definition: numfmt.hxx:77
void EnableBySourceFormat_Impl()
Definition: numfmt.cxx:600
DECL_LINK(OptClickHdl_Impl, weld::Toggleable &, void)
std::unique_ptr< weld::SpinButton > m_xEdDecimals
Definition: numfmt.hxx:100
sal_uInt32 get_active_currency() const
Definition: numfmt.cxx:340
static const WhichRangesContainer pRanges
Definition: numfmt.hxx:59
std::unique_ptr< SvxNumberFormatShell > pNumFmtShell
Definition: numfmt.hxx:78
DECL_LINK(SelFormatTreeListBoxHdl_Impl, weld::TreeView &, void)
std::unique_ptr< weld::TreeView > m_xLbFormat
Definition: numfmt.hxx:95
short m_nLbFormatSelPosEdComment
Definition: numfmt.hxx:80
SvxNumberFormatTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
Definition: numfmt.cxx:184
void UpdateDecimalsDenominatorEditBox()
Change visible Edit box and Fixed text according to category format if fraction format "Denominator p...
Definition: numfmt.cxx:1091
virtual ~SvxNumberFormatTabPage() override
Definition: numfmt.cxx:236
sal_uInt32 nInitFormat
Definition: numfmt.hxx:79
bool Click_Impl(const weld::Button &rIB)
Definition: numfmt.cxx:1282
DECL_LINK(DoubleClickHdl_Impl, weld::TreeView &, bool)
void EditHdl_Impl(const weld::Entry *)
Definition: numfmt.cxx:1462
std::unique_ptr< weld::Entry > m_xEdFormat
Definition: numfmt.hxx:109
void HideLanguage(bool bFlag=true)
Definition: numfmt.cxx:637
std::unique_ptr< weld::SpinButton > m_xEdLeadZeroes
Definition: numfmt.hxx:105
std::unique_ptr< weld::Button > m_xIbAdd
Definition: numfmt.hxx:110
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: numfmt.cxx:754
std::unique_ptr< weld::ComboBox > m_xLbCurrency
Definition: numfmt.hxx:94
std::unique_ptr< weld::Label > m_xFtCategory
Definition: numfmt.hxx:91
void UpdateThousandEngineeringCheckBox()
Change visible checkbox according to category format if scientific format "Engineering notation" else...
Definition: numfmt.cxx:1077
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: numfmt.cxx:656
void SetCategory(sal_uInt16 nPos)
Definition: numfmt.cxx:1716
std::unique_ptr< weld::Label > m_xFtDecimals
Definition: numfmt.hxx:99
DECL_LINK(SelFormatClickHdl_Impl, weld::Toggleable &, void)
std::unique_ptr< weld::Entry > m_xEdComment
Definition: numfmt.hxx:114
std::unique_ptr< weld::Label > m_xFtDenominator
Definition: numfmt.hxx:101
std::unique_ptr< weld::Label > m_xFtLeadZeroes
Definition: numfmt.hxx:104
bool bLegacyAutomaticCurrency
Definition: numfmt.hxx:84
std::unique_ptr< weld::Label > m_xFtLanguage
Definition: numfmt.hxx:96
static WhichRangesContainer GetRanges()
Definition: numfmt.hxx:67
std::unique_ptr< weld::CheckButton > m_xBtnEngineering
Definition: numfmt.hxx:107
void OptHdl_Impl(const weld::Widget *)
Definition: numfmt.cxx:1538
OUString sAutomaticCurrencyEntry
Definition: numfmt.hxx:88
DECL_LINK(OptEditHdl_Impl, weld::SpinButton &, void)
std::unique_ptr< weld::Label > m_xFtFormat
Definition: numfmt.hxx:93
std::unique_ptr< weld::SpinButton > m_xEdDenominator
Definition: numfmt.hxx:102
void MakePreviewText(const OUString &rFormat)
Definition: numfmt.cxx:1683
std::unique_ptr< weld::Button > m_xIbInfo
Definition: numfmt.hxx:111
std::unique_ptr< weld::Label > m_xFtOptions
Definition: numfmt.hxx:98
OUString GetExpColorString(const Color *&rpPreviewColor, const OUString &aFormatStr, short nTmpCatPos)
Definition: numfmt.cxx:1637
bool bNumItemFlag
for handling with DocShell
Definition: numfmt.hxx:82
Color aPrevCol
Definition: numfmt.hxx:38
sal_Int32 mnPos
Definition: numfmt.hxx:39
sal_Unicode mnChar
Definition: numfmt.hxx:40
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: numfmt.cxx:131
void NotifyChange(const OUString &rPrevStr, const Color *pColor=nullptr)
Definition: numfmt.cxx:90
OUString aPrevStr
Definition: numfmt.hxx:37
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: numfmt.hxx:50
virtual int get_text_height() const=0
virtual void set_size_request(int nWidth, int nHeight)=0
DeactivateRC
sal_uInt16 sal_Unicode