core.git: xmloff/source
xmloff/source/text/txtparai.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit e7df78e1d4ac17ae5a17c4a151eefe2a6f2b0e4a Author: Mike Kaganski AuthorDate: Thu Apr 25 11:50:38 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 25 13:00:25 2024 +0200 Fix UBSan failure: omission from 69ed893087f89d176a5ec4b263ce8d75774be72b This failure was seen: /xmloff/source/text/txtparai.cxx:1816:37: runtime error: downcast of address 0x604000d86710 which does not point to an object of type 'XMLStyleHint_Impl' 0x604000d86710: note: object is of type 'XMLTextFrameHint_Impl' 00 00 00 00 00 4b 83 40 b3 7f 00 00 70 bf 22 00 b0 60 00 00 70 bf 22 00 b0 60 00 00 06 00 00 00 ^~~ vptr for 'XMLTextFrameHint_Impl' #0 0x7fb33f2d224d in XMLParaContext::endFastElement(int) /xmloff/source/text/txtparai.cxx:1816:37 #1 0x7fb33dc76333 in SvXMLImport::endFastElement(int) /xmloff/source/core/xmlimp.cxx:885:15 #2 0x7fb36ee0bfca in (anonymous namespace)::Entity::endElement() /sax/source/fastparser/fastparser.cxx:514:27 #3 0x7fb36ee0b998 in sax_fastparser::FastSaxParserImpl::callbackEndElement() /sax/source/fastparser/fastparser.cxx:1331:17 #4 0x7fb36edfb444 in (anonymous namespace)::call_callbackEndElement(void*, unsigned char const*, unsigned char const*, unsigned char const*) /sax/source/fastparser/fastparser.cxx:338:18 #5 0x7fb3bacb8eaa in xmlParseEndTag2 /workdir/UnpackedTarball/libxml2/parser.c:10089:2 #6 0x7fb3bac5fa45 in xmlParseTryOrFinish /workdir/UnpackedTarball/libxml2/parser.c:11867:14 #7 0x7fb3bac533c4 in xmlParseChunk /workdir/UnpackedTarball/libxml2/parser.c:12150:5 #8 0x7fb36edf6231 in sax_fastparser::FastSaxParserImpl::parse() /sax/source/fastparser/fastparser.cxx:1085:21 #9 0x7fb36edefd18 in sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:890:9 #10 0x7fb36ee11950 in sax_fastparser::FastSaxParser::parseStream(com::sun::star::xml::sax::InputSource const&) /sax/source/fastparser/fastparser.cxx:1470:13 #11 0x7fb33dc60551 in SvXMLImport::parseStream(com::sun::star::xml::sax::InputSource const&) /xmloff/source/core/xmlimp.cxx:528:15 #12 0x7fb31916b4f1 in (anonymous namespace)::ReadThroughComponent(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference const&, rtl::OUString const&, com::sun::star::uno::Reference const&, char const*, com::sun::star::uno::Sequence const&, rtl::OUString const&, bool, bool) /sw/source/filter/xml/swxml.cxx:181:26 #13 0x7fb3191609f1 in (anonymous namespace)::ReadThroughComponent(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference const&, char const*, com::sun::star::uno::Reference const&, char const*, com::sun::star::uno::Sequence const&, rtl::OUString const&, bool) /sw/source/filter/xml/swxml.cxx:323:16 #14 0x7fb319159e4c in XMLReader::Read(SwDoc&, rtl::OUString const&, SwPaM&, rtl::OUString const&) /sw/source/filter/xml/swxml.cxx:833:16 #15 0x7fb3187eda73 in SwReader::Read(Reader const&) /sw/source/filter/basflt/shellio.cxx:203:22 #16 0x7fb3195ecd45 in SwDocShell::Load(SfxMedium&) /sw/source/uibase/app/docshini.cxx:533:37 #17 0x7fb382833c33 in SfxObjectShell::LoadOwnFormat(SfxMedium&) /sfx2/source/doc/objstor.cxx:3619:20 #18 0x7fb38283a353 in SfxObjectShell::DoLoad(SfxMedium*) /sfx2/source/doc/objstor.cxx:705:40 #19 0x7fb382aca503 in SfxBaseModel::load(com::sun::star::uno::Sequence const&) /sfx2/source/doc/sfxbasemodel.cxx:1980:36 #20 0x7fb38333d8c9 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) /sfx2/source/view/frmload.cxx:720:28 #21 0x7fb371713419 in framework::LoadEnv::impl_loadContent() /framework/source/loadenv/loadenv.cxx:1176:37 #22 0x7fb37170a43b in framework::LoadEnv::start() /framework/source/loadenv/loadenv.cxx:412:20 #23 0x7fb371702a79 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&, rtl::OUString const&, int, LoadEnvFeatures) /framework/source/loadenv/loadenv.cxx:308:5 #24 0x7fb3716fe207 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) /framework/source/loadenv/loadenv.cxx:168:14 #25 0x7fb3717d23fd in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star:
core.git: include/xmloff sw/qa sw/source xmloff/source
include/xmloff/txtparae.hxx |7 sw/qa/extras/htmlexport/xhtmlexport.cxx |4 sw/qa/extras/odfexport/data/tdf160253_ordinary_numbering.fodt | 43 ++ sw/qa/extras/odfexport/data/tdf160253_outline_numbering.fodt | 37 ++ sw/qa/extras/odfexport/odfexport2.cxx | 56 +++ sw/source/core/text/txtfld.cxx| 22 - sw/source/filter/ww8/ww8par.cxx | 19 - sw/source/filter/ww8/ww8par.hxx |2 sw/source/filter/ww8/ww8par2.cxx |4 sw/source/filter/ww8/ww8par5.cxx |2 sw/source/filter/ww8/ww8par6.cxx |4 sw/source/filter/xml/xmlfmte.cxx |2 xmloff/source/text/txtparae.cxx | 162 ++ xmloff/source/text/txtparai.cxx | 62 ++- 14 files changed, 244 insertions(+), 182 deletions(-) New commits: commit 69ed893087f89d176a5ec4b263ce8d75774be72b Author: Mike Kaganski AuthorDate: Wed Apr 24 07:55:35 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Apr 24 11:37:27 2024 +0200 tdf#160253: fix list identifier export decision code Commits 8f48f91009caa86d896f247059874242ed18bf39 (ODT export: omit unreferenced , 2022-03-10) and 82bbf63582bdf28e7918e58ebf6657a9144bc9f3 (tdf#155823: Improve the check if the list id is not required, 2023-06-14) tried to improve deterministic ODF output, by omitting the list identifiers in case when those identifiers were unreferenced. The latter of these used document model node numbers to check if other lists appeared after the last occurrence of the list that is continuing in the current node. But it turned out, that this isn't robust. Consider this ODF: a bi x c The paragraphs a, b, and c are all in the main document body, and have sequential document model node numbers (say, 15, 16, 17). If these numbers are checked, there is no node between node 15 ("a") and node 17 ("c") with a different list (both 15 and 17 belong to a list with style "L1" and identifier "list1", and node 16 doesn't belong to any lists). That suggests that the list identifier isn't needed in this case. Bug when the actual output of node 16 is done, it includes a node from an endnote ("x"), which is located in a different place in the document model, and has a node number like 7 (so not between 15 and 17). The paragraph "x" belongs to another list with style "L2", and is output to ODF between paragraphs "a" and "c". Here, we must refer from paragraph "c" to the list of the paragraph "a" using the list id, but this is not obvious when only considering node numbers, and requires the prior knowledge of the actual order of appearance of lists in the ODF. Unless we build a DOM, this is only possible, if we do a two-pass output, and collect the nodes order in the first pass. The output already does that in a "collect autostyles" pass. The problem here is that the "collect autostyles" pass used an optimized function, XMLTextParagraphExport::collectTextAutoStylesOptimized, introduced in commit 8195d7061ed52ebb98f46d35fe5929762c71e4b3 (INTEGRATION: CWS swautomatic01 (1.126.4); FILE MERGED, 2006-12-01) for #i65476# and which used style::XAutoStylesSupplier for optimization to get the autostyles. This drops XMLTextParagraphExport::collectTextAutoStylesOptimized, and reverts to use of collectTextAutoStyles, which handles nodes in the same order as when writing to ODF. There, we build a vector of the node numbers sequence, used later to sort DocumentListNodes. This uncovered an omission from the work on paragraph mark (commit 1a88efa8e02a6d765dab13c7110443bb9e6acecf tdf#155238: Reimplement how ListAutoFormat is stored to ODF, 2023-05-11). Turns out, that the code in SwTextFormatter::NewNumberPortion introduced in commit cb0e1b52d68aa6d5b505f91cb4ce577f7f3b2a8f (sw, numbering portion format: consider full-para char formats as well, 2022-10-20) was left behind when re-implementing paragraph marks to use dedicated property; empty trailing spans still affected how the lists were rendered, and that allowed to overlook import defects, where the paragraph mark properties weren't properly set. In ODF import (XMLParaContext::endFastElement), for compatibility, this treats empty trailing spans as defining paragrap
core.git: 2 commits - cpp.hint svgio/qa
cpp.hint | 15 +++ svgio/qa/cppunit/SvgImportTest.cxx | 18 +++--- 2 files changed, 26 insertions(+), 7 deletions(-) New commits: commit d7b15f03e0b956d23854806f35636ab4acfb1296 Author: Mike Kaganski AuthorDate: Tue Apr 23 22:36:36 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Apr 24 09:43:42 2024 +0200 Add some entries into cpp.hint Improves VS integration: allows to find CPP unit tests defined using DECLARE_SW_ROUNDTRIP_TEST and friends. The macros are stripped down to the minimum to allow IntelliSense do its job. Change-Id: I5325cb5ac424e3b08cd64b265d5d4924fbadcfcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166571 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/cpp.hint b/cpp.hint index 67e06e24b646..1000d44cd627 100644 --- a/cpp.hint +++ b/cpp.hint @@ -46,3 +46,18 @@ void TestBody(); \ }; \ void TestName::TestBody() + +// From sw/qa/inc/swmodeltestbase.hxx +// To allow searching for the test names, where they are defined using the macros +#define DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, password, BaseClass) \ +class TestName : public BaseClass {\ +public:\ +void verify() override;\ +}; \ +void TestName::verify() + +#define DECLARE_OOXMLEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) +#define DECLARE_RTFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) +#define DECLARE_ODFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) +#define DECLARE_FODFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) +#define DECLARE_WW8EXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, nullptr, Test) commit d984836834e67b5bcd618ebd5d1633138985a881 Author: Mike Kaganski AuthorDate: Wed Apr 24 10:41:59 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Apr 24 09:43:30 2024 +0200 Fix unit test after commit 98935eef13c7d755221d79fe7d3c5869a40a7c37 Similar to commit cfa9990d470b10548c7fed64eb1182fea11d41e0 (Enable this test on all platforms. 2024-04-20), it seems that 'mask' gets exported inconsistently. This patch workarouns the problem; a proper fix would be finding the real cause. Change-Id: I94c89442aa0385262fba67ec58c9d8d12ffbea27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166573 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index ee9a61deebc3..080580fd8589 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1585,16 +1585,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf160773) { xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160773.svg"); +const bool hasMask = countXPathNodes(pDocument, "/primitive2D/transform/mask"_ostr) > 0; +const OString aXPath = hasMask ? "/primitive2D/transform/mask/transform"_ostr + : "/primitive2D/transform/transform"_ostr; + // tdf#160773 Check there is a rectangle -assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#ff"); +assertXPath(pDocument, aXPath + "/polypolygoncolor", "color"_ostr, "#ff"); // tdf#159661 Check there is text in the right position -assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion"_ostr, 1); -assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion"_ostr, "x"_ostr, "0"); -assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion"_ostr, "y"_ostr, "1"); -assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion"_ostr, "height"_ostr, "0"); -assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion"_ostr, "width"_ostr, "0"); -assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion"_ostr, "text"_ostr, "Red"); +assertXPath(pDocument, aXPath + "/textsimpleportion"_ostr, 1); +assertXPath(pDocument, aXPath + "/textsimpleportion"_ostr, "x"_ostr, "0"); +assertXPath(pDocument, aX
core.git: drawinglayer/source
drawinglayer/source/primitive2d/textlayoutdevice.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 7f64148507a360825e9c28ddb7077996df9fa092 Author: Mike Kaganski AuthorDate: Tue Apr 23 05:25:34 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Apr 23 04:34:33 2024 +0200 Fix a thinko in 8a97f1ba8d9ccb65b2c89106de20666311d90c30 Change-Id: I07bb67e9384470269d1fd3df087acee377cce729 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166490 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index bfa414d40f42..3daecb4bec62 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -188,7 +188,7 @@ void TextLayouterDevice::setFontAttribute(const attribute::FontAttribute& rFontA } else { -mnFontScalingFixX = mnFontScalingFixY = 0; +mnFontScalingFixX = mnFontScalingFixY = 1.0; } }
core.git: drawinglayer/source
drawinglayer/source/primitive2d/textlayoutdevice.cxx | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) New commits: commit 8a97f1ba8d9ccb65b2c89106de20666311d90c30 Author: Mike Kaganski AuthorDate: Mon Apr 22 14:45:37 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 22 16:30:12 2024 +0200 tdf#160773: handle 0-size font height Regression from commit cc3663bbaed4f65d64154e5f9abb51a5f622f710 (tdf#160702: improve text positioning, 2024-04-20), where I didn't know yet that this was possible :-) Change-Id: I1316db48b8acbacd077eeb4a8989c3dbf7e4a7b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166425 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index cb3af255fd0e..bfa414d40f42 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -179,8 +179,17 @@ void TextLayouterDevice::setFontAttribute(const attribute::FontAttribute& rFontA = getVclFontFromFontAttribute(rFontAttribute, fFontScaleX, fFontScaleY, 0.0, rLocale); setFont(aFont); Size aFontSize = aFont.GetFontSize(); -mnFontScalingFixY = fFontScaleY / aFontSize.Height(); -mnFontScalingFixX = fFontScaleX / (aFontSize.Width() ? aFontSize.Width() : aFontSize.Height()); +if (aFontSize.Height()) +{ +mnFontScalingFixY = fFontScaleY / aFontSize.Height(); +// aFontSize.Width() is 0 for uninformly scaled fonts: see getVclFontFromFontAttribute +mnFontScalingFixX += fFontScaleX / (aFontSize.Width() ? aFontSize.Width() : aFontSize.Height()); +} +else +{ +mnFontScalingFixX = mnFontScalingFixY = 0; +} } double TextLayouterDevice::getOverlineOffset() const
core.git: xmloff/source
xmloff/source/text/txtparae.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit e902fe1b8bf03f9c3747685314f4d443bcea9333 Author: Mike Kaganski AuthorDate: Mon Apr 22 08:58:32 2024 +0200 Commit: Mike Kaganski CommitDate: Mon Apr 22 10:02:50 2024 +0200 Use designated initializers for clarity Change-Id: Ie10e657e07981e6fd0f0804371fd30f2b3f143b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166430 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index c95eb4886120..6153fb09d7a8 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1358,8 +1358,9 @@ struct XMLTextParagraphExport::DocumentListNodes for (const auto& node : nodes) { assert(node.getLength() == 3); -docListNodes.push_back({ node[0].get(), node[1].get(), - node[2].get() }); +docListNodes.push_back({ .index = node[0].get(), + .style_id = node[1].get(), + .list_id = node[2].get() }); } std::sort(docListNodes.begin(), docListNodes.end(),
core.git: Branch 'distro/vector/vector-7.5.9' - 3 commits - svgio/inc svgio/qa svgio/source
svgio/inc/SvgNumber.hxx |8 ++-- svgio/inc/svgnode.hxx |7 +-- svgio/inc/svgtspannode.hxx|2 - svgio/qa/cppunit/SvgImportTest.cxx| 52 ++ svgio/qa/cppunit/SvgNumberTest.cxx|4 +- svgio/qa/cppunit/data/dy_in_ems.svg |7 +++ svgio/qa/cppunit/data/dy_in_exs.svg |7 +++ svgio/source/svgreader/SvgNumber.cxx |5 +- svgio/source/svgreader/svgnode.cxx| 36 +++--- svgio/source/svgreader/svgstyleattributes.cxx |8 ++-- svgio/source/svgreader/svgtspannode.cxx |5 -- 11 files changed, 88 insertions(+), 53 deletions(-) New commits: commit c10fba9c937e4a52bfd1ed13aa813d4faee833fe Author: Mike Kaganski AuthorDate: Tue Apr 9 16:04:40 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 22 08:15:12 2024 +0500 tdf#160717: fix ex handling Same as in commit e27572686130df43d1d65c574b0c34f39fc0d1a9 (tdf#160593: make sure to use current element's font size for em unit, 2024-04-18) for em. Change-Id: Id9003c0426a6b373456da1aa1550f7ff07f766a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166235 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/svgio/inc/SvgNumber.hxx b/svgio/inc/SvgNumber.hxx index fe4ab8e2683e..c62576c2b082 100644 --- a/svgio/inc/SvgNumber.hxx +++ b/svgio/inc/SvgNumber.hxx @@ -39,8 +39,8 @@ public: virtual basegfx::B2DRange getCurrentViewPort() const = 0; /// return font size of node, either set here or inherited from parents virtual double getCurrentFontSize() const = 0; -/// return xheight of node inherited from parents -virtual double getCurrentXHeightInherited() const = 0; +/// return xheight of node, either set here or inherited from parents +virtual double getCurrentXHeight() const = 0; }; enum class SvgUnit diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx index 5d3a2453d727..d24cdecf3729 100644 --- a/svgio/inc/svgnode.hxx +++ b/svgio/inc/svgnode.hxx @@ -157,9 +157,7 @@ namespace svgio::svgreader /// InfoProvider support for %, em and ex values virtual basegfx::B2DRange getCurrentViewPort() const override; virtual double getCurrentFontSize() const override; -virtual double getCurrentXHeightInherited() const override; - -double getCurrentXHeight() const; +virtual double getCurrentXHeight() const override; /// Id access std::optional const & getId() const { return mpId; } diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 4d6f7568e2cd..d61c5c761f79 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1148,7 +1148,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDyInEms) CPPUNIT_TEST_FIXTURE(Test, testExs) { -// tdf#160594 given an SVG file with : +// tdf#160594, tdf#160717 given an SVG file with : std::u16string_view aPath = u"/svgio/qa/cppunit/data/dy_in_exs.svg"; Primitive2DSequence aSequence = parseSvg(aPath); drawinglayer::Primitive2dXmlDump aDumper; @@ -1156,6 +1156,7 @@ CPPUNIT_TEST_FIXTURE(Test, testExs) assertXPath(pDocument, "//textsimpleportion", 2); assertXPath(pDocument, "//textsimpleportion[1]", "height", "16"); +assertXPath(pDocument, "//textsimpleportion[1]", "y", "20"); sal_Int32 nSize = getXPath(pDocument, "//textsimpleportion[2]", "height").toInt32(); // Without the accompanying fix in place, this test would have failed with: @@ -1163,6 +1164,17 @@ CPPUNIT_TEST_FIXTURE(Test, testExs) // - Actual : 16 // i.e. the parent font-size was used, instead of its x-size. CPPUNIT_ASSERT_LESS(sal_Int32(16), nSize); + +sal_Int32 nYPos = getXPath(pDocument, "//textsimpleportion[2]", "y").toInt32(); +// Then make sure that the vertical offset is based on x-size of tspan, not of its parent. +// Given the tspan's font-size is nSize, its x-size is less than nSize, and the expected +// vertical offset is less than 3 * nSize, which means that the resulting y is expected +// to be strictly less than 20 + 3 * nSize. +// Without the accompanying fix in place, this test would have failed with: +// - Expected less than: 44 +// - Actual : 44 +// i.e. the parent x-size (or current font-size) was used, instead of current x-size. +CPPUNIT_ASSERT_LESS(sal_Int32(20 + 3 * nSize), nYPos); } } diff --git a/svgio/qa/cppunit/SvgNumberTest.cxx b/svgio/qa/cppunit/SvgNumberTest.cxx index 9b12e52bf956..49e1394bcef2 100644 --- a/svgio/qa/cppunit/SvgNumberTest.cxx +++ b/svgio/qa/cppunit/SvgNumberTest.cxx @@ -40,7 +40,7 @@ public: double getCurrentFontSize() const override { re
core.git: svx/source
svx/source/sdr/overlay/overlayselection.cxx | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) New commits: commit 992c821416817534c53338665e254c0dc554ea51 Author: Mike Kaganski AuthorDate: Sat Apr 20 18:20:13 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 20 16:53:45 2024 +0200 Simplify a bit Change-Id: I824b8670f7f2d6409ae98fe1a107c6c430fc1bfb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166371 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx index 8dafb00778a5..d4a7b45beb8f 100644 --- a/svx/source/sdr/overlay/overlayselection.cxx +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -40,11 +40,7 @@ struct B2DPointCompare { bool operator()(const basegfx::B2DPoint& lhs, const basegfx::B2DPoint& rhs) const { -if (lhs.getX() < rhs.getX()) -return true; -if (lhs.getX() > rhs.getX()) -return false; -return lhs.getY() < rhs.getY(); +return std::make_pair(lhs.getX(), lhs.getY()) < std::make_pair(rhs.getX(), rhs.getY()); } }; @@ -52,11 +48,7 @@ struct B2DPointCompareYThenX { bool operator()(const basegfx::B2DPoint& lhs, const basegfx::B2DPoint& rhs) const { -if (lhs.getY() < rhs.getY()) -return true; -if (lhs.getY() > rhs.getY()) -return false; -return lhs.getX() < rhs.getX(); +return std::make_pair(lhs.getY(), lhs.getX()) < std::make_pair(rhs.getY(), rhs.getX()); } };
core.git: svgio/inc svgio/qa svgio/source
svgio/inc/svgcharacternode.hxx|8 -- svgio/qa/cppunit/SvgImportTest.cxx| 46 ++--- svgio/source/svgreader/svgcharacternode.cxx | 87 +- svgio/source/svgreader/svgdocumenthandler.cxx | 83 +++- 4 files changed, 134 insertions(+), 90 deletions(-) New commits: commit 6e6081b3401de3a4799953edb5cccbeadcce6a2c Author: Mike Kaganski AuthorDate: Thu Apr 18 13:23:43 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 20 12:16:08 2024 +0200 tdf#157103: fix SVG whitespace handling Previous code tried to hack some tricks to restore whitespaces after trimming them according to the xml:space attribute value. But it was wrong in multiple ways. 1. The collapsed space must stay in the block where its start was. When a block ended with a space, then trimming the space from it, and adding to a next block, can change the size of the space. 2. The shift of a line (e.g., specifying x and y values) doesn't end the logical line. A space before such a shift must be kept by the same rules, as if there weren't a shift. 3. A block with xml:space="preserve" is treated as if it consists of all non-whitespace characters, even if its leading or trailing characters are spaces. I.e., a trailing space in a block before, or a leading space in a block after, should be collapsed into a single space, not removed - even when the space-preserving block itself is made invisible. Change-Id: Ic778d1e9d6b9d0c342ea74ad78d44bb47bc8d708 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166239 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx index d81066af47a6..20c60d787cb5 100644 --- a/svgio/inc/svgcharacternode.hxx +++ b/svgio/inc/svgcharacternode.hxx @@ -38,11 +38,10 @@ namespace svgio::svgreader /// the string data OUString maText; -// keep a copy of string data before space handling -OUString maTextBeforeSpaceHandling; - SvgTspanNode*mpParentLine; +bool mbHadTrailingSpace = false; + /// local helpers rtl::Reference createSimpleTextPrimitive( SvgTextPosition& rSvgTextPosition, @@ -65,8 +64,7 @@ namespace svgio::svgreader virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; void decomposeText(drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition) const; -void whiteSpaceHandling(); -SvgCharacterNode* addGap(SvgCharacterNode* pPreviousCharacterNode); +SvgCharacterNode* whiteSpaceHandling(SvgCharacterNode* pPreviousCharacterNode); void concatenate(std::u16string_view rText); /// Text content diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 93921d1b4cb0..e05fe539e1c0 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -749,7 +749,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf85770) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "height"_ostr, "11"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "familyname"_ostr, "Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "fontcolor"_ostr, "#00"); -assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "Start"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "text"_ostr, "Start "); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "height"_ostr, "11"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "familyname"_ostr, "Times New Roman"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "fontcolor"_ostr, "#00"); @@ -782,17 +782,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf93583) xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf93583.svg"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "This is the"); -assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "62"); +assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "58"); assertXPath(pDo
core.git: 2 commits - drawinglayer/source emfio/qa include/drawinglayer svgio/qa svgio/source
drawinglayer/source/primitive2d/textlayoutdevice.cxx | 52 ++--- drawinglayer/source/processor2d/vclprocessor2d.cxx| 30 ++- emfio/qa/cppunit/emf/EmfImportTest.cxx| 50 +--- include/drawinglayer/primitive2d/textlayoutdevice.hxx |2 svgio/qa/cppunit/SvgImportTest.cxx| 70 +- svgio/source/svgreader/svgcharacternode.cxx | 28 --- 6 files changed, 144 insertions(+), 88 deletions(-) New commits: commit cc3663bbaed4f65d64154e5f9abb51a5f622f710 Author: Mike Kaganski AuthorDate: Tue Apr 16 10:48:06 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 20 11:28:34 2024 +0200 tdf#160702: improve text positioning Opening an SVG with text in different elements (e.g., tspans) in the same text element performs calculations to position the parts properly (i.e., the next part will start where the previous part ended, unless the position in overridden explicitly). These calculations require to know the text widths. The first problem leas here: the text width was calculated for a typically small text size (numerically equal to the pixel size defined in the SVG), but these calculations aren't truly linear, because font rendering may change depending on font height. Additionally, the rounding gives much higher error in smaller sizes than in larger. There was already a workaround for a similar problem in ViewRedirector::createRedirectedPrimitive2DSequence, where a large font (with 100 times greater height) was used to increase correctness. This was also used here, with the same large height (5) used as a reference. Then, at the time of wrawing the text at different zoom levels, the code in VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D creates a font of a calculated size, and uses it to output the text. But the font is always created with an integral height, which means, that for a wanted height of 2.5 (in a zoomed out view), the really used height will be 3, which is 20% larger; or for wanted height of 2.4, the actual height will be 2 (20% smaller). This resulted in odd jumps of the text widths, when the text may overlap the following part, or conversely, create a big gap before the next gap. To try to mitigate that, the function now takes the difference between the wanted and the actual font size into account, and adjusts the MapMode accordingly. This doesn't fix the jumping completely (e.g., because of the mentioned special handling of small font sizes in the fonts thenselves, like hinting), but still makes the calculations much more stable, decreasing the amount of jumping. Similar changes are made in TextLayouterDevice. Use of the functions that return text size as a double, not rounded value, should additionally help improving stability. Change-Id: I455845d8ca43ee9c06a0fc980947f35d8a25797a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166238 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 5145d84ed2b6..cb3af255fd0e 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -22,6 +22,8 @@ #include #include + +#include #include #include #include @@ -162,56 +164,69 @@ TextLayouterDevice::TextLayouterDevice() TextLayouterDevice::~TextLayouterDevice() COVERITY_NOEXCEPT_FALSE { releaseGlobalVirtualDevice(); } -void TextLayouterDevice::setFont(const vcl::Font& rFont) { mrDevice.SetFont(rFont); } +void TextLayouterDevice::setFont(const vcl::Font& rFont) +{ +mrDevice.SetFont(rFont); +mnFontScalingFixX = 1.0; +mnFontScalingFixY = 1.0; +} void TextLayouterDevice::setFontAttribute(const attribute::FontAttribute& rFontAttribute, double fFontScaleX, double fFontScaleY, const css::lang::Locale& rLocale) { -setFont(getVclFontFromFontAttribute(rFontAttribute, fFontScaleX, fFontScaleY, 0.0, rLocale)); +vcl::Font aFont += getVclFontFromFontAttribute(rFontAttribute, fFontScaleX, fFontScaleY, 0.0, rLocale); +setFont(aFont); +Size aFontSize = aFont.GetFontSize(); +mnFontScalingFixY = fFontScaleY / aFontSize.Height(); +mnFontScalingFixX = fFontScaleX / (aFontSize.Width() ? aFontSize.Width() : aFontSize.Height()); } double TextLayouterDevice::getOverlineOffset() const { const ::FontMetric& rMetric = mrDevice.GetFontMetric(); double fRet = (rMetric.GetInternalLeading() / 2.0) - rMetric.GetAscent(); -return fRet; +return fRet * mnFontScalingFixY; } double TextLayouterDevice::getUnderlineOffset() const { const ::FontMetric& rMetric
core.git: chart2/qa drawinglayer/source editeng/source emfio/qa filter/source include/vcl sc/qa sd/qa svx/qa toolkit/source vcl/qa vcl/source
chart2/qa/extras/xshape/data/reference/fdo75075.xml | 736 +- chart2/qa/extras/xshape/data/reference/property-mapping-bar.xml | 546 +++ chart2/qa/extras/xshape/data/reference/tdf149204.xml| 116 - chart2/qa/extras/xshape/data/reference/tdf150832.xml| 428 ++--- chart2/qa/extras/xshape/data/reference/tdf151424.xml| 468 +++--- chart2/qa/extras/xshape/data/reference/tdf90839-1.xml | 86 - chart2/qa/extras/xshape/data/reference/tdf90839-2.xml | 64 chart2/qa/extras/xshape/data/reference/tdf90839-3.xml | 64 chart2/qa/extras/xshape/data/reference/tdf90839-4.xml | 64 chart2/qa/extras/xshape/data/reference/testChart.xml| 560 +++ drawinglayer/source/processor2d/vclprocessor2d.cxx |4 editeng/source/items/svxfont.cxx|4 emfio/qa/cppunit/emf/EmfImportTest.cxx |2 filter/source/svg/svgwriter.cxx |2 include/vcl/outdev.hxx |9 sc/qa/uitest/chart/chartDataLabels.py |4 sc/qa/uitest/chart/chartLegend.py |4 sd/qa/unit/layout-tests.cxx | 10 sd/qa/unit/tiledrendering/LOKitSearchTest.cxx |4 svx/qa/unit/customshapes.cxx| 18 toolkit/source/awt/vclxfont.cxx |2 vcl/qa/cppunit/complextext.cxx | 28 vcl/qa/cppunit/text.cxx |4 vcl/source/filter/wmf/emfwr.cxx |2 vcl/source/filter/wmf/wmfwr.cxx |2 vcl/source/outdev/map.cxx | 29 vcl/source/outdev/text.cxx | 31 vcl/source/text/textlayout.cxx |4 28 files changed, 1668 insertions(+), 1627 deletions(-) New commits: commit 089398e51409458c5438c49fb347e4f09d9c09dc Author: Mike Kaganski AuthorDate: Thu Apr 18 13:18:37 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 20 08:53:26 2024 +0200 Return double from OutputDevice::GetTextArray And introduce GetTextWidth / GetTextHeight variants returning double. It allows to avoid premature rounding. At least in one case - testTdf145111_anchor_in_Fontwork - it allowed to make the test DPI-independent (at least in my testing on Windows, using 125, 150, and 175% UI scaling). Change-Id: I973d2c729ec6bb7114b4f99b9027f1ead7c1d061 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166237 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/chart2/qa/extras/xshape/data/reference/fdo75075.xml b/chart2/qa/extras/xshape/data/reference/fdo75075.xml index fe8cb00cf178..6f401aa41edd 100644 --- a/chart2/qa/extras/xshape/data/reference/fdo75075.xml +++ b/chart2/qa/extras/xshape/data/reference/fdo75075.xml @@ -14,9 +14,9 @@ - + - + @@ -25,12 +25,12 @@ - + - + @@ -39,18 +39,18 @@ - + - + - + - + - + @@ -59,125 +59,125
core.git: Branch 'libreoffice-24-2' - svgio/inc svgio/qa svgio/source
svgio/inc/SvgNumber.hxx |4 ++-- svgio/inc/svgnode.hxx|4 +--- svgio/qa/cppunit/SvgImportTest.cxx | 14 +- svgio/qa/cppunit/SvgNumberTest.cxx |2 +- svgio/source/svgreader/SvgNumber.cxx |2 +- svgio/source/svgreader/svgnode.cxx | 21 - 6 files changed, 22 insertions(+), 25 deletions(-) New commits: commit 0324cb1c85b6daab8abaf139ac6b372127b76f06 Author: Mike Kaganski AuthorDate: Tue Apr 9 16:04:40 2024 +0500 Commit: Xisco Fauli CommitDate: Fri Apr 19 15:32:08 2024 +0200 tdf#160717: fix ex handling Same as in commit e27572686130df43d1d65c574b0c34f39fc0d1a9 (tdf#160593: make sure to use current element's font size for em unit, 2024-04-18) for em. Change-Id: Id9003c0426a6b373456da1aa1550f7ff07f766a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166235 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski (cherry picked from commit edef46e82e7e54a27004f9ee6e99108390736d12) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166216 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/svgio/inc/SvgNumber.hxx b/svgio/inc/SvgNumber.hxx index fe4ab8e2683e..c62576c2b082 100644 --- a/svgio/inc/SvgNumber.hxx +++ b/svgio/inc/SvgNumber.hxx @@ -39,8 +39,8 @@ public: virtual basegfx::B2DRange getCurrentViewPort() const = 0; /// return font size of node, either set here or inherited from parents virtual double getCurrentFontSize() const = 0; -/// return xheight of node inherited from parents -virtual double getCurrentXHeightInherited() const = 0; +/// return xheight of node, either set here or inherited from parents +virtual double getCurrentXHeight() const = 0; }; enum class SvgUnit diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx index 98a444cba5fc..5231635d6261 100644 --- a/svgio/inc/svgnode.hxx +++ b/svgio/inc/svgnode.hxx @@ -164,9 +164,7 @@ namespace svgio::svgreader /// InfoProvider support for %, em and ex values virtual basegfx::B2DRange getCurrentViewPort() const override; virtual double getCurrentFontSize() const override; -virtual double getCurrentXHeightInherited() const override; - -double getCurrentXHeight() const; +virtual double getCurrentXHeight() const override; /// Id access std::optional const & getId() const { return mpId; } diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index cc25dec16233..f56966a4423c 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -2087,11 +2087,12 @@ CPPUNIT_TEST_FIXTURE(Test, testDyInEms) CPPUNIT_TEST_FIXTURE(Test, testExs) { -// tdf#160594 given an SVG file with : +// tdf#160594, tdf#160717 given an SVG file with : xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/dy_in_exs.svg"); assertXPath(pDocument, "//textsimpleportion"_ostr, 2); assertXPath(pDocument, "//textsimpleportion[1]"_ostr, "height"_ostr, u"16"_ustr); +assertXPath(pDocument, "//textsimpleportion[1]"_ostr, "y"_ostr, u"20"_ustr); sal_Int32 nSize = getXPath(pDocument, "//textsimpleportion[2]"_ostr, "height"_ostr).toInt32(); // Without the accompanying fix in place, this test would have failed with: @@ -2099,6 +2100,17 @@ CPPUNIT_TEST_FIXTURE(Test, testExs) // - Actual : 16 // i.e. the parent font-size was used, instead of its x-size. CPPUNIT_ASSERT_LESS(sal_Int32(16), nSize); + +sal_Int32 nYPos = getXPath(pDocument, "//textsimpleportion[2]"_ostr, "y"_ostr).toInt32(); +// Then make sure that the vertical offset is based on x-size of tspan, not of its parent. +// Given the tspan's font-size is nSize, its x-size is less than nSize, and the expected +// vertical offset is less than 3 * nSize, which means that the resulting y is expected +// to be strictly less than 20 + 3 * nSize. +// Without the accompanying fix in place, this test would have failed with: +// - Expected less than: 44 +// - Actual : 44 +// i.e. the parent x-size (or current font-size) was used, instead of current x-size. +CPPUNIT_ASSERT_LESS(sal_Int32(20 + 3 * nSize), nYPos); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/svgio/qa/cppunit/SvgNumberTest.cxx b/svgio/qa/cppunit/SvgNumberTest.cxx index 9b12e52bf956..49e1394bcef2 100644 --- a/svgio/qa/cppunit/SvgNumberTest.cxx +++ b/svgio/qa/cppunit/SvgNumberTest.cxx @@ -40,7 +40,7 @@ public: double getCurrentFontSize() const override { return 12.0; } -double getCurrentXHeightInherited() const override { return 5.0; } +double getCurrentXHeight() const override { return 5.0; } }; void TestNumber::testSetting() diff --git a/svgio/source/svgreade
core.git: Branch 'distro/collabora/co-24.04' - 5 commits - sc/source svgio/inc svgio/qa svgio/source sw/qa sw/source
sc/source/filter/html/htmlpars.cxx|2 - sc/source/ui/docshell/impex.cxx |6 ++-- svgio/inc/SvgNumber.hxx |4 +-- svgio/inc/svgnode.hxx |3 -- svgio/inc/svgtspannode.hxx|2 - svgio/qa/cppunit/SvgImportTest.cxx| 34 ++ svgio/qa/cppunit/SvgNumberTest.cxx|2 - svgio/qa/cppunit/data/dy_in_ems.svg |7 + svgio/qa/cppunit/data/dy_in_exs.svg |7 + svgio/source/svgreader/SvgNumber.cxx |3 +- svgio/source/svgreader/svgnode.cxx| 17 +++-- svgio/source/svgreader/svgstyleattributes.cxx |8 +++--- svgio/source/svgreader/svgtspannode.cxx |5 --- sw/qa/extras/odfexport/data/tdf160700.odt |binary sw/qa/extras/odfexport/odfexport2.cxx | 30 ++ sw/source/core/unocore/unoportenum.cxx|3 ++ 16 files changed, 99 insertions(+), 34 deletions(-) New commits: commit e4b31978049a5c96b7672ceabb1fdeef7048afec Author: Mike Kaganski AuthorDate: Fri Apr 19 00:34:28 2024 +0500 Commit: Andras Timar CommitDate: Fri Apr 19 12:38:31 2024 +0200 tdf#160700: Avoid both bookmark-start and bookmark-end at the same index There is a special handling of CrossRefBookmark, which has no end position in the document model, but must span the whole paragraph, and end position is generated explicitly. Since commit 1d7ce421480d9170316533de03feb8d04eb5c767 (tdf#159438: when there's no frame, close previous bookmark first, 2024-01-30), end marks of an index are sorted before start marks of the same index, with the expectation that start / end marks represent non-empty span. Dun in case of empty paragraphs with a CrossRefBookmark, both start and end mark were emitted into the same index, and the new sorting resulted in the wrong order of the elements. Fix this by checking if the start index is less than node end, and don't handle CrossRefBookmark specially, if the check is negative. This writes a single text:bookmark, instead of a text:bookmark-start, followed by a text:bookmark-end. Change-Id: I533c4f7814edddc3cf24b1213490f251d60b2273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166266 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166280 diff --git a/sw/qa/extras/odfexport/data/tdf160700.odt b/sw/qa/extras/odfexport/data/tdf160700.odt new file mode 100644 index ..bc1515da3f82 Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf160700.odt differ diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 49836082907c..f654821acf6a 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -1343,6 +1344,35 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159438) u"bookmark3"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testTdf160700) +{ +// Given a document with an empty numbered paragraph, and a cross-reference to it +loadAndReload("tdf160700.odt"); + +// Refresh fields and ensure cross-reference to numbered para is okay +auto xTextFieldsSupplier(mxComponent.queryThrow()); +auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); + +xFieldsAccess.queryThrow()->refresh(); + +auto xFields(xFieldsAccess->createEnumeration()); +CPPUNIT_ASSERT(xFields->hasMoreElements()); +auto xTextField(xFields->nextElement().queryThrow()); +// Save must not create markup with text:bookmark-end element before text:bookmark-start +// Withoud the fix, this would fail with +// - Expected: 1 +// - Actual : Error: Reference source not found +// i.e., the bookmark wasn't imported, and the field had no proper source +CPPUNIT_ASSERT_EQUAL(u"1"_ustr, xTextField->getPresentation(false)); + +xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); +// Check that we export the bookmark in the empty paragraph as a single text:bookmark +// element. Another walid markup is text:bookmark-start followed by text:bookmark-end +// (in that order). The problem was, that text:bookmark-end was before text:bookmark-start. +assertXPathChildren(pXmlDoc, "//office:text/text:list/text:list-item/text:p"_ostr, 1); +assertXPath(pXmlDoc, "//office:text/text:list/text:list-item/text:p/text:bookmark"_ostr); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 494cec746865..709d79ef4d4b 100644 --- a/sw/source/core/unocore/
core.git: Branch 'libreoffice-24-2' - sw/qa sw/source
sw/qa/extras/odfexport/data/tdf160700.odt |binary sw/qa/extras/odfexport/odfexport2.cxx | 30 ++ sw/source/core/unocore/unoportenum.cxx|3 +++ 3 files changed, 33 insertions(+) New commits: commit 028feacd6a459d613e7a0d12788bf05b0e4c778c Author: Mike Kaganski AuthorDate: Fri Apr 19 00:34:28 2024 +0500 Commit: Xisco Fauli CommitDate: Fri Apr 19 10:59:56 2024 +0200 tdf#160700: Avoid both bookmark-start and bookmark-end at the same index There is a special handling of CrossRefBookmark, which has no end position in the document model, but must span the whole paragraph, and end position is generated explicitly. Since commit 1d7ce421480d9170316533de03feb8d04eb5c767 (tdf#159438: when there's no frame, close previous bookmark first, 2024-01-30), end marks of an index are sorted before start marks of the same index, with the expectation that start / end marks represent non-empty span. Dun in case of empty paragraphs with a CrossRefBookmark, both start and end mark were emitted into the same index, and the new sorting resulted in the wrong order of the elements. Fix this by checking if the start index is less than node end, and don't handle CrossRefBookmark specially, if the check is negative. This writes a single text:bookmark, instead of a text:bookmark-start, followed by a text:bookmark-end. Change-Id: I533c4f7814edddc3cf24b1213490f251d60b2273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166266 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166280 diff --git a/sw/qa/extras/odfexport/data/tdf160700.odt b/sw/qa/extras/odfexport/data/tdf160700.odt new file mode 100644 index ..bc1515da3f82 Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf160700.odt differ diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 49836082907c..f654821acf6a 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -1343,6 +1344,35 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159438) u"bookmark3"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testTdf160700) +{ +// Given a document with an empty numbered paragraph, and a cross-reference to it +loadAndReload("tdf160700.odt"); + +// Refresh fields and ensure cross-reference to numbered para is okay +auto xTextFieldsSupplier(mxComponent.queryThrow()); +auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); + +xFieldsAccess.queryThrow()->refresh(); + +auto xFields(xFieldsAccess->createEnumeration()); +CPPUNIT_ASSERT(xFields->hasMoreElements()); +auto xTextField(xFields->nextElement().queryThrow()); +// Save must not create markup with text:bookmark-end element before text:bookmark-start +// Withoud the fix, this would fail with +// - Expected: 1 +// - Actual : Error: Reference source not found +// i.e., the bookmark wasn't imported, and the field had no proper source +CPPUNIT_ASSERT_EQUAL(u"1"_ustr, xTextField->getPresentation(false)); + +xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); +// Check that we export the bookmark in the empty paragraph as a single text:bookmark +// element. Another walid markup is text:bookmark-start followed by text:bookmark-end +// (in that order). The problem was, that text:bookmark-end was before text:bookmark-start. +assertXPathChildren(pXmlDoc, "//office:text/text:list/text:list-item/text:p"_ostr, 1); +assertXPath(pXmlDoc, "//office:text/text:list/text:list-item/text:p/text:bookmark"_ostr); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 494cec746865..709d79ef4d4b 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -150,8 +150,11 @@ namespace bool const hasOther = isExpanded && rStartPos != rEndPos; bool const bStartPosInNode = rStartPos.GetNode() == rOwnNode; bool const bEndPosInNode = rEndPos.GetNode() == rOwnNode; +// tdf#160700: Crossrefbookmarks only need separate start and end, when the start +// isn't in the end position (so in empty nodes, no need to handle them specially) sw::mark::CrossRefBookmark* const pCrossRefMark = !isExpanded && bStartPosInNode + && rStartPos.GetContentIndex() < rStartPos.GetContentNode()->Len() ? dynamic_cast(pBkmk) : nullptr;
core.git: Branch 'libreoffice-24-2' - 2 commits - svgio/inc svgio/qa svgio/source
svgio/inc/SvgNumber.hxx |4 +-- svgio/inc/svgnode.hxx |3 -- svgio/inc/svgtspannode.hxx|2 - svgio/qa/cppunit/SvgImportTest.cxx| 34 ++ svgio/qa/cppunit/SvgNumberTest.cxx|2 - svgio/qa/cppunit/data/dy_in_ems.svg |7 + svgio/qa/cppunit/data/dy_in_exs.svg |7 + svgio/source/svgreader/SvgNumber.cxx |3 +- svgio/source/svgreader/svgnode.cxx| 17 +++-- svgio/source/svgreader/svgstyleattributes.cxx |8 +++--- svgio/source/svgreader/svgtspannode.cxx |5 --- 11 files changed, 62 insertions(+), 30 deletions(-) New commits: commit 97586e0b4712e44e360e6572af8483d81ac2346a Author: Mike Kaganski AuthorDate: Tue Apr 9 13:56:13 2024 +0500 Commit: Xisco Fauli CommitDate: Fri Apr 19 09:09:17 2024 +0200 tdf#160594: Use the recommended fallback of 0.5em for ex in font-size This fixes the error of identical treatment of em and ex in font-size, which violated https://drafts.csswg.org/css-values-4/#font-relative-length. The fix uses the fallback of 0.5em for ex, similar to the code used in SvgNumber::solveNonPercentage. A follow-up should implement the correct use of "x-height of the first available font". Change-Id: Id9d581994e158d629d9752299ad93ac7e9fe4cad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166234 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166261 diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 099f1d199406..cc25dec16233 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -2085,6 +2085,22 @@ CPPUNIT_TEST_FIXTURE(Test, testDyInEms) assertXPath(pDocument, "//textsimpleportion[2]"_ostr, "y"_ostr, u"32"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testExs) +{ +// tdf#160594 given an SVG file with : +xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/dy_in_exs.svg"); + +assertXPath(pDocument, "//textsimpleportion"_ostr, 2); +assertXPath(pDocument, "//textsimpleportion[1]"_ostr, "height"_ostr, u"16"_ustr); + +sal_Int32 nSize = getXPath(pDocument, "//textsimpleportion[2]"_ostr, "height"_ostr).toInt32(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected less than: 16 +// - Actual : 16 +// i.e. the parent font-size was used, instead of its x-size. +CPPUNIT_ASSERT_LESS(sal_Int32(16), nSize); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svgio/qa/cppunit/data/dy_in_exs.svg b/svgio/qa/cppunit/data/dy_in_exs.svg new file mode 100644 index ..816a64a4586c --- /dev/null +++ b/svgio/qa/cppunit/data/dy_in_exs.svg @@ -0,0 +1,7 @@ + + +http://www.w3.org/2000/svg; width="1in" height="1in" viewBox="0 0 100% 100%"> + + foo + bar + \ No newline at end of file diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 58bdb9add84b..50f72199e40b 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -2642,11 +2642,11 @@ namespace svgio::svgreader if(pSvgStyleAttributes) { const SvgNumber aParentNumber = pSvgStyleAttributes->getFontSizeNumber(); +double n = aParentNumber.getNumber() * maFontSizeNumber.getNumber(); +if (SvgUnit::ex == maFontSizeNumber.getUnit()) +n *= 0.5; // FIXME: use "x-height of the first available font" -return SvgNumber( -aParentNumber.getNumber() * maFontSizeNumber.getNumber(), -aParentNumber.getUnit(), -true); + return SvgNumber(n, aParentNumber.getUnit()); } } commit 334446935b194ebdadb10004c01bff550f09838e Author: Mike Kaganski AuthorDate: Tue Apr 9 13:03:07 2024 +0500 Commit: Xisco Fauli CommitDate: Fri Apr 19 09:09:09 2024 +0200 tdf#160593: make sure to use current element's font size for em unit According to https://drafts.csswg.org/css-values-4/#font-relative-length em is "equal to the computed value of the font-size property of the element on which it is used". This means, that for an element that defines its own font-size, attributes like 'dy' using em refer to the new font-size, not to inherited font-size. Change-Id: Ie5a0
core.git: sw/qa
sw/qa/extras/ww8export/data/empty_group.docx |binary sw/qa/extras/ww8export/ww8export4.cxx| 24 2 files changed, 24 insertions(+) New commits: commit 2c2c155b37750618784cae410f50b75d503e506d Author: Mike Kaganski AuthorDate: Fri Apr 19 10:31:39 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Apr 19 08:59:17 2024 +0200 Add a unit test for commit 3f0220f18a66630e06e3c128980f21a5722f49ca (Handle empty range properly, 2024-04-18) Change-Id: Ifea60ace8ff864ef092e6a62177d5926ceb60de3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166278 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/ww8export/data/empty_group.docx b/sw/qa/extras/ww8export/data/empty_group.docx new file mode 100644 index ..a3454746c5e0 Binary files /dev/null and b/sw/qa/extras/ww8export/data/empty_group.docx differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index 7ab6f76ec3a6..d3bc9c4071d9 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -20,8 +20,11 @@ #include #include +#include #include +#include +#include #include #include #include @@ -294,6 +297,27 @@ DECLARE_WW8EXPORT_TEST(testTdf104704_mangledFooter, "tdf104704_mangledFooter.odt CPPUNIT_ASSERT_EQUAL(2, getPages()); } +CPPUNIT_TEST_FIXTURE(Test, testEmptyGroup) +{ +// Given a document with an empty group +createSwDoc("empty_group.docx"); + +CPPUNIT_ASSERT_EQUAL(1, getPages()); +CPPUNIT_ASSERT_EQUAL(1, getShapes()); +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pTextDoc); +SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); +SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); +SdrObject* pObject = pPage->GetObj(0); + +CPPUNIT_ASSERT_EQUAL(u"Empty group"_ustr, pObject->GetName()); +CPPUNIT_ASSERT(pObject->IsGroupObject()); +CPPUNIT_ASSERT_EQUAL(size_t(0), pObject->GetSubList()->GetObjCount()); + +// it must not assert/crash on save +saveAndReload(mpFilter); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
core.git: drawinglayer/source include/vcl svgio/qa sw/qa vcl/skia vcl/source vcl/win
drawinglayer/source/primitive2d/textlayoutdevice.cxx | 10 + include/vcl/outdev.hxx |7 +++ include/vcl/vcllayout.hxx|5 ++ svgio/qa/cppunit/SvgImportTest.cxx | 11 + sw/qa/uitest/writer_tests6/tdf157569.py |4 +- vcl/skia/gdiimpl.cxx |2 - vcl/source/gdi/sallayout.cxx | 33 vcl/source/outdev/map.cxx|8 vcl/source/outdev/text.cxx | 38 +++ vcl/win/gdi/DWriteTextRenderer.cxx | 11 - 10 files changed, 89 insertions(+), 40 deletions(-) New commits: commit 2642643ec07cd7f3d28fe558769297578c36de19 Author: Mike Kaganski AuthorDate: Wed Apr 10 12:15:55 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Apr 19 05:31:51 2024 +0200 tdf#160622: Let SalLayout::GetBoundRect return basegfx::B2DRectangle This avoids premature rounding in TextLayouterDevice::getTextBoundRect. The box in D2DWriteTextOutRenderer::performRender needs to be expanded to allow room for the line width (which now will be guaranteed on all sides; previously, the rounding could happen to give no room on some side, even prior to commit 8962141a12c966b2d891829925e6203bf8d51852). Fixes some lines partially cut off in smaller text (or zoomed out). Change-Id: I07335136021f894cf045363b4d736bfab06c64d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166236 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 1c551ce01363..5145d84ed2b6 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -260,15 +260,9 @@ basegfx::B2DRange TextLayouterDevice::getTextBoundRect(const OUString& rText, sa if (nTextLength) { -::tools::Rectangle aRect; - +basegfx::B2DRange aRect; mrDevice.GetTextBoundRect(aRect, rText, nIndex, nIndex, nLength); - -// #i104432#, #i102556# take empty results into account -if (!aRect.IsEmpty()) -{ -return vcl::unotools::b2DRectangleFromRectangle(aRect); -} +return aRect; } return basegfx::B2DRange(); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index e4a0b4827b5b..3211ed368989 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -962,6 +963,11 @@ public: sal_uLong nLayoutWidth = 0, KernArraySpan aDXArray = KernArraySpan(), std::span pKashidaArray = {}, const SalLayoutGlyphs* pGlyphs = nullptr ) const; +boolGetTextBoundRect( basegfx::B2DRectangle& rRect, + const OUString& rStr, sal_Int32 nBase = 0, sal_Int32 nIndex = 0, sal_Int32 nLen = -1, + sal_uLong nLayoutWidth = 0, KernArraySpan aDXArray = KernArraySpan(), + std::span pKashidaArray = {}, + const SalLayoutGlyphs* pGlyphs = nullptr ) const; tools::RectangleImplGetTextBoundRect( const SalLayout& ) const; @@ -1615,6 +1621,7 @@ public: SAL_WARN_UNUSED_RESULT SAL_DLLPRIVATE tools::Polygon PixelToLogic(const tools::Polygon& rDevicePoly) const; SAL_WARN_UNUSED_RESULT SAL_DLLPRIVATE tools::PolyPolygon PixelToLogic(const tools::PolyPolygon& rDevicePolyPoly) const; SAL_WARN_UNUSED_RESULT SAL_DLLPRIVATE basegfx::B2DPolyPolygon PixelToLogic(const basegfx::B2DPolyPolygon& rDevicePolyPoly) const; +SAL_WARN_UNUSED_RESULT SAL_DLLPRIVATE basegfx::B2DRectangle PixelToLogic(const basegfx::B2DRectangle& rDeviceRect) const; SAL_WARN_UNUSED_RESULT vcl::Region PixelToLogic(const vcl::Region& rDeviceRegion) const; SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point& rDevicePt, const MapMode& rMapMode) const; SAL_WARN_UNUSED_RESULT Size PixelToLogic(const Size& rDeviceSize, const MapMode& rMapMode) const; diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx index 7c7a179b9b05..c946f6f67884 100644 --- a/include/vcl/vcllayout.hxx +++ b/include/vcl/vcllayout.hxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -103,7 +104,9 @@ public: virtual boolGetNextGlyph(const GlyphItem** pGlyph, basegfx::B2DPoint& rPos, int& nStart, const LogicalFontInstance** ppG
core.git: sw/qa sw/source
sw/qa/extras/odfexport/data/tdf160700.odt |binary sw/qa/extras/odfexport/odfexport2.cxx | 30 ++ sw/source/core/unocore/unoportenum.cxx|3 +++ 3 files changed, 33 insertions(+) New commits: commit 58e79c4394783033f61e1309214d9060e2f0adf2 Author: Mike Kaganski AuthorDate: Fri Apr 19 00:34:28 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Apr 19 05:23:38 2024 +0200 tdf#160700: Avoid both bookmark-start and bookmark-end at the same index There is a special handling of CrossRefBookmark, which has no end position in the document model, but must span the whole paragraph, and end position is generated explicitly. Since commit 1d7ce421480d9170316533de03feb8d04eb5c767 (tdf#159438: when there's no frame, close previous bookmark first, 2024-01-30), end marks of an index are sorted before start marks of the same index, with the expectation that start / end marks represent non-empty span. Dun in case of empty paragraphs with a CrossRefBookmark, both start and end mark were emitted into the same index, and the new sorting resulted in the wrong order of the elements. Fix this by checking if the start index is less than node end, and don't handle CrossRefBookmark specially, if the check is negative. This writes a single text:bookmark, instead of a text:bookmark-start, followed by a text:bookmark-end. Change-Id: I533c4f7814edddc3cf24b1213490f251d60b2273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166266 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/odfexport/data/tdf160700.odt b/sw/qa/extras/odfexport/data/tdf160700.odt new file mode 100644 index ..bc1515da3f82 Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf160700.odt differ diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 5fe33dd96cd5..ee1f7fcbc8bc 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -1499,6 +1500,35 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159438) u"bookmark3"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testTdf160700) +{ +// Given a document with an empty numbered paragraph, and a cross-reference to it +loadAndReload("tdf160700.odt"); + +// Refresh fields and ensure cross-reference to numbered para is okay +auto xTextFieldsSupplier(mxComponent.queryThrow()); +auto xFieldsAccess(xTextFieldsSupplier->getTextFields()); + +xFieldsAccess.queryThrow()->refresh(); + +auto xFields(xFieldsAccess->createEnumeration()); +CPPUNIT_ASSERT(xFields->hasMoreElements()); +auto xTextField(xFields->nextElement().queryThrow()); +// Save must not create markup with text:bookmark-end element before text:bookmark-start +// Withoud the fix, this would fail with +// - Expected: 1 +// - Actual : Error: Reference source not found +// i.e., the bookmark wasn't imported, and the field had no proper source +CPPUNIT_ASSERT_EQUAL(u"1"_ustr, xTextField->getPresentation(false)); + +xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); +// Check that we export the bookmark in the empty paragraph as a single text:bookmark +// element. Another walid markup is text:bookmark-start followed by text:bookmark-end +// (in that order). The problem was, that text:bookmark-end was before text:bookmark-start. +assertXPathChildren(pXmlDoc, "//office:text/text:list/text:list-item/text:p"_ostr, 1); +assertXPath(pXmlDoc, "//office:text/text:list/text:list-item/text:p/text:bookmark"_ostr); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index b5b3490c22ff..220834cb8bb3 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -150,8 +150,11 @@ namespace bool const hasOther = isExpanded && rStartPos != rEndPos; bool const bStartPosInNode = rStartPos.GetNode() == rOwnNode; bool const bEndPosInNode = rEndPos.GetNode() == rOwnNode; +// tdf#160700: Crossrefbookmarks only need separate start and end, when the start +// isn't in the end position (so in empty nodes, no need to handle them specially) sw::mark::CrossRefBookmark* const pCrossRefMark = !isExpanded && bStartPosInNode + && rStartPos.GetContentIndex() < rStartPos.GetContentNode()->Len() ? dynamic_cast(pBkmk) : nullptr;
core.git: svgio/inc svgio/qa svgio/source
svgio/inc/SvgNumber.hxx |4 ++-- svgio/inc/svgnode.hxx|4 +--- svgio/qa/cppunit/SvgImportTest.cxx | 14 +- svgio/qa/cppunit/SvgNumberTest.cxx |2 +- svgio/source/svgreader/SvgNumber.cxx |2 +- svgio/source/svgreader/svgnode.cxx | 21 - 6 files changed, 22 insertions(+), 25 deletions(-) New commits: commit edef46e82e7e54a27004f9ee6e99108390736d12 Author: Mike Kaganski AuthorDate: Tue Apr 9 16:04:40 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Apr 19 05:18:50 2024 +0200 tdf#160717: fix ex handling Same as in commit e27572686130df43d1d65c574b0c34f39fc0d1a9 (tdf#160593: make sure to use current element's font size for em unit, 2024-04-18) for em. Change-Id: Id9003c0426a6b373456da1aa1550f7ff07f766a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166235 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/svgio/inc/SvgNumber.hxx b/svgio/inc/SvgNumber.hxx index 6e371ba94b26..3509200ea392 100644 --- a/svgio/inc/SvgNumber.hxx +++ b/svgio/inc/SvgNumber.hxx @@ -39,8 +39,8 @@ public: virtual basegfx::B2DRange getCurrentViewPort() const = 0; /// return font size of node, either set here or inherited from parents virtual double getCurrentFontSize() const = 0; -/// return xheight of node inherited from parents -virtual double getCurrentXHeightInherited() const = 0; +/// return xheight of node, either set here or inherited from parents +virtual double getCurrentXHeight() const = 0; }; enum class SvgUnit diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx index 6732e8bb142d..727006b3ee18 100644 --- a/svgio/inc/svgnode.hxx +++ b/svgio/inc/svgnode.hxx @@ -165,9 +165,7 @@ namespace svgio::svgreader /// InfoProvider support for %, em and ex values virtual basegfx::B2DRange getCurrentViewPort() const override; virtual double getCurrentFontSize() const override; -virtual double getCurrentXHeightInherited() const override; - -double getCurrentXHeight() const; +virtual double getCurrentXHeight() const override; /// Id access std::optional const & getId() const { return mpId; } diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index dd53d4e28a19..fe7c51d11324 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1679,11 +1679,12 @@ CPPUNIT_TEST_FIXTURE(Test, testDyInEms) CPPUNIT_TEST_FIXTURE(Test, testExs) { -// tdf#160594 given an SVG file with : +// tdf#160594, tdf#160717 given an SVG file with : xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/dy_in_exs.svg"); assertXPath(pDocument, "//textsimpleportion"_ostr, 2); assertXPath(pDocument, "//textsimpleportion[1]"_ostr, "height"_ostr, u"16"_ustr); +assertXPath(pDocument, "//textsimpleportion[1]"_ostr, "y"_ostr, u"20"_ustr); sal_Int32 nSize = getXPath(pDocument, "//textsimpleportion[2]"_ostr, "height"_ostr).toInt32(); // Without the accompanying fix in place, this test would have failed with: @@ -1691,6 +1692,17 @@ CPPUNIT_TEST_FIXTURE(Test, testExs) // - Actual : 16 // i.e. the parent font-size was used, instead of its x-size. CPPUNIT_ASSERT_LESS(sal_Int32(16), nSize); + +sal_Int32 nYPos = getXPath(pDocument, "//textsimpleportion[2]"_ostr, "y"_ostr).toInt32(); +// Then make sure that the vertical offset is based on x-size of tspan, not of its parent. +// Given the tspan's font-size is nSize, its x-size is less than nSize, and the expected +// vertical offset is less than 3 * nSize, which means that the resulting y is expected +// to be strictly less than 20 + 3 * nSize. +// Without the accompanying fix in place, this test would have failed with: +// - Expected less than: 44 +// - Actual : 44 +// i.e. the parent x-size (or current font-size) was used, instead of current x-size. +CPPUNIT_ASSERT_LESS(sal_Int32(20 + 3 * nSize), nYPos); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/svgio/qa/cppunit/SvgNumberTest.cxx b/svgio/qa/cppunit/SvgNumberTest.cxx index 9b12e52bf956..49e1394bcef2 100644 --- a/svgio/qa/cppunit/SvgNumberTest.cxx +++ b/svgio/qa/cppunit/SvgNumberTest.cxx @@ -40,7 +40,7 @@ public: double getCurrentFontSize() const override { return 12.0; } -double getCurrentXHeightInherited() const override { return 5.0; } +double getCurrentXHeight() const override { return 5.0; } }; void TestNumber::testSetting() diff --git a/svgio/source/svgreader/SvgNumber.cxx b/svgio/source/svgreader/SvgNumber.cxx index 4a48ffbfb4e9..72a44dbdd032 100644 --- a/svgio/source/svgreader/SvgNumber.cxx +++ b/svgio/source/svgreader/SvgNumber.cx
core.git: filter/source
filter/source/msfilter/eschesdo.cxx | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) New commits: commit 3f0220f18a66630e06e3c128980f21a5722f49ca Author: Mike Kaganski AuthorDate: Wed Apr 17 21:16:23 2024 +0100 Commit: Caolán McNamara CommitDate: Thu Apr 18 21:28:16 2024 +0200 Handle empty range properly Since commit 690526f95e3ee4fd25bb2c987e093543e4bc435b (Generalize basegfx::fround for templated return type, 2024-04-14), an assertion could fail for certain case, like include/o3tl/unit_conversion.hxx:75: sal_Int64 o3tl::detail::MulDiv(I, sal_Int64, sal_Int64) [I = long]: Assertion `isBetween(n, (SAL_MIN_INT64 + d / 2) / m, (SAL_MAX_INT64 - d / 2) / m)' The problem was unchecked case of empty B2DRange. Change-Id: Ice9125ea557b73a7fabf64bc1ad9368f503ad525 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166101 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index 6a17fff242a0..b21534676e4c 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -1156,10 +1156,19 @@ void ImplEESdrObject::Init() { // if it's a group, the unrotated range is needed for that group const basegfx::B2DRange aUnrotatedRange(getUnrotatedGroupBoundRange(mXShape)); -const Point aNewP(basegfx::fround(aUnrotatedRange.getMinX()), basegfx::fround(aUnrotatedRange.getMinY())); -const Size aNewS(basegfx::fround(aUnrotatedRange.getWidth()), basegfx::fround(aUnrotatedRange.getHeight())); +if (aUnrotatedRange.isEmpty()) +{ +SetRect(tools::Rectangle()); +} +else +{ +const Point aNewP(basegfx::fround(aUnrotatedRange.getMinX()), + basegfx::fround(aUnrotatedRange.getMinY())); +const Size aNewS(basegfx::fround(aUnrotatedRange.getWidth()), + basegfx::fround(aUnrotatedRange.getHeight())); -SetRect(ImplEESdrWriter::ImplMapPoint(aNewP), ImplEESdrWriter::ImplMapSize(aNewS)); +SetRect(ImplEESdrWriter::ImplMapPoint(aNewP), ImplEESdrWriter::ImplMapSize(aNewS)); +} } else {
core.git: Branch 'distro/vector/vector-7.5.9' - 8 commits - vcl/inc vcl/qa vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win vcl/workben
vcl/inc/font/LogicalFontInstance.hxx |5 + vcl/inc/impfontcache.hxx |8 +- vcl/inc/impglyphitem.hxx |6 +- vcl/inc/pdf/pdfbuildin_fonts.hxx |2 vcl/inc/qt5/QtFont.hxx |1 vcl/inc/quartz/salgdi.h|2 vcl/inc/unx/freetype_glyphcache.hxx|2 vcl/inc/unx/glyphcache.hxx |1 vcl/inc/win/winlayout.hxx |2 vcl/qa/cppunit/cjktext.cxx |2 vcl/qa/cppunit/fontmocks.hxx |3 + vcl/qa/cppunit/logicalfontinstance.cxx | 67 +++-- vcl/qt5/QtFont.cxx |7 ++ vcl/quartz/ctfonts.cxx | 21 +++ vcl/skia/gdiimpl.cxx | 15 ++--- vcl/skia/win/gdiimpl.cxx | 33 +++- vcl/skia/x11/textrender.cxx| 10 +-- vcl/source/font/LogicalFontInstance.cxx| 36 + vcl/source/font/fontcache.cxx |4 - vcl/source/gdi/CommonSalLayout.cxx |6 +- vcl/source/gdi/pdfbuildin_fonts.cxx|5 + vcl/source/gdi/pdfwriter_impl.cxx | 29 +- vcl/source/gdi/sallayout.cxx | 37 - vcl/source/outdev/font.cxx |6 +- vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 38 ++ vcl/unx/generic/glyphs/glyphcache.cxx |8 ++ vcl/win/gdi/salfont.cxx| 53 +++ vcl/win/gdi/winlayout.cxx | 14 - vcl/workben/listglyphs.cxx |2 29 files changed, 237 insertions(+), 188 deletions(-) New commits: commit 0aa53d7f7d4aa31cd79ed27dfd20be5b13dd0815 Author: Mike Kaganski AuthorDate: Tue Apr 9 20:55:21 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Apr 9 20:55:21 2024 +0500 Revert "Optimize trigonometry a bit" This reverts commit dc7d9bfbfb7b46d9ac2e3bb72669da1130259f93. diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 84b625115648..7a240600be98 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -2099,8 +2099,8 @@ bool SkiaSalGraphicsImpl::implDrawGradient(const basegfx::B2DPolyPolygon& rPolyP } static double toRadian(Degree10 degree10th) { return toRadians(3600_deg10 - degree10th); } -static auto toCos(Degree10 degree10th) { return SkScalarCos(toRadian(degree10th)); } -static auto toSin(Degree10 degree10th) { return SkScalarSin(toRadian(degree10th)); } +static double toCos(Degree10 degree10th) { return SkScalarCos(toRadian(degree10th)); } +static double toSin(Degree10 degree10th) { return SkScalarSin(toRadian(degree10th)); } void SkiaSalGraphicsImpl::drawGenericLayout(const GenericSalLayout& layout, Color textColor, const SkFont& font, const SkFont& verticalFont) @@ -2115,16 +2115,15 @@ void SkiaSalGraphicsImpl::drawGenericLayout(const GenericSalLayout& layout, Colo DevicePoint aPos; const GlyphItem* pGlyph; int nStart = 0; -auto cos = toCos(layout.GetOrientation()); -auto sin = toSin(layout.GetOrientation()); while (layout.GetNextGlyph(, aPos, nStart)) { glyphIds.push_back(pGlyph->glyphId()); -verticals.emplace_back(pGlyph->IsVertical()); -auto cos1 = pGlyph->IsVertical() ? sin : cos; // cos (x - 90) = sin (x) -auto sin1 = pGlyph->IsVertical() ? -cos : sin; // sin (x - 90) = -cos (x) -SkRSXform form = SkRSXform::Make(cos1, sin1, aPos.getX(), aPos.getY()); +Degree10 angle = layout.GetOrientation(); +if (pGlyph->IsVertical()) +angle += 900_deg10; +SkRSXform form = SkRSXform::Make(toCos(angle), toSin(angle), aPos.getX(), aPos.getY()); glyphForms.emplace_back(std::move(form)); +verticals.emplace_back(pGlyph->IsVertical()); } if (glyphIds.empty()) return; commit b05c43c694435cc4a27c7bfcf103c1d3d8cfcc31 Author: Mike Kaganski AuthorDate: Tue Apr 9 20:55:21 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Apr 9 20:55:21 2024 +0500 Revert "Simplify a bit" This reverts commit 401ed53c66085d2442c361c43fe0180e115d6b11. diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index 04dad0123573..d063b440cf31 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -216,22 +216,20 @@ catch (const sal::systools::ComError& e) bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout) { assert(dynamic_cast(())); -const SkiaWinFontInstance& rWinFont -= static_cast(rLayout.GetFont()); -const vcl::font::FontSelectPattern& rFSD = rWinFont.GetFontSelectPattern(); -if (rFSD.mnHeight == 0) -re
core.git: 2 commits - svgio/inc svgio/qa svgio/source
svgio/inc/SvgNumber.hxx |4 +-- svgio/inc/svgnode.hxx |3 -- svgio/inc/svgtspannode.hxx|2 - svgio/qa/cppunit/SvgImportTest.cxx| 34 ++ svgio/qa/cppunit/SvgNumberTest.cxx|2 - svgio/qa/cppunit/data/dy_in_ems.svg |7 + svgio/qa/cppunit/data/dy_in_exs.svg |7 + svgio/source/svgreader/SvgNumber.cxx |3 +- svgio/source/svgreader/svgnode.cxx| 17 +++-- svgio/source/svgreader/svgstyleattributes.cxx |8 +++--- svgio/source/svgreader/svgtspannode.cxx |5 --- 11 files changed, 62 insertions(+), 30 deletions(-) New commits: commit 86a8a3a43b642fc13bae6a89720496285f8f73d7 Author: Mike Kaganski AuthorDate: Tue Apr 9 13:56:13 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 18 18:21:15 2024 +0200 tdf#160594: Use the recommended fallback of 0.5em for ex in font-size This fixes the error of identical treatment of em and ex in font-size, which violated https://drafts.csswg.org/css-values-4/#font-relative-length. The fix uses the fallback of 0.5em for ex, similar to the code used in SvgNumber::solveNonPercentage. A follow-up should implement the correct use of "x-height of the first available font". Change-Id: Id9d581994e158d629d9752299ad93ac7e9fe4cad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166234 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index d06a50f0e98b..dd53d4e28a19 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1677,6 +1677,22 @@ CPPUNIT_TEST_FIXTURE(Test, testDyInEms) assertXPath(pDocument, "//textsimpleportion[2]"_ostr, "y"_ostr, u"32"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testExs) +{ +// tdf#160594 given an SVG file with : +xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/dy_in_exs.svg"); + +assertXPath(pDocument, "//textsimpleportion"_ostr, 2); +assertXPath(pDocument, "//textsimpleportion[1]"_ostr, "height"_ostr, u"16"_ustr); + +sal_Int32 nSize = getXPath(pDocument, "//textsimpleportion[2]"_ostr, "height"_ostr).toInt32(); +// Without the accompanying fix in place, this test would have failed with: +// - Expected less than: 16 +// - Actual : 16 +// i.e. the parent font-size was used, instead of its x-size. +CPPUNIT_ASSERT_LESS(sal_Int32(16), nSize); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svgio/qa/cppunit/data/dy_in_exs.svg b/svgio/qa/cppunit/data/dy_in_exs.svg new file mode 100644 index ..816a64a4586c --- /dev/null +++ b/svgio/qa/cppunit/data/dy_in_exs.svg @@ -0,0 +1,7 @@ + + +http://www.w3.org/2000/svg; width="1in" height="1in" viewBox="0 0 100% 100%"> + + foo + bar + \ No newline at end of file diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 63be6afe270c..763a7a3cdd96 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -2642,11 +2642,11 @@ namespace svgio::svgreader if(pSvgStyleAttributes) { const SvgNumber aParentNumber = pSvgStyleAttributes->getFontSizeNumber(); +double n = aParentNumber.getNumber() * maFontSizeNumber.getNumber(); +if (SvgUnit::ex == maFontSizeNumber.getUnit()) +n *= 0.5; // FIXME: use "x-height of the first available font" -return SvgNumber( -aParentNumber.getNumber() * maFontSizeNumber.getNumber(), -aParentNumber.getUnit(), -true); + return SvgNumber(n, aParentNumber.getUnit()); } } commit e27572686130df43d1d65c574b0c34f39fc0d1a9 Author: Mike Kaganski AuthorDate: Tue Apr 9 13:03:07 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 18 18:21:09 2024 +0200 tdf#160593: make sure to use current element's font size for em unit According to https://drafts.csswg.org/css-values-4/#font-relative-length em is "equal to the computed value of the font-size property of the element on which it is used". This means, that for an element that defines its own font-size, attributes like 'dy' using em refer to the new font-size, not to inherited font-size. Change-Id: Ie5a013df99a68edddf466e4c0ee5311f6219fcb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+
core.git: tools/source
tools/source/xml/XmlWriter.cxx | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) New commits: commit 3e38fdacba022a9d8001a0f856ef33b4d14857cb Author: Mike Kaganski AuthorDate: Mon Apr 15 08:19:25 2024 +0100 Commit: Mike Kaganski CommitDate: Thu Apr 18 08:18:21 2024 +0200 Optimize a bit, to avoid a copy of the vector Change-Id: I747662e346151e2e055cb803278c2a6c7709f273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166166 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx index 8bbd7951a3b8..afc6dd9b73be 100644 --- a/tools/source/xml/XmlWriter.cxx +++ b/tools/source/xml/XmlWriter.cxx @@ -29,6 +29,15 @@ int funcCloseCallback(void* pContext) return 0; // 0 or -1 in case of error } +template +requires(sizeof(T) == sizeof(char)) void attributeBase64_impl(xmlTextWriterPtr writer, + const char* name, const T* value, + int size) +{ +(void)xmlTextWriterStartAttribute(writer, BAD_CAST(name)); +(void)xmlTextWriterWriteBase64(writer, reinterpret_cast(value), 0, size); +(void)xmlTextWriterEndAttribute(writer); +} } // end anonymous namespace struct XmlWriterImpl @@ -103,16 +112,12 @@ void XmlWriter::endElement() { (void)xmlTextWriterEndElement(mpImpl->mpWriter); void XmlWriter::attributeBase64(const char* pName, std::vector const& rValueInBytes) { -std::vector aSignedBytes(rValueInBytes.begin(), rValueInBytes.end()); -attributeBase64(pName, aSignedBytes); +attributeBase64_impl(mpImpl->mpWriter, pName, rValueInBytes.data(), rValueInBytes.size()); } void XmlWriter::attributeBase64(const char* pName, std::vector const& rValueInBytes) { -xmlChar* xmlName = BAD_CAST(pName); -(void)xmlTextWriterStartAttribute(mpImpl->mpWriter, xmlName); -(void)xmlTextWriterWriteBase64(mpImpl->mpWriter, rValueInBytes.data(), 0, rValueInBytes.size()); -(void)xmlTextWriterEndAttribute(mpImpl->mpWriter); +attributeBase64_impl(mpImpl->mpWriter, pName, rValueInBytes.data(), rValueInBytes.size()); } void XmlWriter::attribute(const char* name, const OString& value)
core.git: include/tools tools/source
include/tools/XmlWriter.hxx|7 +-- tools/source/xml/XmlWriter.cxx | 13 - 2 files changed, 5 insertions(+), 15 deletions(-) New commits: commit 96f62b48b4425f0bc2b6d8497782694078d968fc Author: Mike Kaganski AuthorDate: Mon Apr 15 08:19:25 2024 +0100 Commit: Mike Kaganski CommitDate: Wed Apr 17 06:40:40 2024 +0200 Simplify a bit Change-Id: Iadfa442f762aa3caf3a8de7f3633be4e73bfd91a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166091 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/include/tools/XmlWriter.hxx b/include/tools/XmlWriter.hxx index 03cc151b2624..9c8f82a86f42 100644 --- a/include/tools/XmlWriter.hxx +++ b/include/tools/XmlWriter.hxx @@ -48,12 +48,15 @@ public: void endDocument(); void startElement(const char* sName); -void startElement(const OString& sName); +void startElement(const OString& sName) { startElement(sName.getStr()); } void startElement(const OString& sPrefix, const OString& sName, const OString& sNamespaceUri); void endElement(); void attribute(const char* sTagName, const OString& aValue); -void attribute(const OString& sTagName, const OString& aValue); +void attribute(const OString& sTagName, const OString& aValue) +{ +attribute(sTagName.getStr(), aValue); +} void attribute(const char* sTagName, std::u16string_view aValue); void attribute(const char* sTagName, sal_Int64 aNumber); template diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx index f49c312bd133..8bbd7951a3b8 100644 --- a/tools/source/xml/XmlWriter.cxx +++ b/tools/source/xml/XmlWriter.cxx @@ -99,12 +99,6 @@ void XmlWriter::startElement(const char* pName) (void)xmlTextWriterStartElement(mpImpl->mpWriter, xmlName); } -void XmlWriter::startElement(const OString& rName) -{ -xmlChar* xmlName = BAD_CAST(rName.getStr()); -(void)xmlTextWriterStartElement(mpImpl->mpWriter, xmlName); -} - void XmlWriter::endElement() { (void)xmlTextWriterEndElement(mpImpl->mpWriter); } void XmlWriter::attributeBase64(const char* pName, std::vector const& rValueInBytes) @@ -128,13 +122,6 @@ void XmlWriter::attribute(const char* name, const OString& value) (void)xmlTextWriterWriteAttribute(mpImpl->mpWriter, xmlName, xmlValue); } -void XmlWriter::attribute(const OString& name, const OString& value) -{ -xmlChar* xmlName = BAD_CAST(name.getStr()); -xmlChar* xmlValue = BAD_CAST(value.getStr()); -(void)xmlTextWriterWriteAttribute(mpImpl->mpWriter, xmlName, xmlValue); -} - void XmlWriter::attribute(const char* name, std::u16string_view value) { attribute(name, OUStringToOString(value, RTL_TEXTENCODING_UTF8));
core.git: cui/source filter/source include/basegfx include/svx include/tools include/vcl sc/source sd/source sfx2/source slideshow/source svx/source sw/source tools/CppunitTest_tools_test.mk tools/qa
Author: Mike Kaganski AuthorDate: Tue Apr 16 23:10:45 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Apr 17 03:56:59 2024 +0200 Drop FRound, and use generalized basegfx::fround Change-Id: I7447e649dc3ef4e51242f69c7486a3e84e103d2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166159 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx index c29bc4947e00..69896cd53c0d 100644 --- a/cui/source/dialogs/cuigrfflt.cxx +++ b/cui/source/dialogs/cuigrfflt.cxx @@ -192,8 +192,8 @@ Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic, Graphic aRet; tools::LongnTileWidth = static_cast(mxMtrWidth->get_value(FieldUnit::PIXEL)); tools::LongnTileHeight = static_cast(mxMtrHeight->get_value(FieldUnit::PIXEL)); -const Size aSize( std::max( FRound( nTileWidth * fScaleX ), tools::Long(1) ), - std::max( FRound( nTileHeight * fScaleY ), tools::Long(1) ) ); +const Size aSize( std::max( basegfx::fround( nTileWidth * fScaleX ), tools::Long(1) ), + std::max( basegfx::fround( nTileHeight * fScaleY ), tools::Long(1) ) ); if( rGraphic.IsAnimated() ) { @@ -270,7 +270,7 @@ GraphicFilterSolarize::GraphicFilterSolarize(weld::Window* pParent, const Graphi , mxMtrThreshold(m_xBuilder->weld_metric_spin_button("value", FieldUnit::PERCENT)) , mxCbxInvert(m_xBuilder->weld_check_button("invert")) { -mxMtrThreshold->set_value(FRound(cGreyThreshold / 2.55), FieldUnit::PERCENT); +mxMtrThreshold->set_value(basegfx::fround(cGreyThreshold / 2.55), FieldUnit::PERCENT); mxMtrThreshold->connect_value_changed(LINK(this, GraphicFilterSolarize, EditModifyHdl)); mxCbxInvert->set_active(bInvert); @@ -290,7 +290,7 @@ IMPL_LINK_NOARG(GraphicFilterSolarize, EditModifyHdl, weld::MetricSpinButton&, v Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic, double, double ) { Graphic aRet; -sal_uInt8 nGreyThreshold = static_cast(FRound(mxMtrThreshold->get_value(FieldUnit::PERCENT) * 2.55)); +sal_uInt8 nGreyThreshold = basegfx::fround(mxMtrThreshold->get_value(FieldUnit::PERCENT) * 2.55); if( rGraphic.IsAnimated() ) { diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index adfdda948f76..5d6fa5a2c854 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -2187,7 +2187,7 @@ void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape ) for( size_t k = 0; k < rShape.maDashArray.size(); ++k ) { -const sal_Int32 nDash = ImplMap( FRound( rShape.maDashArray[ k ] ) ); +const sal_Int32 nDash = ImplMap(basegfx::fround(rShape.maDashArray[k])); if( k ) aDashArrayStr.append(","); @@ -2535,8 +2535,8 @@ void SVGActionWriter::ImplWriteMask(GDIMetaFile& rMtf, const Point& rDestPt, con if (fScaleX != 1.0 || fScaleY != 1.0) { rMtf.Scale(fScaleX, fScaleY); -aSrcPt.setX(FRound(aSrcPt.X() * fScaleX)); -aSrcPt.setY(FRound(aSrcPt.Y() * fScaleY)); +aSrcPt.setX(basegfx::fround(aSrcPt.X() * fScaleX)); +aSrcPt.setY(basegfx::fround(aSrcPt.Y() * fScaleY)); } nMoveX = rDestPt.X() - aSrcPt.X(); @@ -2736,7 +2736,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, const double fFactor = static_cast(nWidth) / aNormSize.Width(); for( i = 0; i < ( nLen - 1 ); i++ ) -aTmpArray.set(i, FRound(aTmpArray[i] * fFactor)); +aTmpArray.set(i, basegfx::fround(aTmpArray[i] * fFactor)); } else { @@ -2800,11 +2800,11 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText, return; tools::Polygon aPoly( 4 ); -const tools::Long nLineHeight = std::max( FRound( aMetric.GetLineHeight() * 0.05 ), 1 ); +const tools::Long nLineHeight = std::max( basegfx::fround( aMetric.GetLineHeight() * 0.05 ), 1 ); if( rFont.GetStrikeout() ) { -const tools::Long nYLinePos = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 ); +const tools::Long nYLinePos = aBaseLinePos.Y() - basegfx::fround( aMetric.GetAscent() * 0.26 ); aPoly[ 0 ].setX( aBaseLinePos.X() ); aPoly[ 0 ].setY( nYLinePos - ( nLineHeight >> 1 ) ); aPoly[ 1 ].setX( aBaseLinePos.X() + aNormSize.Width() - 1 ); aPoly[ 1 ].setY( aPoly[ 0 ].Y() ); @@ -3312,8 +3312,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, // i.e. invisible line, because it makes it visible,
core.git: basegfx/source canvas/source chart2/source cppcanvas/source cui/source drawinglayer/source editeng/source emfio/source filter/source include/basegfx include/svx oox/source sc/source sd/qa sd
basegfx/source/curve/b2dcubicbezier.cxx | 24 +++ canvas/source/directx/dx_textlayout_drawhelper.cxx |4 - canvas/source/opengl/ogl_canvashelper.cxx|2 canvas/source/tools/surface.cxx |9 -- canvas/source/vcl/canvasfont.cxx |2 canvas/source/vcl/canvashelper.cxx |4 - canvas/source/vcl/canvashelper_texturefill.cxx | 36 +-- canvas/source/vcl/impltools.cxx |8 +- chart2/source/controller/main/SelectionHelper.cxx|2 cppcanvas/source/mtfrenderer/transparencygroupaction.cxx |4 - cui/source/tabpages/transfrm.cxx |4 - drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx |2 drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx |6 + drawinglayer/source/processor2d/helperwrongspellrenderer.cxx |6 + drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 32 + drawinglayer/source/processor2d/vclprocessor2d.cxx | 19 +++-- drawinglayer/source/tools/converters.cxx |2 editeng/source/editeng/impedit3.cxx |6 - editeng/source/editeng/impedit4.cxx |3 editeng/source/outliner/outliner.cxx |4 - emfio/source/reader/mtftools.cxx |6 - filter/source/msfilter/escherex.cxx |2 filter/source/msfilter/eschesdo.cxx |4 - filter/source/svg/svgfilter.cxx |2 include/basegfx/numeric/ftools.hxx | 16 include/svx/transfrmhelper.hxx |8 +- oox/source/export/drawingml.cxx |2 sc/source/core/data/drwlayer.cxx |4 - sc/source/ui/miscdlgs/autofmt.cxx|8 +- sc/source/ui/view/drawview.cxx |4 - sd/qa/unit/layout-tests.cxx |6 - sd/source/core/sdpage.cxx| 16 ++-- slideshow/source/engine/eventmultiplexer.cxx |8 +- slideshow/source/engine/slideview.cxx|4 - svx/source/customshapes/EnhancedCustomShape3d.cxx|2 svx/source/dialog/frmsel.cxx | 12 +-- svx/source/engine3d/obj3d.cxx|2 svx/source/engine3d/view3d.cxx |6 - svx/source/svdraw/svdcrtv.cxx|4 - svx/source/svdraw/svddrgmt.cxx | 16 ++-- svx/source/svdraw/svddrgv.cxx| 16 ++-- svx/source/svdraw/svdedxv.cxx|8 +- svx/source/svdraw/svdfmtf.cxx|8 +- svx/source/svdraw/svdmrkv.cxx| 12 +-- svx/source/svdraw/svdoedge.cxx | 16 ++-- svx/source/svdraw/svdograf.cxx | 16 ++-- svx/source/svdraw/svdomeas.cxx |6 - svx/source/svdraw/svdpdf.cxx |8 +- svx/source/unodraw/UnoGraphicExporter.cxx|8 +- svx/source/unodraw/unoshape.cxx |8 +- sw/source/core/draw/dflyobj.cxx | 32 - sw/source/core/layout/wsfrm.cxx | 28 sw/source/ui/table/autoformatpreview.cxx | 15 ++-- vcl/source/bitmap/BitmapEx.cxx |2 vcl/source/bitmap/BitmapTools.cxx| 16 ++-- vcl/source/gdi/gdimetafiletools.cxx |8 +- vcl/source/gdi/impgraph.cxx |6 - vcl/source/gdi/region.cxx|4 - vcl/source/gdi/regionband.cxx|4 - vcl/source/graphic/GraphicObject.cxx |8 +- vcl/source/outdev/bitmapex.cxx | 18 ++--- vcl/source/outdev/text.cxx |2 vcl/source/window/printdlg.cxx |4 - vcl/win/gdi/gdiimpl.cxx |4 - 64 files changed, 297 insertions(+), 271 deletions(-) New commits: commit 690526f95e3ee4fd25bb2c987e093543e4bc435b Author: Mike Kaganski AuthorDate: Sun Apr 14 12:50:42 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 15 06:34:33 2024 +0200 Generalize basegfx::fround for templated return type And use it when assigning to tools::Long Change
core.git: emfio/qa include/tools svgio/qa svx/qa tools/source
emfio/qa/cppunit/emf/EmfImportTest.cxx | 34 - include/tools/XmlWriter.hxx| 13 +++- svgio/qa/cppunit/SvgImportTest.cxx | 28 +-- svx/qa/unit/sdr.cxx| 22 ++--- svx/qa/unit/svdraw.cxx |4 +-- tools/source/xml/XmlWriter.cxx |2 - 6 files changed, 57 insertions(+), 46 deletions(-) New commits: commit 1f1f4232001fa23ec1a1bf67d605fda9df542eec Author: Mike Kaganski AuthorDate: Sun Apr 14 11:25:21 2024 +0100 Commit: Mike Kaganski CommitDate: Sun Apr 14 15:13:10 2024 +0200 Round in XmlWriter::attribute when passing a double Before, it truncated. Rounding provides a closer value. Change-Id: I213e6ae34ada2f5081cb2c8b2ef431448c712b37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165947 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index da1ead889431..a00351178065 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -126,12 +126,12 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawImagePointsTypeBitmap) CPPUNIT_ASSERT(pDocument); assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", "color"_ostr, "#0080ff"); -assertXPath(pDocument, aXPathPrefix + "bitmap", "xy11"_ostr, "5346"); +assertXPath(pDocument, aXPathPrefix + "bitmap", "xy11"_ostr, "5347"); assertXPath(pDocument, aXPathPrefix + "bitmap", "xy12"_ostr, "0"); assertXPath(pDocument, aXPathPrefix + "bitmap", "xy13"_ostr, "5558"); assertXPath(pDocument, aXPathPrefix + "bitmap", "xy21"_ostr, "0"); -assertXPath(pDocument, aXPathPrefix + "bitmap", "xy22"_ostr, "4716"); -assertXPath(pDocument, aXPathPrefix + "bitmap", "xy23"_ostr, "5564"); +assertXPath(pDocument, aXPathPrefix + "bitmap", "xy22"_ostr, "4717"); +assertXPath(pDocument, aXPathPrefix + "bitmap", "xy23"_ostr, "5565"); assertXPath( pDocument, aXPathPrefix + "bitmap/data[2]", "row"_ostr, "020202,ff,ff,ff,fefefe,ff,ff,fefefe,ff,ff,f8f8f8,ff," @@ -159,7 +159,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawString) // check correct import of the DrawString: height, position, text, color and font assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "height"_ostr, "120"); assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "x"_ostr, "817"); -assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "y"_ostr, "1137"); +assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "y"_ostr, "1138"); assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "text"_ostr, "TEST"); assertXPath(pDocument, aXPathPrefix + "transform/textsimpleportion", "fontcolor"_ostr, "#00"); @@ -197,7 +197,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawStringAlign) "12"); assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "height"_ostr, "12"); -assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "x"_ostr, "143"); +assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "x"_ostr, "144"); assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "y"_ostr, "22"); assertXPath(pDocument, aXPathPrefix + "mask/transform[2]/textsimpleportion", "text"_ostr, "HCVT"); @@ -218,7 +218,7 @@ CPPUNIT_TEST_FIXTURE(Test, testDrawStringAlign) assertXPath(pDocument, aXPathPrefix + "mask/transform[4]/textsimpleportion", "text"_ostr, "HLVC"); -assertXPath(pDocument, aXPathPrefix + "mask/transform[5]/textsimpleportion", "x"_ostr, "142"); +assertXPath(pDocument, aXPathPrefix + "mask/transform[5]/textsimpleportion", "x"_ostr, "143"); assertXPath(pDocument, aXPathPrefix + "mask/transform[5]/textsimpleportion", "y"_ostr, "66"); assertXPath(pDocument, aXPathPrefix + "mask/transform[5]/textsimpleportion", "text
core.git: sfx2/source
sfx2/source/appl/appmisc.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 707f59019a5edafb4278a5591f8f6578041f1a3c Author: Mike Kaganski AuthorDate: Sat Apr 13 23:38:03 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 14 08:58:56 2024 +0200 Use more o3tl::convert Change-Id: I2a4f109b8c1031d0330f249b7666ae65f9fae7ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166062 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 01b278b16506..cb793022a62f 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -170,7 +170,7 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx , int nWid // cancel out rasterize's mm2pixel conversion // see fFactor100th_mmToInch in // drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx -const double fFakeDPI=2.54 * 1000.0; +constexpr double fFakeDPI = o3tl::convert(1.0, o3tl::Length::in, o3tl::Length::mm100); geometry::RealRectangle2D aRealRect( 0, 0,
core.git: sw/source
sw/source/filter/html/css1atr.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 84580785ba7081939296a0ae2da076e067612d4f Author: Mike Kaganski AuthorDate: Sat Apr 13 23:37:38 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 14 08:58:39 2024 +0200 Use more o3tl::convert Change-Id: I922502c80d79b8432a46e97178bc87f43847f996 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166061 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 48badab293dd..0cbf5b36da86 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -118,7 +118,7 @@ namespace o3tl { template<> struct typed_flags : is_typed_flags {}; } -#define DOT_LEADERS_MAX_WIDTH 18 +constexpr int DOT_LEADERS_MAX_WIDTH = 18; // cm static SwHTMLWriter& OutCSS1_SwFormat( SwHTMLWriter& rWrt, const SwFormat& rFormat, IDocumentStylePoolAccess /*SwDoc*/ *pDoc, SwDoc *pTemplate ); @@ -2822,7 +2822,7 @@ static SwHTMLWriter& OutCSS1_SvxTextLeftMargin(SwHTMLWriter & rWrt, SfxPoolItem // max-width = max-width - margin-left for TOC paragraphs with dot leaders if (rWrt.m_bParaDotLeaders) -rWrt.OutCSS1_UnitProperty(sCSS1_P_max_width, tools::Long(DOT_LEADERS_MAX_WIDTH/2.54*72*20) - nLeftMargin); +rWrt.OutCSS1_UnitProperty(sCSS1_P_max_width, o3tl::convert(DOT_LEADERS_MAX_WIDTH, o3tl::Length::cm, o3tl::Length::twip) - nLeftMargin); } @@ -2859,7 +2859,7 @@ static SwHTMLWriter& OutCSS1_SvxLRSpace( SwHTMLWriter& rWrt, const SfxPoolItem& // max-width = max-width - margin-left for TOC paragraphs with dot leaders if( rWrt.m_bParaDotLeaders ) -rWrt.OutCSS1_UnitProperty( sCSS1_P_max_width, tools::Long(DOT_LEADERS_MAX_WIDTH/2.54*72*20) - nLeftMargin ); +rWrt.OutCSS1_UnitProperty( sCSS1_P_max_width, o3tl::convert(DOT_LEADERS_MAX_WIDTH, o3tl::Length::cm, o3tl::Length::twip) - nLeftMargin ); }
core.git: lotuswordpro/inc lotuswordpro/source
lotuswordpro/inc/lwpoverride.hxx |6 lotuswordpro/inc/lwptools.hxx | 35 +--- lotuswordpro/source/filter/lwpborderstuff.cxx |8 - lotuswordpro/source/filter/lwpbulletstylemgr.cxx |4 lotuswordpro/source/filter/lwpdrawobj.cxx | 144 +- lotuswordpro/source/filter/lwpframelayout.cxx | 13 - lotuswordpro/source/filter/lwpgrfobj.cxx | 20 +- lotuswordpro/source/filter/lwplayout.cxx |6 lotuswordpro/source/filter/lwplaypiece.hxx|2 lotuswordpro/source/filter/lwplnopts.cxx |2 lotuswordpro/source/filter/lwpmargins.hxx |8 - lotuswordpro/source/filter/lwpoleobject.cxx |8 - lotuswordpro/source/filter/lwppagelayout.cxx |8 - lotuswordpro/source/filter/lwpparastyle.cxx | 18 +- lotuswordpro/source/filter/lwprowlayout.cxx |4 lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx | 32 ++-- lotuswordpro/source/filter/lwpshadow.hxx |4 lotuswordpro/source/filter/lwptable.hxx |4 lotuswordpro/source/filter/lwptablelayout.cxx |4 lotuswordpro/source/filter/lwptablelayout.hxx |2 lotuswordpro/source/filter/lwpverdocument.cxx |2 21 files changed, 166 insertions(+), 168 deletions(-) New commits: commit fce1fb034d282dc6e0434bf16c49d5f602d813bd Author: Mike Kaganski AuthorDate: Sat Apr 13 21:57:01 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 14 06:57:06 2024 +0200 Use more o3tl::convert in lotuswordpro Change-Id: I7ec74dc105f846307f5bf3d3c8cedcc4aebb64a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166058 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/lotuswordpro/inc/lwpoverride.hxx b/lotuswordpro/inc/lwpoverride.hxx index 036492e518d1..688ef9747e65 100644 --- a/lotuswordpro/inc/lwpoverride.hxx +++ b/lotuswordpro/inc/lwpoverride.hxx @@ -438,18 +438,18 @@ inline double LwpIndentOverride::GetFirst() const sal_Int32 nRes; if (o3tl::checked_sub(m_nFirst, m_nRest, nRes)) throw std::range_error("bad len"); -return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(nRes)); +return LwpTools::ConvertFromUnits(nRes); } inline double LwpIndentOverride::GetLeft() const { sal_Int32 nRes; if (o3tl::checked_add(m_nAll, m_nRest, nRes)) throw std::range_error("bad len"); -return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(nRes)); +return LwpTools::ConvertFromUnits(nRes); } inline double LwpIndentOverride::GetRight() const { -return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nRight)); +return LwpTools::ConvertFromUnits(m_nRight); } class LwpBackgroundStuff; diff --git a/lotuswordpro/inc/lwptools.hxx b/lotuswordpro/inc/lwptools.hxx index 753a9bacdd06..398abb2ea578 100644 --- a/lotuswordpro/inc/lwptools.hxx +++ b/lotuswordpro/inc/lwptools.hxx @@ -67,19 +67,11 @@ #include "localtime.hxx" #include "xfilter/xfdatestyle.hxx" #include "xfilter/xftimestyle.hxx" +#include #include #include #include -// 01/19/2005 -const sal_uInt32 UNITS_PER_INCH = 65536L * 72L; -const double CM_PER_INCH = 2.54; -//end - -const double POINTS_PER_INCH = 72.27; -const double TWIPS_PER_POINT = 20.0; -const double TWIPS_PER_INCH = TWIPS_PER_POINT * POINTS_PER_INCH; -const double TWIPS_PER_CM = TWIPS_PER_INCH/CM_PER_INCH; /** * @brief tool class (unicode, conversion) for lwp filter. */ @@ -91,9 +83,8 @@ public: OUString& str, sal_uInt16 strlen, rtl_TextEncoding aEncoding ); static bool IsUnicodePacked(LwpObjectStream* pObjStrm, sal_uInt16 len); -inline static double ConvertFromUnits(sal_Int32 nUnits); -inline static double ConvertToMetric(double fInch); -inline static double ConvertFromUnitsToMetric(sal_Int32 nUnits); +inline static double ConvertFromUnits(double nUnits); // to cm +inline static double ConvertFromTwips(double nTwips); // to cm inline static bool IsOddNumber(sal_uInt16 nNumber); inline static bool IsEvenNumber(sal_uInt16 nNumber); @@ -106,18 +97,20 @@ public: static std::unique_ptr GetSystemTimeStyle(); }; -inline double LwpTools::ConvertFromUnits(sal_Int32 nUnits) -{ -return static_cast(nUnits)/UNITS_PER_INCH; -} -inline double LwpTools::ConvertToMetric(double fInch) +// Convert from "units" to centimeters +inline double LwpTools::ConvertFromUnits(double nUnits) { -return fInch*CM_PER_INCH; +constexpr sal_uInt32 UNITS_PER_INCH = 65536 * 72; +constexpr auto mdFromIn = o3tl::getConversionMulDiv(o3tl::Length::in, o3tl::Length::cm); +constexpr o3tl::detail::m_and_d md(mdFromIn.first, mdFromIn.second * UNITS_PER_INCH); +return o3tl::convert(nUnits, md.m, md.d); } -inline double LwpTools::ConvertFromUnitsToMetri
core.git: i18nutil/source
i18nutil/source/utility/paper.cxx | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) New commits: commit ec40e3edd31319fb6cb919a38f44c861880efc5f Author: Mike Kaganski AuthorDate: Sat Apr 13 23:36:53 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 14 06:54:24 2024 +0200 Use more o3tl::convert Change-Id: I281ff1be4663d752a4e1a7e4d38556cefb641bd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166060 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx index c5150c384b60..8dea028ae445 100644 --- a/i18nutil/source/utility/paper.cxx +++ b/i18nutil/source/utility/paper.cxx @@ -17,7 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include #include #include @@ -49,17 +51,11 @@ struct PageDesc const char *m_pAltPSName; }; +constexpr tools::Long PT2MM100(double v) { return o3tl::convert(v, o3tl::Length::pt, o3tl::Length::mm100) + 0.5; } +constexpr tools::Long IN2MM100(double v) { return o3tl::convert(v, o3tl::Length::in, o3tl::Length::mm100) + 0.5; } +constexpr tools::Long MM2MM100(double v) { return o3tl::convert(v, o3tl::Length::mm, o3tl::Length::mm100) + 0.5; } } -#define PT2MM100( v ) \ -tools::Long(((v) * 35.2778) + 0.5) - -#define IN2MM100( v ) \ -(tools::Long(((v) * 2540) + 0.5)) - -#define MM2MM100( v ) \ -(tools::Long((v) * 100)) - //PostScript Printer Description File Format Specification //http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf //https://web.archive.org/web/20040912070512/http://www.y-adagio.com/public/committees/docsii/doc_00-49/symp_ulaan/china_ppr.pdf (Kai) @@ -68,7 +64,7 @@ struct PageDesc //!! The order of these entries must correspond to enum Paper in // see XclPaperSize pPaperSizeTable in calc and ApiPaperSize in filter -const PageDesc aDinTab[] = +constexpr PageDesc aDinTab[] = { { MM2MM100( 841 ), MM2MM100( 1189 ), "A0", nullptr }, { MM2MM100( 594 ), MM2MM100( 841 ),"A1", nullptr },
core.git: vcl/source
vcl/source/outdev/textline.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit a8931211b623cb38b7f703cf9a994ac66162f03a Author: Mike Kaganski AuthorDate: Sat Apr 13 23:36:22 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 14 06:53:58 2024 +0200 Use more o3tl::convert Change-Id: I8a3c5d0e1a29219ab27bde75809ca9d8dce7e093 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166059 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index 0dfd98d602f1..51937edc48ff 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -494,8 +494,8 @@ void OutputDevice::ImplDrawStraightTextLine( tools::Long nBaseX, tools::Long nBa nDashWidth = 100; nSpaceWidth = 50; } -nDashWidth = ((nDashWidth*mnDPIX)+1270)/2540; -nSpaceWidth = ((nSpaceWidth*mnDPIX)+1270)/2540; +nDashWidth = o3tl::convert(nDashWidth * mnDPIX, o3tl::Length::mm100, o3tl::Length::in); +nSpaceWidth = o3tl::convert(nSpaceWidth * mnDPIX, o3tl::Length::mm100, o3tl::Length::in); // DashWidth will be increased if the line is getting too thick // in proportion to the line's length if ( nDashWidth < nMinDashWidth ) @@ -521,7 +521,7 @@ void OutputDevice::ImplDrawStraightTextLine( tools::Long nBaseX, tools::Long nBa nDotWidth += mnDPIY/2; nDotWidth /= mnDPIY; -tools::Long nDashWidth = ((100*mnDPIX)+1270)/2540; +tools::Long nDashWidth = o3tl::convert(100 * mnDPIX, o3tl::Length::mm100, o3tl::Length::in); tools::Long nMinDashWidth = nDotWidth*4; // DashWidth will be increased if the line is getting too thick // in proportion to the line's length @@ -556,7 +556,7 @@ void OutputDevice::ImplDrawStraightTextLine( tools::Long nBaseX, tools::Long nBa nDotWidth += mnDPIY/2; nDotWidth /= mnDPIY; -tools::Long nDashWidth = ((100*mnDPIX)+1270)/2540; +tools::Long nDashWidth = o3tl::convert(100 * mnDPIX, o3tl::Length::mm100, o3tl::Length::in); tools::Long nMinDashWidth = nDotWidth*4; // DashWidth will be increased if the line is getting too thick // in proportion to the line's length
core.git: sc/source
sc/source/filter/orcus/interface.cxx |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) New commits: commit 0a687d1eeffcb21b947b181ceb2424680d1cce46 Author: Mike Kaganski AuthorDate: Sat Apr 13 23:39:24 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 14 06:52:28 2024 +0200 Use more o3tl::convert Change-Id: I5a6a1c05083fbaef71e94799a61c6f918a5134f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166064 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index af425079708d..1f5ac13f358a 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -750,13 +751,15 @@ double translateToInternal(double nVal, orcus::length_unit_t unit) switch(unit) { case orcus::length_unit_t::inch: -return nVal * 72.0 * 20.0; +return o3tl::convert(nVal, o3tl::Length::in, o3tl::Length::twip); case orcus::length_unit_t::twip: return nVal; case orcus::length_unit_t::point: -return nVal * 20.0; +return o3tl::convert(nVal, o3tl::Length::pt, o3tl::Length::twip); case orcus::length_unit_t::centimeter: -return nVal * 20.0 * 72.0 / 2.54; +return o3tl::convert(nVal, o3tl::Length::cm, o3tl::Length::twip); +case orcus::length_unit_t::millimeter: +return o3tl::convert(nVal, o3tl::Length::mm, o3tl::Length::twip); case orcus::length_unit_t::unknown: if (nVal != 0) SAL_WARN("sc.orcus", "unknown unit");
core.git: sd/source
sd/source/filter/eppt/epptso.cxx |2 +- sd/source/filter/eppt/pptx-stylesheet.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit b21978ba644f85ca259b7d58193c6caf03291105 Author: Mike Kaganski AuthorDate: Sat Apr 13 23:39:01 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 14 06:51:49 2024 +0200 Use more o3tl::convert Change-Id: I56d6909dc3b1a7d45e4e3f45583321b1338838cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166063 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 97a0f170edf0..b8d7f8fdf6e3 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -662,7 +662,7 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj ) } else { -if ( !pPara->mbFixedLineSpacing && rPortion.mnCharHeight > static_cast( static_cast(-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point +if ( !pPara->mbFixedLineSpacing && rPortion.mnCharHeight > o3tl::make_unsigned( o3tl::convert(-nLineSpacing, o3tl::Length::mm100, o3tl::Length::pt) ) ) nLineSpacing = nNormalSpacing; else nLineSpacing = static_cast( convertMm100ToMasterUnit(nLineSpacing) ); diff --git a/sd/source/filter/eppt/pptx-stylesheet.cxx b/sd/source/filter/eppt/pptx-stylesheet.cxx index 459020278fc9..fff1b5d06f2d 100644 --- a/sd/source/filter/eppt/pptx-stylesheet.cxx +++ b/sd/source/filter/eppt/pptx-stylesheet.cxx @@ -249,7 +249,7 @@ void PPTExParaSheet::SetStyleSheet( const css::uno::Reference< css::beans::XProp } else { -if ( rCharLevel.mnFontHeight > static_cast( static_cast(-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point +if ( rCharLevel.mnFontHeight > o3tl::make_unsigned(o3tl::convert(-nLineSpacing, o3tl::Length::mm100, o3tl::Length::pt) ) ) { const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont ); if ( pDesc )
core.git: drawinglayer/source emfio/qa hwpfilter/source
drawinglayer/source/tools/emfphelperdata.cxx | 34 +-- drawinglayer/source/tools/emfphelperdata.hxx | 10 ++- emfio/qa/cppunit/emf/EmfImportTest.cxx |2 - hwpfilter/source/drawing.h |1 4 files changed, 26 insertions(+), 21 deletions(-) New commits: commit 4695d84b78d04af6682961732ae92655e03f49eb Author: Mike Kaganski AuthorDate: Sat Apr 13 16:51:33 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 13 18:48:38 2024 +0200 Use more o3tl::convert Change-Id: Ia525e051b53dd6082f2f11ff884677c8b8c6a20c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166051 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 664902f9bc2d..1d95f0a8f38a 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -229,33 +229,33 @@ namespace emfplushelper { } -float EmfPlusHelperData::getUnitToPixelMultiplier(const UnitType aUnitType, const sal_uInt32 aDPI) +double EmfPlusHelperData::unitToPixel(double n, sal_uInt32 aUnitType, Direction d) { -switch (aUnitType) +switch (static_cast(aUnitType)) { case UnitTypePixel: -return 1.0f; +return n; case UnitTypePoint: -return aDPI / 72.0; +return o3tl::convert(n, o3tl::Length::pt, o3tl::Length::in) * DPI(d); case UnitTypeInch: -return aDPI; +return n * DPI(d); case UnitTypeMillimeter: -return aDPI / 25.4; +return o3tl::convert(n, o3tl::Length::mm, o3tl::Length::in) * DPI(d); case UnitTypeDocument: -return aDPI / 300.0; +return n * DPI(d) / 300.0; case UnitTypeWorld: case UnitTypeDisplay: SAL_WARN("drawinglayer.emf", "EMF+ Converting to World/Display."); -return 1.0f; +return n; default: SAL_WARN("drawinglayer.emf", "EMF+ TODO Unimplemented support of Unit Type: 0x" << std::hex << aUnitType); -return 1.0f; +return n; } } @@ -281,7 +281,7 @@ namespace emfplushelper EMFPPen *pen = new EMFPPen(); maEMFPObjects[index].reset(pen); pen->Read(rObjectStream, *this); -pen->penWidth = pen->penWidth * getUnitToPixelMultiplier(static_cast(pen->penUnit), mnHDPI); +pen->penWidth = unitToPixel(pen->penWidth, pen->penUnit, Direction::horizontal); break; } case EmfPlusObjectTypePath: @@ -325,7 +325,7 @@ namespace emfplushelper font->fontFlags = 0; font->Read(rObjectStream); // tdf#113624 Convert unit to Pixels -font->emSize = font->emSize * getUnitToPixelMultiplier(static_cast(font->sizeUnit), mnHDPI); +font->emSize = unitToPixel(font->emSize, font->sizeUnit, Direction::horizontal); break; } @@ -1755,8 +1755,8 @@ namespace emfplushelper } else { -mnMmX *= mfPageScale * getUnitToPixelMultiplier(static_cast(flags), mnHDPI); -mnMmY *= mfPageScale * getUnitToPixelMultiplier(static_cast(flags), mnVDPI); +mnMmX = std::round(unitToPixel(static_cast(mnMmX) * mfPageScale, flags, Direction::horizontal)); +mnMmY = std::round(unitToPixel(static_cast(mnMmY) * mfPageScale, flags, Direction::vertical)); mappingChanged(); } break; @@ -1853,12 +1853,12 @@ namespace emfplushelper SAL_WARN("drawinglayer.emf", "EMF+ file error. UnitTypeDisplay and UnitTypeWorld are not supported by BeginContainer in EMF+ specification."); break; } -const float aPageScaleX = getUnitToPixelMultiplier(static_cast(flags), mnHDPI); -const float aPageScaleY = getUnitToPixelMultiplier(static_cast(flags), mnVDPI); GraphicStatePush(mGSContainerStack, stackIndex); const basegfx::B2DHomMatrix transform = basegfx::utils::createScaleTranslateB2DHomMatrix( -aPageScaleX * ( dw / sw ), aPageScaleY * ( dh / sh ), -aPageScaleX * ( dx - sx ), aPageScaleY * ( dy - sy) ); +
core.git: 2 commits - sw/source vcl/source
sw/source/filter/html/parcss1.cxx | 94 ++ vcl/source/filter/eps/eps.cxx | 60 +++- 2 files changed, 44 insertions(+), 110 deletions(-) New commits: commit 64b5180534b6e87fe89467410bb33459d7179469 Author: Mike Kaganski AuthorDate: Sat Apr 13 16:50:36 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 13 18:48:31 2024 +0200 Simplify and use more o3tl::convert Change-Id: Ic7babea4eec3633d40d306488fea252d6f2636be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166050 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx index f3145f1fa5bd..a32de72ab52f 100644 --- a/sw/source/filter/html/parcss1.cxx +++ b/sw/source/filter/html/parcss1.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -379,87 +380,62 @@ CSS1Token CSS1Parser::GetNextToken() bool bEOFOld = m_bEOF; // parse the next identifier -OUString aIdent; OUStringBuffer sTmpBuffer2(64); do { -sTmpBuffer2.append( m_cNextCh ); + sTmpBuffer2.append(static_cast(rtl::toAsciiLowerCase(m_cNextCh))); m_cNextCh = GetNextChar(); } while( (rtl::isAsciiAlphanumeric(m_cNextCh) || '-' == m_cNextCh) && !IsEOF() ); -aIdent += sTmpBuffer2; +OUString aIdent = sTmpBuffer2.makeStringAndClear(); +nRet = CSS1_NUMBER; // Is it a unit? -const char *pCmp1 = nullptr, *pCmp2 = nullptr, *pCmp3 = nullptr; -double nScale1 = 1., nScale2 = 1.; -CSS1Token nToken1 = CSS1_LENGTH, - nToken2 = CSS1_LENGTH, - nToken3 = CSS1_LENGTH; switch( aIdent[0] ) { case 'c': -case 'C': -pCmp1 = "cm"; -nScale1 = (72.*20.)/2.54; // twip +if (aIdent == "cm") +{ +m_nValue = o3tl::convert(m_nValue, o3tl::Length::cm, o3tl::Length::twip); +nRet = CSS1_LENGTH; +} break; case 'e': -case 'E': -pCmp1 = "em"; -nToken1 = CSS1_EMS; - -pCmp2 = "ex"; -nToken2 = CSS1_EMX; +if (aIdent == "em") +nRet = CSS1_EMS; +else if (aIdent == "ex") +nRet = CSS1_EMX; break; case 'i': -case 'I': -pCmp1 = "in"; -nScale1 = 72.*20.; // twip +if (aIdent == "in") +{ +nRet = CSS1_LENGTH; +m_nValue = o3tl::convert(m_nValue, o3tl::Length::in, o3tl::Length::twip); +} break; case 'm': -case 'M': -pCmp1 = "mm"; -nScale1 = (72.*20.)/25.4; // twip +if (aIdent == "mm") +{ +nRet = CSS1_LENGTH; +m_nValue = o3tl::convert(m_nValue, o3tl::Length::mm, o3tl::Length::twip); +} break; case 'p': -case 'P': -pCmp1 = "pt"; -nScale1 = 20.; // twip - -pCmp2 = "pc"; -nScale2 = 12.*20.; // twip - -pCmp3 = "px"; -nToken3 = CSS1_PIXLENGTH; +if (aIdent == "pt") +{ +nRet = CSS1_LENGTH; +m_nValue = o3tl::convert(m_nValue, o3tl::Length::pt, o3tl::Length::twip); +} +else if (aIdent == "pc") +{
core.git: writerfilter/source
writerfilter/source/ooxml/OOXMLPropertySet.cxx | 37 - 1 file changed, 12 insertions(+), 25 deletions(-) New commits: commit fd19637cfd4099a96661a071939576bc7db4946a Author: Mike Kaganski AuthorDate: Sat Apr 13 16:47:37 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 13 15:23:36 2024 +0200 Simplify a bit, and use more o3tl::convert Change-Id: I30f619b81d831db9c1e212a1588d5696b9ad3dd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166048 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx b/writerfilter/source/ooxml/OOXMLPropertySet.cxx index 2c760519b69f..f29efe875aee 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx +++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx @@ -601,41 +601,28 @@ OOXMLUniversalMeasureValue::OOXMLUniversalMeasureValue(std::string_view pValue, { double val = o3tl::toDouble(pValue); // will ignore the trailing unit -int nLen = pValue.size(); -if (nLen > 2 && -pValue[nLen-2] == 'p' && -pValue[nLen-1] == 't') +if (pValue.ends_with("pt")) { -mnValue = static_cast(val * npPt); +val *= npPt; } -else if (nLen > 2 && -pValue[nLen - 2] == 'c' && -pValue[nLen - 1] == 'm') +else if (pValue.ends_with("cm")) { -mnValue = static_cast(val * npPt * 72 / 2.54); +val = o3tl::convert(val, o3tl::Length::cm, o3tl::Length::pt) * npPt; } -else if (nLen > 2 && -pValue[nLen - 2] == 'm' && -pValue[nLen - 1] == 'm') +else if (pValue.ends_with("mm")) { -mnValue = static_cast(val * npPt * 72 / 25.4); +val = o3tl::convert(val, o3tl::Length::mm, o3tl::Length::pt) * npPt; } -else if (nLen > 2 && -pValue[nLen - 2] == 'i' && -pValue[nLen - 1] == 'n') +else if (pValue.ends_with("in")) { -mnValue = static_cast(val * npPt * 72); +val = o3tl::convert(val, o3tl::Length::in, o3tl::Length::pt) * npPt; } -else if (nLen > 2 && -pValue[nLen - 2] == 'p' && -( pValue[nLen - 1] == 'c' || pValue[nLen - 1] == 'i' )) +else if (pValue.ends_with("pc") || pValue.ends_with("pi")) { -mnValue = static_cast(val * npPt * 12); -} -else -{ -mnValue = static_cast(val); +val = o3tl::convert(val, o3tl::Length::pc, o3tl::Length::pt) * npPt; } + +mnValue = std::round(val); } OOXMLUniversalMeasureValue::~OOXMLUniversalMeasureValue()
core.git: vcl/source
vcl/source/gdi/CommonSalLayout.cxx |6 +++--- vcl/source/outdev/text.cxx |2 +- 2 files changed, 4 insertions(+), 4 deletions(-) New commits: commit 01cabd3f998197f277300bcc71fc80e80642caed Author: Mike Kaganski AuthorDate: Fri Apr 12 09:56:29 2024 +0100 Commit: Mike Kaganski CommitDate: Sat Apr 13 01:20:18 2024 +0200 Don't use lround when assigning to a double Change-Id: Ifdfd351cf1f2848b754ec7a4c6f6cb9a56f478d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165939 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index fc3a2a2bf79c..8211b9ea6aa9 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -555,9 +555,9 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay nYOffset = nYOffset * nYScale; if (!GetSubpixelPositioning()) { -nAdvance = std::lround(nAdvance); -nXOffset = std::lround(nXOffset); -nYOffset = std::lround(nYOffset); +nAdvance = std::round(nAdvance); +nXOffset = std::round(nXOffset); +nYOffset = std::round(nYOffset); } basegfx::B2DPoint aNewPos(aCurrPos.getX() + nXOffset, aCurrPos.getY() + nYOffset); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 80fb2b94bd40..ed782acf2ffb 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1121,7 +1121,7 @@ std::unique_ptr OutputDevice::ImplLayout(const OUString& rOrigStr, { for(int i = 0; i < nLen; ++i) xDXPixelArray[i] = pDXArray.get(i); -nEndGlyphCoord = std::lround(xDXPixelArray[nLen - 1]); +nEndGlyphCoord = std::round(xDXPixelArray[nLen - 1]); } aLayoutArgs.SetDXArray(xDXPixelArray.get());
core.git: solenv/vs
solenv/vs/LibreOffice.natstepfilter | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) New commits: commit 4108a59dec851cae19012f790776c7d65b8ceef3 Author: Mike Kaganski AuthorDate: Fri Apr 12 09:37:11 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 13 01:19:45 2024 +0200 Add VclPtr operators to natstepfilter And fix a vector-related filter Change-Id: Icd3f5bd5a04a1385dff3f3413792a7aad544a506 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166029 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/solenv/vs/LibreOffice.natstepfilter b/solenv/vs/LibreOffice.natstepfilter index 6098ef9fb980..afd3428ace1f 100644 --- a/solenv/vs/LibreOffice.natstepfilter +++ b/solenv/vs/LibreOffice.natstepfilter @@ -9,7 +9,7 @@ NoStepInto ->std::vector.*::operator[] +std::vector.*::operator[] NoStepInto @@ -24,4 +24,14 @@ rtl::Reference.*::operator- NoStepInto + +VclPtr.*::operator- +NoStepInto + + + + +VclPtr.*::operator .* \* +NoStepInto +
core.git: oox/source sc/qa
oox/source/drawingml/drawingmltypes.cxx | 12 +--- oox/source/export/drawingml.cxx | 18 +- sc/qa/unit/subsequent_export_test3.cxx |8 3 files changed, 22 insertions(+), 16 deletions(-) New commits: commit 6e3ed71f906c3571a6b6efb5335c26807b566a42 Author: Mike Kaganski AuthorDate: Fri Apr 12 09:16:12 2024 +0100 Commit: Mike Kaganski CommitDate: Sat Apr 13 01:19:00 2024 +0200 Use o3tl::convert in oox Change-Id: I1cbc299e7e64eae48f0f6c896a8160bbe6e19c97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165938 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx index 30fed83f4391..04668c6b9a72 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -92,22 +92,20 @@ float GetTextSize( std::u16string_view sValue ) return fRet; } -/** converts the ST_TextSpacingPoint to 1/100mm */ +/** converts the ST_TextSpacingPoint (1/100pt) to 1/100mm */ sal_Int32 GetTextSpacingPoint( std::u16string_view sValue ) { sal_Int32 nRet; -if( ::sax::Converter::convertNumber( nRet, sValue, (SAL_MIN_INT32 + 360) / 254, (SAL_MAX_INT32 - 360) / 254 ) ) +if( ::sax::Converter::convertNumber( nRet, sValue ) ) nRet = GetTextSpacingPoint( nRet ); return nRet; } sal_Int32 GetTextSpacingPoint(sal_Int32 nValue) { -if (nValue > 0) -nValue = (nValue * 254 + 360); -else if (nValue < 0) -nValue = (nValue * 254 - 360); -return nValue / 720; +constexpr auto mdFromPt = o3tl::getConversionMulDiv(o3tl::Length::pt, o3tl::Length::mm100); +constexpr o3tl::detail::m_and_d md(mdFromPt.first, mdFromPt.second * 100); +return o3tl::convertNarrowing(nValue); } float GetFontHeight( sal_Int32 nHeight ) diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 92aa84438e62..d14fd037f237 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -167,6 +167,14 @@ const char* g_aPredefinedClrNames[] = { "hlink", "folHlink", }; + +/** converts 1/100mm to the ST_TextSpacingPoint (1/100pt) */ +sal_Int64 toTextSpacingPoint(sal_Int64 mm100) +{ +constexpr auto mdToPt = o3tl::getConversionMulDiv(o3tl::Length::mm100, o3tl::Length::pt); +constexpr o3tl::detail::m_and_d md(mdToPt.first * 100, mdToPt.second); +return o3tl::convert(mm100, md.m, md.d); +} } namespace oox::drawingml { @@ -2491,7 +2499,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool *therefore to get original value CharKerning need to be convert. * https://opengrok.libreoffice.org/xref/core/oox/source/drawingml/drawingmltypes.cxx#95 **/ -nCharKerning = ((nCharKerning * 720)-360) / 254; +nCharKerning = toTextSpacingPoint(nCharKerning); if ((bComplex && GetProperty(rXPropSet, "CharWeightComplex")) || GetProperty(rXPropSet, "CharWeight")) @@ -3445,7 +3453,7 @@ void DrawingML::WriteLinespacing(const LineSpacing& rSpacing, float fFirstCharHe XML_val, OString::number(static_cast(rSpacing.Height)*1000)); } else if (rSpacing.Mode == LineSpacingMode::MINIMUM - && fFirstCharHeight > static_cast(rSpacing.Height) * 0.001 * 72.0 / 2.54) + && fFirstCharHeight > o3tl::convert(rSpacing.Height, o3tl::Length::mm100, o3tl::Length::pt)) { // 100% proportional line spacing = single line spacing mpFS->singleElementNS(XML_a, XML_spcPct, XML_val, @@ -3454,7 +3462,7 @@ void DrawingML::WriteLinespacing(const LineSpacing& rSpacing, float fFirstCharHe else { mpFS->singleElementNS( XML_a, XML_spcPts, - XML_val, OString::number(std::lround(rSpacing.Height / 25.4 * 72))); + XML_val, OString::number(toTextSpacingPoint(rSpacing.Height))); } } @@ -3582,7 +3590,7 @@ bool DrawingML::WriteParagraphProperties(const Reference& rParagra mpFS->startElementNS(XML_a, XML_spcBef); { mpFS->singleElementNS( XML_a, XML_spcPts, - XML_val, OString::number(std::lround(nParaTopMargin / 25.4 * 72))); + XML_val, OString::number(toTextSpacingPoint(nParaTopMargin))); } mpFS->endElementNS( XML_a, XML_spcBef ); } @@ -3592,7 +3600,7 @@ bool DrawingML::WriteParagraphProperties(const Reference& rParagra mpFS->startElementNS(XML_a, XML_spcAft); { mpFS->singleElementNS( XML_a, XML_spcPts, - XML_val, OString::number(std::lround(nParaBottomMargin / 25.4 * 72))); + XML_val, OStrin
core.git: Branch 'libreoffice-24-2' - dbaccess/source
dbaccess/source/ui/misc/UITools.cxx| 45 + dbaccess/source/ui/misc/WCopyTable.cxx |1 dbaccess/source/ui/tabledesign/TableController.cxx |4 - 3 files changed, 31 insertions(+), 19 deletions(-) New commits: commit c94c724d0ba9da6f6bacd6e9c6025ad0759d9658 Author: Mike Kaganski AuthorDate: Tue Mar 19 16:48:19 2024 +0500 Commit: Christian Lohmaier CommitDate: Thu Apr 11 19:17:42 2024 +0200 Related: tdf#108057 Use autoincrement for automatically added primary key This partially undoes commit 24940e2c3717ad7b07d43db4f08cf7e09cfcc22f (#100599# #95927# check if row is readonly and disable autoincrement column for auto primarykey, 2002-06-27), enabling autoincrement again. Make sure to use the largest type that supports autoincrement. Change-Id: I4dfdbfb0c3d9b94c7634082b029c6e66aa01c782 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165027 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit c07548447a564b2d142cc439a124b76e6a71dfbd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165001 Reviewed-by: Christian Lohmaier diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 483afced1082..910baad617df 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1047,29 +1047,40 @@ void setEvalDateFormatForFormatter(Reference< css::util::XNumberFormatter > cons } } +static bool TypeIsGreater(const TOTypeInfoSP& lhs, const TOTypeInfoSP& rhs) +{ +assert(lhs); +if (!rhs) +return true; +if (lhs->nNumPrecRadix == rhs->nNumPrecRadix) +return lhs->nPrecision > rhs->nPrecision; +if (lhs->nPrecision == rhs->nPrecision) +return lhs->nNumPrecRadix > rhs->nNumPrecRadix; +if ((lhs->nNumPrecRadix > rhs->nNumPrecRadix) == (lhs->nPrecision > rhs->nPrecision)) +return lhs->nPrecision > rhs->nPrecision; +return std::pow(lhs->nNumPrecRadix, lhs->nPrecision) + > std::pow(rhs->nNumPrecRadix, rhs->nPrecision); +} + TOTypeInfoSP queryPrimaryKeyType(const OTypeInfoMap& _rTypeInfo) { -TOTypeInfoSP pTypeInfo; -// first we search for a type which supports autoIncrement +TOTypeInfoSP pTypeInfo, pFallback; +// first we search for a largest type which supports autoIncrement for (auto const& elem : _rTypeInfo) { -// OJ: we don't want to set an autoincrement column to be key -// because we don't have the possibility to know how to create -// such auto increment column later on -// so until we know how to do it, we create a column without autoincrement -// therefore we have searched -if ( elem.second->nType == DataType::INTEGER ) -{ -pTypeInfo = elem.second; // alternative -break; -} -else if ( !pTypeInfo && elem.second->nType == DataType::DOUBLE ) -pTypeInfo = elem.second; // alternative -else if ( !pTypeInfo && elem.second->nType == DataType::REAL ) -pTypeInfo = elem.second; // alternative +if (elem.second->bAutoIncrement && TypeIsGreater(elem.second, pTypeInfo)) +pTypeInfo = elem.second; +if (pTypeInfo) +continue; +if (elem.second->nType == DataType::INTEGER) +pFallback = elem.second; // default alternative +else if (!pFallback && elem.second->nType == DataType::DOUBLE) +pFallback = elem.second; // alternative +else if (!pFallback && elem.second->nType == DataType::REAL) +pFallback = elem.second; // alternative } if ( !pTypeInfo ) // just a fallback -pTypeInfo = queryTypeInfoByType(DataType::VARCHAR,_rTypeInfo); +pTypeInfo = pFallback ? pFallback : queryTypeInfoByType(DataType::VARCHAR, _rTypeInfo); OSL_ENSURE(pTypeInfo,"checkColumns: can't find a type which is usable as a key!"); return pTypeInfo; diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 29be8774747b..a2737543c705 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -737,6 +737,7 @@ bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos) OFieldDescription* pField = new OFieldDescription(); pField->SetName(m_aKeyName); pField->FillFromTypeInfo(pTypeInfo,true,true); +pField->SetAutoIncrement(pTypeInfo->bAutoIncrement); pField->SetPrimaryKey(true); m_bAddPKFirstTime = false; insertColumn(0,pField); diff --git a/dbaccess/source/ui/tabledesign/TableContro
core.git: svgio/source
svgio/source/svgreader/svgsvgnode.cxx | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) New commits: commit 2cb757db3409cef9e0568ffa6409da7522fd702e Author: Mike Kaganski AuthorDate: Thu Apr 11 12:54:35 2024 +0100 Commit: Mike Kaganski CommitDate: Thu Apr 11 16:22:21 2024 +0200 Move variables into their usage scope Change-Id: I9b04a3b62fed65139a4b48629e9b442ba163a3d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165931 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx index e3c52053a839..4dfa60271844 100644 --- a/svgio/source/svgreader/svgsvgnode.cxx +++ b/svgio/source/svgreader/svgsvgnode.cxx @@ -489,8 +489,6 @@ namespace svgio::svgreader if(!bWidthInvalid && !bHeightInvalid) { basegfx::B2DRange aSvgCanvasRange; // viewport -double fW = 0.0; // dummy values -double fH = 0.0; if (const basegfx::B2DRange* pBox = getViewBox()) { // SVG 1.1 defines in section 7.7 that a negative value for width or height @@ -508,20 +506,20 @@ namespace svgio::svgreader const double fViewBoxRatio(fViewBoxWidth/fViewBoxHeight); if(bWidthIsAbsolute && bHeightIsAbsolute) { -fW = getWidth().solveNonPercentage(*this); -fH = getHeight().solveNonPercentage(*this); +double fW = getWidth().solveNonPercentage(*this); +double fH = getHeight().solveNonPercentage(*this); aSvgCanvasRange = basegfx::B2DRange(0.0, 0.0, fW, fH); } else if (bWidthIsAbsolute) { -fW = getWidth().solveNonPercentage(*this); -fH = fW / fViewBoxRatio ; +double fW = getWidth().solveNonPercentage(*this); +double fH = fW / fViewBoxRatio; aSvgCanvasRange = basegfx::B2DRange(0.0, 0.0, fW, fH); } else if (bHeightIsAbsolute) { -fH = getHeight().solveNonPercentage(*this); -fW = fH * fViewBoxRatio ; +double fH = getHeight().solveNonPercentage(*this); +double fW = fH * fViewBoxRatio; aSvgCanvasRange = basegfx::B2DRange(0.0, 0.0, fW, fH); } else @@ -536,6 +534,7 @@ namespace svgio::svgreader const double fChildHeight(pBox->getHeight()); const double fLeft(pBox->getMinX()); const double fTop(pBox->getMinY()); +double fW, fH; if ( fChildWidth / fViewBoxWidth > fChildHeight / fViewBoxHeight ) { // expand y fW = fChildWidth; @@ -577,8 +576,8 @@ namespace svgio::svgreader const bool bHeightIsAbsolute(getHeight().isSet() && SvgUnit::percent != getHeight().getUnit()); if (bWidthIsAbsolute && bHeightIsAbsolute) { -fW =getWidth().solveNonPercentage(*this); -fH =getHeight().solveNonPercentage(*this); +double fW = getWidth().solveNonPercentage(*this); +double fH = getHeight().solveNonPercentage(*this); aSvgCanvasRange = basegfx::B2DRange(0.0, 0.0, fW, fH); } else @@ -592,8 +591,8 @@ namespace svgio::svgreader const double fChildHeight(aChildRange.getHeight()); const double fChildLeft(aChildRange.getMinX()); const double fChildTop(aChildRange.getMinY()); -fW = bWidthIsAbsolute ? getWidth().solveNonPercentage(*this) : fChildWidth; -fH = bHeightIsAbsolute ? getHeight().solveNonPercentage(*this) : fChildHeight; +double fW = bWidt
core.git: logerrit
logerrit | 39 +++ 1 file changed, 27 insertions(+), 12 deletions(-) New commits: commit b6c10f89e25f43cac4eab8d596dbdba3c5e11ef2 Author: Mike Kaganski AuthorDate: Thu Apr 11 11:51:09 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 11 14:08:29 2024 +0200 When no branch is specified, fallback to the tracked branch first This allows to work in a branch foo, which tracks e.g. master, and using plain ./logerrit submit, have it submit to master properly. Change-Id: I7aaff759392250a5380853cbaea0f892461c1d77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165984 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/logerrit b/logerrit index 25e9943b2bbf..f9077bd6b384 100755 --- a/logerrit +++ b/logerrit @@ -8,15 +8,24 @@ get_SHA_for_change() { SHA=$(ssh "${GERRITHOST?}" gerrit query --all-approvals change:"$1" | grep ref | tail -1 | cut -d: -f2 | sed 's/^ *//') } +get_tracked_branch() { +local BRANCH=$(git symbolic-ref HEAD|sed 's|refs/heads/||') +local REMOTE=$(git config branch.$BRANCH.remote) +git rev-parse --abbrev-ref --symbolic-full-name HEAD@{upstream}|sed "s|${REMOTE}/||" +} + submit() { BRANCH=$1 TYPE=${2:-''} if test -z "$BRANCH"; then -BRANCH=$(git symbolic-ref HEAD 2> /dev/null) -BRANCH="${BRANCH##refs/heads/}" +BRANCH=$(get_tracked_branch) if test -z "$BRANCH"; then -echo "no branch specified, and could not guess the current branch" -exit 1 +BRANCH=$(git symbolic-ref HEAD 2> /dev/null) +BRANCH="${BRANCH##refs/heads/}" +if test -z "$BRANCH"; then +echo "no branch specified, and could not guess the current branch" +exit 1 +fi fi echo "no branch specified, guessing current branch $BRANCH" fi @@ -180,11 +189,14 @@ case "$1" in echo "current state backed up as $BACKUPBRANCH" BRANCH=$2 if test -z "$BRANCH"; then -BRANCH=$(git symbolic-ref HEAD 2> /dev/null) -BRANCH="${BRANCH##refs/heads/}" +BRANCH=$(get_tracked_branch) if test -z "$BRANCH"; then -echo "no branch specified, and could not guess the current branch" -exit 1 +BRANCH=$(git symbolic-ref HEAD 2> /dev/null) +BRANCH="${BRANCH##refs/heads/}" +if test -z "$BRANCH"; then +echo "no branch specified, and could not guess the current branch" +exit 1 +fi fi echo "no branch specified, guessing current branch $BRANCH" fi @@ -228,11 +240,14 @@ case "$1" in BRANCH=$2 if test -z "$BRANCH"; then -BRANCH=$(git symbolic-ref HEAD 2> /dev/null) -BRANCH="${BRANCH##refs/heads/}" +BRANCH=$(get_tracked_branch) if test -z "$BRANCH"; then -echo "no branch specified, and could not guess the current branch" -exit 1 +BRANCH=$(git symbolic-ref HEAD 2> /dev/null) +BRANCH="${BRANCH##refs/heads/}" +if test -z "$BRANCH"; then +echo "no branch specified, and could not guess the current branch" +exit 1 +fi fi echo "no branch specified, guessing current branch $BRANCH" fi
core.git: vcl/inc vcl/skia vcl/win
vcl/inc/win/DWriteTextRenderer.hxx |8 ++--- vcl/inc/win/salgdi.h |7 +--- vcl/skia/win/gdiimpl.cxx |3 - vcl/win/gdi/DWriteTextRenderer.cxx | 31 --- vcl/win/gdi/salfont.cxx|3 - vcl/win/gdi/salgdi.cxx | 58 + 6 files changed, 48 insertions(+), 62 deletions(-) New commits: commit 9bbecbaea359350c2e0d78ebe4dcd10d16dccbee Author: Mike Kaganski AuthorDate: Wed Apr 10 14:01:53 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 11 12:51:50 2024 +0200 Use COMReference in D2DWriteTextOutRenderer ... and simplify the related code. Change-Id: Idaef7c9d725273e202948158e45ded7e7a2f85a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165985 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/inc/win/DWriteTextRenderer.hxx b/vcl/inc/win/DWriteTextRenderer.hxx index b822a6bca488..1cdf67d04a39 100644 --- a/vcl/inc/win/DWriteTextRenderer.hxx +++ b/vcl/inc/win/DWriteTextRenderer.hxx @@ -23,6 +23,8 @@ #include #include +#include + #include enum class D2DTextAntiAliasMode @@ -37,7 +39,6 @@ class D2DWriteTextOutRenderer : public TextOutRenderer { public: explicit D2DWriteTextOutRenderer(bool bRenderingModeNatural); -virtual ~D2DWriteTextOutRenderer() override; bool operator()(GenericSalLayout const , SalGraphics , @@ -62,9 +63,8 @@ private: IDWriteFontFace* GetDWriteFace(const WinFontInstance& rWinFont, float * lfSize) const; bool performRender(GenericSalLayout const , SalGraphics , HDC hDC, bool& bRetry, bool bRenderingModeNatural); -ID2D1Factory* mpD2DFactory; -IDWriteFactory * mpDWriteFactory; -ID2D1DCRenderTarget * mpRT; +sal::systools::COMReference mpD2DFactory; +sal::systools::COMReference mpRT; const D2D1_RENDER_TARGET_PROPERTIES mRTProps; bool mbRenderingModeNatural; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 80fafdeba56f..19edee0f4440 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -166,10 +166,6 @@ private: RGNDATA*mpStdClipRgnData; // Cache Standard-ClipRegion-Data int mnPenWidth; // line width -inline static sal::systools::COMReference mxDWriteFactory; -inline static sal::systools::COMReference mxDWriteGdiInterop; -inline static bool bDWriteDone = false; - // just call both from setHDC! void InitGraphics(); void DeInitGraphics(); @@ -198,7 +194,8 @@ public: SCREEN }; -static void getDWriteFactory(IDWriteFactory** pFactory, IDWriteGdiInterop** pInterop = nullptr); +static IDWriteFactory* getDWriteFactory(); +static IDWriteGdiInterop* getDWriteGdiInterop(); public: diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index 0451307b7bdf..1d48fb9bbe71 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -126,8 +126,7 @@ sk_sp WinSkiaSalGraphicsImpl::createDirectWriteTypeface(const WinFontInstance* pWinFont) try { using sal::systools::ThrowIfFailed; -IDWriteFactory* dwriteFactory; -WinSalGraphics::getDWriteFactory(); +IDWriteFactory* dwriteFactory = WinSalGraphics::getDWriteFactory(); if (!dwriteDone) { dwriteFontMgr = SkFontMgr_New_DirectWrite(dwriteFactory); diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index c167c44c0110..e0a50c4ed981 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -62,8 +62,10 @@ D2DTextAntiAliasMode lclGetSystemTextAntiAliasMode() return eMode; } -IDWriteRenderingParams* lclSetRenderingMode(IDWriteFactory* pDWriteFactory, DWRITE_RENDERING_MODE eRenderingMode) +IDWriteRenderingParams* lclSetRenderingMode(DWRITE_RENDERING_MODE eRenderingMode) { +IDWriteFactory* pDWriteFactory = WinSalGraphics::getDWriteFactory(); + IDWriteRenderingParams* pDefaultParameters = nullptr; pDWriteFactory->CreateRenderingParams(); @@ -118,22 +120,12 @@ D2DWriteTextOutRenderer::D2DWriteTextOutRenderer(bool bRenderingModeNatural) mbRenderingModeNatural(bRenderingModeNatural), meTextAntiAliasMode(D2DTextAntiAliasMode::Default) { -WinSalGraphics::getDWriteFactory(); -HRESULT hr = S_OK; -hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory), nullptr, reinterpret_cast()); +HRESULT hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory), nullptr, IID_PPV_ARGS_Helper()); if (SUCCEEDED(hr)) hr = CreateRenderTarget(bRenderingModeNatural); meTextAntiAliasMode = lclGetSystemTextAntiAliasMode(); } -D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer() -{ -if (mpRT) -mpRT->Release(); -if (mpD2DFactory) -mpD2DFactory->Release(); -} - void D2DWriteTextOutRenderer::applyTextA
core.git: Branch 'libreoffice-24-2' - sw/qa sw/source
sw/qa/extras/layout/data/tdf160526.fodt | 47 ++ sw/qa/extras/layout/data/tdf160549.fodt | 60 +++ sw/qa/extras/layout/layout3.cxx | 21 ++ sw/source/core/text/frmform.cxx | 101 +++- 4 files changed, 216 insertions(+), 13 deletions(-) New commits: commit 167be9363ea505b334aa595b273707d7d9217863 Author: Mike Kaganski AuthorDate: Sun Apr 7 18:23:52 2024 +0500 Commit: Xisco Fauli CommitDate: Thu Apr 11 11:40:45 2024 +0200 tdf#160526, tdf#160549: fix split conditions at page start A single large object in a paragraph must be moved down, when the page has other content before this. On the other hand, there must not be moving down, when an unsuccessful attempt to move was already done (so the master frame is empty), or even the first time, when the frame is at the page body start. Change-Id: Ib8e2fe7b77c622d9cfac22722ca6b55dba7ad8ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165869 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165889 diff --git a/sw/qa/extras/layout/data/tdf160526.fodt b/sw/qa/extras/layout/data/tdf160526.fodt new file mode 100644 index ..37cf73fb8e18 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf160526.fodt @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Foo + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/layout/data/tdf160549.fodt b/sw/qa/extras/layout/data/tdf160549.fodt new file mode 100644 index ..fd8425eedd86 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf160549.fodt @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + foobar + + + + + + + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index a074a35dc61b..98c77b18ecdf 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -2353,6 +2353,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testPageBreakInHiddenSection) assertXPath(pXmlDoc, "//page[4]/body/section/infos/bounds"_ostr, "height"_ostr, u"0"_ustr); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf160549) +{ +// Given a document with a large as-char object, alone in its paragraph, shifted down by a +// header object: it must not hang in a layout loop on import (similar to i84870, but not +// fixed by its fix) +createSwDoc("tdf160549.fodt"); +// The object is the first in the document; it must not move to the next page +CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf160526) +{ +// Given a document with a large as-char object, alone in its paragraph, shifted down by +// another body object +createSwDoc("tdf160526.fodt"); +// It must move to the next page +CPPUNIT_ASSERT_EQUAL(2, getPages()); +auto pExportDump = parseLayoutDump(); +assertXPath(pExportDump, "//page[2]/body/txt/anchored/SwAnchoredDrawObject"_ostr); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index e19b834a5618..97eff3e607ec 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1081,6 +1081,54 @@ void SwTextFrame::ChangeOffset( SwTextFrame* pFrame, TextFrameIndex nNew ) MoveFlyInCnt( pFrame, nNew, TextFrameIndex(COMPLETE_STRING) ); } +static bool isFirstVisibleFrameInBody(const SwTextFrame* pFrame) +{ +const SwFrame* pBodyFrame = pFrame->FindBodyFrame(); +if (!pBodyFrame) +return false; +for (const SwFrame* pCur = pFrame;;) +{ +for (const SwFrame* pPrev = pCur->GetPrev(); pPrev; pPrev = pPrev->GetPrev()) +if (!pPrev->IsHiddenNow()) +return false; +pCur = pCur->GetUpper(); +assert(pCur); // We found pBodyFrame, right? +if (pCur->IsBodyFrame()) +return true; +} +} + +static bool hasFly(const SwTextFrame* pFrame) +{ +if (auto pDrawObjs = pFrame->GetDrawObjs(); pDrawObjs && pDrawObjs->size()) +{ +auto anchorId = (*pDrawObjs)[0]->GetFrameFormat()->GetAnchor().GetAnchorId(); +if (anchorId == RndStdIds::FLY_AT_PARA || anchorId == RndStdIds::FLY_AT_CHAR) +return true; +} +return false; +} + +static bool hasAtPageFly(const SwFrame* pFrame) +{ +auto pPageFrame = pFrame->FindPageFr
core.git: Branch 'libreoffice-24-2' - sw/inc sw/source
sw/inc/editsh.hxx |4 ++-- sw/source/core/edit/eddel.cxx |8 +--- sw/source/uibase/wrtsh/delete.cxx |4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) New commits: commit 3ca52750661cf8a3b36a42a0a6d293318232f1b9 Author: Mike Kaganski AuthorDate: Thu Jan 18 14:56:54 2024 +0600 Commit: Xisco Fauli CommitDate: Thu Apr 11 11:36:04 2024 +0200 tdf#109272: make sure that Delete / Backspace move cursor correctly ... in change tracking mode. Cursor's end position now doesn't depend on the selection direction; it is at the deletion's beginning in case of Backspace, and at deletion's end in case of Delete. Change-Id: I9cb7af235a066bea2c7b21b8ff515dcdd52218c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162240 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit c80606bb23fd42e41710d70a96b7ffaf948384a6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165849 Reviewed-by: Xisco Fauli diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 1fb9ff3a5bae..2b753530159a 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -152,7 +152,7 @@ class SW_DLLPUBLIC SwEditShell : public SwCursorShell that will be used by GetGraphic() and GetGraphicSize(). */ SAL_DLLPRIVATE SwGrfNode *GetGrfNode_() const ; -SAL_DLLPRIVATE void DeleteSel(SwPaM& rPam, bool isArtificialSelection, bool* pUndo = nullptr); +SAL_DLLPRIVATE void DeleteSel(SwPaM& rPam, bool isArtificialSelection, bool goLeft = false, bool* pUndo = nullptr); SAL_DLLPRIVATE void SetSectionAttr_( SwSectionFormat& rSectFormat, const SfxItemSet& rSet ); @@ -178,7 +178,7 @@ public: /** Delete content of all ranges. If whole nodes are selected, these nodes get deleted. */ -bool Delete(bool isArtificialSelection = false); +bool Delete(bool isArtificialSelection = false, bool goLeft = false); /// Remove a complete paragraph. bool DelFullPara(); diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 9eb51da617b1..b8d6b0e39554 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -33,7 +33,8 @@ #include #include -void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool *const pUndo) +void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool goLeft, +bool* const pUndo) { auto const oSelectAll(StartsWith_() != SwCursorShell::StartsWith::None ? ExtendedSelectedAll() @@ -127,11 +128,12 @@ void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool } } +rPam.Normalize(goLeft); // change tracking case: will make sure to end up in the correct point // Selection is not needed anymore rPam.DeleteMark(); } -bool SwEditShell::Delete(bool const isArtificialSelection) +bool SwEditShell::Delete(bool const isArtificialSelection, bool goLeft) { CurrShell aCurr( this ); bool bRet = false; @@ -159,7 +161,7 @@ bool SwEditShell::Delete(bool const isArtificialSelection) for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { -DeleteSel(rPaM, isArtificialSelection, ); +DeleteSel(rPaM, isArtificialSelection, goLeft, ); } // If undo container then close here diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx index e7a09d016587..46b0a40cca5d 100644 --- a/sw/source/uibase/wrtsh/delete.cxx +++ b/sw/source/uibase/wrtsh/delete.cxx @@ -171,7 +171,7 @@ bool SwWrtShell::DelLeft() { SwActContext aActContext(this); ResetCursorStack(); -Delete(false); +Delete(false, true); UpdateAttr(); } if( IsBlockMode() ) @@ -274,7 +274,7 @@ bool SwWrtShell::DelLeft() SwCursorShell::Pop( SwCursorShell::PopMode::DeleteStack ); } } -bool bRet = Delete(true); +bool bRet = Delete(true, true); if( !bRet && bSwap ) SwCursorShell::SwapPam(); CloseMark( bRet );
core.git: vcl/win
vcl/win/gdi/DWriteTextRenderer.cxx | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) New commits: commit 8d85da5616bab28c1df226bcbf4fe777b14b363e Author: Mike Kaganski AuthorDate: Wed Apr 10 22:45:41 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 11 10:38:47 2024 +0200 Only call ID2D1RenderTarget::Get/SetTransform when needed Change-Id: Ifde2c24c222e3c316f5a4f47e86c2c08f676639a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165983 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index 633dcf82b13b..c167c44c0110 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -104,7 +104,7 @@ public: private: ID2D1RenderTarget* mpRenderTarget; -D2D1::Matrix3x2F maTransform; +std::optional moTransform; }; } // end anonymous namespace @@ -321,25 +321,27 @@ WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, bool bIsVertical) : mpRenderTarget(pRenderTarget) { -pRenderTarget->GetTransform(); -D2D1::Matrix3x2F aTransform = maTransform; - Degree10 angle = rLayout.GetOrientation(); - if (bIsVertical) angle += 900_deg10; if (angle) { +D2D1::Matrix3x2F aTransform; +pRenderTarget->GetTransform(); +moTransform = aTransform; + // DWrite angle is in clockwise degrees, our orientation is in counter-clockwise 10th // degrees. -aTransform = aTransform - * D2D1::Matrix3x2F::Rotation( - -toDegrees(angle), rBaseline); +aTransform = aTransform * D2D1::Matrix3x2F::Rotation(-toDegrees(angle), rBaseline); +mpRenderTarget->SetTransform(aTransform); } -mpRenderTarget->SetTransform(aTransform); } -WinFontTransformGuard::~WinFontTransformGuard() { mpRenderTarget->SetTransform(maTransform); } +WinFontTransformGuard::~WinFontTransformGuard() +{ +if (moTransform) +mpRenderTarget->SetTransform(*moTransform); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
core.git: vcl/win
vcl/win/gdi/salfont.cxx | 16 1 file changed, 16 deletions(-) New commits: commit 1dc1729183ac2e8ba9abf067dac38f39a3a5454a Author: Mike Kaganski AuthorDate: Wed Apr 10 22:47:57 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 11 09:26:51 2024 +0200 Drop old Windows 95/98/ME problem workaround KB305290 (broken link https://support.microsoft.com/en-us/help/305290) was for these long-unsupported systems. Change-Id: Ie2e3814d24ceb5d014c0bff1a39b3d6675e3603c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165981 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 51ddcce741b7..a98d82c6b8a4 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -753,19 +753,6 @@ std::tuple WinSalGraphics::ImplDoSetFont(HDC hDC, vcl::fon } hNewFont = ::CreateFontIndirectW( ); - -HDC hdcScreen = nullptr; -if( mbVirDev ) -// only required for virtual devices, see below for details -hdcScreen = GetDC(nullptr); -if( hdcScreen ) -{ -// select font into screen hdc first to get an antialiased font -// and instantly restore the default font! -// see knowledge base article 305290: -// "PRB: Fonts Not Drawn Antialiased on Device Context for DirectDraw Surface" -SelectFont( hdcScreen, SelectFont( hdcScreen , hNewFont ) ); -} o_rOldFont = ::SelectFont(hDC, hNewFont); TEXTMETRICW aTextMetricW; @@ -782,9 +769,6 @@ std::tuple WinSalGraphics::ImplDoSetFont(HDC hDC, vcl::fon bIsCJKVerticalFont = false; } -if( hdcScreen ) -::ReleaseDC( nullptr, hdcScreen ); - return std::make_tuple(hNewFont, bIsCJKVerticalFont, static_cast(aTextMetricW.tmDescent)); }
core.git: Branch 'distro/collabora/co-23.05' - sw/inc sw/source
sw/inc/editsh.hxx |4 ++-- sw/source/core/edit/eddel.cxx |8 +--- sw/source/uibase/wrtsh/delete.cxx |4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) New commits: commit eda9d88054423025c97d07136e7ff77789b17857 Author: Mike Kaganski AuthorDate: Thu Jan 18 14:56:54 2024 +0600 Commit: Miklos Vajna CommitDate: Thu Apr 11 08:38:51 2024 +0200 tdf#109272: make sure that Delete / Backspace move cursor correctly ... in change tracking mode. Cursor's end position now doesn't depend on the selection direction; it is at the deletion's beginning in case of Backspace, and at deletion's end in case of Delete. (cherry picked from commit c80606bb23fd42e41710d70a96b7ffaf948384a6) Change-Id: I9cb7af235a066bea2c7b21b8ff515dcdd52218c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165335 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit ccb26c80cb9f8da9ad6a4d1874a8e68215284eef) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165848 diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 663a0ffc35f7..604e9ac91aab 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -151,7 +151,7 @@ class SW_DLLPUBLIC SwEditShell : public SwCursorShell that will be used by GetGraphic() and GetGraphicSize(). */ SAL_DLLPRIVATE SwGrfNode *GetGrfNode_() const ; -SAL_DLLPRIVATE void DeleteSel(SwPaM& rPam, bool isArtificialSelection, bool* pUndo = nullptr); +SAL_DLLPRIVATE void DeleteSel(SwPaM& rPam, bool isArtificialSelection, bool goLeft = false, bool* pUndo = nullptr); SAL_DLLPRIVATE void SetSectionAttr_( SwSectionFormat& rSectFormat, const SfxItemSet& rSet ); @@ -173,7 +173,7 @@ public: /** Delete content of all ranges. If whole nodes are selected, these nodes get deleted. */ -bool Delete(bool isArtificialSelection = false); +bool Delete(bool isArtificialSelection = false, bool goLeft = false); /// Remove a complete paragraph. bool DelFullPara(); diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 6cbce339615c..0ccc93f6154e 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -31,7 +31,8 @@ #include #include -void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool *const pUndo) +void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool goLeft, +bool* const pUndo) { auto const oSelectAll(StartsWith_() != SwCursorShell::StartsWith::None ? ExtendedSelectedAll() @@ -125,11 +126,12 @@ void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool } } +rPam.Normalize(goLeft); // change tracking case: will make sure to end up in the correct point // Selection is not needed anymore rPam.DeleteMark(); } -bool SwEditShell::Delete(bool const isArtificialSelection) +bool SwEditShell::Delete(bool const isArtificialSelection, bool goLeft) { CurrShell aCurr( this ); bool bRet = false; @@ -148,7 +150,7 @@ bool SwEditShell::Delete(bool const isArtificialSelection) for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { -DeleteSel(rPaM, isArtificialSelection, ); +DeleteSel(rPaM, isArtificialSelection, goLeft, ); } // If undo container then close here diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx index ad49d66e58bf..44b9afe5ae92 100644 --- a/sw/source/uibase/wrtsh/delete.cxx +++ b/sw/source/uibase/wrtsh/delete.cxx @@ -169,7 +169,7 @@ bool SwWrtShell::DelLeft() { SwActContext aActContext(this); ResetCursorStack(); -Delete(false); +Delete(false, true); UpdateAttr(); } if( IsBlockMode() ) @@ -277,7 +277,7 @@ bool SwWrtShell::DelLeft() } } } -bool bRet = Delete(true); +bool bRet = Delete(true, true); if( !bRet && bSwap ) SwCursorShell::SwapPam(); CloseMark( bRet );
core.git: filter/source
filter/source/svg/svgfontexport.cxx |7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) New commits: commit 2dbd0acb88be751c05648167518dbc60ba75bceb Author: Mike Kaganski AuthorDate: Tue Apr 9 19:08:07 2024 +0100 Commit: Mike Kaganski CommitDate: Tue Apr 9 21:50:37 2024 +0200 Simplify a bit Change-Id: I92def0e5731d231583b9b03e351bc46949045b4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165846 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx index 7e75d65e6bc2..014975b8d229 100644 --- a/filter/source/svg/svgfontexport.cxx +++ b/filter/source/svg/svgfontexport.cxx @@ -252,7 +252,6 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont ) void SVGFontExport::implEmbedGlyph( OutputDevice const & rOut, const OUString& rCellStr ) { tools::PolyPolygon aPolyPoly; -const sal_Unicode nSpace = ' '; if( !rOut.GetTextOutline( aPolyPoly, rCellStr ) ) return; @@ -261,14 +260,10 @@ void SVGFontExport::implEmbedGlyph( OutputDevice const & rOut, const OUString& r aPolyPoly.Scale( 1.0, -1.0 ); -if( !rOut.GetTextBoundRect( aBoundRect, rCellStr ) ) +if (rCellStr == " " || !rOut.GetTextBoundRect(aBoundRect, rCellStr)) aBoundRect = tools::Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( rCellStr ), 0 ) ); mrExport.AddAttribute( XML_NAMESPACE_NONE, "unicode", rCellStr ); - -if( rCellStr[ 0 ] == nSpace && rCellStr.getLength() == 1 ) -aBoundRect = tools::Rectangle( Point( 0, 0 ), Size( rOut.GetTextWidth( OUString(' ') ), 0 ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, "horiz-adv-x", OUString::number( aBoundRect.GetWidth() ) ); const OUString aPathString( SVGActionWriter::GetPathString( aPolyPoly, false ) );
core.git: Branch 'libreoffice-24-2' - vcl/qa vcl/source
vcl/qa/cppunit/logicalfontinstance.cxx | 25 + vcl/source/font/LogicalFontInstance.cxx | 11 +++ 2 files changed, 32 insertions(+), 4 deletions(-) New commits: commit 61e94a59a947c372a5802134d94f0908327a2366 Author: Mike Kaganski AuthorDate: Sun Mar 31 00:45:25 2024 +0500 Commit: Xisco Fauli CommitDate: Tue Apr 9 13:56:23 2024 +0200 tdf#160436: fix glyph bounds calculation for vertical glyphs It is unclear if LogicalFontInstance::GetGlyphBoundRect can be called for both normal and rotated variants of the same glyph in the same font. If yes, then the normal and vertical variants must be cached separately, or possibly vertical variant can be not cached, but always calculated. This problem already existed before, so this change doesn't introduce a new issue. Change-Id: I9b50ef340c9e38db7bef890165519aadc96d3ffa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165581 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit dff57d2b4f5abd1b51ebfb0015339471f61e72f9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165843 Reviewed-by: Xisco Fauli diff --git a/vcl/qa/cppunit/logicalfontinstance.cxx b/vcl/qa/cppunit/logicalfontinstance.cxx index 2a0e30d50c34..eb803ed40363 100644 --- a/vcl/qa/cppunit/logicalfontinstance.cxx +++ b/vcl/qa/cppunit/logicalfontinstance.cxx @@ -46,6 +46,7 @@ void VclLogicalFontInstanceTest::testglyphboundrect() basegfx::B2DRectangle aBoundRect; const auto LATIN_SMALL_LETTER_B = 0x0062; +const auto SECTION_SIGN = 0x00A7; // UTR#50: Vertical_Orientation (vo) property value U pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(LATIN_SMALL_LETTER_B), aBoundRect, false); @@ -54,6 +55,14 @@ void VclLogicalFontInstanceTest::testglyphboundrect() CPPUNIT_ASSERT_DOUBLES_EQUAL(49.5, aBoundRect.getWidth(), 0.05); CPPUNIT_ASSERT_DOUBLES_EQUAL(80.8, aBoundRect.getHeight(), 0.05); +// tdf#160436: test vertically oriented glyphs + pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(SECTION_SIGN), aBoundRect, true); + +CPPUNIT_ASSERT_DOUBLES_EQUAL(-79.7, aBoundRect.getMinX(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(-55.0, aBoundRect.getMinY(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(88.9, aBoundRect.getWidth(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(48.8, aBoundRect.getHeight(), 0.05); + font.SetOrientation(900_deg10); device->SetFont(font); @@ -67,6 +76,14 @@ void VclLogicalFontInstanceTest::testglyphboundrect() CPPUNIT_ASSERT_DOUBLES_EQUAL(80.8, aBoundRect.getWidth(), 0.05); CPPUNIT_ASSERT_DOUBLES_EQUAL(49.5, aBoundRect.getHeight(), 0.05); +// tdf#160436: test vertically oriented glyphs + pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(SECTION_SIGN), aBoundRect, true); + +CPPUNIT_ASSERT_DOUBLES_EQUAL(-55.0, aBoundRect.getMinX(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(-9.2, aBoundRect.getMinY(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(48.8, aBoundRect.getWidth(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(88.9, aBoundRect.getHeight(), 0.05); + font.SetOrientation(450_deg10); device->SetFont(font); @@ -79,6 +96,14 @@ void VclLogicalFontInstanceTest::testglyphboundrect() CPPUNIT_ASSERT_DOUBLES_EQUAL(-96.4, aBoundRect.getMinY(), 0.05); CPPUNIT_ASSERT_DOUBLES_EQUAL(92.1, aBoundRect.getWidth(), 0.05); CPPUNIT_ASSERT_DOUBLES_EQUAL(92.1, aBoundRect.getHeight(), 0.05); + +// tdf#160436: test vertically oriented glyphs + pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(SECTION_SIGN), aBoundRect, true); + +CPPUNIT_ASSERT_DOUBLES_EQUAL(-95.3, aBoundRect.getMinX(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(-45.4, aBoundRect.getMinY(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(97.4, aBoundRect.getWidth(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(97.4, aBoundRect.getHeight(), 0.05); } CPPUNIT_TEST_SUITE_REGISTRATION(VclLogicalFontInstanceTest); diff --git a/vcl/source/font/LogicalFontInstance.cxx b/vcl/source/font/LogicalFontInstance.cxx index fbb115825828..3cf95cab8d65 100644 --- a/vcl/source/font/LogicalFontInstance.cxx +++ b/vcl/source/font/LogicalFontInstance.cxx @@ -171,8 +171,8 @@ void LogicalFontInstance::IgnoreFallbackForUnicode(sal_UCS4 cChar, FontWeight eW bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, basegfx::B2DRectangle& rRect, bool bVertical) const { -// TODO/FIXME: bVertical handling here is highly suspicious. When it's true, it may -// return different rectangle, depending on if this glyph was cached already or not. +// TODO: find out if it's possible for the same glyph in the same font to be used both +// normally and vertically; if yes, then these two variants must be cached separately if (mpFontCache && mpFo
core.git: Branch 'libreoffice-24-2' - sw/source
sw/source/core/fields/expfld.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 07a566f87213bd4c9c28b454ab4c4d30146fdaa4 Author: Mike Kaganski AuthorDate: Thu Apr 4 15:11:24 2024 +0500 Commit: Michael Stahl CommitDate: Tue Apr 9 10:34:14 2024 +0200 tdf#81012: avoid content frames in footnotes / endnotes This makes the behavior of the endnotes in the end of sections consistent with the behavior of dedicated endnote pages, where heading fields ignore headings in endnote content. Change-Id: Iad0218b75a678808b1266024fe4c81f040a631c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165789 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 746b21760b911860c7ac497f10ab07d60111e867) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165842 Reviewed-by: Michael Stahl diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 6ed4cdb7c125..47c675cc42bf 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -233,7 +233,7 @@ const SwTextNode* GetBodyTextNode( const SwDoc& rDoc, SwPosition& rPos, else pContentFrame = pPgFrame->FindLastBodyContent(); -if( pContentFrame ) +if( pContentFrame && !pContentFrame->IsInFootnote() ) { assert(pContentFrame->IsTextFrame()); SwTextFrame const*const pFrame(static_cast(pContentFrame));
core.git: Branch 'libreoffice-24-2' - vcl/source
vcl/source/gdi/sallayout.cxx | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) New commits: commit 70c19e55662e8a42876bc6aebdc7cfe1ede14ee1 Author: Mike Kaganski AuthorDate: Tue Apr 2 08:55:51 2024 +0500 Commit: Xisco Fauli CommitDate: Tue Apr 9 10:24:53 2024 +0200 Fix UB after 8962141a12c966b2d891829925e6203bf8d51852 (tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangle, 2024-04-01). As reported by Stephan in https://gerrit.libreoffice.org/c/core/+/165553/6#message-fec1e45288c0e87d43c58f777ebe51b03c534d82: `CppunitTest_sw_rtfexport CPPUNIT_TEST_NAME=testMathEqarray::TestBody` now fails with vcl/source/gdi/sallayout.cxx:245:30: runtime error: inf is outside the range of representable values of type 'long' #0 in SalLayout::GetBoundRect(tools::Rectangle&) const at vcl/source/gdi/sallayout.cxx:245:30 #1 in OutputDevice::GetTextBoundRect(tools::Rectangle&, rtl::OUString const&, int, int, int, unsigned long, KernArraySpan, std::span, SalLayoutGlyphs const*) const at vcl/source/outdev/text.cxx:1932:28 #2 in (anonymous namespace)::SmGetGlyphBoundRect(OutputDevice const&, rtl::OUString const&, tools::Rectangle&) at starmath/source/rect.cxx:80:32 #3 in SmRect::SmRect(OutputDevice const&, SmFormat const*, rtl::OUString const&, unsigned short) at starmath/source/rect.cxx:224:21 #4 in SmMathSymbolNode::AdaptToY(OutputDevice&, unsigned long) at starmath/source/node.cxx:2122:18 #5 in SmBraceNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:1340:17 #6 in SmBinHorNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:816:13 #7 in SmLineNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:610:20 #8 in SmTableNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:534:20 #9 in SmDocShell::ArrangeFormula() at starmath/source/document.cxx:280:13 #10 in SmDocShell::GetSize() at starmath/source/document.cxx:405:9 #11 in SmDocShell::Repaint() at starmath/source/document.cxx:566:21 #12 in SmDocShell::OnDocumentPrinterChanged(Printer*) at starmath/source/document.cxx:552:5 #13 in SmDocShell::SetText(rtl::OUString const&) at starmath/source/document.cxx:188:9 #14 in SmDocShell::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/document.cxx:848:5 #15 in SmModel::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/unomodel.cxx:1105:22 #16 in writerfilter::rtftok::RTFDocumentImpl::beforePopState(writerfilter::rtftok::RTFParserState&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3010:30 #17 in writerfilter::rtftok::RTFDocumentImpl::popState() at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3666:23 #18 in writerfilter::rtftok::RTFTokenizer::resolveParse() at writerfilter/source/rtftok/rtftokenizer.cxx:114:37 #19 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:856:27 #20 in (anonymous namespace)::RtfFilter::filter(com::sun::star::uno::Sequence const&) at writerfilter/source/filter/RtfFilter.cxx:163:20 #21 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference const&) at sfx2/source/doc/objstor.cxx:2392:34 #22 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:760:23 #23 in SfxBaseModel::load(com::sun::star::uno::Sequence const&) at sfx2/source/doc/sfxbasemodel.cxx:1980:36 #24 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) at sfx2/source/view/frmload.cxx:720:28 #25 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1176:37 #26 in framework::LoadEnv::start() at framework/source/loadenv/loadenv.cxx:412:20 #27 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&, rtl::OUString const&, int, LoadEnvFeatures) at framework/source/loadenv/loadenv.cxx:308:5 #28 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) at framework/source/loadenv/loadenv.cxx:168:14 #29 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) at framework/source/services/desktop.cxx:591:16 #30 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&a
core.git: Branch 'libreoffice-24-2' - 2 commits - svgio/CppunitTest_svgio.mk svgio/CppunitTest_svgio_tools.mk svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source vcl/inc vcl/qa vcl/source vcl/workb
svgio/CppunitTest_svgio.mk|1 svgio/CppunitTest_svgio_tools.mk |1 svgio/Library_svgio.mk|2 svgio/inc/svgdocument.hxx |6 - svgio/inc/svgnode.hxx |7 + svgio/inc/svgswitchnode.hxx | 55 +++ svgio/inc/svgtoken.hxx|1 svgio/qa/cppunit/SvgImportTest.cxx| 23 svgio/qa/cppunit/data/tdf160386.svg | 16 +++ svgio/source/svgreader/svgdocumenthandler.cxx |9 + svgio/source/svgreader/svgnode.cxx| 44 +++- svgio/source/svgreader/svgswitchnode.cxx | 129 ++ svgio/source/svgreader/svgtoken.cxx |1 vcl/inc/font/LogicalFontInstance.hxx |3 vcl/inc/impfontcache.hxx |8 - vcl/inc/impglyphitem.hxx |6 - vcl/qa/cppunit/logicalfontinstance.cxx| 43 ++-- vcl/source/font/LogicalFontInstance.cxx | 50 -- vcl/source/font/fontcache.cxx |4 vcl/source/gdi/CommonSalLayout.cxx|6 - vcl/source/gdi/pdfwriter_impl.cxx |4 vcl/source/gdi/sallayout.cxx | 24 ++-- vcl/source/outdev/font.cxx|4 vcl/workben/listglyphs.cxx|2 24 files changed, 367 insertions(+), 82 deletions(-) New commits: commit 6f4a949c07eb06345df08c722f8e59e97888a499 Author: Mike Kaganski AuthorDate: Fri Mar 29 20:15:06 2024 +0500 Commit: Xisco Fauli CommitDate: Mon Apr 8 16:56:31 2024 +0200 tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangle ... instead of tools::Rectangle. Several problems were there: 1. First, a horizontal bounding rectangle was calculated, with due rounding; and then the result was rotated, and after that, rounded again. That made the resulting rotated rectangle coordinates very imprecise. 2. Also, ceil/floor was applied without normalization; and in case of rotated font, that meant, that sometimes the range could be not expanded to cover partially covered pixels, but instead collapsed. 3. The rotation to angles other than 90 degree multiples was done incorrectly, resulting in cut off parts of characters. 4. For 90 degrees, the imprecise result of sin/cos converted 0.0 into values like 3e-16, which then could be ceil'ed up to 1. Using B2DRectangle and its transform allows to simplify and fix the calculations easily, and avoids premature rounding. Render of rotated text of small size is more stable with this change. Change-Id: Idffd74b9937feb2418ab76a8d325fdaf4ff841b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165553 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl Reviewed-by: Mike Kaganski (cherry picked from commit 8962141a12c966b2d891829925e6203bf8d51852) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165619 Reviewed-by: Xisco Fauli diff --git a/vcl/inc/font/LogicalFontInstance.hxx b/vcl/inc/font/LogicalFontInstance.hxx index 40d3c57c4e67..73ba2e26a2b1 100644 --- a/vcl/inc/font/LogicalFontInstance.hxx +++ b/vcl/inc/font/LogicalFontInstance.hxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -100,7 +101,7 @@ public: // TODO: make data members private vcl::font::PhysicalFontFace* GetFontFace() { return m_pFontFace.get(); } const ImplFontCache* GetFontCache() const { return mpFontCache; } -bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const; +bool GetGlyphBoundRect(sal_GlyphId, basegfx::B2DRectangle&, bool) const; virtual bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const = 0; basegfx::B2DPolyPolygon GetGlyphOutlineUntransformed(sal_GlyphId) const; diff --git a/vcl/inc/impfontcache.hxx b/vcl/inc/impfontcache.hxx index 5ea19b05d9a5..4d197003b279 100644 --- a/vcl/inc/impfontcache.hxx +++ b/vcl/inc/impfontcache.hxx @@ -21,10 +21,10 @@ #include +#include #include #include #include -#include #include "font/FontSelectPattern.hxx" #include "glyphid.hxx" @@ -59,7 +59,7 @@ struct GlyphBoundRectCacheHash } }; -typedef o3tl::lru_map GlyphBoundRectCache; class ImplFontCache @@ -86,8 +86,8 @@ public: LogicalFontInstance* pLogicalFont, int nFallbackLevel, OUString& rMissingCodes ); -bool GetCachedGlyphBoundRect(const LogicalFontInstance *, sal_GlyphId, tools::Rectangle &); -void CacheGlyphBoundRect(const LogicalFontInstance *, sal_GlyphId, tools::Rectangle &); +bool GetCachedGlyphBoundRect(const LogicalFontInstance*, sal_GlyphId, basegfx::B2DRectangle&); +void CacheGlyphBoundRect(const LogicalFontInstance*, sal_GlyphId, basegfx::B2DRectangle&
core.git: Branch 'distro/vector/vector-7.5.9' - vcl/inc vcl/win
vcl/inc/win/DWriteTextRenderer.hxx | 15 +++ vcl/inc/win/winlayout.hxx |2 ++ vcl/win/gdi/DWriteTextRenderer.cxx | 28 ++-- vcl/win/gdi/winlayout.cxx |8 4 files changed, 35 insertions(+), 18 deletions(-) New commits: commit 14c76305c6ebbaa765caf45db409a10cf99c5cea Author: Mike Kaganski AuthorDate: Mon Apr 8 11:12:01 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 8 11:12:01 2024 +0500 Revert "Exclude getHScale from DirectWrite font rendering" This reverts commit 36e8e419d022a9c43302efe5e702a704dea39e76. diff --git a/vcl/inc/win/DWriteTextRenderer.hxx b/vcl/inc/win/DWriteTextRenderer.hxx index a655df6459ea..67094052ebb5 100644 --- a/vcl/inc/win/DWriteTextRenderer.hxx +++ b/vcl/inc/win/DWriteTextRenderer.hxx @@ -72,6 +72,21 @@ private: D2DTextAntiAliasMode meTextAntiAliasMode; }; +/** + * Sets and unsets the needed DirectWrite transform to support the font's horizontal scaling and + * rotation. + */ +class WinFontTransformGuard +{ +public: +WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale, const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, bool bIsVertical); +~WinFontTransformGuard(); + +private: +ID2D1RenderTarget* mpRenderTarget; +D2D1::Matrix3x2F maTransform; +}; + #endif // INCLUDED_VCL_INC_WIN_DWRITERENDERER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index ac70e42b66cf..0f253230c1b4 100644 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -36,6 +36,8 @@ class WinFontInstance : public LogicalFontInstance public: ~WinFontInstance() override; +float getHScale() const; + void SetGraphics(WinSalGraphics*); WinSalGraphics* GetGraphics() const { return m_pGraphics; } diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index 321587db8137..b7d7c03e9995 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -97,20 +97,6 @@ HRESULT checkResult(HRESULT hr, const char* file, size_t line) #endif -// Sets and unsets the needed DirectWrite transform to support the font's rotation. -class WinFontTransformGuard -{ -public: -WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, - const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, - bool bIsVertical); -~WinFontTransformGuard(); - -private: -ID2D1RenderTarget* mpRenderTarget; -D2D1::Matrix3x2F maTransform; -}; - } // end anonymous namespace D2DWriteTextOutRenderer::D2DWriteTextOutRenderer(bool bRenderingModeNatural) @@ -232,6 +218,7 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa } const WinFontInstance& rWinFont = static_cast(rLayout.GetFont()); +float fHScale = rWinFont.getHScale(); float lfEmHeight = 0; IDWriteFontFace* pFontFace = GetDWriteFace(rWinFont, ); @@ -264,11 +251,11 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa while (rLayout.GetNextGlyph(, aPos, nStart)) { UINT16 glyphIndices[] = { static_cast(pGlyph->glyphId()) }; -FLOAT glyphAdvances[] = { static_cast(pGlyph->newWidth()) }; +FLOAT glyphAdvances[] = { static_cast(pGlyph->newWidth()) / fHScale }; DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, }; -D2D1_POINT_2F baseline = { static_cast(aPos.getX() - bounds.Left()), +D2D1_POINT_2F baseline = { static_cast(aPos.getX() - bounds.Left()) / fHScale, static_cast(aPos.getY() - bounds.Top()) }; -WinFontTransformGuard aTransformGuard(mpRT, rLayout, baseline, pGlyph->IsVertical()); +WinFontTransformGuard aTransformGuard(mpRT, fHScale, rLayout, baseline, pGlyph->IsVertical()); DWRITE_GLYPH_RUN glyphs = { pFontFace, lfEmHeight, @@ -319,7 +306,7 @@ IDWriteFontFace* D2DWriteTextOutRenderer::GetDWriteFace(const WinFontInstance& r return pFontFace; } -WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, +WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale, const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, bool bIsVertical) @@ -327,6 +314,11 @@ WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, { pRenderTarget->GetTransform(); D2D1::Matrix3x2F aTransform = maTransform; +if (fHScale != 1.0f) +{ +aTransform += aTransform * D2D1::Matrix3x2F::Scale(D2D1
core.git: Branch 'distro/vector/vector-7.5.9' - 9 commits - vcl/inc vcl/qa vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win vcl/workben
vcl/inc/font/LogicalFontInstance.hxx |5 - vcl/inc/impfontcache.hxx |8 +- vcl/inc/impglyphitem.hxx |6 +- vcl/inc/pdf/pdfbuildin_fonts.hxx |2 vcl/inc/qt5/QtFont.hxx |1 vcl/inc/quartz/salgdi.h|2 vcl/inc/unx/freetype_glyphcache.hxx|2 vcl/inc/unx/glyphcache.hxx |1 vcl/inc/win/DWriteTextRenderer.hxx | 15 - vcl/inc/win/winlayout.hxx |4 - vcl/qa/cppunit/cjktext.cxx |2 vcl/qa/cppunit/fontmocks.hxx |3 - vcl/qa/cppunit/logicalfontinstance.cxx | 67 + vcl/qt5/QtFont.cxx |7 -- vcl/quartz/ctfonts.cxx | 21 --- vcl/skia/gdiimpl.cxx | 15 ++--- vcl/skia/win/gdiimpl.cxx | 33 +--- vcl/skia/x11/textrender.cxx| 10 +-- vcl/source/font/LogicalFontInstance.cxx| 36 +++-- vcl/source/font/fontcache.cxx |4 - vcl/source/gdi/CommonSalLayout.cxx |6 +- vcl/source/gdi/pdfbuildin_fonts.cxx|5 - vcl/source/gdi/pdfwriter_impl.cxx | 29 +- vcl/source/gdi/sallayout.cxx | 37 + vcl/source/outdev/font.cxx |6 +- vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 38 -- vcl/unx/generic/glyphs/glyphcache.cxx |8 -- vcl/win/gdi/DWriteTextRenderer.cxx | 28 ++ vcl/win/gdi/salfont.cxx| 53 --- vcl/win/gdi/winlayout.cxx | 18 -- vcl/workben/listglyphs.cxx |2 31 files changed, 204 insertions(+), 270 deletions(-) New commits: commit 36e8e419d022a9c43302efe5e702a704dea39e76 Author: Mike Kaganski AuthorDate: Mon Apr 8 02:45:28 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 8 10:40:50 2024 +0500 Exclude getHScale from DirectWrite font rendering ... and drop it, since it's unused now. Unkike with Skia, where the ratio produces a visible effect, in DirectWrite the effect seems cancelled by transformations. Yet, it produced computational instability, noticable in small vertical text. Change-Id: I2f3b20913075d1338dc75c5a04c9cc0ef29c75ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165877 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/inc/win/DWriteTextRenderer.hxx b/vcl/inc/win/DWriteTextRenderer.hxx index 67094052ebb5..a655df6459ea 100644 --- a/vcl/inc/win/DWriteTextRenderer.hxx +++ b/vcl/inc/win/DWriteTextRenderer.hxx @@ -72,21 +72,6 @@ private: D2DTextAntiAliasMode meTextAntiAliasMode; }; -/** - * Sets and unsets the needed DirectWrite transform to support the font's horizontal scaling and - * rotation. - */ -class WinFontTransformGuard -{ -public: -WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale, const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, bool bIsVertical); -~WinFontTransformGuard(); - -private: -ID2D1RenderTarget* mpRenderTarget; -D2D1::Matrix3x2F maTransform; -}; - #endif // INCLUDED_VCL_INC_WIN_DWRITERENDERER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index 0f253230c1b4..ac70e42b66cf 100644 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -36,8 +36,6 @@ class WinFontInstance : public LogicalFontInstance public: ~WinFontInstance() override; -float getHScale() const; - void SetGraphics(WinSalGraphics*); WinSalGraphics* GetGraphics() const { return m_pGraphics; } diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index b7d7c03e9995..321587db8137 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -97,6 +97,20 @@ HRESULT checkResult(HRESULT hr, const char* file, size_t line) #endif +// Sets and unsets the needed DirectWrite transform to support the font's rotation. +class WinFontTransformGuard +{ +public: +WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, + const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, + bool bIsVertical); +~WinFontTransformGuard(); + +private: +ID2D1RenderTarget* mpRenderTarget; +D2D1::Matrix3x2F maTransform; +}; + } // end anonymous namespace D2DWriteTextOutRenderer::D2DWriteTextOutRenderer(bool bRenderingModeNatural) @@ -218,7 +232,6 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa } const WinFontInstance& rWinFont = static_cast(rLayout.GetFon
core.git: vcl/inc vcl/win
vcl/inc/win/DWriteTextRenderer.hxx | 15 --- vcl/inc/win/winlayout.hxx |2 -- vcl/win/gdi/DWriteTextRenderer.cxx | 28 ++-- vcl/win/gdi/winlayout.cxx |8 4 files changed, 18 insertions(+), 35 deletions(-) New commits: commit 8557ea84c9336ba8061246f1f46ddb6e02f413a1 Author: Mike Kaganski AuthorDate: Mon Apr 8 02:45:28 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 8 07:12:18 2024 +0200 Exclude getHScale from DirectWrite font rendering ... and drop it, since it's unused now. Unkike with Skia, where the ratio produces a visible effect, in DirectWrite the effect seems cancelled by transformations. Yet, it produced computational instability, noticable in small vertical text. Change-Id: I2f3b20913075d1338dc75c5a04c9cc0ef29c75ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165877 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/inc/win/DWriteTextRenderer.hxx b/vcl/inc/win/DWriteTextRenderer.hxx index d4bb45e5895b..b822a6bca488 100644 --- a/vcl/inc/win/DWriteTextRenderer.hxx +++ b/vcl/inc/win/DWriteTextRenderer.hxx @@ -71,19 +71,4 @@ private: D2DTextAntiAliasMode meTextAntiAliasMode; }; -/** - * Sets and unsets the needed DirectWrite transform to support the font's horizontal scaling and - * rotation. - */ -class WinFontTransformGuard -{ -public: -WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale, const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, bool bIsVertical); -~WinFontTransformGuard(); - -private: -ID2D1RenderTarget* mpRenderTarget; -D2D1::Matrix3x2F maTransform; -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index cfb36e825b54..31066a7db28a 100644 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -36,8 +36,6 @@ class WinFontInstance : public LogicalFontInstance public: ~WinFontInstance() override; -float getHScale() const; - void SetGraphics(WinSalGraphics*); WinSalGraphics* GetGraphics() const { return m_pGraphics; } diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index bb0f7e6b7661..633dcf82b13b 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -93,6 +93,20 @@ HRESULT checkResult(HRESULT hr, const char* location) #endif +// Sets and unsets the needed DirectWrite transform to support the font's rotation. +class WinFontTransformGuard +{ +public: +WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, + const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, + bool bIsVertical); +~WinFontTransformGuard(); + +private: +ID2D1RenderTarget* mpRenderTarget; +D2D1::Matrix3x2F maTransform; +}; + } // end anonymous namespace D2DWriteTextOutRenderer::D2DWriteTextOutRenderer(bool bRenderingModeNatural) @@ -214,7 +228,6 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa } const WinFontInstance& rWinFont = static_cast(rLayout.GetFont()); -float fHScale = rWinFont.getHScale(); float lfEmHeight = 0; IDWriteFontFace* pFontFace = GetDWriteFace(rWinFont, ); @@ -247,11 +260,11 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa while (rLayout.GetNextGlyph(, aPos, nStart)) { UINT16 glyphIndices[] = { static_cast(pGlyph->glyphId()) }; -FLOAT glyphAdvances[] = { static_cast(pGlyph->newWidth()) / fHScale }; +FLOAT glyphAdvances[] = { static_cast(pGlyph->newWidth()) }; DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, }; -D2D1_POINT_2F baseline = { static_cast(aPos.getX() - bounds.Left()) / fHScale, +D2D1_POINT_2F baseline = { static_cast(aPos.getX() - bounds.Left()), static_cast(aPos.getY() - bounds.Top()) }; -WinFontTransformGuard aTransformGuard(mpRT, fHScale, rLayout, baseline, pGlyph->IsVertical()); +WinFontTransformGuard aTransformGuard(mpRT, rLayout, baseline, pGlyph->IsVertical()); DWRITE_GLYPH_RUN glyphs = { pFontFace, lfEmHeight, @@ -302,7 +315,7 @@ IDWriteFontFace* D2DWriteTextOutRenderer::GetDWriteFace(const WinFontInstance& r return pFontFace; } -WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale, +WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, bool b
core.git: Branch 'distro/vector/vector-7.5.9' - 19 commits - basctl/source basic/source editeng/source embeddedobj/source filter/source fpicker/source include/editeng include/filter include/oox includ
| 10 sd/source/ui/dlg/morphdlg.cxx|4 sd/source/ui/dlg/vectdlg.cxx |4 sd/source/ui/inc/DrawDocShell.hxx|3 sd/source/ui/inc/sdtreelb.hxx|2 sd/source/ui/unoidl/sddetect.cxx |2 sd/source/ui/unoidl/unodoc.cxx |4 sfx2/source/appl/appcfg.cxx | 10 sfx2/source/appl/appopen.cxx |3 sfx2/source/appl/sfxpicklist.cxx |6 sfx2/source/appl/xpackcreator.cxx|4 sfx2/source/control/bindings.cxx |1 sfx2/source/doc/objcont.cxx |1 sfx2/source/doc/objxtor.cxx | 38 + sfx2/source/doc/oleprops.cxx |4 sfx2/source/inc/objshimp.hxx |4 sot/qa/cppunit/test_sot.cxx | 20 sot/source/base/object.cxx |6 sot/source/sdstor/storage.cxx| 22 starmath/qa/cppunit/test_cursor.cxx |2 starmath/qa/cppunit/test_node.cxx|2 starmath/qa/cppunit/test_nodetotextvisitors.cxx |2 starmath/qa/cppunit/test_parse.cxx |2 starmath/qa/cppunit/test_starmath.cxx|2 starmath/qa/extras/mmlexport-test.cxx|2 starmath/qa/extras/mmlimport-test.cxx|2 starmath/source/document.cxx |2 starmath/source/eqnolefilehdr.cxx|2 starmath/source/mathtype.cxx | 10 starmath/source/smdetect.cxx |2 starmath/source/unodoc.cxx |2 starmath/source/unofilter.cxx|2 svtools/source/misc/imagemgr.cxx |2 svx/source/gallery2/gallerybinaryengine.cxx | 22 sw/inc/doc.hxx |2 sw/inc/shellio.hxx | 10 sw/qa/core/filters-test.cxx |2 sw/qa/core/macros-test.cxx |2 sw/qa/core/uwriter.cxx |2 sw/qa/extras/htmlexport/htmlexport.cxx |6 sw/qa/extras/layout/data/i84870.fodt | 61 ++ sw/qa/extras/layout/data/tdf160526.fodt | 47 ++ sw/qa/extras/layout/data/tdf160549.fodt | 60 ++ sw/qa/extras/layout/layout2.cxx | 29 + sw/source/core/doc/DocumentLayoutManager.cxx |4 sw/source/core/doc/docnew.cxx|4 sw/source/core/inc/SwXMLTextBlocks.hxx |4 sw/source/core/ole/ndole.cxx |8 sw/source/core/swg/SwXMLTextBlocks.cxx | 14 sw/source/core/text/frmform.cxx | 100 +++- sw/source/filter/basflt/iodetect.cxx |4 sw/source/filter/basflt/shellio.cxx |4 sw/source/filter/html/htmlplug.cxx |2 sw/source/filter/html/htmlreqifreader.cxx| 16 sw/source/filter/writer/writer.cxx |2 sw/source/filter/ww8/wrtw8esh.cxx|6 sw/source/filter/ww8/wrtww8.cxx | 12 sw/source/filter/ww8/wrtww8.hxx |6 sw/source/filter/ww8/wrtww8gr.cxx| 16 sw/source/filter/ww8/ww8glsy.cxx |2 sw/source/filter/ww8/ww8glsy.hxx |8 sw/source/filter/ww8/ww8par.cxx | 36 - sw/source/filter/ww8/ww8par.hxx | 10 sw/source/filter/ww8/ww8par4.cxx | 20 sw/source/filter/ww8/ww8par5.cxx |6 sw/source/ui/uno/swdetect.cxx|4 sw/source/uibase/app/apphdl.cxx |2 sw/source/uibase/app/docsh.cxx |4 sw/source/uibase/app/docsh2.cxx |3 sw/source/uibase/dochdl/swdtflvr.cxx |4 sw/source/uibase/inc/glosdoc.hxx |4 sw/source/uibase/inc/unoatxt.hxx |3 sw/source/uibase/misc/glshell.cxx|4 sw/source/uibase/uno/unodoc.cxx |6 sw/source/uibase/uno/unotxvw.cxx |4 vcl/inc/svdata.hxx |5 vcl/source/app/scheduler.cxx | 70 ++- vcl/source/app/svapp.cxx |4 vcl/source/app/svmain.cxx|3 vcl/win/dtrans/MtaOleClipb.cxx | 35 - vcl/win/dtrans/WinClipboard.cxx | 14 vcl/win/window/salframe.cxx | 10 writerperfect/source/common/WPXSvInputStream.cxx | 30 - 168 files changed, 1329 insertions(+), 815 deletions(-) New commits: commit a49596248ac9004d57d8bb6752c11bce5121 Author: Mike Kaganski AuthorDate: Sun Apr 7 18:23:52 2024 +0500 Commit: Mike
core.git: 3 commits - sw/qa sw/source
sw/qa/extras/layout/data/i84870.fodt| 61 +++ sw/qa/extras/layout/data/tdf160526.fodt | 47 ++ sw/qa/extras/layout/data/tdf160549.fodt | 60 +++ sw/qa/extras/layout/layout3.cxx | 29 + sw/qa/extras/uiwriter/uiwriter3.cxx |5 + sw/source/core/text/frmform.cxx | 101 +++- 6 files changed, 290 insertions(+), 13 deletions(-) New commits: commit ae9e8f3f6d10b0be2fe5b9b238a531b17e0d67da Author: Mike Kaganski AuthorDate: Sun Apr 7 18:23:52 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 7 18:46:59 2024 +0200 tdf#160526, tdf#160549: fix split conditions at page start A single large object in a paragraph must be moved down, when the page has other content before this. On the other hand, there must not be moving down, when an unsuccessful attempt to move was already done (so the master frame is empty), or even the first time, when the frame is at the page body start. Change-Id: Ib8e2fe7b77c622d9cfac22722ca6b55dba7ad8ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165869 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/layout/data/tdf160526.fodt b/sw/qa/extras/layout/data/tdf160526.fodt new file mode 100644 index ..37cf73fb8e18 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf160526.fodt @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Foo + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/layout/data/tdf160549.fodt b/sw/qa/extras/layout/data/tdf160549.fodt new file mode 100644 index ..fd8425eedd86 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf160549.fodt @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + foobar + + + + + + + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index d198b327df3a..b73cff5a32fc 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -2491,6 +2491,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, test_i84870) CPPUNIT_ASSERT_EQUAL(2, getPages()); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf160549) +{ +// Given a document with a large as-char object, alone in its paragraph, shifted down by a +// header object: it must not hang in a layout loop on import (similar to i84870, but not +// fixed by its fix) +createSwDoc("tdf160549.fodt"); +// The object is the first in the document; it must not move to the next page +CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf160526) +{ +// Given a document with a large as-char object, alone in its paragraph, shifted down by +// another body object +createSwDoc("tdf160526.fodt"); +// It must move to the next page +CPPUNIT_ASSERT_EQUAL(2, getPages()); +auto pExportDump = parseLayoutDump(); +assertXPath(pExportDump, "//page[2]/body/txt/anchored/SwAnchoredDrawObject"_ostr); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index e19b834a5618..97eff3e607ec 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1081,6 +1081,54 @@ void SwTextFrame::ChangeOffset( SwTextFrame* pFrame, TextFrameIndex nNew ) MoveFlyInCnt( pFrame, nNew, TextFrameIndex(COMPLETE_STRING) ); } +static bool isFirstVisibleFrameInBody(const SwTextFrame* pFrame) +{ +const SwFrame* pBodyFrame = pFrame->FindBodyFrame(); +if (!pBodyFrame) +return false; +for (const SwFrame* pCur = pFrame;;) +{ +for (const SwFrame* pPrev = pCur->GetPrev(); pPrev; pPrev = pPrev->GetPrev()) +if (!pPrev->IsHiddenNow()) +return false; +pCur = pCur->GetUpper(); +assert(pCur); // We found pBodyFrame, right? +if (pCur->IsBodyFrame()) +return true; +} +} + +static bool hasFly(const SwTextFrame* pFrame) +{ +if (auto pDrawObjs = pFrame->GetDrawObjs(); pDrawObjs && pDrawObjs->size()) +{ +auto anchorId = (*pDrawObjs)[0]->GetFrameFormat()->GetAnchor().GetAnchorId(); +if (anchorId == RndStdIds::FLY_AT_PARA || anchorId == RndStdIds::FLY_AT_CHAR) +return true; +} +return false; +} + +static bool hasAtPageFly(const SwFrame* pFrame) +{ +auto pPageFrame = pFrame->FindPageFrame(); +if (!pPageFrame) +return false; +auto pPageDrawObjs = pPageFrame->GetD
core.git: sw/source
sw/source/core/layout/findfrm.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit fead9c3ea98eb5e6bc01b1dde2a8ab2fa755209d Author: Mike Kaganski AuthorDate: Sun Apr 7 12:38:23 2024 +0100 Commit: Mike Kaganski CommitDate: Sun Apr 7 14:46:34 2024 +0200 Drop a redundant check Change-Id: Ie88dbf29bd03b890a75fb4a1059083bbd939f56e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165837 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index c910ebf48992..7b85f267d26a 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -475,8 +475,6 @@ const SwContentFrame* SwContentFrame::ImplGetNextContentFrame( bool bFwd ) const SwPageFrame* SwFrame::ImplFindPageFrame() { SwFrame *pRet = this; -if (pRet->IsInDtor()) -return nullptr; while ( pRet ) { if (pRet->IsInDtor())
core.git: sw/source
sw/source/core/layout/calcmove.cxx | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) New commits: commit 07f287c58ca4bae4bdc641cc9139f9aaaff24374 Author: Mike Kaganski AuthorDate: Sat Apr 6 13:00:06 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 6 16:09:54 2024 +0200 Simplify a bit Change-Id: I4bfe875d0484bf77472301f9dea3fc4c6dacdbf4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165852 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index e13fdf012143..428c1defe8c2 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1312,7 +1312,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) // #i28701# - move master forward, if it has to move, // because of its object positioning. -if ( !static_cast(this)->IsFollow() ) +if (!IsFollow()) { sal_uInt32 nToPageNum = 0; const bool bMoveFwdByObjPos = SwLayouter::FrameMovedFwdByObjPos( @@ -1333,17 +1333,15 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) MoveFwd( bMakePage, false ); } } - -// If a Follow sits next to its Master and doesn't fit, we know it can -// be moved right now. -if ( lcl_Prev( this ) && static_cast(this)->IsFollow() && IsMoveable() ) +else if (auto* prev = lcl_Prev(this); prev && IsMoveable()) { +// If a Follow sits next to its Master and doesn't fit, we know it can be moved right now. bMovedFwd = true; // If follow frame is in table, its master will be the last in the // current table cell. Thus, invalidate the printing area of the master. if ( IsInTab() ) { -lcl_Prev( this )->InvalidatePrt(); +prev->InvalidatePrt(); } MoveFwd( bMakePage, false ); }
core.git: Branch 'libreoffice-24-2' - sdext/source
sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx | 82 +++-- 1 file changed, 61 insertions(+), 21 deletions(-) New commits: commit 4ad24b828b77b9ebbaf09a08eafa52093349c32f Author: Mike Kaganski AuthorDate: Wed Apr 3 12:40:06 2024 +0500 Commit: Michael Stahl CommitDate: Fri Apr 5 10:49:54 2024 +0200 tdf#160260: make poppler wrapper executable Unicode-aware on Windows Change-Id: I76dc31ee14d1794fa73f990e641540ff941c7201 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165735 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 7b9905df455b47977968a185a7c43f35541e018b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165717 Reviewed-by: Michael Stahl diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx index e924547e9357..383f6810b2a2 100644 --- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx @@ -21,6 +21,8 @@ #ifdef _WIN32 # include # include /*_O_BINARY*/ +#define WIN32_LEAN_AND_MEAN +#include #endif #ifndef SYSTEM_POPPLER #include // std::string @@ -30,24 +32,58 @@ FILE* g_binary_out=stderr; -static const char *ownerPassword = ""; -static const char *userPassword = ""; -static const char *outputFile= ""; -static const char *options = ""; +#ifdef _WIN32 + +// Use Unicode API + +static const wchar_t *ownerPassword = nullptr; +static const wchar_t *userPassword = nullptr; +static const wchar_t *outputFile= nullptr; +static const wchar_t *options = L""; + +#define TO_STRING_VIEW(s) std::wstring_view(L##s) +using my_string = std::wstring; + +// Poppler expects UTF-8 strings on Windows - see its openFile in poppler/goo/gfile.cc. +static std::string myStringToStdString(std::wstring_view s) +{ +int len = WideCharToMultiByte(CP_UTF8, 0, s.data(), s.size(), nullptr, 0, nullptr, nullptr); +char* buff = static_cast(_alloca(len * sizeof(char))); +len = WideCharToMultiByte(CP_UTF8, 0, s.data(), s.size(), buff, len, nullptr, nullptr); +return std::string(buff, len); +} + +#else // ! _WIN32 + +static const char *ownerPassword = nullptr; +static const char *userPassword = nullptr; +static const char *outputFile= nullptr; +static const char *options = ""; +#define TO_STRING_VIEW(s) std::string_view(s) +using my_string = std::string; + +static std::string myStringToStdString(std::string&& s) { return std::move(s); } + +#endif + +#ifdef _WIN32 +int wmain(int argc, wchar_t **argv) +#else int main(int argc, char **argv) +#endif { -int k = 0; +int k = 1; while (k < argc) { -if (!strcmp(argv[k], "-f")) +if (argv[k] == TO_STRING_VIEW("-f")) { outputFile = argv[k+1]; argc -= 2; for (int j = k; j < argc; ++j) argv[j] = argv[j+2]; } -else if (!strcmp(argv[k], "-o")) +else if (argv[k] == TO_STRING_VIEW("-o")) { options = argv[k+1]; argc -= 2; @@ -55,14 +91,14 @@ int main(int argc, char **argv) argv[j] = argv[j+2]; } -else if (!strcmp(argv[k], "-opw")) +else if (argv[k] == TO_STRING_VIEW("-opw")) { ownerPassword = argv[k+1]; argc -= 2; for (int j = k; j < argc; ++j) argv[j] = argv[j+2]; } -else if (!strcmp(argv[k], "-upw")) +else if (argv[k] == TO_STRING_VIEW("-upw")) { userPassword = argv[k+1]; argc -= 2; @@ -79,10 +115,10 @@ int main(int argc, char **argv) /* Creates an absolute path to the poppler_data directory, by taking the path * to the xpdfimport executable (provided in argv[0], and concatenating a * relative path to the poppler_data directory from the program directory. */ -const std::string execPath = argv[0]; -const std::size_t filenameStartPos = execPath.find_last_of("/\")+1; -const std::string programPath = execPath.substr(0,filenameStartPos); -const std::string popplerDataPath = programPath + "../" LIBO_SHARE_FOLDER "/xpdfimport/poppler_data"; +const my_string execPath = argv[0]; +const std::size_t filenameStartPos = execPath.find_last_of(TO_STRING_VIEW("/\")) + 1; +const my_string programPath = execPath.substr(0, filenameStartPos); +const std::string popplerDataPath = myStringToStdString(programPath + my_string(TO_STRING_VIEW("../" LIBO_SHARE_FOLDER "/xpdfimport/poppler_data"))); const char* datadir = popplerDataPath.c_str(); #endif @@ -115,22 +151,26 @@ int main(int argc, char **argv) } // PDFDoc take
core.git: sw/source
sw/source/core/fields/expfld.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 746b21760b911860c7ac497f10ab07d60111e867 Author: Mike Kaganski AuthorDate: Thu Apr 4 15:11:24 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 4 15:12:14 2024 +0200 tdf#81012: avoid content frames in footnotes / endnotes This makes the behavior of the endnotes in the end of sections consistent with the behavior of dedicated endnote pages, where heading fields ignore headings in endnote content. Change-Id: Iad0218b75a678808b1266024fe4c81f040a631c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165789 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index c764f898d93f..adf6097582b8 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -233,7 +233,7 @@ const SwTextNode* GetBodyTextNode( const SwDoc& rDoc, SwPosition& rPos, else pContentFrame = pPgFrame->FindLastBodyContent(); -if( pContentFrame ) +if( pContentFrame && !pContentFrame->IsInFootnote() ) { assert(pContentFrame->IsTextFrame()); SwTextFrame const*const pFrame(static_cast(pContentFrame));
core.git: 2 commits - desktop/source embeddedobj/source include/osl svl/source
desktop/source/deployment/registry/package/dp_package.cxx |9 -- embeddedobj/source/inc/oleembobj.hxx | 16 -- embeddedobj/source/msole/oleembed.cxx |4 +- embeddedobj/source/msole/olevisual.cxx|2 - include/osl/mutex.hxx | 21 ++ svl/source/undo/undo.cxx | 11 --- 6 files changed, 27 insertions(+), 36 deletions(-) New commits: commit 466156f14d8dee7e3e629dd72dc9c40ddc7262e8 Author: Mike Kaganski AuthorDate: Thu Apr 4 12:04:12 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 4 13:21:14 2024 +0200 Use osl::ResettableMutexGuardScopedReleaser instead of ad-hoc guards Change-Id: I2aa09655c207d3647650b5e38011a600bd221699 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165777 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx index 983f242308cf..087a3c829527 100644 --- a/embeddedobj/source/inc/oleembobj.hxx +++ b/embeddedobj/source/inc/oleembobj.hxx @@ -454,26 +454,12 @@ public: css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; -class ClearedMutexArea -{ -public: -ClearedMutexArea(osl::ResettableMutexGuard& guard) -: m_guard(guard) -{ -m_guard.clear(); -} -~ClearedMutexArea() { m_guard.reset(); } - -private: -osl::ResettableMutexGuard& m_guard; -}; - namespace { #if defined(_WIN32) template auto ExecUnlocked(Proc proc, osl::ResettableMutexGuard& guard) { -ClearedMutexArea area(guard); +osl::ResettableMutexGuardScopedReleaser area(guard); return proc(); } #endif diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index a7a2bf661d70..a055ceae2249 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -870,7 +870,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID ) m_aVerbExecutionController.StartControlExecution(); { -ClearedMutexArea clearedMutex(aGuard); +osl::ResettableMutexGuardScopedReleaser clearedMutex(aGuard); m_pOleComponent->ExecuteVerb(nVerbID); m_pOleComponent->SetHostName(m_aContainerName); } @@ -1153,7 +1153,7 @@ sal_Int64 SAL_CALL OleEmbeddedObject::getStatus( sal_Int64 else if ( m_pOleComponent ) { { -ClearedMutexArea clearedMutex(aGuard); +osl::ResettableMutexGuardScopedReleaser clearedMutex(aGuard); m_nStatus = m_pOleComponent->GetMiscStatus(nAspect); } m_nStatusAspect = nAspect; diff --git a/embeddedobj/source/msole/olevisual.cxx b/embeddedobj/source/msole/olevisual.cxx index bcbacffe5d64..7b3e12e7339a 100644 --- a/embeddedobj/source/msole/olevisual.cxx +++ b/embeddedobj/source/msole/olevisual.cxx @@ -365,7 +365,7 @@ embed::VisualRepresentation SAL_CALL OleEmbeddedObject::getPreferredVisualRepres embed::VisualRepresentation aVisualRepr; { -ClearedMutexArea clearedMutex(aGuard); +osl::ResettableMutexGuardScopedReleaser clearedMutex(aGuard); aVisualRepr.Data = m_pOleComponent->getTransferData(aDataFlavor); } aVisualRepr.Flavor = aDataFlavor; diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index 96c937c037ad..488a0538244f 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -283,16 +283,7 @@ namespace svl::undo::impl ~UndoManagerGuard(); -struct ResetGuard { -ResetGuard(osl::ResettableMutexGuard& r) : rGuard(r) {} -~ResetGuard() { rGuard.reset(); } -osl::ResettableMutexGuard& rGuard; -}; -ResetGuard clear() -{ -m_aGuard.clear(); -return ResetGuard(m_aGuard); -} +auto clear() { return osl::ResettableMutexGuardScopedReleaser(m_aGuard); } void cancelNotifications() { commit 6eefe3a29df4b0862a455a2d057e4a7d88457c71 Author: Mike Kaganski AuthorDate: Thu Apr 4 11:26:53 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 4 13:21:09 2024 +0200 Introduce ResettableMutexGuardScopedReleaser And use it to guarantee reretting a guard, without having to do that explicitly in exception handlers. Change-Id: I4727cb5b7f37b25e203396957797d24a093e0797 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165775 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index d5c1feeb4992..494ce437e1e9 100644 --- a/desktop/source/deployment/registry/packa
core.git: sw/source
sw/source/core/layout/trvlfrm.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d33a43a76c3ad6d38f7c2dca0ff5386ee5264bce Author: Mike Kaganski AuthorDate: Thu Apr 4 10:51:10 2024 +0100 Commit: Mike Kaganski CommitDate: Thu Apr 4 13:11:08 2024 +0200 Drop one redundant check Change-Id: I0ae90e10fad2d6e41d855ead69b8cdcf8d53f525 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165719 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index aa1a255fc421..07801bf93164 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -1205,7 +1205,7 @@ const SwContentFrame *SwLayoutFrame::GetContentPos( Point& rPoint, if ( !pContent && (GetPrev() && !bDontLeave) ) pContent = ContainsContent(); -if ( bBodyOnly && pContent && !pContent->IsInDocBody() ) +if ( bBodyOnly ) while ( pContent && !pContent->IsInDocBody() ) pContent = pContent->GetNextContentFrame();
core.git: sdext/source
sdext/source/pdfimport/wrapper/wrapper.cxx | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) New commits: commit 65a57e5c7c3770d788e076303a7182de43a17cbf Author: Mike Kaganski AuthorDate: Thu Apr 4 10:50:56 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 4 09:21:49 2024 +0200 A small refactor Change-Id: I299cc7c2850a71ee563824c6361707d894f5ddcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165773 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 6a17d295eae1..86c0d3cf806f 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -61,6 +61,7 @@ #include #include #include +#include #include using namespace com::sun::star; @@ -1081,10 +1082,13 @@ bool xpdf_ImportFromFile(const OUString& rURL, // spawn separate process to keep LGPL/GPL code apart. -OUString aOptFlag("-o"); -rtl_uString* args[] = { aSysUPath.pData, - aOptFlag.pData, rFilterOptions.pData }; -sal_Int32 nArgs = rFilterOptions.isEmpty() ? std::size(args) - 2 : std::size(args); +constexpr OUString aOptFlag(u"-o"_ustr); +std::vector args({ aSysUPath.pData }); +if (!rFilterOptions.isEmpty()) +{ +args.push_back(aOptFlag.pData); +args.push_back(rFilterOptions.pData); +} oslProcessaProcess; oslFileHandle pIn = nullptr; @@ -1093,8 +1097,8 @@ bool xpdf_ImportFromFile(const OUString& rURL, oslSecurity pSecurity = osl_getCurrentSecurity (); oslProcessError eErr = osl_executeProcess_WithRedirectedIO(converterURL.pData, -args, -nArgs, +args.data(), +args.size(), osl_Process_SEARCHPATH|osl_Process_HIDDEN, pSecurity, nullptr, nullptr, 0,
core.git: sdext/source
sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |2 +- sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 9e47e217126d421e51e167da0d94a5d7c2f078ed Author: Mike Kaganski AuthorDate: Thu Apr 4 10:29:48 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 4 09:05:12 2024 +0200 Drop a bit of redundancy POPPLER_CHECK_VERSION(0, 23, 0) implies POPPLER_CHECK_VERSION(0, 24, 0) Change-Id: I48f3763ef115719a3e3615623bfb40f7c79b8df4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165772 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index 603155a2036e..57164f27cb42 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -626,7 +626,7 @@ PDFOutDev::~PDFOutDev() } void PDFOutDev::startPage(int /*pageNum*/, GfxState* state -#if POPPLER_CHECK_VERSION(0, 23, 0) || POPPLER_CHECK_VERSION(0, 24, 0) +#if POPPLER_CHECK_VERSION(0, 23, 0) , XRef* /*xref*/ #endif ) diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx index 2a8078422def..6a35d119314b 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx @@ -179,7 +179,7 @@ namespace pdfi // Start a page. virtual void startPage(int pageNum, GfxState *state -#if POPPLER_CHECK_VERSION(0, 23, 0) || POPPLER_CHECK_VERSION(0, 24, 0) +#if POPPLER_CHECK_VERSION(0, 23, 0) , XRef *xref #endif ) override;
core.git: sdext/Package_pdfimport_xpdfimport.mk sdext/source
dev/null |binary sdext/Package_pdfimport_xpdfimport.mk |2 -- sdext/source/pdfimport/wrapper/wrapper.cxx | 17 +++-- sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx | 21 ++--- 4 files changed, 9 insertions(+), 31 deletions(-) New commits: commit cc895651302dc42dfb91ef06c41872d9dae8dd44 Author: Mike Kaganski AuthorDate: Thu Apr 4 09:41:50 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Apr 4 08:29:35 2024 +0200 Related: tdf#160260 Drop xpdfimport.err.pdf, let PDF import return false The problem was, that upon any error in opening a PDF, out Poppler wrapper used another bundled document, with a single page with a static text "This PDF file is encrypted and can't be opened.". That happened regardless of the nature of the problem (it could be an IO problem, as in tdf#160260, or other things from Poppler's poppler/ErrorCodes.h). For automated import (command line or API), it meant that it was not possible to detect the failure. This replaces this strange mechanism with a normal error reporting. For now, a simple "general input/output error" will be reported; but it is possible to use interaction handler to show details (see comment in xpdf_ImportFromFile). Change-Id: I30493118fc5dd0b1c62cae7718acfe95bb4b13b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165771 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sdext/Package_pdfimport_xpdfimport.mk b/sdext/Package_pdfimport_xpdfimport.mk index 9f08e05f4773..c1c82814aa77 100644 --- a/sdext/Package_pdfimport_xpdfimport.mk +++ b/sdext/Package_pdfimport_xpdfimport.mk @@ -9,6 +9,4 @@ $(eval $(call gb_Package_Package,sdext_pdfimport_pdf,$(SRCDIR)/sdext)) -$(eval $(call gb_Package_add_file,sdext_pdfimport_pdf,$(LIBO_SHARE_FOLDER)/xpdfimport/xpdfimport_err.pdf,source/pdfimport/dialogs/xpdfimport_err.pdf)) - # vim: set noet sw=4 ts=4: diff --git a/sdext/source/pdfimport/dialogs/xpdfimport_err.pdf b/sdext/source/pdfimport/dialogs/xpdfimport_err.pdf deleted file mode 100644 index dc0f9292c680.. Binary files a/sdext/source/pdfimport/dialogs/xpdfimport_err.pdf and /dev/null differ diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index d99103b9867a..6a17d295eae1 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -1079,24 +1079,12 @@ bool xpdf_ImportFromFile(const OUString& rURL, OUString converterURL("$BRAND_BASE_DIR/" LIBO_BIN_FOLDER "/xpdfimport"); rtl::Bootstrap::expandMacros(converterURL); //TODO: detect failure -// Determine pathname of xpdfimport_err.pdf: -OUString errPathname("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/xpdfimport/xpdfimport_err.pdf"); -rtl::Bootstrap::expandMacros(errPathname); //TODO: detect failure -if (osl::FileBase::getSystemPathFromFileURL(errPathname, errPathname) -!= osl::FileBase::E_None) -{ -SAL_WARN( -"sdext.pdfimport", -"getSystemPathFromFileURL(" << errPathname << ") failed"); -return false; -} - // spawn separate process to keep LGPL/GPL code apart. OUString aOptFlag("-o"); -rtl_uString* args[] = { aSysUPath.pData, errPathname.pData, +rtl_uString* args[] = { aSysUPath.pData, aOptFlag.pData, rFilterOptions.pData }; -sal_Int32 nArgs = rFilterOptions.isEmpty() ? 2 : 4; +sal_Int32 nArgs = rFilterOptions.isEmpty() ? std::size(args) - 2 : std::size(args); oslProcessaProcess; oslFileHandle pIn = nullptr; @@ -1206,6 +1194,7 @@ bool xpdf_ImportFromFile(const OUString& rURL, "sdext.pdfimport", "getProcessInfo of " << converterURL << " failed with exit code " << info.Code); +// TODO: use xIHdl and/or exceptions to inform the user; see poppler/ErrorCodes.h bRet = false; } } diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx index 383f6810b2a2..ebed120708cc 100644 --- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx @@ -152,7 +152,6 @@ int main(int argc, char **argv) // PDFDoc takes over ownership for all strings below GooString* pFileName = new GooString(myStringToStdString(argv[1])); -GooString* pErrFileName = new GooString(myStringToStdString(argv[2])); // check for password string(s) GooString* pOwnerPasswordStr( aPwBuf[0] != 0 @@ -182,30 +181,22 @@ int main(int argc, char **argv) PDFDoc aDoc( std::
core.git: sdext/source
sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx | 82 +++-- 1 file changed, 61 insertions(+), 21 deletions(-) New commits: commit 7b9905df455b47977968a185a7c43f35541e018b Author: Mike Kaganski AuthorDate: Wed Apr 3 12:40:06 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Apr 3 22:11:17 2024 +0200 tdf#160260: make poppler wrapper executable Unicode-aware on Windows Change-Id: I76dc31ee14d1794fa73f990e641540ff941c7201 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165735 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx index e924547e9357..383f6810b2a2 100644 --- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx @@ -21,6 +21,8 @@ #ifdef _WIN32 # include # include /*_O_BINARY*/ +#define WIN32_LEAN_AND_MEAN +#include #endif #ifndef SYSTEM_POPPLER #include // std::string @@ -30,24 +32,58 @@ FILE* g_binary_out=stderr; -static const char *ownerPassword = ""; -static const char *userPassword = ""; -static const char *outputFile= ""; -static const char *options = ""; +#ifdef _WIN32 + +// Use Unicode API + +static const wchar_t *ownerPassword = nullptr; +static const wchar_t *userPassword = nullptr; +static const wchar_t *outputFile= nullptr; +static const wchar_t *options = L""; + +#define TO_STRING_VIEW(s) std::wstring_view(L##s) +using my_string = std::wstring; + +// Poppler expects UTF-8 strings on Windows - see its openFile in poppler/goo/gfile.cc. +static std::string myStringToStdString(std::wstring_view s) +{ +int len = WideCharToMultiByte(CP_UTF8, 0, s.data(), s.size(), nullptr, 0, nullptr, nullptr); +char* buff = static_cast(_alloca(len * sizeof(char))); +len = WideCharToMultiByte(CP_UTF8, 0, s.data(), s.size(), buff, len, nullptr, nullptr); +return std::string(buff, len); +} + +#else // ! _WIN32 + +static const char *ownerPassword = nullptr; +static const char *userPassword = nullptr; +static const char *outputFile= nullptr; +static const char *options = ""; +#define TO_STRING_VIEW(s) std::string_view(s) +using my_string = std::string; + +static std::string myStringToStdString(std::string&& s) { return std::move(s); } + +#endif + +#ifdef _WIN32 +int wmain(int argc, wchar_t **argv) +#else int main(int argc, char **argv) +#endif { -int k = 0; +int k = 1; while (k < argc) { -if (!strcmp(argv[k], "-f")) +if (argv[k] == TO_STRING_VIEW("-f")) { outputFile = argv[k+1]; argc -= 2; for (int j = k; j < argc; ++j) argv[j] = argv[j+2]; } -else if (!strcmp(argv[k], "-o")) +else if (argv[k] == TO_STRING_VIEW("-o")) { options = argv[k+1]; argc -= 2; @@ -55,14 +91,14 @@ int main(int argc, char **argv) argv[j] = argv[j+2]; } -else if (!strcmp(argv[k], "-opw")) +else if (argv[k] == TO_STRING_VIEW("-opw")) { ownerPassword = argv[k+1]; argc -= 2; for (int j = k; j < argc; ++j) argv[j] = argv[j+2]; } -else if (!strcmp(argv[k], "-upw")) +else if (argv[k] == TO_STRING_VIEW("-upw")) { userPassword = argv[k+1]; argc -= 2; @@ -79,10 +115,10 @@ int main(int argc, char **argv) /* Creates an absolute path to the poppler_data directory, by taking the path * to the xpdfimport executable (provided in argv[0], and concatenating a * relative path to the poppler_data directory from the program directory. */ -const std::string execPath = argv[0]; -const std::size_t filenameStartPos = execPath.find_last_of("/\")+1; -const std::string programPath = execPath.substr(0,filenameStartPos); -const std::string popplerDataPath = programPath + "../" LIBO_SHARE_FOLDER "/xpdfimport/poppler_data"; +const my_string execPath = argv[0]; +const std::size_t filenameStartPos = execPath.find_last_of(TO_STRING_VIEW("/\")) + 1; +const my_string programPath = execPath.substr(0, filenameStartPos); +const std::string popplerDataPath = myStringToStdString(programPath + my_string(TO_STRING_VIEW("../" LIBO_SHARE_FOLDER "/xpdfimport/poppler_data"))); const char* datadir = popplerDataPath.c_str(); #endif @@ -115,22 +151,26 @@ int main(int argc, char **argv) } // PDFDoc takes over ownership for all strings below -GooString* pFileName= new GooString(argv[1]); -GooString* pErrFileName = new GooString(argv[2]); +GooString* pFil
core.git: editeng/source include/editeng oox/source sd/qa sd/source svx/source
editeng/source/editeng/impedit.hxx | 16 +++--- editeng/source/editeng/impedit3.cxx| 50 ++--- editeng/source/outliner/outliner.cxx |8 +-- include/editeng/editdata.hxx | 18 ++- oox/source/drawingml/textbodypropertiescontext.cxx |4 - oox/source/export/drawingml.cxx|4 - sd/qa/unit/TextFittingTest.cxx | 22 - sd/source/ui/dlg/NotesChildWindow.cxx |2 sd/source/ui/view/drtxtob.cxx |4 - svx/source/svdraw/svdotext.cxx | 22 - svx/source/svdraw/svdotextdecomposition.cxx|2 svx/source/unodraw/unoshape.cxx|8 +-- 12 files changed, 76 insertions(+), 84 deletions(-) New commits: commit a3daf52dd21ae03a8b04e1f9132a6713c9cc414f Author: Mike Kaganski AuthorDate: Tue Apr 2 11:16:30 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Apr 3 16:41:59 2024 +0200 Base scale on 1.0, not on 100.0 Simplifies things by avoiding many repeated multiplications / divisions by 100 during calculations. Change-Id: Ib063d343549139c8d83e5b06570dc61f39ea0df6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165666 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index e09712f74bad..07f6af002358 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -780,34 +780,34 @@ private: double scaleXSpacingValue(tools::Long nXValue) const { -if (!maStatus.DoStretch() || maScalingParameters.fSpacingX == 100.0) +if (!maStatus.DoStretch() || maScalingParameters.fSpacingX == 1.0) return nXValue; -return double(nXValue) * (maScalingParameters.fSpacingX / 100.0); +return double(nXValue) * maScalingParameters.fSpacingX; } double scaleYSpacingValue(sal_uInt16 nYValue) const { -if (!maStatus.DoStretch() || maScalingParameters.fSpacingY == 100.0) +if (!maStatus.DoStretch() || maScalingParameters.fSpacingY == 1.0) return nYValue; -return double(nYValue) * (maScalingParameters.fSpacingY / 100.0); +return double(nYValue) * maScalingParameters.fSpacingY; } double scaleXFontValue(tools::Long nXValue) const { -if (!maStatus.DoStretch() || (maScalingParameters.fFontX == 100.0)) +if (!maStatus.DoStretch() || (maScalingParameters.fFontX == 1.0)) return nXValue; -return double(nXValue) * (maScalingParameters.fFontX / 100.0); +return double(nXValue) * maScalingParameters.fFontX; } double scaleYFontValue(sal_uInt16 nYValue) const { -if (!maStatus.DoStretch() || (maScalingParameters.fFontY == 100.0)) +if (!maStatus.DoStretch() || (maScalingParameters.fFontY == 1.0)) return nYValue; -return double(nYValue) * (maScalingParameters.fFontY / 100.0); +return double(nYValue) * maScalingParameters.fFontY; } void setRoundToNearestPt(bool bRound) { mbRoundToNearestPt = bRound; } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index a2dee889aa63..75fe99e684ee 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -447,19 +447,19 @@ namespace { constexpr std::array constScaleLevels = { -ScalingParameters{100.0, 100.0, 100.0, 90.0 }, -ScalingParameters{ 92.5, 92.5, 100.0, 90.0 }, -ScalingParameters{ 92.5, 92.5, 100.0, 80.0 }, -ScalingParameters{ 85.0, 85.0, 100.0, 90.0 }, -ScalingParameters{ 85.0, 85.0, 100.0, 80.0 }, -ScalingParameters{ 77.5, 77.5, 100.0, 80.0 }, -ScalingParameters{ 70.0, 70.0, 100.0, 80.0 }, -ScalingParameters{ 62.5, 62.5, 100.0, 80.0 }, -ScalingParameters{ 55.0, 55.0, 100.0, 80.0 }, -ScalingParameters{ 47.5, 47.5, 100.0, 80.0 }, -ScalingParameters{ 40.0, 40.0, 100.0, 80.0 }, -ScalingParameters{ 32.5, 32.5, 100.0, 80.0 }, -ScalingParameters{ 25.0, 25.0, 100.0, 80.0 }, +ScalingParameters{ 1.000, 1.000, 1.0, 0.9 }, +ScalingParameters{ 0.925, 0.925, 1.0, 0.9 }, +ScalingParameters{ 0.925, 0.925, 1.0, 0.8 }, +ScalingParameters{ 0.850, 0.850, 1.0, 0.9 }, +ScalingParameters{ 0.850, 0.850, 1.0, 0.8 }, +ScalingParameters{ 0.775, 0.775, 1.0, 0.8 }, +ScalingParameters{ 0.700, 0.700, 1.0, 0.8 }, +ScalingParameters{ 0.625, 0.625, 1.0, 0.8 }, +ScalingParameters{ 0.550, 0.550, 1.0, 0.8 }, +ScalingParameters{ 0.475, 0.475, 1.0, 0.8 }, +ScalingParameters{ 0.400, 0.400, 1.0, 0.8 }, +ScalingParameters{ 0.325, 0.325, 1.0, 0.8 }, +ScalingParameters{ 0.250, 0.250, 1.0, 0.8 }, }; } // end anonymous ns @@ -1069,8 +1069,8 @@ bool
core.git: sal/osl unotools/source
sal/osl/w32/tempfile.cxx | 16 unotools/source/ucbhelper/tempfile.cxx | 61 + 2 files changed, 40 insertions(+), 37 deletions(-) New commits: commit 68e2b820489f01c38106a606740ef746c0cf4c9f Author: Mike Kaganski AuthorDate: Wed Apr 3 12:17:54 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Apr 3 12:31:33 2024 +0200 Allow custom "eye catcher" from LO_TESTNAME in tempfiles on Windows Change-Id: Id8d94af9e03d0c8553d0a7949e4a9259159481cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165732 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sal/osl/w32/tempfile.cxx b/sal/osl/w32/tempfile.cxx index f0065bf2d8ef..30f879573de4 100644 --- a/sal/osl/w32/tempfile.cxx +++ b/sal/osl/w32/tempfile.cxx @@ -85,6 +85,20 @@ static oslFileError osl_setup_createTempFile_impl_( return osl_error; } +static LPCWSTR getEyeCatcher() +{ +static const OUString sEyeCatcher = [] +{ +OUString eyeCatcher = u" +#ifdef DBG_UTIL +if (const wchar_t* eye = _wgetenv(L"LO_TESTNAME")) +eyeCatcher = OUString(o3tl::toU(eye), wcslen(eye) + 1); // including terminating nul +#endif +return eyeCatcher; +}(); +return o3tl::toW(sEyeCatcher.getStr()); +} + static oslFileError osl_win32_GetTempFileName_impl_( rtl_uString* base_directory, LPWSTR temp_file_name) { @@ -92,7 +106,7 @@ static oslFileError osl_win32_GetTempFileName_impl_( if (GetTempFileNameW( o3tl::toW(rtl_uString_getStr(base_directory)), -L"", +getEyeCatcher(), 0, temp_file_name) == 0) { diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index 3b2a7c604b4c..149a1413c37a 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -273,53 +274,41 @@ OUString lcl_createName( return OUString(); } -OUString CreateTempName_Impl( const OUString* pParent, bool bKeep, bool bDir = true ) +const OUString& getEyeCatcher() { -OUString aEyeCatcher = "lu"; -#ifdef UNX -#ifdef DBG_UTIL -const char* eye = getenv("LO_TESTNAME"); -if(eye) +static const OUString sEyeCatcher = [] { -aEyeCatcher = OUString(eye, strlen(eye), RTL_TEXTENCODING_ASCII_US); -} -#else -static const pid_t pid = getpid(); -static const OUString aPidString = OUString::number(pid); -aEyeCatcher += aPidString; +OUString eyeCatcher = u"lu"_ustr; +#ifdef DBG_UTIL +#ifdef UNX +if (const char* eye = getenv("LO_TESTNAME")) +eyeCatcher = OUString(eye, strlen(eye), RTL_TEXTENCODING_ASCII_US); +#elif defined(_WIN32) +if (const wchar_t* eye = _wgetenv(L"LO_TESTNAME")) +eyeCatcher = OUString(o3tl::toU(eye)); #endif +#else +#ifdef UNX +eyeCatcher += OUString::number(getpid()); #elif defined(_WIN32) -static const int pid = _getpid(); -static const OUString aPidString = OUString::number(pid); -aEyeCatcher += aPidString; +eyeCatcher += OUString::number(_getpid()); +#endif #endif +return eyeCatcher; +}(); +return sEyeCatcher; +} + +OUString CreateTempName_Impl( const OUString* pParent, bool bKeep, bool bDir = true ) +{ UniqueTokens t; -return lcl_createName( aEyeCatcher, t, u"", pParent, bDir, bKeep, +return lcl_createName( getEyeCatcher(), t, u"", pParent, bDir, bKeep, false, false); } OUString CreateTempNameFast() { -OUString aEyeCatcher = "lu"; -#ifdef UNX -#ifdef DBG_UTIL -const char* eye = getenv("LO_TESTNAME"); -if(eye) -{ -aEyeCatcher = OUString(eye, strlen(eye), RTL_TEXTENCODING_ASCII_US); -} -#else -static const pid_t pid = getpid(); -static const OUString aPidString = OUString::number(pid); -aEyeCatcher += aPidString; -#endif -#elif defined(_WIN32) -static const int pid = _getpid(); -static const OUString aPidString = OUString::number(pid); -aEyeCatcher += aPidString; -#endif - -OUString aName = getTempNameBase_Impl() + aEyeCatcher; +OUString aName = getTempNameBase_Impl() + getEyeCatcher(); tools::Guid aGuid(tools::Guid::Generate);
core.git: Branch 'libreoffice-24-2' - basic/CppunitTest_basic_scanner.mk basic/Library_sb.mk basic/source
basic/CppunitTest_basic_scanner.mk |6 basic/Library_sb.mk|6 basic/source/runtime/runtime.cxx | 46 +++-- 3 files changed, 41 insertions(+), 17 deletions(-) New commits: commit b4abb5ee77c6894cd9a9ef3d5f66e868b591d02c Author: Mike Kaganski AuthorDate: Tue Apr 2 20:34:00 2024 +0500 Commit: Xisco Fauli CommitDate: Wed Apr 3 10:53:05 2024 +0200 tdf#160478: fix Basic LIKE operator 1. The regex must match the whole input. Thus, the ^ and $ metacharacters must be replaced with \A and \z, which only match beginning and end of input, not any line start / end. 2. The * and ? metacharacters of LIKE must match newline character; thus, search flags must include UREGEX_DOTALL. To avoid changing TextSearch implementation, I use icu::RegexMatcher directly. The direct use of icu::RegexMatcher also allowed to simplify the code by calling icu::RegexMatcher::matches method. This may perform better than general-purpose utl::TextSearch::SearchForward. Change-Id: I75776498b36f236da294462362ed5b36ed8cdf68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165700 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165704 diff --git a/basic/CppunitTest_basic_scanner.mk b/basic/CppunitTest_basic_scanner.mk index 55a6e0faf311..03701864f8f7 100644 --- a/basic/CppunitTest_basic_scanner.mk +++ b/basic/CppunitTest_basic_scanner.mk @@ -11,6 +11,12 @@ $(eval $(call gb_CppunitTest_CppunitTest,basic_scanner)) $(eval $(call gb_CppunitTest_use_ure,basic_scanner)) +$(eval $(call gb_CppunitTest_use_externals,basic_scanner,\ + icu_headers \ +icuuc \ +icui18n \ +)) + $(eval $(call gb_CppunitTest_add_exception_objects,basic_scanner, \ basic/qa/cppunit/test_scanner \ )) diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk index 8076f0995873..4976eb5eda8b 100644 --- a/basic/Library_sb.mk +++ b/basic/Library_sb.mk @@ -25,6 +25,12 @@ $(eval $(call gb_Library_set_include,sb,\ -I$(SRCDIR)/basic/source/inc \ )) +$(eval $(call gb_Library_use_externals,sb,\ + icu_headers \ +icuuc \ +icui18n \ +)) + $(eval $(call gb_Library_set_precompiled_header,sb,basic/inc/pch/precompiled_sb)) $(eval $(call gb_Library_use_custom_headers,sb,\ diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index bdde50944a1d..7ae67251160a 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -49,9 +49,7 @@ #include #include -#include -#include -#include +#include #include @@ -1466,7 +1464,7 @@ namespace int seenright = 0; -sResult.append('^'); +sResult.append("\A"); // Match at the beginning of the input while (start < end) { @@ -1530,7 +1528,7 @@ namespace } } -sResult.append('$'); +sResult.append("\z"); // Match if the current position is at the end of input return sResult.makeStringAndClear(); } @@ -1541,15 +1539,8 @@ void SbiRuntime::StepLIKE() SbxVariableRef refVar1 = PopVar(); SbxVariableRef refVar2 = PopVar(); -OUString pattern = VBALikeToRegexp(refVar1->GetOUString()); OUString value = refVar2->GetOUString(); - -i18nutil::SearchOptions2 aSearchOpt; - -aSearchOpt.AlgorithmType2 = css::util::SearchAlgorithms2::REGEXP; - -aSearchOpt.Locale = Application::GetSettings().GetLanguageTag().getLocale(); -aSearchOpt.searchString = pattern; +OUString regex = VBALikeToRegexp(refVar1->GetOUString()); bool bTextMode(true); bool bCompatibility = ( GetSbData()->pInst && GetSbData()->pInst->IsCompatibility() ); @@ -1557,14 +1548,35 @@ void SbiRuntime::StepLIKE() { bTextMode = IsImageFlag( SbiImageFlags::COMPARETEXT ); } +sal_uInt32 searchFlags = UREGEX_UWORD | UREGEX_DOTALL; // Dot matches newline if( bTextMode ) { -aSearchOpt.transliterateFlags |= TransliterationFlags::IGNORE_CASE; +searchFlags |= UREGEX_CASE_INSENSITIVE; +} + +static sal_uInt32 cachedSearchFlags = 0; +static OUString cachedRegex; +static std::optional oRegexMatcher; +UErrorCode nIcuErr = U_ZERO_ERROR; +if (regex != cachedRegex || searchFlags != cachedSearchFlags || !oRegexMatcher) +{ +cachedRegex = regex; +cachedSearchFlags = searchFlags; +icu::UnicodeString sRegex(false, reinterpret_cast(cachedRegex.getStr()), + cachedRegex.getLength()); +oRegexMatcher.emplace(sRegex, cachedSearchFlags, nIcuErr); +} + +icu::UnicodeString sSource(false, reinterpret_cast(value.getStr()), + value.getLength()); +oRegexMatcher->reset(sSource); + +bool bRes
core.git: basic/source
basic/source/runtime/runtime.cxx | 95 --- 1 file changed, 30 insertions(+), 65 deletions(-) New commits: commit f2482fd96eff00b806fae385096531f63f5f2bf5 Author: Mike Kaganski AuthorDate: Tue Apr 2 23:57:16 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Apr 3 04:35:10 2024 +0200 Simplify VBALikeToRegexp a bit This cleans up some unnecessary escaping both inside and outside [] groups. Change-Id: I5abcf0fce634f0d8809bf4d318f61b8c8f69a318 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165703 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 20bbedc9d6f0..b2f493689c0b 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1436,99 +1436,64 @@ void SbiRuntime::StepGE() { StepCompare( SbxGE ); } namespace { -bool NeedEsc(sal_Unicode cCode) +OUString VBALikeToRegexp(std::u16string_view sIn) { -if(!rtl::isAscii(cCode)) -{ -return false; -} -switch(cCode) -{ -case '.': -case '^': -case '$': -case '+': -case '\': -case '|': -case '{': -case '}': -case '(': -case ')': -return true; -default: -return false; -} -} - -OUString VBALikeToRegexp(const OUString ) -{ -OUStringBuffer sResult; -const sal_Unicode *start = rIn.getStr(); -const sal_Unicode *end = start + rIn.getLength(); - -int seenright = 0; - -sResult.append("\A"); // Match at the beginning of the input +OUStringBuffer sResult("\A"); // Match at the beginning of the input -while (start < end) +for (auto start = sIn.begin(), end = sIn.end(); start < end;) { -switch (*start) +switch (auto ch = *start++) { case '?': sResult.append('.'); -start++; break; case '*': sResult.append(".*"); -start++; break; case '#': sResult.append("[0-9]"); -start++; -break; -case ']': -sResult.append('\'); -sResult.append(*start++); break; case '[': -sResult.append(*start++); -seenright = 0; -if (start < end && *start == '!') +sResult.append(ch); +if (start < end) { -sResult.append('^'); -start++; +if (*start == '!') +{ +sResult.append('^'); +++start; +} +else if (*start == '^') +sResult.append('\'); } -while (start < end && !seenright) +for (bool seenright = false; start < end && !seenright; ++start) { switch (*start) { case '[': -case '?': -case '*': +case '\': sResult.append('\'); -sResult.append(*start); break; case ']': -sResult.append(*start); -seenright = 1; -break; -default: -if (NeedEsc(*start)) -{ -sResult.append('\'); -} -sResult.append(*start); +seenright = true; break; } -start++; +sResult.append(*start); } break; +case '.': +case '^': +case '$': +case '+': +case '\': +case '|': +case '{': +case '}': +case '(': +case ')': +sResult.append('\'); +[[fallthrough]]; default: -if (NeedEsc(*start)) -{ -sResult.append('\'); -} -sResult.append(*start++); +sResult.append(ch); } }
core.git: basic/CppunitTest_basic_scanner.mk basic/Library_sb.mk basic/source
basic/CppunitTest_basic_scanner.mk |6 basic/Library_sb.mk|6 basic/source/runtime/runtime.cxx | 45 +++-- 3 files changed, 41 insertions(+), 16 deletions(-) New commits: commit 38f731ff67142a423aa6f46dc3e92d094f86ffb1 Author: Mike Kaganski AuthorDate: Tue Apr 2 20:34:00 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Apr 2 19:47:35 2024 +0200 tdf#160478: fix Basic LIKE operator 1. The regex must match the whole input. Thus, the ^ and $ metacharacters must be replaced with \A and \z, which only match beginning and end of input, not any line start / end. 2. The * and ? metacharacters of LIKE must match newline character; thus, search flags must include UREGEX_DOTALL. To avoid changing TextSearch implementation, I use icu::RegexMatcher directly. The direct use of icu::RegexMatcher also allowed to simplify the code by calling icu::RegexMatcher::matches method. This may perform better than general-purpose utl::TextSearch::SearchForward. Change-Id: I75776498b36f236da294462362ed5b36ed8cdf68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165700 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/basic/CppunitTest_basic_scanner.mk b/basic/CppunitTest_basic_scanner.mk index 55a6e0faf311..03701864f8f7 100644 --- a/basic/CppunitTest_basic_scanner.mk +++ b/basic/CppunitTest_basic_scanner.mk @@ -11,6 +11,12 @@ $(eval $(call gb_CppunitTest_CppunitTest,basic_scanner)) $(eval $(call gb_CppunitTest_use_ure,basic_scanner)) +$(eval $(call gb_CppunitTest_use_externals,basic_scanner,\ + icu_headers \ +icuuc \ +icui18n \ +)) + $(eval $(call gb_CppunitTest_add_exception_objects,basic_scanner, \ basic/qa/cppunit/test_scanner \ )) diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk index b0e6e454a99b..be0cbaeef005 100644 --- a/basic/Library_sb.mk +++ b/basic/Library_sb.mk @@ -25,6 +25,12 @@ $(eval $(call gb_Library_set_include,sb,\ -I$(SRCDIR)/basic/source/inc \ )) +$(eval $(call gb_Library_use_externals,sb,\ + icu_headers \ +icuuc \ +icui18n \ +)) + $(eval $(call gb_Library_set_precompiled_header,sb,basic/inc/pch/precompiled_sb)) $(eval $(call gb_Library_use_custom_headers,sb,\ diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 5d8a2ba2ffc3..20bbedc9d6f0 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -49,9 +49,7 @@ #include #include -#include -#include -#include +#include #include @@ -1470,7 +1468,7 @@ namespace int seenright = 0; -sResult.append('^'); +sResult.append("\A"); // Match at the beginning of the input while (start < end) { @@ -1534,7 +1532,7 @@ namespace } } -sResult.append('$'); +sResult.append("\z"); // Match if the current position is at the end of input return sResult.makeStringAndClear(); } @@ -1546,13 +1544,7 @@ void SbiRuntime::StepLIKE() SbxVariableRef refVar2 = PopVar(); OUString value = refVar2->GetOUString(); - -i18nutil::SearchOptions2 aSearchOpt; - -aSearchOpt.AlgorithmType2 = css::util::SearchAlgorithms2::REGEXP; - -aSearchOpt.Locale = Application::GetSettings().GetLanguageTag().getLocale(); -aSearchOpt.searchString = VBALikeToRegexp(refVar1->GetOUString()); +OUString regex = VBALikeToRegexp(refVar1->GetOUString()); bool bTextMode(true); bool bCompatibility = ( GetSbData()->pInst && GetSbData()->pInst->IsCompatibility() ); @@ -1560,14 +1552,35 @@ void SbiRuntime::StepLIKE() { bTextMode = IsImageFlag( SbiImageFlags::COMPARETEXT ); } +sal_uInt32 searchFlags = UREGEX_UWORD | UREGEX_DOTALL; // Dot matches newline if( bTextMode ) { -aSearchOpt.transliterateFlags |= TransliterationFlags::IGNORE_CASE; +searchFlags |= UREGEX_CASE_INSENSITIVE; +} + +static sal_uInt32 cachedSearchFlags = 0; +static OUString cachedRegex; +static std::optional oRegexMatcher; +UErrorCode nIcuErr = U_ZERO_ERROR; +if (regex != cachedRegex || searchFlags != cachedSearchFlags || !oRegexMatcher) +{ +cachedRegex = regex; +cachedSearchFlags = searchFlags; +icu::UnicodeString sRegex(false, reinterpret_cast(cachedRegex.getStr()), + cachedRegex.getLength()); +oRegexMatcher.emplace(sRegex, cachedSearchFlags, nIcuErr); +} + +icu::UnicodeString sSource(false, reinterpret_cast(value.getStr()), + value.getLength()); +oRegexMatcher->reset(sSource); + +bool bRes = oRegexMatcher->matches(nIcuErr); +if (nIcuErr) +{ +Error(ERRCODE_BASIC_INTERNAL_ERROR); } SbxVariable* pRes = new SbxVariable; -utl::T
core.git: vcl/source
vcl/source/gdi/sallayout.cxx | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) New commits: commit 51244ebe62bb25f7d87ab1332e863720d980db66 Author: Mike Kaganski AuthorDate: Tue Apr 2 08:55:51 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Apr 2 07:34:32 2024 +0200 Fix UB after 8962141a12c966b2d891829925e6203bf8d51852 (tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangle, 2024-04-01). As reported by Stephan in https://gerrit.libreoffice.org/c/core/+/165553/6#message-fec1e45288c0e87d43c58f777ebe51b03c534d82: `CppunitTest_sw_rtfexport CPPUNIT_TEST_NAME=testMathEqarray::TestBody` now fails with vcl/source/gdi/sallayout.cxx:245:30: runtime error: inf is outside the range of representable values of type 'long' #0 in SalLayout::GetBoundRect(tools::Rectangle&) const at vcl/source/gdi/sallayout.cxx:245:30 #1 in OutputDevice::GetTextBoundRect(tools::Rectangle&, rtl::OUString const&, int, int, int, unsigned long, KernArraySpan, std::span, SalLayoutGlyphs const*) const at vcl/source/outdev/text.cxx:1932:28 #2 in (anonymous namespace)::SmGetGlyphBoundRect(OutputDevice const&, rtl::OUString const&, tools::Rectangle&) at starmath/source/rect.cxx:80:32 #3 in SmRect::SmRect(OutputDevice const&, SmFormat const*, rtl::OUString const&, unsigned short) at starmath/source/rect.cxx:224:21 #4 in SmMathSymbolNode::AdaptToY(OutputDevice&, unsigned long) at starmath/source/node.cxx:2122:18 #5 in SmBraceNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:1340:17 #6 in SmBinHorNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:816:13 #7 in SmLineNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:610:20 #8 in SmTableNode::Arrange(OutputDevice&, SmFormat const&) at starmath/source/node.cxx:534:20 #9 in SmDocShell::ArrangeFormula() at starmath/source/document.cxx:280:13 #10 in SmDocShell::GetSize() at starmath/source/document.cxx:405:9 #11 in SmDocShell::Repaint() at starmath/source/document.cxx:566:21 #12 in SmDocShell::OnDocumentPrinterChanged(Printer*) at starmath/source/document.cxx:552:5 #13 in SmDocShell::SetText(rtl::OUString const&) at starmath/source/document.cxx:188:9 #14 in SmDocShell::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/document.cxx:848:5 #15 in SmModel::readFormulaOoxml(oox::formulaimport::XmlStream&) at starmath/source/unomodel.cxx:1105:22 #16 in writerfilter::rtftok::RTFDocumentImpl::beforePopState(writerfilter::rtftok::RTFParserState&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3010:30 #17 in writerfilter::rtftok::RTFDocumentImpl::popState() at writerfilter/source/rtftok/rtfdocumentimpl.cxx:3666:23 #18 in writerfilter::rtftok::RTFTokenizer::resolveParse() at writerfilter/source/rtftok/rtftokenizer.cxx:114:37 #19 in writerfilter::rtftok::RTFDocumentImpl::resolve(writerfilter::Stream&) at writerfilter/source/rtftok/rtfdocumentimpl.cxx:856:27 #20 in (anonymous namespace)::RtfFilter::filter(com::sun::star::uno::Sequence const&) at writerfilter/source/filter/RtfFilter.cxx:163:20 #21 in SfxObjectShell::ImportFrom(SfxMedium&, com::sun::star::uno::Reference const&) at sfx2/source/doc/objstor.cxx:2392:34 #22 in SfxObjectShell::DoLoad(SfxMedium*) at sfx2/source/doc/objstor.cxx:760:23 #23 in SfxBaseModel::load(com::sun::star::uno::Sequence const&) at sfx2/source/doc/sfxbasemodel.cxx:1980:36 #24 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) at sfx2/source/view/frmload.cxx:720:28 #25 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1176:37 #26 in framework::LoadEnv::start() at framework/source/loadenv/loadenv.cxx:412:20 #27 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&, rtl::OUString const&, int, LoadEnvFeatures) at framework/source/loadenv/loadenv.cxx:308:5 #28 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) at framework/source/loadenv/loadenv.cxx:168:14 #29 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) at framework/source/services/desktop.cxx:591:16 #30 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&a
core.git: include/vcl sc/source sw/qa sw/source vcl/source
include/vcl/transfer.hxx |4 + sc/source/ui/docshell/impex.cxx |8 -- sc/source/ui/view/viewfun5.cxx | 51 ++ sw/qa/extras/uiwriter/uiwriter7.cxx |2 sw/source/uibase/dochdl/swdtflvr.cxx | 40 ++ vcl/source/treelist/transfer.cxx | 95 +++ 6 files changed, 117 insertions(+), 83 deletions(-) New commits: commit db1de445ea67e7f888664531e0bd2d82cde7b46d Author: Mike Kaganski AuthorDate: Mon Apr 1 14:49:33 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 1 19:19:42 2024 +0200 tdf#151413: add UTF-8 data to the Link clipboard format And introduce methods in TransferableDataHelper to handle that. Change-Id: I1d91f0f6b7e8523125f9cc1507dbd6737968f7d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165607 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx index bdd61c61ba25..78b5b9e03d5c 100644 --- a/include/vcl/transfer.hxx +++ b/include/vcl/transfer.hxx @@ -363,6 +363,10 @@ public: static TransferableDataHelper CreateFromPrimarySelection(); static bool IsEqual( const css::datatransfer::DataFlavor& rInternalFlavor, const css::datatransfer::DataFlavor& rRequestFlavor ); +static bool WriteDDELink(SvStream& stream, std::u16string_view application, + std::u16string_view topic, std::u16string_view item, + std::u16string_view extra = {}); +bool ReadDDELink(OUString& application, OUString& topic, OUString& item, OUString& rest) const; }; class VCL_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") DragSourceHelper diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 36110b1efd98..248c837b6dd1 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -471,12 +471,8 @@ bool ScImportExport::ExportStream( SvStream& rStrm, const OUString& rBaseURL, So // extra bits are used to tell the client to prefer external // reference link. - -rStrm.WriteUnicodeOrByteText(aAppName, true); -rStrm.WriteUnicodeOrByteText(aDocName, true); -rStrm.WriteUnicodeOrByteText(aRefName, true); -rStrm.WriteUnicodeOrByteText(u"calc:extref", true); -return rStrm.WriteUnicodeOrByteText(u"", true); // One more trailing zero +return TransferableDataHelper::WriteDDELink(rStrm, aAppName, aDocName, aRefName, +u"calc:extref"); } } if( nFmt == SotClipboardFormatId::HTML ) diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 9cb343ecd478..27c90299a908 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -387,12 +387,9 @@ bool ScViewFunc::PasteLink( const uno::Reference& r // get link data from transferable before string data, // so the source knows it will be used for a link -uno::Sequence aSequence = aDataHelper.GetSequence(SotClipboardFormatId::LINK, OUString()); -if (!aSequence.hasElements()) -{ -OSL_FAIL("DDE Data not found."); +OUString sApp, sTopic, sItem, sExtra; +if (!aDataHelper.ReadDDELink(sApp, sTopic, sItem, sExtra)) return false; -} // check size (only if string is available in transferable) @@ -421,46 +418,14 @@ bool ScViewFunc::PasteLink( const uno::Reference& r } // create formula - -sal_Int32 nSeqLen = aSequence.getLength(); -const char* p = reinterpret_cast(aSequence.getConstArray()); - -rtl_TextEncoding eSysEnc = osl_getThreadTextEncoding(); - -// char array delimited by -// app -::std::vector aStrs; -const char* pStart = p; -sal_Int32 nStart = 0; -for (sal_Int32 i = 0; i < nSeqLen; ++i, ++p) -{ -if (*p == ' -{ -sal_Int32 nLen = i - nStart; -aStrs.emplace_back(pStart, nLen, eSysEnc); -nStart = ++i; -pStart = ++p; -} -} - -if (aStrs.size() < 3) -return false; - -const OUString& pApp = aStrs[0]; -const OUString& pTopic = aStrs[1]; -const OUString& pItem = aStrs[2]; -const OUString* pExtra = nullptr; -if (aStrs.size() > 3) -pExtra = [3]; - -if ( pExtra && *pExtra == "calc:extref" ) +if ( sExtra == "calc:extref" ) { // Paste this as an external reference. Note that paste link always // uses Calc A1 syntax even when another formula syntax is specified // in the UI. EnterMatrix("='" -+ ScGlobal::GetAbsDocName(pTopic, GetViewData().G
core.git: 2 commits - vcl/inc vcl/qa vcl/source vcl/workben
vcl/inc/font/LogicalFontInstance.hxx|3 - vcl/inc/impfontcache.hxx|8 +-- vcl/inc/impglyphitem.hxx|6 +- vcl/qa/cppunit/logicalfontinstance.cxx | 68 ++-- vcl/source/font/LogicalFontInstance.cxx | 53 +++- vcl/source/font/fontcache.cxx |4 - vcl/source/gdi/CommonSalLayout.cxx |6 +- vcl/source/gdi/pdfwriter_impl.cxx |4 - vcl/source/gdi/sallayout.cxx| 24 +-- vcl/source/outdev/font.cxx |4 - vcl/workben/listglyphs.cxx |2 11 files changed, 113 insertions(+), 69 deletions(-) New commits: commit dff57d2b4f5abd1b51ebfb0015339471f61e72f9 Author: Mike Kaganski AuthorDate: Sun Mar 31 00:45:25 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 1 13:06:05 2024 +0200 tdf#160436: fix glyph bounds calculation for vertical glyphs It is unclear if LogicalFontInstance::GetGlyphBoundRect can be called for both normal and rotated variants of the same glyph in the same font. If yes, then the normal and vertical variants must be cached separately, or possibly vertical variant can be not cached, but always calculated. This problem already existed before, so this change doesn't introduce a new issue. Change-Id: I9b50ef340c9e38db7bef890165519aadc96d3ffa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165581 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/qa/cppunit/logicalfontinstance.cxx b/vcl/qa/cppunit/logicalfontinstance.cxx index 2a0e30d50c34..eb803ed40363 100644 --- a/vcl/qa/cppunit/logicalfontinstance.cxx +++ b/vcl/qa/cppunit/logicalfontinstance.cxx @@ -46,6 +46,7 @@ void VclLogicalFontInstanceTest::testglyphboundrect() basegfx::B2DRectangle aBoundRect; const auto LATIN_SMALL_LETTER_B = 0x0062; +const auto SECTION_SIGN = 0x00A7; // UTR#50: Vertical_Orientation (vo) property value U pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(LATIN_SMALL_LETTER_B), aBoundRect, false); @@ -54,6 +55,14 @@ void VclLogicalFontInstanceTest::testglyphboundrect() CPPUNIT_ASSERT_DOUBLES_EQUAL(49.5, aBoundRect.getWidth(), 0.05); CPPUNIT_ASSERT_DOUBLES_EQUAL(80.8, aBoundRect.getHeight(), 0.05); +// tdf#160436: test vertically oriented glyphs + pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(SECTION_SIGN), aBoundRect, true); + +CPPUNIT_ASSERT_DOUBLES_EQUAL(-79.7, aBoundRect.getMinX(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(-55.0, aBoundRect.getMinY(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(88.9, aBoundRect.getWidth(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(48.8, aBoundRect.getHeight(), 0.05); + font.SetOrientation(900_deg10); device->SetFont(font); @@ -67,6 +76,14 @@ void VclLogicalFontInstanceTest::testglyphboundrect() CPPUNIT_ASSERT_DOUBLES_EQUAL(80.8, aBoundRect.getWidth(), 0.05); CPPUNIT_ASSERT_DOUBLES_EQUAL(49.5, aBoundRect.getHeight(), 0.05); +// tdf#160436: test vertically oriented glyphs + pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(SECTION_SIGN), aBoundRect, true); + +CPPUNIT_ASSERT_DOUBLES_EQUAL(-55.0, aBoundRect.getMinX(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(-9.2, aBoundRect.getMinY(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(48.8, aBoundRect.getWidth(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(88.9, aBoundRect.getHeight(), 0.05); + font.SetOrientation(450_deg10); device->SetFont(font); @@ -79,6 +96,14 @@ void VclLogicalFontInstanceTest::testglyphboundrect() CPPUNIT_ASSERT_DOUBLES_EQUAL(-96.4, aBoundRect.getMinY(), 0.05); CPPUNIT_ASSERT_DOUBLES_EQUAL(92.1, aBoundRect.getWidth(), 0.05); CPPUNIT_ASSERT_DOUBLES_EQUAL(92.1, aBoundRect.getHeight(), 0.05); + +// tdf#160436: test vertically oriented glyphs + pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(SECTION_SIGN), aBoundRect, true); + +CPPUNIT_ASSERT_DOUBLES_EQUAL(-95.3, aBoundRect.getMinX(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(-45.4, aBoundRect.getMinY(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(97.4, aBoundRect.getWidth(), 0.05); +CPPUNIT_ASSERT_DOUBLES_EQUAL(97.4, aBoundRect.getHeight(), 0.05); } CPPUNIT_TEST_SUITE_REGISTRATION(VclLogicalFontInstanceTest); diff --git a/vcl/source/font/LogicalFontInstance.cxx b/vcl/source/font/LogicalFontInstance.cxx index 56129199d3a8..971965385164 100644 --- a/vcl/source/font/LogicalFontInstance.cxx +++ b/vcl/source/font/LogicalFontInstance.cxx @@ -172,8 +172,8 @@ void LogicalFontInstance::IgnoreFallbackForUnicode(sal_UCS4 cChar, FontWeight eW bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, basegfx::B2DRectangle& rRect, bool bVertical) const { -// TODO/FIXME: bVertical handling here is highly suspicious. When it's tru
core.git: 2 commits - vcl/skia
vcl/skia/gdiimpl.cxx| 15 --- vcl/skia/win/gdiimpl.cxx| 31 +-- vcl/skia/x11/textrender.cxx | 10 +- 3 files changed, 26 insertions(+), 30 deletions(-) New commits: commit 2b427f319a7a95c48beda13913a067d24bd82cf8 Author: Mike Kaganski AuthorDate: Sun Mar 31 10:57:43 2024 +0100 Commit: Mike Kaganski CommitDate: Sun Mar 31 15:38:56 2024 +0200 Simplify a bit And make font size calculations consistent between SkiaTextRender (x11) and WinSkiaSalGraphicsImpl (win). They already did ~the same, the win case just used an intermediate 'getHScale' coefficient. Change-Id: I90ad4d9c49427465ef3263843b34bd9bc0d762eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165488 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index 651f294add0e..0451307b7bdf 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -217,19 +217,21 @@ catch (const sal::systools::ComError& e) bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout) { assert(dynamic_cast(())); -SkiaWinFontInstance* pWinFont = static_cast(()); -const HFONT hLayoutFont = pWinFont->GetHFONT(); -double hScale = pWinFont->getHScale(); +SkiaWinFontInstance& rWinFont = static_cast(rLayout.GetFont()); +const vcl::font::FontSelectPattern& rFSD = rWinFont.GetFontSelectPattern(); +if (rFSD.mnHeight == 0) +return false; +const HFONT hLayoutFont = rWinFont.GetHFONT(); LOGFONTW logFont; if (GetObjectW(hLayoutFont, sizeof(logFont), ) == 0) { assert(false); return false; } -sk_sp typeface = pWinFont->GetSkiaTypeface(); +sk_sp typeface = rWinFont.GetSkiaTypeface(); if (!typeface) { -typeface = createDirectWriteTypeface(pWinFont); +typeface = createDirectWriteTypeface(); bool dwrite = true; if (!typeface) // fall back to GDI text rendering { @@ -250,7 +252,7 @@ bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout) return false; } // Cache the typeface. -pWinFont->SetSkiaTypeface(typeface, dwrite); +rWinFont.SetSkiaTypeface(typeface, dwrite); } SkFont font(typeface); @@ -267,21 +269,14 @@ bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout) font.setEdging(logFont.lfQuality == NONANTIALIASED_QUALITY ? SkFont::Edging::kAlias : ePreferredAliasing); -const vcl::font::FontSelectPattern& rFSD = pWinFont->GetFontSelectPattern(); -int nHeight = rFSD.mnHeight; -int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; -if (nWidth == 0 || nHeight == 0) -return false; +double nHeight = rFSD.mnHeight; +double nWidth = rFSD.mnWidth ? rFSD.mnWidth * rWinFont.GetAverageWidthFactor() : nHeight; font.setSize(nHeight); -font.setScaleX(hScale); +font.setScaleX(nWidth / nHeight); -// Unlike with Freetype-based font handling, use height even in vertical mode, -// additionally multiply it by horizontal scale to get the proper -// size and then scale the width back, otherwise the height would -// not be correct. I don't know why this is inconsistent. SkFont verticalFont(font); -verticalFont.setSize(nHeight * hScale); -verticalFont.setScaleX(1.0 / hScale); +verticalFont.setSize(nWidth); +verticalFont.setScaleX(nHeight / nWidth); assert(dynamic_cast(mWinParent.GetImpl())); SkiaSalGraphicsImpl* impl = static_cast(mWinParent.GetImpl()); diff --git a/vcl/skia/x11/textrender.cxx b/vcl/skia/x11/textrender.cxx index acc930e070e5..425710626fb5 100644 --- a/vcl/skia/x11/textrender.cxx +++ b/vcl/skia/x11/textrender.cxx @@ -51,10 +51,10 @@ void SkiaTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalGr const FreetypeFontInstance& rInstance = static_cast(rLayout.GetFont()); const FreetypeFont& rFont = rInstance.GetFreetypeFont(); const vcl::font::FontSelectPattern& rFSD = rInstance.GetFontSelectPattern(); -int nHeight = rFSD.mnHeight; -int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; -if (nWidth == 0 || nHeight == 0) +if (rFSD.mnHeight == 0) return; +double nHeight = rFSD.mnHeight; +double nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; if (!fontManager) { @@ -65,7 +65,7 @@ void SkiaTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalGr = SkFontMgr_createTypefaceFromFcPattern(fontManager, rFont.GetFontOptions()->GetPattern()); SkFont font(typeface); font.setSize(nHeight); -font.setScaleX(1.0 * nWidth / nHeight); +font.setScaleX(nWidth / nHeight); if (rInstance.NeedsArtifi
core.git: 2 commits - vcl/source
vcl/source/font/font.cxx | 89 --- 1 file changed, 46 insertions(+), 43 deletions(-) New commits: commit 4673e96d3a292b8990450b4b13230f1e3cd158ae Author: Mike Kaganski AuthorDate: Sat Mar 30 19:04:38 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Mar 30 16:55:48 2024 +0100 Simplify and avoid const_cast Change-Id: I963bccd565750b41f16e3585f9a358678aa28500 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165576 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index 07d5eb7a6044..c47fb0bbac4d 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -73,8 +73,9 @@ Font::Font( const OUString& rFamilyName, const Size& rSize ) if (GetFamilyName() != rFamilyName || GetAverageFontSize() != rSize) { -mpImplFont->SetFamilyName( rFamilyName ); -mpImplFont->SetFontSize( rSize ); +auto impl = mpImplFont.get(); +impl->SetFamilyName( rFamilyName ); +impl->SetFontSize( rSize ); } } @@ -84,9 +85,10 @@ Font::Font( const OUString& rFamilyName, const OUString& rStyleName, const Size& || GetStyleName() != rStyleName || GetAverageFontSize() != rSize) { -mpImplFont->SetFamilyName( rFamilyName ); -mpImplFont->SetStyleName( rStyleName ); -mpImplFont->SetFontSize( rSize ); +auto impl = mpImplFont.get(); +impl->SetFamilyName( rFamilyName ); +impl->SetStyleName( rStyleName ); +impl->SetFontSize( rSize ); } } @@ -95,8 +97,9 @@ Font::Font( FontFamily eFamily, const Size& rSize ) if (GetFontFamily() != eFamily || GetAverageFontSize() != rSize) { -mpImplFont->SetFamilyType( eFamily ); -mpImplFont->SetFontSize( rSize ); +auto impl = mpImplFont.get(); +impl->SetFamilyType( eFamily ); +impl->SetFontSize( rSize ); } } @@ -116,9 +119,10 @@ void Font::SetFillColor( const Color& rColor ) { if (GetFillColor() != rColor) { -mpImplFont->maFillColor = rColor; +auto impl = mpImplFont.get(); +impl->maFillColor = rColor; if ( rColor.IsTransparent() ) -mpImplFont->mbTransparent = true; +impl->mbTransparent = true; } } @@ -130,7 +134,7 @@ void Font::SetTransparent( bool bTransparent ) void Font::SetAlignment( TextAlign eAlign ) { -if (const_cast(mpImplFont)->meAlign != eAlign) +if (GetAlignment() != eAlign) mpImplFont->SetAlignment(eAlign); } @@ -148,19 +152,19 @@ void Font::SetStyleName( const OUString& rStyleName ) void Font::SetFontSize( const Size& rSize ) { -if (const_cast(mpImplFont)->GetFontSize() != rSize) +if (GetFontSize() != rSize) mpImplFont->SetFontSize( rSize ); } void Font::SetFamily( FontFamily eFamily ) { -if (const_cast(mpImplFont)->GetFamilyTypeNoAsk() != eFamily) +if (std::as_const(mpImplFont)->GetFamilyTypeNoAsk() != eFamily) mpImplFont->SetFamilyType( eFamily ); } void Font::SetCharSet( rtl_TextEncoding eCharSet ) { -if (const_cast(mpImplFont)->GetCharSet() != eCharSet) +if (GetCharSet() != eCharSet) mpImplFont->SetCharSet( eCharSet ); } @@ -190,25 +194,25 @@ void Font::SetCJKContextLanguage( LanguageType eLanguage ) void Font::SetPitch( FontPitch ePitch ) { -if (const_cast(mpImplFont)->GetPitchNoAsk() != ePitch) +if (std::as_const(mpImplFont)->GetPitchNoAsk() != ePitch) mpImplFont->SetPitch( ePitch ); } void Font::SetOrientation( Degree10 nOrientation ) { -if (const_cast(mpImplFont)->mnOrientation != nOrientation) +if (GetOrientation() != nOrientation) mpImplFont->mnOrientation = nOrientation; } void Font::SetVertical( bool bVertical ) { -if (const_cast(mpImplFont)->mbVertical != bVertical) +if (IsVertical() != bVertical) mpImplFont->mbVertical = bVertical; } void Font::SetKerning( FontKerning eKerning ) { -if (const_cast(mpImplFont)->meKerning != eKerning) +if (GetKerning() != eKerning) mpImplFont->meKerning = eKerning; } @@ -219,7 +223,7 @@ bool Font::IsKerning() const void Font::SetFixKerning( short nSpacing ) { -if (const_cast(mpImplFont)->mnSpacing != nSpacing) +if (GetFixKerning() != nSpacing) mpImplFont->mnSpacing = nSpacing; } @@ -235,67 +239,67 @@ bool Font::IsFixKerning() const void Font::SetWeight( FontWeight eWeight ) { -if (const_cast(mpImplFont)->GetWeightNoAsk() != eWeight) +if (std::as_const(mpImplFont)->GetWeightNoAsk() != eWeight) mpImplFont->SetWeight( eWeight ); } void Font::SetWidthType( FontWidth eWidth ) { -if (const_cast(mpImplFont)->GetWidthTypeNoAsk()
Re: https://opengrok.libreoffice.org/ has no project "core"
On 29.03.2024 23:31, Regina Henschel wrote: https://opengrok.libreoffice.org/ has neither in 'Projects' nor in the 'Repository' list a project 'core'. Same here. -- Best regards, Mike Kaganski
core.git: vcl/win
vcl/win/gdi/DWriteTextRenderer.cxx | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) New commits: commit 40176bd39c94c32ac0269d9994e8e50518d84467 Author: Mike Kaganski AuthorDate: Fri Mar 29 07:57:36 2024 +0100 Commit: Mike Kaganski CommitDate: Fri Mar 29 09:30:22 2024 +0100 Simplify a bit Change-Id: Idb10d594829eeffd9b37e5ae971283b2a9730168 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165475 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index 1d5985dfceac..bb0f7e6b7661 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -79,19 +79,15 @@ IDWriteRenderingParams* lclSetRenderingMode(IDWriteFactory* pDWriteFactory, DWRI } #ifdef SAL_LOG_WARN -HRESULT checkResult(HRESULT hr, const char* file, size_t line) +HRESULT checkResult(HRESULT hr, const char* location) { -if (FAILED(hr)) -{ -OUString sLocationString = OUString::createFromAscii(file) + ":" + OUString::number(line) + " "; -SAL_DETAIL_LOG_STREAM(SAL_DETAIL_ENABLE_LOG_WARN, ::SAL_DETAIL_LOG_LEVEL_WARN, - "vcl.gdi", sLocationString.toUtf8().getStr(), - "HRESULT failed with: 0x" << OUString::number(hr, 16) << ": " << WindowsErrorStringFromHRESULT(hr)); -} +SAL_DETAIL_LOG_STREAM(SAL_DETAIL_ENABLE_LOG_WARN && FAILED(hr), ::SAL_DETAIL_LOG_LEVEL_WARN, + "vcl.gdi", location, + "HRESULT failed with: 0x" << OUString::number(hr, 16) << ": " << WindowsErrorStringFromHRESULT(hr)); return hr; } -#define CHECKHR(funct) checkResult(funct, __FILE__, __LINE__) +#define CHECKHR(funct) checkResult(funct, SAL_WHERE) #else #define CHECKHR(funct) (funct) #endif
core.git: vcl/win
vcl/win/gdi/DWriteTextRenderer.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 20b0ea97b047fb57ceb8afb39bdcf5a428f8f691 Author: Mike Kaganski AuthorDate: Fri Mar 29 07:18:02 2024 +0100 Commit: Mike Kaganski CommitDate: Fri Mar 29 08:28:17 2024 +0100 Avoid bitwise assignment operators on bool Change-Id: I77509caf437c02792c34385cdf115f2c2a673754 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165474 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index 3d3dac83c6dd..1d5985dfceac 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -230,7 +230,7 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa if (succeeded) { hr = BindDC(hDC, bounds); // Update the bounding rect. -succeeded &= SUCCEEDED(hr); +succeeded = SUCCEEDED(hr); } ID2D1SolidColorBrush* pBrush = nullptr; @@ -238,7 +238,7 @@ bool D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa { COLORREF bgrTextColor = GetTextColor(hDC); D2D1::ColorF aD2DColor(GetRValue(bgrTextColor) / 255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f); -succeeded &= SUCCEEDED(CHECKHR(mpRT->CreateSolidColorBrush(aD2DColor, ))); +succeeded = SUCCEEDED(CHECKHR(mpRT->CreateSolidColorBrush(aD2DColor, ))); } if (succeeded)
core.git: vcl/skia
vcl/skia/win/gdiimpl.cxx |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) New commits: commit c40a1201f90cec8d5490b3330fd990fc5546cfad Author: Mike Kaganski AuthorDate: Fri Mar 29 09:27:43 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Mar 29 06:55:27 2024 +0100 Drop a const_cast Change-Id: I3eb4547c71768d81bc351f9cb8d0ed1e07c9ebc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165504 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index 39294bc2b372..651f294add0e 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -216,9 +216,8 @@ catch (const sal::systools::ComError& e) bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout) { -assert(dynamic_cast(())); -const SkiaWinFontInstance* pWinFont -= static_cast(()); +assert(dynamic_cast(())); +SkiaWinFontInstance* pWinFont = static_cast(()); const HFONT hLayoutFont = pWinFont->GetHFONT(); double hScale = pWinFont->getHScale(); LOGFONTW logFont; @@ -251,7 +250,7 @@ bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout) return false; } // Cache the typeface. -const_cast(pWinFont)->SetSkiaTypeface(typeface, dwrite); +pWinFont->SetSkiaTypeface(typeface, dwrite); } SkFont font(typeface);
core.git: vcl/source
vcl/source/font/LogicalFontInstance.cxx | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) New commits: commit 291c90811ada39ed079d458887a59fc8977494f6 Author: Mike Kaganski AuthorDate: Fri Mar 29 08:55:24 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Mar 29 06:11:11 2024 +0100 Simplify a bit Change-Id: I2a5b870516d8b597ebf476c7c1da7549a27571ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165503 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/font/LogicalFontInstance.cxx b/vcl/source/font/LogicalFontInstance.cxx index 0c21cba47548..94e1e72353fb 100644 --- a/vcl/source/font/LogicalFontInstance.cxx +++ b/vcl/source/font/LogicalFontInstance.cxx @@ -113,19 +113,20 @@ double LogicalFontInstance::GetKashidaWidth() const void LogicalFontInstance::GetScale(double* nXScale, double* nYScale) const { double nUPEM = GetFontFace()->UnitsPerEm(); -double nHeight(m_aFontSelData.mnHeight); - -// On Windows, mnWidth is relative to average char width not font height, -// and we need to keep it that way for GDI to correctly scale the glyphs. -// Here we compensate for this so that HarfBuzz gives us the correct glyph -// positions. -double nWidth(m_aFontSelData.mnWidth ? m_aFontSelData.mnWidth * m_nAveWidthFactor : nHeight); if (nYScale) -*nYScale = nHeight / nUPEM; +*nYScale = m_aFontSelData.mnHeight / nUPEM; if (nXScale) +{ +// On Windows, mnWidth is relative to average char width not font height, +// and we need to keep it that way for GDI to correctly scale the glyphs. +// Here we compensate for this so that HarfBuzz gives us the correct glyph +// positions. +double nWidth(m_aFontSelData.mnWidth ? m_aFontSelData.mnWidth * GetAverageWidthFactor() + : m_aFontSelData.mnHeight); *nXScale = nWidth / nUPEM; +} } void LogicalFontInstance::AddFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight,
core.git: vcl/inc vcl/win
vcl/inc/win/winlayout.hxx |1 - vcl/win/gdi/winlayout.cxx | 14 ++ 2 files changed, 2 insertions(+), 13 deletions(-) New commits: commit ff7a6711277bda28711cc92540fbd62ebaaf8db7 Author: Mike Kaganski AuthorDate: Thu Mar 28 19:52:00 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Mar 29 04:17:12 2024 +0100 Simplify and drop unused method Change-Id: Ie987bce2bb25232d54a4a83631c609ad6dba7213 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165467 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index e1d66a0e1ab2..cfb36e825b54 100644 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -36,7 +36,6 @@ class WinFontInstance : public LogicalFontInstance public: ~WinFontInstance() override; -bool hasHScale() const; float getHScale() const; void SetGraphics(WinSalGraphics*); diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index eb5c740580c5..19eaae2ecee7 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -146,22 +146,12 @@ WinFontInstance::~WinFontInstance() ::DeleteFont(m_hFont); } -bool WinFontInstance::hasHScale() const -{ -const vcl::font::FontSelectPattern& rPattern = GetFontSelectPattern(); -int nHeight(rPattern.mnHeight); -int nWidth(rPattern.mnWidth ? rPattern.mnWidth * GetAverageWidthFactor() : nHeight); -return nWidth != nHeight; -} - float WinFontInstance::getHScale() const { const vcl::font::FontSelectPattern& rPattern = GetFontSelectPattern(); -int nHeight(rPattern.mnHeight); -if (!nHeight) +if (!rPattern.mnHeight || !rPattern.mnWidth) return 1.0; -float nWidth(rPattern.mnWidth ? rPattern.mnWidth * GetAverageWidthFactor() : nHeight); -return nWidth / nHeight; +return rPattern.mnWidth * GetAverageWidthFactor() / rPattern.mnHeight; } void WinFontInstance::ImplInitHbFont(hb_font_t* /*pHbFont*/)
core.git: drawinglayer/source
drawinglayer/source/processor2d/vclprocessor2d.cxx | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) New commits: commit 696e405a8d734e1440e3178a04cbb10190bbc4d7 Author: Mike Kaganski AuthorDate: Thu Mar 28 10:19:26 2024 +0100 Commit: Mike Kaganski CommitDate: Thu Mar 28 15:50:36 2024 +0100 Simplify a comparison Similar to commit 860548e23e2ae737d7bd5840f71f776b1239f997 (Simplify a comparison, 2024-03-07). Change-Id: Ia2ae4a9d23558842626b6e52a13bc1582bc35741 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165422 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 9049bec591b2..d99893dbab98 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -142,8 +142,7 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( // especially if the effect is less than a pixel. if (std::abs(aFontScaling.getY() * fShearX) < 1) { -if (basegfx::fTools::less(aFontScaling.getX(), 0.0) -&& basegfx::fTools::less(aFontScaling.getY(), 0.0)) +if (aFontScaling.getX() < 0.0 && aFontScaling.getY() < 0.0) { // handle special case: If scale is negative in (x,y) (3rd quadrant), it can // be expressed as rotation by PI. Use this since the Font rendering will not @@ -152,8 +151,7 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( fRotate += M_PI; } -if (basegfx::fTools::more(aFontScaling.getX(), 0.0) -&& basegfx::fTools::more(aFontScaling.getY(), 0.0)) +if (aFontScaling.getX() > 0.0 && aFontScaling.getY() > 0.0) { double fIgnoreRotate, fIgnoreShearX; @@ -1099,7 +1097,7 @@ void VclProcessor2D::RenderPolygonStrokePrimitive2D( const double fLineWidth(rLineAttribute.getWidth()); bool bDone(false); -if (basegfx::fTools::more(fLineWidth, 0.0)) +if (fLineWidth > 0.0) { const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(fLineWidth, 0.0)); @@ -1348,7 +1346,7 @@ void VclProcessor2D::RenderSvgLinearAtomPrimitive2D( { const double fDelta(rCandidate.getOffsetB() - rCandidate.getOffsetA()); -if (!basegfx::fTools::more(fDelta, 0.0)) +if (fDelta <= 0.0) return; const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA())); @@ -1392,7 +1390,7 @@ void VclProcessor2D::RenderSvgRadialAtomPrimitive2D( { const double fDeltaScale(rCandidate.getScaleB() - rCandidate.getScaleA()); -if (!basegfx::fTools::more(fDeltaScale, 0.0)) +if (fDeltaScale <= 0.0) return; const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA()));
core.git: Branch 'distro/vector/vector-7.5.9' - sw/qa sw/source
sw/qa/extras/htmlexport/data/tdf160390.fodt | 17 ++ sw/qa/extras/htmlexport/htmlexport.cxx |7 sw/source/filter/html/htmlatr.cxx | 44 +--- 3 files changed, 45 insertions(+), 23 deletions(-) New commits: commit c0f3dc4875f0b40110f1d3513828d2ebf8a4b8aa Author: Mike Kaganski AuthorDate: Wed Mar 27 16:01:51 2024 +0500 Commit: Mike Kaganski CommitDate: Thu Mar 28 11:37:19 2024 +0500 tdf#160390: make sure to forward the iterator Change-Id: I302cc4303f083a1024175ce4ba00ce8021c6d4c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165390 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/htmlexport/data/tdf160390.fodt b/sw/qa/extras/htmlexport/data/tdf160390.fodt new file mode 100644 index ..53d6144ff19b --- /dev/null +++ b/sw/qa/extras/htmlexport/data/tdf160390.fodt @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + foo + + + \ No newline at end of file diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 4afef396..7c8bf0985ff8 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -3047,6 +3047,13 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160017_spanClosingOrder) CPPUNIT_ASSERT(parseXml(maTempFile)); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160390) +{ +// This document must not hang infinitely on HTML export +createSwDoc("tdf160390.fodt"); +save("HTML (StarWriter)"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 247b22e5ff2f..0731c3709571 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -1526,8 +1526,9 @@ void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart, for (auto it = items.begin(); it != items.end();) { -HTMLStartEndPos* pTest = *it; -sal_Int32 nTestEnd = pTest->GetEnd(); +auto itTest = it++; // forward early, allow 'continue', and keep a copy for 'erase' +HTMLStartEndPos* pTest = *itTest; +const sal_Int32 nTestEnd = pTest->GetEnd(); if (nTestEnd <= nStart) continue; @@ -1535,30 +1536,27 @@ void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart, const SfxPoolItem& rTestItem = pTest->GetItem(); // only the corresponding OnTag attributes have to be considered -if (rTestItem.Which() == nWhich && HTML_ON_VALUE == GetHTMLItemState(rTestItem)) -{ -// if necessary, insert the second part of the split -// attribute -if (nTestEnd > nEnd) -InsertItem(pTest->GetItem(), nEnd, nTestEnd); +if (rTestItem.Which() != nWhich || HTML_ON_VALUE != GetHTMLItemState(rTestItem)) +continue; -if (nTestStart >= nStart) -{ -// the Test item only starts after the new end of the -// attribute. Therefore, it can be completely erased. -it = items.erase(it); -auto& posItems = m_aEndLst[pTest->GetEnd()]; -posItems.erase(std::remove(posItems.begin(), posItems.end(), pTest), - posItems.end()); -delete pTest; -continue; -} +// if necessary, insert the second part of the split attribute +if (nTestEnd > nEnd) +InsertItem(rTestItem, nEnd, nTestEnd); -// the start of the new attribute corresponds to the new -// end of the attribute -FixSplittedItem(pTest, nStart); +if (nTestStart >= nStart) +{ +// the Test item only starts after the new end of the +// attribute. Therefore, it can be completely erased. +it = items.erase(itTest); +auto& posItems = m_aEndLst[nTestEnd]; +posItems.erase(std::remove(posItems.begin(), posItems.end(), pTest), + posItems.end()); +delete pTest; +continue; } -++it; + +// the start of the new attribute corresponds to the new end of the attribute +FixSplittedItem(pTest, nStart); } } }
core.git: Branch 'libreoffice-24-2' - dbaccess/source
dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx |6 +++- dbaccess/source/ui/dlg/dbwizsetup.cxx |3 ++ dbaccess/source/ui/dlg/generalpage.cxx| 32 ++ 3 files changed, 23 insertions(+), 18 deletions(-) New commits: commit 8e0bb9dadb9ef77f693cf6d334843cfb9b4701a3 Author: Mike Kaganski AuthorDate: Tue Mar 19 11:47:14 2024 +0500 Commit: Adolfo Jayme Barrientos CommitDate: Thu Mar 28 06:37:08 2024 +0100 tdf#103068: make sure to update and use current MySQL connection type 1. Don't set selection in OGeneralPageWizard::getEmbeddedDBName. The method should only provide a name of an embedded database - either in the passed set, or the default one; the activation of controls and related actions will be done in the calling implInitControls. This makes sure, that ODbTypeWizDialogSetup::m_sURL doesn't get rewritten unnecessarily, keeping the current preference intact. 2. In ODbTypeWizDialogSetup::activateDatabasePath, do not use the hardcoded MySQL URL from the control, if the current value of m_sURL is already a MySQL one. This allows to keep the selected kind intact. 3. In OMySQLIntroPageSetup::implInitControls, do not assume that the existing selection means that there's nothing to do. The page keeps the selection, even when the wizard's active path was changed; and so, the wizard's idea which page to show next may differ from the selection. Just make sure to update the setup mode. Change-Id: Iad98d54a615dccc58b2852a1c0d8aefad6b0b898 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164987 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 1e66905c840dbee0a67e444fca80bdacfcb6e6b2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165000 Reviewed-by: Adolfo Jayme Barrientos diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index 22cdefdd6c31..ad81680ba421 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -239,9 +239,13 @@ using namespace ::com::sun::star; if ( bHasMySQLNative ) m_xNATIVEDatabase->show(); -// if any of the options is checked, then there's nothing to do +// tdf#103068: if any of the options is checked, then just update the selected kind: +// it could happen that the selection and the wizard path are not in sync if ( m_xODBCDatabase->get_active() || m_xJDBCDatabase->get_active() || m_xNATIVEDatabase->get_active() ) +{ +maClickHdl.Call(this); return; +} // prefer "native" or "JDBC" if ( bHasMySQLNative ) diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 720892e2a015..2fb260e18e75 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -312,6 +312,9 @@ void ODbTypeWizDialogSetup::activateDatabasePath() { OUString sOld = m_sURL; m_sURL = m_pGeneralPage->GetSelectedType(); +if (m_sURL.startsWith("sdbc:mysql:") && sOld.startsWith("sdbc:mysql:")) +m_sURL = sOld; // The type of MySQL connection was already set elsewhere; just use it, + // instead of the hardcoded one from the selector DataSourceInfoConverter::convert(getORB(), m_pCollection,sOld,m_sURL,m_pImpl->getCurrentDataSource()); ::dbaccess::DATASOURCE_TYPE eType = VerifyDataSourceType(m_pCollection->determineType(m_sURL)); if (eType == ::dbaccess::DST_UNKNOWN) diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index a2a48158c56d..bb308845528e 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -226,31 +226,29 @@ namespace dbaui OUString OGeneralPageWizard::getEmbeddedDBName( const SfxItemSet& _rSet ) { +if (!m_pCollection) +return {}; // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa) bool bValid, bReadonly; getFlags( _rSet, bValid, bReadonly ); - -// if the selection is invalid, disable everything - -implSetCurrentType( OUString() ); +if (!bValid) +return {}; // compare the DSN prefix with the registered ones -OUString sDisplayName; - -if (m_pCollection && bValid) -{ -implSetCurrentType( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() ); -sDisplayName = m_pCollection->getTypeDisplayName( m_eCurrentSelection ); -onTypeSelected(m_eCurrentSelection); -} - -// select the corr
core.git: Branch 'libreoffice-24-2' - sw/qa sw/source
sw/qa/extras/htmlexport/data/tdf160390.fodt | 17 +++ sw/qa/extras/htmlexport/htmlexport.cxx |7 sw/source/filter/html/htmlatr.cxx | 40 +--- 3 files changed, 43 insertions(+), 21 deletions(-) New commits: commit 832fb1ab9abf94f4074e0cc20d846c1536931cf3 Author: Mike Kaganski AuthorDate: Wed Mar 27 16:01:51 2024 +0500 Commit: Xisco Fauli CommitDate: Wed Mar 27 22:03:48 2024 +0100 tdf#160390: make sure to forward the iterator Change-Id: I302cc4303f083a1024175ce4ba00ce8021c6d4c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165390 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165404 diff --git a/sw/qa/extras/htmlexport/data/tdf160390.fodt b/sw/qa/extras/htmlexport/data/tdf160390.fodt new file mode 100644 index ..53d6144ff19b --- /dev/null +++ b/sw/qa/extras/htmlexport/data/tdf160390.fodt @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + foo + + + \ No newline at end of file diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index de2e9da4c678..42099f3bc44f 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -3053,6 +3053,13 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160017_spanClosingOrder) CPPUNIT_ASSERT(parseXml(maTempFile)); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160390) +{ +// This document must not hang infinitely on HTML export +createSwDoc("tdf160390.fodt"); +ExportToHTML(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index c880082018f1..f298f93dc5b2 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -1524,8 +1524,9 @@ void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart, for (auto it = items.begin(); it != items.end();) { -HTMLStartEndPos* pTest = *it; -sal_Int32 nTestEnd = pTest->GetEnd(); +auto itTest = it++; // forward early, allow 'continue', and keep a copy for 'erase' +HTMLStartEndPos* pTest = *itTest; +const sal_Int32 nTestEnd = pTest->GetEnd(); if (nTestEnd <= nStart) continue; @@ -1533,28 +1534,25 @@ void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart, const SfxPoolItem& rTestItem = pTest->GetItem(); // only the corresponding OnTag attributes have to be considered -if (rTestItem.Which() == nWhich && HTML_ON_VALUE == GetHTMLItemState(rTestItem)) -{ -// if necessary, insert the second part of the split -// attribute -if (nTestEnd > nEnd) -InsertItem(pTest->GetItem(), nEnd, nTestEnd); +if (rTestItem.Which() != nWhich || HTML_ON_VALUE != GetHTMLItemState(rTestItem)) +continue; -if (nTestStart >= nStart) -{ -// the Test item only starts after the new end of the -// attribute. Therefore, it can be completely erased. -it = items.erase(it); -std::erase(m_aEndLst[pTest->GetEnd()], pTest); -delete pTest; -continue; -} +// if necessary, insert the second part of the split attribute +if (nTestEnd > nEnd) +InsertItem(rTestItem, nEnd, nTestEnd); -// the start of the new attribute corresponds to the new -// end of the attribute -FixSplittedItem(pTest, nStart); +if (nTestStart >= nStart) +{ +// the Test item only starts after the new end of the +// attribute. Therefore, it can be completely erased. +it = items.erase(itTest); +std::erase(m_aEndLst[nTestEnd], pTest); +delete pTest; +continue; } -++it; + +// the start of the new attribute corresponds to the new end of the attribute +FixSplittedItem(pTest, nStart); } } }
core.git: sw/qa sw/source
sw/qa/extras/htmlexport/data/tdf160390.fodt | 17 +++ sw/qa/extras/htmlexport/htmlexport.cxx |7 sw/source/filter/html/htmlatr.cxx | 40 +--- 3 files changed, 43 insertions(+), 21 deletions(-) New commits: commit d9c778391796e91ea3da361bf3901000350c26dd Author: Mike Kaganski AuthorDate: Wed Mar 27 16:01:51 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Mar 27 17:06:38 2024 +0100 tdf#160390: make sure to forward the iterator Change-Id: I302cc4303f083a1024175ce4ba00ce8021c6d4c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165390 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/htmlexport/data/tdf160390.fodt b/sw/qa/extras/htmlexport/data/tdf160390.fodt new file mode 100644 index ..53d6144ff19b --- /dev/null +++ b/sw/qa/extras/htmlexport/data/tdf160390.fodt @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + foo + + + \ No newline at end of file diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 374c739230e5..6a23599184a5 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -3075,6 +3075,13 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160017_spanClosingOrder) CPPUNIT_ASSERT(parseXml(maTempFile)); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_Tdf160390) +{ +// This document must not hang infinitely on HTML export +createSwDoc("tdf160390.fodt"); +ExportToHTML(); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index c880082018f1..f298f93dc5b2 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -1524,8 +1524,9 @@ void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart, for (auto it = items.begin(); it != items.end();) { -HTMLStartEndPos* pTest = *it; -sal_Int32 nTestEnd = pTest->GetEnd(); +auto itTest = it++; // forward early, allow 'continue', and keep a copy for 'erase' +HTMLStartEndPos* pTest = *itTest; +const sal_Int32 nTestEnd = pTest->GetEnd(); if (nTestEnd <= nStart) continue; @@ -1533,28 +1534,25 @@ void HTMLEndPosLst::SplitItem( const SfxPoolItem& rItem, sal_Int32 nStart, const SfxPoolItem& rTestItem = pTest->GetItem(); // only the corresponding OnTag attributes have to be considered -if (rTestItem.Which() == nWhich && HTML_ON_VALUE == GetHTMLItemState(rTestItem)) -{ -// if necessary, insert the second part of the split -// attribute -if (nTestEnd > nEnd) -InsertItem(pTest->GetItem(), nEnd, nTestEnd); +if (rTestItem.Which() != nWhich || HTML_ON_VALUE != GetHTMLItemState(rTestItem)) +continue; -if (nTestStart >= nStart) -{ -// the Test item only starts after the new end of the -// attribute. Therefore, it can be completely erased. -it = items.erase(it); -std::erase(m_aEndLst[pTest->GetEnd()], pTest); -delete pTest; -continue; -} +// if necessary, insert the second part of the split attribute +if (nTestEnd > nEnd) +InsertItem(rTestItem, nEnd, nTestEnd); -// the start of the new attribute corresponds to the new -// end of the attribute -FixSplittedItem(pTest, nStart); +if (nTestStart >= nStart) +{ +// the Test item only starts after the new end of the +// attribute. Therefore, it can be completely erased. +it = items.erase(itTest); +std::erase(m_aEndLst[nTestEnd], pTest); +delete pTest; +continue; } -++it; + +// the start of the new attribute corresponds to the new end of the attribute +FixSplittedItem(pTest, nStart); } } }
core.git: Branch 'distro/vector/vector-7.5.9' - 17 commits - basctl/source basic/source editeng/source embeddedobj/source filter/source fpicker/source include/editeng include/filter include/oox includ
| 10 sd/source/ui/dlg/morphdlg.cxx|4 sd/source/ui/dlg/vectdlg.cxx |4 sd/source/ui/inc/DrawDocShell.hxx|3 sd/source/ui/inc/sdtreelb.hxx|2 sd/source/ui/unoidl/sddetect.cxx |2 sd/source/ui/unoidl/unodoc.cxx |4 sfx2/source/appl/appcfg.cxx | 10 sfx2/source/appl/appopen.cxx |3 sfx2/source/appl/sfxpicklist.cxx |6 sfx2/source/appl/xpackcreator.cxx|4 sfx2/source/control/bindings.cxx |1 sfx2/source/doc/objcont.cxx |1 sfx2/source/doc/objxtor.cxx | 38 - sfx2/source/doc/oleprops.cxx |4 sfx2/source/inc/objshimp.hxx |4 sot/qa/cppunit/test_sot.cxx | 20 sot/source/base/object.cxx |6 sot/source/sdstor/storage.cxx| 22 starmath/qa/cppunit/test_cursor.cxx |2 starmath/qa/cppunit/test_node.cxx|2 starmath/qa/cppunit/test_nodetotextvisitors.cxx |2 starmath/qa/cppunit/test_parse.cxx |2 starmath/qa/cppunit/test_starmath.cxx|2 starmath/qa/extras/mmlexport-test.cxx|2 starmath/qa/extras/mmlimport-test.cxx|2 starmath/source/document.cxx |2 starmath/source/eqnolefilehdr.cxx|2 starmath/source/mathtype.cxx | 10 starmath/source/smdetect.cxx |2 starmath/source/unodoc.cxx |2 starmath/source/unofilter.cxx|2 svtools/source/misc/imagemgr.cxx |2 svx/source/gallery2/gallerybinaryengine.cxx | 22 sw/inc/doc.hxx |2 sw/inc/shellio.hxx | 10 sw/qa/core/filters-test.cxx |2 sw/qa/core/macros-test.cxx |2 sw/qa/core/uwriter.cxx |2 sw/qa/extras/htmlexport/htmlexport.cxx |6 sw/source/core/doc/DocumentLayoutManager.cxx |4 sw/source/core/doc/docnew.cxx|4 sw/source/core/inc/SwXMLTextBlocks.hxx |4 sw/source/core/ole/ndole.cxx |8 sw/source/core/swg/SwXMLTextBlocks.cxx | 14 sw/source/filter/basflt/iodetect.cxx |4 sw/source/filter/basflt/shellio.cxx |4 sw/source/filter/html/htmlplug.cxx |2 sw/source/filter/html/htmlreqifreader.cxx| 16 sw/source/filter/writer/writer.cxx |2 sw/source/filter/ww8/wrtw8esh.cxx|6 sw/source/filter/ww8/wrtww8.cxx | 12 sw/source/filter/ww8/wrtww8.hxx |6 sw/source/filter/ww8/wrtww8gr.cxx| 16 sw/source/filter/ww8/ww8glsy.cxx |2 sw/source/filter/ww8/ww8glsy.hxx |8 sw/source/filter/ww8/ww8par.cxx | 36 - sw/source/filter/ww8/ww8par.hxx | 10 sw/source/filter/ww8/ww8par4.cxx | 20 sw/source/filter/ww8/ww8par5.cxx |6 sw/source/ui/uno/swdetect.cxx|4 sw/source/uibase/app/apphdl.cxx |2 sw/source/uibase/app/docsh.cxx |4 sw/source/uibase/app/docsh2.cxx |3 sw/source/uibase/dochdl/swdtflvr.cxx |4 sw/source/uibase/inc/glosdoc.hxx |4 sw/source/uibase/inc/unoatxt.hxx |3 sw/source/uibase/misc/glshell.cxx|4 sw/source/uibase/uno/unodoc.cxx |6 sw/source/uibase/uno/unotxvw.cxx |4 vcl/inc/svdata.hxx |5 vcl/source/app/scheduler.cxx | 70 --- vcl/source/app/svapp.cxx |4 vcl/source/app/svmain.cxx|3 vcl/win/dtrans/MtaOleClipb.cxx | 35 - vcl/win/dtrans/WinClipboard.cxx | 14 vcl/win/window/salframe.cxx | 10 writerperfect/source/common/WPXSvInputStream.cxx | 30 - 163 files changed, 802 insertions(+), 1045 deletions(-) New commits: commit c844ed2784054c5e08883b05698fcc614d73d9ac Author: Mike Kaganski AuthorDate: Wed Mar 27 17:50:57 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Mar 27 17:50:57 2024 +0500 Revert "Check the correct member" This reverts commit 4169d62be965e2b3c3ddac63bd47030856557529. diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index 518de651d045..fc
core.git: Branch 'distro/vector/vector-7.5.9' - 5 commits - embeddedobj/source fpicker/source include/vcl sfx2/source vcl/source vcl/win
embeddedobj/source/msole/olecomponent.cxx| 42 ++- fpicker/source/win32/VistaFilePickerImpl.cxx |1 include/vcl/svapp.hxx| 12 ++- sfx2/source/control/bindings.cxx |1 vcl/source/app/scheduler.cxx |7 ++-- vcl/source/helper/threadex.cxx |1 vcl/win/dtrans/MtaOleClipb.cxx | 35 +- vcl/win/dtrans/WinClipboard.cxx | 14 + 8 files changed, 62 insertions(+), 51 deletions(-) New commits: commit cb9c9d990600baad9e5a63c80ddaa46e98248161 Author: Mike Kaganski AuthorDate: Thu Mar 21 10:01:36 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Mar 27 09:36:54 2024 +0500 Downgrade sfx::SfxBindings aAutoTimer to an idle This is a follow-up to commit f45402ae3f5241b460d9f1dcb04183893e1f91f7 (Fix a spurious JunitTest_sw_unoapi_3 failure, 2024-03-15). As noted by Stephan, the failure persisted; it was because the update of slots also accessed the changing document model, and it wasn't prevented by IdlesLockGuard, because aAutoTimer had a default priority. Change-Id: Iad8dfadcd35d9611e61e4c011511d6155a343f58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165090 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 4ea06231562a..44fbbd10c2f0 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -146,6 +146,7 @@ SfxBindings::SfxBindings() // all caches are valid (no pending invalidate-job) // create the list of caches +pImpl->aAutoTimer.SetPriority(TaskPriority::HIGH_IDLE); pImpl->aAutoTimer.SetInvokeHandler( LINK(this, SfxBindings, NextJob) ); } commit 3bb1590c78ffcf26cfadcc89a3dd3e0bf8be50e3 Author: Mike Kaganski AuthorDate: Thu Mar 21 10:00:44 2024 +0500 Commit: Mike Kaganski CommitDate: Wed Mar 27 09:27:14 2024 +0500 Only hold clipboard mutexes to obtain the values, to avoid deadlocks Change-Id: I36a2f6e444b8a5397b96d3cba475a8d06ea86459 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165089 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx index 865025057dcc..19a37dc52e19 100644 --- a/vcl/win/dtrans/MtaOleClipb.cxx +++ b/vcl/win/dtrans/MtaOleClipb.cxx @@ -713,25 +713,32 @@ DWORD WINAPI CMtaOleClipboard::clipboardChangedNotifierThreadProc( _In_ LPVOID p MsgWaitForMultipleObjects(2, pInst->m_hClipboardChangedNotifierEvents, false, INFINITE, QS_ALLINPUT | QS_ALLPOSTMESSAGE); -ClearableMutexGuard aGuard2( pInst->m_ClipboardChangedEventCountMutex ); - -if ( pInst->m_ClipboardChangedEventCount > 0 ) +bool hadEvents; { -pInst->m_ClipboardChangedEventCount--; -if ( 0 == pInst->m_ClipboardChangedEventCount ) -ResetEvent( pInst->m_hClipboardChangedEvent ); - -aGuard2.clear( ); +ClearableMutexGuard aGuard2(pInst->m_ClipboardChangedEventCountMutex); +hadEvents = pInst->m_ClipboardChangedEventCount > 0; +if (hadEvents) +{ +pInst->m_ClipboardChangedEventCount--; +if (0 == pInst->m_ClipboardChangedEventCount) +ResetEvent(pInst->m_hClipboardChangedEvent); +} +} -// nobody should touch m_pfncClipViewerCallback while we do -MutexGuard aClipViewerGuard( pInst->m_pfncClipViewerCallbackMutex ); +if (hadEvents) +{ +LPFNC_CLIPVIEWER_CALLBACK_t pClipViewerCallback; +{ +// nobody should touch m_pfncClipViewerCallback while we do +// but don't hold the mutex while calling the callback itself: it could deadlock +MutexGuard aClipViewerGuard(pInst->m_pfncClipViewerCallbackMutex); +pClipViewerCallback = pInst->m_pfncClipViewerCallback; +} // notify all clipboard listener -if ( pInst->m_pfncClipViewerCallback ) -pInst->m_pfncClipViewerCallback( ); +if (pClipViewerCallback) +pClipViewerCallback(); } -else -aGuard2.clear( ); } return 0; diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx index c2fa269dfc5d..33c8023a925c 100644 --- a/vcl/win/dtrans/WinClipboard.cxx +++ b/vcl/win/dtrans/WinClipboard.cxx @@ -373,13 +373,17 @@ void CWinClipboard::unregisterClipboardViewer() { m_MtaOleClipboard.registerClip void WINAPI CWinClipboard::onClipboardContentChanged() { -osl::MutexGuard aGuard(s_aClipboardSingletonMutex); +rtl::Reference pWinClipboard; +{ +/
core.git: vcl/source
vcl/source/app/scheduler.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit e89c4d157a66e273898a8851d25fd0504cb28fc6 Author: Mike Kaganski AuthorDate: Tue Mar 26 19:06:25 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Mar 26 19:08:05 2024 +0100 Set the condition, even when main thread message queue is empty Post an empty user event for that. Change-Id: I9ab4b4374a25eddce8c58d36f58e08bec4a1855c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165352 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index 4f2543641c3c..e9f4057cd47c 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -284,6 +284,9 @@ Scheduler::IdlesLockGuard::IdlesLockGuard() // condition to proceed. Only main thread returning to Application::Execute guarantees that // the flag really took effect. pSVData->m_inExecuteCondtion.reset(); +// Put an empty event to the application's queue, to make sure that it loops through the +// code that sets the condition, even when there's no other events in the queue +Application::PostUserEvent({}); SolarMutexReleaser releaser; pSVData->m_inExecuteCondtion.wait(); }
core.git: embeddedobj/source
embeddedobj/source/msole/olecomponent.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 328416e015174778d11e982fd56f2cb59b0a5168 Author: Mike Kaganski AuthorDate: Tue Mar 26 12:11:13 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Mar 26 17:14:40 2024 +0100 This assert was wrong In commit e2bfc34d146806a8f96be0cd2323d716f12cba4e (Reimplement OleComponentNative_Impl to use IGlobalInterfaceTable, 2024-03-11), I added the assert in a false assumption that RunObject may only be called once. Indeed, this is not so. Thus just make sure to not try to register it second time. Change-Id: I36fc4f3939bd0061e462659749bba8e4bd3075ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165299 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index edbeebb3c0b3..b9c1c27827bb 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -201,7 +201,8 @@ private: template void registerInterface(T* pInterface, DWORD& cookie) { -assert(cookie == 0); // do not set again +if (cookie != 0) // E.g., on subsequent RunObject calls +return; HRESULT hr = m_pGlobalTable->RegisterInterfaceInGlobal(pInterface, __uuidof(T), ); SAL_WARN_IF(FAILED(hr), "embeddedobj.ole", "RegisterInterfaceInGlobal failed"); }
core.git: Branch 'distro/collabora/co-24.04' - sw/inc sw/source
sw/inc/editsh.hxx |4 ++-- sw/source/core/edit/eddel.cxx |8 +--- sw/source/uibase/wrtsh/delete.cxx |4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) New commits: commit ccb26c80cb9f8da9ad6a4d1874a8e68215284eef Author: Mike Kaganski AuthorDate: Thu Jan 18 14:56:54 2024 +0600 Commit: Miklos Vajna CommitDate: Tue Mar 26 16:48:42 2024 +0100 tdf#109272: make sure that Delete / Backspace move cursor correctly ... in change tracking mode. Cursor's end position now doesn't depend on the selection direction; it is at the deletion's beginning in case of Backspace, and at deletion's end in case of Delete. (cherry picked from commit c80606bb23fd42e41710d70a96b7ffaf948384a6) Change-Id: I9cb7af235a066bea2c7b21b8ff515dcdd52218c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165335 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 1fb9ff3a5bae..2b753530159a 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -152,7 +152,7 @@ class SW_DLLPUBLIC SwEditShell : public SwCursorShell that will be used by GetGraphic() and GetGraphicSize(). */ SAL_DLLPRIVATE SwGrfNode *GetGrfNode_() const ; -SAL_DLLPRIVATE void DeleteSel(SwPaM& rPam, bool isArtificialSelection, bool* pUndo = nullptr); +SAL_DLLPRIVATE void DeleteSel(SwPaM& rPam, bool isArtificialSelection, bool goLeft = false, bool* pUndo = nullptr); SAL_DLLPRIVATE void SetSectionAttr_( SwSectionFormat& rSectFormat, const SfxItemSet& rSet ); @@ -178,7 +178,7 @@ public: /** Delete content of all ranges. If whole nodes are selected, these nodes get deleted. */ -bool Delete(bool isArtificialSelection = false); +bool Delete(bool isArtificialSelection = false, bool goLeft = false); /// Remove a complete paragraph. bool DelFullPara(); diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 9eb51da617b1..b8d6b0e39554 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -33,7 +33,8 @@ #include #include -void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool *const pUndo) +void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool goLeft, +bool* const pUndo) { auto const oSelectAll(StartsWith_() != SwCursorShell::StartsWith::None ? ExtendedSelectedAll() @@ -127,11 +128,12 @@ void SwEditShell::DeleteSel(SwPaM& rPam, bool const isArtificialSelection, bool } } +rPam.Normalize(goLeft); // change tracking case: will make sure to end up in the correct point // Selection is not needed anymore rPam.DeleteMark(); } -bool SwEditShell::Delete(bool const isArtificialSelection) +bool SwEditShell::Delete(bool const isArtificialSelection, bool goLeft) { CurrShell aCurr( this ); bool bRet = false; @@ -159,7 +161,7 @@ bool SwEditShell::Delete(bool const isArtificialSelection) for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { -DeleteSel(rPaM, isArtificialSelection, ); +DeleteSel(rPaM, isArtificialSelection, goLeft, ); } // If undo container then close here diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx index e7a09d016587..46b0a40cca5d 100644 --- a/sw/source/uibase/wrtsh/delete.cxx +++ b/sw/source/uibase/wrtsh/delete.cxx @@ -171,7 +171,7 @@ bool SwWrtShell::DelLeft() { SwActContext aActContext(this); ResetCursorStack(); -Delete(false); +Delete(false, true); UpdateAttr(); } if( IsBlockMode() ) @@ -274,7 +274,7 @@ bool SwWrtShell::DelLeft() SwCursorShell::Pop( SwCursorShell::PopMode::DeleteStack ); } } -bool bRet = Delete(true); +bool bRet = Delete(true, true); if( !bRet && bSwap ) SwCursorShell::SwapPam(); CloseMark( bRet );
core.git: embeddedobj/source
embeddedobj/source/msole/olecomponent.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit f0c32a4de8b18cc9f42bd441961ae4ae9fc72ceb Author: Mike Kaganski AuthorDate: Tue Mar 26 10:11:29 2024 +0100 Commit: Mike Kaganski CommitDate: Tue Mar 26 15:54:26 2024 +0100 Replace some matchAsciiL (and wrong lengths) with match Change-Id: I6d0b5fa249cb466230183e11fc96a89fad69d45d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165310 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index a19c9aa72b20..edbeebb3c0b3 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -273,7 +273,7 @@ bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium, if ( nBufSize && nBufSize == GetMetaFileBitsEx( pMF->hMF, nBufSize - 22, pBuf.get() + 22 ) ) { -if ( aFlavor.MimeType.matchAsciiL( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"", 57 ) ) +if ( aFlavor.MimeType.match( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"" ) ) { aResult <<= uno::Sequence< sal_Int8 >( pBuf.get(), nBufSize ); bAnyIsReady = true; @@ -290,7 +290,7 @@ bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium, pBuf.reset(new sal_Int8[nBufSize]); if ( nBufSize && nBufSize == GetEnhMetaFileBits( aMedium.hEnhMetaFile, nBufSize, reinterpret_cast(pBuf.get()) ) ) { -if ( aFlavor.MimeType.matchAsciiL( "application/x-openoffice-emf;windows_formatname=\"Image EMF\"", 57 ) ) +if ( aFlavor.MimeType.match( "application/x-openoffice-emf;windows_formatname=\"Image EMF\"" ) ) { aResult <<= uno::Sequence< sal_Int8 >( pBuf.get(), nBufSize ); bAnyIsReady = true; @@ -310,7 +310,7 @@ bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium, pBuf.reset(new sal_Int8[nBufSize]); if ( nBufSize && nBufSize == sal::static_int_cast< ULONG >( GetBitmapBits( aMedium.hBitmap, nBufSize, pBuf.get() ) ) ) { -if ( aFlavor.MimeType.matchAsciiL( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", 54 ) ) +if ( aFlavor.MimeType.match( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" ) ) { aResult <<= uno::Sequence< sal_Int8 >( pBuf.get(), nBufSize ); bAnyIsReady = true;
core.git: Branch 'libreoffice-7-6' - sw/source
sw/source/ui/index/cnttab.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4fd5e282a6b0b9e531740b500c52040dc6ac5481 Author: Mike Kaganski AuthorDate: Mon Mar 25 17:41:24 2024 +0500 Commit: Xisco Fauli CommitDate: Tue Mar 26 13:14:31 2024 +0100 tdf#160351: the field name can be shorter than two symbols Change-Id: Id834ae2919661752b921510f766c9e9ff7fc16fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165282 Reviewed-by: Julien Nabet Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 4a14bad7232ecf23d23c1997dc20922d0b4892cb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165246 Reviewed-by: Xisco Fauli (cherry picked from commit 0a4569912915459b3eb10d0d52624403ce15c46f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165248 diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index f68aa514d272..61aeb63080d1 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -2919,7 +2919,7 @@ SwTOXWidget* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& //use the first two chars as symbol OUString sTmp(SwAuthorityFieldType::GetAuthFieldName( static_cast(rToken.nAuthorityField))); -pButton->SetText(sTmp.copy(0, 2)); +pButton->SetText(sTmp.copy(0, std::min(sTmp.getLength(), sal_Int32(2; } sal_uInt32 nIndex = GetControlIndex( rToken.eTokenType );
core.git: Branch 'libreoffice-24-2' - sw/source
sw/source/ui/index/cnttab.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 0a86d2e2dd898aa1d455c0bbde91dd9a8b011daf Author: Mike Kaganski AuthorDate: Mon Mar 25 17:41:24 2024 +0500 Commit: Xisco Fauli CommitDate: Tue Mar 26 09:23:57 2024 +0100 tdf#160351: the field name can be shorter than two symbols Change-Id: Id834ae2919661752b921510f766c9e9ff7fc16fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165282 Reviewed-by: Julien Nabet Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 4a14bad7232ecf23d23c1997dc20922d0b4892cb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165246 Reviewed-by: Xisco Fauli diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index a5d3bf92ddef..f07cf8ab2883 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -2933,7 +2933,7 @@ SwTOXWidget* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& //use the first two chars as symbol OUString sTmp(SwAuthorityFieldType::GetAuthFieldName( static_cast(rToken.nAuthorityField))); -pButton->SetText(sTmp.copy(0, 2)); +pButton->SetText(sTmp.copy(0, std::min(sTmp.getLength(), sal_Int32(2; } sal_uInt32 nIndex = GetControlIndex( rToken.eTokenType );
Re: Is anybody using LO's JavaScript editor window?
On 26.03.2024 5:55, Thorsten Behrens wrote: any recollection of anyone ever using live-editing of JS in LibreOffice? Here is a list of Ask topics with "JavaScript" in title: https://ask.libreoffice.org/search?q=JavaScript%20in%3Atitle%20order%3Alatest IMO, it is best to provide a better language compliance, sacrificing the editor if unavoidable; the IDE could catch up later, even as an extension, like with Python's APSO. -- Best regards, Mike Kaganski
core.git: sw/source
sw/source/ui/index/cnttab.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4a14bad7232ecf23d23c1997dc20922d0b4892cb Author: Mike Kaganski AuthorDate: Mon Mar 25 17:41:24 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Mar 25 16:52:31 2024 +0100 tdf#160351: the field name can be shorter than two symbols Change-Id: Id834ae2919661752b921510f766c9e9ff7fc16fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165282 Reviewed-by: Julien Nabet Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index a5d3bf92ddef..f07cf8ab2883 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -2933,7 +2933,7 @@ SwTOXWidget* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& //use the first two chars as symbol OUString sTmp(SwAuthorityFieldType::GetAuthFieldName( static_cast(rToken.nAuthorityField))); -pButton->SetText(sTmp.copy(0, 2)); +pButton->SetText(sTmp.copy(0, std::min(sTmp.getLength(), sal_Int32(2; } sal_uInt32 nIndex = GetControlIndex( rToken.eTokenType );