summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-08-12 12:52:16 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-08-13 07:17:13 +0200
commitcad292adaba986c04f5bc8e73c11871075b5abe5 (patch)
tree9d009de7436178456a5f6f05c798078c9e867631 /include
parentf2ca1c058b3400db54bd440dd00daf81c9bab04a (diff)
tdf#130857 VclBuilder: Move locale handling to base class
* Introduce `ParserState` in the `BuilderBase` base class and move the `std::locale m_aResLocale` there from `VclParserState`. * Add a virtual `resetParserState()` method to reset both parser states. * Move `VclBuilder::handleInterfaceDomain` to the base class to let it take care of the handling of the translation domain/locale. * Instead of directly accessing the `m_aResLocale` member of the parser state, introduce a new getter, `getResLocale()`. Moving more of the members from `VclBuilder::m_pVclParserState` to `BuilderBase::m_pParserState` might make sense in future commits in order to reuse code for other implementations (like the WIP QtInstanceBuilder from [1]), so start with a corresponding struct right away instead of a member for just the locale. [1] https://gerrit.libreoffice.org/c/core/+/161831 Change-Id: I2cefddae0a7e2e2dd4487cc9b9796afb215e2616 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171786 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/builder.hxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 38af7c5f8305..d91e3b8c51b5 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -77,13 +77,23 @@ protected:
static void collectAtkRelationAttribute(xmlreader::XmlReader& reader, stringmap& rMap);
static void collectAtkRoleAttribute(xmlreader::XmlReader& reader, stringmap& rMap);
static void collectAccelerator(xmlreader::XmlReader& reader, accelmap& rMap);
+ void handleInterfaceDomain(xmlreader::XmlReader& rReader);
static bool isToolbarItemClass(std::u16string_view sClass);
static std::vector<vcl::EnumContext::Context> handleStyle(xmlreader::XmlReader &reader, int &nPriority);
static OUString getStyleClass(xmlreader::XmlReader &reader);
bool isLegacy() { return m_bLegacy; }
+ const std::locale& getResLocale() const;
+
+ virtual void resetParserState();
private:
+ struct ParserState
+ {
+ std::locale m_aResLocale;
+ };
+
+ std::unique_ptr<ParserState> m_pParserState;
bool m_bLegacy;
};
@@ -101,7 +111,7 @@ public:
= css::uno::Reference<css::frame::XFrame>(),
bool bLegacy = true,
const NotebookBarAddonsItem* pNotebookBarAddonsItem = nullptr);
- ~VclBuilder();
+ virtual ~VclBuilder();
///releases references and disposes all children.
void disposeBuilder();
//sID must exist and be of type T
@@ -255,8 +265,6 @@ private:
struct VclParserState
{
- std::locale m_aResLocale;
-
std::vector<RadioButtonGroupMap> m_aGroupMaps;
std::vector<ComboBoxModelMap> m_aModelMaps;
@@ -304,6 +312,7 @@ private:
bool m_bToplevelParentFound;
std::unique_ptr<VclParserState> m_pVclParserState;
+ virtual void resetParserState() override;
vcl::Window *get_by_name(std::u16string_view sID);
void delete_by_name(const OUString& sID);
@@ -355,7 +364,6 @@ private:
// if bToolbarItem=true, pParent is the ToolBox that the item belongs to, since there's no widget for the item itself
VclPtr<vcl::Window> handleObject(vcl::Window *pParent, stringmap *pAtkProps, xmlreader::XmlReader &reader, bool bToolbarItem);
- void handleInterfaceDomain(xmlreader::XmlReader& rReader);
void handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader);
void applyPackingProperty(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader);
void collectProperty(xmlreader::XmlReader &reader, stringmap &rVec) const;