core.git: svx/source sw/qa
svx/source/svdraw/svdopath.cxx | 11 +++ sw/qa/extras/ooxmlexport/data/cloud.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |8 3 files changed, 15 insertions(+), 4 deletions(-) New commits: commit 08da27fc377f443d1d6698f4a061fa462849062d Author: Mike Kaganski AuthorDate: Wed May 22 20:22:08 2024 +0500 Commit: Mike Kaganski CommitDate: Wed May 22 20:53:05 2024 +0200 Handle empty range correctly Otherwise, the translation gets MAX_DBL value, and scaling becomes 0. After commit 690526f95e3ee4fd25bb2c987e093543e4bc435b (Generalize basegfx::fround for templated return type, 2024-04-15) this made some documents (e.g., bugdoc in tdf#85132) fail an assertion in debug builds, which allowed to find and fix this problem. Change-Id: I14cb0afd0c8d884f505efb921907cc8e86418da2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167965 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 322b7444960f..935397d1ea61 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2850,11 +2850,14 @@ bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DP // itself, else this method will no longer return the full polygon information (curve will // be lost) const basegfx::B2DRange aPolyRangeNoCurve(basegfx::utils::getRange(rPolyPolygon)); -aScale = aPolyRangeNoCurve.getRange(); -aTranslate = aPolyRangeNoCurve.getMinimum(); +if (!aPolyRangeNoCurve.isEmpty()) +{ +aScale = aPolyRangeNoCurve.getRange(); +aTranslate = aPolyRangeNoCurve.getMinimum(); -// define matrix for move polygon to zero point -aMoveToZeroMatrix.translate(-aTranslate.getX(), -aTranslate.getY()); +// define matrix for move polygon to zero point +aMoveToZeroMatrix.translate(-aTranslate.getX(), -aTranslate.getY()); +} } } diff --git a/sw/qa/extras/ooxmlexport/data/cloud.docx b/sw/qa/extras/ooxmlexport/data/cloud.docx new file mode 100644 index ..74c4ac91031c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/cloud.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 6cfbe8d783fc..1c55be3df2cf 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -553,6 +553,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf154369, "tdf154369.docx") "color"_ostr, "00527d55"); } +CPPUNIT_TEST_FIXTURE(Test, testEmptyObjectRange) +{ +// Before the fix, this failed an assertion like this: +// Assertion failed: isBetween(n, (SAL_MIN_INT64 + d / 2) / m, (SAL_MAX_INT64 - d / 2) / m), +// file C:\lo+loadAndSave("cloud.docx"); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf161172.fodt | 35 + sw/qa/extras/uiwriter/uiwriter9.cxx | 41 ++ sw/source/core/doc/docfmt.cxx | 10 ++- 3 files changed, 80 insertions(+), 6 deletions(-) New commits: commit af38e96cad0949291a289443363218f93ba59ecd Author: Mike Kaganski AuthorDate: Sun May 19 13:40:49 2024 +0500 Commit: Miklos Vajna CommitDate: Tue May 21 14:01:59 2024 +0200 tdf#161172: Also record history for !bChangeOfListStyleAtParagraph Change-Id: I6443d7ef76a27ac3ab75f88edd271a8b36e06c14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167839 Reviewed-by: Mike Kaganski Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167841 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/uiwriter/data/tdf161172.fodt b/sw/qa/extras/uiwriter/data/tdf161172.fodt new file mode 100644 index ..08cea575cc60 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf161172.fodt @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + foo + + + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index ecf35075623e..335b004fa6f8 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -256,6 +257,46 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159054_disableOutlineNumbering) CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara2, "ListLabelString")); CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara3, "ListLabelString")); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf161172) +{ +// Given a paragraph manually made a member of a list: +createSwDoc("tdf161172.fodt"); +auto para = getParagraph(1); + +// Check initial state: the first paragraph has "No_list" para style, "Num_1" numbering style, +// numbering level 0, and "Num1_lvl1_1" numbering label. +CPPUNIT_ASSERT_EQUAL(u"No_list"_ustr, getProperty(para, u"ParaStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, u"NumberingStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num1_lvl1_1"_ustr, getProperty(para, u"ListLabelString"_ustr)); +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(para, u"NumberingLevel"_ustr)); + +// Assign "Num_1_lvl2" paragraph style to the first paragraph. The style is associated with +// "Num_1" numbering style, level 1. +dispatchCommand(mxComponent, u".uno:StyleApply"_ustr, +{ comphelper::makePropertyValue(u"FamilyName"_ustr, u"ParagraphStyles"_ustr), + comphelper::makePropertyValue(u"Style"_ustr, u"Num_1_lvl2"_ustr) }); + +// Check that the respective properties got correctly applied +CPPUNIT_ASSERT_EQUAL(u"Num_1_lvl2"_ustr, getProperty(para, u"ParaStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, u"NumberingStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num1_lvl2_1"_ustr, getProperty(para, u"ListLabelString"_ustr)); +CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty(para, u"NumberingLevel"_ustr)); + +// Undo +dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); + +// Check that the numbering properties got correctly restored +CPPUNIT_ASSERT_EQUAL(u"No_list"_ustr, getProperty(para, u"ParaStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, u"NumberingStyleName"_ustr)); +// Without the fix, this would fail with +// - Expected: Num1_lvl1_1 +// - Actual : Num1_lvl2_1 +CPPUNIT_ASSERT_EQUAL(u"Num1_lvl1_1"_ustr, getProperty(para, u"ListLabelString"_ustr)); +// Without the fix, this would fail with +// - Expected: 0 +// - Actual : 1 +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(para, u"NumberingLevel"_ustr)); +} } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 1c696bebb6a0..3390a506052c 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1040,14 +1040,12 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* pArgs ) } } +std::optional oRegH; +if (pPara->pHistory) +oRegH.emplace(, rTNd, pPara->pHistory); + if ( bChangeOfListStyleAtParagraph ) { -std::unique_ptr< SwRegHistory > pRegH; -if ( pPara->pHistory ) -{ -pRegH.reset(new SwRegHistory(, rTNd, pPara->pHistory)); -} - pCNd->ResetAttr( RES_PARATR_NUMRULE ); // reset all list attributes
core.git: Branch 'libreoffice-24-2' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf161172.fodt | 35 + sw/qa/extras/uiwriter/uiwriter9.cxx | 42 ++ sw/source/core/doc/docfmt.cxx | 10 ++- 3 files changed, 81 insertions(+), 6 deletions(-) New commits: commit e9e27cc9a8914e97f5ea28de863e580062e030de Author: Mike Kaganski AuthorDate: Sun May 19 13:40:49 2024 +0500 Commit: Xisco Fauli CommitDate: Tue May 21 11:27:26 2024 +0200 tdf#161172: Also record history for !bChangeOfListStyleAtParagraph Change-Id: I6443d7ef76a27ac3ab75f88edd271a8b36e06c14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167839 Reviewed-by: Mike Kaganski Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167818 diff --git a/sw/qa/extras/uiwriter/data/tdf161172.fodt b/sw/qa/extras/uiwriter/data/tdf161172.fodt new file mode 100644 index ..08cea575cc60 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf161172.fodt @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + foo + + + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index fe69b26dd87a..2389aa63714a 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -214,6 +215,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf160898) pWrtShell->SelAll(); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf161172) +{ +// Given a paragraph manually made a member of a list: +createSwDoc("tdf161172.fodt"); +auto para = getParagraph(1); + +// Check initial state: the first paragraph has "No_list" para style, "Num_1" numbering style, +// numbering level 0, and "Num1_lvl1_1" numbering label. +CPPUNIT_ASSERT_EQUAL(u"No_list"_ustr, getProperty(para, u"ParaStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, u"NumberingStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num1_lvl1_1"_ustr, getProperty(para, u"ListLabelString"_ustr)); +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(para, u"NumberingLevel"_ustr)); + +// Assign "Num_1_lvl2" paragraph style to the first paragraph. The style is associated with +// "Num_1" numbering style, level 1. +dispatchCommand(mxComponent, u".uno:StyleApply"_ustr, +{ comphelper::makePropertyValue(u"FamilyName"_ustr, u"ParagraphStyles"_ustr), + comphelper::makePropertyValue(u"Style"_ustr, u"Num_1_lvl2"_ustr) }); + +// Check that the respective properties got correctly applied +CPPUNIT_ASSERT_EQUAL(u"Num_1_lvl2"_ustr, getProperty(para, u"ParaStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, u"NumberingStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num1_lvl2_1"_ustr, getProperty(para, u"ListLabelString"_ustr)); +CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty(para, u"NumberingLevel"_ustr)); + +// Undo +dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); + +// Check that the numbering properties got correctly restored +CPPUNIT_ASSERT_EQUAL(u"No_list"_ustr, getProperty(para, u"ParaStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, u"NumberingStyleName"_ustr)); +// Without the fix, this would fail with +// - Expected: Num1_lvl1_1 +// - Actual : Num1_lvl2_1 +CPPUNIT_ASSERT_EQUAL(u"Num1_lvl1_1"_ustr, getProperty(para, u"ListLabelString"_ustr)); +// Without the fix, this would fail with +// - Expected: 0 +// - Actual : 1 +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(para, u"NumberingLevel"_ustr)); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 1c696bebb6a0..3390a506052c 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1040,14 +1040,12 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* pArgs ) } } +std::optional oRegH; +if (pPara->pHistory) +oRegH.emplace(, rTNd, pPara->pHistory); + if ( bChangeOfListStyleAtParagraph ) { -std::unique_ptr< SwRegHistory > pRegH; -if ( pPara->pHistory ) -{ -pRegH.reset(new SwRegHistory(, rTNd, pPara->pHistory)); -} - pCNd->ResetAttr( RES_PARATR_NUMRULE ); // reset all list attributes
core.git: desktop/source
desktop/source/deployment/manager/dp_manager.cxx |3 --- 1 file changed, 3 deletions(-) New commits: commit 9851311055da1a050405f7bc0b7e12ad7cff3cbe Author: Mike Kaganski AuthorDate: Mon May 20 16:00:39 2024 +0200 Commit: Mike Kaganski CommitDate: Mon May 20 17:31:19 2024 +0200 Drop remnants of a long-obsolete hack In commits 6dd5a96e1e3a6bb307f8f2d43cce2b5f2cde659d (INTEGRATION: CWS unopkg1 (1.1.2); FILE ADDED, 2004-04-14), 19a10039a59002b68291e7f200f85fd962592d75 (INTEGRATION: CWS unopkg2 (1.2.4); FILE MERGED, 2004-06-11), and 886715b6b6f30fed36d50a4ddf84ed5984f4f993 (INTEGRATION: CWS scriptingf7 (1.3.4); FILE MERGED, 2004-07-23), a hack was introduced to allow empty substorages. Later, in commits 0d6b24a721f05fedef9cd32b596a0fec71a5089f (INTEGRATION: CWS tdoc3 (1.7.24); FILE MERGED, 2004-11-09) and 5f4d17724f7323077191114486edff8cdce05b2f (INTEGRATION: CWS scriptingf9 (1.6.2); FILE MERGED, 2004-12-23), that hack was removed, but one place was kept, which is removed now. Change-Id: Iaaf46421ddbe942878ebe17ca1e585be9db5999d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167823 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index c2c8c621df1f..574470068da1 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -130,9 +130,6 @@ void PackageManagerImpl::initActivationLayer( { Reference xRow( xResultSet, UNO_QUERY_THROW ); OUString title( xRow->getString( 1 /* Title */ ) ); -// xxx todo: remove workaround for tdoc -if ( title == "this_is_a_dummy_stream_just_there_as_a_workaround_for_a_temporary_limitation_of_the_storage_api_implementation" ) -continue; if ( title == "META-INF" ) continue;
core.git: sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf161172.fodt | 35 + sw/qa/extras/uiwriter/uiwriter9.cxx | 41 ++ sw/source/core/doc/docfmt.cxx | 10 ++- 3 files changed, 80 insertions(+), 6 deletions(-) New commits: commit bb5740bb4c79c6c9507d4dc127e9f4bac78afc2f Author: Mike Kaganski AuthorDate: Sun May 19 13:40:49 2024 +0500 Commit: Mike Kaganski CommitDate: Sun May 19 12:36:09 2024 +0200 tdf#161172: Also record history for !bChangeOfListStyleAtParagraph Change-Id: I6443d7ef76a27ac3ab75f88edd271a8b36e06c14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167839 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data/tdf161172.fodt b/sw/qa/extras/uiwriter/data/tdf161172.fodt new file mode 100644 index ..08cea575cc60 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf161172.fodt @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + foo + + + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index d8b10279a827..a0918742a438 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -607,6 +607,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf160898) pWrtShell->SelAll(); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf161172) +{ +// Given a paragraph manually made a member of a list: +createSwDoc("tdf161172.fodt"); +auto para = getParagraph(1); + +// Check initial state: the first paragraph has "No_list" para style, "Num_1" numbering style, +// numbering level 0, and "Num1_lvl1_1" numbering label. +CPPUNIT_ASSERT_EQUAL(u"No_list"_ustr, getProperty(para, u"ParaStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, u"NumberingStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num1_lvl1_1"_ustr, getProperty(para, u"ListLabelString"_ustr)); +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(para, u"NumberingLevel"_ustr)); + +// Assign "Num_1_lvl2" paragraph style to the first paragraph. The style is associated with +// "Num_1" numbering style, level 1. +dispatchCommand(mxComponent, u".uno:StyleApply"_ustr, +{ comphelper::makePropertyValue(u"FamilyName"_ustr, u"ParagraphStyles"_ustr), + comphelper::makePropertyValue(u"Style"_ustr, u"Num_1_lvl2"_ustr) }); + +// Check that the respective properties got correctly applied +CPPUNIT_ASSERT_EQUAL(u"Num_1_lvl2"_ustr, getProperty(para, u"ParaStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, u"NumberingStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num1_lvl2_1"_ustr, getProperty(para, u"ListLabelString"_ustr)); +CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty(para, u"NumberingLevel"_ustr)); + +// Undo +dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); + +// Check that the numbering properties got correctly restored +CPPUNIT_ASSERT_EQUAL(u"No_list"_ustr, getProperty(para, u"ParaStyleName"_ustr)); +CPPUNIT_ASSERT_EQUAL(u"Num_1"_ustr, getProperty(para, u"NumberingStyleName"_ustr)); +// Without the fix, this would fail with +// - Expected: Num1_lvl1_1 +// - Actual : Num1_lvl2_1 +CPPUNIT_ASSERT_EQUAL(u"Num1_lvl1_1"_ustr, getProperty(para, u"ListLabelString"_ustr)); +// Without the fix, this would fail with +// - Expected: 0 +// - Actual : 1 +CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty(para, u"NumberingLevel"_ustr)); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 6690ae418831..722d3dba8c0d 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1046,14 +1046,12 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* pArgs ) } } +std::optional oRegH; +if (pPara->pHistory) +oRegH.emplace(, rTNd, pPara->pHistory); + if ( bChangeOfListStyleAtParagraph ) { -std::unique_ptr< SwRegHistory > pRegH; -if ( pPara->pHistory ) -{ -pRegH.reset(new SwRegHistory(, rTNd, pPara->pHistory)); -} - pCNd->ResetAttr( RES_PARATR_NUMRULE ); // reset all list attributes
core.git: vcl/win
vcl/win/gdi/salprn.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 60600b5bc07487a5e31f643029357211d70c0481 Author: Mike Kaganski AuthorDate: Sat May 18 15:28:48 2024 +0500 Commit: Mike Kaganski CommitDate: Sat May 18 15:10:55 2024 +0200 WaE: Dereferencing NULL pointer C:/lo/core/vcl/win/gdi/salprn.cxx(180): error C2220: the following warning is treated as an error C:\lo Change-Id: Id20f4bc308259a706cc55fc8331a5119b2172a14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167807 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 80ea56f2e9f8..6edcc9ac2938 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -166,6 +166,7 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) PRINTER_INFO_4W* pWinInfo4 = static_cast(std::malloc( nBytes )); if ( EnumPrintersW( PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, nullptr, 4, reinterpret_cast(pWinInfo4), nBytes, , ) ) { +assert(pWinInfo4); for ( i = 0; i < nInfoPrn4; i++ ) { std::unique_ptr pInfo(new SalPrinterQueueInfo);
core.git: Branch 'distro/vector/vector-7.5.9' - drawinglayer/source include/vcl vcl/source vcl/win
drawinglayer/source/processor2d/vclprocessor2d.cxx | 24 - include/vcl/outdev.hxx |5 include/vcl/vcllayout.hxx |6 + vcl/source/outdev/text.cxx |2 - vcl/win/gdi/DWriteTextRenderer.cxx |8 --- 5 files changed, 31 insertions(+), 14 deletions(-) New commits: commit 368bc2b821dde56379c9a4c3acfcc3143efbdf6d Author: Mike Kaganski AuthorDate: Fri May 17 20:40:37 2024 +0500 Commit: Mike Kaganski CommitDate: Sat May 18 14:46:38 2024 +0500 tdf#161154: pass "scaling is done externally" information down the stack VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D does the scaling, taking into account the font scaling. Before commit 8557ea84c9336ba8061246f1f46ddb6e02f413a1, D2DWriteTextOutRenderer was doing own scaling in addition, but it seems that it somehow didn't affect the result much. The said commit removed the scalng from D2DWriteTextOutRenderer. As tdf#160901 demonstrated, the scaling is necessary in different code paths - and it turns out, that we need to know, if the caller does its own scaling or not, to make a decision, if the scaling should be fone in D2DWriteTextOutRenderer. This hack passes this from VclProcessor2D to D2DWriteTextOutRenderer through OutputDevice. Thanks to Miklos for the isea. I still don't understand, why all this seemingly doesn't affect other renderers. Change-Id: I001036f4574898b8e7606652525638df43c35240 diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 109be5cd40f9..f401c220f170 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -428,17 +428,21 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( mpOutputDevice->SetFont(aFont); mpOutputDevice->SetTextColor(Color(aRGBFontColor)); -if (!aDXArray.empty()) { -const SalLayoutGlyphs* pGlyphs = SalLayoutGlyphsCache::self()->GetLayoutGlyphs( -mpOutputDevice, aText, nPos, nLen); -mpOutputDevice->DrawTextArray(aStartPoint, aText, aDXArray, - rTextCandidate.getKashidaArray(), nPos, nLen, - SalLayoutFlags::NONE, pGlyphs); -} -else -{ -mpOutputDevice->DrawText(aStartPoint, aText, nPos, nLen); +// For D2DWriteTextOutRenderer, we must pass a flag to not use font scaling +auto guard = mpOutputDevice->ScopedNoFontScaling(); +if (!aDXArray.empty()) +{ +const SalLayoutGlyphs* pGlyphs = SalLayoutGlyphsCache::self()->GetLayoutGlyphs( +mpOutputDevice, aText, nPos, nLen); +mpOutputDevice->DrawTextArray(aStartPoint, aText, aDXArray, + rTextCandidate.getKashidaArray(), nPos, nLen, + SalLayoutFlags::NONE, pGlyphs); +} +else +{ +mpOutputDevice->DrawText(aStartPoint, aText, nPos, nLen); +} } if (rTextCandidate.getFontAttribute().getRTL()) diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 098a5ccc5ef0..7142fee006df 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -258,6 +259,8 @@ private: mutable boolmbRefPoint : 1; mutable boolmbEnableRTL : 1; +bool mbNoFontScaling = false; // Used only by D2DWriteTextOutRenderer + protected: mutable std::shared_ptr mxFontCollection; mutable std::shared_ptr mxFontCache; @@ -340,6 +343,8 @@ public: /// request XSpriteCanvas render interface css::uno::Reference< css::rendering::XSpriteCanvas > GetSpriteCanvas() const; +auto ScopedNoFontScaling() { return comphelper::FlagRestorationGuard(mbNoFontScaling, true); } + protected: /** Acquire a graphics device that the output device uses to draw on. diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx index 887480ce3ee9..a70fdaaddc1c 100644 --- a/include/vcl/vcllayout.hxx +++ b/include/vcl/vcllayout.hxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -110,6 +111,9 @@ public: virtual SalLayoutGlyphs GetGlyphs() const; +auto ScopedFontScaling(bool v) { return comphelper::FlagRestorationGuard(mbScaleFont, v); } +bool ScaleFont() const { return mbScaleFont; } + protected: // used by
core.git: drawinglayer/source include/vcl vcl/source vcl/win
drawinglayer/source/processor2d/vclprocessor2d.cxx | 24 - include/vcl/outdev.hxx |5 include/vcl/vcllayout.hxx |6 + vcl/source/outdev/text.cxx |2 - vcl/win/gdi/DWriteTextRenderer.cxx |8 --- 5 files changed, 31 insertions(+), 14 deletions(-) New commits: commit 2092df2a9044f1c2ae4379f48a3201e5867575a8 Author: Mike Kaganski AuthorDate: Fri May 17 20:40:37 2024 +0500 Commit: Mike Kaganski CommitDate: Sat May 18 11:03:58 2024 +0200 tdf#161154: pass "scaling is done externally" information down the stack VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D does the scaling, taking into account the font scaling. Before commit 8557ea84c9336ba8061246f1f46ddb6e02f413a1, D2DWriteTextOutRenderer was doing own scaling in addition, but it seems that it somehow didn't affect the result much. The said commit removed the scalng from D2DWriteTextOutRenderer. As tdf#160901 demonstrated, the scaling is necessary in different code paths - and it turns out, that we need to know, if the caller does its own scaling or not, to make a decision, if the scaling should be fone in D2DWriteTextOutRenderer. This hack passes this from VclProcessor2D to D2DWriteTextOutRenderer through OutputDevice. Thanks to Miklos for the isea. I still don't understand, why all this seemingly doesn't affect other renderers. Change-Id: I001036f4574898b8e7606652525638df43c35240 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167786 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 3cfec4af8b8d..c245389fdcb5 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -439,17 +439,21 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( mpOutputDevice->SetFont(aFont); mpOutputDevice->SetTextColor(Color(aRGBFontColor)); -if (!aDXArray.empty()) { -const SalLayoutGlyphs* pGlyphs = SalLayoutGlyphsCache::self()->GetLayoutGlyphs( -mpOutputDevice, aText, nPos, nLen); -mpOutputDevice->DrawTextArray(aStartPoint, aText, aDXArray, - rTextCandidate.getKashidaArray(), nPos, nLen, - SalLayoutFlags::NONE, pGlyphs); -} -else -{ -mpOutputDevice->DrawText(aStartPoint, aText, nPos, nLen); +// For D2DWriteTextOutRenderer, we must pass a flag to not use font scaling +auto guard = mpOutputDevice->ScopedNoFontScaling(); +if (!aDXArray.empty()) +{ +const SalLayoutGlyphs* pGlyphs = SalLayoutGlyphsCache::self()->GetLayoutGlyphs( +mpOutputDevice, aText, nPos, nLen); +mpOutputDevice->DrawTextArray(aStartPoint, aText, aDXArray, + rTextCandidate.getKashidaArray(), nPos, nLen, + SalLayoutFlags::NONE, pGlyphs); +} +else +{ +mpOutputDevice->DrawText(aStartPoint, aText, nPos, nLen); +} } if (rTextCandidate.getFontAttribute().getRTL()) diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index ab1758835ce1..6dbb9acf7f32 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -260,6 +261,8 @@ private: mutable boolmbRefPoint : 1; mutable boolmbEnableRTL : 1; +bool mbNoFontScaling = false; // Used only by D2DWriteTextOutRenderer + protected: mutable std::shared_ptr mxFontCollection; mutable std::shared_ptr mxFontCache; @@ -342,6 +345,8 @@ public: /// request XSpriteCanvas render interface css::uno::Reference< css::rendering::XSpriteCanvas > GetSpriteCanvas() const; +auto ScopedNoFontScaling() { return comphelper::FlagRestorationGuard(mbNoFontScaling, true); } + protected: /** Acquire a graphics device that the output device uses to draw on. diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx index dd0747eae3ec..9370c69ded2e 100644 --- a/include/vcl/vcllayout.hxx +++ b/include/vcl/vcllayout.hxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -120,6 +121,9 @@ public: virtual SalLayoutGlyphs GetGlyphs() const; +auto ScopedFontScaling(bool v) { return comp
core.git: Branch 'feature/cib_contract57d' - 27 commits - avmedia/source configure.ac dbaccess/source download.lst drawinglayer/source embeddedobj/source external/curl external/liblangtag external/lib
Rebased ref, commits from common ancestor: commit 5669f498e84622dd969bb7ee83583701087df82b Author: Mike Kaganski AuthorDate: Sun Feb 25 08:48:08 2024 +0600 Commit: Thorsten Behrens CommitDate: Fri May 17 18:29:59 2024 +0200 Use SAL_WNODEPRECATED_DECLARATIONS_(PUSH|POP) Change-Id: I2810d22e8f5e1c81647b9e9b15519de65939630a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163895 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx index 2acc7dba07b5..14088a70ee2a 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.cxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -478,21 +478,9 @@ namespace XSLT params = args; } -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4996) -#endif +SAL_WNODEPRECATED_DECLARATIONS_PUSH xmlSubstituteEntitiesDefault(0); -#if defined(_MSC_VER) -#pragma warning(pop) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +SAL_WNODEPRECATED_DECLARATIONS_POP m_parameters.clear(); for (int i = 0; i < params.getLength(); i++) diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx index 98fd7f6eb55d..9cd0425c2e05 100644 --- a/helpcompiler/source/HelpCompiler.cxx +++ b/helpcompiler/source/HelpCompiler.cxx @@ -44,21 +44,9 @@ HelpCompiler::HelpCompiler(StreamTable _streamTable, const fs::path _input src(in_src), zipdir(in_zipdir), module(in_module), lang(in_lang), resCompactStylesheet(in_resCompactStylesheet), resEmbStylesheet(in_resEmbStylesheet), bExtensionMode( in_bExtensionMode ) { -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4996) -#endif +SAL_WNODEPRECATED_DECLARATIONS_PUSH xmlKeepBlanksDefaultValue = 0; -#if defined(_MSC_VER) -#pragma warning(pop) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +SAL_WNODEPRECATED_DECLARATIONS_POP char* os = getenv("OS"); if (os) { diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 3c910f3b39df..6651f23bdf68 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -82,14 +82,9 @@ struct GetPPDAttribs { // This CUPS method is not at all thread-safe we need // to dup the pointer to a static buffer it returns ASAP -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif +SAL_WNODEPRECATED_DECLARATIONS_PUSH OString aResult = cupsGetPPD(m_aParameter.getStr()); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +SAL_WNODEPRECATED_DECLARATIONS_POP MutexGuard aGuard( *m_pSyncMutex ); m_aResult = aResult; m_aCondition.set(); @@ -222,10 +217,7 @@ void CUPSManager::runDests() // n#722902 - do a fast-failing check for cups working *at all* first http_t* p_http; -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif +SAL_WNODEPRECATED_DECLARATIONS_PUSH if( (p_http=httpConnectEncrypt( cupsServer(), ippPort(), @@ -242,9 +234,7 @@ void CUPSManager::runDests() httpClose(p_http); } -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +SAL_WNODEPRECATED_DECLARATIONS_POP } void CUPSManager::initialize() @@ -454,14 +444,9 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter ) rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); OUString aFileName( OStringToOUString( aPPDFile, aEncoding ) ); // update the printer info with context information -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif +SAL_WNODEPRECATED_DECLARATIONS_PUSH ppd_file_t* pPPD = ppdOpenFile( aPPDFile.getStr() ); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif +SAL_WNODEPRECATED_DECLARATIONS_POP if( pPPD ) { // create the new parser @@ -469,14 +454,9 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter ) pCUPSParser->m_aFile = rPrinter; pNewParser = pCUPSParser; -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif +SAL_WNODEPRECATED_DECLARATIONS_PUSH /*int nConflicts =*/ cupsMarkOptions( pPPD, pDest->num_options, pDest->options )
core.git: Branch 'distro/vector/vector-7.5.9-release' - 2 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/layout2.cxx | 29 + sw/source/core/text/frmform.cxx | 100 +++- 5 files changed, 284 insertions(+), 13 deletions(-) New commits: commit f6e80f3a2917ad9809b16cca03049ae4e985893a Author: Mike Kaganski AuthorDate: Sun Apr 7 18:23:52 2024 +0500 Commit: Mike Kaganski CommitDate: Thu May 16 17:07:57 2024 +0500 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/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 55f2b966c6dc..ce6c7c56bb1e 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -2927,6 +2927,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, test_i84870) CPPUNIT_ASSERT_EQUAL(2, getPages()); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 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(SwLayoutWriter2, 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"); +} + 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 19dcb6e3ed5f..2e00f55f0988 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -1003,6 +1003,53 @@ 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;;) +{ +if (pCur->GetPrev()) +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->GetDrawObjs(); +if (pPageDrawObjs) +{ +for (const auto pObject : *pPageDrawObjs) +if (pObject->GetFrameFormat().GetAnchor().Ge
core.git: Branch 'libreoffice-24-2' - sw/qa sw/source
sw/qa/extras/unowriter/data/tdf161035.fodt |9 + sw/qa/extras/unowriter/unowriter.cxx | 27 +++ sw/source/core/unocore/unoportenum.cxx |4 +++- 3 files changed, 39 insertions(+), 1 deletion(-) New commits: commit 324c1a72961ccc1af1c496689c558aa127ef3d81 Author: Mike Kaganski AuthorDate: Thu May 16 11:07:26 2024 +0500 Commit: Adolfo Jayme Barrientos CommitDate: Thu May 16 22:41:09 2024 +0200 tdf#161035: The previous bookmarks can legitimately be not processed The enumeration may be called for a partial paragraph selection, and then the bookmarks prior to the selection are not processed. Change-Id: Ib725ffb320ec5a81b39ce77f06392a82bd6d8ee0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167720 Reviewed-by: Mike Kaganski Tested-by: Jenkins Reviewed-by: Patrick Luby Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167754 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/qa/extras/unowriter/data/tdf161035.fodt b/sw/qa/extras/unowriter/data/tdf161035.fodt new file mode 100644 index ..8f1d53b083d6 --- /dev/null +++ b/sw/qa/extras/unowriter/data/tdf161035.fodt @@ -0,0 +1,9 @@ + + + + + + Lorem ipsum. + + + \ No newline at end of file diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 80b9e556f73b..7175e702d709 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -1222,6 +1222,33 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf160278) CPPUNIT_ASSERT_EQUAL(u"12test"_ustr, xText->getString()); } +CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf161035) +{ +// Given a paragraph with a bookmark: +createSwDoc("tdf161035.fodt"); +auto xModel = mxComponent.queryThrow(); + +// Create a text view cursor in the paragraph. +auto xController = xModel->getCurrentController().queryThrow(); +auto xViewCursor = xController->getViewCursor(); +CPPUNIT_ASSERT(xViewCursor); +auto xText = xViewCursor->getText(); +CPPUNIT_ASSERT(xText); +// Create a text cursor from the text view cursor, and move it to the end of the paragraph +auto xTextCursor = xText->createTextCursorByRange(xViewCursor); +CPPUNIT_ASSERT(xTextCursor); +xTextCursor->gotoEnd(false); +// Get the first paragraph portion from the text cursor +auto xParaEnum = xTextCursor.queryThrow()->createEnumeration(); +CPPUNIT_ASSERT(xParaEnum); +auto xPara = xParaEnum->nextElement().queryThrow(); +// Try to enumerate text portions. Without the fix, it would fail an assertion in debug builds, +// and hang in release builds, because the paragraph portion started after the bookmark, and +// so the bookmark wasn't processed (expectedly): +auto xRunEnum = xPara->createEnumeration(); +CPPUNIT_ASSERT(!xRunEnum->hasMoreElements()); // Empty enumeration for empty selection +} + 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 709d79ef4d4b..9177765c0e32 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -608,7 +608,9 @@ static void lcl_ExportBookmark( const SwXBookmarkPortion_ImplSharedPtr& pPtr = *aIter; if ( nIndex > pPtr->getIndex() ) { -assert(!"Some bookmarks were not consumed earlier"); +// We may get here, if SwXTextPortionEnumeration ctor was called with nStart greater +// than this bookmark's index. Just drop it. +aIter = rBkmArr.erase(aIter); continue; } if ( nIndex < pPtr->getIndex() )
core.git: sw/qa sw/source
sw/qa/extras/unowriter/data/tdf161035.fodt |9 + sw/qa/extras/unowriter/unowriter.cxx | 27 +++ sw/source/core/unocore/unoportenum.cxx |4 +++- 3 files changed, 39 insertions(+), 1 deletion(-) New commits: commit 9d3c6b31158aedc33bd616981f0f80af8a0ed1b0 Author: Mike Kaganski AuthorDate: Thu May 16 11:07:26 2024 +0500 Commit: Mike Kaganski CommitDate: Thu May 16 16:38:56 2024 +0200 tdf#161035: The previous bookmarks can legitimately be not processed The enumeration may be called for a partial paragraph selection, and then the bookmarks prior to the selection are not processed. Change-Id: Ib725ffb320ec5a81b39ce77f06392a82bd6d8ee0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167720 Reviewed-by: Mike Kaganski Tested-by: Jenkins Reviewed-by: Patrick Luby diff --git a/sw/qa/extras/unowriter/data/tdf161035.fodt b/sw/qa/extras/unowriter/data/tdf161035.fodt new file mode 100644 index ..8f1d53b083d6 --- /dev/null +++ b/sw/qa/extras/unowriter/data/tdf161035.fodt @@ -0,0 +1,9 @@ + + + + + + Lorem ipsum. + + + \ No newline at end of file diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 0d8704752b07..edee8577d55b 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -1247,6 +1247,33 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf160278) CPPUNIT_ASSERT_EQUAL(u"12test"_ustr, xText->getString()); } +CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf161035) +{ +// Given a paragraph with a bookmark: +createSwDoc("tdf161035.fodt"); +auto xModel = mxComponent.queryThrow(); + +// Create a text view cursor in the paragraph. +auto xController = xModel->getCurrentController().queryThrow(); +auto xViewCursor = xController->getViewCursor(); +CPPUNIT_ASSERT(xViewCursor); +auto xText = xViewCursor->getText(); +CPPUNIT_ASSERT(xText); +// Create a text cursor from the text view cursor, and move it to the end of the paragraph +auto xTextCursor = xText->createTextCursorByRange(xViewCursor); +CPPUNIT_ASSERT(xTextCursor); +xTextCursor->gotoEnd(false); +// Get the first paragraph portion from the text cursor +auto xParaEnum = xTextCursor.queryThrow()->createEnumeration(); +CPPUNIT_ASSERT(xParaEnum); +auto xPara = xParaEnum->nextElement().queryThrow(); +// Try to enumerate text portions. Without the fix, it would fail an assertion in debug builds, +// and hang in release builds, because the paragraph portion started after the bookmark, and +// so the bookmark wasn't processed (expectedly): +auto xRunEnum = xPara->createEnumeration(); +CPPUNIT_ASSERT(!xRunEnum->hasMoreElements()); // Empty enumeration for empty selection +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 220834cb8bb3..6bfebf8962dd 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -604,7 +604,9 @@ static void lcl_ExportBookmark( const SwXBookmarkPortion_ImplSharedPtr& pPtr = *aIter; if ( nIndex > pPtr->getIndex() ) { -assert(!"Some bookmarks were not consumed earlier"); +// We may get here, if SwXTextPortionEnumeration ctor was called with nStart greater +// than this bookmark's index. Just drop it. +aIter = rBkmArr.erase(aIter); continue; } if ( nIndex < pPtr->getIndex() )
core.git: Branch 'distro/vector/vector-7.5.9-release' - 17 commits - basctl/source basic/source editeng/source embeddedobj/source filter/source fpicker/source include/editeng include/filter include/oo
| 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, 1045 insertions(+), 802 deletions(-) New commits: commit a02e74098cb4f23184b237b59b61297822063d9e Author: Mike Kaganski AuthorDate: Sun Apr 7 21:54:16 2024 +0500 Commit: Mike Kaganski CommitDate: Thu May 16 16:40:27 2024 +0500 Reapply "Downgrade sfx::SfxBindings aAutoTimer to an idle" This reverts commit e95ada626ccf0c1e915a1582c372242ef9b9b59a. diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 4ea06231562a..44
core.git: Changes to 'distro/vector/vector-7.5.9-release'
New branch 'distro/vector/vector-7.5.9-release' available with the following commits:
core.git: sw/qa xmloff/source
sw/qa/core/text/data/number-portion-format.odt |binary sw/qa/extras/odfimport/data/empty_line_in_text_box.fodt | 31 sw/qa/extras/odfimport/odfimport.cxx| 53 + xmloff/source/text/txtparai.cxx | 62 4 files changed, 102 insertions(+), 44 deletions(-) New commits: commit 1201d3d6b0457bac30105bf5371c76a4ef69f29a Author: Mike Kaganski AuthorDate: Mon May 13 15:04:09 2024 +0500 Commit: Mike Kaganski CommitDate: Tue May 14 05:45:20 2024 +0200 tdf#161054: drop support of last empty span as paragraph mark format Commits 6249858a8972aef077e0249bd93cfe8f01bce4d6 (sw: ODT import/export of DOCX's paragraph marker formatting, 2022-12-19) and 209dce614c43f63f63f5b42a746665c0ec1cbfe3 (sw: fix ODT import of paragraph marker formatting, 2022-12-20) introduced support for paragraph marker formatting in ODF, using an empty trailing span. Later, commit 1a88efa8e02a6d765dab13c7110443bb9e6acecf (tdf#155238: Reimplement how ListAutoFormat is stored to ODF, 2023-05-11) changed how the data was stored in ODF. Then, in commit 69ed893087f89d176a5ec4b263ce8d75774be72b (tdf#160253: fix list identifier export decision code, 2024-04-24), some remnants of the older "trailing empty spans" were removed, but a code was added in XMLParaContext::endFastElement, to keep backward compatible with documents created in the frame between December 2022 and May 2023. The said compatibility code brings own problems, requiring new hacks like commit 2ca93eb5df7ddb8641ff7d884a109261c9700aca (tdf#161023: Empty spans may only define paragraph marks in text documents, 2024-05-13), and keeping the code would need more hacks on top, e.g. to fix the case in ODT documents. Instead, let's bite the bullet, and drop the compatibility with this initial implementation, because it was only a brief period during which the documents could be created, which can be affected by this drop. This makes the code simpler. A testdoc for testNumberPortionFormat was edited to use the new markup for the paragraph marks formatting. Change-Id: I053e72dd1cc2ead83baa6ce7d24c8522b494c8fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167583 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/core/text/data/number-portion-format.odt b/sw/qa/core/text/data/number-portion-format.odt index 19b23ae84420..70b67ee3547e 100644 Binary files a/sw/qa/core/text/data/number-portion-format.odt and b/sw/qa/core/text/data/number-portion-format.odt differ diff --git a/sw/qa/extras/odfimport/data/empty_line_in_text_box.fodt b/sw/qa/extras/odfimport/data/empty_line_in_text_box.fodt new file mode 100644 index ..4ae36a9c5fac --- /dev/null +++ b/sw/qa/extras/odfimport/data/empty_line_in_text_box.fodt @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + a + + c + + + + + \ No newline at end of file diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 82d73ab5b8dc..a12cd5b53641 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -1563,6 +1563,59 @@ CPPUNIT_TEST_FIXTURE(Test, testBrokenPackage_Tdf159474) CPPUNIT_ASSERT_EQUAL(u"Empty document"_ustr, getParagraph(1)->getString()); } +CPPUNIT_TEST_FIXTURE(Test, testTdf161054) +{ +// Similar to testTdf161023 in sd/qa/unit/import-tests2.cxx +// Given a shape with three paragraphs (18pt), all directly assigned a smaller font (10pt) +createSwDoc("empty_line_in_text_box.fodt"); +auto shapeText = getShape(1).queryThrow()->getText(); + +// 1st paragraph, not empty +{ +auto paragraph(getParagraphOfText(1, shapeText)); +CPPUNIT_ASSERT_EQUAL(u"a"_ustr, paragraph->getString()); +auto run(getRun(paragraph, 1)); +CPPUNIT_ASSERT_EQUAL(u"a"_ustr, run->getString()); +uno::Reference xPropSet(run, uno::UNO_QUERY_THROW); +double fCharHeight = 0; +xPropSet->getPropertyValue("CharHeight") >>= fCharHeight; +CPPUNIT_ASSERT_EQUAL(10.0, fCharHeight); +// No more runs +CPPUNIT_ASSERT_THROW(getRun(paragraph, 2), container::NoSuchElementException); +} + +// Empty 2nd paragraph, consisting of a single span: this span was treated as "paragraph mark" +{ +auto paragraph(getParagraphOfText(2, shapeText)); +CPPUNIT_ASSERT_EQUAL(u""_ustr, paragraph->getString()); +auto run(getRun(paragraph, 1)); +CPPUNIT_ASSERT_EQUAL(u""_ustr, run->getString()); +uno::Reference xPropSet(run, uno::UNO_QUERY_THROW); +double fCharHeight = 0; +xPropSet->getP
Re: behavior of new functions XLOOKUP and XMATCH
On 14.05.2024 3:23, Regina Henschel wrote: Combining parameter values for wildcard mode and binary search is possible. But there exist no way to actually do it. Excel gives an error messages in such cases. LibreOffice silently switches to linear search. ... Some arguments so far: * No error message would make use of the functions in macros and forms easier. * No error message might be better for using the functions in automatically calculations without UI. * Using linear search can be unexpected slow on a huge Lookup_array. An error message makes the problem visible to the user. Emitting error is the only sane way here. No error message means doing something different than user requested, without user knowing that, with no practical benefit (the wildcards / regexes won't be used, so the task is not done anyway). Calculations without UI means either prepared document (and there a sane set of options must be used), or programmatically defined formulas (and there a sane set of options must be used). -- Best regards, Mike Kaganski
core.git: sd/qa xmloff/source
sd/qa/unit/data/odp/tdf161023.fodp | 35 sd/qa/unit/import-tests2.cxx | 52 + xmloff/source/text/txtparai.cxx|4 ++ 3 files changed, 90 insertions(+), 1 deletion(-) New commits: commit 2ca93eb5df7ddb8641ff7d884a109261c9700aca Author: Mike Kaganski AuthorDate: Sun May 12 22:53:23 2024 +0500 Commit: Mike Kaganski CommitDate: Mon May 13 04:21:20 2024 +0200 tdf#161023: Empty spans may only define paragraph marks in text documents Change-Id: I40607652a0fd8e31c609732daa54bb796e3fffa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167557 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sd/qa/unit/data/odp/tdf161023.fodp b/sd/qa/unit/data/odp/tdf161023.fodp new file mode 100644 index ..bf3a894cec4b --- /dev/null +++ b/sd/qa/unit/data/odp/tdf161023.fodp @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + a + + c + + + + + + \ No newline at end of file diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 5457224bd642..d5e6c2bf14bb 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -2006,6 +2006,58 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testMasterSlides) CPPUNIT_ASSERT_EQUAL(sal_Int32(7), xMasterPages->getCount()); } +CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf161023) +{ +// Given a shape with three paragraphs (18pt), all directly assigned a smaller font (10pt) +createSdImpressDoc("odp/tdf161023.fodp"); +auto shape = getShapeFromPage(0, 0); + +// 1st paragraph, not empty +{ +auto paragraph(getParagraphFromShape(0, shape)); +CPPUNIT_ASSERT_EQUAL(u"a"_ustr, paragraph->getString()); +auto run(getRunFromParagraph(0, paragraph)); +CPPUNIT_ASSERT_EQUAL(u"a"_ustr, run->getString()); +uno::Reference xPropSet(run, uno::UNO_QUERY_THROW); +double fCharHeight = 0; +xPropSet->getPropertyValue("CharHeight") >>= fCharHeight; +CPPUNIT_ASSERT_EQUAL(10.0, fCharHeight); +// No more runs +CPPUNIT_ASSERT_THROW(getRunFromParagraph(1, paragraph), container::NoSuchElementException); +} + +// Empty 2nd paragraph, consisting of a single span: this span was treated as "paragraph mark" +{ +auto paragraph(getParagraphFromShape(1, shape)); +CPPUNIT_ASSERT_EQUAL(u""_ustr, paragraph->getString()); +auto run(getRunFromParagraph(0, paragraph)); +CPPUNIT_ASSERT_EQUAL(u""_ustr, run->getString()); +uno::Reference xPropSet(run, uno::UNO_QUERY_THROW); +double fCharHeight = 0; +xPropSet->getPropertyValue("CharHeight") >>= fCharHeight; +// Without the fix, this would fail with +// - Expected: 10 +// - Actual : 18 +CPPUNIT_ASSERT_EQUAL(10.0, fCharHeight); +// No more runs +CPPUNIT_ASSERT_THROW(getRunFromParagraph(1, paragraph), container::NoSuchElementException); +} + +// 3rd paragraph, not empty +{ +auto paragraph(getParagraphFromShape(2, shape)); +CPPUNIT_ASSERT_EQUAL(u"c"_ustr, paragraph->getString()); +auto run(getRunFromParagraph(0, paragraph)); +CPPUNIT_ASSERT_EQUAL(u"c"_ustr, run->getString()); +uno::Reference xPropSet(run, uno::UNO_QUERY_THROW); +double fCharHeight = 0; +xPropSet->getPropertyValue("CharHeight") >>= fCharHeight; +CPPUNIT_ASSERT_EQUAL(10.0, fCharHeight); +// No more runs +CPPUNIT_ASSERT_THROW(getRunFromParagraph(1, paragraph), container::NoSuchElementException); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index 816bf876..cd4cc2b9996c 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1796,6 +1797,7 @@ void XMLParaContext::endFastElement(sal_Int32 ) uno::Reference xCompare(xTxtImport->GetText(), uno::UNO_QUERY); if (xCompare.is()) { +bool bTextDocument = GetImport().GetModel().query().is(); try { for (const auto& pHint : m_xHints->GetHints()) @@ -1809,7 +1811,7 @@ void XMLParaContext::endFastElement(sal_Int32 ) // created between commits 6249858a8972aef077e0249bd93cfe8f01bce4d6 and // 1a88efa8e02a6d765dab13c7110443bb9e6acecf, where the trailing empty spans // were used to store the marker formatting -
core.git: vcl/win
vcl/win/app/salinst.cxx | 223 ++-- 1 file changed, 158 insertions(+), 65 deletions(-) New commits: commit 0bcb62c6b71eb3f886e6d4885b1c2b691ce810b6 Author: Mike Kaganski AuthorDate: Sun May 12 10:09:19 2024 +0500 Commit: Mike Kaganski CommitDate: Sun May 12 08:15:58 2024 +0200 Related: tdf#96671 Also handle other Windows architectures Change-Id: I8b3a9c10781450083ae2cdeb8614b42e33bf9520 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167531 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index 1a047853a3e1..bcb3041225b6 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -948,110 +949,202 @@ typedef LONG NTSTATUS; typedef NTSTATUS(WINAPI* RtlGetVersion_t)(PRTL_OSVERSIONINFOW); constexpr NTSTATUS STATUS_SUCCESS = 0x; -static OUString getWinBits() +static OUString getWinArch() { +USHORT nNativeMachine = IMAGE_FILE_MACHINE_UNKNOWN; + +using LPFN_ISWOW64PROCESS2 = BOOL(WINAPI*)(HANDLE, USHORT*, USHORT*); +auto fnIsWow64Process2 = reinterpret_cast( +GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "IsWow64Process2")); +if (fnIsWow64Process2) +fnIsWow64Process2(GetCurrentProcess(), ::temporary(USHORT()), ); + +if (nNativeMachine == IMAGE_FILE_MACHINE_UNKNOWN) +{ #if _WIN64 -return " X86_64"; +nNativeMachine = IMAGE_FILE_MACHINE_AMD64; #else -BOOL isWow64 = FALSE; +BOOL isWow64 = FALSE; -IsWow64Process(GetCurrentProcess(), ); +IsWow64Process(GetCurrentProcess(), ); -if (isWow64) -return " X86_64"; //32-bit process on 64-bit Windows. -else -return " X86_32"; +if (isWow64) +nNativeMachine = IMAGE_FILE_MACHINE_AMD64; // 32-bit process on 64-bit Windows +else +nNativeMachine = IMAGE_FILE_MACHINE_I386; #endif +} + +switch (nNativeMachine) +{ +case IMAGE_FILE_MACHINE_I386: +return u" X86_32"_ustr; +case IMAGE_FILE_MACHINE_R3000: +return u" R3000"_ustr; +case IMAGE_FILE_MACHINE_R4000: +return u" R4000"_ustr; +case IMAGE_FILE_MACHINE_R1: +return u" R1"_ustr; +case IMAGE_FILE_MACHINE_WCEMIPSV2: +return u" WCEMIPSV2"_ustr; +case IMAGE_FILE_MACHINE_ALPHA: +return u" ALPHA"_ustr; +case IMAGE_FILE_MACHINE_SH3: +return u" SH3"_ustr; +case IMAGE_FILE_MACHINE_SH3DSP: +return u" SH3DSP"_ustr; +case IMAGE_FILE_MACHINE_SH3E: +return u" SH3E"_ustr; +case IMAGE_FILE_MACHINE_SH4: +return u" SH4"_ustr; +case IMAGE_FILE_MACHINE_SH5: +return u" SH5"_ustr; +case IMAGE_FILE_MACHINE_ARM: +return u" ARM"_ustr; +case IMAGE_FILE_MACHINE_THUMB: +return u" THUMB"_ustr; +case IMAGE_FILE_MACHINE_ARMNT: +return u" ARMNT"_ustr; +case IMAGE_FILE_MACHINE_AM33: +return u" AM33"_ustr; +case IMAGE_FILE_MACHINE_POWERPC: +return u" POWERPC"_ustr; +case IMAGE_FILE_MACHINE_POWERPCFP: +return u" POWERPCFP"_ustr; +case IMAGE_FILE_MACHINE_IA64: +return u" IA64"_ustr; +case IMAGE_FILE_MACHINE_MIPS16: +return u" MIPS16"_ustr; +case IMAGE_FILE_MACHINE_ALPHA64: +return u" ALPHA64"_ustr; +case IMAGE_FILE_MACHINE_MIPSFPU: +return u" MIPSFPU"_ustr; +case IMAGE_FILE_MACHINE_MIPSFPU16: +return u" MIPSFPU16"_ustr; +case IMAGE_FILE_MACHINE_TRICORE: +return u" TRICORE"_ustr; +case IMAGE_FILE_MACHINE_CEF: +return u" CEF"_ustr; +case IMAGE_FILE_MACHINE_EBC: +return u" EBC"_ustr; +case IMAGE_FILE_MACHINE_AMD64: +return u" X86_64"_ustr; +case IMAGE_FILE_MACHINE_M32R: +return u" M32R"_ustr; +case IMAGE_FILE_MACHINE_ARM64: +return u" ARM64"_ustr; +case IMAGE_FILE_MACHINE_CEE: +return u" CEE"_ustr; +default: +assert(!"Yet unhandled case"); +return OUString(); +} } static OUString getOSVersionString(const OUString& aNtVersionString, DWORD nBuildNumber) { -OUString winArch = getWinBits(); -OUString aVersionPlusBuild -= winArch + " (" + aNtVersionString + &quo
core.git: canvas/inc canvas/source editeng/source scripting/source
canvas/inc/verifyinput.hxx |6 - canvas/source/directx/dx_config.cxx |2 canvas/source/directx/dx_surfacebitmap.cxx |2 editeng/source/accessibility/AccessibleEditableTextPara.cxx | 25 ++--- editeng/source/accessibility/AccessibleStaticTextBase.cxx | 23 +--- scripting/source/dlgprov/dlgevtatt.cxx | 59 +--- scripting/source/dlgprov/dlgevtatt.hxx |1 scripting/source/dlgprov/dlgprov.cxx|7 - 8 files changed, 53 insertions(+), 72 deletions(-) New commits: commit ccdb98c0e590281f63a8c180a2eb87086210efbd Author: Mike Kaganski AuthorDate: Sat May 4 13:04:41 2024 +0500 Commit: Mike Kaganski CommitDate: Sun May 12 05:04:57 2024 +0200 Drop some uses of css::uno::Sequence::getConstArray where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: I64683093afc48ddf2307dc1dee2302cf0b3cbecc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167110 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/canvas/inc/verifyinput.hxx b/canvas/inc/verifyinput.hxx index b37468ebbe24..7dd956c92882 100644 --- a/canvas/inc/verifyinput.hxx +++ b/canvas/inc/verifyinput.hxx @@ -360,10 +360,8 @@ namespace canvas const css::uno::Reference< css::uno::XInterface >& xIf, ::sal_Int16 nArgPos ) { -const SequenceContent* pCurr = rSequence.getConstArray(); -const SequenceContent* pEnd = pCurr + rSequence.getLength(); -while( pCurr != pEnd ) -verifyInput( *pCurr++, pStr, xIf, nArgPos ); +for (auto& element : rSequence) +verifyInput(element, pStr, xIf, nArgPos); } /// Catch-all, to handle cases that DON'T need input checking (i.e. the Integer geometry ones) diff --git a/canvas/source/directx/dx_config.cxx b/canvas/source/directx/dx_config.cxx index c1d9020845a2..643877659edd 100644 --- a/canvas/source/directx/dx_config.cxx +++ b/canvas/source/directx/dx_config.cxx @@ -48,7 +48,7 @@ namespace dxcanvas uno::Sequence< uno::Any > aProps( GetProperties( { "DeviceDenylist" } )); uno::Sequence< sal_Int32 > aValues; -if( aProps.getLength() > 0 && +if (aProps.hasElements() && (aProps[0] >>= aValues) ) { const sal_Int32* pValues = aValues.getConstArray(); diff --git a/canvas/source/directx/dx_surfacebitmap.cxx b/canvas/source/directx/dx_surfacebitmap.cxx index 5a3992eea221..c425af2911ce 100644 --- a/canvas/source/directx/dx_surfacebitmap.cxx +++ b/canvas/source/directx/dx_surfacebitmap.cxx @@ -542,7 +542,7 @@ namespace dxcanvas if(FAILED(mpSurface->LockRect(,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) throw uno::RuntimeException("failed to lock directx surface to surface memory"); -sal_uInt8 const *pSrc = reinterpret_cast(data.getConstArray()); +auto* pSrc = data.getConstArray(); sal_uInt8 *pDst = (static_cast(aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1; sal_uInt32 nSegmentSizeInBytes = nWidth<<4; for(sal_uInt32 y=0; y& m_rValues; +explicit IndexCompare(const uno::Sequence& rValues) +: m_rValues(rValues) +{ +} bool operator() ( sal_Int32 a, sal_Int32 b ) const { -return pValues[a].Name < pValues[b].Name; +return m_rValues[a].Name < m_rValues[b].Name; } }; @@ -1228,19 +1231,13 @@ namespace accessibility //sort property values // build sorted index array sal_Int32 nLength = aRes.getLength(); -const beans::PropertyValue* pPairs = aRes.getConstArray(); -std::unique_ptr pIndices(new sal_Int32[nLength]); -sal_Int32 i = 0; -for( i = 0; i < nLength; i++ ) -pIndices[i] = i; -std::sort( [0], [nLength], IndexCompare(pPairs) ); +std::vector indices(nLength); +std::iota(indices.begin(), indices.end(), 0); +std::sort(indices.begin(), indices.end(), IndexCompare(aRes)); // create sorted sequences according to index array uno::Sequence aNewValues( nLength ); -beans::PropertyValue* pNewValues = aNewValues.getArray(); -for( i = 0; i < nLength; i++ ) -{ -pNewValues[i] = pPairs[pIndices[
core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/core/inc/unoflatpara.hxx |1 + sw/source/core/unocore/unoflatpara.cxx |3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) New commits: commit 90b35f89efb96e17b511f1dde7b69c467d0fd2b6 Author: Mike Kaganski AuthorDate: Tue Nov 28 13:59:22 2023 +0300 Commit: Caolán McNamara CommitDate: Wed May 8 11:11:05 2024 +0200 tdf#153693: improve SwXFlatParagraph::isModified check The response from LanguageTool server may take some seconds, during which the user may type more characters of an unfinished word. A result of the check started using an incomplete text should be discarded in this case. The code in GrammarCheckingIterator::ProcessResult that applies the check results first calls isModified to decide if it should apply the result, or to discard it. Before the change, SwXFlatParagraph::isModified only checked that its underlying node is still referenced; but it could only get nullified in SwXTextMarkup::Impl::Notify (only when the node dies), or in SwXTextMarkup::ClearTextNode, called in SwXFlatParagraph::changeText and SwXFlatParagraph::changeAttributes. Any external changes of the node didn't mark SwXFlatParagraph "modified". This change stores the initial text of the paragraph, from the moment of creation of SwXFlatParagraph; and then compares it to the current text of the node in isModified. Change-Id: Ia9a2e74b256152fe311db874c66f7e5347183f12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160021 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 708e52a551daa27932dfae072a16e3512c72cf92) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160032 Reviewed-by: Michael Stahl (cherry picked from commit 9810b3c06c709ffef15932fe24106b503ea4ff46) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167072 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/core/inc/unoflatpara.hxx b/sw/source/core/inc/unoflatpara.hxx index 2cc2c354c292..e0c820a009d7 100644 --- a/sw/source/core/inc/unoflatpara.hxx +++ b/sw/source/core/inc/unoflatpara.hxx @@ -105,6 +105,7 @@ private: SwXFlatParagraph & operator = ( const SwXFlatParagraph & ) = delete; OUString maExpandText; +OUString maOrigText; }; class SwXFlatParagraphIterator final : diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index d5f3c9c4130b..5d7e2d0f5bca 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -68,6 +68,7 @@ CreateFlatParagraphIterator(SwDoc & rDoc, sal_Int32 const nTextMarkupType, SwXFlatParagraph::SwXFlatParagraph( SwTextNode& rTextNode, OUString aExpandText, const ModelToViewHelper& rMap ) : SwXFlatParagraph_Base(& rTextNode, rMap) , maExpandText(std::move(aExpandText)) +, maOrigText(rTextNode.GetText()) { } @@ -215,7 +216,7 @@ sal_Bool SAL_CALL SwXFlatParagraph::isChecked( ::sal_Int32 nType ) sal_Bool SAL_CALL SwXFlatParagraph::isModified() { SolarMutexGuard aGuard; -return nullptr == GetTextNode(); +return !GetTextNode() || GetTextNode()->GetText() != maOrigText; } // text::XFlatParagraph:
core.git: Branch 'libreoffice-7-6-7' - sw/qa sw/source
sw/qa/extras/uiwriter/data/table-in-table.fodt | 29 + sw/qa/extras/uiwriter/uiwriter9.cxx| 16 - sw/source/core/crsr/crsrsh.cxx | 12 +++--- 3 files changed, 53 insertions(+), 4 deletions(-) New commits: commit 05057b823e9a9b3b05029aef122c4d0781d8c285 Author: Mike Kaganski AuthorDate: Thu May 2 09:11:25 2024 +0500 Commit: Xisco Fauli CommitDate: Tue May 7 10:06:47 2024 +0200 tdf#160898: check for nullptr Regression after commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda (tdf#154877 sw: generalise ExtendedSelectAll(), 2023-05-09) Change-Id: I9289171647fca8bd1b696399ff7c43a2ac7b8b30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166990 Reviewed-by: Mike Kaganski Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166997 Reviewed-by: Michael Stahl Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167213 Reviewed-by: Ilmari Lauhakangas Reviewed-by: Michael Weghorn diff --git a/sw/qa/extras/uiwriter/data/table-in-table.fodt b/sw/qa/extras/uiwriter/data/table-in-table.fodt new file mode 100644 index ..e055d343b847 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/table-in-table.fodt @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 9f961b1def60..bd69d2616a6d 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -109,7 +109,21 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816) xTransfer->PrivateDrop(*pWrtShell, ptTo, /*bMove=*/true, /*bXSelection=*/true); } -} // end of anonymouse namespace +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf160898) +{ +// Given a document with a 1-cell table in another 1-cell table: +createSwDoc("table-in-table.fodt"); +SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); +SwDocShell* pDocShell = pXTextDocument->GetDocShell(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + +// Move to the normally hidden paragraph inside the outer table cell, following the inner table +pWrtShell->Down(false, 2); +// Without the fix, this would crash: +pWrtShell->SelAll(); +} + +} // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 04b263cda754..b7b7a8997f8c 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -738,9 +738,15 @@ bool SwCursorShell::MoveStartText() SwTableNode const*const pTable(pStartNode->FindTableNode()); m_pCurrentCursor->GetPoint()->Assign(*pStartNode); GetDoc()->GetNodes().GoNext(m_pCurrentCursor->GetPoint()); -while (m_pCurrentCursor->GetPoint()->GetNode().FindTableNode() != pTable -&& (!pTable || pTable->GetIndex() < m_pCurrentCursor->GetPoint()->GetNode().FindTableNode()->GetIndex()) -&& MoveOutOfTable()); +while (auto* pFoundTable = m_pCurrentCursor->GetPoint()->GetNode().FindTableNode()) +{ +if (pFoundTable == pTable) +break; +if (pTable && pTable->GetIndex() >= pFoundTable->GetIndex()) +break; +if (!MoveOutOfTable()) +break; +} UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return old != *m_pCurrentCursor->GetPoint(); }
core.git: Branch 'libreoffice-7-6' - sw/qa sw/source
sw/qa/extras/uiwriter/data/table-in-table.fodt | 29 + sw/qa/extras/uiwriter/uiwriter9.cxx| 16 - sw/source/core/crsr/crsrsh.cxx | 12 +++--- 3 files changed, 53 insertions(+), 4 deletions(-) New commits: commit 278845dddefbd1359b8bd28f87c42f4124be50ca Author: Mike Kaganski AuthorDate: Thu May 2 09:11:25 2024 +0500 Commit: Xisco Fauli CommitDate: Tue May 7 10:06:53 2024 +0200 tdf#160898: check for nullptr Regression after commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda (tdf#154877 sw: generalise ExtendedSelectAll(), 2023-05-09) Change-Id: I9289171647fca8bd1b696399ff7c43a2ac7b8b30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166990 Reviewed-by: Mike Kaganski Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166997 Reviewed-by: Michael Stahl Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167037 diff --git a/sw/qa/extras/uiwriter/data/table-in-table.fodt b/sw/qa/extras/uiwriter/data/table-in-table.fodt new file mode 100644 index ..e055d343b847 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/table-in-table.fodt @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 9f961b1def60..bd69d2616a6d 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -109,7 +109,21 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816) xTransfer->PrivateDrop(*pWrtShell, ptTo, /*bMove=*/true, /*bXSelection=*/true); } -} // end of anonymouse namespace +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf160898) +{ +// Given a document with a 1-cell table in another 1-cell table: +createSwDoc("table-in-table.fodt"); +SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); +SwDocShell* pDocShell = pXTextDocument->GetDocShell(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + +// Move to the normally hidden paragraph inside the outer table cell, following the inner table +pWrtShell->Down(false, 2); +// Without the fix, this would crash: +pWrtShell->SelAll(); +} + +} // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 04b263cda754..b7b7a8997f8c 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -738,9 +738,15 @@ bool SwCursorShell::MoveStartText() SwTableNode const*const pTable(pStartNode->FindTableNode()); m_pCurrentCursor->GetPoint()->Assign(*pStartNode); GetDoc()->GetNodes().GoNext(m_pCurrentCursor->GetPoint()); -while (m_pCurrentCursor->GetPoint()->GetNode().FindTableNode() != pTable -&& (!pTable || pTable->GetIndex() < m_pCurrentCursor->GetPoint()->GetNode().FindTableNode()->GetIndex()) -&& MoveOutOfTable()); +while (auto* pFoundTable = m_pCurrentCursor->GetPoint()->GetNode().FindTableNode()) +{ +if (pFoundTable == pTable) +break; +if (pTable && pTable->GetIndex() >= pFoundTable->GetIndex()) +break; +if (!MoveOutOfTable()) +break; +} UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return old != *m_pCurrentCursor->GetPoint(); }
core.git: editeng/source sd/qa
editeng/source/editeng/impedit3.cxx|2 - sd/qa/unit/data/odg/adjust-to-contour.fodg | 52 + sd/qa/unit/layout-tests.cxx| 48 ++ 3 files changed, 101 insertions(+), 1 deletion(-) New commits: commit 4d0987564c33bbccc9b58e041d106c6caf7686a3 Author: Mike Kaganski AuthorDate: Fri May 3 14:14:26 2024 +0500 Commit: Mike Kaganski CommitDate: Fri May 3 18:43:44 2024 +0200 tdf#152906: use correct Y offset GetEditCursor now returns the position relative to the line, not to the whole text. In ImpEditEngine::CreateLines, its use wasn't fixed, and so the Y position of all lines in the calculation was the same, thus adjusting to the same contour's horizontal stripe. Change-Id: I16362bab47f3064281eefb45a12834d836a8ada3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167042 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index f548e2423490..288afb5a33bd 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -923,7 +923,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { GetTextRanger()->SetVertical( IsEffectivelyVertical() ); -tools::Long nTextY = nStartPosY + GetEditCursor(rParaPortion, *pLine, pLine->GetStart(), CursorFlags()).Top(); +tools::Long nTextY = nCurrentPosY + GetEditCursor(rParaPortion, *pLine, pLine->GetStart(), CursorFlags()).Top(); if ( !bSameLineAgain ) { SeekCursor( pNode, nTmpPos+1, aTmpFont ); diff --git a/sd/qa/unit/data/odg/adjust-to-contour.fodg b/sd/qa/unit/data/odg/adjust-to-contour.fodg new file mode 100644 index ..a5ec6fed74fc --- /dev/null +++ b/sd/qa/unit/data/odg/adjust-to-contour.fodg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat mi quis pretium semper. Proin luctus orci ac neque venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus egestas. Donec blandit auctor arcu, nec pellentesque eros molestie eget. In consectetur aliquam hendrerit. Sed cursus mauris vitae ligula pellentesque, non pellentesque urna aliquet. Fusce placerat mauris enim, nec rutrum purus semper vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce pellentesque est orci. + + + + + \ No newline at end of file diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx index 1735f6574be3..8143b82e5a1b 100644 --- a/sd/qa/unit/layout-tests.cxx +++ b/sd/qa/unit/layout-tests.cxx @@ -380,6 +380,54 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf112594) u"11\u202f\u1824"_ustr); } +CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf152906_AdjustToContour) +{ +// Test that the text adjusts to contour properly + +constexpr OUString sText += u"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat mi quis " + "pretium semper. Proin luctus orci ac neque venenatis, quis commodo dolor posuere. " + "Curabitur dignissim sapien quis cursus egestas. Donec blandit auctor arcu, nec " + "pellentesque eros molestie eget. In consectetur aliquam hendrerit. Sed cursus mauris " + "vitae ligula pellentesque, non pellentesque urna aliquet. Fusce placerat mauris enim, " + "nec rutrum purus semper vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce " + "pellentesque est orci."_ustr; + +// index, length, x, y +const std::tuple strings[] = { +{ 0, 6, 9599, 8647 }, //Lorem +{ 6, 22, 7570, 9358 }, // ipsum dolor sit amet, +{ 28, 29, 6775, 10069 }, // consectetur adipiscing elit. +{ 57, 29, 6299, 10780 }, // Vestibulum consequat mi quis +{ 86, 37, 5453, 11491 }, // pretium semper. Proin luctus orci ac +{ 123, 36, 5134, 12202 }, // neque venenatis, quis commodo dolor +{ 159, 41, 4764, 12913 }, // posuere. Curabitur dignissim sapien quis +{ 200, 43, 4481, 13624 }, // cursus egestas. Donec blandit auctor arcu, +{ 243, 40, 4975, 14335 }, // nec pellentesque eros molestie eget. In +{ 283, 42, 4552, 15046 }, // consectetur aliquam hendrerit. Sed cursus +{ 325, 38, 5363, 15757 }, //mauris vitae ligula pellentesque, non +{ 363, 42, 4692, 16468 }, // pellentesque urna aliquet. Fusce placerat +{ 405, 37, 5047, 17179 }, //mauris enim, nec rutrum purus semper +{
core.git: Branch 'libreoffice-24-2' - 2 commits - drawinglayer/source
drawinglayer/source/primitive2d/textlayoutdevice.cxx | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) New commits: commit d1c31e3857b7f0c6b3fb72da0c967bfa2bdef015 Author: Mike Kaganski AuthorDate: Tue Apr 23 05:25:34 2024 +0500 Commit: Xisco Fauli CommitDate: Fri May 3 18:27:18 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 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167052 diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 3e5708a99de6..9de634076960 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; } } commit 14c7b4249e822c218f912fcd3707226081363f7a Author: Mike Kaganski AuthorDate: Mon Apr 22 14:45:37 2024 +0500 Commit: Xisco Fauli CommitDate: Fri May 3 18:27:07 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 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167051 diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index afc0663aa4b0..3e5708a99de6 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: Branch 'libreoffice-24-2' - 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 44b6b90080e7585e46250fb4076b210619e10bb3 Author: Mike Kaganski AuthorDate: Thu Apr 18 13:23:43 2024 +0500 Commit: Xisco Fauli CommitDate: Fri May 3 17:05:18 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 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167050 Tested-by: Jenkins 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 ed3fa02e1c22..2c9f9ea72485 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -855,7 +855,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"); @@ -900,17 +900,17 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf93583) CPPUNIT_ASSERT (pDocument); 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, "
Re: About tdf#150082 gssapi
On 03.05.2024 14:20, Michael Stahl wrote: On 03/05/2024 09:27, Julien Nabet wrote: 1) what libs to install on Windows to have one of these files available ? (and without installing all Kerberos stuff) GSSAPI doesn't exist on Windows, but there is SSPI (in the Windows SDK) which serves the same purpose. And mariadb-connector-c seems to include SSPI support - at least, its plugins/auth [1] contains sspi_client.c, sspi_errmsg.c, and sspi_common.h. Possibly it makes sense to check if adding these .c to generated cobjects would work? [1] https://github.com/mariadb-corporation/mariadb-connector-c/tree/b323b5462db3751ed29fc3db83c855154f5f5ab4/plugins/auth -- Best regards, Mike Kaganski
core.git: Branch 'libreoffice-24-2' - 2 commits - drawinglayer/source include/drawinglayer include/vcl svgio/qa svgio/source vcl/skia vcl/source vcl/win
drawinglayer/source/primitive2d/textlayoutdevice.cxx | 58 drawinglayer/source/processor2d/vclprocessor2d.cxx| 28 + include/drawinglayer/primitive2d/textlayoutdevice.hxx |2 include/vcl/outdev.hxx|7 + include/vcl/vcllayout.hxx |5 - svgio/qa/cppunit/SvgImportTest.cxx| 85 +- svgio/source/svgreader/svgcharacternode.cxx | 28 +++-- 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 +- 12 files changed, 207 insertions(+), 98 deletions(-) New commits: commit 5a25899a9c5c0c4e6fb92ca355ea1e24cec3a747 Author: Mike Kaganski AuthorDate: Tue Apr 16 10:48:06 2024 +0500 Commit: Xisco Fauli CommitDate: Fri May 3 13:32:31 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 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166468 diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 5145d84ed2b6..afc0663aa4b0 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 /
core.git: comphelper/source xmloff/source
comphelper/source/container/embeddedobjectcontainer.cxx | 45 ++-- xmloff/source/draw/shapeexport.cxx | 22 --- 2 files changed, 42 insertions(+), 25 deletions(-) New commits: commit 2aa310cfe0bc10e7bf079147d379f6eb7d061b74 Author: Mike Kaganski AuthorDate: Fri May 3 08:14:16 2024 +0500 Commit: Mike Kaganski CommitDate: Fri May 3 11:19:04 2024 +0200 tdf#160915: make own OLE objects obey AddReplacementImages setting Change-Id: I25ce3c920dc8ba25d0ac14310ff9cba8a4c23c6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167026 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index 1bbf7b847fe4..0f831db3d6c5 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -36,6 +36,8 @@ #include #include +#include +#include #include #include #include @@ -1158,6 +1160,15 @@ namespace { } +static bool AlwaysStoreReplacementImages(const uno::Reference& xObj) +{ +const auto clsid = xObj->getClassID(); +if (clsid == MimeConfigurationHelper::GetSequenceClassID(SO3_SCH_CLASSID) +|| clsid == MimeConfigurationHelper::GetSequenceClassID(SO3_SM_CLASSID)) +return false; +return true; +} + bool EmbeddedObjectContainer::StoreAsChildren(bool _bOasisFormat,bool _bCreateEmbedded, bool _bAutoSaveEvent, const uno::Reference < embed::XStorage >& _xStorage) { @@ -1176,26 +1187,28 @@ bool EmbeddedObjectContainer::StoreAsChildren(bool _bOasisFormat,bool _bCreateEm uno::Reference < io::XInputStream > xStream; OUString aMediaType; - -sal_Int32 nCurState = xObj->getCurrentState(); -if ( nCurState == embed::EmbedStates::LOADED || nCurState == embed::EmbedStates::RUNNING ) +if (officecfg::Office::Common::Save::Graphic::AddReplacementImages::get() +|| AlwaysStoreReplacementImages(xObj)) { -// means that the object is not active -// copy replacement image from old to new container -xStream = GetGraphicStream( xObj, ); -} +sal_Int32 nCurState = xObj->getCurrentState(); +if (nCurState == embed::EmbedStates::LOADED +|| nCurState == embed::EmbedStates::RUNNING) +{ +// means that the object is not active +// copy replacement image from old to new container +xStream = GetGraphicStream(xObj, ); +} -if ( !xStream.is() && getUserAllowsLinkUpdate() ) -{ -// the image must be regenerated -// TODO/LATER: another aspect could be used -if ( xObj->getCurrentState() == embed::EmbedStates::LOADED ) +if (!xStream.is() && getUserAllowsLinkUpdate()) +{ +// the image must be regenerated +// TODO/LATER: another aspect could be used +if (xObj->getCurrentState() == embed::EmbedStates::LOADED) bSwitchBackToLoaded = true; -xStream = GetGraphicReplacementStream( - embed::Aspects::MSOLE_CONTENT, -xObj, - ); +xStream = GetGraphicReplacementStream(embed::Aspects::MSOLE_CONTENT, xObj, + ); +} } if ( _bOasisFormat || (xLink.is() && xLink->isLink()) ) diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index a701fff5dd12..0f150c847cd2 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2526,8 +2526,8 @@ void XMLShapeExport::ImpExportGraphicObjectShape( //Resolves: fdo#62461 put preferred image first above, followed by //fallback here -const bool bAddReplacementImages = officecfg::Office::Common::Save::Graphic::AddReplacementImages::get(); -if( !bIsEmptyPresObj && bAddReplacementImages) +if (!bIsEmptyPresObj +&& officecfg::Office::Common::Save::Graphic::AddReplacementImages::get()) { uno::Reference xReplacementGraphic; xPropSet->getPropertyValue("ReplacementGraphic") >>= xReplacementGraphic; @@ -35
core.git: Branch 'distro/vector/vector-7.5.9' - 3 commits - drawinglayer/source vcl/win
drawinglayer/source/processor2d/vclprocessor2d.cxx |3 - vcl/win/gdi/DWriteTextRenderer.cxx | 35 +++-- 2 files changed, 26 insertions(+), 12 deletions(-) New commits: commit 85c82ad23c64db500e607a3ffb76e3aebfb18102 Author: Mike Kaganski AuthorDate: Thu May 2 14:23:53 2024 +0500 Commit: Mike Kaganski CommitDate: Fri May 3 09:39:46 2024 +0500 tdf#160901: partially revert 8557ea84c9336ba8061246f1f46ddb6e02f413a1 It turns out, that the horizontal scale is needed in the applied transform. Change-Id: Ic07e015f0ddeee3d66653b683d83435d04b9ab81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167004 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index a962cbcbb801..f8c8c93958d7 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -332,19 +332,32 @@ WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, bool bIsVertical) : mpRenderTarget(pRenderTarget) { +const float hscale = [ = rLayout.GetFont()] +{ +const auto& rPattern = font.GetFontSelectPattern(); +if (!rPattern.mnHeight || !rPattern.mnWidth) +return 1.0; +return rPattern.mnWidth * font.GetAverageWidthFactor() / rPattern.mnHeight; +}(); + Degree10 angle = rLayout.GetOrientation(); if (bIsVertical) angle += 900_deg10; -if (angle) +if (hscale != 1.0f || angle) { D2D1::Matrix3x2F aTransform; pRenderTarget->GetTransform(); moTransform = aTransform; +if (hscale != 1.0f) // basegfx::fTools::equal is useless with float +aTransform = aTransform * D2D1::Matrix3x2F::Scale(hscale, 1.0f, { 0, 0 }); + // DWrite angle is in clockwise degrees, our orientation is in counter-clockwise 10th // degrees. -aTransform = aTransform * D2D1::Matrix3x2F::Rotation(-toDegrees(angle), rBaseline); +if (angle) +aTransform = aTransform * D2D1::Matrix3x2F::Rotation(-toDegrees(angle), rBaseline); + mpRenderTarget->SetTransform(aTransform); } } commit f1d2339d320dd86c427b93a6e24f4106bf7feb10 Author: Mike Kaganski AuthorDate: Wed Apr 10 22:45:41 2024 +0500 Commit: Mike Kaganski CommitDate: Fri May 3 09:39:42 2024 +0500 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 fb96cfa68659..a962cbcbb801 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -108,7 +108,7 @@ public: private: ID2D1RenderTarget* mpRenderTarget; -D2D1::Matrix3x2F maTransform; +std::optional moTransform; }; } // end anonymous namespace @@ -332,25 +332,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: */ commit 331fcd66d047d4b12e4b958f88f92825ddd2acbd Author: Mike Kaganski AuthorDate: Fri Apr 26 01:00:21 2024 +0500 Commit: Mike Kaganski CommitDate: Wed May 1 17:15:32 2024 +0500 tdf#157240: also set font color together with font Commit b008831a5545e5a777d77547ef96b9798d795f30 (tdf#152990 set the font after the MapMode is (potentially) set, 2023-01-14) had moved setting of font forward, but left setting the font color behind. This fixed that. Change-Id: I73fadc7c139da3b6f84b7fc875c585d02fc1c719 Reviewed-on: https://gerrit.libreoffice.or
core.git: vcl/win
vcl/win/gdi/DWriteTextRenderer.cxx | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) New commits: commit 3f2d56d486da2006e2cfa6f2f63700a14fae Author: Mike Kaganski AuthorDate: Thu May 2 14:23:53 2024 +0500 Commit: Mike Kaganski CommitDate: Fri May 3 03:51:45 2024 +0200 tdf#160901: partially revert 8557ea84c9336ba8061246f1f46ddb6e02f413a1 It turns out, that the horizontal scale is needed in the applied transform. Change-Id: Ic07e015f0ddeee3d66653b683d83435d04b9ab81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167004 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index 37c8f2aa217b..8a62f2d73fd9 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -311,19 +311,32 @@ WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, bool bIsVertical) : mpRenderTarget(pRenderTarget) { +const float hscale = [ = rLayout.GetFont()] +{ +const auto& rPattern = font.GetFontSelectPattern(); +if (!rPattern.mnHeight || !rPattern.mnWidth) +return 1.0; +return rPattern.mnWidth * font.GetAverageWidthFactor() / rPattern.mnHeight; +}(); + Degree10 angle = rLayout.GetOrientation(); if (bIsVertical) angle += 900_deg10; -if (angle) +if (hscale != 1.0f || angle) { D2D1::Matrix3x2F aTransform; pRenderTarget->GetTransform(); moTransform = aTransform; +if (hscale != 1.0f) // basegfx::fTools::equal is useless with float +aTransform = aTransform * D2D1::Matrix3x2F::Scale(hscale, 1.0f, { 0, 0 }); + // DWrite angle is in clockwise degrees, our orientation is in counter-clockwise 10th // degrees. -aTransform = aTransform * D2D1::Matrix3x2F::Rotation(-toDegrees(angle), rBaseline); +if (angle) +aTransform = aTransform * D2D1::Matrix3x2F::Rotation(-toDegrees(angle), rBaseline); + mpRenderTarget->SetTransform(aTransform); } }
core.git: Branch 'libreoffice-24-2' - sw/qa sw/source
sw/qa/extras/uiwriter/data/table-in-table.fodt | 29 + sw/qa/extras/uiwriter/uiwriter9.cxx| 14 sw/source/core/crsr/crsrsh.cxx | 12 +++--- 3 files changed, 52 insertions(+), 3 deletions(-) New commits: commit e7803234b5609d6ff66ebe79b7409d0fc822b067 Author: Mike Kaganski AuthorDate: Thu May 2 09:11:25 2024 +0500 Commit: Xisco Fauli CommitDate: Thu May 2 19:10:37 2024 +0200 tdf#160898: check for nullptr Regression after commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda (tdf#154877 sw: generalise ExtendedSelectAll(), 2023-05-09) Change-Id: I9289171647fca8bd1b696399ff7c43a2ac7b8b30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166990 Reviewed-by: Mike Kaganski Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166997 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/uiwriter/data/table-in-table.fodt b/sw/qa/extras/uiwriter/data/table-in-table.fodt new file mode 100644 index ..e055d343b847 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/table-in-table.fodt @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 3772955dd9c1..fe69b26dd87a 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -200,6 +200,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816) xTransfer->PrivateDrop(*pWrtShell, ptTo, /*bMove=*/true, /*bXSelection=*/true); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf160898) +{ +// Given a document with a 1-cell table in another 1-cell table: +createSwDoc("table-in-table.fodt"); +SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); +SwDocShell* pDocShell = pXTextDocument->GetDocShell(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + +// Move to the normally hidden paragraph inside the outer table cell, following the inner table +pWrtShell->Down(false, 2); +// Without the fix, this would crash: +pWrtShell->SelAll(); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index b7f6962982b5..33f11e9a282b 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -738,9 +738,15 @@ bool SwCursorShell::MoveStartText() SwTableNode const*const pTable(pStartNode->FindTableNode()); m_pCurrentCursor->GetPoint()->Assign(*pStartNode); GetDoc()->GetNodes().GoNext(m_pCurrentCursor->GetPoint()); -while (m_pCurrentCursor->GetPoint()->GetNode().FindTableNode() != pTable -&& (!pTable || pTable->GetIndex() < m_pCurrentCursor->GetPoint()->GetNode().FindTableNode()->GetIndex()) -&& MoveOutOfTable()); +while (auto* pFoundTable = m_pCurrentCursor->GetPoint()->GetNode().FindTableNode()) +{ +if (pFoundTable == pTable) +break; +if (pTable && pTable->GetIndex() >= pFoundTable->GetIndex()) +break; +if (!MoveOutOfTable()) +break; +} UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return old != *m_pCurrentCursor->GetPoint(); }
core.git: sw/qa sw/source
sw/qa/extras/uiwriter/data/table-in-table.fodt | 29 + sw/qa/extras/uiwriter/uiwriter9.cxx| 14 sw/source/core/crsr/crsrsh.cxx | 12 +++--- 3 files changed, 52 insertions(+), 3 deletions(-) New commits: commit 0d82ddb39e0cdbfde428eb4da7268cac4176f1bd Author: Mike Kaganski AuthorDate: Thu May 2 09:11:25 2024 +0500 Commit: Mike Kaganski CommitDate: Thu May 2 08:56:47 2024 +0200 tdf#160898: check for nullptr Regression after commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda (tdf#154877 sw: generalise ExtendedSelectAll(), 2023-05-09) Change-Id: I9289171647fca8bd1b696399ff7c43a2ac7b8b30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166990 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data/table-in-table.fodt b/sw/qa/extras/uiwriter/data/table-in-table.fodt new file mode 100644 index ..e055d343b847 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/table-in-table.fodt @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 93d608a69247..d8b10279a827 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -593,6 +593,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf146190) CPPUNIT_ASSERT_EQUAL(OUString("Shape 1"), rMrkList.GetMark(0)->GetMarkedSdrObj()->GetName()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf160898) +{ +// Given a document with a 1-cell table in another 1-cell table: +createSwDoc("table-in-table.fodt"); +SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); +SwDocShell* pDocShell = pXTextDocument->GetDocShell(); +SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + +// Move to the normally hidden paragraph inside the outer table cell, following the inner table +pWrtShell->Down(false, 2); +// Without the fix, this would crash: +pWrtShell->SelAll(); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 58396b6f2890..d3b39a4ae2c4 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -737,9 +737,15 @@ bool SwCursorShell::MoveStartText() SwTableNode const*const pTable(pStartNode->FindTableNode()); m_pCurrentCursor->GetPoint()->Assign(*pStartNode); SwNodes::GoNext(m_pCurrentCursor->GetPoint()); -while (m_pCurrentCursor->GetPoint()->GetNode().FindTableNode() != pTable -&& (!pTable || pTable->GetIndex() < m_pCurrentCursor->GetPoint()->GetNode().FindTableNode()->GetIndex()) -&& MoveOutOfTable()); +while (auto* pFoundTable = m_pCurrentCursor->GetPoint()->GetNode().FindTableNode()) +{ +if (pFoundTable == pTable) +break; +if (pTable && pTable->GetIndex() >= pFoundTable->GetIndex()) +break; +if (!MoveOutOfTable()) +break; +} UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); return old != *m_pCurrentCursor->GetPoint(); }
core.git: Branch 'distro/vector/vector-7.5.9' - 4 commits - svtools/source sw/qa sw/source
svtools/source/svhtml/htmlout.cxx |4 - sw/qa/extras/htmlexport/data/tdf160867_image_with_link.fodt | 25 +++ sw/qa/extras/htmlexport/htmlexport.cxx | 41 sw/source/core/inc/noteurl.hxx | 36 ++ sw/source/core/inc/swfont.hxx |3 sw/source/core/layout/paintfrm.cxx |5 - sw/source/core/text/atrhndl.hxx |2 sw/source/core/text/atrstck.cxx | 15 sw/source/core/text/inftxt.cxx | 37 ++ sw/source/core/text/inftxt.hxx |7 ++ sw/source/core/text/itrform2.cxx|2 sw/source/core/text/itrpaint.cxx| 20 + sw/source/core/text/noteurl.cxx | 37 ++ sw/source/core/text/porfly.hxx |1 sw/source/core/text/pormulti.cxx|3 sw/source/core/txtnode/swfont.cxx |2 sw/source/filter/html/htmlflywriter.cxx | 31 ++--- 17 files changed, 256 insertions(+), 15 deletions(-) New commits: commit a2cb4a27f2e56d042b1f0dd1eaead49228b98197 Author: Mike Kaganski AuthorDate: Wed May 1 12:10:23 2024 +0500 Commit: Mike Kaganski CommitDate: Wed May 1 16:13:46 2024 +0500 tdf#160867: only output first element of the map in ReqIF case It should be investigated, how the whole image map can be output in that case - something to be done separately. Change-Id: I6543c0d238205fabdb0a688e32a2d08423d7a5d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166948 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 148285680043..f1e32f9d110e 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -3078,6 +3078,23 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_160867) assertXPath(pDoc, "/html/body/p[2]/img", "usemap", "#" + mapName); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_160867) +{ +// Given a document with an image with hyperlink, and text with hyperlink, both in a frame: +createSwDoc("tdf160867_image_with_link.fodt"); +// When exporting to reqif: +ExportToReqif(); +// For now, we don't (yet) output the whole map in ReqIF case. +// Make sure that the first hyperlink from the objects in the frame is output as an element +// around the whole image of the frame. +SvMemoryStream aStream; +WrapReqifFromTempFile(aStream); +xmlDocUniquePtr pXmlDoc = parseXmlStream(); +assertXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a/reqif-xhtml:object"); +CPPUNIT_ASSERT( +getXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a", "href").endsWith("foo/bar")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 624d992fb273..32b97fe16bdc 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1117,17 +1117,17 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con OUString aIMapName; // Only consider the URL attribute if no ImageMap was supplied -if (!pAltImgMap) -pURLItem = rItemSet.GetItemIfSet( RES_URL ); // write ImageMap const ImageMap* pIMap = pAltImgMap; -if( !pIMap && pURLItem ) +if( !pIMap ) { -pIMap = pURLItem->GetMap(); +pURLItem = rItemSet.GetItemIfSet(RES_URL); +if (pURLItem) +pIMap = pURLItem->GetMap(); } -if (pIMap) +if (pIMap && !rHTMLWrt.mbReqIF) { // make the name unique aIMapName = pIMap->GetName(); @@ -1135,10 +1135,10 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con if (!aIMapName.isEmpty()) aNameBase = aIMapName; else +{ aNameBase = OOO_STRING_SVTOOLS_HTML_map; - -if (aIMapName.isEmpty()) aIMapName = aNameBase + OUString::number(rHTMLWrt.m_nImgMapCnt); +} bool bFound; do @@ -1309,7 +1309,7 @@ Writer& OutHTML_ImageStart( HtmlWriter& rHtml, Writer& rWrt, const SwFrameFormat // URL -> .. const SvxMacroItem *pMacItem = rItemSet.GetItemIfSet(RES_FRMMACRO); -if (pURLItem || pMacItem) +if (pURLItem || pMacItem || (rHTMLWrt.mbReqIF && pAltImgMap)) { OUString aMapURL; OUString aName;
core.git: sw/qa sw/source
sw/qa/extras/htmlexport/htmlexport.cxx | 15 +++ sw/source/filter/html/htmlflywriter.cxx | 31 +++ 2 files changed, 38 insertions(+), 8 deletions(-) New commits: commit 96eabc69e9c3c6e9c944a4e83adddea44d48c621 Author: Mike Kaganski AuthorDate: Wed May 1 12:10:23 2024 +0500 Commit: Mike Kaganski CommitDate: Wed May 1 12:12:59 2024 +0200 tdf#160867: only output first element of the map in ReqIF case It should be investigated, how the whole image map can be output in that case - something to be done separately. Change-Id: I6543c0d238205fabdb0a688e32a2d08423d7a5d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166948 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 1fc731b8b21d..282ce035b3a6 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -3107,6 +3107,21 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_160867) assertXPath(pDoc, "/html/body/p[2]/img"_ostr, "usemap"_ostr, "#" + mapName); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_160867) +{ +// Given a document with an image with hyperlink, and text with hyperlink, both in a frame: +createSwDoc("tdf160867_image_with_link.fodt"); +// When exporting to reqif: +ExportToReqif(); +// For now, we don't (yet) output the whole map in ReqIF case. +// Make sure that the first hyperlink from the objects in the frame is output as an element +// around the whole image of the frame. +xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile(); +assertXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a/reqif-xhtml:object"_ostr); +CPPUNIT_ASSERT(getXPath(pXmlDoc, "//reqif-xhtml:p[2]/reqif-xhtml:a"_ostr, "href"_ostr) + .endsWith("foo/bar")); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index ea421f3cbc72..80b4abf5eade 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1080,17 +1080,17 @@ OUString lclWriteOutImap(SwHTMLWriter& rWrt, const SfxItemSet& rItemSet, const S OUString aIMapName; // Only consider the URL attribute if no ImageMap was supplied -if (!pAltImgMap) -pURLItem = rItemSet.GetItemIfSet( RES_URL ); // write ImageMap const ImageMap* pIMap = pAltImgMap; -if( !pIMap && pURLItem ) +if( !pIMap ) { -pIMap = pURLItem->GetMap(); +pURLItem = rItemSet.GetItemIfSet(RES_URL); +if (pURLItem) +pIMap = pURLItem->GetMap(); } -if (pIMap) +if (pIMap && !rWrt.mbReqIF) { // make the name unique aIMapName = pIMap->GetName(); @@ -1098,10 +1098,10 @@ OUString lclWriteOutImap(SwHTMLWriter& rWrt, const SfxItemSet& rItemSet, const S if (!aIMapName.isEmpty()) aNameBase = aIMapName; else +{ aNameBase = OOO_STRING_SVTOOLS_HTML_map; - -if (aIMapName.isEmpty()) aIMapName = aNameBase + OUString::number(rWrt.m_nImgMapCnt); +} bool bFound; do @@ -1271,7 +1271,7 @@ SwHTMLWriter& OutHTML_ImageStart( HtmlWriter& rHtml, SwHTMLWriter& rWrt, const S // URL -> .. const SvxMacroItem *pMacItem = rItemSet.GetItemIfSet(RES_FRMMACRO); -if (pURLItem || pMacItem) +if (pURLItem || pMacItem || (rWrt.mbReqIF && pAltImgMap)) { OUString aMapURL; OUString aName; @@ -1283,6 +1283,21 @@ SwHTMLWriter& OutHTML_ImageStart( HtmlWriter& rHtml, SwHTMLWriter& rWrt, const S aName = pURLItem->GetName(); aTarget = pURLItem->GetTargetFrameName(); } +else if (rWrt.mbReqIF && pAltImgMap) +{ +// Get first non-empty map element +for (size_t i = 0; i < pAltImgMap->GetIMapObjectCount(); ++i) +{ +if (auto* pIMapObject = pAltImgMap->GetIMapObject(i)) +{ +aMapURL = pIMapObject->GetURL(); +aName = pIMapObject->GetName(); +aTarget = pIMapObject->GetTarget(); +if (!aMapURL.isEmpty() || !aName.isEmpty() || !aTarget.isEmpty()) +break; +} +} +} bool bEvents = pMacItem && !pMacItem->GetMacroTable().empty();
core.git: translations
translations |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e8e5ffe638ad36ca0bb444006c86479b190d6de3 Author: Mike Kaganski AuthorDate: Wed May 1 10:57:12 2024 +0100 Commit: Gerrit Code Review CommitDate: Wed May 1 11:57:12 2024 +0200 Update git submodules * Update translations from branch 'master' to b824b552da5c054dd35568e86266afd1cf539441 - tdf#151830: Fix RID_SVXSTR_TEXTENCODING_TABLE nb translations Change-Id: I54cf1c7b471724ece13b2789d31b187b5e080446 Reviewed-on: https://gerrit.libreoffice.org/c/translations/+/164882 Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/translations b/translations index 7e1ef25c4f7b..b824b552da5c 16 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit 7e1ef25c4f7bb14013f6e68e04c1205785967dad +Subproject commit b824b552da5c054dd35568e86266afd1cf539441
translations.git: source/nb
source/nb/svx/messages.po | 104 +++--- 1 file changed, 52 insertions(+), 52 deletions(-) New commits: commit b824b552da5c054dd35568e86266afd1cf539441 Author: Mike Kaganski AuthorDate: Mon Mar 18 12:42:48 2024 +0100 Commit: Christian Lohmaier CommitDate: Wed May 1 11:57:12 2024 +0200 tdf#151830: Fix RID_SVXSTR_TEXTENCODING_TABLE nb translations Change-Id: I54cf1c7b471724ece13b2789d31b187b5e080446 Reviewed-on: https://gerrit.libreoffice.org/c/translations/+/164882 Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/source/nb/svx/messages.po b/source/nb/svx/messages.po index dcac5993bcd..223d6f6ab21 100644 --- a/source/nb/svx/messages.po +++ b/source/nb/svx/messages.po @@ -12176,133 +12176,133 @@ msgstr "Kyrillisk (ISO-8859-5)" #: svx/inc/txenctab.hrc:47 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Arabic (ISO-8859-6)" -msgstr "Gresk (ISO-8859-7)" +msgstr "Arabisk (ISO-8859-6)" #. qTzCE #: svx/inc/txenctab.hrc:48 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Greek (ISO-8859-7)" -msgstr "Tyrkisk (ISO-8859-9)" +msgstr "Gresk (ISO-8859-7)" #. MmChj #: svx/inc/txenctab.hrc:49 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Hebrew (ISO-8859-8)" -msgstr "Vest-Europa (ISO-8859-14)" +msgstr "Hebraisk (ISO-8859-8)" #. 3bHAV #: svx/inc/txenctab.hrc:50 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Turkish (ISO-8859-9)" -msgstr "Vest-Europa (ISO-8859-15/euro)" +msgstr "Tyrkisk (ISO-8859-9)" #. phdte #: svx/inc/txenctab.hrc:51 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Western Europe (ISO-8859-14)" -msgstr "Gresk (DOS/OS2-737)" +msgstr "Vest-Europa (ISO-8859-14)" #. MpHUZ #: svx/inc/txenctab.hrc:52 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Western Europe (ISO-8859-15/EURO)" -msgstr "Baltisk (DOS/OS2-775)" +msgstr "Vest-Europa (ISO-8859-15/Euro)" #. JgVnj #: svx/inc/txenctab.hrc:53 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Greek (DOS/OS2-737)" -msgstr "Øst-Europa (DOS/OS2-852)" +msgstr "Gresk (DOS/OS2-737)" #. EQi6s #: svx/inc/txenctab.hrc:54 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Baltic (DOS/OS2-775)" -msgstr "Kyrillisk (DOS/OS2-855)" +msgstr "Baltisk (DOS/OS2-775)" #. SDvMf #: svx/inc/txenctab.hrc:55 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Eastern Europe (DOS/OS2-852)" -msgstr "Tyrkisk (DOS/OS2-857)" +msgstr "Øst-Europa (DOS/OS2-852)" #. 3FrUC #: svx/inc/txenctab.hrc:56 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Cyrillic (DOS/OS2-855)" -msgstr "Kyrillisk (DOS/OS2-866/russisk)" +msgstr "Kyrillisk (DOS/OS2-855)" #. G8q5c #: svx/inc/txenctab.hrc:57 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Turkish (DOS/OS2-857)" -msgstr "Gresk (DOS/OS2-869/moderne)" +msgstr "Tyrkisk (DOS/OS2-857)" #. kBvdY #: svx/inc/txenctab.hrc:58 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Hebrew (DOS/OS2-862)" -msgstr "Øst-Europa (Windows-1250/WinLatin 2)" +msgstr "Hebraisk (DOS/OS2-862)" #. to6H6 #: svx/inc/txenctab.hrc:59 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Arabic (DOS/OS2-864)" -msgstr "Kyrillisk (Windows-1251)" +msgstr "Arabisk (DOS/OS2-864)" #. BH6K4 #: svx/inc/txenctab.hrc:60 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Cyrillic (DOS/OS2-866/Russian)" -msgstr "Gresk (Windows-1253)" +msgstr "Kyrillisk (DOS/OS2-866/Russisk)" #. ms8Dk #: svx/inc/txenctab.hrc:61 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Greek (DOS/OS2-869/Modern)" -msgstr "Tyrkisk (Windows-1254)" +msgstr "Gresk (DOS/OS2-869/Moderne)" #. U9RbL #: svx/inc/txenctab.hrc:62 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Eastern Europe (Windows-1250/WinLatin 2)" -msgstr "Baltisk (Windows-1257)" +msgstr "Øst-Europa (Windows-1250/WinLatin 2)" #. fRRMB #: svx/inc/txenctab.hrc:63 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Cyrillic (Windows-1251)" -msgstr "Øst-Europa (Apple Macintosh)" +msgstr "Kyrillisk (Windows-1251)" #. 7D9eT #: svx/inc/txenctab.hrc:64 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Greek (Windows-1253)" -msgstr "Øst-Europa (Apple Macintosh/kroatisk)" +msgstr "Gresk (Windows-1253)" #. sa8W8 #: svx/inc/txenctab.hrc:65 msgctxt "RID_SVXSTR_TEXTENCODING_TABLE" msgid "Tu
core.git: sw/source
sw/source/core/inc/noteurl.hxx |2 +- sw/source/core/layout/paintfrm.cxx |4 ++-- sw/source/core/text/noteurl.cxx|2 +- 3 files changed, 4 insertions(+), 4 deletions(-) New commits: commit c85c534befc1a68f405fc2ad508ae9363d7ebb91 Author: Mike Kaganski AuthorDate: Wed May 1 10:00:25 2024 +0500 Commit: Mike Kaganski CommitDate: Wed May 1 08:35:25 2024 +0200 Make pNoteURL thread-local, just in case Change-Id: I27247a85f0d7497f70c5d97a8955b68a29be1176 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166946 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/source/core/inc/noteurl.hxx b/sw/source/core/inc/noteurl.hxx index eeae15642a43..b575b60d20a0 100644 --- a/sw/source/core/inc/noteurl.hxx +++ b/sw/source/core/inc/noteurl.hxx @@ -59,7 +59,7 @@ public: }; // globale Variable, in NoteURL.Cxx angelegt -extern SwNoteURL* pNoteURL; +extern thread_local SwNoteURL* pNoteURL; #endif diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 1e8600d83094..1d27f9406c0c 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -8054,7 +8054,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap, const sal_uInt32 /*nMaxim SfxItemState::SET != GetAttrSet().GetItemState( RES_URL ); if( bNoteURL ) { -OSL_ENSURE( !pNoteURL, "MakeGraphic: pNoteURL already used? " ); +assert(!pNoteURL); pNoteURL = new SwNoteURL; } SwFlyFrame *pFly = static_cast(pFirst); @@ -8135,7 +8135,7 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap, const sal_uInt32 /*nMaxim if( bNoteURL ) { -OSL_ENSURE( pNoteURL, "MakeGraphic: Good Bye, NoteURL." ); +assert(pNoteURL); pNoteURL->FillImageMap(pMap, pFly->getFrameArea().Pos(), aMap); delete pNoteURL; pNoteURL = nullptr; diff --git a/sw/source/core/text/noteurl.cxx b/sw/source/core/text/noteurl.cxx index ae52e1c29a91..d66736280bb5 100644 --- a/sw/source/core/text/noteurl.cxx +++ b/sw/source/core/text/noteurl.cxx @@ -25,7 +25,7 @@ #include // Global variable -SwNoteURL* pNoteURL = nullptr; +thread_local SwNoteURL* pNoteURL = nullptr; void SwNoteURL::InsertURLNote(const OUString& rURL, const OUString& rTarget, const SwRect& rRect) {
core.git: sw/qa sw/source
sw/qa/extras/htmlexport/htmlexport.cxx |8 ++-- sw/source/core/text/inftxt.cxx | 16 sw/source/core/text/itrpaint.cxx | 17 + sw/source/core/text/porfly.hxx |1 + 4 files changed, 40 insertions(+), 2 deletions(-) New commits: commit 42876f0a99e2ae7cb7529dd7fb4d94c5e9298b21 Author: Mike Kaganski AuthorDate: Tue Apr 30 22:16:12 2024 +0500 Commit: Mike Kaganski CommitDate: Wed May 1 06:59:40 2024 +0200 tdf#160867: export as-char frames' hyperlinks to image map Change-Id: Idc8d41a27c8ee9cdd12fb5e17a328ec6aa104a16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166935 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 329be9231bb9..1fc731b8b21d 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -3093,13 +3093,17 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testHTML_160867) CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/html/body/p"_ostr, 2); -// Test export of text hyperlink in the image map. TODO: implement export of image hyperlink. +// Test export of image and text hyperlinks in the image map. // Without the fix, the test would fail with // - Expected: 1 // - Actual : 0 // - In <>, XPath '/html/body/p[2]/map' number of nodes is incorrect const OUString mapName = getXPath(pDoc, "/html/body/p[2]/map"_ostr, "name"_ostr); -assertXPath(pDoc, "/html/body/p[2]/map/area"_ostr, "shape"_ostr, u"rect"_ustr); +assertXPath(pDoc, "/html/body/p[2]/map/area[1]"_ostr, "shape"_ostr, u"rect"_ustr); +CPPUNIT_ASSERT( +getXPath(pDoc, "/html/body/p[2]/map/area[1]"_ostr, "href"_ostr).endsWith("foo/bar")); +assertXPath(pDoc, "/html/body/p[2]/map/area[2]"_ostr, "shape"_ostr, u"rect"_ustr); +CPPUNIT_ASSERT(getXPath(pDoc, "/html/body/p[2]/map/area[2]"_ostr, "href"_ostr).endsWith("baz")); assertXPath(pDoc, "/html/body/p[2]/img"_ostr, "usemap"_ostr, "#" + mapName); } diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index a1a3bb89a87b..ddcca31668db 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -51,6 +52,7 @@ #include #include "inftxt.hxx" #include +#include "porfly.hxx" #include "porftn.hxx" #include "porrst.hxx" #include "itratr.hxx" @@ -1479,6 +1481,20 @@ void SwTextPaintInfo::NotifyURL_(const SwLinePortion& rPor) const const SwFormatINetFormat& rFormat = pAttr->GetINetFormat(); pNoteURL->InsertURLNote(rFormat.GetValue(), rFormat.GetTargetFrame(), aIntersect); } +else if (rPor.IsFlyCntPortion()) +{ +if (auto* pFlyContentPortion = dynamic_cast()) +{ +if (auto* pFlyFtame = pFlyContentPortion->GetFlyFrame()) +{ +if (auto* pFormat = pFlyFtame->GetFormat()) +{ +auto& url = pFormat->GetURL(); // TODO: url.GetMap() ? +pNoteURL->InsertURLNote(url.GetURL(), url.GetTargetFrameName(), aIntersect); +} +} +} +} } } diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 8fa9ca45f5fd..f02beed8ce5b 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -33,6 +33,7 @@ #include #include "txtpaint.hxx" #include "porfld.hxx" +#include "porfly.hxx" #include "portab.hxx" #include #include @@ -40,6 +41,7 @@ #include "porrst.hxx" #include "pormulti.hxx" #include +#include // Returns, if we have an underline breaking situation // Adding some more conditions here means you also have to change them @@ -461,6 +463,21 @@ void SwTextPainter::DrawTextLine( const SwRect , SwSaveClip , if (GetFnt()->IsURL() && pPor->InTextGrp()) GetInfo().NotifyURL(*pPor); +else if (pPor->IsFlyCntPortion()) +{ +if (auto* pFlyContentPortion = dynamic_cast(pPor)) +{ +if (auto* pFlyFrame = pFlyContentPortion->GetFlyFrame()) +{ +if (auto* pFormat = pFlyFrame->GetFormat()) +{ +auto& url = pFormat->GetURL(); +if (!url.GetURL().isEmpty()) // TODO: url.GetMap() ? +
core.git: include/vcl svtools/source sw/qa sw/source
include/vcl/imaprect.hxx|2 svtools/source/svhtml/htmlout.cxx |4 - sw/qa/extras/htmlexport/data/tdf160867_image_with_link.fodt | 25 sw/qa/extras/htmlexport/htmlexport.cxx | 21 +++ sw/source/core/inc/noteurl.hxx | 34 +++ sw/source/core/inc/swfont.hxx |3 + sw/source/core/layout/paintfrm.cxx |1 sw/source/core/text/atrhndl.hxx |2 sw/source/core/text/atrstck.cxx | 15 + sw/source/core/text/inftxt.cxx | 21 +++ sw/source/core/text/inftxt.hxx |7 ++ sw/source/core/text/itrform2.cxx|2 sw/source/core/text/itrpaint.cxx|3 + sw/source/core/text/noteurl.cxx | 35 sw/source/core/text/pormulti.cxx|3 + sw/source/core/txtnode/swfont.cxx |2 16 files changed, 176 insertions(+), 4 deletions(-) New commits: commit acbb6c98ae1335da5aca4f1a55de5f3ae35a5d02 Author: Mike Kaganski AuthorDate: Tue Apr 30 15:40:41 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Apr 30 19:11:32 2024 +0200 tdf#160867: restore HTML map export for text hyperlinks in frames The most exciting was to discover that this functionality was actually already implemented prior to 2001, and then accidentally dropped, and nobody noticed, until Noel did his great cleanups, and made an amazing investigation in commit ed2ae3c3bb0a708cafc3de6a01adc9ddc43fb859 (remove dead SwNoteURL, 2018-03-14). The detailed commit message made my task so much easier: I knew where and what to restore. So this change restores relevant pieces removed over the time in commits * 1b666235f6b0b0f0b13f473bf3b639f4f5f0b12f (loplugin:singlevalfields improve copy constructor check, 2018-01-03), * be8c414567f49242164b1fdfb12764b16be355c1 (loplugin:unusedmethods also check for functions returning bool, 2018-01-19), * 73139fe600fc1399ae828077981a2498cb0a0b0c (loplugin:unusedmethods, 2018-01-20) * bb7ade140df807b6a0f12766a1365b8f8d0fd342 (loplugin:unusedmethods, 2018-03-08), * ed2ae3c3bb0a708cafc3de6a01adc9ddc43fb859 (remove dead SwNoteURL, 2018-03-14), * fd1cfd25b48cb4bd5c87e9cb317b37699ca3a1d6 (PortionType::Url is unused, 2019-01-18). It re-implements the functionality accidentally removed in commit da7671e4f7482110ecd0cfbfd7dbd9e0b873c81c (Opt.(FME): The new attribute handler makes a lot of code superfluous, 2001-03-15), moving it into SwAttrHandler, which replaced the ChgFnt in SwTxtAttr. It also fixes the code writing the HTML image map, to output valid HTML. And finally, it adds a unit test, to avoid repeating the story :-) Change-Id: I72ae3cf30f0e9689f50a2c877e1622e4ae46de49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166924 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/include/vcl/imaprect.hxx b/include/vcl/imaprect.hxx index 89cb52d80bbe..8abe1ed39960 100644 --- a/include/vcl/imaprect.hxx +++ b/include/vcl/imaprect.hxx @@ -25,7 +25,7 @@ class Fraction; -class UNLESS_MERGELIBS(VCL_DLLPUBLIC) IMapRectangleObject final : public IMapObject +class VCL_DLLPUBLIC IMapRectangleObject final : public IMapObject { tools::Rectangle aRect; diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 956546269708..d165a8922f02 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -702,7 +702,7 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, sOut.append(OString::Concat("<") + OOO_STRING_SVTOOLS_HTML_area " " OOO_STRING_SVTOOLS_HTML_O_shape -"=" + pShape + " " +"=\"" + pShape + "\" " OOO_STRING_SVTOOLS_HTML_O_coords "=\"" + aCoords + "\" "); rStream.WriteOString( sOut ); @@ -756,7 +756,7 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, Out_Events( rStream, rMacroTab, pEventTable, bOutStarBasic ); -rStream.WriteChar( '>' ); +rStream.WriteOString("/>"); } } diff --git a/sw/qa/extras/htmlexport/data/tdf160867_image_with_link.fodt b/sw/qa/extras/htmlexport/data/tdf160867_image_with_link.fodt new file mode 100644 index ..43c35cdff13e --- /dev/
core.git: desktop/source
desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 17 +++- desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx | 21 +++ desktop/source/deployment/registry/help/dp_help.cxx | 18 + desktop/source/deployment/registry/package/dp_package.cxx|9 +--- 4 files changed, 20 insertions(+), 45 deletions(-) New commits: commit 55eb79f8f52ef20198aeba04578a1be4d100b126 Author: Mike Kaganski AuthorDate: Mon Apr 29 15:11:54 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Apr 30 15:12:14 2024 +0200 Drop uses of css::uno::Sequence::getConstArray in deployment where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: I3b2cb267010e7b654291fa866b28c7cc272f0ea1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166911 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index c91ec4a0b132..fe7194405576 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -507,27 +507,24 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & } else { +assert(approve != abort); // select: -uno::Sequence< uno::Reference< task::XInteractionContinuation > > conts( -xRequest->getContinuations() ); -uno::Reference< task::XInteractionContinuation > const * pConts = conts.getConstArray(); -sal_Int32 len = conts.getLength(); -for ( sal_Int32 pos = 0; pos < len; ++pos ) +for (auto& cont : xRequest->getContinuations()) { if (approve) { -uno::Reference< task::XInteractionApprove > xInteractionApprove( pConts[ pos ], uno::UNO_QUERY ); +uno::Reference xInteractionApprove(cont, uno::UNO_QUERY); if (xInteractionApprove.is()) { xInteractionApprove->select(); // don't query again for ongoing continuations: -approve = false; +break; } } -else if (abort) { -uno::Reference< task::XInteractionAbort > xInteractionAbort( pConts[ pos ], uno::UNO_QUERY ); +else /*if (abort)*/ { +uno::Reference xInteractionAbort(cont, uno::UNO_QUERY); if (xInteractionAbort.is()) { xInteractionAbort->select(); // don't query again for ongoing continuations: -abort = false; +break; } } } diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index 0248a1537fa1..e15c72c9caac 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -623,21 +623,14 @@ void UpdateCommandEnv::handle( else { // select: -css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > conts( -xRequest->getContinuations() ); -css::uno::Reference< css::task::XInteractionContinuation > const * pConts = -conts.getConstArray(); -sal_Int32 len = conts.getLength(); -for ( sal_Int32 pos = 0; pos < len; ++pos ) +for (auto& cont : xRequest->getContinuations()) { -if (approve) { -css::uno::Reference< css::task::XInteractionApprove > xInteractionApprove( -pConts[ pos ], css::uno::UNO_QUERY ); -if (xInteractionApprove.is()) { -xInteractionApprove->select(); -// don't query again for ongoing continuations: -approve = false; -} +css::uno::Reference< css::task::XInteractionApprove > xInteractionApprove( +cont, css::uno::UNO_QUERY ); +if (xInteractionApprove.is()) { +xInteractionApprove->select(); +// don't query again for ongoing continuations: +break; } } } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index a84bc2809544..b0db2acd200e 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -396,12 +396,8 @@ void Bac
core.git: vcl/qa
vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 250 1 file changed, 125 insertions(+), 125 deletions(-) New commits: commit 41e5b9d32f8914e3f0159f064e46c362d55b6ccd Author: Mike Kaganski AuthorDate: Tue Apr 30 09:14:55 2024 +0200 Commit: Mike Kaganski CommitDate: Tue Apr 30 10:37:02 2024 +0200 Remove some syntactic noise Use of auto num(0) together with decltype(1) is overkill, when the language explicitly specifies these literals to be int. Also, change static_casts on literals into function-style cast. And make some comparisong use CPPUNIT_ASSERT_GREATEREQUAL. Change-Id: I3af7231a997a4611b564b38facd15a3a6bb76cdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166893 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index ccaab1d5c9bf..96e34cc8c208 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -100,7 +100,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf124272) // The document has one page. std::vector aPages = aDocument.GetPages(); -CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); // The page has a stream. vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); @@ -133,7 +133,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf121615) // The document has one page. std::vector aPages = aDocument.GetPages(); -CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); // Get access to the only image on the only page. vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); @@ -141,7 +141,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf121615) auto pXObjects = dynamic_cast(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); -CPPUNIT_ASSERT_EQUAL(static_cast(1), pXObjects->GetItems().size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject = pXObjects->LookupObject(pXObjects->GetItems().begin()->first); CPPUNIT_ASSERT(pXObject); @@ -181,7 +181,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf141171) // The document has one page. std::vector aPages = aDocument.GetPages(); -CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); // Get access to the only image on the only page. vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); @@ -189,7 +189,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf141171) auto pXObjects = dynamic_cast(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); -CPPUNIT_ASSERT_EQUAL(static_cast(1), pXObjects->GetItems().size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject = pXObjects->LookupObject(pXObjects->GetItems().begin()->first); CPPUNIT_ASSERT(pXObject); @@ -236,7 +236,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf129085) // The document has one page. std::vector aPages = aDocument.GetPages(); -CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); // Get access to the only image on the only page. vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); @@ -246,7 +246,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf129085) // Without the fix in place, this test would have failed here CPPUNIT_ASSERT(pXObjects); -CPPUNIT_ASSERT_EQUAL(static_cast(1), pXObjects->GetItems().size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject = pXObjects->LookupObject(pXObjects->GetItems().begin()->first); CPPUNIT_ASSERT(pXObject); @@ -700,7 +700,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF) load(u"SimpleMultiPagePDF.pdf", aDocument); std::vector aPages = aDocument.GetPages(); -CPPUNIT_ASSERT_EQUAL(static_cast(3), aPages.size()); +CPPUNIT_ASSERT_EQUAL(size_t(3), aPages.size()); vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); @@ -709,7 +709,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF) = dynamic_cast(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); -CPPUNIT_ASSERT_EQUAL(static_cast(3), +CPPUNIT_ASSERT_EQUAL(size_t(3), pXObjects->GetItems().size
core.git: desktop/source extensions/source i18npool/source include/comphelper scripting/source sd/qa slideshow/source stoc/source sw/source testtools/source
desktop/source/deployment/manager/dp_commandenvironments.cxx | 21 +-- desktop/source/deployment/registry/component/dp_component.cxx |4 extensions/source/abpilot/datasourcehandling.cxx | 14 -- extensions/source/abpilot/fieldmappingimpl.cxx| 24 +--- extensions/source/bibliography/bibconfig.cxx | 31 ++--- extensions/source/bibliography/bibload.cxx|2 extensions/source/bibliography/datman.cxx | 54 -- extensions/source/bibliography/framectr.cxx | 12 -- extensions/source/bibliography/toolbar.cxx| 16 -- extensions/source/dbpilots/controlwizard.cxx | 21 +-- extensions/source/dbpilots/gridwizard.cxx | 19 +-- i18npool/source/localedata/saxparser.cxx |2 include/comphelper/namedvaluecollection.hxx |8 - scripting/source/basprov/baslibnode.cxx |3 scripting/source/basprov/basscript.cxx|3 sd/qa/unit/import-tests.cxx |2 slideshow/source/engine/opengl/TransitionerImpl.cxx | 43 +++ stoc/source/implementationregistration/implreg.cxx| 32 ++--- stoc/source/implementationregistration/mergekeys.cxx |5 stoc/source/security/permissions.cxx |3 stoc/source/servicemanager/servicemanager.cxx |7 - sw/source/core/unocore/unostyle.cxx | 26 +--- testtools/source/bridgetest/bridgetest.cxx|4 23 files changed, 136 insertions(+), 220 deletions(-) New commits: commit ea9367037232054a576f1e6aabffeb3a62ffa44b Author: Mike Kaganski AuthorDate: Mon Apr 29 01:31:19 2024 +0500 Commit: Mike Kaganski CommitDate: Tue Apr 30 06:20:50 2024 +0200 Drop some uses of css::uno::Sequence::getConstArray ... where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: I4ccc647bb794515c8c11f8dfd9a26563f4aa094b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166819 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/desktop/source/deployment/manager/dp_commandenvironments.cxx b/desktop/source/deployment/manager/dp_commandenvironments.cxx index 2b98ff971908..4a0a88f42432 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.cxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.cxx @@ -82,21 +82,14 @@ void BaseCommandEnv::handle_(bool approve, else { // select: -uno::Sequence< Reference< task::XInteractionContinuation > > conts( -xRequest->getContinuations() ); -Reference< task::XInteractionContinuation > const * pConts = -conts.getConstArray(); -sal_Int32 len = conts.getLength(); -for ( sal_Int32 pos = 0; pos < len; ++pos ) +for (auto& xContinuation : xRequest->getContinuations()) { -if (approve) { -Reference< task::XInteractionApprove > xInteractionApprove( -pConts[ pos ], uno::UNO_QUERY ); -if (xInteractionApprove.is()) { -xInteractionApprove->select(); -// don't query again for ongoing continuations: -approve = false; -} +Reference xInteractionApprove(xContinuation, uno::UNO_QUERY); +if (xInteractionApprove.is()) +{ +xInteractionApprove->select(); +// don't query again for ongoing continuations: +break; } } } diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 7a692ec8c6c5..7efa1ba854e6 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1279,13 +1279,11 @@ BackendImpl::ComponentPackageImpl::isRegistered_( Sequence implNames; if (xImplKey.is() && xImplKey->isValid()) implNames = xImplKey->getKeyNames(); -OUString const * pImplNames = implNames.getConstArray(); sal_Int32 pos = implNames.getLength(); for ( ; pos--; ) { checkAborted( abortChannel ); -const OUString key( -pImplNames[ pos ] + "/UNO/LOCATION" ); +const OUString key(implNames[pos] + "/UNO/LOCATION"); const Reference xKey
core.git: 2 commits - cppuhelper/source cpputools/source cui/source dbaccess/source
/TableWindow.cxx | 12 - dbaccess/source/ui/querydesign/querydlg.cxx|9 dbaccess/source/ui/relationdesign/RTableConnectionData.cxx | 35 +-- dbaccess/source/ui/uno/copytablewizard.cxx |4 dbaccess/source/ui/uno/dbinteraction.cxx | 15 - 76 files changed, 633 insertions(+), 1145 deletions(-) New commits: commit af5a1b5925dbc816dced8813282d953fd5adbaaa Author: Mike Kaganski AuthorDate: Mon Apr 29 01:31:19 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 29 23:15:48 2024 +0200 Drop uses of css::uno::Sequence::getConstArray in dbaccess where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: I4f8dc4f430dc49fa29012b8f064094daceb5e1b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166818 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index 955a7f1c222f..0314c36b8696 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -71,15 +71,11 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: return nShiftPos; } -static bool lcl_isElementAllowed( const OUString& _rName, +static bool lcl_isElementAllowed(std::u16string_view _rName, const Sequence< OUString >& _rTableFilter, const std::vector< WildCard >& _rWCSearch ) { -sal_Int32 nTableFilterLen = _rTableFilter.getLength(); - -const OUString* tableFilter = _rTableFilter.getConstArray(); -const OUString* tableFilterEnd = _rTableFilter.getConstArray() + nTableFilterLen; -bool bFilterMatch = std::find( tableFilter, tableFilterEnd, _rName ) != tableFilterEnd; +bool bFilterMatch = std::find(_rTableFilter.begin(), _rTableFilter.end(), _rName) != _rTableFilter.end(); // the table is allowed to "pass" if we had no filters at all or any of the non-wildcard filters matches if (!bFilterMatch && !_rWCSearch.empty()) { // or if one of the wildcard expression matches @@ -207,15 +203,12 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: TableInfos aUnfilteredTables; aUnfilteredTables.swap( aFilteredTables ); -const OUString* pTableTypeFilterBegin = _tableTypeFilter.getConstArray(); -const OUString* pTableTypeFilterEnd = pTableTypeFilterBegin + _tableTypeFilter.getLength(); - for (auto & unfilteredTable : aUnfilteredTables) { // ensure that we know the table type lcl_ensureType( unfilteredTable, _metaData, _masterContainer ); -if ( std::find( pTableTypeFilterBegin, pTableTypeFilterEnd, *unfilteredTable.sType ) != pTableTypeFilterEnd ) +if (std::find(_tableTypeFilter.begin(), _tableTypeFilter.end(), *unfilteredTable.sType) != _tableTypeFilter.end()) aFilteredTables.push_back(unfilteredTable); } } @@ -267,11 +260,10 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: TableInfos aUnfilteredTables; -Sequence< OUString > aNames = m_xMasterContainer->getElementNames(); -const OUString* name = aNames.getConstArray(); -const OUString* nameEnd = name + aNames.getLength(); -for ( ; name != nameEnd; ++name ) -aUnfilteredTables.emplace_back( *name ); +Sequence aNames = m_xMasterContainer->getElementNames(); +aUnfilteredTables.reserve(aNames.getLength()); +for (auto& name : aNames) +aUnfilteredTables.emplace_back(name); reFill( lcl_filter( std::move(aUnfilteredTables), _rTableFilter, _rTableTypeFilter, m_xMetaData, m_xMasterContainer ) ); @@ -308,14 +300,9 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: { if ( _rTableTypeFilter.hasElements() ) { -const OUString* tableType= _rTableTypeFilter.getConstArray(); -const OUString* tableTypeEnd = tableType + _rTableTypeFilter.getLength(); -for ( ; tableType != tableTypeEnd; ++tableType ) -{ -if ( *tableType == sInherentTableTypeRestriction ) -break; -} -if ( tableType
core.git: 2 commits - accessibility/source basctl/source basegfx/source canvas/source cli_ure/source connectivity/source
accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx |2 basctl/source/basicide/IDEComboBox.cxx | 16 basctl/source/basicide/basides1.cxx|3 basctl/source/basicide/basidesh.cxx| 22 basctl/source/basicide/basobj3.cxx |8 basctl/source/basicide/bastype2.cxx| 51 - basctl/source/basicide/localizationmgr.cxx | 121 --- basctl/source/basicide/moduldl2.cxx| 26 basctl/source/dlged/dlged.cxx | 59 - basctl/source/dlged/dlgedobj.cxx | 36 - basctl/source/dlged/managelang.cxx | 18 basegfx/source/polygon/b2dpolygontools.cxx | 41 - basegfx/source/polygon/b2dpolypolygontools.cxx | 21 basegfx/source/polygon/b3dpolypolygontools.cxx | 25 canvas/source/factory/cf_service.cxx | 16 canvas/source/tools/canvastools.cxx| 329 +++--- cli_ure/source/climaker/climaker_emit.cxx | 74 -- connectivity/source/commontools/DriversConfig.cxx | 27 connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx | 26 connectivity/source/commontools/FValue.cxx |7 connectivity/source/commontools/TDatabaseMetaDataBase.cxx |6 connectivity/source/commontools/dbtools.cxx|9 connectivity/source/commontools/dbtools2.cxx | 17 connectivity/source/commontools/parameters.cxx |7 connectivity/source/cpool/ZPoolCollection.cxx |9 connectivity/source/drivers/ado/AConnection.cxx| 16 connectivity/source/drivers/ado/AResultSet.cxx |6 connectivity/source/drivers/ado/Aolevariant.cxx|6 connectivity/source/drivers/ado/Awrapado.cxx |6 connectivity/source/drivers/calc/CConnection.cxx | 11 connectivity/source/drivers/calc/CDatabaseMetaData.cxx | 18 connectivity/source/drivers/calc/CTable.cxx|9 connectivity/source/drivers/dbase/DDatabaseMetaData.cxx| 47 - connectivity/source/drivers/dbase/DTable.cxx | 10 connectivity/source/parse/sqliterator.cxx | 14 35 files changed, 385 insertions(+), 734 deletions(-) New commits: commit 8755c80018bec656e1b102da25edc450da4eee52 Author: Mike Kaganski AuthorDate: Mon Apr 29 01:31:19 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 29 23:15:33 2024 +0200 Drop uses of css::uno::Sequence::getConstArray in canvas .. connectivity where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code 2021-11-05). Change-Id: I9467028fd1a7eeafad7f0dd776a91a9a40770b48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166816 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index 94f7069e267a..10d05379e8e9 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -142,13 +142,10 @@ CanvasFactory::CanvasFactory( Reference const & xContext ) : Reference xHierarchicalNameAccess( xNameAccess, UNO_QUERY_THROW); -Sequence serviceNames = xNameAccess->getElementNames(); -const OUString* pCurr = serviceNames.getConstArray(); -const OUString* const pEnd = pCurr + serviceNames.getLength(); -while( pCurr != pEnd ) +for (auto& serviceName : xNameAccess->getElementNames()) { Reference xEntryNameAccess( -xHierarchicalNameAccess->getByHierarchicalName(*pCurr), + xHierarchicalNameAccess->getByHierarchicalName(serviceName), UNO_QUERY ); if( xEntryNameAccess.is() ) @@ -156,20 +153,17 @@ CanvasFactory::CanvasFactory( Reference const & xContext ) : Sequence implementationList; if( xEntryNameAccess->getByName("PreferredImplementations") >>= implementationList ) { - m_aAvailableImplementations.emplace_back(*pCurr,implementationList ); +m_aAvailableImplementations.emplace_back(serviceName, implementationList); } if( xEntryNameAccess->getByName("A
core.git: Branch 'libreoffice-24-2-3' - 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 fa83f96bd8d987a7e9abce73d7b4ace1ff389ce7 Author: Mike Kaganski AuthorDate: Fri Apr 19 00:34:28 2024 +0500 Commit: Xisco Fauli CommitDate: Mon Apr 29 18:41:58 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 (cherry picked from commit 63ebbc33e8b1194f1e0ef7b58a98c6e4236476a9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166219 Reviewed-by: Patrick Luby Reviewed-by: Ilmari Lauhakangas 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 && bStartPosI
core.git: Branch 'distro/vector/vector-7.5.9' - 19 commits - basegfx/source canvas/source chart2/source cppcanvas/source cui/source drawinglayer/source editeng/source emfio/qa emfio/source filter/sour
/CommonSalLayout.cxx |6 vcl/source/gdi/gdimetafiletools.cxx |8 - vcl/source/gdi/gdimtf.cxx| 28 ++-- vcl/source/gdi/impgraph.cxx |6 vcl/source/gdi/metaact.cxx | 30 ++-- vcl/source/gdi/pdfbuildin_fonts.cxx |5 vcl/source/gdi/pdfwriter_impl.cxx| 37 - vcl/source/gdi/pdfwriter_impl2.cxx |8 - vcl/source/gdi/print.cxx | 10 - vcl/source/gdi/regband.cxx |7 - vcl/source/gdi/region.cxx|4 vcl/source/gdi/regionband.cxx|4 vcl/source/gdi/sallayout.cxx | 40 -- vcl/source/gdi/textlayout.cxx|2 vcl/source/graphic/GraphicObject.cxx | 24 +-- vcl/source/helper/canvastools.cxx|4 vcl/source/outdev/bitmapex.cxx | 18 +- vcl/source/outdev/font.cxx |6 vcl/source/outdev/hatch.cxx | 19 +- vcl/source/outdev/map.cxx| 37 + vcl/source/outdev/rect.cxx | 16 +- vcl/source/outdev/text.cxx | 71 --- vcl/source/outdev/textline.cxx |4 vcl/source/outdev/transparent.cxx|2 vcl/source/window/printdlg.cxx |4 vcl/source/window/window2.cxx|6 vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 38 - vcl/unx/generic/glyphs/glyphcache.cxx|8 - vcl/unx/gtk3/gtkinst.cxx |3 vcl/win/gdi/DWriteTextRenderer.cxx | 39 -- vcl/win/gdi/gdiimpl.cxx |4 vcl/win/gdi/salfont.cxx | 53 vcl/win/gdi/winlayout.cxx| 18 -- vcl/workben/listglyphs.cxx |2 xmloff/source/draw/shapeexport.cxx | 17 +- 175 files changed, 1134 insertions(+), 1011 deletions(-) New commits: commit 76342214ed36a02342dbc43a081fa0e64a0262c4 Author: Mike Kaganski AuthorDate: Tue Apr 23 05:25:34 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 29 10:02:52 2024 +0500 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 31120279a732..a9b78c599042 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; } } commit 44e8c255d6e072e12f3e178b5080ad0f6b87b173 Author: Mike Kaganski AuthorDate: Mon Apr 22 14:45:37 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Apr 29 10:02:52 2024 +0500 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 5bc82301b794..31120279a732 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 fo
core.git: comphelper/source
comphelper/source/container/embeddedobjectcontainer.cxx | 39 comphelper/source/container/enumerablemap.cxx |8 -- comphelper/source/container/enumhelper.cxx |2 comphelper/source/eventattachermgr/eventattachermgr.cxx |3 comphelper/source/misc/docpasswordhelper.cxx|9 -- comphelper/source/misc/sequenceashashmap.cxx| 18 + comphelper/source/misc/xmlsechelper.cxx |8 -- comphelper/source/property/ChainablePropertySet.cxx | 36 --- comphelper/source/property/MasterPropertySet.cxx| 32 -- comphelper/source/property/genericpropertyset.cxx | 14 +--- comphelper/source/property/opropertybag.cxx | 31 +++--- comphelper/source/property/propagg.cxx | 30 +++-- comphelper/source/property/propertysethelper.cxx| 49 comphelper/source/property/propertystatecontainer.cxx | 44 +- comphelper/source/property/propshlp.cxx |3 comphelper/source/property/propstate.cxx| 19 ++ 16 files changed, 128 insertions(+), 217 deletions(-) New commits: commit 826e7e79f36de0248782213e0196baebc1653e85 Author: Mike Kaganski AuthorDate: Sun Apr 28 00:52:10 2024 +0500 Commit: Mike Kaganski CommitDate: Sun Apr 28 05:14:50 2024 +0200 Simplify a bit Change-Id: I1db779648b273d0c732683042c74bd29666f1b10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166785 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index a66ac2dec527..56b50c964823 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -1165,12 +1165,9 @@ bool EmbeddedObjectContainer::StoreAsChildren(bool _bOasisFormat,bool _bCreateEm try { comphelper::EmbeddedObjectContainer aCnt( _xStorage ); -const uno::Sequence < OUString > aNames = GetObjectNames(); -const OUString* pIter = aNames.getConstArray(); -const OUString* pEnd = pIter + aNames.getLength(); -for(;pIter != pEnd;++pIter) +for (auto& name : GetObjectNames()) { -uno::Reference < embed::XEmbeddedObject > xObj = GetEmbeddedObject( *pIter ); +uno::Reference xObj = GetEmbeddedObject(name); SAL_WARN_IF( !xObj.is(), "comphelper.container", "An empty entry in the embedded objects list!" ); if ( xObj.is() ) { @@ -1209,13 +1206,13 @@ bool EmbeddedObjectContainer::StoreAsChildren(bool _bOasisFormat,bool _bCreateEm { // if it is an embedded object or the optimized inserting fails the normal inserting should be done if ( _bCreateEmbedded -|| !aCnt.InsertGraphicStreamDirectly( xStream, *pIter, aMediaType ) ) -aCnt.InsertGraphicStream( xStream, *pIter, aMediaType ); +|| !aCnt.InsertGraphicStreamDirectly(xStream, name, aMediaType)) +aCnt.InsertGraphicStream(xStream, name, aMediaType); } else { // it is a linked object exported into SO7 format -InsertStreamIntoPicturesStorage_Impl( _xStorage, xStream, *pIter ); +InsertStreamIntoPicturesStorage_Impl(_xStorage, xStream, name); } } } @@ -1248,7 +1245,7 @@ bool EmbeddedObjectContainer::StoreAsChildren(bool _bOasisFormat,bool _bCreateEm } catch (const embed::WrongStateException&) { -SAL_WARN("comphelper.container", "failed to store '" << *pIter << "'"); +SAL_WARN("comphelper.container", "failed to store '" << name << "'"); } } @@ -1290,14 +1287,11 @@ bool EmbeddedObjectContainer::StoreAsChildren(bool _bOasisFormat,bool _bCreateEm bool EmbeddedObjectContainer::StoreChildren(bool _bOasisFormat,bool _bObjectsOnly) { bool bResult = true; -const uno::Sequence < OUString > aNames = GetObjectNames(); -const OUString* pIter = aNames.getConstArray(); -const OUString* pEnd = pIter + aNames.getLength(); -for(;pIter != pEnd;++pIter) +for (auto& name : GetObjectNames()) { try { -uno::Reference < embed::XEmbeddedObject > xObj = GetEmbeddedObject( *pIter ); +uno::Refer
core.git: chart2/qa chart2/source
chart2/qa/extras/chart2export3.cxx |4 chart2/qa/unit/common_functor_test.cxx |4 chart2/source/controller/main/DrawCommandDispatch.cxx |6 chart2/source/inc/CommonFunctors.hxx | 65 chart2/source/model/filter/XMLFilter.cxx |2 chart2/source/model/main/ChartModel_Persistence.cxx| 20 -- chart2/source/tools/CachedDataSequence.cxx | 76 + chart2/source/tools/ColorPerPointHelper.cxx|4 chart2/source/tools/InternalDataProvider.cxx | 99 +++-- chart2/source/tools/MeanValueRegressionCurveCalculator.cxx | 18 -- chart2/source/tools/UncachedDataSequence.cxx | 14 - chart2/source/view/main/ChartView.cxx | 22 +- 12 files changed, 99 insertions(+), 235 deletions(-) New commits: commit faeb8adf4b12a62919fbf961f65181964cce5325 Author: Mike Kaganski AuthorDate: Sat Apr 27 20:49:13 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 27 20:50:48 2024 +0200 Simplify a bit Change-Id: Ic6d0dd0f66a258fffd0be7f458316801516aaefc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166778 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/chart2/qa/extras/chart2export3.cxx b/chart2/qa/extras/chart2export3.cxx index df96a70e8e1f..df70cd603d89 100644 --- a/chart2/qa/extras/chart2export3.cxx +++ b/chart2/qa/extras/chart2export3.cxx @@ -838,9 +838,9 @@ void checkCharacterProps(Reference const & xTitleProp) std::vector aValues = { "This", " is", "3", " a ", "custom", " erte1 ", "2dfgd ch", "ar", "t ", "title" }; for (sal_Int32 i = 0; i < xFormattedSubTitle.getLength(); i++) { -const OUString aText = xFormattedSubTitle.getConstArray()[i]->getString(); +const OUString aText = xFormattedSubTitle[i]->getString(); CPPUNIT_ASSERT_EQUAL(aValues[i], aText); -Reference< beans::XPropertySet > xRunPropSet(xFormattedSubTitle.getConstArray()[i], uno::UNO_QUERY); +Reference< beans::XPropertySet > xRunPropSet(xFormattedSubTitle[i], uno::UNO_QUERY); // common props uno::Any aAny = xRunPropSet->getPropertyValue("CharFontName"); CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Aptos Narrow")), aAny); diff --git a/chart2/qa/unit/common_functor_test.cxx b/chart2/qa/unit/common_functor_test.cxx index b2e404e13508..a744945e6663 100644 --- a/chart2/qa/unit/common_functor_test.cxx +++ b/chart2/qa/unit/common_functor_test.cxx @@ -48,7 +48,7 @@ void CommonFunctorsTest::testAnyToString() std::vector aOutput; std::transform(aInput.begin(), aInput.end(), -std::back_inserter(aOutput), chart::CommonFunctors::AnyToString()); +std::back_inserter(aOutput), chart::CommonFunctors::ToString()); CPPUNIT_ASSERT_EQUAL(OUString("2"), aOutput[0]); CPPUNIT_ASSERT_EQUAL(OUString("10"), aOutput[1]); @@ -65,7 +65,7 @@ void CommonFunctorsTest::testDoubleToString() std::vector aOutput; std::transform(aInput.begin(), aInput.end(), -std::back_inserter(aOutput), chart::CommonFunctors::DoubleToOUString()); +std::back_inserter(aOutput), chart::CommonFunctors::ToString()); CPPUNIT_ASSERT_EQUAL(OUString("2"), aOutput[0]); CPPUNIT_ASSERT_EQUAL(OUString("10"), aOutput[1]); diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index 01771f1e7763..516c2d2ec5f3 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -346,13 +346,11 @@ void DrawCommandDispatch::execute( const OUString& rCommand, const Sequence< bea pDrawViewWrapper->SetCreateMode(); } -const beans::PropertyValue* pIter = rArgs.getConstArray(); -const beans::PropertyValue* pEnd = pIter + rArgs.getLength(); -const beans::PropertyValue* pKeyModifier = std::find_if(pIter, pEnd, +const beans::PropertyValue* pKeyModifier = std::find_if(rArgs.begin(), rArgs.end(), [](const beans::PropertyValue& lhs) {return lhs.Name == "KeyModifier";} ); sal_Int16 nKeyModifier = 0; -if ( !(pKeyModifier != pEnd && ( pKeyModifier->Value >>= nKeyModifier ) && nKeyModifier == KEY_MOD1) ) +if ( !(pKeyModifier != rArgs.end() && ( pKeyModifier->Value >>= nKeyModifier ) && nKeyModifier == KEY_MOD1) ) return; if ( eDrawMode != CHARTDRAW_INSERT ) diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFuncto
core.git: sw/qa xmloff/source
sw/qa/extras/odfexport/data/midnight_redline.fodt | 19 +++ sw/qa/extras/odfexport/odfexport2.cxx | 15 +++ xmloff/source/text/XMLRedlineExport.cxx |4 ++-- 3 files changed, 36 insertions(+), 2 deletions(-) New commits: commit 60f65e63b4b52891c7725a151f3aeedc3a9de4ac Author: Mike Kaganski AuthorDate: Fri Apr 26 19:17:09 2024 +0500 Commit: Mike Kaganski CommitDate: Sat Apr 27 06:21:58 2024 +0200 Fix dc:date export for midnight time Change-Id: I2fc40055e8949348925159a7e10f231a2573950c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166757 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/odfexport/data/midnight_redline.fodt b/sw/qa/extras/odfexport/data/midnight_redline.fodt new file mode 100644 index ..9d75a32f811c --- /dev/null +++ b/sw/qa/extras/odfexport/data/midnight_redline.fodt @@ -0,0 +1,19 @@ + + +http://purl.org/dc/elements/1.1/; xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + + + + + + + John Doe + 2001-01-01T00:00:00 + + + + + Deleted text + + + \ No newline at end of file diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 01016b5b8ad2..d196dc3d 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -1609,6 +1609,21 @@ CPPUNIT_TEST_FIXTURE(Test, testDeletedTableAutostylesExport) loadAndReload("deleted_table.fodt"); } +CPPUNIT_TEST_FIXTURE(Test, testMidnightRedlineDatetime) +{ +// Given a document with a tracked change with a midnight datetime: +// make sure that it succeeds export and import validation. Before the fix, this failed: +// - Error: "2001-01-01" does not satisfy the "dateTime" type +// because "2001-01-01T00:00:00" became "2001-01-01" on roundtrip. +loadAndReload("midnight_redline.fodt"); + +xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); +assertXPathContent(pXmlDoc, + "//office:body/office:text/text:tracked-changes/text:changed-region/" + "text:deletion/office:change-info/dc:date"_ostr, + u"2001-01-01T00:00:00"_ustr); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index 69664f818644..bff3a772779b 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -469,7 +469,7 @@ void XMLRedlineExport::ExportChangeInfo( OUStringBuffer sBuf; ::sax::Converter::convertDateTime(sBuf, bRemovePersonalInfo ? util::DateTime(0, 0, 0, 0, 1, 1, 1970, true) // Epoch time -: aDateTime, nullptr); +: aDateTime, nullptr, true); SvXMLElementExport aDateElem( rExport, XML_NAMESPACE_DC, XML_DATE, true, false ); @@ -521,7 +521,7 @@ void XMLRedlineExport::ExportChangeInfo( OUStringBuffer sBuf; ::sax::Converter::convertDateTime(sBuf, bRemovePersonalInfo ? util::DateTime(0, 0, 0, 0, 1, 1, 1970, true) // Epoch time -: aDateTime, nullptr); +: aDateTime, nullptr, true); SvXMLElementExport aDateElem( rExport, XML_NAMESPACE_DC, XML_DATE, true, false );
core.git: sw/qa sw/source xmloff/source
sw/qa/extras/odfexport/data/deleted_table.fodt | 47 + sw/qa/extras/odfexport/odfexport2.cxx |7 +++ sw/source/filter/xml/xmlfmte.cxx |6 --- xmloff/source/text/txtparae.cxx|3 + 4 files changed, 57 insertions(+), 6 deletions(-) New commits: commit 105ce47a695cb7ea7e6abf879e1c632b7d81f054 Author: Mike Kaganski AuthorDate: Fri Apr 26 16:47:26 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Apr 26 21:19:57 2024 +0200 Make sure that collecting redline autostyles succeeds This step was called separately in SwXMLExport::ExportAutoStyles_, after collectAutoStyles. collectTextAutoStylesAndNodeExportOrder (which is called from collectAutoStyles) sets mbCollected to true, and then all the code checking mbCollected/isAutoStylesCollected stops collecting autostyles. This moves exportTrackedChanges call to the place where all auto- styles are collected. Change-Id: I3f4bd0e0ff906a35b69c052e34adb6d66ef80d48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166735 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sw/qa/extras/odfexport/data/deleted_table.fodt b/sw/qa/extras/odfexport/data/deleted_table.fodt new file mode 100644 index ..830eb278ce18 --- /dev/null +++ b/sw/qa/extras/odfexport/data/deleted_table.fodt @@ -0,0 +1,47 @@ + + +http://openoffice.org/2004/office; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + + + false + + + + + + + + + + + + + + + + + + + + + + + John Doe + 2001-01-01T01:00:00 + + + + + + + + + + Deleted table + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index be3f891b4e81..01016b5b8ad2 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -1602,6 +1602,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTableInFrameAnchoredToPage) assertXPath(pXmlDoc, P + "/style:text-properties", "font-style"_ostr, u"italic"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testDeletedTableAutostylesExport) +{ +// Given a document with deleted table: +// it must not assert on export because of missing format for an exported table +loadAndReload("deleted_table.fodt"); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index d64810724cf8..4a70f2953868 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -263,12 +263,6 @@ void SwXMLExport::ExportAutoStyles_() if( !(getExportFlags() & SvXMLExportFlags::STYLES) ) GetTextParagraphExport()->exportUsedDeclarations(); -// exported in ExportContent_ -if( getExportFlags() & SvXMLExportFlags::CONTENT ) -{ -GetTextParagraphExport()->exportTrackedChanges( true ); -} - GetTextParagraphExport()->exportTextAutoStyles(); GetShapeExport()->exportAutoStyles(); if( getExportFlags() & SvXMLExportFlags::MASTERSTYLES ) diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index df324c16acad..b0671175e547 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1684,6 +1684,9 @@ void XMLTextParagraphExport::collectTextAutoStylesAndNodeExportOrder(bool bIsPro } } +if (GetExport().getExportFlags() & SvXMLExportFlags::CONTENT) +exportTrackedChanges(true); + mbCollected = true; }
core.git: sw/qa
sw/qa/extras/odfexport/odfexport2.cxx | 31 ++- 1 file changed, 14 insertions(+), 17 deletions(-) New commits: commit a00294a6d56ff7f4da8c6ae426eca95d39e38981 Author: Mike Kaganski AuthorDate: Fri Apr 26 10:06:38 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Apr 26 08:16:22 2024 +0200 Simplify a bit Change-Id: Ia724b8dcfbd3e1b3744bbc26e005831d30b5ce38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166691 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 62098deccc08..0da0ca9ac69f 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -1583,26 +1583,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTableInFrameAnchoredToPage) // it must not assert on export because of missing format for an exported table loadAndReload("table_in_frame_to_page.fodt"); +xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); +auto AutoStyleUsedIn = [this, ](const OString& path, const OString& attr) -> OString +{ +const OUString styleName = getXPath(pXmlDoc, path, attr); +return "//office:automatic-styles/style:style[@style:name='" + styleName.toUtf8() + "']"; +}; +constexpr OString xPathTextBox = "//office:body/office:text/draw:frame/draw:text-box"_ostr; + // Check also, that autostyles defined inside that frame are stored correctly. If not, then // these paragraphs would refer to styles in , not in , // without the 'italic' and 'bold' attributes. -xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); -OUString P1 = getXPath( -pXmlDoc, - "//office:body/office:text/draw:frame/draw:text-box/table:table/table:table-row[1]/" -"table:table-cell[1]/text:p"_ostr, -"style-name"_ostr); -assertXPath(pXmlDoc, -"//office:automatic-styles/style:style[@style:name='"_ostr + P1.toUtf8() -+ "']/style:text-properties", -"font-style"_ostr, u"italic"_ustr); -OUString P2 -= getXPath(pXmlDoc, "//office:body/office:text/draw:frame/draw:text-box/text:p"_ostr, - "style-name"_ostr); -assertXPath(pXmlDoc, -"//office:automatic-styles/style:style[@style:name='"_ostr + P2.toUtf8() -+ "']/style:text-properties", -"font-weight"_ostr, u"bold"_ustr); +OString P = AutoStyleUsedIn(xPathTextBox + "/text:p", "style-name"_ostr); +assertXPath(pXmlDoc, P + "/style:text-properties", "font-weight"_ostr, u"bold"_ustr); + +P = AutoStyleUsedIn(xPathTextBox + "/table:table/table:table-row[1]/table:table-cell[1]/text:p", +"style-name"_ostr); +assertXPath(pXmlDoc, P + "/style:text-properties", "font-style"_ostr, u"italic"_ustr); } } // end of anonymous namespace
core.git: drawinglayer/source
drawinglayer/source/processor2d/vclprocessor2d.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 1112a2bea0cb260fd64360b679c3f0f5c495e16e Author: Mike Kaganski AuthorDate: Fri Apr 26 01:00:21 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Apr 26 05:50:27 2024 +0200 tdf#157240: also set font color together with font Commit b008831a5545e5a777d77547ef96b9798d795f30 (tdf#152990 set the font after the MapMode is (potentially) set, 2023-01-14) had moved setting of font forward, but left setting the font color behind. This fixed that. Change-Id: I73fadc7c139da3b6f84b7fc875c585d02fc1c719 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166654 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 0c5f70bb530b..3cfec4af8b8d 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -326,8 +326,6 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( mpOutputDevice->SetLayoutMode(nRTLLayoutMode); } -mpOutputDevice->SetTextColor(Color(aRGBFontColor)); - OUString aText(rTextCandidate.getText()); sal_Int32 nPos = rTextCandidate.getTextPosition(); sal_Int32 nLen = rTextCandidate.getTextLength(); @@ -439,6 +437,7 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( // tdf#152990 set the font after the MapMode is (potentially) set so canvas uses the desired // font size mpOutputDevice->SetFont(aFont); +mpOutputDevice->SetTextColor(Color(aRGBFontColor)); if (!aDXArray.empty()) {
core.git: xmloff/source
xmloff/source/text/txtparae.cxx | 43 1 file changed, 43 deletions(-) New commits: commit e73e117c1309b586f59a4c901aa30117f457727c Author: Mike Kaganski AuthorDate: Fri Apr 26 00:44:45 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Apr 26 05:49:50 2024 +0200 This block seems obsolete now, try to drop it ... and see if something breaks. Unit tests pass. Likely obsoleted by commit 69ed893087f89d176a5ec4b263ce8d75774be72b (tdf#160253: fix list identifier export decision code, 2024-04-24). Change-Id: I4fde19e1047104686df22053c9b140819ea72963 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166651 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 09af34d44648..df324c16acad 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1684,49 +1684,6 @@ void XMLTextParagraphExport::collectTextAutoStylesAndNodeExportOrder(bool bIsPro } } -Reference< XNumberingRulesSupplier > xNumberingRulesSupp( GetExport().GetModel(), UNO_QUERY ); -if ( xNumberingRulesSupp.is() ) -{ -Reference< XIndexAccess > xNumberingRules = xNumberingRulesSupp->getNumberingRules(); -sal_Int32 nCount = xNumberingRules->getCount(); -// Custom outline assignment lost after re-importing sxw (#i73361#) -for( sal_Int32 i = 0; i < nCount; ++i ) -{ -Reference< XIndexReplace > xNumRule( xNumberingRules->getByIndex( i ), UNO_QUERY ); -if( xNumRule.is() && xNumRule->getCount() ) -{ -Reference < XNamed > xNamed( xNumRule, UNO_QUERY ); -OUString sName; -if( xNamed.is() ) -sName = xNamed->getName(); -bool bAdd = sName.isEmpty(); -if( !bAdd ) -{ -Reference < XPropertySet > xNumPropSet( xNumRule, -UNO_QUERY ); -if( xNumPropSet.is() && -xNumPropSet->getPropertySetInfo() - ->hasPropertyByName( "IsAutomatic" ) ) -{ -bAdd = *o3tl::doAccess(xNumPropSet->getPropertyValue( "IsAutomatic" )); -// Check on outline style (#i73361#) -if ( bAdd && - xNumPropSet->getPropertySetInfo() - ->hasPropertyByName( "NumberingIsOutline" ) ) -{ -bAdd = !(*o3tl::doAccess(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); -} -} -else -{ -bAdd = true; -} -} -if( bAdd ) -maListAutoPool.Add( xNumRule ); -} -} -} mbCollected = true; }
core.git: sw/qa xmloff/source
sw/qa/extras/odfexport/data/table_in_frame_to_page.fodt | 66 sw/qa/extras/odfexport/odfexport2.cxx | 28 ++ xmloff/source/text/txtparae.cxx |2 3 files changed, 95 insertions(+), 1 deletion(-) New commits: commit 0568384c5d16748aa58b544dbbd2a18a85a1 Author: Mike Kaganski AuthorDate: Fri Apr 26 00:05:07 2024 +0500 Commit: Mike Kaganski CommitDate: Fri Apr 26 05:49:04 2024 +0200 Make sure to export autostyles from inside frames anchored to page These frames need to export content when collecting autostyles, too. Regression after commit 69ed893087f89d176a5ec4b263ce8d75774be72b (tdf#160253: fix list identifier export decision code, 2024-04-24). Change-Id: If036cab9327e33d32f494fc765bae8e2d685907c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166650 Reviewed-by: Caolán McNamara Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sw/qa/extras/odfexport/data/table_in_frame_to_page.fodt b/sw/qa/extras/odfexport/data/table_in_frame_to_page.fodt new file mode 100644 index ..998f7a08e590 --- /dev/null +++ b/sw/qa/extras/odfexport/data/table_in_frame_to_page.fodt @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 4432d9eb1623..62098deccc08 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -1577,6 +1577,34 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf160253_outline_numbering) // assertXPath(pXmlDoc, "//office:body/office:text/text:list"_ostr, 0); } +CPPUNIT_TEST_FIXTURE(Test, testTableInFrameAnchoredToPage) +{ +// Given a table in a frame anchored to a page: +// it must not assert on export because of missing format for an exported table +loadAndReload("table_in_frame_to_page.fodt"); + +// Check also, that autostyles defined inside that frame are stored correctly. If not, then +// these paragraphs would refer to styles in , not in , +// without the 'italic' and 'bold' attributes. +xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); +OUString P1 = getXPath( +pXmlDoc, + "//office:body/office:text/draw:frame/draw:text-box/table:table/table:table-row[1]/" +"table:table-cell[1]/text:p"_ostr, +"style-name"_ostr); +assertXPath(pXmlDoc, +"//office:automatic-styles/style:style[@style:name='"_ostr + P1.toUtf8() ++ "']/style:text-properties", +"font-style"_ostr, u"italic"_ustr); +OUString P2 += getXPath(pXmlDoc, "//office:body/office:text/draw:frame/draw:text-box/text:p"_ostr, + "style-name"_ostr); +assertXPath(pXmlDoc, +"//office:automatic-styles/style:style[@style:name='"_ostr + P2.toUtf8() ++ "']/style:text-properties", +"font-weight"_ostr, u"bold"_ustr); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 786539812341..09af34d44648 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1631,7 +1631,7 @@ void XMLTextParagraphExport::collectTextAutoStylesAndNodeExportOrder(bool bIsPro return; const bool bAutoStyles = true; -const bool bExportContent = false; +const bool bExportContent = true; if (auto xTextDocument = GetExport().GetModel().query()) {
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 );