dictionaries | 2 - include/vcl/builderbase.hxx | 3 + include/vcl/qt/QtUtils.hxx | 4 +- include/vcl/toolkit/fixed.hxx | 2 - sw/source/uibase/inc/pattern.hxx | 5 -- sw/source/uibase/inc/pggrid.hxx | 5 -- sw/source/uibase/inc/prcntfld.hxx | 6 --- sw/source/uibase/inc/pview.hxx | 6 --- sw/source/uibase/inc/redlndlg.hxx | 6 +-- sw/source/uibase/inc/rowht.hxx | 5 -- vcl/inc/qt5/QtBuilder.hxx | 2 - vcl/qt5/QtBuilder.cxx | 27 ++++++++++++++- vcl/source/control/fixed.cxx | 5 -- vcl/source/window/builder.cxx | 65 +++++++++++++++++++++----------------- 14 files changed, 76 insertions(+), 67 deletions(-)
New commits: commit cd2e3087642bb2849a089fb121f7b2c581fe0f00 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Oct 28 22:29:25 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Oct 29 07:46:24 2024 +0100 tdf#130857 qt weld: Set button image set in .ui file Implement logic to set the image for a button, as specified via the "image" property for the "GtkButton" object in the .ui file. Similar to how VclBuilder::makeObject does it, extract an icon name and load an image using that one for "GtkImage" obejcts. Add another static `toQPixmap` variant that takes an Image parameter and use that one for conversion. For buttons, if the "image" property is set, get the corresponding QLabel object, get the pixmap from that one and set an icon in the button from that. With this in place, when opening the "Help" -> "About LibreOfficeDev" dialog in a WIP branch adding "cui/ui/aboutdialog.ui" to the list of .ui files in QtInstanceBuilder::IsUIFileSupported, the button to copy the version information now shows the corresponding icon when using the qt6 VCL plugin. Change-Id: If87866d7ab935cbc4162fb513074eefda22c981a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175761 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/vcl/qt/QtUtils.hxx b/include/vcl/qt/QtUtils.hxx index 95f31e97ce63..368424a8cbe7 100644 --- a/include/vcl/qt/QtUtils.hxx +++ b/include/vcl/qt/QtUtils.hxx @@ -42,13 +42,15 @@ inline QPixmap toQPixmap(const BitmapEx& rBitmapEx) return aPixmap; } +inline QPixmap toQPixmap(const Image& rImage) { return toQPixmap(rImage.GetBitmapEx()); } + inline QPixmap toQPixmap(const css::uno::Reference<css::graphic::XGraphic>& rImage) { if (!rImage.is()) return QPixmap(); Image aImage(rImage); - return toQPixmap(aImage.GetBitmapEx()); + return toQPixmap(aImage); } inline QPixmap loadQPixmapIcon(const OUString& rIconName) diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx index ad7569b77a11..ccc199ec4c16 100644 --- a/vcl/inc/qt5/QtBuilder.hxx +++ b/vcl/inc/qt5/QtBuilder.hxx @@ -71,7 +71,7 @@ public: virtual void set_response(std::u16string_view sID, short nResponse) override; private: - static void setProperties(QObject* obj, stringmap& rProps); + void setProperties(QObject* obj, stringmap& rProps); static QWidget* windowForObject(QObject* pObject); static QDialogButtonBox* findButtonBox(QDialog* pDialog); diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index a655e351117b..a25f419a915b 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -187,7 +187,14 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons } else if (sName == u"GtkImage") { - pObject = new QLabel(pParentWidget); + QLabel* pLabel = new QLabel(pParentWidget); + const OUString sIconName = extractIconName(rMap); + if (!sIconName.isEmpty()) + { + const Image aImage = loadThemeImage(sIconName); + pLabel->setPixmap(toQPixmap(aImage)); + } + pObject = pLabel; } else if (sName == u"GtkLabel") { @@ -473,8 +480,24 @@ void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) { for (auto const & [ rKey, rValue ] : rProps) { - if (rKey == u"label") + if (rKey == u"image") + { + QLabel* pImageLabel = get<QLabel>(rValue); + assert(pImageLabel && "Button has non-existent image set"); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + pButton->setIcon(QIcon(pImageLabel->pixmap())); +#else + pButton->setIcon(QIcon(pImageLabel->pixmap(Qt::ReturnByValue))); +#endif + // parentless GtkImage in .ui file is only used for setting button + // image, so the object is no longer needed after doing so + if (!pImageLabel->parent()) + pImageLabel->deleteLater(); + } + else if (rKey == u"label") + { pButton->setText(convertAccelerator(rValue)); + } } } } commit 6bf7069f72255518d7abc52d4756cddbffbe6512 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Oct 28 21:40:57 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Oct 29 07:46:16 2024 +0100 tdf#130857 Move loadThemeImage from FixedImage to BuilderBase This static helper method is currently only used by VclBuilder. Move it to the BuilderBase class, for reuse by QtBuilder in an upcoming commit. Change-Id: I229bc98e0de2dbe0788f07c7f4ff5e5426203de9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175740 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/include/vcl/builderbase.hxx b/include/vcl/builderbase.hxx index f2b0319ee913..d811b3ca8d49 100644 --- a/include/vcl/builderbase.hxx +++ b/include/vcl/builderbase.hxx @@ -12,6 +12,7 @@ #include <config_options.h> #include <vcl/dllapi.h> +#include <vcl/image.hxx> #include <vcl/EnumContext.hxx> #include <com/sun/star/uno/Exception.hpp> @@ -87,6 +88,7 @@ protected: static bool extractVisible(stringmap& rMap); void extractClassAndIdAndCustomProperty(xmlreader::XmlReader& reader, OUString& rClass, OUString& rId, OUString& rCustomProperty); + static Image loadThemeImage(const OUString& rFileName); void handleActionWidget(xmlreader::XmlReader& reader); void handleInterfaceDomain(xmlreader::XmlReader& rReader); diff --git a/include/vcl/toolkit/fixed.hxx b/include/vcl/toolkit/fixed.hxx index 313e717c5a2f..fec5234748ad 100644 --- a/include/vcl/toolkit/fixed.hxx +++ b/include/vcl/toolkit/fixed.hxx @@ -173,8 +173,6 @@ public: const Image& GetModeImage( ) const { return maImage;} SAL_DLLPRIVATE virtual bool set_property(const OUString &rKey, const OUString &rValue) override; - SAL_DLLPRIVATE static Image loadThemeImage(const OUString &rFileName); - SAL_DLLPRIVATE void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override; }; diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index ce5bbf486c85..8a366a0d69b3 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -953,11 +953,6 @@ void FixedImage::SetImage( const Image& rImage ) } } -Image FixedImage::loadThemeImage(const OUString &rFileName) -{ - return Image(StockImage::Yes, rFileName); -} - bool FixedImage::set_property(const OUString &rKey, const OUString &rValue) { if (rKey == "icon-size") diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 7483fcda94f4..88d60255c7db 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1964,7 +1964,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OUString VclPtr<FixedImage> xFixedImage = VclPtr<FixedImage>::Create(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK|WB_SCALE); OUString sIconName = extractIconName(rMap); if (!sIconName.isEmpty()) - xFixedImage->SetImage(FixedImage::loadThemeImage(sIconName)); + xFixedImage->SetImage(loadThemeImage(sIconName)); m_pVclParserState->m_aImageSizeMap[id] = getImageSize(rMap); xWindow = xFixedImage; //such parentless GtkImages are temps used to set icons on buttons @@ -2106,7 +2106,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OUString OUString sIconName(extractIconName(rMap)); if (!sIconName.isEmpty()) - pToolBox->SetItemImage(nItemId, FixedImage::loadThemeImage(sIconName)); + pToolBox->SetItemImage(nItemId, loadThemeImage(sIconName)); if (!extractVisible(rMap)) pToolBox->HideItem(nItemId); @@ -2619,7 +2619,7 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read { OUString sLabel(BuilderUtils::convertMnemonicMarkup(aFind->second)); OUString sIconName(extractIconName(aProperties)); - pVerticalTabControl->InsertPage(sIDs.front(), sLabel, FixedImage::loadThemeImage(sIconName), sTooltip, + pVerticalTabControl->InsertPage(sIDs.front(), sLabel, loadThemeImage(sIconName), sTooltip, pVerticalTabControl->GetPageParent()->GetWindow(GetWindowType::LastChild)); } } @@ -3503,6 +3503,12 @@ void BuilderBase::extractClassAndIdAndCustomProperty(xmlreader::XmlReader& reade } } + +Image BuilderBase::loadThemeImage(const OUString& rFileName) +{ + return Image(StockImage::Yes, rFileName); +} + void BuilderBase::handleInterfaceDomain(xmlreader::XmlReader& rReader) { xmlreader::Span name = rReader.getAttributeValue(false); commit 85fb5e98fcb837f2dae59c81f64963c2159fc95b Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Oct 28 21:33:33 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Oct 29 07:46:09 2024 +0100 tdf#130857 VclBuilder: Move extractIconName to BuilderBase Turn this helper function into a static method in the BuilderBase class, for reuse in QtBuilder in an upcoming commit. Change-Id: I1e3318f22d83ddef4e7bf6269c7142f307ec6d1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175739 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/include/vcl/builderbase.hxx b/include/vcl/builderbase.hxx index f7216864c11e..f2b0319ee913 100644 --- a/include/vcl/builderbase.hxx +++ b/include/vcl/builderbase.hxx @@ -83,6 +83,7 @@ protected: stringmap collectPackingProperties(xmlreader::XmlReader& reader); void collectProperty(xmlreader::XmlReader& rReader, stringmap& rMap) const; static bool extractEntry(stringmap& rMap); + static OUString extractIconName(stringmap& rMap); static bool extractVisible(stringmap& rMap); void extractClassAndIdAndCustomProperty(xmlreader::XmlReader& reader, OUString& rClass, OUString& rId, OUString& rCustomProperty); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index c54014053d85..7483fcda94f4 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1009,32 +1009,6 @@ namespace return bInconsistent; } - OUString extractIconName(VclBuilder::stringmap &rMap) - { - OUString sIconName; - // allow pixbuf, but prefer icon-name - { - VclBuilder::stringmap::iterator aFind = rMap.find(u"pixbuf"_ustr); - if (aFind != rMap.end()) - { - sIconName = aFind->second; - rMap.erase(aFind); - } - } - { - VclBuilder::stringmap::iterator aFind = rMap.find(u"icon-name"_ustr); - if (aFind != rMap.end()) - { - sIconName = aFind->second; - rMap.erase(aFind); - } - } - if (sIconName == "missing-image") - return OUString(); - OUString sReplace = mapStockToImageResource(sIconName); - return !sReplace.isEmpty() ? sReplace : sIconName; - } - WinBits extractRelief(VclBuilder::stringmap &rMap) { WinBits nBits = WB_3DLOOK; @@ -3766,6 +3740,33 @@ bool BuilderBase::extractEntry(VclBuilder::stringmap &rMap) return bHasEntry; } + +OUString BuilderBase::extractIconName(VclBuilder::stringmap &rMap) +{ + OUString sIconName; + // allow pixbuf, but prefer icon-name + { + VclBuilder::stringmap::iterator aFind = rMap.find(u"pixbuf"_ustr); + if (aFind != rMap.end()) + { + sIconName = aFind->second; + rMap.erase(aFind); + } + } + { + VclBuilder::stringmap::iterator aFind = rMap.find(u"icon-name"_ustr); + if (aFind != rMap.end()) + { + sIconName = aFind->second; + rMap.erase(aFind); + } + } + if (sIconName == "missing-image") + return OUString(); + OUString sReplace = mapStockToImageResource(sIconName); + return !sReplace.isEmpty() ? sReplace : sIconName; +} + bool BuilderBase::extractVisible(VclBuilder::stringmap& rMap) { bool bRet = false; commit 1feb2466dccc0eee66bbfd50aff23ad7864e0c94 Author: Muluh MG Godson <godsonmu...@gmail.com> AuthorDate: Tue Oct 29 04:55:22 2024 +0100 Commit: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> CommitDate: Tue Oct 29 07:37:22 2024 +0100 tdf#143148 Use #pragma once instead of include guards Change-Id: Ib779717653f17fdb83319d65313ae1a0ffc8fd3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175768 Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> diff --git a/sw/source/uibase/inc/pattern.hxx b/sw/source/uibase/inc/pattern.hxx index 06bb5bb06e71..31ea461c4c72 100644 --- a/sw/source/uibase/inc/pattern.hxx +++ b/sw/source/uibase/inc/pattern.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_PATTERN_HXX -#define INCLUDED_SW_SOURCE_UIBASE_INC_PATTERN_HXX +#pragma once #include <sfx2/basedlgs.hxx> @@ -28,6 +27,4 @@ public: SwBackgroundDlg(weld::Window* pParent, const SfxItemSet& rSet); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/pggrid.hxx b/sw/source/uibase/inc/pggrid.hxx index 12d6a8bae13d..58d5c9467188 100644 --- a/sw/source/uibase/inc/pggrid.hxx +++ b/sw/source/uibase/inc/pggrid.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_PGGRID_HXX -#define INCLUDED_SW_SOURCE_UIBASE_INC_PGGRID_HXX +#pragma once #include <sfx2/tabdlg.hxx> #include "colex.hxx" @@ -86,6 +85,4 @@ public: virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx index 3b4775e6a524..03a80b0530cd 100644 --- a/sw/source/uibase/inc/prcntfld.hxx +++ b/sw/source/uibase/inc/prcntfld.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_PRCNTFLD_HXX -#define INCLUDED_SW_SOURCE_UIBASE_INC_PRCNTFLD_HXX +#pragma once #include <svtools/unitconv.hxx> #include <vcl/weld.hxx> @@ -81,7 +80,4 @@ public: void LockAutoCalculation(bool bLock) {m_bLockAutoCalculation = bLock;} }; - -#endif // INCLUDED_SW_SOURCE_UIBASE_INC_PRCNTFLD_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx index b024f9e59fe5..5fb6ee3e4c28 100644 --- a/sw/source/uibase/inc/pview.hxx +++ b/sw/source/uibase/inc/pview.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_PVIEW_HXX -#define INCLUDED_SW_SOURCE_UIBASE_INC_PVIEW_HXX +#pragma once #include <tools/link.hxx> #include <tools/fract.hxx> @@ -297,7 +296,4 @@ public: virtual ~SwPagePreview() override; }; - -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index e38fd83f68b3..e56383203d7d 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_REDLNDLG_HXX -#define INCLUDED_SW_SOURCE_UIBASE_INC_REDLNDLG_HXX +#pragma once + #include <swdllapi.h> #include "chldwrap.hxx" #include <docary.hxx> @@ -174,6 +174,4 @@ public: virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/rowht.hxx b/sw/source/uibase/inc/rowht.hxx index 59a51fc97abe..4579fa48e499 100644 --- a/sw/source/uibase/inc/rowht.hxx +++ b/sw/source/uibase/inc/rowht.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_ROWHT_HXX -#define INCLUDED_SW_SOURCE_UIBASE_INC_ROWHT_HXX +#pragma once #include <vcl/weld.hxx> @@ -35,6 +34,4 @@ public: void Apply(); }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 8f6cae354d0b068dc377583d5af12acc7dc9e675 Author: Theppitak Karoonboonyanan <theppi...@gmail.com> AuthorDate: Tue Oct 29 13:23:05 2024 +0700 Commit: Gerrit Code Review <ger...@gerrit.libreoffice.org> CommitDate: Tue Oct 29 07:23:05 2024 +0100 Update git submodules * Update dictionaries from branch 'master' to d375e51d98ce78857dc71f5a26b75058592d833d - tdf#163657 Adjust Thai spell check dictionary LibThai word list, a source of the Thai spell check dictionary, includes some common misspelled words for its word segmentation function to still work with documents in real life. But such entries should not be included in the spell check dictionary. * th_TH/th_TH.dic: - Remove entries from LibThai's tdict-spell.txt - Fix spellings of some related entries (ซิลิกอนเวเฟอร์ -> ซิลิคอนเวเฟอร์, ปรากฎการณ์ธรรมชาติ -> ปรากฏการณ์ธรรมชาติ) - Add the updated spelling for "ทุกกฏ". Still accept the old spelling "ทุกฏ". Change-Id: I792bd67a4a2cea85554442e30c952889898bbbac Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/175732 Reviewed-by: Vernon, Stuart Foote <vsfo...@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> diff --git a/dictionaries b/dictionaries index d0c939181ac1..d375e51d98ce 160000 --- a/dictionaries +++ b/dictionaries @@ -1 +1 @@ -Subproject commit d0c939181ac181ce6479ae8604ef647055ccf44d +Subproject commit d375e51d98ce78857dc71f5a26b75058592d833d