diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-17 19:53:56 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-18 07:32:58 +0200 |
commit | 5cb3f13e3d5e11d7deba3e0d9750a941d19ba1a3 (patch) | |
tree | 31218fe8de41a796a0d1882f16519ae599918f24 | |
parent | 24406f5ae529e355474b43d4770617ecb264ccff (diff) |
tdf#130857 VclBuilder: Move TextBuffer bookkeeping to base class
This is basically the same as
Change-Id: Iba98406817906e36fb8dc723c8e9b4b554eb2258
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Tue Sep 17 19:35:22 2024 +0200
tdf#130857 VclBuilder: Move adjustment bookkeeping to base class
, but for the `TextBuffer`s instead of the `Adjustment`s.
Change-Id: I0f53718892f70a285a7f8b0d8e9e112d48dedb50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173575
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r-- | include/vcl/builder.hxx | 10 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 13 |
2 files changed, 15 insertions, 8 deletions
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 573fcf66946b..9f8f9269cb2e 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -71,6 +71,7 @@ public: typedef std::map<OUString, std::pair<OUString, OUString>> accelmap; typedef stringmap Adjustment; + typedef stringmap TextBuffer; protected: BuilderBase(bool bLegacy); @@ -116,6 +117,10 @@ protected: void addAdjustment(const OUString& sID, const Adjustment& rAdjustment); const Adjustment* get_adjustment_by_name(const OUString& sID) const; + + void addTextBuffer(const OUString& sID, const TextBuffer& rTextBuffer); + const TextBuffer* get_buffer_by_name(const OUString& sID) const; + const ListStore* get_model_by_name(const OUString& sID) const; void handleSizeGroup(xmlreader::XmlReader& reader); @@ -131,6 +136,7 @@ private: std::vector<SizeGroup> m_aSizeGroups; std::map<OUString, Adjustment> m_aAdjustments; + std::map<OUString, TextBuffer> m_aTextBuffers; }; std::unique_ptr<ParserState> m_pParserState; @@ -273,9 +279,6 @@ private: void mungeModel(ComboBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId); void mungeModel(SvTabListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId); - typedef stringmap TextBuffer; - const TextBuffer* get_buffer_by_name(const OUString& sID) const; - static void mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rTextBuffer); static void mungeAdjustment(NumericFormatter &rTarget, const Adjustment &rAdjustment); @@ -294,7 +297,6 @@ private: std::vector<ComboBoxModelMap> m_aModelMaps; std::vector<TextBufferMap> m_aTextBufferMaps; - std::map<OUString, TextBuffer> m_aTextBuffers; std::vector<WidgetAdjustmentMap> m_aNumericFormatterAdjustmentMaps; std::vector<WidgetAdjustmentMap> m_aFormattedFormatterAdjustmentMaps; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index e352396f9b11..057f5077b893 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -3751,7 +3751,7 @@ VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, stringmap *pA } else if (sClass == "GtkTextBuffer") { - m_pVclParserState->m_aTextBuffers[sID] = aProperties; + addTextBuffer(sID, aProperties); return nullptr; } @@ -4246,10 +4246,15 @@ const BuilderBase::ListStore* BuilderBase::get_model_by_name(const OUString& sID return nullptr; } -const VclBuilder::TextBuffer *VclBuilder::get_buffer_by_name(const OUString& sID) const +void BuilderBase::addTextBuffer(const OUString& sID, const TextBuffer& rTextBuffer) { - const auto aI = m_pVclParserState->m_aTextBuffers.find(sID); - if (aI != m_pVclParserState->m_aTextBuffers.end()) + m_pParserState->m_aTextBuffers[sID] = rTextBuffer; +} + +const BuilderBase::TextBuffer* BuilderBase::get_buffer_by_name(const OUString& sID) const +{ + const auto aI = m_pParserState->m_aTextBuffers.find(sID); + if (aI != m_pParserState->m_aTextBuffers.end()) return &(aI->second); return nullptr; } |