summaryrefslogtreecommitdiff
path: root/include/vcl/widgetbuilder.hxx
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-09-25 09:08:06 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-09-25 21:09:14 +0200
commit1a1bf2b78d689a570cc71b7bcb3e0100947a2fb1 (patch)
tree295dac8a35df74049977dbac7752d8ae27a526c2 /include/vcl/widgetbuilder.hxx
parentad19f3b9f23ddd4179589e9a641094f3e7642e72 (diff)
tdf#130857 VclBuilder: Extract helper to start parsing UI file
Extract logic to start parsing/processing the VclBuilder's .ui file from the VclBuilder ctor to a new helper method in the base class, WidgetBuilder::processUIFile. This will allow to reuse it in the upcoming QtBuilder. Change-Id: Ia7d31563e5aeef0786b0db34abb1a32a3a479947 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173902 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'include/vcl/widgetbuilder.hxx')
-rw-r--r--include/vcl/widgetbuilder.hxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/vcl/widgetbuilder.hxx b/include/vcl/widgetbuilder.hxx
index ccd418e2c0d2..d5934dcaf4f3 100644
--- a/include/vcl/widgetbuilder.hxx
+++ b/include/vcl/widgetbuilder.hxx
@@ -9,6 +9,9 @@
#pragma once
+#include <com/sun/star/uno/Exception.hpp>
+#include <comphelper/diagnose_ex.hxx>
+#include <desktop/crashreport.hxx>
#include <sal/log.hxx>
#include <vcl/builderbase.hxx>
#include <xmlreader/span.hxx>
@@ -39,6 +42,24 @@ protected:
}
virtual ~WidgetBuilder() = default;
+ void processUIFile(Widget* pParent)
+ {
+ try
+ {
+ xmlreader::XmlReader reader(getUIFileUrl());
+ handleChild(pParent, nullptr, reader);
+ }
+ catch (const css::uno::Exception& rExcept)
+ {
+ TOOLS_WARN_EXCEPTION("vcl.builder", "Unable to read .ui file " << getUIFileUrl());
+ CrashReporter::addKeyValue(u"VclBuilderException"_ustr,
+ "Unable to read .ui file: " + rExcept.Message,
+ CrashReporter::Write);
+ assert(false && "missing ui file or missing gb_CppunitTest_use_uiconfigs dependency");
+ throw;
+ }
+ }
+
// either pParent or pAtkProps must be set, pParent for a child of a widget, pAtkProps for
// collecting the atk info for a GtkMenuItem or tab child
void handleChild(Widget* pParent, stringmap* pAtkProps, xmlreader::XmlReader& reader,