diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-23 18:13:05 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-25 21:09:07 +0200 |
commit | ad19f3b9f23ddd4179589e9a641094f3e7642e72 (patch) | |
tree | 49e2f2e2bd85e82d23cab3aacacef373e846f24d /vcl | |
parent | 385bbbd6e1f602d066b00c0913aefa36e75ce5a6 (diff) |
tdf#130857 VclBuilder: Pass UI dir/root to BuilderBase
Pass the UI file root down to `BuilderBase`, and add
a new getter `BuilderBase::getUIFileUrl` to get the
URL composed of the UI dir and the UI file passed to
the ctor.
This is in preparation of moving the `XmlReader`
creation out of the `VclBuilder` ctor, so the code
can be reused by the upcoming `QtBuilder`.
Change the UI directory param from `const OUString&` to
`std::u16_string_view` as suggested by the clang plugin.
Change-Id: I3f7719e30e55bae3c774da704e642e4227165a76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173827
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 8 | ||||
-rw-r--r-- | vcl/inc/salvtables.hxx | 2 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 16 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 11 |
5 files changed, 21 insertions, 20 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index ac529cef12b0..33bf2ccb6bd3 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -249,17 +249,17 @@ class JSInstanceBuilder final : public SalInstanceBuilder, public JSDialogSender public: /// used for dialogs or popups - JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile, + JSInstanceBuilder(weld::Widget* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, bool bPopup = false); /// used for sidebar panels - JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile, + JSInstanceBuilder(weld::Widget* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, sal_uInt64 nLOKWindowId); /// used for notebookbar, optional nWindowId is used if getting parent id failed - JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + JSInstanceBuilder(vcl::Window* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, const css::uno::Reference<css::frame::XFrame>& rFrame, sal_uInt64 nWindowId = 0); /// used for formulabar - JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + JSInstanceBuilder(vcl::Window* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, sal_uInt64 nLOKWindowId); static std::unique_ptr<JSInstanceBuilder> diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index ba7653a0fc40..f57ecc9395e3 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -46,7 +46,7 @@ protected: VclPtr<vcl::Window> m_aOwnedToplevel; public: - SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + SalInstanceBuilder(vcl::Window* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, const css::uno::Reference<css::frame::XFrame>& rFrame = css::uno::Reference<css::frame::XFrame>()); diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 7c90d59e8c48..797247fef13e 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -492,9 +492,9 @@ OUString JSInstanceBuilder::getMapIdFromWindowId() const } // used for dialogs -JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, +JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const std::u16string_view sUIRoot, const OUString& rUIFile, bool bPopup) - : SalInstanceBuilder(extract_sal_widget(pParent), rUIRoot, rUIFile) + : SalInstanceBuilder(extract_sal_widget(pParent), sUIRoot, rUIFile) , m_nWindowId(0) , m_aParentDialog(nullptr) , m_aContentWindow(nullptr) @@ -526,9 +526,9 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR } // used for sidebar panels -JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, +JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, sal_uInt64 nLOKWindowId) - : SalInstanceBuilder(extract_sal_widget(pParent), rUIRoot, rUIFile) + : SalInstanceBuilder(extract_sal_widget(pParent), sUIRoot, rUIFile) , m_nWindowId(nLOKWindowId) , m_aParentDialog(nullptr) , m_aContentWindow(nullptr) @@ -568,11 +568,11 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR } // used for notebookbar -JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, +JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, const css::uno::Reference<css::frame::XFrame>& rFrame, sal_uInt64 nWindowId) - : SalInstanceBuilder(pParent, rUIRoot, rUIFile, rFrame) + : SalInstanceBuilder(pParent, sUIRoot, rUIFile, rFrame) , m_nWindowId(0) , m_aParentDialog(nullptr) , m_aContentWindow(nullptr) @@ -601,9 +601,9 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo } // used for formulabar -JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, +JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, sal_uInt64 nLOKWindowId) - : SalInstanceBuilder(pParent, rUIRoot, rUIFile) + : SalInstanceBuilder(pParent, sUIRoot, rUIFile) , m_nWindowId(nLOKWindowId) , m_aParentDialog(nullptr) , m_aContentWindow(nullptr) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 728f2ec8428d..c875b3847ea1 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -7078,11 +7078,11 @@ void SalInstancePopover::resize_to_request() IMPL_LINK_NOARG(SalInstancePopover, PopupModeEndHdl, FloatingWindow*, void) { signal_closed(); } -SalInstanceBuilder::SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, +SalInstanceBuilder::SalInstanceBuilder(vcl::Window* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, const css::uno::Reference<css::frame::XFrame>& rFrame) : weld::Builder() - , m_xBuilder(new VclBuilder(pParent, rUIRoot, rUIFile, {}, rFrame, false)) + , m_xBuilder(new VclBuilder(pParent, sUIRoot, rUIFile, {}, rFrame, false)) { } diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 25bab94a1265..bfbab0d89a00 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -444,8 +444,9 @@ namespace weld } } -BuilderBase::BuilderBase(const OUString& rUIFile, bool bLegacy) +BuilderBase::BuilderBase(std::u16string_view sUIDir, const OUString& rUIFile, bool bLegacy) : m_pParserState(new ParserState) + , m_sUIFileUrl(sUIDir + rUIFile) , m_sHelpRoot(rUIFile) , m_bLegacy(bLegacy) { @@ -487,10 +488,10 @@ OUString BuilderBase::finalizeValue(const OString& rContext, const OString& rVal void BuilderBase::resetParserState() { m_pParserState.reset(); } -VclBuilder::VclBuilder(vcl::Window* pParent, const OUString& sUIDir, const OUString& sUIFile, +VclBuilder::VclBuilder(vcl::Window* pParent, std::u16string_view sUIDir, const OUString& sUIFile, OUString sID, css::uno::Reference<css::frame::XFrame> xFrame, bool bLegacy, const NotebookBarAddonsItem* pNotebookBarAddonsItem) - : WidgetBuilder(sUIFile, bLegacy) + : WidgetBuilder(sUIDir, sUIFile, bLegacy) , m_pNotebookBarAddonsItem(pNotebookBarAddonsItem ? new NotebookBarAddonsItem(*pNotebookBarAddonsItem) : new NotebookBarAddonsItem{}) @@ -507,13 +508,13 @@ VclBuilder::VclBuilder(vcl::Window* pParent, const OUString& sUIDir, const OUStr try { - xmlreader::XmlReader reader(sUIDir + sUIFile); + xmlreader::XmlReader reader(getUIFileUrl()); handleChild(pParent, nullptr, reader); } catch (const css::uno::Exception &rExcept) { - TOOLS_WARN_EXCEPTION("vcl.builder", "Unable to read .ui file " << sUIDir << sUIFile); + 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; |