sd: keep a non-owning pointer to the OverridingShell
[LibreOffice.git] / cui / source / inc / numfmt.hxx
blob2df21ef094bdc54ce62cc8717a20e0486aecb5ac
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
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>
29 class SvxNumberFormatShell;
30 class SvxNumberInfoItem;
31 class vector;
34 class SvxNumberPreview : public weld::CustomWidgetController
36 private:
37 OUString aPrevStr;
38 Color aPrevCol;
39 sal_Int32 mnPos;
40 sal_Unicode mnChar;
42 protected:
43 virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
45 public:
46 SvxNumberPreview();
48 void NotifyChange( const OUString& rPrevStr, const Color* pColor = nullptr );
50 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
52 CustomWidgetController::SetDrawingArea(pDrawingArea);
53 pDrawingArea->set_size_request(-1, pDrawingArea->get_text_height() * 3);
57 class SvxNumberFormatTabPage : public SfxTabPage
59 static const WhichRangesContainer pRanges;
61 public:
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.
67 static const WhichRangesContainer & GetRanges() { return pRanges; }
69 virtual bool FillItemSet( SfxItemSet* rSet ) override;
70 virtual void Reset( const SfxItemSet* rSet ) override;
71 virtual DeactivateRC DeactivatePage ( SfxItemSet* pSet ) override;
73 void HideLanguage(bool bFlag=true);
74 virtual void PageCreated(const SfxAllItemSet& aSet) override;
76 private:
77 std::unique_ptr<SvxNumberInfoItem> pNumItem;
78 std::unique_ptr<SvxNumberFormatShell> pNumFmtShell;
79 sal_uInt32 nInitFormat;
80 short m_nLbFormatSelPosEdComment;
82 bool bNumItemFlag; ///< for handling with DocShell
83 bool bOneAreaFlag;
84 bool bLegacyAutomaticCurrency;
85 short nFixedCategory;
87 OUString sAutomaticLangEntry;
88 OUString sAutomaticCurrencyEntry;
90 SvxNumberPreview m_aWndPreview;
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;
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 );
123 void UpdateThousandEngineeringCheckBox();
124 void UpdateDecimalsDenominatorEditBox();
125 void Obstructing();
126 void EnableBySourceFormat_Impl();
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);
139 void SelFormatHdl_Impl(weld::Widget*);
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*);
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;
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */