core.git: Branch 'distro/collabora/co-23.05' - sc/source
sc/source/filter/excel/xestream.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 1675c3e2f14c68873e63cb725e0dd6e4b70cb3c3 Author: Justin Luth AuthorDate: Thu Apr 18 17:30:06 2024 -0400 Commit: Miklos Vajna CommitDate: Wed Apr 24 09:11:59 2024 +0200 xlsx export: never export short-hand version of range address If all the columns are in focus, LO was exporting A10:XFD11 as 10:11. Amazingly, we can't read that. Seriously? Doesn't Microsoft ever export in shorthand? I thought it would be helpful to find any instances where LO is exporting shorthand, to verify that we really do break import of round-tripped files. I made a brief attempt at fixing the import, but it will require lots of changes and break lots of assumptions. Obviously it can't be a hugely common problem because I didn't find any bug reports about it... I abandoned my attempt because it is too prone to disaster. Change-Id: If59c316d0af466e5cf71ecc459bdf57bb2cd5144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166269 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna (cherry picked from commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166515 Tested-by: Jenkins CollaboraOffice diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index d511c6daebe1..c856eebd5c9c 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -745,7 +745,8 @@ OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRange& rRange, b OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRangeList& rRangeList ) { OUString s; -rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, ' '); +rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, ' ', + /*FullAddressNotation=*/true); return s.toUtf8(); }
core.git: Branch 'distro/collabora/co-24.04' - sc/qa sc/source
sc/qa/unit/data/xlsx/protectedRange.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 11 +++ sc/source/core/tool/rangelst.cxx |4 sc/source/filter/excel/xestream.cxx |3 ++- 4 files changed, 17 insertions(+), 1 deletion(-) New commits: commit 34886ba8843b319e114742f5d42e30d835a85ae0 Author: Justin Luth AuthorDate: Thu Apr 18 17:30:06 2024 -0400 Commit: Miklos Vajna CommitDate: Wed Apr 24 09:11:40 2024 +0200 xlsx export: never export short-hand version of range address If all the columns are in focus, LO was exporting A10:XFD11 as 10:11. Amazingly, we can't read that. Seriously? Doesn't Microsoft ever export in shorthand? I thought it would be helpful to find any instances where LO is exporting shorthand, to verify that we really do break import of round-tripped files. I made a brief attempt at fixing the import, but it will require lots of changes and break lots of assumptions. Obviously it can't be a hugely common problem because I didn't find any bug reports about it... I abandoned my attempt because it is too prone to disaster. Change-Id: If59c316d0af466e5cf71ecc459bdf57bb2cd5144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166269 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna (cherry picked from commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166514 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/data/xlsx/protectedRange.xlsx b/sc/qa/unit/data/xlsx/protectedRange.xlsx new file mode 100644 index ..a185ac3598d0 Binary files /dev/null and b/sc/qa/unit/data/xlsx/protectedRange.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 9f281928c732..c0b17e11aeb8 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1263,6 +1263,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX) "External"); } +CPPUNIT_TEST_FIXTURE(ScExportTest2, testProtectedRange) +{ +createScDoc("xlsx/protectedRange.xlsx"); +save("Calc Office Open XML"); + +xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); +// entire row was being exported as shorthand 'B:B' which LO couldn't read back +assertXPath(pDoc, "//x:protectedRanges/x:protectedRange"_ostr, "sqref"_ostr, "B1:B1048576"); +} + CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332) { createScDoc("xlsx/tdf91332.xlsx"); diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index f84c92c7a7ae..998187b42996 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -133,6 +133,10 @@ void ScRangeList::Format( OUString& rStr, ScRefFlags nFlags, const ScDocument& r formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cDelimiter, bool bFullAddressNotation ) const { +// LO's AddressConverter::parseOoxAddress2d cannot import a short-hand address, +// so definitely do not export that way. +assert(eConv != FormulaGrammar::CONV_XL_OOX || bFullAddressNotation); + if (!cDelimiter) cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index a70e4e08bd71..e4ae036ead48 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -748,7 +748,8 @@ OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRange& rRange, b OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRangeList& rRangeList ) { OUString s; -rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, ' '); +rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, ' ', + /*FullAddressNotation=*/true); return s.toUtf8(); }
core.git: sc/source
sc/source/core/tool/token.cxx | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) New commits: commit 4ed26399e2c9a0d35a1f7e6f19f68a5bb0303109 Author: Justin Luth AuthorDate: Tue Apr 23 13:38:08 2024 -0400 Commit: Justin Luth CommitDate: Tue Apr 23 23:00:56 2024 +0200 NFC ScRawToken::CreateToken: ocPush uses the same function Ever since commit 87307aba9e8dbca16672e6df701d9f905b9e1786 Author: Jens-Heiner Rechtien on Thu Jan 8 10:47:13 2009 + CWS-TOOLING: integrate CWS frmdlg case svSingleRef : if (eOp == ocPush) return new ScSingleRefToken( aRef.Ref1 ); else -return new ScSingleRefOpToken( eOp, aRef.Ref1 ); +return new ScSingleRefToken( aRef.Ref1, eOp ); case svDoubleRef : if (eOp == ocPush) return new ScDoubleRefToken( aRef ); else -return new ScDoubleRefOpToken( eOp, aRef ); +return new ScDoubleRefToken( aRef, eOp ); Instead of using different functions, they now use the same function where optional eOp = ocPush [sc/inc/token.hxx]. Change-Id: I3ee0f308bd983c3edd54fdd064b957b63ca4c0d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166564 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 33e520723213..364913e4fa99 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -370,15 +370,9 @@ FormulaToken* ScRawToken::CreateToken(ScSheetLimits& rLimits) const return new FormulaStringOpToken(eOp, std::move(aSS)); } case svSingleRef : -if (eOp == ocPush) -return new ScSingleRefToken(rLimits, aRef.Ref1 ); -else -return new ScSingleRefToken(rLimits, aRef.Ref1, eOp ); +return new ScSingleRefToken(rLimits, aRef.Ref1, eOp); case svDoubleRef : -if (eOp == ocPush) -return new ScDoubleRefToken(rLimits, aRef ); -else -return new ScDoubleRefToken(rLimits, aRef, eOp ); +return new ScDoubleRefToken(rLimits, aRef, eOp); case svMatrix : IF_NOT_OPCODE_ERROR( ocPush, ScMatrixToken); return new ScMatrixToken( pMat );
core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/protectedRange.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 11 +++ sc/source/core/tool/rangelst.cxx |4 sc/source/filter/excel/xestream.cxx |3 ++- 4 files changed, 17 insertions(+), 1 deletion(-) New commits: commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7 Author: Justin Luth AuthorDate: Thu Apr 18 17:30:06 2024 -0400 Commit: Miklos Vajna CommitDate: Tue Apr 23 08:40:49 2024 +0200 xlsx export: never export short-hand version of range address If all the columns are in focus, LO was exporting A10:XFD11 as 10:11. Amazingly, we can't read that. Seriously? Doesn't Microsoft ever export in shorthand? I thought it would be helpful to find any instances where LO is exporting shorthand, to verify that we really do break import of round-tripped files. I made a brief attempt at fixing the import, but it will require lots of changes and break lots of assumptions. Obviously it can't be a hugely common problem because I didn't find any bug reports about it... I abandoned my attempt because it is too prone to disaster. Change-Id: If59c316d0af466e5cf71ecc459bdf57bb2cd5144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166269 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/data/xlsx/protectedRange.xlsx b/sc/qa/unit/data/xlsx/protectedRange.xlsx new file mode 100644 index ..a185ac3598d0 Binary files /dev/null and b/sc/qa/unit/data/xlsx/protectedRange.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 9f281928c732..c0b17e11aeb8 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1263,6 +1263,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX) "External"); } +CPPUNIT_TEST_FIXTURE(ScExportTest2, testProtectedRange) +{ +createScDoc("xlsx/protectedRange.xlsx"); +save("Calc Office Open XML"); + +xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); +// entire row was being exported as shorthand 'B:B' which LO couldn't read back +assertXPath(pDoc, "//x:protectedRanges/x:protectedRange"_ostr, "sqref"_ostr, "B1:B1048576"); +} + CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332) { createScDoc("xlsx/tdf91332.xlsx"); diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index f84c92c7a7ae..998187b42996 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -133,6 +133,10 @@ void ScRangeList::Format( OUString& rStr, ScRefFlags nFlags, const ScDocument& r formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cDelimiter, bool bFullAddressNotation ) const { +// LO's AddressConverter::parseOoxAddress2d cannot import a short-hand address, +// so definitely do not export that way. +assert(eConv != FormulaGrammar::CONV_XL_OOX || bFullAddressNotation); + if (!cDelimiter) cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 32cecf352de3..c93cf6f5f34d 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -748,7 +748,8 @@ OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRange& rRange, b OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRangeList& rRangeList ) { OUString s; -rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, ' '); +rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, ' ', + /*FullAddressNotation=*/true); return s.toUtf8(); }
core.git: Branch 'libreoffice-24-2' - sc/source
sc/source/filter/excel/excrecds.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit c3bbc3b5c06b743a206a33111c061d4d7d011f21 Author: Justin Luth AuthorDate: Thu Apr 18 14:46:30 2024 -0400 Commit: Miklos Vajna CommitDate: Mon Apr 22 08:38:57 2024 +0200 xlsx export: fix corrupt file for Excel: protectedRange must have sqref Excel refuses to open a file if there is no sqref specified In this case, import failed to import sqref="10:131". A follow-up commit avoids exporting these shorthand ranges. I don't see much point in trying to create a unit test for this. (I assume protectedRange is simply round-tripped because I doubt LO has working support for protectedRanges.) commit 9cee6a45632623d3d7e5a574128940f96d8c926b Author: Eike Rathke on Thu Mar 20 10:16:50 2014 +0100 added ScEnhancedProtection to ScTableProtection Change-Id: I97ef1ee801898bdcace067d62890c4ce0e7cf1d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166265 Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Tested-by: Justin Luth (cherry picked from commit 78bd5e2523d077a67468b752d4788a2c3b43fb5f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166220 Tested-by: Jenkins diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 86afa5a6c163..f18e9f829bbe 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -478,6 +478,9 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->startElement(XML_protectedRanges); for (const auto& rProt : rProts) { +if (!rProt.maRangeList.is()) +continue; // Excel refuses to open if sqref is missing from a protectedRange + SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && !rProt.maSecurityDescriptor.empty(), "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF security descriptor"); rWorksheet->singleElement( XML_protectedRange, @@ -492,7 +495,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) XML_hashValue, sax_fastparser::UseIf(rProt.maPasswordHash.maHashValue, !rProt.maPasswordHash.maHashValue.isEmpty()), XML_saltValue, sax_fastparser::UseIf(rProt.maPasswordHash.maSaltValue, !rProt.maPasswordHash.maSaltValue.isEmpty()), XML_spinCount, sax_fastparser::UseIf(OString::number(rProt.maPasswordHash.mnSpinCount), rProt.maPasswordHash.mnSpinCount != 0), -XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr); +XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr()); } rWorksheet->endElement( XML_protectedRanges); }
core.git: Branch 'distro/collabora/co-23.05' - sc/source
sc/source/filter/excel/excrecds.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 6c82e96e849c4a312feaa6cba21093c48a0d9d46 Author: Justin Luth AuthorDate: Thu Apr 18 14:46:30 2024 -0400 Commit: Miklos Vajna CommitDate: Mon Apr 22 08:39:10 2024 +0200 xlsx export: fix corrupt file for Excel: protectedRange must have sqref Excel refuses to open a file if there is no sqref specified In this case, import failed to import sqref="10:131". I don't see much point in trying to create a unit test for this. (I assume protectedRange is simply round-tripped because I doubt LO has working support for protectedRanges.) commit 9cee6a45632623d3d7e5a574128940f96d8c926b Author: Eike Rathke on Thu Mar 20 10:16:50 2014 +0100 added ScEnhancedProtection to ScTableProtection Change-Id: I97ef1ee801898bdcace067d62890c4ce0e7cf1d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166265 Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Tested-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166344 Tested-by: Jenkins CollaboraOffice diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 3db3d653073c..0dfba784f97c 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -478,6 +478,9 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->startElement(XML_protectedRanges); for (const auto& rProt : rProts) { +if (!rProt.maRangeList.is()) +continue; // Excel refuses to open if sqref is missing from a protectedRange + SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && !rProt.maSecurityDescriptor.empty(), "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF security descriptor"); rWorksheet->singleElement( XML_protectedRange, @@ -492,7 +495,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) XML_hashValue, rProt.maPasswordHash.maHashValue.isEmpty() ? nullptr : rProt.maPasswordHash.maHashValue.toUtf8().getStr(), XML_saltValue, rProt.maPasswordHash.maSaltValue.isEmpty() ? nullptr : rProt.maPasswordHash.maSaltValue.toUtf8().getStr(), XML_spinCount, rProt.maPasswordHash.mnSpinCount ? OString::number( rProt.maPasswordHash.mnSpinCount).getStr() : nullptr, -XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr); +XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr()); } rWorksheet->endElement( XML_protectedRanges); }
core.git: sw/qa sw/source
sw/qa/extras/ooxmlimport/ooxmlimport.cxx |3 ++ sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx | 21 +++ 2 files changed, 24 insertions(+) New commits: commit 00ef339bfc747897b8e4410fa0aa4397c4e45717 Author: Justin Luth AuthorDate: Fri Apr 19 21:57:29 2024 -0400 Commit: Justin Luth CommitDate: Sat Apr 20 19:07:22 2024 +0200 tdf#81956 vml import: put groupshape in foreground if positive z-index no interesting unit tests found, but this one at least lets you add text to the body and visibly see the effect of foreground/background. make CppunitTest_sw_ooxmlimport CPPUNIT_TEST_NAME=testN751077 Change-Id: Ib03e6b429ad4ec6a38d1119f3720bc56a70b98eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166345 Reviewed-by: Justin Luth Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index e9bc24315d6b..7c2800b7aa72 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -175,6 +175,9 @@ xray ThisComponent.DrawPage(1).getByIndex(0).String xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName */ uno::Reference xShapes(getShape(2), uno::UNO_QUERY); +// The groupshape should be in the foreground, not the background. +CPPUNIT_ASSERT(getProperty(xShapes, "Opaque")); + uno::Reference xShape(xShapes->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("TEXT1 "), xShape->getString()); // we want to test the textbox is on the first page (it was put onto another page without the fix), diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index 4fdacfb2f944..6e65750dec1e 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -4696,6 +4696,27 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape } } +uno::Reference xShapePropertySet(xShape, uno::UNO_QUERY); +uno::Sequence aGrabBag; +xShapePropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag; + +for (const auto& rProp : aGrabBag) +{ +if (rProp.Name == "VML-Z-ORDER") +{ +sal_Int64 zOrder(0); +rProp.Value >>= zOrder; + +text::TextContentAnchorType nAnchorType += text::TextContentAnchorType_AT_PARAGRAPH; + xShapePropertySet->getPropertyValue(getPropertyName(PROP_ANCHOR_TYPE)) +>>= nAnchorType; + +const uno::Any aOpaque(nAnchorType == text::TextContentAnchorType_AS_CHARACTER + || (zOrder >= 0 && !IsInHeaderFooter())); + xShapePropertySet->setPropertyValue(getPropertyName(PROP_OPAQUE), aOpaque); +} +} // A GroupShape doesn't implement text::XTextRange, but appending // an empty reference to the stacks still makes sense, because this // way bToRemove can be set, and we won't end up with duplicated
core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |1 + sw/source/core/text/txtfld.cxx |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) New commits: commit 3b7ffa204c6d04640b5e2f4d4c6b6b4a03fd26c8 Author: Justin Luth AuthorDate: Thu Apr 18 04:00:05 2024 -0400 Commit: Justin Luth CommitDate: Sat Apr 20 00:18:17 2024 +0200 tdf#140616 ApplyParagraphMarkFormatToNumbering: including highlight I was concerned that I might override highlights set in numbering.xml but in that case pFormat && pFormat->hasItem(RES_CHRATR_HIGHLIGHT) so pCleanSet no longer hasItem. (see num3n.docx and TestDoc_highlight2.docx) Note: must use Word 2010+ to see numbering.xml highlights!! This is strictly a visual thing. Unit testing has traditionally used magic tile rendering x,y positions to check the color, which seems completely untrustworthy. Change-Id: I026252f127107e4782d08f72bfd5e2a412142111 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166303 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 6528b093fd57..ba70a335ca09 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -965,6 +965,7 @@ CPPUNIT_TEST_FIXTURE(Test, testHighlightEdit_numbering) xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); assertXPath(pXmlStyles, "//w:style[@w:styleId='CustomParaStyleHighlightGreen']/w:rPr/w:highlight"_ostr, "val"_ostr, "green"); +// Visually, the last bullet point's text should be green-highlighted (but the bullet point itself shouldn't) if (bWasExportToShade) { diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 84f32e30971f..55e439096f3d 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -409,7 +409,7 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm if (oFontBackColor) pNumFnt->SetBackColor(oFontBackColor); -if (aHighlight != COL_TRANSPARENT) +if (aHighlight != COL_TRANSPARENT && !pCleanedSet->HasItem(RES_CHRATR_HIGHLIGHT)) pNumFnt->SetHighlightColor(aHighlight); }
core.git: sc/source
sc/source/filter/excel/excrecds.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 78bd5e2523d077a67468b752d4788a2c3b43fb5f Author: Justin Luth AuthorDate: Thu Apr 18 14:46:30 2024 -0400 Commit: Miklos Vajna CommitDate: Fri Apr 19 14:21:13 2024 +0200 xlsx export: fix corrupt file for Excel: protectedRange must have sqref Excel refuses to open a file if there is no sqref specified In this case, import failed to import sqref="10:131". A follow-up commit avoids exporting these shorthand ranges. I don't see much point in trying to create a unit test for this. (I assume protectedRange is simply round-tripped because I doubt LO has working support for protectedRanges.) commit 9cee6a45632623d3d7e5a574128940f96d8c926b Author: Eike Rathke on Thu Mar 20 10:16:50 2014 +0100 added ScEnhancedProtection to ScTableProtection Change-Id: I97ef1ee801898bdcace067d62890c4ce0e7cf1d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166265 Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Tested-by: Justin Luth diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 86afa5a6c163..f18e9f829bbe 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -478,6 +478,9 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->startElement(XML_protectedRanges); for (const auto& rProt : rProts) { +if (!rProt.maRangeList.is()) +continue; // Excel refuses to open if sqref is missing from a protectedRange + SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && !rProt.maSecurityDescriptor.empty(), "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF security descriptor"); rWorksheet->singleElement( XML_protectedRange, @@ -492,7 +495,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) XML_hashValue, sax_fastparser::UseIf(rProt.maPasswordHash.maHashValue, !rProt.maPasswordHash.maHashValue.isEmpty()), XML_saltValue, sax_fastparser::UseIf(rProt.maPasswordHash.maSaltValue, !rProt.maPasswordHash.maSaltValue.isEmpty()), XML_spinCount, sax_fastparser::UseIf(OString::number(rProt.maPasswordHash.mnSpinCount), rProt.maPasswordHash.mnSpinCount != 0), -XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr); +XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr()); } rWorksheet->endElement( XML_protectedRanges); }
core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |3 +++ sw/source/writerfilter/ooxml/model.xml | 11 ++- 2 files changed, 13 insertions(+), 1 deletion(-) New commits: commit 4a120f4f557b99bb8371474a4e7fdaf52b148143 Author: Justin Luth AuthorDate: Wed Apr 17 16:11:56 2024 -0400 Commit: Miklos Vajna CommitDate: Fri Apr 19 14:20:58 2024 +0200 tdf#140616 writerfilter: recognize style rPr under pPr Although it is completely NOT normal to put any rPr's in the style's pPr (since they normally just go into a stand-alone rPr), MSO is able to read and apply those - while LO just ignored them (as misplaced properties). It seems harmless to me to import it this way as well. make CppunitTest_sw_ooxmlexport14 \ CPPUNIT_TEST_NAME=testHighlightEdit_numbering Change-Id: Ie4a6c4c91a8214f40e34dc58c47b0bb9381bac1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166189 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index c33275b62394..6528b093fd57 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -963,6 +963,9 @@ CPPUNIT_TEST_FIXTURE(Test, testHighlightEdit_numbering) assertXPath(pXmlDoc, "//w:body/w:p[2]/w:pPr/w:rPr/w:highlight"_ostr, "val"_ostr, "none"); // Visually, the "none" highlight means the bullet point should not have a character background. +xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); +assertXPath(pXmlStyles, "//w:style[@w:styleId='CustomParaStyleHighlightGreen']/w:rPr/w:highlight"_ostr, "val"_ostr, "green"); + if (bWasExportToShade) { officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(false, batch); diff --git a/sw/source/writerfilter/ooxml/model.xml b/sw/source/writerfilter/ooxml/model.xml index 2f84e72c0615..c99eb836ffe6 100644 --- a/sw/source/writerfilter/ooxml/model.xml +++ b/sw/source/writerfilter/ooxml/model.xml @@ -12620,6 +12620,12 @@ + + + + + + @@ -16226,7 +16232,7 @@ - + @@ -17739,6 +17745,9 @@ + + +
core.git: sc/uiconfig
sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui |3 +++ 1 file changed, 3 insertions(+) New commits: commit 7b515b473cfb706c9fa0b474f27d61351aeec3a3 Author: Justin Luth AuthorDate: Wed Apr 10 12:45:20 2024 -0400 Commit: Justin Luth CommitDate: Wed Apr 10 23:13:13 2024 +0200 tdf#160293 sc NBB: tabbed groupbar_compact keep tabs in Pivot context The VBox was hidding each child item since none had Pivot or any as context types. This didn't affect any other NBB variants because they hadn't wrapped the tabs in a ContextVBox. Using context-any would be bad for PrintPreview for example. Change-Id: I47c4c9c813c17dde5440ae6dbadb8d1ab066d293 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165956 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui b/sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui index e577579264c0..4e35ae8f780a 100644 --- a/sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui +++ b/sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui @@ -4904,6 +4904,9 @@ + + +
core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/core/layout/paintfrm.cxx | 22 ++ 1 file changed, 22 insertions(+) New commits: commit f53df0c693d8e73e86ddd986e5b861a0af28e62b Author: Justin Luth AuthorDate: Mon Mar 25 16:01:44 2024 -0400 Commit: Miklos Vajna CommitDate: Tue Apr 2 09:08:25 2024 +0200 tdf#131253 sw: draw frame text boundary only if show formatting marks This squashed backport includes c51f9f15b8c308e62b4839cc13d623fdab0486c2 It is infuriating to see a border around your image when there is no border defined. View - Text boundaries does NOT sound like something that would apply to images, and it is NOT nice to turn that off because then you also lose the body text markers as well as the header/footer indicators. Instead, do the same thing as the page boundaries - only show the (full) boundary when show formatting marks is turned on (and there are no partial boundaries for frames...) These text boundaries around AT-anchored flies only became visible in LO 6.0. Change-Id: I7954effc46d977e1761cba71758f7a7af2072807 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165294 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165428 Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 92d8f087ec36..5ca89df04ba8 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7331,6 +7331,28 @@ void SwLayoutFrame::PaintSubsidiaryLines( const SwPageFrame *pPage, const bool bFlys = pPage->GetSortedObjs() != nullptr; const bool bCell = IsCellFrame(); + +if (!bCell && IsFlyFrame()) +{ +// particularly with images (but also plausible for any kind of frame), +// it is very disconcerting to see a fake border, +// so (just like the page boundary) only show fly "text boundaries" +// when "Show Formatting Marks" is turned on +if (!gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars()) +return; + +// if the frame is wrap none or wrap through, then text boundary lines have no meaning +// (unless the frame itself contains text) +const text::WrapTextMode aSurround = GetFormat()->GetSurround().GetSurround(); +if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR +&& (!Lower() || !Lower()->IsTextFrame()) +&& (aSurround == text::WrapTextMode::WrapTextMode_THROUGH +|| aSurround == text::WrapTextMode::WrapTextMode_NONE)) +{ +return; +} +} + // #i3662# - use frame area for cells for section use also frame area const bool bUseFrameArea = bCell || IsSctFrame(); SwRect aOriginal( bUseFrameArea ? getFrameArea() : getFramePrintArea() );
core.git: Branch 'distro/collabora/co-24.04' - sw/source
sw/source/core/layout/paintfrm.cxx | 22 ++ 1 file changed, 22 insertions(+) New commits: commit a1214585c7cb849c7d47591ec6bc0d68ea9a7ba8 Author: Justin Luth AuthorDate: Mon Mar 25 16:01:44 2024 -0400 Commit: Miklos Vajna CommitDate: Tue Apr 2 09:07:57 2024 +0200 tdf#131253 sw: draw frame text boundary only if show formatting marks This squashed backport includes c51f9f15b8c308e62b4839cc13d623fdab0486c2 It is infuriating to see a border around your image when there is no border defined. View - Text boundaries does NOT sound like something that would apply to images, and it is NOT nice to turn that off because then you also lose the body text markers as well as the header/footer indicators. Instead, do the same thing as the page boundaries - only show the (full) boundary when show formatting marks is turned on (and there are no partial boundaries for frames...) These text boundaries around AT-anchored flies only became visible in LO 6.0. Change-Id: I7954effc46d977e1761cba71758f7a7af2072807 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165294 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165463 Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 46c9189f0dfd..ff5abcfcf898 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7488,6 +7488,28 @@ void SwLayoutFrame::PaintSubsidiaryLines( const SwPageFrame *pPage, const bool bFlys = pPage->GetSortedObjs() != nullptr; const bool bCell = IsCellFrame(); + +if (!bCell && IsFlyFrame()) +{ +// particularly with images (but also plausible for any kind of frame), +// it is very disconcerting to see a fake border, +// so (just like the page boundary) only show fly "text boundaries" +// when "Show Formatting Marks" is turned on +if (!gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars()) +return; + +// if the frame is wrap none or wrap through, then text boundary lines have no meaning +// (unless the frame itself contains text) +const text::WrapTextMode aSurround = GetFormat()->GetSurround().GetSurround(); +if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR +&& (!Lower() || !Lower()->IsTextFrame()) +&& (aSurround == text::WrapTextMode::WrapTextMode_THROUGH +|| aSurround == text::WrapTextMode::WrapTextMode_NONE)) +{ +return; +} +} + // #i3662# - use frame area for cells for section use also frame area const bool bUseFrameArea = bCell || IsSctFrame(); SwRect aOriginal( bUseFrameArea ? getFrameArea() : getFramePrintArea() );
core.git: Branch 'distro/mimo/mimo-7-3' - 2 commits - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt |binary sw/qa/extras/uiwriter/uiwriter4.cxx | 38 +++ sw/source/core/crsr/findtxt.cxx | 86 ++-- 3 files changed, 92 insertions(+), 32 deletions(-) New commits: commit 7a7df4c0ea28e460ac6781d54f7da95a19355dde Author: Justin Luth AuthorDate: Tue Mar 19 15:28:32 2024 -0400 Commit: Aron Budea CommitDate: Thu Mar 28 22:46:56 2024 +1030 related tdf#147583 sw find: fix backwards search for string at end of para Prior to this fix, it was finding every single character in the document when searching for ".$". Interestingly, the unit test worked even before the patch. Not sure how that could be possible... make CppunitTest_sw_uiwriter7 \ CPPUNIT_TEST_NAME=testTdf147583_backwardSearch Change-Id: I20779898c01736eb39ecd7db7d66c2c24e4358b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165037 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Mike Kaganski Reviewed-by: Miklos Vajna (cherry picked from commit e830394c068c229bb840018f2f0e8810da6a1487) (cherry picked from commit 5a78a44c486a2a49532d32a8ef53b2f2b4833ffe) diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index e9e6eb2bd148..7c2a2f930a09 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -4193,6 +4193,11 @@ void SwUiWriterTest4::testTdf147583_backwardSearch() xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); // should actually be 10 (including the empty para with the comment marker, and the last para) CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount()); + +xSearchDes->setSearchString(".$"); // any last character (not just full-stops) in a paragraph +xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); +// should be one for every non-empty paragraph +CPPUNIT_ASSERT_EQUAL(sal_Int32(14), xIndex->getCount()); } CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest4); diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 1f2d130f7147..06f72ea06306 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -734,6 +734,25 @@ bool DoSearch(SwPaM & rSearchPam, SwTextNode const*const pNode, SwTextFrame const*const pFrame, SwRootFrame const*const pLayout, SwPaM* pPam) { +if (bRegSearch && rSearchOpt.searchString.endsWith("$")) +{ +bool bAlwaysSearchingForEndOfPara = true; +sal_Int32 nIndex = 0; +while ((nIndex = rSearchOpt.searchString.indexOf("|", nIndex)) != -1) +{ +if (!nIndex || rSearchOpt.searchString[nIndex - 1] != '$') +{ +bAlwaysSearchingForEndOfPara = false; +break; +} +++nIndex; +} +// when searching for something at the end of the paragraph, the para end must be in range +const AmbiguousIndex& rParaEnd = bSrchForward ? nEnd : nStart; +if (bAlwaysSearchingForEndOfPara && nTextLen.GetAnyIndex() != rParaEnd.GetAnyIndex()) +return false; +} + bool bFound = false; OUString sCleanStr; std::vector aFltArr; commit d8ff9e1e259f7b11940f76d1055bce3dd44f0844 Author: Justin Luth AuthorDate: Fri Mar 15 20:01:39 2024 -0400 Commit: Aron Budea CommitDate: Thu Mar 28 22:33:03 2024 +1030 tdf#147583 sw find: fix backwards search for emptyPara/endOfPara A comment added 10 years ago thought that it had never worked. The very last paragraph end cannot be selected manually, and so of course it can't work in find either. It didn't work earlier either. Everything goes ballistic if searching inside comments, but that would be handled elsewhere anyway I guess. It didn't work earlier either. Keeping the search "inside the selection" didn't work earlier either. That should be fixed now. make CppunitTest_sw_uiwriter7 \ CPPUNIT_TEST_NAME=testTdf147583_backwardSearch Change-Id: I48a72084d277b8c270255de9296a2743162937cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164892 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164982 Tested-by: Jenkins CollaboraOffice (cherry picked from commit 2f5b9916baaf0017ece84bf867a9e9acfe86d61a) (cherry picked from commit 098a2536d08a18981032273b55e287bd231dc58e) diff --git a/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt new file mode 100644 index ..9bfde3bfaa6b Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index
core.git: sw/source
sw/source/core/layout/paintfrm.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit c51f9f15b8c308e62b4839cc13d623fdab0486c2 Author: Justin Luth AuthorDate: Wed Mar 27 09:50:36 2024 -0400 Commit: Justin Luth CommitDate: Wed Mar 27 18:49:09 2024 +0100 tdf#131253 sw: draw frame text boundary if fly has textframe While the text boundary on a wrap-through frame will not need text boundary markers for the external text, it does have relevance for the internal text. Change-Id: Ica91dc42333a69cfecd10a72a1188d77d1dd4ed7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165395 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 6903e80b1f46..8479436a88c8 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7491,8 +7491,10 @@ void SwLayoutFrame::PaintSubsidiaryLines( const SwPageFrame *pPage, return; // if the frame is wrap none or wrap through, then text boundary lines have no meaning +// (unless the frame itself contains text) const text::WrapTextMode aSurround = GetFormat()->GetSurround().GetSurround(); if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR +&& (!Lower() || !Lower()->IsTextFrame()) && (aSurround == text::WrapTextMode::WrapTextMode_THROUGH || aSurround == text::WrapTextMode::WrapTextMode_NONE)) {
core.git: Branch 'libreoffice-7-6' - sw/source
sw/source/core/layout/paintfrm.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 576398b0493eb642af5221605dcc28ca7656630e Author: Justin Luth AuthorDate: Mon Mar 25 19:20:32 2024 -0400 Commit: Rafael Lima CommitDate: Tue Mar 26 19:53:24 2024 +0100 tdf#129905 tdf#160365 sw: don't always draw text boundary on frames This fixes a 7.6 regression caused by commit 79811c27f34d3e752de1bc3959605c5d58ac2365 tdf#129905 Create toggle for Section boundaries This fixes the toggle for View - Text boundaries, so now images can have their thin gray border removed. This also fixes the toggle for View - Table boundaries. Change-Id: Idb75debf173d64b14a6864c61b4524e46898975f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165297 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Rafael Lima Reviewed-by: Miklos Vajna (cherry picked from commit 47af9e64a573684eb42faa097e327e31777a2b58) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165311 (cherry picked from commit 948a5fb3ffb02e43f228a6adb85a37129a57692b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165315 diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index a23d86d1181c..8820fa3a5d19 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7011,7 +7011,8 @@ void SwPageFrame::RefreshSubsidiary( const SwRect ) const void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage, const SwRect ) const { -const bool bSubsOpt = isSubsidiaryLinesEnabled() || isSubsidiaryLinesForSectionsEnabled(); +const bool bSubsOpt += isSubsidiaryLinesEnabled() || (IsSctFrame() && isSubsidiaryLinesForSectionsEnabled()); if ( bSubsOpt ) PaintSubsidiaryLines( pPage, rRect );
core.git: Branch 'libreoffice-24-2' - sw/source
sw/source/core/layout/paintfrm.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 09b3dd1cb0c1741cf3560fc9faf2aec696d5c9a2 Author: Justin Luth AuthorDate: Mon Mar 25 19:20:32 2024 -0400 Commit: Rafael Lima CommitDate: Tue Mar 26 17:08:05 2024 +0100 tdf#129905 tdf#160365 sw: don't always draw text boundary on frames This fixes a 7.6 regression caused by commit 79811c27f34d3e752de1bc3959605c5d58ac2365 tdf#129905 Create toggle for Section boundaries This fixes the toggle for View - Text boundaries, so now images can have their thin gray border removed. This also fixes the toggle for View - Table boundaries. Change-Id: Idb75debf173d64b14a6864c61b4524e46898975f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165297 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Rafael Lima Reviewed-by: Miklos Vajna (cherry picked from commit 47af9e64a573684eb42faa097e327e31777a2b58) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165311 diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 0f048c4e805d..5472695e9732 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7012,7 +7012,8 @@ void SwPageFrame::RefreshSubsidiary( const SwRect ) const void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage, const SwRect ) const { -const bool bSubsOpt = isSubsidiaryLinesEnabled() || isSubsidiaryLinesForSectionsEnabled(); +const bool bSubsOpt += isSubsidiaryLinesEnabled() || (IsSctFrame() && isSubsidiaryLinesForSectionsEnabled()); if ( bSubsOpt ) PaintSubsidiaryLines( pPage, rRect );
core.git: sw/source
sw/source/core/layout/paintfrm.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 47af9e64a573684eb42faa097e327e31777a2b58 Author: Justin Luth AuthorDate: Mon Mar 25 19:20:32 2024 -0400 Commit: Miklos Vajna CommitDate: Tue Mar 26 13:32:49 2024 +0100 tdf#129905 tdf#160365 sw: don't always draw text boundary on frames This fixes a 7.6 regression caused by commit 79811c27f34d3e752de1bc3959605c5d58ac2365 tdf#129905 Create toggle for Section boundaries This fixes the toggle for View - Text boundaries, so now images can have their thin gray border removed. This also fixes the toggle for View - Table boundaries. Change-Id: Idb75debf173d64b14a6864c61b4524e46898975f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165297 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Rafael Lima Reviewed-by: Miklos Vajna diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 9a0776631f01..6903e80b1f46 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7004,7 +7004,8 @@ void SwPageFrame::RefreshSubsidiary( const SwRect ) const void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage, const SwRect ) const { -const bool bSubsOpt = isSubsidiaryLinesEnabled() || isSubsidiaryLinesForSectionsEnabled(); +const bool bSubsOpt += isSubsidiaryLinesEnabled() || (IsSctFrame() && isSubsidiaryLinesForSectionsEnabled()); if ( bSubsOpt ) PaintSubsidiaryLines( pPage, rRect );
core.git: sw/source
sw/source/core/layout/paintfrm.cxx | 20 1 file changed, 20 insertions(+) New commits: commit 5bf7df62645f73ad69772f318ea3058dfd6fce12 Author: Justin Luth AuthorDate: Mon Mar 25 16:01:44 2024 -0400 Commit: Miklos Vajna CommitDate: Tue Mar 26 13:29:13 2024 +0100 tdf#131253 sw: draw frame text boundary on when show formatting marks It is infuriating to see a border around your image when there is no border defined. View - Text boundaries does NOT sound like something that would apply to images, and it is NOT nice to turn that off because then you also lose the body text markers as well as the header/footer indicators. Instead, do the same thing as the page boundaries - only show the (full) boundary when show formatting marks is turned on (and there are no partial boundaries for frames...) I tried to write a GDIMetaFile unit test, but the dumps were identical - failing to capture this screen artifact. Change-Id: I7954effc46d977e1761cba71758f7a7af2072807 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165294 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 042c4f3be4a7..9a0776631f01 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -7479,6 +7479,26 @@ void SwLayoutFrame::PaintSubsidiaryLines( const SwPageFrame *pPage, const bool bFlys = pPage->GetSortedObjs() != nullptr; const bool bCell = IsCellFrame(); + +if (!bCell && IsFlyFrame()) +{ +// particularly with images (but also plausible for any kind of frame), +// it is very disconcerting to see a fake border, +// so (just like the page boundary) only show fly "text boundaries" +// when "Show Formatting Marks" is turned on +if (!gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars()) +return; + +// if the frame is wrap none or wrap through, then text boundary lines have no meaning +const text::WrapTextMode aSurround = GetFormat()->GetSurround().GetSurround(); +if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR +&& (aSurround == text::WrapTextMode::WrapTextMode_THROUGH +|| aSurround == text::WrapTextMode::WrapTextMode_NONE)) +{ +return; +} +} + // #i3662# - use frame area for cells for section use also frame area const bool bUseFrameArea = bCell || IsSctFrame(); SwRect aOriginal( bUseFrameArea ? getFrameArea() : getFramePrintArea() );
core.git: Branch 'distro/mimo/mimo-7-5' - 2 commits - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt |binary sw/qa/extras/uiwriter/uiwriter7.cxx | 36 ++ sw/source/core/crsr/findtxt.cxx | 86 ++-- 3 files changed, 90 insertions(+), 32 deletions(-) New commits: commit 5a78a44c486a2a49532d32a8ef53b2f2b4833ffe Author: Justin Luth AuthorDate: Tue Mar 19 15:28:32 2024 -0400 Commit: Aron Budea CommitDate: Tue Mar 26 17:36:03 2024 +1030 related tdf#147583 sw find: fix backwards search for string at end of para Prior to this fix, it was finding every single character in the document when searching for ".$". Interestingly, the unit test worked even before the patch. Not sure how that could be possible... make CppunitTest_sw_uiwriter7 \ CPPUNIT_TEST_NAME=testTdf147583_backwardSearch Change-Id: I20779898c01736eb39ecd7db7d66c2c24e4358b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165037 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Mike Kaganski Reviewed-by: Miklos Vajna (cherry picked from commit e830394c068c229bb840018f2f0e8810da6a1487) diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index dbae48e33798..127c78a1d583 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -386,6 +386,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf147583_backwardSearch) xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); // should actually be 10 (including the empty para with the comment marker, and the last para) CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount()); + +xSearchDes->setSearchString(".$"); // any last character (not just full-stops) in a paragraph +xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); +// should be one for every non-empty paragraph +CPPUNIT_ASSERT_EQUAL(sal_Int32(14), xIndex->getCount()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282) diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index e87e4d6ff5c1..6b6cec3268d2 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -729,6 +729,25 @@ bool DoSearch(SwPaM & rSearchPam, SwTextNode const*const pNode, SwTextFrame const*const pFrame, SwRootFrame const*const pLayout, SwPaM* pPam) { +if (bRegSearch && rSearchOpt.searchString.endsWith("$")) +{ +bool bAlwaysSearchingForEndOfPara = true; +sal_Int32 nIndex = 0; +while ((nIndex = rSearchOpt.searchString.indexOf("|", nIndex)) != -1) +{ +if (!nIndex || rSearchOpt.searchString[nIndex - 1] != '$') +{ +bAlwaysSearchingForEndOfPara = false; +break; +} +++nIndex; +} +// when searching for something at the end of the paragraph, the para end must be in range +const AmbiguousIndex& rParaEnd = bSrchForward ? nEnd : nStart; +if (bAlwaysSearchingForEndOfPara && nTextLen.GetAnyIndex() != rParaEnd.GetAnyIndex()) +return false; +} + bool bFound = false; OUString sCleanStr; std::vector aFltArr; commit 098a2536d08a18981032273b55e287bd231dc58e Author: Justin Luth AuthorDate: Fri Mar 15 20:01:39 2024 -0400 Commit: Aron Budea CommitDate: Tue Mar 26 17:15:32 2024 +1030 tdf#147583 sw find: fix backwards search for emptyPara/endOfPara A comment added 10 years ago thought that it had never worked. The very last paragraph end cannot be selected manually, and so of course it can't work in find either. It didn't work earlier either. Everything goes ballistic if searching inside comments, but that would be handled elsewhere anyway I guess. It didn't work earlier either. Keeping the search "inside the selection" didn't work earlier either. That should be fixed now. make CppunitTest_sw_uiwriter7 \ CPPUNIT_TEST_NAME=testTdf147583_backwardSearch Change-Id: I48a72084d277b8c270255de9296a2743162937cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164892 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164982 Tested-by: Jenkins CollaboraOffice (cherry picked from commit 2f5b9916baaf0017ece84bf867a9e9acfe86d61a) diff --git a/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt new file mode 100644 index ..9bfde3bfaa6b Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index 92b6732f2778..dbae48e33798 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -357,6
core.git: sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter7.cxx |5 + sw/source/core/crsr/findtxt.cxx | 19 +++ 2 files changed, 24 insertions(+) New commits: commit e830394c068c229bb840018f2f0e8810da6a1487 Author: Justin Luth AuthorDate: Tue Mar 19 15:28:32 2024 -0400 Commit: Miklos Vajna CommitDate: Thu Mar 21 10:59:23 2024 +0100 related tdf#147583 sw find: fix backwards search for string at end of para Prior to this fix, it was finding every single character in the document when searching for ".$". Interestingly, the unit test worked even before the patch. Not sure how that could be possible... make CppunitTest_sw_uiwriter7 \ CPPUNIT_TEST_NAME=testTdf147583_backwardSearch Change-Id: I20779898c01736eb39ecd7db7d66c2c24e4358b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165037 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Mike Kaganski Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index bf9a4ee1bd1c..dda894b7fda5 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -386,6 +386,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf147583_backwardSearch) xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); // should actually be 10 (including the empty para with the comment marker, and the last para) CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount()); + +xSearchDes->setSearchString(".$"); // any last character (not just full-stops) in a paragraph +xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); +// should be one for every non-empty paragraph +CPPUNIT_ASSERT_EQUAL(sal_Int32(14), xIndex->getCount()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282) diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 930ac7926ce2..34d16d2a91b9 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -726,6 +726,25 @@ bool DoSearch(SwPaM & rSearchPam, SwTextNode const*const pNode, SwTextFrame const*const pFrame, SwRootFrame const*const pLayout, SwPaM& rPam) { +if (bRegSearch && rSearchOpt.searchString.endsWith("$")) +{ +bool bAlwaysSearchingForEndOfPara = true; +sal_Int32 nIndex = 0; +while ((nIndex = rSearchOpt.searchString.indexOf("|", nIndex)) != -1) +{ +if (!nIndex || rSearchOpt.searchString[nIndex - 1] != '$') +{ +bAlwaysSearchingForEndOfPara = false; +break; +} +++nIndex; +} +// when searching for something at the end of the paragraph, the para end must be in range +const AmbiguousIndex& rParaEnd = bSrchForward ? nEnd : nStart; +if (bAlwaysSearchingForEndOfPara && nTextLen.GetAnyIndex() != rParaEnd.GetAnyIndex()) +return false; +} + bool bFound = false; OUString sCleanStr; std::vector aFltArr;
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx |binary sw/qa/extras/uiwriter/uiwriter9.cxx | 43 ++ sw/source/core/doc/docnum.cxx | 11 +- sw/source/uibase/shells/txtnum.cxx|1 sw/source/uibase/wrtsh/wrtsh1.cxx | 31 --- 5 files changed, 52 insertions(+), 34 deletions(-) New commits: commit 5956bb9937164a815bccadd4801dee63c28367f5 Author: Justin Luth AuthorDate: Mon Mar 18 16:56:55 2024 -0400 Commit: Miklos Vajna CommitDate: Thu Mar 21 10:54:23 2024 +0100 tdf#159054 sw: fix .uno:DefaultNumber toggle on Heading numbering This fixes a 7.2 regression from commit c456f839a597f537f1c59becd7d0bb6c86248ef8 Author: Anshu on Wed Jan 6 15:04:16 2021 +0530 tdf#115965 tdf#92622 NoList default in menu,tool,sidebar The current implementation would set the number format to SVX_NUM_NUMBER_NONE, but it still looks like a number to the toolbar, so toggling didn't work since 7.4's bcede3c0ed94d4 It also never cleared out the prefix/suffix when toggled off, and it affected ALL paragraphs using that outline numbering style. Remove numbering was doing the same kind of thing. I think the toggle was trying to follow the drop-down behaviour of modifying the outline numbering style itself. While I think the drop-down handling could be considered appropriate, using the toggle to pseudo-disable the entire style just seems wrong. This patch kills that, and in addition automatically gains all the nice undo/redo functionality. This is one tiny step in making outline numbering go away. make CppunitTest_sw_uiwriter9 \ CPPUNIT_TEST_NAME=testTdf159054_disableOutlineNumbering Change-Id: Id6a24ac25479cb8f35bf1c2c58344390ed7512fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164985 Reviewed-by: Justin Luth Tested-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165076 Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx new file mode 100644 index ..091a3830e75b Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 3772955dd9c1..96ea65e988d9 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -200,6 +200,49 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816) xTransfer->PrivateDrop(*pWrtShell, ptTo, /*bMove=*/true, /*bXSelection=*/true); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159054_disableOutlineNumbering) +{ +createSwDoc("tdf159054_disableOutlineNumbering.docx"); +SwDoc* pDoc = getSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +const uno::Reference xPara1 = getParagraph(1, "Heading A"); +const uno::Reference xPara2 = getParagraph(2, "Heading B"); +const uno::Reference xPara3 = getParagraph(3, "Heading C"); + +CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara1, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("B."), getProperty(xPara2, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("C."), getProperty(xPara3, "ListLabelString")); + +// select (at least parts) of the first two paragraphs +pWrtShell->Down(/*bSelect=*/true, /*nCount=*/1, /*bBasicCall=*/true); + +// on the selection, simulate pressing the toolbar button to toggle OFF numbering +dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); + +// the selected paragraphs should definitely have the list label removed +CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara1, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara2, "ListLabelString")); +// the third paragraph must retain the existing numbering format +CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara3, "ListLabelString")); + +// on the selection, simulate pressing the toolbar button to toggle ON numbering again +dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); + +// the outline numbering format must be re-applied to the first two paragraphs +CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara1, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("B."), getProperty(xPara2, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("C."), getProperty(xPara3, "ListLabelString")); + +// on the selection, simulate a right click - list - No list +dispatchCommand(mxComponent, ".uno:RemoveBullets", {}); + +// the selected paragraphs should definitely have the list label removed +
core.git: sw/qa sw/source
sw/qa/extras/uiwriter/uiwriter9.cxx | 26 -- sw/source/core/doc/docnum.cxx | 11 --- sw/source/uibase/shells/txtnum.cxx |1 - sw/source/uibase/wrtsh/wrtsh1.cxx | 31 +-- 4 files changed, 25 insertions(+), 44 deletions(-) New commits: commit 91e5d1ef52964dc43875ed62acd766524fa7cc5c Author: Justin Luth AuthorDate: Tue Mar 19 09:22:34 2024 -0400 Commit: Miklos Vajna CommitDate: Wed Mar 20 16:20:14 2024 +0100 tdf#159054 sw: fix .uno:DefaultNumber toggle on Heading numbering This fixes a 7.2 regression from commit c456f839a597f537f1c59becd7d0bb6c86248ef8 Author: Anshu on Wed Jan 6 15:04:16 2021 +0530 tdf#115965 tdf#92622 NoList default in menu,tool,sidebar The current implementation would set the number format to SVX_NUM_NUMBER_NONE, but it still looks like a number to the toolbar, so toggling didn't work since 7.4's bcede3c0ed94d4 It also never cleared out the prefix/suffix when toggled off, and it affected ALL paragraphs using that outline numbering style. Remove numbering was doing the same kind of thing. I think the toggle was trying to follow the drop-down behaviour of modifying the outline numbering style itself. While I think the drop-down handling could be considered appropriate, using the toggle to pseudo-disable the entire style just seems wrong. This patch kills that, and in addition automatically gains all the nice undo/redo functionality. This is one tiny step in making outline numbering go away. make CppunitTest_sw_uiwriter9 \ CPPUNIT_TEST_NAME=testTdf159054_disableOutlineNumbering Change-Id: Id6a24ac25479cb8f35bf1c2c58344390ed7512fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164985 Reviewed-by: Justin Luth Tested-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index a18f14c9ad9a..f46d43e537b6 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -429,20 +429,26 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159054_disableOutlineNumbering) dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); // the selected paragraphs should definitely have the list label removed -CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara1, "ListLabelString")); -CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara2, "ListLabelString")); -// current implementation: the numbering style itself is changed too - affects all Heading 1's. -// A valid alternative implementation would be to simply SetCountInList(false) for 1st para, -// and leave the Outline style format alone. -CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara3, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara1, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara2, "ListLabelString")); +// the third paragraph must retain the existing numbering format +CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara3, "ListLabelString")); // on the selection, simulate pressing the toolbar button to toggle ON numbering again dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); -// current implementation: the entire format was removed, so turn (default) numbering on -CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara1, "ListLabelString")); -CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara2, "ListLabelString")); -CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara3, "ListLabelString")); +// the outline numbering format must be re-applied to the first two paragraphs +CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara1, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("B."), getProperty(xPara2, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("C."), getProperty(xPara3, "ListLabelString")); + +// on the selection, simulate a right click - list - No list +dispatchCommand(mxComponent, ".uno:RemoveBullets", {}); + +// the selected paragraphs should definitely have the list label removed +CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara1, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara2, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara3, "ListLabelString")); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158375_dde_disable) diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 1c7d1792abe5..73b04ad24122 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1368,10 +1368,15 @@ void SwDoc::DelNumRules(const SwPaM& rPam, SwRootFrame const*const pLayout) { pTNd->ChkCondColl(); } -else if( !pOutlNd && -
core.git: sw/qa
sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx |binary sw/qa/extras/uiwriter/uiwriter9.cxx | 37 ++ 2 files changed, 37 insertions(+) New commits: commit f78c0dfa7a63303533eed17636e7abf8332eea48 Author: Justin Luth AuthorDate: Mon Mar 18 16:56:55 2024 -0400 Commit: Miklos Vajna CommitDate: Wed Mar 20 16:19:14 2024 +0100 tdf#159054 unit test: noting the current state before making changes The historical implementation is rather bizarre, so I submit it beforehand so that my patch shows the changes in behaviour in a clearer way. I checked LO 5.1, and while things were slightly different (still inexplicable, but not in the same way) it still did leave behind the suffix, and toggled back on as 1. So this has never been good. Throwing out the old behaviour seems appropriate in this case. make CppunitTest_sw_uiwriter9 \ CPPUNIT_TEST_NAME=testTdf159054_disableOutlineNumbering Change-Id: Id794e629d00480bc5a031aaf0595084cb3eb3559 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164984 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx new file mode 100644 index ..091a3830e75b Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index 77245e63ce2f..a18f14c9ad9a 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -408,6 +408,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf151710) CPPUNIT_ASSERT_EQUAL(sStartDoubleQuote, pTextDoc->getText()->getString()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159054_disableOutlineNumbering) +{ +createSwDoc("tdf159054_disableOutlineNumbering.docx"); +SwDoc* pDoc = getSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +const uno::Reference xPara1 = getParagraph(1, "Heading A"); +const uno::Reference xPara2 = getParagraph(2, "Heading B"); +const uno::Reference xPara3 = getParagraph(3, "Heading C"); + +CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara1, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("B."), getProperty(xPara2, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("C."), getProperty(xPara3, "ListLabelString")); + +// select (at least parts) of the first two paragraphs +pWrtShell->Down(/*bSelect=*/true, /*nCount=*/1, /*bBasicCall=*/true); + +// on the selection, simulate pressing the toolbar button to toggle OFF numbering +dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); + +// the selected paragraphs should definitely have the list label removed +CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara1, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara2, "ListLabelString")); +// current implementation: the numbering style itself is changed too - affects all Heading 1's. +// A valid alternative implementation would be to simply SetCountInList(false) for 1st para, +// and leave the Outline style format alone. +CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara3, "ListLabelString")); + +// on the selection, simulate pressing the toolbar button to toggle ON numbering again +dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); + +// current implementation: the entire format was removed, so turn (default) numbering on +CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara1, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara2, "ListLabelString")); +CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara3, "ListLabelString")); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158375_dde_disable) { std::shared_ptr pBatch(
core.git: sw/source
sw/source/ui/misc/outline.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit f056f4d45080febc6c912bd623b5df8fa06f87a1 Author: Justin Luth AuthorDate: Tue Mar 19 13:20:36 2024 -0400 Commit: Justin Luth CommitDate: Wed Mar 20 15:40:09 2024 +0100 related tdf#150197: ensure HasListFormat Steps to reproduce 1.) tools - Heading numbering - set "Number" to non-NONE (e.g. 1, 2, 3) 2.) set a paragraph to "Heading 1" style (to ensure we export style) 3.) export to assert.docx hits commit 727c5ed30f68abc28bb04531b25a1df30810760f assert(false && "deprecated format still exists and is unhandled. Inform Vasily or Justin"); Not reproduced with "Bullets and numbering" Change-Id: I99395f8905075dc0ec6ae04a0fd7a28b64da06af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165036 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 6500bfdd6eca..c216289a0b10 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -623,6 +623,8 @@ IMPL_LINK_NOARG(SwOutlineSettingsTabPage, NumberSelect, weld::ComboBox&, void) { SwNumFormat aNumFormat(m_pNumRule->Get(i)); aNumFormat.SetNumberingType(nNumberType); +// ensure that HasListFormat +aNumFormat.SetListFormat(aNumFormat.GetPrefix(), aNumFormat.GetSuffix(), i); m_pNumRule->Set(i, aNumFormat); CheckForStartValue_Impl(nNumberType); }
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt |binary sw/qa/extras/uiwriter/uiwriter7.cxx | 31 +++ sw/source/core/crsr/findtxt.cxx | 67 3 files changed, 66 insertions(+), 32 deletions(-) New commits: commit 2f5b9916baaf0017ece84bf867a9e9acfe86d61a Author: Justin Luth AuthorDate: Fri Mar 15 20:01:39 2024 -0400 Commit: Miklos Vajna CommitDate: Tue Mar 19 08:57:27 2024 +0100 tdf#147583 sw find: fix backwards search for emptyPara/endOfPara A comment added 10 years ago thought that it had never worked. The very last paragraph end cannot be selected manually, and so of course it can't work in find either. It didn't work earlier either. Everything goes ballistic if searching inside comments, but that would be handled elsewhere anyway I guess. It didn't work earlier either. Keeping the search "inside the selection" didn't work earlier either. That should be fixed now. make CppunitTest_sw_uiwriter7 \ CPPUNIT_TEST_NAME=testTdf147583_backwardSearch Change-Id: I48a72084d277b8c270255de9296a2743162937cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164892 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164982 Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt new file mode 100644 index ..9bfde3bfaa6b Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index 16afe5f205c0..844e9ff06c42 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -358,6 +358,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextSearch) pCursor->GetPointNode().GetTextNode()->GetText()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf147583_backwardSearch) +{ +createSwDoc("tdf147583_backwardSearch.odt"); +uno::Reference xSearch(mxComponent, uno::UNO_QUERY); +uno::Reference xSearchDes = xSearch->createSearchDescriptor(); +uno::Reference xProp(xSearchDes, uno::UNO_QUERY); + +uno::Reference xIndex; +const sal_Int32 nParas = getParagraphs(); + +//specifying the search attributes +uno::Reference xPropSet(xSearchDes, uno::UNO_QUERY_THROW); +xSearchDes->setPropertyValue("SearchRegularExpression", uno::Any(true)); // regex +xSearchDes->setSearchString("$"); // the end of the paragraph pilcrow marker + +// xSearchDes->setPropertyValue("SearchBackwards", uno::Any(false)); +// xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); +// // all paragraphs (including the unselected last one) should be found +// CPPUNIT_ASSERT_EQUAL(nParas, xIndex->getCount()); + +xSearchDes->setPropertyValue("SearchBackwards", uno::Any(true)); +xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); +// all paragraphs (except the troublesome last one) are found +CPPUNIT_ASSERT_EQUAL(nParas - 1, xIndex->getCount()); + +xSearchDes->setSearchString("^$"); // empty paragraphs +xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); +// should actually be 10 (including the empty para with the comment marker, and the last para) +CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282) { createSwDoc(); diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 9d05c3290e50..ca3b19fb0be9 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -730,7 +730,6 @@ bool DoSearch(SwPaM & rSearchPam, SwRootFrame const*const pLayout, SwPaM& rPam) { bool bFound = false; -SwPosition& rPtPos = *rPam.GetPoint(); OUString sCleanStr; std::vector aFltArr; LanguageType eLastLang = LANGUAGE_SYSTEM; @@ -872,39 +871,43 @@ bool DoSearch(SwPaM & rSearchPam, if ( bFound ) return true; -else if ((bChkEmptyPara && !nStart.GetAnyIndex() && !nTextLen.GetAnyIndex()) - || bChkParaEnd) + +if (!bChkEmptyPara && !bChkParaEnd) +return false; + +if (bChkEmptyPara && bSrchForward && nTextLen.GetAnyIndex()) +return false; // the length is not zero - there is content here + +// move to the end (or start) of the paragraph +*rSearchPam.GetPoint() = *rPam.GetPoint(); +if (pLayout) { -*rSearchPam.GetPoint() = *rPam.GetPoint(); -if (pLayout) -{ -*rSearchPam.GetPoint() = pFrame->MapViewToModelPos( -bChkParaEnd ? nTextLen.GetFrameIndex() : TextFrameIndex(0)); -} -else -{ -rSearchPam.GetPoint()->SetContent(
core.git: Branch 'distro/collabora/co-24.04' - sw/source
sw/source/core/crsr/findtxt.cxx | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit 60b39486660f238fd4385a9cab48a396ed15a155 Author: Justin Luth AuthorDate: Fri Mar 15 12:40:42 2024 -0400 Commit: Miklos Vajna CommitDate: Tue Mar 19 08:56:56 2024 +0100 DoSearch's pPam was not optional - made it an SwPam& rPam oPam also is not a real optional - it is always populated by MakeRegion, and known to be non-null since it was used in the containing while loop clause earlier Change-Id: I33133c8f9f9188e57fe100f3c455dc92453d05f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164868 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Noel Grandin Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164981 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 5f63f8f13694..9d05c3290e50 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -361,7 +361,7 @@ static bool DoSearch(SwPaM & rSearchPam, bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd, AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex nTextLen, SwTextNode const* pNode, SwTextFrame const* pTextFrame, -SwRootFrame const* pLayout, SwPaM* pPam); +SwRootFrame const* pLayout, SwPaM& rPam); namespace sw { @@ -677,7 +677,7 @@ bool FindTextImpl(SwPaM & rSearchPam, bRegSearch, bChkEmptyPara, bChkParaEnd, nStartInside, nEndInside, nTextLen, pNode->GetTextNode(), pFrame, pLayout, - oPam ? &*oPam : nullptr ); + *oPam); if ( bFound ) break; else @@ -710,7 +710,7 @@ bool FindTextImpl(SwPaM & rSearchPam, bRegSearch, bChkEmptyPara, bChkParaEnd, nStart, nEnd, nTextLen, pNode->GetTextNode(), pFrame, pLayout, - oPam ? &*oPam : nullptr ); + *oPam); } if (bFound) break; @@ -727,10 +727,10 @@ bool DoSearch(SwPaM & rSearchPam, bool bChkEmptyPara, bool bChkParaEnd, AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex const nTextLen, SwTextNode const*const pNode, SwTextFrame const*const pFrame, -SwRootFrame const*const pLayout, SwPaM* pPam) +SwRootFrame const*const pLayout, SwPaM& rPam) { bool bFound = false; -SwPosition& rPtPos = *pPam->GetPoint(); +SwPosition& rPtPos = *rPam.GetPoint(); OUString sCleanStr; std::vector aFltArr; LanguageType eLastLang = LANGUAGE_SYSTEM; @@ -818,7 +818,7 @@ bool DoSearch(SwPaM & rSearchPam, nStart = nProxyStart; nEnd = nProxyEnd; // set section correctly -*rSearchPam.GetPoint() = *pPam->GetPoint(); +*rSearchPam.GetPoint() = *rPam.GetPoint(); rSearchPam.SetMark(); // adjust start and end @@ -875,7 +875,7 @@ bool DoSearch(SwPaM & rSearchPam, else if ((bChkEmptyPara && !nStart.GetAnyIndex() && !nTextLen.GetAnyIndex()) || bChkParaEnd) { -*rSearchPam.GetPoint() = *pPam->GetPoint(); +*rSearchPam.GetPoint() = *rPam.GetPoint(); if (pLayout) { *rSearchPam.GetPoint() = pFrame->MapViewToModelPos(
core.git: sw/qa sw/source
sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt |binary sw/qa/extras/uiwriter/uiwriter7.cxx | 31 +++ sw/source/core/crsr/findtxt.cxx | 67 3 files changed, 66 insertions(+), 32 deletions(-) New commits: commit 8b58007fc5a619012b58a1f8d8731a753bc1c40d Author: Justin Luth AuthorDate: Fri Mar 15 20:01:39 2024 -0400 Commit: Miklos Vajna CommitDate: Mon Mar 18 14:25:39 2024 +0100 tdf#147583 sw find: fix backwards search for emptyPara/endOfPara A comment added 10 years ago thought that it had never worked. The very last paragraph end cannot be selected manually, and so of course it can't work in find either. It didn't work earlier either. Everything goes ballistic if searching inside comments, but that would be handled elsewhere anyway I guess. It didn't work earlier either. Keeping the search "inside the selection" didn't work earlier either. That should be fixed now. make CppunitTest_sw_uiwriter7 \ CPPUNIT_TEST_NAME=testTdf147583_backwardSearch Change-Id: I48a72084d277b8c270255de9296a2743162937cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164892 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt new file mode 100644 index ..9bfde3bfaa6b Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index fe873d8cfb3b..898ed6dcd1b5 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -358,6 +358,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextSearch) pCursor->GetPointNode().GetTextNode()->GetText()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf147583_backwardSearch) +{ +createSwDoc("tdf147583_backwardSearch.odt"); +uno::Reference xSearch(mxComponent, uno::UNO_QUERY); +uno::Reference xSearchDes = xSearch->createSearchDescriptor(); +uno::Reference xProp(xSearchDes, uno::UNO_QUERY); + +uno::Reference xIndex; +const sal_Int32 nParas = getParagraphs(); + +//specifying the search attributes +uno::Reference xPropSet(xSearchDes, uno::UNO_QUERY_THROW); +xSearchDes->setPropertyValue("SearchRegularExpression", uno::Any(true)); // regex +xSearchDes->setSearchString("$"); // the end of the paragraph pilcrow marker + +// xSearchDes->setPropertyValue("SearchBackwards", uno::Any(false)); +// xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); +// // all paragraphs (including the unselected last one) should be found +// CPPUNIT_ASSERT_EQUAL(nParas, xIndex->getCount()); + +xSearchDes->setPropertyValue("SearchBackwards", uno::Any(true)); +xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); +// all paragraphs (except the troublesome last one) are found +CPPUNIT_ASSERT_EQUAL(nParas - 1, xIndex->getCount()); + +xSearchDes->setSearchString("^$"); // empty paragraphs +xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW); +// should actually be 10 (including the empty para with the comment marker, and the last para) +CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282) { createSwDoc(); diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 1edde20d7ccc..930ac7926ce2 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -727,7 +727,6 @@ bool DoSearch(SwPaM & rSearchPam, SwRootFrame const*const pLayout, SwPaM& rPam) { bool bFound = false; -SwPosition& rPtPos = *rPam.GetPoint(); OUString sCleanStr; std::vector aFltArr; LanguageType eLastLang = LANGUAGE_SYSTEM; @@ -869,39 +868,43 @@ bool DoSearch(SwPaM & rSearchPam, if ( bFound ) return true; -else if ((bChkEmptyPara && !nStart.GetAnyIndex() && !nTextLen.GetAnyIndex()) - || bChkParaEnd) + +if (!bChkEmptyPara && !bChkParaEnd) +return false; + +if (bChkEmptyPara && bSrchForward && nTextLen.GetAnyIndex()) +return false; // the length is not zero - there is content here + +// move to the end (or start) of the paragraph +*rSearchPam.GetPoint() = *rPam.GetPoint(); +if (pLayout) { -*rSearchPam.GetPoint() = *rPam.GetPoint(); -if (pLayout) -{ -*rSearchPam.GetPoint() = pFrame->MapViewToModelPos( -bChkParaEnd ? nTextLen.GetFrameIndex() : TextFrameIndex(0)); -} -else -{ -rSearchPam.GetPoint()->SetContent( bChkParaEnd ? nTextLen.GetModelIndex() : 0 ); -} -rSearchPam.SetMark(); -const
core.git: sfx2/source
sfx2/source/doc/docfile.cxx |4 1 file changed, 4 insertions(+) New commits: commit 5441ed518d36ac12a6bd0c517e2cfc24aff94d50 Author: Justin Luth AuthorDate: Thu Mar 14 11:29:08 2024 -0400 Commit: Miklos Vajna CommitDate: Mon Mar 18 14:20:38 2024 +0100 tdf#40244 tdf#160192: create tempFile elsewhere if LogicBase is RO This avoids a crash/infinite loop in specific read-only folder situation (where the lock file already exists). It also fixes ODF files giving three misleading/unclear notices when attempting to save into a read-only folder. When LO saves a file, it saves to a temporary file and then moves that file overtop of the previous one, IIUC. Prior to 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b that temporary file was stored in the /tmp directory (IIUC), but was changed to be in the same folder for easier renaming, same filesystem etc. Note that typically this situation would fail since a locking file also could not be created. However in the case where the lock file already exists, then all the pieces are in place to actually modify the document. By falling back to the /tmp folder if the document's folder is read-only, we can still modify a writeable document. Change-Id: Ie027fc05934f2c071f7a91007255801c179bff49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164841 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index c90fb794f690..b58d27c95fa4 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -4038,6 +4038,8 @@ void SfxMedium::CreateTempFile( bool bReplace ) OUString aLogicBase = GetLogicBase(GetURLObject(), pImpl); pImpl->pTempFile.reset(new ::utl::TempFileNamed()); +if (!aLogicBase.isEmpty() && pImpl->pTempFile->GetFileName().isEmpty()) +pImpl->pTempFile.reset(new ::utl::TempFileNamed()); pImpl->pTempFile->EnableKillingFile(); pImpl->m_aName = pImpl->pTempFile->GetFileName(); OUString aTmpURL = pImpl->pTempFile->GetURL(); @@ -4134,6 +4136,8 @@ void SfxMedium::CreateTempFileNoCopy() OUString aLogicBase = GetLogicBase(GetURLObject(), pImpl); pImpl->pTempFile.reset(new ::utl::TempFileNamed()); +if (!aLogicBase.isEmpty() && pImpl->pTempFile->GetFileName().isEmpty()) +pImpl->pTempFile.reset(new ::utl::TempFileNamed()); pImpl->pTempFile->EnableKillingFile(); pImpl->m_aName = pImpl->pTempFile->GetFileName(); if ( pImpl->m_aName.isEmpty() )
core.git: sw/source
sw/source/core/crsr/findtxt.cxx | 463 +++- 1 file changed, 230 insertions(+), 233 deletions(-) New commits: commit 0b7494dfd361f7f2f7d8257b0a8a233a11f00679 Author: Justin Luth AuthorDate: Fri Mar 15 12:49:00 2024 -0400 Commit: Justin Luth CommitDate: Sat Mar 16 02:59:53 2024 +0100 NFC flatten sw FindTextImpl and /opt/lo/clang-format the changed lines There hasn't been much change in this function in the last two years, so now is a good time to flatten it. It will be easy to backport this commit if any fixes to this area of code warrant backporting. Change-Id: If2503ae1ea6e29426f256284efa730edbb157b4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164891 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 9d05c3290e50..1edde20d7ccc 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -403,318 +403,315 @@ bool FindTextImpl(SwPaM & rSearchPam, // LanguageType eLastLang = 0; while (nullptr != (pNode = ::GetNode(*oPam, bFirst, fnMove, bInReadOnly, pLayout))) { -if( pNode->IsTextNode() ) +if (!pNode->IsTextNode()) +continue; + +const SwTextNode& rTextNode = *pNode->GetTextNode(); +SwTextFrame const* const pFrame( +pLayout ? static_cast(rTextNode.getLayoutFrame(pLayout)) : nullptr); +assert(!pLayout || pFrame); +AmbiguousIndex nTextLen; +if (pLayout) +{ + nTextLen.SetFrameIndex(TextFrameIndex(pFrame->GetText().getLength())); +} +else +{ +nTextLen.SetModelIndex(rTextNode.GetText().getLength()); +} +AmbiguousIndex nEnd; +if (pLayout ? FrameContainsNode(*pFrame, oPam->GetMark()->GetNodeIndex()) +: rPtPos.GetNode() == oPam->GetMark()->GetNode()) { -SwTextNode& rTextNode = *pNode->GetTextNode(); -SwTextFrame const*const pFrame(pLayout -? static_cast(rTextNode.getLayoutFrame(pLayout)) -: nullptr); -assert(!pLayout || pFrame); -AmbiguousIndex nTextLen; if (pLayout) { - nTextLen.SetFrameIndex(TextFrameIndex(pFrame->GetText().getLength())); + nEnd.SetFrameIndex(pFrame->MapModelToViewPos(*oPam->GetMark())); } else { -nTextLen.SetModelIndex(rTextNode.GetText().getLength()); +nEnd.SetModelIndex(oPam->GetMark()->GetContentIndex()); } -AmbiguousIndex nEnd; -if (pLayout -? FrameContainsNode(*pFrame, oPam->GetMark()->GetNodeIndex()) -: rPtPos.GetNode() == oPam->GetMark()->GetNode()) +} +else +{ +if (bSrchForward) +{ +nEnd = nTextLen; +} +else { if (pLayout) { - nEnd.SetFrameIndex(pFrame->MapModelToViewPos(*oPam->GetMark())); +nEnd.SetFrameIndex(TextFrameIndex(0)); } else { -nEnd.SetModelIndex(oPam->GetMark()->GetContentIndex()); +nEnd.SetModelIndex(0); } } -else +} +AmbiguousIndex nStart; +if (pLayout) +{ +nStart.SetFrameIndex(pFrame->MapModelToViewPos(*oPam->GetPoint())); +} +else +{ +nStart.SetModelIndex(rPtPos.GetContentIndex()); +} + +/* #i80135# */ +// if there are SwPostItFields inside our current node text, we +// split the text into separate pieces and search for text inside +// the pieces as well as inside the fields +MaybeMergedIter iter(pLayout ? pFrame : nullptr, pLayout ? nullptr : ); + +// count PostItFields by looping over all fields +std::vector> postits; +if (bSearchInNotes) +{ +if (!bSrchForward) { -if (bSrchForward) -{ -nEnd = nTextLen; -} -else +std::swap(nStart, nEnd); +} + +SwTextNode const* pTemp(nullptr); +while (SwTextAttr const* const pTextAttr = iter.NextAttr(pTemp)) +{ +if (pTextAttr->Which() == RES_TXTATR_ANNOTATION) { +AmbiguousIndex aPos; +aPos.SetModelIndex(pTextAttr->GetStart()); if (pLayout) { -nEnd.SetFrameIndex(TextFrameIndex(0)); +aPos.SetFrameIndex(pFrame->MapModelToView(pTemp,
core.git: sw/source
sw/source/filter/ww8/wrtww8.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit f56b2dcb5f8b264366a7f7945f3d5ad83aaa7ea8 Author: Justin Luth AuthorDate: Thu Mar 14 17:28:50 2024 -0400 Commit: Justin Luth CommitDate: Fri Mar 15 22:02:15 2024 +0100 tdf#160192: avoid crash when trying to overwrite doc/lockfile in RO dir Bug exposed with 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b sfx2 store: create temp files next to local files Change-Id: I769096f5ee1b2568e198c1e53b71c10af58f5c9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164850 Tested-by: Jenkins Reviewed-by: Julien Nabet Reviewed-by: Justin Luth diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 23bc15c8f941..72ed190b4ec2 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3553,6 +3553,9 @@ ErrCode WW8Export::ExportDocument_Impl() m_pFib.reset(new WW8Fib(8, m_bDot)); rtl::Reference xWwStrm(GetWriter().GetStorage().OpenSotStream(m_aMainStg)); +if (!xWwStrm->IsWritable()) +return ERRCODE_IO_ACCESSDENIED; + rtl::Reference xTableStrm(xWwStrm), xDataStrm(xWwStrm); xWwStrm->SetBufferSize( 32768 );
core.git: sfx2/source
sfx2/source/doc/oleprops.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c615fba780da5ac3073fe5a00848824f59ee376a Author: Justin Luth AuthorDate: Thu Mar 14 12:29:25 2024 -0400 Commit: Justin Luth CommitDate: Fri Mar 15 21:57:44 2024 +0100 tdf#160192: avoid hang when trying to overwrite doc/lockfile in RO dir Bug exposed with 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b sfx2 store: create temp files next to local files tested on .doc format, code-read suggests it affects xls/ppt too, but they throw exceptions, apparently before hitting this section. I was seeing an infinite loop on SfxOleSection::SaveProperty's while((rStrm.Tell() & 3)) rStrm.WriteUChar( 0 ); because nothing checks to confirm that the tempfile is actually created/useable. Now, instead of an infinite loop, we get a crash... Change-Id: I9e093432361a8ad6f928ec9b47290274b3d4ef06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164840 Reviewed-by: Julien Nabet Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index 891110c43780..714f58c2f1af 100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -1110,7 +1110,7 @@ ErrCode const & SfxOlePropertySet::SavePropertySet( SotStorage* pStrg, const OUS if( pStrg ) { rtl::Reference xStrm = pStrg->OpenSotStream( rStrmName, StreamMode::TRUNC | StreamMode::STD_WRITE ); -if( xStrm.is() ) +if (xStrm.is() && xStrm->IsWritable()) Save( *xStrm ); else SetError( ERRCODE_IO_ACCESSDENIED );
core.git: sw/source
sw/source/core/crsr/findtxt.cxx | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit 397cacaa13dd8c102fb467a0c769597a60a2cfbf Author: Justin Luth AuthorDate: Fri Mar 15 12:40:42 2024 -0400 Commit: Noel Grandin CommitDate: Fri Mar 15 20:29:21 2024 +0100 DoSearch's pPam was not optional - made it an SwPam& rPam oPam also is not a real optional - it is always populated by MakeRegion, and known to be non-null since it was used in the containing while loop clause earlier Change-Id: I33133c8f9f9188e57fe100f3c455dc92453d05f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164868 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Noel Grandin diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 5f63f8f13694..9d05c3290e50 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -361,7 +361,7 @@ static bool DoSearch(SwPaM & rSearchPam, bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd, AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex nTextLen, SwTextNode const* pNode, SwTextFrame const* pTextFrame, -SwRootFrame const* pLayout, SwPaM* pPam); +SwRootFrame const* pLayout, SwPaM& rPam); namespace sw { @@ -677,7 +677,7 @@ bool FindTextImpl(SwPaM & rSearchPam, bRegSearch, bChkEmptyPara, bChkParaEnd, nStartInside, nEndInside, nTextLen, pNode->GetTextNode(), pFrame, pLayout, - oPam ? &*oPam : nullptr ); + *oPam); if ( bFound ) break; else @@ -710,7 +710,7 @@ bool FindTextImpl(SwPaM & rSearchPam, bRegSearch, bChkEmptyPara, bChkParaEnd, nStart, nEnd, nTextLen, pNode->GetTextNode(), pFrame, pLayout, - oPam ? &*oPam : nullptr ); + *oPam); } if (bFound) break; @@ -727,10 +727,10 @@ bool DoSearch(SwPaM & rSearchPam, bool bChkEmptyPara, bool bChkParaEnd, AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex const nTextLen, SwTextNode const*const pNode, SwTextFrame const*const pFrame, -SwRootFrame const*const pLayout, SwPaM* pPam) +SwRootFrame const*const pLayout, SwPaM& rPam) { bool bFound = false; -SwPosition& rPtPos = *pPam->GetPoint(); +SwPosition& rPtPos = *rPam.GetPoint(); OUString sCleanStr; std::vector aFltArr; LanguageType eLastLang = LANGUAGE_SYSTEM; @@ -818,7 +818,7 @@ bool DoSearch(SwPaM & rSearchPam, nStart = nProxyStart; nEnd = nProxyEnd; // set section correctly -*rSearchPam.GetPoint() = *pPam->GetPoint(); +*rSearchPam.GetPoint() = *rPam.GetPoint(); rSearchPam.SetMark(); // adjust start and end @@ -875,7 +875,7 @@ bool DoSearch(SwPaM & rSearchPam, else if ((bChkEmptyPara && !nStart.GetAnyIndex() && !nTextLen.GetAnyIndex()) || bChkParaEnd) { -*rSearchPam.GetPoint() = *pPam->GetPoint(); +*rSearchPam.GetPoint() = *rPam.GetPoint(); if (pLayout) { *rSearchPam.GetPoint() = pFrame->MapViewToModelPos(
core.git: Branch 'distro/mimo/mimo-7-2' - sd/source
sd/source/ui/dlg/headerfooterdlg.cxx | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) New commits: commit fccf8882a59fbfc68b5d567b968841541713230c Author: Justin Luth AuthorDate: Tue Feb 27 09:57:35 2024 -0500 Commit: Aron Budea CommitDate: Thu Mar 14 13:17:06 2024 +1030 tdf#159927 sd headerfooterdlg: detect existing date/time language Sometimes it was hard to change an existing foreign language to your own language for Impress' header/footer fields. The function was only checking the first master slide for the date/time language. If it didn't have one, then the default locale was selected. However, although all pages share the same date/time language, it is not necessary for all (or even the first) master slide to have a date/time field. So check through all the master slides until one with a date/time is found. Obviously if none have one defined things still work OK, because that is effectively how it was working beforehand. I don't have much hope for a successful unit test. I'll try to develop it as a follow-up to this patch. Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506 Reviewed-by: Miklos Vajna (cherry picked from commit 703cc8d674d81573a1e6191a12cec4012cca22f7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164671 (cherry picked from commit 2dd2471290acf4d1229cca7b43719e57242cd59e) (cherry picked from commit 6ff74883ec3e6ca6b1552968306556f8a921aa23) (cherry picked from commit eb26913aba35522babb15eee06124d18d4a0cb4e) diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 3320ed06b9e3..add1f86b25a8 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -151,7 +151,8 @@ private: void FillFormatList(sal_Int32 nSelectedPos); void GetOrSetDateTimeLanguage( LanguageType , bool bSet ); -void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ); +// returns true if the page has a date/time field item +bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* pPage); public: HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); @@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -// get the language from the first master page -// or set it to all master pages -sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PageKind::Notes ) : 1; +const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) { -GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PageKind::Standard ) ); +SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, PageKind::Standard); +bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, pMasterSlide); + +// All pages must use the same language. If getting the language, only need to find one. +if (!bSet && bHasDateFieldItem) +break; } } } -void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ) +bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, + SdPage* pPage) { if( !pPage ) -return; +return false; SdrTextObj* pObj = static_cast(pPage->GetPresObj( PresObjKind::DateTime )); if( !pObj ) -return; +return false; Outliner* pOutl = mpDoc->GetInternalOutliner(); pOutl->Init( OutlinerMode::TextObject ); @@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo pOutl->Clear(); pOutl->Init( nOutlMode ); +return bHasDateFieldItem; } PresLayoutPreview::PresLayoutPreview()
core.git: Branch 'libreoffice-7-6' - pyuno/source
pyuno/source/module/pyuno.cxx |3 +++ pyuno/source/module/pyuno_callable.cxx |3 +++ pyuno/source/module/pyuno_iterator.cxx |6 ++ pyuno/source/module/pyuno_runtime.cxx |3 +++ pyuno/source/module/pyuno_struct.cxx |3 +++ 5 files changed, 18 insertions(+) New commits: commit 31d72aff203e6d16e4ff624a2b2d17eb3e2d9852 Author: Justin Luth AuthorDate: Wed Mar 13 08:38:40 2024 -0400 Commit: Stephan Bergmann CommitDate: Thu Mar 14 07:59:58 2024 +0100 allow build with python 3.12.0: initialize new tp_watched This fixes the build failure after I updated Ubuntu 24.04 (alpha), which upgraded python 3.11.7 to python 3.12.0, causing the error: libreoffice/pyuno/source/module/pyuno_callable.cxx:249:1: error: missing initializer for member ‘_typeobject::tp_watched’ [-Werror=missing-field-initializers] ... I gleaned this information from a July 2023 commit for https://github.com/xbmc/xbmc/issues/23503 tp_watched was added in upstream commit python/cpython@82ccbf6 https://github.com/python/cpython/commit/82ccbf69a842db25d8117f1c41b47aa5b4ed96ab This change first appeared in Python v3.12.0a1 Change-Id: If82ff1eb47d66d2669d90d6e00e0feff3c55b5ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164775 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Stephan Bergmann Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164789 diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index bd4904d5f729..a589c72ba3bf 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -1667,6 +1667,9 @@ static PyTypeObject PyUNOType = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_callable.cxx b/pyuno/source/module/pyuno_callable.cxx index f22de316b7de..8f19fc8eb654 100644 --- a/pyuno/source/module/pyuno_callable.cxx +++ b/pyuno/source/module/pyuno_callable.cxx @@ -244,6 +244,9 @@ static PyTypeObject PyUNO_callable_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_iterator.cxx b/pyuno/source/module/pyuno_iterator.cxx index 134f318a1017..2fc70a32fcff 100644 --- a/pyuno/source/module/pyuno_iterator.cxx +++ b/pyuno/source/module/pyuno_iterator.cxx @@ -177,6 +177,9 @@ static PyTypeObject PyUNO_iterator_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; @@ -323,6 +326,9 @@ static PyTypeObject PyUNO_list_iterator_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index 7f3eb7a6e95f..02f02c2f6679 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -138,6 +138,9 @@ static PyTypeObject RuntimeImpl_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_struct.cxx b/pyuno/source/module/pyuno_struct.cxx index c8fd7e987905..364f2776011a 100644 --- a/pyuno/source/module/pyuno_struct.cxx +++ b/pyuno/source/module/pyuno_struct.cxx @@ -354,6 +354,9 @@ static PyTypeObject PyUNOStructType = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif };
core.git: Branch 'distro/mimo/mimo-7-3' - sd/source
sd/source/ui/dlg/headerfooterdlg.cxx | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) New commits: commit eb26913aba35522babb15eee06124d18d4a0cb4e Author: Justin Luth AuthorDate: Tue Feb 27 09:57:35 2024 -0500 Commit: Aron Budea CommitDate: Wed Mar 13 15:11:53 2024 +1030 tdf#159927 sd headerfooterdlg: detect existing date/time language Sometimes it was hard to change an existing foreign language to your own language for Impress' header/footer fields. The function was only checking the first master slide for the date/time language. If it didn't have one, then the default locale was selected. However, although all pages share the same date/time language, it is not necessary for all (or even the first) master slide to have a date/time field. So check through all the master slides until one with a date/time is found. Obviously if none have one defined things still work OK, because that is effectively how it was working beforehand. I don't have much hope for a successful unit test. I'll try to develop it as a follow-up to this patch. Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506 Reviewed-by: Miklos Vajna (cherry picked from commit 703cc8d674d81573a1e6191a12cec4012cca22f7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164671 (cherry picked from commit 2dd2471290acf4d1229cca7b43719e57242cd59e) (cherry picked from commit 6ff74883ec3e6ca6b1552968306556f8a921aa23) diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 703f2f59809f..1446832f2802 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -151,7 +151,8 @@ private: void FillFormatList(sal_Int32 nSelectedPos); void GetOrSetDateTimeLanguage( LanguageType , bool bSet ); -void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ); +// returns true if the page has a date/time field item +bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* pPage); public: HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); @@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -// get the language from the first master page -// or set it to all master pages -sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PageKind::Notes ) : 1; +const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) { -GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PageKind::Standard ) ); +SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, PageKind::Standard); +bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, pMasterSlide); + +// All pages must use the same language. If getting the language, only need to find one. +if (!bSet && bHasDateFieldItem) +break; } } } -void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ) +bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, + SdPage* pPage) { if( !pPage ) -return; +return false; SdrTextObj* pObj = static_cast(pPage->GetPresObj( PresObjKind::DateTime )); if( !pObj ) -return; +return false; Outliner* pOutl = mpDoc->GetInternalOutliner(); pOutl->Init( OutlinerMode::TextObject ); @@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo pOutl->Clear(); pOutl->Init( nOutlMode ); +return bHasDateFieldItem; } PresLayoutPreview::PresLayoutPreview()
core.git: sw/qa
sw/qa/extras/ooxmlexport/ooxmlexport17.cxx |4 ++-- sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 24 sw/qa/extras/rtfexport/rtfexport5.cxx | 12 ++-- sw/qa/extras/rtfexport/rtfexport8.cxx | 12 ++-- sw/qa/extras/rtfimport/rtfimport.cxx |6 +++--- sw/qa/extras/uiwriter/uiwriter3.cxx|4 ++-- sw/qa/extras/ww8export/ww8export3.cxx |2 +- 7 files changed, 32 insertions(+), 32 deletions(-) New commits: commit 80219819e068dcf53059e2026be2a6f4151d6fc6 Author: Justin Luth AuthorDate: Tue Dec 19 10:14:29 2023 -0500 Commit: Justin Luth CommitDate: Wed Mar 13 22:38:36 2024 +0100 address nit: use xmlDocUniquePtr, not const auto& Miklos "nitted" me that I should NOT use const auto& in this context. Obviously anything I do is simply copy/paste, so lets make sure that this "bad example" is removed from all unit tests. Change-Id: I9b76aeafc5848637e8ebd523a7a550789bd991c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160993 Reviewed-by: Justin Luth Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 49d974b01159..6169ca1140df 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -600,7 +600,7 @@ DECLARE_OOXMLEXPORT_TEST(TestWPGZOrder, "testWPGZOrder.docx") CPPUNIT_TEST_FIXTURE(Test, testTdf148720) { loadAndReload("tdf148720.odt"); -const auto& pLayout = parseLayoutDump(); +xmlDocUniquePtr pLayout = parseLayoutDump(); const OString sShapeXPaths[] = { @@ -1098,7 +1098,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149313, "tdf149313.docx") DECLARE_OOXMLEXPORT_TEST(testTdf148360, "tdf148360.docx") { -const auto& pLayout = parseLayoutDump(); +xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure first element is a tab assertXPath(pLayout, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]"_ostr, "type"_ostr, "PortionType::TabLeft"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index cb41f033730d..de10f434b07c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -131,7 +131,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153042_largeTab, "tdf153042_largeTab.docx") if (isExported()) return; -const auto& pLayout = parseLayoutDump(); +xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure a large tabstop is used in the pseudo-numbering (numbering::NONE followed by tabstop) assertXPath(pLayout, "//SwFixPortion"_ostr, "width"_ostr, "1701"); } @@ -147,7 +147,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153042_noTab, "tdf153042_noTab.docx") if (isExported()) return; -const auto& pLayout = parseLayoutDump(); +xmlDocUniquePtr pLayout = parseLayoutDump(); // Ensure a miniscule tab is used in the pseudo-numbering (numbering::NONE followed by tabstop) assertXPath(pLayout, "//SwFixPortion"_ostr, "width"_ostr, "10"); } @@ -205,7 +205,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105035_framePrB, "tdf105035_framePrB.docx") { // The paragraphs have different frame definitions, so they must be in separate frames, // and the frames must not overlap - even though their vertical positions are identical. -const auto& pLayout = parseLayoutDump(); +xmlDocUniquePtr pLayout = parseLayoutDump(); sal_Int32 n1stFlyBottom = getXPath(pLayout, "//page[1]//anchored/fly[1]/infos/bounds"_ostr, "bottom"_ostr).toInt32(); sal_Int32 n2ndFlyTop @@ -222,7 +222,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105035_framePrC, "tdf105035_framePrC.docx") { // The paragraphs have different frame definitions, so they must be in separate frames, // and the frames DO overlap this time. -const auto& pLayout = parseLayoutDump(); +xmlDocUniquePtr pLayout = parseLayoutDump(); sal_Int32 n1stFlyTop = getXPath(pLayout, "//page[1]//anchored/fly[1]/infos/bounds"_ostr, "top"_ostr).toInt32(); sal_Int32 n2ndFlyTop @@ -307,21 +307,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf154703_framePrTextDirection, "tdf154703_framePrT DECLARE_OOXMLEXPORT_TEST(testTdf153613_anchoredAfterPgBreak, "tdf153613_anchoredAfterPgBreak.docx") { -const auto& pLayout = parseLayoutDump(); +xmlDocUniquePtr pLayout = parseLayoutDump(); // An anchored TO character image anchors before the page break. assertXPath(pLayout, "//page[1]//anchored"_ostr, 1); } DECLARE_OOXMLEXPORT_TEST(testTdf153613_anchoredAfterPgBreak2, "tdf153613_anchoredAfterPgBreak2.docx") { -const auto& pLayout = parseLayoutDump(); +xmlDocUniquePtr pLayout = parseLayoutDump(); // An anchored TO character image, followed by more characters moves to the following page assertXPath(pLayout, "//page[2]//anchored"_ostr, 1); }
core.git: sc/source
sc/source/filter/xml/xmlimprt.cxx |5 - 1 file changed, 5 deletions(-) New commits: commit 21bd1facb207e5d558854eab3a45a0fb2bb222f7 Author: Justin Luth AuthorDate: Wed Mar 13 11:30:02 2024 -0400 Commit: Justin Luth CommitDate: Wed Mar 13 21:29:45 2024 +0100 related tdf#123026 xmlimprt: cleanup #includes after removing code block Change-Id: I1e00e669428491a118ddf0d8e6c2eea87b854846 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164783 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index b59b644b5c4d..b94d1d44d8fa 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -51,16 +50,12 @@ #include #include #include -#include -#include -#include #include "xmlbodyi.hxx" #include "xmlstyli.hxx" #include #include #include -#include #include "XMLConverter.hxx" #include "XMLDetectiveContext.hxx"
core.git: Branch 'libreoffice-24-2' - pyuno/source
pyuno/source/module/pyuno.cxx |3 +++ pyuno/source/module/pyuno_callable.cxx |3 +++ pyuno/source/module/pyuno_iterator.cxx |6 ++ pyuno/source/module/pyuno_runtime.cxx |3 +++ pyuno/source/module/pyuno_struct.cxx |3 +++ 5 files changed, 18 insertions(+) New commits: commit 7a561440acd01949e9b7b4efef9062ce05ce5d64 Author: Justin Luth AuthorDate: Wed Mar 13 08:38:40 2024 -0400 Commit: Stephan Bergmann CommitDate: Wed Mar 13 20:28:53 2024 +0100 allow build with python 3.12.0: initialize new tp_watched This fixes the build failure after I updated Ubuntu 24.04 (alpha), which upgraded python 3.11.7 to python 3.12.0, causing the error: libreoffice/pyuno/source/module/pyuno_callable.cxx:249:1: error: missing initializer for member ‘_typeobject::tp_watched’ [-Werror=missing-field-initializers] ... I gleaned this information from a July 2023 commit for https://github.com/xbmc/xbmc/issues/23503 tp_watched was added in upstream commit python/cpython@82ccbf6 https://github.com/python/cpython/commit/82ccbf69a842db25d8117f1c41b47aa5b4ed96ab This change first appeared in Python v3.12.0a1 Change-Id: If82ff1eb47d66d2669d90d6e00e0feff3c55b5ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164775 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Stephan Bergmann Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164785 diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index bd4904d5f729..a589c72ba3bf 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -1667,6 +1667,9 @@ static PyTypeObject PyUNOType = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_callable.cxx b/pyuno/source/module/pyuno_callable.cxx index f22de316b7de..8f19fc8eb654 100644 --- a/pyuno/source/module/pyuno_callable.cxx +++ b/pyuno/source/module/pyuno_callable.cxx @@ -244,6 +244,9 @@ static PyTypeObject PyUNO_callable_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_iterator.cxx b/pyuno/source/module/pyuno_iterator.cxx index 134f318a1017..2fc70a32fcff 100644 --- a/pyuno/source/module/pyuno_iterator.cxx +++ b/pyuno/source/module/pyuno_iterator.cxx @@ -177,6 +177,9 @@ static PyTypeObject PyUNO_iterator_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; @@ -323,6 +326,9 @@ static PyTypeObject PyUNO_list_iterator_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index cb95e5a46dc1..91e971fdd582 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -139,6 +139,9 @@ static PyTypeObject RuntimeImpl_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_struct.cxx b/pyuno/source/module/pyuno_struct.cxx index c8fd7e987905..364f2776011a 100644 --- a/pyuno/source/module/pyuno_struct.cxx +++ b/pyuno/source/module/pyuno_struct.cxx @@ -354,6 +354,9 @@ static PyTypeObject PyUNOStructType = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif };
core.git: pyuno/source
pyuno/source/module/pyuno.cxx |3 +++ pyuno/source/module/pyuno_callable.cxx |3 +++ pyuno/source/module/pyuno_iterator.cxx |6 ++ pyuno/source/module/pyuno_runtime.cxx |3 +++ pyuno/source/module/pyuno_struct.cxx |3 +++ 5 files changed, 18 insertions(+) New commits: commit daa04d405a0081c5212cfbad0d36a049a4ea83c2 Author: Justin Luth AuthorDate: Wed Mar 13 08:38:40 2024 -0400 Commit: Stephan Bergmann CommitDate: Wed Mar 13 17:45:49 2024 +0100 allow build with python 3.12.0: initialize new tp_watched This fixes the build failure after I updated Ubuntu 24.04 (alpha), which upgraded python 3.11.7 to python 3.12.0, causing the error: libreoffice/pyuno/source/module/pyuno_callable.cxx:249:1: error: missing initializer for member ‘_typeobject::tp_watched’ [-Werror=missing-field-initializers] ... I gleaned this information from a July 2023 commit for https://github.com/xbmc/xbmc/issues/23503 tp_watched was added in upstream commit python/cpython@82ccbf6 https://github.com/python/cpython/commit/82ccbf69a842db25d8117f1c41b47aa5b4ed96ab This change first appeared in Python v3.12.0a1 Change-Id: If82ff1eb47d66d2669d90d6e00e0feff3c55b5ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164775 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Stephan Bergmann diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index 44fd8af6810e..f21cbb63d2f4 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -1667,6 +1667,9 @@ static PyTypeObject PyUNOType = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_callable.cxx b/pyuno/source/module/pyuno_callable.cxx index f22de316b7de..8f19fc8eb654 100644 --- a/pyuno/source/module/pyuno_callable.cxx +++ b/pyuno/source/module/pyuno_callable.cxx @@ -244,6 +244,9 @@ static PyTypeObject PyUNO_callable_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_iterator.cxx b/pyuno/source/module/pyuno_iterator.cxx index 134f318a1017..2fc70a32fcff 100644 --- a/pyuno/source/module/pyuno_iterator.cxx +++ b/pyuno/source/module/pyuno_iterator.cxx @@ -177,6 +177,9 @@ static PyTypeObject PyUNO_iterator_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; @@ -323,6 +326,9 @@ static PyTypeObject PyUNO_list_iterator_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index cb95e5a46dc1..91e971fdd582 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -139,6 +139,9 @@ static PyTypeObject RuntimeImpl_Type = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif }; diff --git a/pyuno/source/module/pyuno_struct.cxx b/pyuno/source/module/pyuno_struct.cxx index c8fd7e987905..364f2776011a 100644 --- a/pyuno/source/module/pyuno_struct.cxx +++ b/pyuno/source/module/pyuno_struct.cxx @@ -354,6 +354,9 @@ static PyTypeObject PyUNOStructType = #pragma clang diagnostic pop #endif #endif +#if PY_VERSION_HEX >= 0x030C00A1 +, 0 // tp_watched +#endif #endif #endif };
core.git: Branch 'distro/mimo/mimo-7-5' - sd/source
sd/source/ui/dlg/headerfooterdlg.cxx | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) New commits: commit 6ff74883ec3e6ca6b1552968306556f8a921aa23 Author: Justin Luth AuthorDate: Tue Feb 27 09:57:35 2024 -0500 Commit: Aron Budea CommitDate: Tue Mar 12 18:49:31 2024 +1030 tdf#159927 sd headerfooterdlg: detect existing date/time language Sometimes it was hard to change an existing foreign language to your own language for Impress' header/footer fields. The function was only checking the first master slide for the date/time language. If it didn't have one, then the default locale was selected. However, although all pages share the same date/time language, it is not necessary for all (or even the first) master slide to have a date/time field. So check through all the master slides until one with a date/time is found. Obviously if none have one defined things still work OK, because that is effectively how it was working beforehand. I don't have much hope for a successful unit test. I'll try to develop it as a follow-up to this patch. Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506 Reviewed-by: Miklos Vajna (cherry picked from commit 703cc8d674d81573a1e6191a12cec4012cca22f7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164671 (cherry picked from commit 2dd2471290acf4d1229cca7b43719e57242cd59e) diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 0c0786d3eebb..1f5ada44cf33 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -151,7 +151,8 @@ private: void FillFormatList(sal_Int32 nSelectedPos); void GetOrSetDateTimeLanguage( LanguageType , bool bSet ); -void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ); +// returns true if the page has a date/time field item +bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* pPage); public: HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); @@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -// get the language from the first master page -// or set it to all master pages -sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PageKind::Notes ) : 1; +const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) { -GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PageKind::Standard ) ); +SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, PageKind::Standard); +bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, pMasterSlide); + +// All pages must use the same language. If getting the language, only need to find one. +if (!bSet && bHasDateFieldItem) +break; } } } -void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ) +bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, + SdPage* pPage) { if( !pPage ) -return; +return false; SdrTextObj* pObj = static_cast(pPage->GetPresObj( PresObjKind::DateTime )); if( !pObj ) -return; +return false; Outliner* pOutl = mpDoc->GetInternalOutliner(); pOutl->Init( OutlinerMode::TextObject ); @@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo pOutl->Clear(); pOutl->Init( nOutlMode ); +return bHasDateFieldItem; } PresLayoutPreview::PresLayoutPreview()
core.git: Branch 'libreoffice-7-6' - sd/source
sd/source/ui/dlg/headerfooterdlg.cxx | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) New commits: commit 2dd2471290acf4d1229cca7b43719e57242cd59e Author: Justin Luth AuthorDate: Tue Feb 27 09:57:35 2024 -0500 Commit: Miklos Vajna CommitDate: Tue Mar 12 08:36:06 2024 +0100 tdf#159927 sd headerfooterdlg: detect existing date/time language Sometimes it was hard to change an existing foreign language to your own language for Impress' header/footer fields. The function was only checking the first master slide for the date/time language. If it didn't have one, then the default locale was selected. However, although all pages share the same date/time language, it is not necessary for all (or even the first) master slide to have a date/time field. So check through all the master slides until one with a date/time is found. Obviously if none have one defined things still work OK, because that is effectively how it was working beforehand. I don't have much hope for a successful unit test. I'll try to develop it as a follow-up to this patch. Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506 Reviewed-by: Miklos Vajna (cherry picked from commit 703cc8d674d81573a1e6191a12cec4012cca22f7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164671 diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 8401ec38cd6e..92f7e9be1cb0 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -151,7 +151,8 @@ private: void FillFormatList(sal_Int32 nSelectedPos); void GetOrSetDateTimeLanguage( LanguageType , bool bSet ); -void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ); +// returns true if the page has a date/time field item +bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* pPage); public: HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); @@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -// get the language from the first master page -// or set it to all master pages -sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PageKind::Notes ) : 1; +const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) { -GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PageKind::Standard ) ); +SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, PageKind::Standard); +bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, pMasterSlide); + +// All pages must use the same language. If getting the language, only need to find one. +if (!bSet && bHasDateFieldItem) +break; } } } -void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ) +bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, + SdPage* pPage) { if( !pPage ) -return; +return false; SdrTextObj* pObj = static_cast(pPage->GetPresObj( PresObjKind::DateTime )); if( !pObj ) -return; +return false; Outliner* pOutl = mpDoc->GetInternalOutliner(); pOutl->Init( OutlinerMode::TextObject ); @@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo pOutl->Clear(); pOutl->Init( nOutlMode ); +return bHasDateFieldItem; } PresLayoutPreview::PresLayoutPreview()
core.git: writerfilter/source
writerfilter/source/dmapper/GraphicImport.cxx |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit ccf988d206a47701c81126f23e2bef71fc3db333 Author: Justin Luth AuthorDate: Mon Mar 11 08:26:28 2024 -0400 Commit: Justin Luth CommitDate: Mon Mar 11 15:34:03 2024 +0100 GraphicImport.cxx: address nit less emphasis on minimizing "if logic" and more emphasis on readability (especially since the comment comes after the logic). In the most common cases, this version should actually finish sooner to. Change-Id: I18cf760e806c53f6d32afadca8d127df2df89653 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164655 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 6ee808355a60..2df2569530a1 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1863,9 +1863,10 @@ uno::Reference GraphicImport::createGraphicObject(uno::Refer if (m_pImpl->m_rGraphicImportType == IMPORT_AS_DETECTED_ANCHOR) { if (m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME -&& m_pImpl->m_nHoriOrient > text::HoriOrientation::NONE -&& m_pImpl->m_nHoriOrient != text::HoriOrientation::CENTER -&& m_pImpl->m_nHoriOrient < text::HoriOrientation::FULL) +&& (m_pImpl->m_nHoriOrient == text::HoriOrientation::LEFT +|| m_pImpl->m_nHoriOrient == text::HoriOrientation::RIGHT +|| m_pImpl->m_nHoriOrient == text::HoriOrientation::INSIDE +|| m_pImpl->m_nHoriOrient == text::HoriOrientation::OUTSIDE)) { // before compat15, relative left/right/inside/outside honored margins. if (m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15)
core.git: Branch 'libreoffice-24-2' - sd/source
sd/source/ui/dlg/headerfooterdlg.cxx | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) New commits: commit 703cc8d674d81573a1e6191a12cec4012cca22f7 Author: Justin Luth AuthorDate: Tue Feb 27 09:57:35 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Mar 11 13:15:13 2024 +0100 tdf#159927 sd headerfooterdlg: detect existing date/time language Sometimes it was hard to change an existing foreign language to your own language for Impress' header/footer fields. The function was only checking the first master slide for the date/time language. If it didn't have one, then the default locale was selected. However, although all pages share the same date/time language, it is not necessary for all (or even the first) master slide to have a date/time field. So check through all the master slides until one with a date/time is found. Obviously if none have one defined things still work OK, because that is effectively how it was working beforehand. I don't have much hope for a successful unit test. I'll try to develop it as a follow-up to this patch. Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506 Reviewed-by: Miklos Vajna diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 8401ec38cd6e..92f7e9be1cb0 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -151,7 +151,8 @@ private: void FillFormatList(sal_Int32 nSelectedPos); void GetOrSetDateTimeLanguage( LanguageType , bool bSet ); -void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ); +// returns true if the page has a date/time field item +bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* pPage); public: HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); @@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -// get the language from the first master page -// or set it to all master pages -sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PageKind::Notes ) : 1; +const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) { -GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PageKind::Standard ) ); +SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, PageKind::Standard); +bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, pMasterSlide); + +// All pages must use the same language. If getting the language, only need to find one. +if (!bSet && bHasDateFieldItem) +break; } } } -void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ) +bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, + SdPage* pPage) { if( !pPage ) -return; +return false; SdrTextObj* pObj = static_cast(pPage->GetPresObj( PresObjKind::DateTime )); if( !pObj ) -return; +return false; Outliner* pOutl = mpDoc->GetInternalOutliner(); pOutl->Init( OutlinerMode::TextObject ); @@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo pOutl->Clear(); pOutl->Init( nOutlMode ); +return bHasDateFieldItem; } PresLayoutPreview::PresLayoutPreview()
core.git: Branch 'distro/collabora/co-24.04' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx| 27 ++ writerfilter/source/dmapper/GraphicImport.cxx | 13 ++ 3 files changed, 40 insertions(+) New commits: commit 8192ed8c0e0e474ef631f7012577fb2821708b52 Author: Justin Luth AuthorDate: Wed Mar 6 18:56:55 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Mar 11 09:47:34 2024 +0100 tdf#160077 writerfilter: shape vertRelation is FRAME for layoutinCell When layoutInCell is active, then the offset must be applied against the paragraph instead of the page or page margins. There were only two unit tests that matched this, and both were off-sheet positioned. -tdf151704_thinColumnHeight.docx -tdf92157.docx make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160077_layoutInCell Change-Id: I28241136c0c0be12d3f2dd876550ecdf91b0009c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164514 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164585 Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx new file mode 100644 index ..811fc47e184c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 61c1b3172d19..e26abce21066 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -321,6 +321,33 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, "tdf160049_anchorMargin15 getProperty(getShape(1), "HoriOrientRelation")); } +DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCell, "tdf160077_layoutInCell.docx") +{ +// given an in-table, slightly rotated image vertically aligned -1cm (above) the top page margin +// (which is actually forced to layoutInCell, so that becomes 1cm above the paragraph instead) + +xmlDocUniquePtr pDump = parseLayoutDump(); +const sal_Int32 nCellTop += getXPath(pDump, "//row[1]/cell[1]/infos/bounds"_ostr, "top"_ostr).toInt32(); +const sal_Int32 nParaTop += getXPath(pDump, "//row[1]/cell[1]/txt/infos/bounds"_ostr, "top"_ostr).toInt32(); +const sal_Int32 nImageTop += getXPath(pDump, "//row[1]/cell[1]/txt/anchored/SwAnchoredDrawObject/bounds"_ostr, + "top"_ostr) + .toInt32(); +// The image is approximately half-way between cell top and the start of the text +// correct ImageTop: 3588, while incorrect value was 1117. Cell top is 3051, ParaTop is 4195 +const sal_Int32 nHalfway = nCellTop + (nParaTop - nCellTop) / 2; +CPPUNIT_ASSERT_DOUBLES_EQUAL(nHalfway, nImageTop, 50); // +/- 4.4% + +// The effect is implemented by forcing "Entire paragraph area"/FRAME/0 +// instead of "Page text area"/PAGE_PRINT_AREA/8 +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME, + getProperty(getShape(1), "VertOrientRelation")); +// since layoutInCell had been turned off. If the implementation changes, check the layout. +CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, "tdf153909_followTextFlow.docx") { // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't specified or honored diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 46a5da451226..9b0f161d2f94 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1263,6 +1263,19 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) if (m_pImpl->m_nWrap == text::WrapTextMode_THROUGH && m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME) { +if (m_pImpl->m_bLayoutInCell && m_pImpl->m_rDomainMapper.IsInTable() +&& (m_pImpl->m_nVertRelation == text::RelOrientation::PAGE_FRAME +|| m_pImpl->m_nVertRelation == text::RelOrientation::PAGE_PRINT_AREA)) +{ +// Impossible to be page-oriented when layout in cell. +// Since we are turning LayoutInCell off (to simplify layout), +// we need to set the orientation to the paragraph, +// as MSO effectively does when it forces layoutInCell. +// Probably also needs to happen with TEXT_LINE, +// but MSO is
core.git: Branch 'distro/collabora/co-24.04' - sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 10 ++ writerfilter/source/dmapper/GraphicImport.cxx | 10 ++ 3 files changed, 20 insertions(+) New commits: commit 14451b801029e8efc05d7f777692a91eddab9e16 Author: Justin Luth AuthorDate: Tue Mar 5 20:19:09 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Mar 11 09:47:18 2024 +0100 tdf#160049 dml shape import: use margins with left/right HoriOrientRel make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160049_anchorMargin Change-Id: I3e2df2037cabfedbb6df6b8c8257e90baeaab96e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164445 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164584 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx new file mode 100644 index ..349ed4cbeea7 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index d57c94835e4b..61c1b3172d19 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -302,6 +302,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, "tdf160049_anchorMarginV getProperty(getShape(1), "HoriOrientRelation")); } +DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin2, "tdf160049_anchorMargin2.docx") +{ +// given a DML compat14 (Word 2010) document with a LEFT "column/text" anchored shape + +// The shape takes into account the margin, so it looks like it is in the middle of the doc, +// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph area"/FRAME/0 +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA, + getProperty(getShape(1), "HoriOrientRelation")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, "tdf160049_anchorMargin15.docx") { // given a DML compat15 (Word 2013) document with a LEFT "column/text" anchored image diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 3e5d6d87b267..46a5da451226 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1268,6 +1268,16 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) m_pImpl->m_bLayoutInCell = false; } +if (m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME +&& m_pImpl->m_nHoriOrient > text::HoriOrientation::NONE +&& m_pImpl->m_nHoriOrient != text::HoriOrientation::CENTER +&& m_pImpl->m_nHoriOrient < text::HoriOrientation::FULL) +{ +// before compat15, relative left/right/inside/outside honored margins. +if (m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15) +m_pImpl->m_nHoriRelation = text::RelOrientation::PRINT_AREA; +} + // Anchored: Word only supports at-char in that case. text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_CHARACTER;
core.git: Branch 'distro/collabora/co-24.04' - 3 commits - oox/source sw/qa sw/source writerfilter/source
oox/source/vml/vmlshape.cxx | 17 +++- sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx |binary sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 21 +++ sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc |binary sw/qa/extras/ww8export/ww8export4.cxx| 10 + sw/source/filter/ww8/ww8graf.cxx |6 +++ writerfilter/source/dmapper/GraphicImport.cxx| 10 + 8 files changed, 61 insertions(+), 3 deletions(-) New commits: commit 8dcc7c73999727a5a5e5577d6d48f43f403e2995 Author: Justin Luth AuthorDate: Tue Mar 5 19:43:51 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Mar 11 09:44:45 2024 +0100 tdf#160049 doc import: use margins with left/right HoriOrientRelation No interesting existing unit tests. make CppunitTest_sw_ww8export4 \ CPPUNIT_TEST_NAME=testTdf160049_anchorMargin Change-Id: Ib855d9f35db9e0f47aff18400b69a990cd1ad5ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/16 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164583 Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc new file mode 100644 index ..d1082515fd9c Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index d31bf17a31f6..e297ac949afe 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -49,6 +49,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf77964) CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(getShapeByName(u"Image2"), "AnchorType")); } +DECLARE_WW8EXPORT_TEST(testTdf160049_anchorMargin, "tdf160049_anchorMargin.doc") +{ +// given a document with a LEFT "column/text" anchored image + +// The image takes into account the margin, so it looks like it is in the middle of the doc, +// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph area"/FRAME/0 +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA, + getProperty(getShape(1), "HoriOrientRelation")); +} + DECLARE_WW8EXPORT_TEST(testTdf150197_anlv2ListFormat, "tdf150197_anlv2ListFormat.doc") { CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(getParagraph(2), "ListLabelString")); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 8a9dd1197129..7d486f471e1f 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2400,6 +2400,12 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS rFSPA.nXaLeft = 0; rFSPA.nXaRight = nWidth; } +else if ((eHoriOri == text::HoriOrientation::LEFT || eHoriOri == text::HoriOrientation::RIGHT) + && eHoriRel == text::RelOrientation::FRAME) +{ +// relative left/right honors paragraph margins, but not with center or none/absolute offset +eHoriRel = text::RelOrientation::PRINT_AREA; +} // #i24255# - position of floating screen objects in // R2L layout are given in L2R layout, thus convert them of all commit bb6fa9b093e857c7d34eb161ff4c6692f09f7b9e Author: Justin Luth AuthorDate: Tue Mar 5 19:22:34 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Mar 11 09:44:39 2024 +0100 tdf#160049 dml import: use margins with left/right HoriOrientRelation I'm really surprised this wasn't found much earlier. Even DOC format isn't handling this. compat15 gets rid of this inconsistency. Surprisingly, there were no interesting unit tests matching this. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160049_anchorMarginVML make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160049_anchorMargin15 Change-Id: Ic5c316569ad3640ba0e786d39a6e5c006c74d665 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164443 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164582 Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx new file mode 100755 index ..0b80c9652fbe Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 339e54784843..d57c94835e4b 100644 ---
core.git: sw/qa
sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx |binary 1 file changed New commits: commit 4904e608fd7ac3d61c924a17fe3494f5e4a43ae6 Author: Justin Luth AuthorDate: Fri Mar 8 17:43:51 2024 -0500 Commit: Justin Luth CommitDate: Sat Mar 9 01:45:33 2024 +0100 replace unit test font with Liberation Sans since I was getting a build failure on Ubuntu 24.04 warn:vcl.fonts:1268905:1268905: vcl/unx/generic/fontmanager/fontconfig.cxx:1192: PrintFontManager::Substitute: missing font: 'Rockwell' try: Noto Sans instead replaced theme1.xml Rockwell and Franklin fonts with Liberation Sans Change-Id: I365f64c927fcb2211990321e906f757c2d03e893 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164603 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx index 741bf8270855..625e149ff38e 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx and b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx differ
core.git: sw/qa
sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 16 + 2 files changed, 16 insertions(+) New commits: commit 61b1d3a17ff784b7c79a92cbe069a90ce4932535 Author: Justin Luth AuthorDate: Fri Mar 8 08:37:30 2024 -0500 Commit: Justin Luth CommitDate: Fri Mar 8 18:22:46 2024 +0100 tdf#160077 unit test: this file was helpful identifying a "bad fix" ...since I'm walking away from doing any fix at all as it involves layout code for layoutInCell. Following the createGraphicObject route could also benefit from a similar fix as d210667c72ff821b8cb50b386a83ed55d65ae9bf, but placing that code outside of the try/catch will be important because this example exceptions out. However, my first instinct was to put the code in the "obvious spot" and it didn't work, so adding this as a separate unit test. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160077_layoutInCellB Change-Id: Ifa6a62d9708d9248e48766b913d54a79cfcb230a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164578 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx new file mode 100644 index ..741bf8270855 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 5e320bb6d743..2683ccad087e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -381,6 +381,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCell, "tdf160077_layoutInCell.doc CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow")); } +DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCellB, "tdf160077_layoutInCellB.docx") +{ +// given an in-table, group-shape vertically aligned -1.35 cm (above) the top page margin +// (which is actually forced to layoutInCell, so that turns into 1.35cm above the paragraph) + +xmlDocUniquePtr pDump = parseLayoutDump(); +const sal_Int32 nShapeTop += getXPath(pDump, + "//body/tab[1]/row[1]/cell[1]/txt[1]/anchored/SwAnchoredDrawObject/bounds"_ostr, + "top"_ostr) + .toInt32(); +// The shape is approximately 1 cm below the top of the page, and ~0.5cm above the cell +// correct ShapeTop: 888 TWIPS, while incorrect value was -480. Cell top is 1148, PageTop is 284 +CPPUNIT_ASSERT_DOUBLES_EQUAL(888, nShapeTop, 50); +} + DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, "tdf153909_followTextFlow.docx") { // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't specified or honored
core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx| 27 ++ writerfilter/source/dmapper/GraphicImport.cxx | 13 ++ 3 files changed, 40 insertions(+) New commits: commit d210667c72ff821b8cb50b386a83ed55d65ae9bf Author: Justin Luth AuthorDate: Wed Mar 6 18:56:55 2024 -0500 Commit: Miklos Vajna CommitDate: Fri Mar 8 10:59:36 2024 +0100 tdf#160077 writerfilter: shape vertRelation is FRAME for layoutinCell When layoutInCell is active, then the offset must be applied against the paragraph instead of the page or page margins. There were only two unit tests that matched this, and both were off-sheet positioned. -tdf151704_thinColumnHeight.docx -tdf92157.docx make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160077_layoutInCell Change-Id: I28241136c0c0be12d3f2dd876550ecdf91b0009c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164514 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx new file mode 100644 index ..811fc47e184c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index fcb2eea321c9..5e320bb6d743 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -354,6 +354,33 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, "tdf160049_anchorMargin15 getProperty(getShape(1), "HoriOrientRelation")); } +DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCell, "tdf160077_layoutInCell.docx") +{ +// given an in-table, slightly rotated image vertically aligned -1cm (above) the top page margin +// (which is actually forced to layoutInCell, so that becomes 1cm above the paragraph instead) + +xmlDocUniquePtr pDump = parseLayoutDump(); +const sal_Int32 nCellTop += getXPath(pDump, "//row[1]/cell[1]/infos/bounds"_ostr, "top"_ostr).toInt32(); +const sal_Int32 nParaTop += getXPath(pDump, "//row[1]/cell[1]/txt/infos/bounds"_ostr, "top"_ostr).toInt32(); +const sal_Int32 nImageTop += getXPath(pDump, "//row[1]/cell[1]/txt/anchored/SwAnchoredDrawObject/bounds"_ostr, + "top"_ostr) + .toInt32(); +// The image is approximately half-way between cell top and the start of the text +// correct ImageTop: 3588, while incorrect value was 1117. Cell top is 3051, ParaTop is 4195 +const sal_Int32 nHalfway = nCellTop + (nParaTop - nCellTop) / 2; +CPPUNIT_ASSERT_DOUBLES_EQUAL(nHalfway, nImageTop, 50); // +/- 4.4% + +// The effect is implemented by forcing "Entire paragraph area"/FRAME/0 +// instead of "Page text area"/PAGE_PRINT_AREA/8 +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME, + getProperty(getShape(1), "VertOrientRelation")); +// since layoutInCell had been turned off. If the implementation changes, check the layout. +CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, "tdf153909_followTextFlow.docx") { // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't specified or honored diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index b7d5f101f417..6ee808355a60 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1285,6 +1285,19 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) if (m_pImpl->m_nWrap == text::WrapTextMode_THROUGH && m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME) { +if (m_pImpl->m_bLayoutInCell && m_pImpl->m_rDomainMapper.IsInTable() +&& (m_pImpl->m_nVertRelation == text::RelOrientation::PAGE_FRAME +|| m_pImpl->m_nVertRelation == text::RelOrientation::PAGE_PRINT_AREA)) +{ +// Impossible to be page-oriented when layout in cell. +// Since we are turning LayoutInCell off (to simplify layout), +// we need to set the orientation to the paragraph, +// as MSO effectively does when it forces layoutInCell. +// Probably also needs to happen with TEXT_LINE, +// but MSO is really weird with vertical relation to "line" +m_pImpl->m_nVertRelation
core.git: sw/qa
sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 31 2 files changed, 31 insertions(+) New commits: commit b0f8b695ef25dfd24416afe36b26d7d4f41c40a9 Author: Justin Luth AuthorDate: Wed Mar 6 09:25:31 2024 -0500 Commit: Justin Luth CommitDate: Thu Mar 7 04:23:50 2024 +0100 tdf#160049 full unit test: use margins with left/right HoriOrientRel The other unit tests focused on the concept in general, but always used the same situation. This is a comprehensive test, indicating the things that should NOT use the margins (center, left by) and both things that do use the margin (right, as well as left). So there are a few "do not break what is already working" situations now tested for... Change-Id: I77a5d3e6244710def76b35dac1c6f0fe9ec9e480 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164474 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx new file mode 100644 index ..b39c0cad83e7 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index bc5d5f253e8e..fcb2eea321c9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -314,6 +314,37 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin2, "tdf160049_anchorMargin2.d getProperty(getShape(1), "HoriOrientRelation")); } +DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin14, "tdf160049_anchorMargin14.docx") +{ +// given a DML compat14 (Word 2010) document with a LEFT "column/text" anchored image +// followed by a RIGHT column/text anchored image (with a 2cm paragraph right margin) +// followed by a CENTER column/text anchored image (with a large left margin) +// followed by a LEFT FROM column/text anchored image (which ignores the left margin) +// followed by a LEFT "margin" anchored image (which always ignores the left margin) + +// The shape takes into account the left margin, looking like it is in the middle of the doc, +// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph area"/FRAME/0 +uno::Reference xShape(getShapeByName(u"Picture 2")); +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA, + getProperty(xShape, "HoriOrientRelation")); +// The shape takes into account the right margin, looking like it is in the middle of the doc, +xShape.set(getShapeByName(u"Picture 3")); +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA, + getProperty(xShape, "HoriOrientRelation")); +// The third shape takes "center" very seriously, and ignores the margins +xShape.set(getShapeByName(u"Picture 4")); +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME, + getProperty(xShape, "HoriOrientRelation")); +// The fourth shape takes "left by 123", and ignores the margins, acting just like "margin" +xShape.set(getShapeByName(u"Picture 5")); +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME, + getProperty(xShape, "HoriOrientRelation")); +// The fifth shape shows how "left" works with "margin", which apparently means page margin +xShape.set(getShapeByName(u"Picture 6")); +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA, + getProperty(xShape, "HoriOrientRelation")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, "tdf160049_anchorMargin15.docx") { // given a DML compat15 (Word 2013) document with a LEFT "column/text" anchored image
core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 10 ++ writerfilter/source/dmapper/GraphicImport.cxx | 10 ++ 3 files changed, 20 insertions(+) New commits: commit 77980d4375b270f328afe1dd90e96e2e31fd498d Author: Justin Luth AuthorDate: Tue Mar 5 20:19:09 2024 -0500 Commit: Justin Luth CommitDate: Thu Mar 7 02:20:33 2024 +0100 tdf#160049 dml shape import: use margins with left/right HoriOrientRel make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160049_anchorMargin Change-Id: I3e2df2037cabfedbb6df6b8c8257e90baeaab96e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164445 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx new file mode 100644 index ..349ed4cbeea7 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 8bae715cf4de..bc5d5f253e8e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -304,6 +304,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, "tdf160049_anchorMarginV getProperty(getShape(1), "HoriOrientRelation")); } +DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin2, "tdf160049_anchorMargin2.docx") +{ +// given a DML compat14 (Word 2010) document with a LEFT "column/text" anchored shape + +// The shape takes into account the margin, so it looks like it is in the middle of the doc, +// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph area"/FRAME/0 +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA, + getProperty(getShape(1), "HoriOrientRelation")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, "tdf160049_anchorMargin15.docx") { // given a DML compat15 (Word 2013) document with a LEFT "column/text" anchored image diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index fb34152cda6f..b7d5f101f417 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1290,6 +1290,16 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) m_pImpl->m_bLayoutInCell = false; } +if (m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME +&& m_pImpl->m_nHoriOrient > text::HoriOrientation::NONE +&& m_pImpl->m_nHoriOrient != text::HoriOrientation::CENTER +&& m_pImpl->m_nHoriOrient < text::HoriOrientation::FULL) +{ +// before compat15, relative left/right/inside/outside honored margins. +if (m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15) +m_pImpl->m_nHoriRelation = text::RelOrientation::PRINT_AREA; +} + // Anchored: Word only supports at-char in that case. text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_CHARACTER;
core.git: sw/qa sw/source
sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc |binary sw/qa/extras/ww8export/ww8export4.cxx | 10 ++ sw/source/filter/ww8/ww8graf.cxx |6 ++ 3 files changed, 16 insertions(+) New commits: commit 3aeaee800f675a5f733e06bb4ea73909570f9004 Author: Justin Luth AuthorDate: Tue Mar 5 19:43:51 2024 -0500 Commit: Miklos Vajna CommitDate: Wed Mar 6 11:27:04 2024 +0100 tdf#160049 doc import: use margins with left/right HoriOrientRelation No interesting existing unit tests. make CppunitTest_sw_ww8export4 \ CPPUNIT_TEST_NAME=testTdf160049_anchorMargin Change-Id: Ib855d9f35db9e0f47aff18400b69a990cd1ad5ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/16 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc new file mode 100644 index ..d1082515fd9c Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index ea50ed2a19b9..7ab6f76ec3a6 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -51,6 +51,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf77964) CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, getProperty(getShapeByName(u"Image2"), "AnchorType")); } +DECLARE_WW8EXPORT_TEST(testTdf160049_anchorMargin, "tdf160049_anchorMargin.doc") +{ +// given a document with a LEFT "column/text" anchored image + +// The image takes into account the margin, so it looks like it is in the middle of the doc, +// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph area"/FRAME/0 +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA, + getProperty(getShape(1), "HoriOrientRelation")); +} + DECLARE_WW8EXPORT_TEST(testTdf150197_anlv2ListFormat, "tdf150197_anlv2ListFormat.doc") { CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty(getParagraph(2), "ListLabelString")); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index a7c9ec979e09..28b1211683d1 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2400,6 +2400,12 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS rFSPA.nXaLeft = 0; rFSPA.nXaRight = nWidth; } +else if ((eHoriOri == text::HoriOrientation::LEFT || eHoriOri == text::HoriOrientation::RIGHT) + && eHoriRel == text::RelOrientation::FRAME) +{ +// relative left/right honors paragraph margins, but not with center or none/absolute offset +eHoriRel = text::RelOrientation::PRINT_AREA; +} // #i24255# - position of floating screen objects in // R2L layout are given in L2R layout, thus convert them of all
core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 12 ++-- writerfilter/source/dmapper/GraphicImport.cxx | 10 ++ 3 files changed, 20 insertions(+), 2 deletions(-) New commits: commit eacf8dc7ab850f2d00bd4b327f830c55cf2a0d92 Author: Justin Luth AuthorDate: Tue Mar 5 19:22:34 2024 -0500 Commit: Miklos Vajna CommitDate: Wed Mar 6 11:23:59 2024 +0100 tdf#160049 dml import: use margins with left/right HoriOrientRelation I'm really surprised this wasn't found much earlier. Even DOC format isn't handling this. compat15 gets rid of this inconsistency. Surprisingly, there were no interesting unit tests matching this. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160049_anchorMarginVML make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160049_anchorMargin15 Change-Id: Ic5c316569ad3640ba0e786d39a6e5c006c74d665 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164443 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx new file mode 100755 index ..0b80c9652fbe Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index d045e18efa32..8bae715cf4de 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -297,14 +297,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, "tdf160049_anchorMarginV { // given a VML (Word 2003) document with a LEFT "column/text" anchored image // (which will import as DML compat12 on the round-trip) -if (isExported()) -return; + // The image takes into account the margin, so it looks like it is in the middle of the doc, // which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph area"/FRAME/0 CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA, getProperty(getShape(1), "HoriOrientRelation")); } +DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, "tdf160049_anchorMargin15.docx") +{ +// given a DML compat15 (Word 2013) document with a LEFT "column/text" anchored image + +// The image ignores the margin, so it is at the left for compat15 (but middle-ish for compat14) +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME, + getProperty(getShape(1), "HoriOrientRelation")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, "tdf153909_followTextFlow.docx") { // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't specified or honored diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index a2acdeb604cc..fb34152cda6f 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1839,6 +1839,16 @@ uno::Reference GraphicImport::createGraphicObject(uno::Refer sal_Int32 nWidth = - m_pImpl->m_nLeftPosition; if (m_pImpl->m_rGraphicImportType == IMPORT_AS_DETECTED_ANCHOR) { +if (m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME +&& m_pImpl->m_nHoriOrient > text::HoriOrientation::NONE +&& m_pImpl->m_nHoriOrient != text::HoriOrientation::CENTER +&& m_pImpl->m_nHoriOrient < text::HoriOrientation::FULL) +{ +// before compat15, relative left/right/inside/outside honored margins. +if (m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15) +m_pImpl->m_nHoriRelation = text::RelOrientation::PRINT_AREA; +} + //adjust margins if( (m_pImpl->m_nHoriOrient == text::HoriOrientation::LEFT && (m_pImpl->m_nHoriRelation == text::RelOrientation::PAGE_PRINT_AREA ||
core.git: oox/source sw/qa
oox/source/vml/vmlshape.cxx | 17 +-- sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 13 3 files changed, 27 insertions(+), 3 deletions(-) New commits: commit e0ef7d54b4e4ccbaaada5d2c4a42ba41d961ea69 Author: Justin Luth AuthorDate: Tue Mar 5 19:05:29 2024 -0500 Commit: Miklos Vajna CommitDate: Wed Mar 6 11:22:31 2024 +0100 tdf#160049 oox import: use margins with left/right HoriOrientRelation I'm really surprised this wasn't found much earlier. Even DOC format isn't handling this. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160049_anchorMarginVML Change-Id: I92ee8eceb6c6bab5f027663bae94d7acdf01be3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164442 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 5284de176839..8f16c6267211 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -647,8 +647,13 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType rPropSet.setAnyProperty(PROP_VertOrient, Any(text::VertOrientation::TOP)); } +// if the anchor is not inline, and is relative to left or right, then apply the margins +bool bHonorMargins = rTypeModel.maPosition == "relative" || rTypeModel.maPosition == "absolute"; if ( rTypeModel.maPositionHorizontal == "center" ) +{ rPropSet.setAnyProperty(PROP_HoriOrient, Any(text::HoriOrientation::CENTER)); +bHonorMargins = false; +} else if ( rTypeModel.maPositionHorizontal == "left" ) rPropSet.setAnyProperty(PROP_HoriOrient, Any(text::HoriOrientation::LEFT)); else if ( rTypeModel.maPositionHorizontal == "right" ) @@ -663,6 +668,8 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType rPropSet.setAnyProperty(PROP_HoriOrient, Any(text::HoriOrientation::RIGHT)); rPropSet.setAnyProperty(PROP_PageToggle, Any(true)); } +else +bHonorMargins = false; if ( rTypeModel.maPositionHorizontalRelative == "page" ) rPropSet.setAnyProperty(PROP_HoriOrientRelation, Any(text::RelOrientation::PAGE_FRAME)); @@ -674,9 +681,13 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType else if (rTypeModel.maPositionHorizontalRelative == "left-margin-area" || rTypeModel.maPositionHorizontalRelative == "outer-margin-area") rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PAGE_LEFT); -else if ( rTypeModel.maPositionHorizontalRelative == "text" ) -rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::FRAME); - +else // "text" +{ +if (bHonorMargins) +rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PRINT_AREA); +else +rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::FRAME); +} if ( rTypeModel.maPositionVertical == "center" ) rPropSet.setAnyProperty(PROP_VertOrient, Any(text::VertOrientation::CENTER)); else if ( rTypeModel.maPositionVertical == "top" ) diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx new file mode 100644 index ..f8cb262f53c8 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 2e6c10c99031..d045e18efa32 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -292,6 +293,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx") } } +DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, "tdf160049_anchorMarginVML.docx") +{ +// given a VML (Word 2003) document with a LEFT "column/text" anchored image +// (which will import as DML compat12 on the round-trip) +if (isExported()) +return; +// The image takes into account the margin, so it looks like it is in the middle of the doc, +// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph area"/FRAME/0 +CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA, + getProperty(getShape(1), "HoriOrientRelation")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, "tdf153909_followTextFlow.docx") { // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't specified or honored
core.git: sd/qa sd/source
sd/qa/uitest/impress_tests/tdf159927_dateTime.py |3 +-- sd/source/ui/dlg/headerfooterdlg.cxx |2 +- 2 files changed, 2 insertions(+), 3 deletions(-) New commits: commit de5816806589c6e6d1da11f50f9ceeb6f50dc3ef Author: Justin Luth AuthorDate: Fri Mar 1 10:40:23 2024 -0500 Commit: Justin Luth CommitDate: Fri Mar 1 21:37:15 2024 +0100 fix build: UITest_impress_tests (re-enable date-time test) accidental debugging change got mixed into a patch... This reverts part of commit 99e33129346afeb0a386ffad859a9178290211a6 which shows I clearly failed to follow my normal practise of properly reviewing the change in gerrit before submitting. Change-Id: Iaa1d9a0eaa4f12c8a5786a29887a82b193baac38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164223 Reviewed-by: Justin Luth Tested-by: Jenkins diff --git a/sd/qa/uitest/impress_tests/tdf159927_dateTime.py b/sd/qa/uitest/impress_tests/tdf159927_dateTime.py index 7225d5c96468..17c5f23caa3b 100644 --- a/sd/qa/uitest/impress_tests/tdf159927_dateTime.py +++ b/sd/qa/uitest/impress_tests/tdf159927_dateTime.py @@ -19,7 +19,6 @@ class tdf159927(UITestCase): language_list = xDialog.getChild("language_list") # Expected: the existing language of the date/time field: Finnish # Actual without the fix: the user's locale as specified in tools - options. -# comment out uitest that fails regularly both on jenkins and my local box -# self.assertEqual(get_state_as_dict(language_list)["SelectEntryText"], "Finnish") + self.assertEqual(get_state_as_dict(language_list)["SelectEntryText"], "Finnish") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 8aaf7fed1e47..92f7e9be1cb0 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -536,7 +536,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -const sal_uInt16 nPageCount = 1;// mpDoc->GetMasterSdPageCount(PageKind::Standard); +const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) {
core.git: sd/source writerfilter/source
sd/source/ui/dlg/headerfooterdlg.cxx |2 +- writerfilter/source/dmapper/GraphicImport.cxx |3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) New commits: commit 99e33129346afeb0a386ffad859a9178290211a6 Author: Justin Luth AuthorDate: Thu Feb 29 11:35:43 2024 -0500 Commit: Justin Luth CommitDate: Fri Mar 1 01:39:18 2024 +0100 NFC writerfilter GraphicImport: streamline if statement The function is a const static, so it doesn't require being run. Change-Id: I31fb35e9daf54103071197e669c54818d4062264 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164172 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 92f7e9be1cb0..8aaf7fed1e47 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -536,7 +536,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); +const sal_uInt16 nPageCount = 1;// mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) { diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index f64bef09e958..a2acdeb604cc 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -972,8 +972,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) && !bIsDiagram && !bIsLockedCanvas && !bIsWordprocessingCanvas) || xServiceInfo->supportsService("com.sun.star.drawing.LineShape"); SdrObject* pShape = SdrObject::getSdrObjectFromXShape(m_xShape); -if ((bIsGroupOrLine && !lcl_bHasGroupSlantedChild(pShape) && nOOXAngle == 0) -|| !bIsGroupOrLine) +if (!bIsGroupOrLine || (!nOOXAngle && !lcl_bHasGroupSlantedChild(pShape))) { if (m_pImpl->isXSizeValid()) aSize.Width = m_pImpl->getXSize();
core.git: sw/qa writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind2.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx| 17 ++ writerfilter/source/dmapper/GraphicImport.cxx |4 +- 3 files changed, 19 insertions(+), 2 deletions(-) New commits: commit c4c5937a98572630915de497b3138164b12079e3 Author: Justin Luth AuthorDate: Wed Feb 28 14:18:44 2024 -0500 Commit: Justin Luth CommitDate: Fri Mar 1 01:38:13 2024 +0100 tdf#159158 writerfilter: headers always behind text (!opaque) If the body-anchored thing is in the background, then if any header stuff was NOT in the background, then it would show up above the body thing, and that should not happen in a DOCX world. This test was not easy to produce. ODT kind of knows that headers are special, and so it tries really hard to put stuff in the background without any wrap - at least after a round-trip. So I had to hand-craft from my example DOCX that exhibited a behindDoc which actually had some wrapping component to it. make CppunitTest_sw_ooxmlexport18 \ CPPUNIT_TEST_NAME=testTdf159158_zOrder_headerBehind2 Change-Id: I31617cd7bf2d38add2233a7a06ffe9a8ec00ec0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164130 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind2.docx b/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind2.docx new file mode 100644 index ..e787b9c2605d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind2.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 91fa26ea0a47..cb41f033730d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -1047,6 +1047,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_headerBehind, "tdf159158_zOrder_he CPPUNIT_ASSERT_EQUAL(OUString("RectangleInBody"), getProperty(zOrder1,"Name")); } +DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_headerBehind2, "tdf159158_zOrder_headerBehind2.docx") +{ +// given a logo (marked as behind text) anchored in the header +// and an overlapping blue rectangle anchored in the body text. +uno::Reference zOrder0(getShape(1), uno::UNO_QUERY); +uno::Reference zOrder1(getShape(2), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(zOrder0, "ZOrder")); // lower +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty(zOrder1, "ZOrder")); // higher +CPPUNIT_ASSERT_EQUAL(OUString("HeaderImage"), + getProperty(zOrder0, "LinkDisplayName")); +CPPUNIT_ASSERT_EQUAL(OUString("BodyBlueRectangle"), + getProperty(zOrder1,"LinkDisplayName")); +// The logo should not be opaque since it is in the header. +CPPUNIT_ASSERT(!getProperty(zOrder0, "Opaque")); // logo should be invisible +CPPUNIT_ASSERT(!getProperty(zOrder1, "Opaque")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt") { // Without the accompanying fix in place, this test would have crashed, diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 386ac693d81b..f64bef09e958 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1602,7 +1602,7 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) { // tdf#137850: Word >= 2013 seems to ignore bBehindDoc except for wrapNone, but older versions honour it. if (m_pImpl->m_bBehindDoc && m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() > 14) -m_pImpl->m_bOpaque = true; +m_pImpl->m_bOpaque = !m_pImpl->m_rDomainMapper.IsInHeaderFooter(); } break; } @@ -1720,7 +1720,7 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_EG_WrapType_wrapTopAndBottom: // tdf#137850: Word >= 2013 seems to ignore bBehindDoc except for wrapNone, but older versions honour it. if (m_pImpl->m_bBehindDoc && m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() > 14) - m_pImpl->m_bOpaque = true; + m_pImpl->m_bOpaque = !m_pImpl->m_rDomainMapper.IsInHeaderFooter(); m_pImpl->m_nWrap = text::WrapTextMode_NONE; break; case NS_ooxml::LN_CT_GraphicalObject_graphicData:
core.git: sw/qa writerfilter/inc writerfilter/source
sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 15 ++ writerfilter/inc/dmapper/GraphicZOrderHelper.hxx| 10 + writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 + writerfilter/source/dmapper/GraphicHelpers.cxx | 58 +- writerfilter/source/dmapper/GraphicImport.cxx | 27 6 files changed, 89 insertions(+), 29 deletions(-) New commits: commit 9aa7dc185af99a540926cc699193449177050386 Author: Justin Luth AuthorDate: Tue Feb 27 19:56:32 2024 -0500 Commit: Justin Luth CommitDate: Fri Mar 1 01:36:30 2024 +0100 tdf#159158 writerfilter: headers always under other z-orders I guessed that a negative z-order will be below a positive relativeHeight when it is in the header. It seems like a reasonable assumption. No unit tests hit this situation AFAIK. make CppunitTest_sw_ooxmlexport18 \ CPPUNIT_TEST_NAME=testTdf159158_zOrder_headerBehind Change-Id: I06e31f3df413ad9c32791c8f4b940831630131dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164105 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind.odt b/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind.odt new file mode 100644 index ..a4bf98a1f7aa Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 084863c144f4..91fa26ea0a47 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -1032,6 +1032,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_behindDocB, "tdf159158_zOrder_behi CPPUNIT_ASSERT_EQUAL(OUString("5-Point Star Blue"), getProperty(zOrder1,"Name")); } +DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_headerBehind, "tdf159158_zOrder_headerBehind.odt") +{ +// given a blue star (not marked as behind text) anchored in the header +// and an overlapping yellow rectangle anchored in the body text. +// (note that in ODT format the star is on top, but for DOCX format it must be behind (hidden) +uno::Reference zOrder0(getShape(1), uno::UNO_QUERY); +uno::Reference zOrder1(getShape(2), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(zOrder0, "ZOrder")); // lower +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty(zOrder1, "ZOrder")); // higher +// I don't know why the star is the lowest order in ODT import (maybe header weirdness), +// but it certainly needs to be the lowest on docx round-trip (also for header weirdness) +CPPUNIT_ASSERT_EQUAL(OUString("StarInHeader"), getProperty(zOrder0, "Name")); +CPPUNIT_ASSERT_EQUAL(OUString("RectangleInBody"), getProperty(zOrder1,"Name")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt") { // Without the accompanying fix in place, this test would have crashed, diff --git a/writerfilter/inc/dmapper/GraphicZOrderHelper.hxx b/writerfilter/inc/dmapper/GraphicZOrderHelper.hxx index c6a308ddf819..b5bb27eea81b 100644 --- a/writerfilter/inc/dmapper/GraphicZOrderHelper.hxx +++ b/writerfilter/inc/dmapper/GraphicZOrderHelper.hxx @@ -17,11 +17,15 @@ class GraphicZOrderHelper { public: void addItem(css::uno::Reference const& props, - sal_Int32 relativeHeight); -sal_Int32 findZOrder(sal_Int32 relativeHeight, bool bOldStyle = false); + sal_Int64 relativeHeight); + +// must run adjustRelativeHeight before findZOrder - to set zOrder priorities +static void adjustRelativeHeight(sal_Int64& rRelativeHeight, bool bIsZIndex, bool bIsBehindText, + bool bIsInHeader); +sal_Int32 findZOrder(sal_Int64 relativeHeight, bool bOldStyle = false); private: -using Items = std::map>; +using Items = std::map>; Items m_items; }; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 45ff00958083..bbdfbd35c34a 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4763,8 +4763,10 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape if (rProp.Name == "VML-Z-ORDER") { GraphicZOrderHelper& rZOrderHelper = m_rDMapper.graphicZOrderHelper(); -sal_Int32 zOrder(0); +sal_Int64 zOrder(0); rProp.Value >>= zOrder; +GraphicZOrderHelper::adjustRelativeHeight(zOrder, /*IsZIndex=*/true, + zOrder < 0, IsInHeaderFooter());
core.git: writerfilter/source
writerfilter/source/dmapper/DomainMapper.cxx |4 +-- writerfilter/source/dmapper/DomainMapper.hxx |2 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 12 +-- writerfilter/source/dmapper/GraphicImport.cxx | 23 +++--- 4 files changed, 21 insertions(+), 20 deletions(-) New commits: commit 027632ec97ad556606997254244c76c7474d9122 Author: Justin Luth AuthorDate: Thu Feb 29 08:42:07 2024 -0500 Commit: Justin Luth CommitDate: Fri Mar 1 01:29:58 2024 +0100 NFC prepwork for tdf#159158: flatten writerfilter applyZOrder limit code shuffle in the fix itself Change-Id: Ic506ac700403fa434dd6410e9ea566c6d0e19676 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164154 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 239ecde547d4..3548ece176ed 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -4908,11 +4908,11 @@ SettingsTablePtr const & DomainMapper::GetSettingsTable() return m_pImpl->GetSettingsTable(); } -GraphicZOrderHelper* DomainMapper::graphicZOrderHelper() +GraphicZOrderHelper& DomainMapper::graphicZOrderHelper() { if (m_zOrderHelper == nullptr) m_zOrderHelper.reset( new GraphicZOrderHelper ); -return m_zOrderHelper.get(); +return *m_zOrderHelper; } uno::Reference DomainMapper::PopPendingShape() diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx index db29f10d45eb..9d9771e640f5 100644 --- a/writerfilter/source/dmapper/DomainMapper.hxx +++ b/writerfilter/source/dmapper/DomainMapper.hxx @@ -107,7 +107,7 @@ public: OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ); StyleSheetTablePtr const & GetStyleSheetTable( ); SettingsTablePtr const & GetSettingsTable(); -GraphicZOrderHelper* graphicZOrderHelper(); +GraphicZOrderHelper& graphicZOrderHelper(); /// Return the first from the pending (not inserted to the document) shapes, if there are any. css::uno::Reference PopPendingShape(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 0b1ff5e0e6e3..45ff00958083 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4762,12 +4762,12 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape { if (rProp.Name == "VML-Z-ORDER") { -GraphicZOrderHelper* pZOrderHelper = m_rDMapper.graphicZOrderHelper(); +GraphicZOrderHelper& rZOrderHelper = m_rDMapper.graphicZOrderHelper(); sal_Int32 zOrder(0); rProp.Value >>= zOrder; xShapePropertySet->setPropertyValue("ZOrder", -uno::Any(pZOrderHelper->findZOrder(zOrder, /*LastDuplicateWins*/true))); -pZOrderHelper->addItem(xShapePropertySet, zOrder); +uno::Any(rZOrderHelper.findZOrder(zOrder, /*LastDuplicateWins*/true))); +rZOrderHelper.addItem(xShapePropertySet, zOrder); xShapePropertySet->setPropertyValue(getPropertyName( PROP_OPAQUE ), uno::Any( zOrder >= 0 ) ); checkZOrderStatus = true; } @@ -4807,12 +4807,12 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape { if (rProp.Name == "VML-Z-ORDER") { -GraphicZOrderHelper* pZOrderHelper = m_rDMapper.graphicZOrderHelper(); +GraphicZOrderHelper& rZOrderHelper = m_rDMapper.graphicZOrderHelper(); sal_Int32 zOrder(0); rProp.Value >>= zOrder; xShapePropertySet->setPropertyValue("ZOrder", -uno::Any(pZOrderHelper->findZOrder(zOrder, /*LastDuplicateWins*/true))); -pZOrderHelper->addItem(xShapePropertySet, zOrder); +uno::Any(rZOrderHelper.findZOrder(zOrder, /*LastDuplicateWins*/true))); +rZOrderHelper.addItem(xShapePropertySet, zOrder); xShapePropertySet->setPropertyValue(getPropertyName( PROP_OPAQUE ), uno::Any( zOrder >= 0 ) ); checkZOrderStatus = true; } diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index c11717b4048a..bee20740278f 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@
core.git: Branch 'distro/collabora/co-23.05' - sd/source
sd/source/ui/dlg/headerfooterdlg.cxx | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) New commits: commit 5e7a86d54789252877072ec8d4c0812247bf1683 Author: Justin Luth AuthorDate: Tue Feb 27 09:57:35 2024 -0500 Commit: Miklos Vajna CommitDate: Thu Feb 29 08:23:36 2024 +0100 tdf#159927 sd headerfooterdlg: detect existing date/time language Sometimes it was hard to change an existing foreign language to your own language for Impress' header/footer fields. The function was only checking the first master slide for the date/time language. If it didn't have one, then the default locale was selected. However, although all pages share the same date/time language, it is not necessary for all (or even the first) master slide to have a date/time field. So check through all the master slides until one with a date/time is found. Obviously if none have one defined things still work OK, because that is effectively how it was working beforehand. A separate unit test was provided with https://gerrit.libreoffice.org/c/core/+/164070 Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164069 Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164077 Reviewed-by: Miklos Vajna diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 0c0786d3eebb..1f5ada44cf33 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -151,7 +151,8 @@ private: void FillFormatList(sal_Int32 nSelectedPos); void GetOrSetDateTimeLanguage( LanguageType , bool bSet ); -void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ); +// returns true if the page has a date/time field item +bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* pPage); public: HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); @@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -// get the language from the first master page -// or set it to all master pages -sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PageKind::Notes ) : 1; +const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) { -GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PageKind::Standard ) ); +SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, PageKind::Standard); +bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, pMasterSlide); + +// All pages must use the same language. If getting the language, only need to find one. +if (!bSet && bHasDateFieldItem) +break; } } } -void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ) +bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, + SdPage* pPage) { if( !pPage ) -return; +return false; SdrTextObj* pObj = static_cast(pPage->GetPresObj( PresObjKind::DateTime )); if( !pObj ) -return; +return false; Outliner* pOutl = mpDoc->GetInternalOutliner(); pOutl->Init( OutlinerMode::TextObject ); @@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo pOutl->Clear(); pOutl->Init( nOutlMode ); +return bHasDateFieldItem; } PresLayoutPreview::PresLayoutPreview()
core.git: sd/qa
sd/qa/uitest/data/tdf159927_dateTime.odp |binary sd/qa/uitest/impress_tests/tdf159927_dateTime.py | 28 +++ 2 files changed, 28 insertions(+) New commits: commit 0c643e8afdf8b0b929b603340979e771eeb9fc0b Author: Justin Luth AuthorDate: Tue Feb 27 13:45:38 2024 -0500 Commit: Justin Luth CommitDate: Wed Feb 28 03:32:51 2024 +0100 tdf#159927 unit test for impress date/time language detection make -srj1 UITest_impress_tests \ UITEST_TEST_NAME="tdf159927_dateTime.tdf159927.test_tdf159927" \ SAL_USE_VCLPLUGIN=gen Change-Id: Ic0f13fd7f7f427cc85f8f7c4d144ecfb5b722291 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164070 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sd/qa/uitest/data/tdf159927_dateTime.odp b/sd/qa/uitest/data/tdf159927_dateTime.odp new file mode 100644 index ..a04816608495 Binary files /dev/null and b/sd/qa/uitest/data/tdf159927_dateTime.odp differ diff --git a/sd/qa/uitest/impress_tests/tdf159927_dateTime.py b/sd/qa/uitest/impress_tests/tdf159927_dateTime.py new file mode 100644 index ..1a72d1997b75 --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf159927_dateTime.py @@ -0,0 +1,28 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +import time + +class tdf159927(UITestCase): + + def test_tdf159927(self): +with self.ui_test.load_file(get_url_for_data_file("tdf159927_dateTime.odp")) as document: + +with self.ui_test.execute_dialog_through_command(".uno:HeaderAndFooter", close_button="cancel") as xDialog: +language_list = xDialog.getChild("language_list") +# Expected: the existing language of the date/time field: Finnish +# Actual without the fix: the user's locale as specified in tools - options. + self.assertEqual(get_state_as_dict(language_list)["SelectEntryText"], "Finnish") + +#time.sleep(2) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
core.git: Branch 'distro/collabora/co-24.04' - sd/source
sd/source/ui/dlg/headerfooterdlg.cxx | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) New commits: commit 62ae4d01dd06629413af7316ffb6a8030acf83e9 Author: Justin Luth AuthorDate: Tue Feb 27 09:57:35 2024 -0500 Commit: Justin Luth CommitDate: Wed Feb 28 03:32:22 2024 +0100 tdf#159927 sd headerfooterdlg: detect existing date/time language Sometimes it was hard to change an existing foreign language to your own language for Impress' header/footer fields. The function was only checking the first master slide for the date/time language. If it didn't have one, then the default locale was selected. However, although all pages share the same date/time language, it is not necessary for all (or even the first) master slide to have a date/time field. So check through all the master slides until one with a date/time is found. Obviously if none have one defined things still work OK, because that is effectively how it was working beforehand. I don't have much hope for a successful unit test. I'll try to develop it as a follow-up to this patch. Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164069 Tested-by: Jenkins CollaboraOffice diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 8401ec38cd6e..92f7e9be1cb0 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -151,7 +151,8 @@ private: void FillFormatList(sal_Int32 nSelectedPos); void GetOrSetDateTimeLanguage( LanguageType , bool bSet ); -void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ); +// returns true if the page has a date/time field item +bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* pPage); public: HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); @@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -// get the language from the first master page -// or set it to all master pages -sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PageKind::Notes ) : 1; +const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) { -GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PageKind::Standard ) ); +SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, PageKind::Standard); +bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, pMasterSlide); + +// All pages must use the same language. If getting the language, only need to find one. +if (!bSet && bHasDateFieldItem) +break; } } } -void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ) +bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, + SdPage* pPage) { if( !pPage ) -return; +return false; SdrTextObj* pObj = static_cast(pPage->GetPresObj( PresObjKind::DateTime )); if( !pObj ) -return; +return false; Outliner* pOutl = mpDoc->GetInternalOutliner(); pOutl->Init( OutlinerMode::TextObject ); @@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo pOutl->Clear(); pOutl->Init( nOutlMode ); +return bHasDateFieldItem; } PresLayoutPreview::PresLayoutPreview()
core.git: sd/source
sd/source/ui/dlg/headerfooterdlg.cxx | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) New commits: commit 62323124f54885c6de4ac4fa38052d380309a5a1 Author: Justin Luth AuthorDate: Tue Feb 27 09:57:35 2024 -0500 Commit: Justin Luth CommitDate: Wed Feb 28 00:23:11 2024 +0100 tdf#159927 sd headerfooterdlg: detect existing date/time language Sometimes it was hard to change an existing foreign language to your own language for Impress' header/footer fields. The function was only checking the first master slide for the date/time language. If it didn't have one, then the default locale was selected. However, although all pages share the same date/time language, it is not necessary for all (or even the first) master slide to have a date/time field. So check through all the master slides until one with a date/time is found. Obviously if none have one defined things still work OK, because that is effectively how it was working beforehand. I don't have much hope for a successful unit test. I'll try to develop it as a follow-up to this patch. Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index 8401ec38cd6e..92f7e9be1cb0 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -151,7 +151,8 @@ private: void FillFormatList(sal_Int32 nSelectedPos); void GetOrSetDateTimeLanguage( LanguageType , bool bSet ); -void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ); +// returns true if the page has a date/time field item +bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* pPage); public: HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode ); @@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo } else { -// get the language from the first master page -// or set it to all master pages -sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( PageKind::Notes ) : 1; +const sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount(PageKind::Standard); sal_uInt16 nPage; for( nPage = 0; nPage < nPageCount; nPage++ ) { -GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( nPage, PageKind::Standard ) ); +SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, PageKind::Standard); +bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, pMasterSlide); + +// All pages must use the same language. If getting the language, only need to find one. +if (!bSet && bHasDateFieldItem) +break; } } } -void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* pPage ) +bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, + SdPage* pPage) { if( !pPage ) -return; +return false; SdrTextObj* pObj = static_cast(pPage->GetPresObj( PresObjKind::DateTime )); if( !pObj ) -return; +return false; Outliner* pOutl = mpDoc->GetInternalOutliner(); pOutl->Init( OutlinerMode::TextObject ); @@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , boo pOutl->Clear(); pOutl->Init( nOutlMode ); +return bHasDateFieldItem; } PresLayoutPreview::PresLayoutPreview()
core.git: oox/source
oox/source/drawingml/fillproperties.cxx |4 1 file changed, 4 insertions(+) New commits: commit 5920bc2d1a624021a6f3eb42a56ce9b96b53a39f Author: Justin Luth AuthorDate: Tue Feb 27 08:23:44 2024 -0500 Commit: Justin Luth CommitDate: Tue Feb 27 19:50:57 2024 +0100 address shortcoming: document why I avoided axials for transparency Hmm, I like to complain when other people don't comment on why certain situations are excluded, and yet I did the same thing here. Thanks vmiklos for pointing that out. Change-Id: I4c5ddeaeee078f036fc31149fc29bc6acb277ab3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164040 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index f24208722cb5..596e18f2176e 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -543,6 +543,10 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp // convert DrawingML angle (in 1/6 degrees) to API angle (in 1/10 degrees) aGradient.SetAngle(Degree10(static_cast< sal_Int16 >( (8100 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 ))); + +// If this is symmetrical, set it as an axial gradient for better UI/export. +// There were chart2 unit test failures when doing this to transparent gradients +// so just avoid that case. if (!bContainsTransparency) aGradient.tryToConvertToAxial(); }
core.git: Branch 'libreoffice-24-2' - include/svx svx/source sw/source
include/svx/sidebar/ValueSetWithTextControl.hxx |1 - svx/source/sidebar/tools/ValueSetWithTextControl.cxx |9 - sw/source/uibase/sidebar/PageSizeControl.cxx |1 - 3 files changed, 11 deletions(-) New commits: commit 759c9ea8e66b5fc1a362cf914055ac498fbbd80a Author: Justin Luth AuthorDate: Mon Feb 26 11:09:59 2024 -0500 Commit: Xisco Fauli CommitDate: Tue Feb 27 09:27:32 2024 +0100 tdf#159865 Revert "tdf#136905 NBB: let ValueSetWithTextControl set optimal" ...height This reverts my 24.2 commit 1876feb8a8805b2f80537e2828c152ccbdf67fe2. Change-Id: I70c3668393a13992f9ce489e86b07860218445b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163954 Tested-by: Justin Luth Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163961 Tested-by: Jenkins diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx b/include/svx/sidebar/ValueSetWithTextControl.hxx index 407e9606757f..ac397f9fdab6 100644 --- a/include/svx/sidebar/ValueSetWithTextControl.hxx +++ b/include/svx/sidebar/ValueSetWithTextControl.hxx @@ -40,7 +40,6 @@ public: SVX_DLLPRIVATE virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; -void SetOptimalDrawingAreaHeight(); void AddItem(const OUString& rItemText, const OUString& rItemText2); SVX_DLLPRIVATE virtual void UserDraw(const UserDrawEvent& rUDEvt) override; diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx index 91cea51325e6..b5b1f2be3ce9 100644 --- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx +++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx @@ -43,15 +43,6 @@ void ValueSetWithTextControl::SetDrawingArea(weld::DrawingArea* pDrawingArea) SetColCount(); } -void ValueSetWithTextControl::SetOptimalDrawingAreaHeight() -{ -const vcl::Font aFont(Application::GetSettings().GetStyleSettings().GetLabelFont()); -const sal_Int32 nRowHeight = aFont.GetFontSize().Height() * 9 / 4; // see UserDraw() -const Size aSize(GetOutputSizePixel().Width(), nRowHeight * maItems.size()); -GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); -SetOutputSizePixel(aSize); -} - void ValueSetWithTextControl::AddItem( const OUString& rItemText, const OUString& rItemText2 ) diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index 4ea5995c098f..a2dbe406f335 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -168,7 +168,6 @@ PageSizeControl::PageSizeControl(PageSizePopup* pControl, weld::Widget* pParent) } mxSizeValueSet->SetNoSelection(); mxSizeValueSet->SetSelectHdl( LINK(this, PageSizeControl, ImplSizeHdl ) ); -mxSizeValueSet->SetOptimalDrawingAreaHeight(); mxSizeValueSet->Show(); mxSizeValueSet->Resize();
core.git: sw/source
sw/source/filter/ww8/rtfattributeoutput.cxx | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) New commits: commit 6931d41640e31db4f1ad07afb48ec4df7086f6bb Author: Justin Luth AuthorDate: Mon Feb 26 15:28:10 2024 -0500 Commit: Miklos Vajna CommitDate: Tue Feb 27 08:45:44 2024 +0100 address nit: use boolean flag instead of minor copy/paste Change-Id: I380ca73047fecefd9b7ff508eb6f8bf8202b1b62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163969 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 0f2885068d12..36bb03149c06 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3760,13 +3760,11 @@ void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradie std::make_pair("fillAngle"_ostr, OString::number(nAngle))); } +bool bIsSymmetrical = true; if (rColorStops.size() < 3) { -if (rGradient.GetGradientStyle() == awt::GradientStyle_AXIAL) -{ -m_aFlyProperties.push_back( -std::make_pair("fillFocus"_ostr, OString::number(50))); -} +if (rGradient.GetGradientStyle() != awt::GradientStyle_AXIAL) +bIsSymmetrical = false; } else { @@ -3774,15 +3772,18 @@ void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradie // FillModel::pushToPropMap 'fFocus' value and usage. // The 2nd color is the in-between color, use it aMSOEndColor = Color(rColorStops[1].getStopColor()); - -m_aFlyProperties.push_back( -std::make_pair("fillFocus"_ostr, OString::number(50))); } m_aFlyProperties.push_back(std::make_pair( "fillColor"_ostr, OString::number(wwUtility::RGBToBGR(aMSOStartColor; m_aFlyProperties.push_back(std::make_pair( "fillBackColor"_ostr, OString::number(wwUtility::RGBToBGR(aMSOEndColor; + +if (bIsSymmetrical) +{ +m_aFlyProperties.push_back( +std::make_pair("fillFocus"_ostr, OString::number(50))); +} } void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox)
core.git: sw/source writerfilter/source
sw/source/filter/ww8/rtfattributeoutput.cxx |5 +++-- writerfilter/source/rtftok/rtfsdrimport.cxx |3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) New commits: commit 9348677e040927a736e70797d07bb1de32d729ca Author: Justin Luth AuthorDate: Mon Feb 26 15:20:11 2024 -0500 Commit: Miklos Vajna CommitDate: Tue Feb 27 08:45:03 2024 +0100 address nit: use oox::drawingml::PER_DEGREE instead of 60,000 Change-Id: Ie3ca5a76376a3c26f0d3079b6e819ec29afd2c17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163968 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 03fc0fa354cb..0f2885068d12 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -86,6 +86,7 @@ #include #include #include +#include #include #include #include @@ -3752,11 +3753,11 @@ void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradie const Color aMSOStartColor(rColorStops.back().getStopColor()); Color aMSOEndColor(rColorStops.front().getStopColor()); -const sal_Int32 nAngle = toDegrees(rGradient.GetAngle()); +const sal_Int32 nAngle = toDegrees(rGradient.GetAngle()) * oox::drawingml::PER_DEGREE; if (nAngle != 0) { m_aFlyProperties.push_back( -std::make_pair("fillAngle"_ostr, OString::number(nAngle * 6))); +std::make_pair("fillAngle"_ostr, OString::number(nAngle))); } if (rColorStops.size() < 3) diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 9c673e871835..812a8e69f318 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -42,6 +42,7 @@ #include "rtfreferenceproperties.hxx" #include #include +#include #include #include #include @@ -668,7 +669,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap } else if (rProperty.first == "fillAngle") { -aFillModel.moAngle = rProperty.second.toInt32() / 6; +aFillModel.moAngle = rProperty.second.toInt32() / oox::drawingml::PER_DEGREE; } else if (rProperty.first == "fillFocus") aFillModel.moFocus = rProperty.second.toDouble() / 100; // percent
core.git: sw/source
sw/source/filter/ww8/docxexport.cxx | 100 +++- sw/source/filter/ww8/docxexport.hxx |3 + 2 files changed, 56 insertions(+), 47 deletions(-) New commits: commit 2e073dc313cb2beaa7e4d2aef8584e7f76e9edee Author: Justin Luth AuthorDate: Mon Feb 26 14:24:14 2024 -0500 Commit: Miklos Vajna CommitDate: Tue Feb 27 08:44:16 2024 +0100 address nit: create separate WriteDocumentBackgroundFill function Change-Id: I4e204dfee51987112f1a4a4a052a11349ae3f373 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163966 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 787c90e32b12..f1331ce4141e 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1901,63 +1901,69 @@ bool DocxExport::isMirroredMargin() return bMirroredMargins; } -void DocxExport::WriteMainText() +void DocxExport::WriteDocumentBackgroundFill() { -// setup the namespaces -m_pDocumentFS->startElementNS( XML_w, XML_document, MainXmlNamespaces()); +const std::unique_ptr pBrush = getBackground(); +if (!pBrush) +return; -// reset the incrementing linked-textboxes chain ID before re-saving. -m_nLinkedTextboxesChainId=0; -m_aLinkedTextboxesHelper.clear(); +m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, XML_color), + msfilter::util::ConvertColor(pBrush->GetColor())); -// Write background page color -if (std::unique_ptr oBrush = getBackground(); oBrush) +const SwAttrSet& rPageStyleAttrSet = m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet(); +const drawing::FillStyle eFillType = rPageStyleAttrSet.Get(XATTR_FILLSTYLE).GetValue(); +const GraphicObject* pGraphicObj = pBrush->GetGraphicObject(); +if (pGraphicObj) // image/pattern/texture { -m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, XML_color), - msfilter::util::ConvertColor(oBrush->GetColor())); - -const SwAttrSet& rPageStyleAttrSet = m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet(); -const drawing::FillStyle eFillType = rPageStyleAttrSet.Get(XATTR_FILLSTYLE).GetValue(); -const GraphicObject* pGraphicObj = oBrush->GetGraphicObject(); -if (pGraphicObj) // image/pattern/texture +const OUString aRelId = m_pDrawingML->writeGraphicToStorage(pGraphicObj->GetGraphic()); +if (!aRelId.isEmpty()) { -const OUString aRelId = m_pDrawingML->writeGraphicToStorage(pGraphicObj->GetGraphic()); -if (!aRelId.isEmpty()) -{ -m_pDocumentFS->startElementNS(XML_v, XML_background); +m_pDocumentFS->startElementNS(XML_v, XML_background); -// Although MSO treats everything as tile, it is better for LO to not always tile -OString sType = "frame"_ostr; // single image -if (rPageStyleAttrSet.Get(XATTR_FILLBMP_TILE).GetValue()) -sType = "tile"_ostr; // primarily for patterns / textures -m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, XML_id), aRelId, -XML_type, sType); +// Although MSO treats everything as tile, it is better for LO to not always tile +OString sType = "frame"_ostr; // single image +if (rPageStyleAttrSet.Get(XATTR_FILLBMP_TILE).GetValue()) +sType = "tile"_ostr; // primarily for patterns / textures +m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, XML_id), aRelId, XML_type, + sType); -m_pDocumentFS->endElementNS(XML_v, XML_background); -} -} -else if (eFillType == drawing::FillStyle_GRADIENT) -{ -SfxItemSetFixed aSet(m_rDoc.GetAttrPool()); -aSet.Set(rPageStyleAttrSet); - -// Collect all of the gradient attributes into SdrExporter() AttrLists -m_pAttrOutput->OutputStyleItemSet(aSet, /*TestForDefault=*/true); -assert(SdrExporter().getFlyAttrList().is() && "type and fillcolor are always provided"); -assert(SdrExporter().getFlyFillAttrList().is() && "color2 is always provided"); - -rtl::Reference xFlyAttrList(SdrExporter().getFlyAttrList()); -rtl::Reference xFillAttrList(SdrExporter().getFlyFillAttrList()); -m_pDocumentFS->startElementNS(XML_v, XML_background, xFlyAttrList); -m_pDocumentFS->singleElementNS(XML_v, XML_fill, xFillAttrList); m_pDocumentFS->endElementNS(XML_v, XML_background); - -SdrExporter().getFlyAttrList().clear(); -SdrExporter().getFlyFillAttrList().clear(); } - -
core.git: oox/source sw/qa
oox/source/drawingml/fillproperties.cxx |2 + sw/qa/extras/ooxmlexport/ooxmlexport2.cxx | 30 +++ sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 26 +++- sw/qa/extras/rtfexport/rtfexport.cxx | 47 +++--- sw/qa/extras/rtfexport/rtfexport8.cxx | 15 + 5 files changed, 42 insertions(+), 78 deletions(-) New commits: commit 38083e4c0b5638d69162593c3fbf599da6cd499f Author: Justin Luth AuthorDate: Tue Feb 20 16:11:08 2024 -0500 Commit: Miklos Vajna CommitDate: Tue Feb 27 08:40:50 2024 +0100 related tdf#126533 dml/vml import: import radials as radials ... and not as symmetrical linear gradients. The benefit is that our export code will be able to intelligently export it. Apparently RTF export code does not intelligently export axials, (now fixed - tdf#159824) but VML and DML (and doc) do it well. Unfortunately charts can be badly affected, (avoided by ignoring when transparent) and unit tests are implementation-tested... This affects existing unit tests: -tdf128345_Legend_CS_TG_axial.pptx: label imports fine: lost on export (no change) -tdf128345_ChartWall_CS_TG.pptx: wall gradient now looks axial: lost on export (no change) -textframe-gradient.docx: still round-trips OK: no change -textframe-gradient.rtf: round-trips as linear: lost axial-ness (now fixed: tdf#159824) -fdo78663.docx: textbox font fill: still exports as solid: no change I ran the assert check against chart2, oox, and sw Change-Id: Ib16e9488a76b006bf335ff01a38acf7cde69cccb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163675 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index dec9ab9672cc..f24208722cb5 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -543,6 +543,8 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp // convert DrawingML angle (in 1/6 degrees) to API angle (in 1/10 degrees) aGradient.SetAngle(Degree10(static_cast< sal_Int16 >( (8100 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 ))); +if (!bContainsTransparency) +aGradient.tryToConvertToAxial(); } if (awt::GradientStyle_RECT == aGradient.GetGradientStyle()) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index f8defa15d1a2..72072bc5bb03 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -577,34 +577,16 @@ DECLARE_OOXMLEXPORT_TEST(testTextframeGradient, "textframe-gradient.docx") uno::Reference xFrame(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty(xFrame, "FillStyle")); awt::Gradient2 aGradient(getProperty(xFrame, "FillGradient")); - -// MCGR: Use the completely imported transparency gradient to check for correctness -basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops); - -CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); -CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); -CPPUNIT_ASSERT_EQUAL(Color(0xd99594), Color(aColorStops[0].getStopColor())); -CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); -CPPUNIT_ASSERT_EQUAL(Color(0xc0504d), Color(aColorStops[1].getStopColor())); -CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); -CPPUNIT_ASSERT_EQUAL(Color(0xd99594), Color(aColorStops[2].getStopColor())); -CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); +CPPUNIT_ASSERT_EQUAL(Color(0xC0504D), Color(ColorTransparency, aGradient.StartColor)); +CPPUNIT_ASSERT_EQUAL(Color(0xD99594), Color(ColorTransparency, aGradient.EndColor)); +CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style);; xFrame.set(getShape(2), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty(xFrame, "FillStyle")); aGradient = getProperty(xFrame, "FillGradient"); - -// MCGR: Use the completely imported transparency gradient to check for correctness -aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops); - -CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); -CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); -CPPUNIT_ASSERT_EQUAL(Color(0x66), Color(aColorStops[0].getStopColor())); -CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); -CPPUNIT_ASSERT_EQUAL(Color(0x00), Color(aColorStops[1].getStopColor())); -
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/ww8export/ww8export3.cxx |7 +++ sw/source/filter/ww8/wrtw8esh.cxx |5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) New commits: commit 9b6754db7659e8b192c36c36807729d6c37cf340 Author: Justin Luth AuthorDate: Mon Feb 26 09:56:11 2024 -0500 Commit: Miklos Vajna CommitDate: Tue Feb 27 08:38:07 2024 +0100 related tdf#126533 doc export: don't lose "tiled" aspect of image fill. This affects patterns as well as textures/images. make CppunitTest_sw_ww8export3 CPPUNIT_TEST_NAME=testTdf101826_xattrTextBoxFill Change-Id: I2742a6f333fc6688b3570772a1dbc8371741f210 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163948 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 93b14c1ba3afaf0a734ee5112444f0adbb35c428) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163970 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 97ea979d01e8..66c5ae5c471c 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -621,6 +622,12 @@ DECLARE_WW8EXPORT_TEST(testTdf101826_xattrTextBoxFill, "tdf101826_xattrTextBoxFi CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != getProperty(getShape(4), "BackColor")); //Basic Picture Fill: Tux image CPPUNIT_ASSERT_EQUAL_MESSAGE("background image", drawing::FillStyle_BITMAP, getProperty(getShape(5), "FillStyle")); +// Basic Pattern fill: many thin, green, vertical stripes on yellow background +auto eMode = getProperty(getShapeByName(u"Frame2"), "FillBitmapMode"); +CPPUNIT_ASSERT_EQUAL_MESSAGE("tiled pattern", drawing::BitmapMode_REPEAT, eMode); +// Basic Texture fill: tiled blue denim texture +eMode = getProperty(getShapeByName(u"Frame6"), "FillBitmapMode"); +CPPUNIT_ASSERT_EQUAL_MESSAGE("tiled texture", drawing::BitmapMode_REPEAT, eMode); } DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc") diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 19ac50ccf5c9..f9e1082f9276 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1849,8 +1849,9 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem , nOpaque = 255 - pGraphicObject->GetAttr().GetAlpha(); if (0 != nOpaque) bSetOpacity = true; - -rPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture ); +const ESCHER_FillStyle eFillType += rBrush.GetGraphicPos() == GPOS_TILED ? ESCHER_FillTexture : ESCHER_FillPicture; +rPropOpt.AddOpt(ESCHER_Prop_fillType, eFillType); rPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 ); rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 ); }
core.git: include/svx svx/source sw/source
include/svx/sidebar/ValueSetWithTextControl.hxx |1 - svx/source/sidebar/tools/ValueSetWithTextControl.cxx | 11 --- sw/source/uibase/sidebar/PageSizeControl.cxx |1 - 3 files changed, 13 deletions(-) New commits: commit 7c3cdc88337959ddbb9799c4cee57901e94719f3 Author: Justin Luth AuthorDate: Mon Feb 26 11:09:59 2024 -0500 Commit: Justin Luth CommitDate: Mon Feb 26 18:55:51 2024 +0100 tdf#159865 Revert "tdf#136905 NBB: let ValueSetWithTextControl set optimal" ...height This reverts my 24.2 commit 1876feb8a8805b2f80537e2828c152ccbdf67fe2 (as well as my initial attempt to fix it in 24.8). Change-Id: I70c3668393a13992f9ce489e86b07860218445b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163954 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx b/include/svx/sidebar/ValueSetWithTextControl.hxx index 407e9606757f..ac397f9fdab6 100644 --- a/include/svx/sidebar/ValueSetWithTextControl.hxx +++ b/include/svx/sidebar/ValueSetWithTextControl.hxx @@ -40,7 +40,6 @@ public: SVX_DLLPRIVATE virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; -void SetOptimalDrawingAreaHeight(); void AddItem(const OUString& rItemText, const OUString& rItemText2); SVX_DLLPRIVATE virtual void UserDraw(const UserDrawEvent& rUDEvt) override; diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx index d55740315c99..cddd7b0aa801 100644 --- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx +++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx @@ -42,17 +42,6 @@ void ValueSetWithTextControl::SetDrawingArea(weld::DrawingArea* pDrawingArea) SetColCount(); } -void ValueSetWithTextControl::SetOptimalDrawingAreaHeight() -{ -const vcl::Font aFont(Application::GetSettings().GetStyleSettings().GetLabelFont()); -double fRowHeight = aFont.GetFontSize().Height() * 9 / 4.0; // see UserDraw() -// It still looks too small. Probably the height specified should be the leading point size? -fRowHeight *= 1.2; // add 20% leading -const Size aSize(GetOutputSizePixel().Width(), fRowHeight * maItems.size()); -GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); -SetOutputSizePixel(aSize); -} - void ValueSetWithTextControl::AddItem( const OUString& rItemText, const OUString& rItemText2 ) diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index 2591ffd99718..37ed1835e972 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -168,7 +168,6 @@ PageSizeControl::PageSizeControl(PageSizePopup* pControl, weld::Widget* pParent) } mxSizeValueSet->SetNoSelection(); mxSizeValueSet->SetSelectHdl( LINK(this, PageSizeControl, ImplSizeHdl ) ); -mxSizeValueSet->SetOptimalDrawingAreaHeight(); mxSizeValueSet->Show(); mxSizeValueSet->Resize();
core.git: sw/qa sw/source
sw/qa/extras/ww8export/ww8export3.cxx |7 +++ sw/source/filter/ww8/wrtw8esh.cxx |5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) New commits: commit 589ac948c0650a16c734db7337c6c31b950be151 Author: Justin Luth AuthorDate: Mon Feb 26 09:56:11 2024 -0500 Commit: Justin Luth CommitDate: Mon Feb 26 17:16:55 2024 +0100 related tdf#126533 doc export: don't lose "tiled" aspect of image fill. This affects patterns as well as textures/images. make CppunitTest_sw_ww8export3 CPPUNIT_TEST_NAME=testTdf101826_xattrTextBoxFill Change-Id: I2742a6f333fc6688b3570772a1dbc8371741f210 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163948 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 97ea979d01e8..66c5ae5c471c 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -621,6 +622,12 @@ DECLARE_WW8EXPORT_TEST(testTdf101826_xattrTextBoxFill, "tdf101826_xattrTextBoxFi CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != getProperty(getShape(4), "BackColor")); //Basic Picture Fill: Tux image CPPUNIT_ASSERT_EQUAL_MESSAGE("background image", drawing::FillStyle_BITMAP, getProperty(getShape(5), "FillStyle")); +// Basic Pattern fill: many thin, green, vertical stripes on yellow background +auto eMode = getProperty(getShapeByName(u"Frame2"), "FillBitmapMode"); +CPPUNIT_ASSERT_EQUAL_MESSAGE("tiled pattern", drawing::BitmapMode_REPEAT, eMode); +// Basic Texture fill: tiled blue denim texture +eMode = getProperty(getShapeByName(u"Frame6"), "FillBitmapMode"); +CPPUNIT_ASSERT_EQUAL_MESSAGE("tiled texture", drawing::BitmapMode_REPEAT, eMode); } DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc") diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 7931387e32fa..55c140e2a7c9 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1849,8 +1849,9 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem , nOpaque = 255 - pGraphicObject->GetAttr().GetAlpha(); if (0 != nOpaque) bSetOpacity = true; - -rPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture ); +const ESCHER_FillStyle eFillType += rBrush.GetGraphicPos() == GPOS_TILED ? ESCHER_FillTexture : ESCHER_FillPicture; +rPropOpt.AddOpt(ESCHER_Prop_fillType, eFillType); rPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 ); rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 ); }
core.git: Branch 'distro/collabora/co-24.04' - oox/source sw/qa sw/source
oox/source/vml/vmlformatting.cxx | 17 ++-- sw/qa/extras/ooxmlexport/data/tdf126533_axialAngle2.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport7.cxx| 27 +- sw/qa/extras/rtfexport/data/tdf159824_gradientAngle3.rtf | 17 sw/qa/extras/rtfexport/data/tdf159824_gradientAngle4.rtf | 17 sw/qa/extras/rtfexport/rtfexport8.cxx| 62 +-- sw/source/filter/ww8/docxattributeoutput.cxx | 23 ++--- sw/source/filter/ww8/rtfattributeoutput.cxx | 37 8 files changed, 153 insertions(+), 47 deletions(-) New commits: commit 8d3f85cf1d1eaa489b468c66dee465f67e0a5fe1 Author: Justin Luth AuthorDate: Thu Feb 22 09:24:12 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 09:08:29 2024 +0100 related tdf#126533 tdf#159824 VML: don't export: negative angles and stop an automatic 180 reversal on import. Some documents had gradient reversals on every round trip, typically when the angle was 0-179 (mainly seen in ODT examples, since DOCX/RTF imports defaulted to be angle 180). The negative sign has special meaning, indicating that the start and end colors should be swapped. Well, swapping colors was not intentional in the export logic. Previously there was a mistaken idea that any angles > 180 needed to be swapped on import, and likely that is what prompted this overly complicated formula to try to avoid any angle > 180 during export by allowing negative angles. This tdf#126533 patchset has already eliminated import checks for angles > 180, so now a sane formula can be applied on export. In order to do that, we have to avoid emulating color swaps with 180 degree rotations at import time. So ONLY do color swapping with start/end, and leave the angle alone. That GREATLY helps unit tests (which otherwise would flip-flop the angle and the color start/stop). Very unhelpful was an undocumented, indecipherable inversion when converting to DML angle. Boy, I hope I got this right... make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_gradientAngle3 make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_gradientAngle4 make CppunitTest_sw_ooxmlexport7 \ CPPUNIT_TEST_NAME=testTdf126533_axialAngle2 Eliminating the inversion for ooxml7 test is fine since inversion does nothing to an axial. Otherwise, eliminating inversions corresponds to a color swap. Change-Id: I2aae0a7595807569ffc740689ff3840692d6159d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163798 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163871 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index f4022d0639d6..5fb422e63b9d 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -800,22 +800,29 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& } else// focus of -100%, 0%, and 100% is linear gradient { +// LO linear gradients: top == start, but for MSO bottom == start == moColor +bool bSwapColors = true; + /* According to spec, a focus of -100% or 100% swaps the start and stop colors, effectively reversing the gradient. If the angle was provided as a negative, then the colors are also (again) reversed. */ if( fFocus < -0.5 || fFocus > 0.5 ) -nVmlAngle = (nVmlAngle + 180) % 360; +bSwapColors = !bSwapColors; if (moAngle.value_or(0) < 0) -nVmlAngle = (nVmlAngle + 180) % 360; +bSwapColors = !bSwapColors; +const Color& rStartColor = bSwapColors ? aColor2 : aColor1; +const Color& rEndColor = bSwapColors ? aColor1 : aColor2; // set the start and stop colors -lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 0.0, aColor1 ); -lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 1.0, aColor2 ); + lcl_setGradientStop(aFillProps.maGradientProps.maGradientStops, 0.0, +rStartColor); + lcl_setGradientStop(aFillProps.maGradientProps.maGradientStops, 1.0, +rEndColor); }
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source writerfilter/source
sw/qa/extras/rtfexport/data/tdf159824_gradientAngle1.rtf | 17 sw/qa/extras/rtfexport/data/tdf159824_gradientAngle2.rtf | 17 sw/qa/extras/rtfexport/rtfexport8.cxx| 57 +-- sw/source/filter/ww8/rtfattributeoutput.cxx |9 ++ writerfilter/source/rtftok/rtfsdrimport.cxx |4 + 5 files changed, 97 insertions(+), 7 deletions(-) New commits: commit 64398a41f7d4110b58f0496f1237a6778772b05c Author: Justin Luth AuthorDate: Wed Feb 21 16:37:31 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 09:06:28 2024 +0100 related tdf#159824 RTF import/export gradient angle The fillAngle is important for obvious visual reasons, but also significantly because a negative angle means that the start/end colors should be swapped (which is the normal case since LO's 0 degree angle == -180 VML/RTF angle). There were no existing unit tests with a "fillAngle" specified, or with a non-180 angle (0 VML/RTF angle) in LO. make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_gradientAngle1 make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_gradientAngle2 make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_axialGradient Change-Id: I4bb2c47bd2a79833d11bedac72ba2152b65b7c73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163714 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163870 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle1.rtf b/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle1.rtf new file mode 100644 index ..37fd8ae2e339 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle1.rtf @@ -0,0 +1,17 @@ +{ tf1nsi\deff3deflang1025 + +\landscape\paperh5940\paperw8391 + +{ +\shp{\*\shpinst\shptop382\shpbottom2737\shpleft759\shpright5064 +{\sp{\sn shapeType}{\sv 202}} +{\sp{\sn fillType}{\sv 7}} +{\sp{\sn fillAngle}{\sv 6}} +{\sp{\sn fillFocus}{\sv 0}} +{\sp{\sn fillColor}{\sv 1758337}} +{\sp{\sn fillBackColor}{\sv 16777215}} + +{\shptxt\par \pard}} +} + +\par } diff --git a/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle2.rtf b/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle2.rtf new file mode 100644 index ..223864f3281b --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle2.rtf @@ -0,0 +1,17 @@ +{ tf1nsi\deff3deflang1025 + +\landscape\paperh5940\paperw8391 + +{ +\shp{\*\shpinst\shptop382\shpbottom2737\shpleft759\shpright5064 +{\sp{\sn shapeType}{\sv 202}} +{\sp{\sn fillType}{\sv 7}} +{\sp{\sn fillAngle}{\sv -12}} +{\sp{\sn fillFocus}{\sv 0}} +{\sp{\sn fillColor}{\sv 1758337}} +{\sp{\sn fillBackColor}{\sv 16777215}} + +{\shptxt\par \pard}} +} + +\par } diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index ab787919dfa9..c0b8cbad9a0a 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -195,8 +195,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159824_axialGradient) getProperty(xFrame, "FillStyle")); awt::Gradient2 aGradient = getProperty(xFrame, "FillGradient"); -//const Color aColA(0x127622); // green -//const Color aColB(0xff); // white +const Color aColA(0x127622); // green +const Color aColB(0xff); // white // MCGR: Use the completely imported transparency gradient to check for correctness basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops); @@ -205,11 +205,54 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159824_axialGradient) CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); -//CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[0].getStopColor())); -// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); -// CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[1].getStopColor())); -// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); -// CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[2].getStopColor())); +CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[0].getStopColor())); +CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); +CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[1].getStopColor())); +CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); +CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[2].getStopColor())); +} + +DECLARE_RTFEXPORT_TEST(testTdf159824_gradientAngle1, "tdf159824_gradientAngle1.rtf") +{ +// given a frame with a white (top) to lime (bottom) linear gradient at an RTF 1° angle +
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt |binary sw/qa/extras/rtfexport/rtfexport8.cxx | 34 sw/source/filter/ww8/rtfattributeoutput.cxx |6 ++ 3 files changed, 40 insertions(+) New commits: commit ffaf75303273c3803cce58f887b5fb8bd570ff18 Author: Justin Luth AuthorDate: Wed Feb 21 11:52:36 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 09:03:14 2024 +0100 tdf#159824 MCGR rtf export: don't lose gradient's axial-ness This fixes alg's 7.6 regression from commit bb198176684c3d9377e26c04a29ec66deb811949 Found when trying to import these strung-out-linears as real axials. make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_axialGradient Change-Id: I220f1bf689b4b219bc0ae187e95aedb1a29a7233 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163705 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163869 Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt b/sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt new file mode 100644 index ..c1ce5cd31d2a Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index c78298c0..ab787919dfa9 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -10,6 +10,8 @@ #include #include +#include +#include #include #include #include @@ -21,7 +23,9 @@ #include #include +#include #include +#include #include #include @@ -178,6 +182,36 @@ DECLARE_RTFEXPORT_TEST(testTdf158826_extraCR, "tdf158826_extraCR.rtf") uno::Reference xTable(getParagraphOrTable(1), uno::UNO_QUERY_THROW); } +CPPUNIT_TEST_FIXTURE(Test, testTdf159824_axialGradient) +{ +// given a frame with an axial gradient (white - green - white) +loadAndReload("tdf159824_axialGradient.odt"); + +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); +uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, + getProperty(xFrame, "FillStyle")); +awt::Gradient2 aGradient = getProperty(xFrame, "FillGradient"); + +//const Color aColA(0x127622); // green +//const Color aColB(0xff); // white + +// MCGR: Use the completely imported transparency gradient to check for correctness +basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops); + +// expected: a 3-color linear gradient (or better yet a 2-color AXIAL gradient) +CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); +CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); +CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); +//CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[0].getStopColor())); +// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); +// CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[1].getStopColor())); +// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); +// CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[2].getStopColor())); +} + DECLARE_RTFEXPORT_TEST(testTdf158830, "tdf158830.rtf") { //check centered text in table diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 2d68556e8a23..05e1cbc2cd22 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3747,6 +3747,12 @@ void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradie const Color aEndColor(rColorStops.back().getStopColor()); m_aFlyProperties.push_back(std::make_pair( "fillBackColor"_ostr, OString::number(wwUtility::RGBToBGR(aEndColor; + +if (rGradient.GetGradientStyle() == awt::GradientStyle_AXIAL) +{ +m_aFlyProperties.push_back( +std::make_pair("fillFocus"_ostr, OString::number(50))); +} } else {
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport7.cxx|3 -- sw/source/filter/ww8/docxattributeoutput.cxx | 32 +-- 2 files changed, 25 insertions(+), 10 deletions(-) New commits: commit 8881c7935e79290fedfed812715605d17dde9d22 Author: Justin Luth AuthorDate: Tue Feb 20 22:41:22 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 09:00:52 2024 +0100 related tdf#126533 vml export: fix axial colors This is a follow-up from the earlier tdf#65295 clone which removed swapping colors on IMport for axials. Well, tdf#65295 had also removed EXport swap for the linear case, so, now that import doesn't swap, remove the axial export swap too. Additionally, some linear gradients are actually axials, so identify those symmetrical gradients that have identical start/end colors to avoid exporting as a "solid" color. [I tried changing the import to detect it was an axial, but got RTF export failures, chart2 false positives, and unit-test-the-implementation failures.] make CppunitTest_sw_ooxmlexport7 \ CPPUNIT_TEST_NAME=testTdf126533_negativeAxialAngle The only other unit test that hit this code was textframe-gradient.docx - which is dominated by DML import/export. I can see with Word 2003 that this patch fixes the VML export for this unit test file also. Change-Id: I75e993c7c127a861617b14072a98778ddde03a08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163676 Tested-by: Justin Luth Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163868 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index ef4bcb2d..a362cb36c221 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -642,9 +642,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf77219_backgroundShape, "tdf77219_backgroundShape DECLARE_OOXMLEXPORT_TEST(testTdf126533_negativeAxialAngle, "tdf126533_negativeAxialAngle.docx") { -if (isExported()) -return; - // axiel gradient is purple foreground/lime background in the middle (top-left to bottom-right) uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index c04a86ab4e55..334e521aba04 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -9653,16 +9653,34 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad switch (rGradient.GetGradientStyle()) { case css::awt::GradientStyle_AXIAL: -AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient"); -AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), XML_focus, "50%" ); -// If it is an 'axial' gradient - swap the colors -// (because in the import process they were imported swapped) -sColor1 = sEndColor; -sColor2 = sStartColor; -break; case css::awt::GradientStyle_LINEAR: +{ +bool bIsSymmetrical = rGradient.GetGradientStyle() == css::awt::GradientStyle_AXIAL; +if (!bIsSymmetrical) +{ +const basegfx::BColorStops& rColorStops = rGradient.GetColorStops(); +if (rColorStops.size() > 2 && rColorStops.isSymmetrical()) +{ +for (auto& rStop : rColorStops) +{ +if (basegfx::fTools::less(rStop.getStopOffset(), 0.5)) +continue; +if (basegfx::fTools::more(rStop.getStopOffset(), 0.5)) +break; + +// the color in the middle is considered the start color for focus 50 +sColor1 = msfilter::util::ConvertColor(Color(rStop.getStopColor())); +bIsSymmetrical = true; +} +} +} + +if (bIsSymmetrical) +AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), XML_focus, "50%" ); + AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient"); break; +} case css::awt::GradientStyle_RADIAL: case css::awt::GradientStyle_ELLIPTICAL: case css::awt::GradientStyle_SQUARE:
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |4 sw/source/filter/ww8/docxattributeoutput.cxx | 18 +++--- 2 files changed, 15 insertions(+), 7 deletions(-) New commits: commit 7ee5904a12b55eb3abbdf5d0d46f57ffdb7158c7 Author: Justin Luth AuthorDate: Wed Feb 14 10:48:08 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 08:59:03 2024 +0100 related tdf#126533 DOCX: vml export gradientRadial instead of gradient ... for everything except the linear gradients (linear/axial) Interestingly, there was nothing in make sw.check that hit this. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_pageGradient Change-Id: Id58ed8b312ec29a10ce461ff0e032838b745b11b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163470 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163867 Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index b9b04eafb0f1..fcdd26b22924 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -9,6 +9,7 @@ #include +#include #include #include #include @@ -80,6 +81,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageGradient, "fill.docx") uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty(xPageStyle, "FillStyle")); + +awt::Gradient2 aGradient = getProperty(xPageStyle, "FillGradient"); +CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RECT, aGradient.Style); } DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageBitmap, "tdf126533_pageBitmap.docx") diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 03ada68bcb2d..c04a86ab4e55 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -9632,8 +9632,6 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad { if (m_oFillStyle && *m_oFillStyle == drawing::FillStyle_GRADIENT && !m_rExport.SdrExporter().getDMLTextFrameSyntax()) { -AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient" ); - const basegfx::BGradient& rGradient = rFillGradient.GetGradientValue(); OString sStartColor = msfilter::util::ConvertColor(Color(rGradient.GetColorStops().front().getStopColor())); OString sEndColor = msfilter::util::ConvertColor(Color(rGradient.GetColorStops().back().getStopColor())); @@ -9655,17 +9653,23 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad switch (rGradient.GetGradientStyle()) { case css::awt::GradientStyle_AXIAL: +AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient"); AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), XML_focus, "50%" ); // If it is an 'axial' gradient - swap the colors // (because in the import process they were imported swapped) sColor1 = sEndColor; sColor2 = sStartColor; break; -case css::awt::GradientStyle_LINEAR: break; -case css::awt::GradientStyle_RADIAL: break; -case css::awt::GradientStyle_ELLIPTICAL: break; -case css::awt::GradientStyle_SQUARE: break; -case css::awt::GradientStyle_RECT: break; +case css::awt::GradientStyle_LINEAR: +AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient"); +break; +case css::awt::GradientStyle_RADIAL: +case css::awt::GradientStyle_ELLIPTICAL: +case css::awt::GradientStyle_SQUARE: +case css::awt::GradientStyle_RECT: +AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, + "gradientRadial"); +break; default: break; }
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |3 +-- sw/source/filter/ww8/docxexport.cxx| 21 + 2 files changed, 22 insertions(+), 2 deletions(-) New commits: commit aca1125350e68d94906074fc075b079d4460ae7f Author: Justin Luth AuthorDate: Tue Feb 13 13:58:08 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 08:55:59 2024 +0100 tdf#126533 DOCX: export page vml fill gradient Simplistic export of gradient fill. I just used the existing docxattribute stuff that textboxes use to export their background as VML fallback. Note that docxattribute only knows how to export gradient, not gradientRadial. (Done in follow-up patch.) Lots of stuff is missing in terms of properly supporting gradients. But likely fixing page background will fix the same problem in textboxes etc. Given how incredibly different LO and MSO are in terms of gradients, it makes sense to commit this change and at least get the basics wired in. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_pageGradient Change-Id: I2ac14fdef2fe29609bc8d5a5d8f65b3f0da71889 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163469 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163866 Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index d4bc37d5f700..b9b04eafb0f1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -73,10 +73,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_noPageBitmap, "tdf126533_noPageBitmap.doc getProperty(xPageStyle, "FillStyle")); } -CPPUNIT_TEST_FIXTURE(Test, testTdf126533_pageGradient) +DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageGradient, "fill.docx") { // given a document with a gradient page background -loadFromFile(u"fill.docx"); uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index a4c06ab5ac5b..e84bbc48eb20 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -55,6 +55,7 @@ #include #include +#include #include #include @@ -1916,6 +1917,7 @@ void DocxExport::WriteMainText() msfilter::util::ConvertColor(oBrush->GetColor())); const SwAttrSet& rPageStyleAttrSet = m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet(); +const drawing::FillStyle eFillType = rPageStyleAttrSet.Get(XATTR_FILLSTYLE).GetValue(); const GraphicObject* pGraphicObj = oBrush->GetGraphicObject(); if (pGraphicObj) // image/pattern/texture { @@ -1934,6 +1936,25 @@ void DocxExport::WriteMainText() m_pDocumentFS->endElementNS(XML_v, XML_background); } } +else if (eFillType == drawing::FillStyle_GRADIENT) +{ +SfxItemSetFixed aSet(m_rDoc.GetAttrPool()); +aSet.Set(rPageStyleAttrSet); + +// Collect all of the gradient attributes into SdrExporter() AttrLists +m_pAttrOutput->OutputStyleItemSet(aSet, /*TestForDefault=*/true); +assert(SdrExporter().getFlyAttrList().is() && "type and fillcolor are always provided"); +assert(SdrExporter().getFlyFillAttrList().is() && "color2 is always provided"); + +rtl::Reference xFlyAttrList(SdrExporter().getFlyAttrList()); +rtl::Reference xFillAttrList(SdrExporter().getFlyFillAttrList()); +m_pDocumentFS->startElementNS(XML_v, XML_background, xFlyAttrList); +m_pDocumentFS->singleElementNS(XML_v, XML_fill, xFillAttrList); +m_pDocumentFS->endElementNS(XML_v, XML_background); + +SdrExporter().getFlyAttrList().clear(); +SdrExporter().getFlyFillAttrList().clear(); +} m_pDocumentFS->endElementNS(XML_w, XML_background); }
core.git: Branch 'distro/collabora/co-24.04' - oox/source sw/qa
oox/source/vml/vmlformatting.cxx| 27 +++--- sw/qa/extras/ooxmlexport/data/tdf126533_negativeAxialAngle.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 45 ++ 3 files changed, 61 insertions(+), 11 deletions(-) New commits: commit 2c97f30c6aeaddfb9942a1906f182a7704fbf093 Author: Justin Luth AuthorDate: Wed Feb 14 18:16:29 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 08:49:09 2024 +0100 related tdf#126533 vml import: fix gradient color swapping tdf#65295 already fixed one case by removing the test for degrees > 180 for the linear-equivalent gradients. Unfortunately the comment wasn't also removed, so that was confusing: removed comment. The test for degrees > 180 is not needed for the axial-equivalent case either: removed. The reason for that degrees > 180 case is likely due to negative degrees, which is a documented reason for swapping the colors: added swap if negative degrees. All the affected, existing unit tests are improved now: -tdf81345.docx: famous MS example: improved header gradient -fdo78300.docx: fontworks: hard to tell without MCGR... make CppunitTest_sw_ooxmlexport7 \ CPPUNIT_TEST_NAME=testTdf126533_negativeAxialAngle make CppunitTest_sw_ooxmlexport7 \ CPPUNIT_TEST_NAME=testTdf77219_backgroundShape Change-Id: I9f4d56375bb2cec28ffbd93df419d586da465b78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163417 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163865 Tested-by: Jenkins CollaboraOffice diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 6182950973ee..f4022d0639d6 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -777,15 +777,18 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& sal_Int32 nVmlAngle = getIntervalValue< sal_Int32, sal_Int32 >( moAngle.value_or( 0 ), 0, 360 ); // focus of -50% or 50% is axial gradient +// so approximate anything with a similar focus by using LO's axial gradient, +// (otherwise drop the radial aspect; linear gradient becomes the closest match) if( ((-0.75 <= fFocus) && (fFocus <= -0.25)) || ((0.25 <= fFocus) && (fFocus <= 0.75)) ) { -/* According to spec, focus of 50% is outer-to-inner, +/* According to spec, a focus of positive 50% is outer-to-inner, and -50% is inner-to-outer (color to color2). -BUT: For angles >= 180 deg., the behaviour is -reversed... that's not spec'ed of course. So, -[0;180) deg. and 50%, or [180;360) deg. and -50% is -outer-to-inner in fact. */ -bool bOuterToInner = (fFocus > 0.0) == (nVmlAngle < 180); +If the angle was provided as a negative, +then the colors are also (again) reversed. */ +bool bOuterToInner = fFocus > 0.0; +if (moAngle.value_or(0) < 0) +bOuterToInner = !bOuterToInner; + // simulate axial gradient by 3-step DrawingML gradient const Color& rOuterColor = bOuterToInner ? aColor1 : aColor2; const Color& rInnerColor = bOuterToInner ? aColor2 : aColor1; @@ -797,13 +800,15 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& } else// focus of -100%, 0%, and 100% is linear gradient { -/* According to spec, focus of -100% or 100% swaps the -start and stop colors, effectively reversing the -gradient. BUT: For angles >= 180 deg., the -behaviour is reversed. This means that in this case -a focus of 0% swaps the gradient. */ +/* According to spec, a focus of -100% or 100% swaps the +start and stop colors, effectively reversing the gradient. +If the angle was provided as a negative, +then the colors are also (again) reversed. */ if( fFocus < -0.5 || fFocus > 0.5 ) nVmlAngle = (nVmlAngle + 180) % 360; +if (moAngle.value_or(0) < 0) +nVmlAngle = (nVmlAngle + 180) % 360; + // set the start and stop colors
core.git: Branch 'distro/collabora/co-24.04' - oox/source sw/qa
oox/source/vml/vmlformatting.cxx | 48 sw/qa/extras/tiledrendering/data/tdf159626_blackPatternFill.docx |binary sw/qa/extras/tiledrendering/data/tdf159626_yellowPatternFill.docx |binary sw/qa/extras/tiledrendering/data/tdf159626_yellowPatternFillB.docx |binary sw/qa/extras/tiledrendering/tiledrendering.cxx | 97 ++ 5 files changed, 145 insertions(+) New commits: commit a1055563a0b72d470fa0e8ab6cd12d1e58932b40 Author: Justin Luth AuthorDate: Wed Feb 7 17:25:50 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 08:48:41 2024 +0100 tdf#159626 vml pattern import: add color, fix back/foreground This depends on tdf#126533 which imports page style v:fill, BUT ONLY IN ORDER TO support the unit tests. The patch itself can stand alone and fixes vml import into textboxes/shapes etc. i.e. backporting could be possible by dropping the unit tests. The pattern that VML uses to indicate foreground and background is very different from what LO needs. [Fortunately LO does not use the _guess_ from vcl::bitmap::isHistorical8x8 to determine which color is the background. Instead it always uses the first pixel.] Documentation says that unspecified XML_fillcolor and XML_color should be white, but observation says it should be 25% gray (Word 2003). 25% gray == C0C0C0 == fillcolor="silver" == COL_LIGHTGRAY Currently, we simply export as a colored, tiled image, and not as a B type="pattern" so no corresponding export changes need to be made to export. Existing unit test documents that are affected: -chart2export's PieChartDataLabels.docx (page background) -ooxmlexport5's fdo77725.docx (minimized PieChartDataLabels.docx) * both foreground and background are set to white => solid white -sw/qa/core/data/ooxml/pass/fdo79131.docx (shape "inline") make CppunitTest_sw_tiledrendering \ CPPUNIT_TEST_NAME=testTdf159626_yellowPatternFill make CppunitTest_sw_tiledrendering \ CPPUNIT_TEST_NAME=testTdf159626_yellowPatternFillB make CppunitTest_sw_tiledrendering \ CPPUNIT_TEST_NAME=testTdf159626_blackPatternFill Change-Id: I9533ac4a7489081ffc62a10e900f5526abb906db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163106 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163864 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 029d5429d921..6182950973ee 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -29,6 +29,7 @@ #include #include #include + #include #include #include @@ -46,6 +47,8 @@ #include #include #include +#include +#include #include namespace oox::vml { @@ -843,6 +846,51 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& aFillProps.maBlipProps.mxFillGraphic = rGraphicHelper.importEmbeddedGraphic(moBitmapPath.value()); if (aFillProps.maBlipProps.mxFillGraphic.is()) { +if (nFillType == XML_pattern) +{ +// VML provides an 8x8 black(background) and white(foreground) pattern +// along with specified background(color2) and foreground(color) colors, +// while LO needs the color applied directly to the pattern. +const Graphic aGraphic(aFillProps.maBlipProps.mxFillGraphic); +::Color nBackColor; +::Color nPixelColor; +bool bIs8x8 = vcl::bitmap::isHistorical8x8(aGraphic.GetBitmapEx(), + nBackColor, nPixelColor); +if (bIs8x8) +{ +nBackColor += ConversionHelper::decodeColor(rGraphicHelper, moColor2, + moOpacity2, API_RGB_WHITE) + .getColor(rGraphicHelper); +// Documentation says undefined == white; observation says lightgray +nPixelColor += ConversionHelper::decodeColor(rGraphicHelper, moColor, +moOpacity, COL_LIGHTGRAY) + .getColor(rGraphicHelper); + +XOBitmap aXOB(aGraphic.GetBitmapEx()); +aXOB.Bitmap2Array(); +//
core.git: Branch 'distro/collabora/co-24.04' - sw/source
sw/source/filter/ww8/docxexport.cxx |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) New commits: commit 57244c2096782dbedfd55cea5629ae08433e204a Author: Justin Luth AuthorDate: Fri Feb 9 17:26:52 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 08:43:38 2024 +0100 tdf#126533 docx export: page background vml fill: tiles/patterns This patch only benefits LO. MSO ignores "frame" and always treats page background as it if were tiled, but that is a trait we do NOT want to mimic. Textures are the primary fill type that needs to be tiled (instead of scaled/stretched). LO export also treats patterns as tiled bitmaps, and the end result of exporting as a tile looks the same as the original pattern. It just loses HOW the page background (i.e. as a pattern) but that is very low value. It is rather difficult to export as a true pattern and just not worth the effort of identifying the correct fore/background colors, converting to b image, and inverting the B image if the first pixel is white instead of black. [Hatching seems similar to patterns, but rarely (and only coincidentally) would it tile well. I think hatching is a new DML-only thing. Hatching is not in the page background UI of MS Word. LO just exports any hatching as a solid color.] Change-Id: I5cd3f1c6e380edb5e5b21900bad289fa298574e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163206 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163863 Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 46e66a4a42a0..a4c06ab5ac5b 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -55,6 +55,7 @@ #include #include +#include #include #include @@ -1914,6 +1915,7 @@ void DocxExport::WriteMainText() m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, XML_color), msfilter::util::ConvertColor(oBrush->GetColor())); +const SwAttrSet& rPageStyleAttrSet = m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet(); const GraphicObject* pGraphicObj = oBrush->GetGraphicObject(); if (pGraphicObj) // image/pattern/texture { @@ -1922,8 +1924,12 @@ void DocxExport::WriteMainText() { m_pDocumentFS->startElementNS(XML_v, XML_background); +// Although MSO treats everything as tile, it is better for LO to not always tile +OString sType = "frame"_ostr; // single image +if (rPageStyleAttrSet.Get(XATTR_FILLBMP_TILE).GetValue()) +sType = "tile"_ostr; // primarily for patterns / textures m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, XML_id), aRelId, -XML_type, "frame"); +XML_type, sType); m_pDocumentFS->endElementNS(XML_v, XML_background); }
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf126533_pageBitmap.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 16 +++ sw/source/filter/ww8/docxexport.cxx | 22 +--- sw/source/filter/ww8/rtfexport.cxx |3 +- sw/source/filter/ww8/wrtww8.cxx |2 - 5 files changed, 37 insertions(+), 6 deletions(-) New commits: commit 9e623d8d0a1896e679a48b84459dc3b316636aba Author: Justin Luth AuthorDate: Fri Feb 9 15:43:32 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 08:42:51 2024 +0100 tdf#126533 docx export: page background vml fill: basic image This is the absolute minimal possible combination to export an image to page background. However, none of the other properties that I see strike me as particularly important or connected to our image properties. Plus MSO ignores things like "frame" and tiles anyway. Import is also pretty basic, so any improvement to imports can also add the corresponding export component. For example: it seems like MSO tiles all images based on somewhat magical sizing (they do always export o:targetscreensize="999,999" which we ignore). But note that MSO does pixel display and not logical display for page background - something we do NOT want to emulate, so any importing of properties needs to be done intelligently. But MSO's UI only allows for basic image insertion, so very few files will have complex settings. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_pageBitmap Change-Id: Ib410594d1e3377aefb8ee94f209a1a1155154b17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163203 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163862 Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/ooxmlexport/data/tdf126533_pageBitmap.docx b/sw/qa/extras/ooxmlexport/data/tdf126533_pageBitmap.docx new file mode 100644 index ..67131acd2fd8 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf126533_pageBitmap.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index ca0cc5438ee6..d4bc37d5f700 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -83,6 +83,22 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126533_pageGradient) getProperty(xPageStyle, "FillStyle")); } +DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageBitmap, "tdf126533_pageBitmap.docx") +{ +// given a document with a page background image +uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, + getProperty(xPageStyle, "FillStyle")); + +if (!isExported()) +return; + +xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); +assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Target='media/image1.jpeg']"_ostr, 1); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index e7c1972ce9c0..46e66a4a42a0 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1911,11 +1911,25 @@ void DocxExport::WriteMainText() // Write background page color if (std::unique_ptr oBrush = getBackground(); oBrush) { -Color backgroundColor = oBrush->GetColor(); -OString aBackgroundColorStr = msfilter::util::ConvertColor(backgroundColor); +m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, XML_color), + msfilter::util::ConvertColor(oBrush->GetColor())); -m_pDocumentFS->singleElementNS(XML_w, XML_background, FSNS(XML_w, XML_color), - aBackgroundColorStr); +const GraphicObject* pGraphicObj = oBrush->GetGraphicObject(); +if (pGraphicObj) // image/pattern/texture +{ +const OUString aRelId = m_pDrawingML->writeGraphicToStorage(pGraphicObj->GetGraphic()); +if (!aRelId.isEmpty()) +{ +m_pDocumentFS->startElementNS(XML_v, XML_background); + +m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, XML_id), aRelId, +XML_type, "frame"); + +m_pDocumentFS->endElementNS(XML_v, XML_background); +} +} + +m_pDocumentFS->endElementNS(XML_w, XML_background); } // body diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index
core.git: Branch 'distro/collabora/co-24.04' - oox/source sw/qa writerfilter/source
oox/source/vml/vmlshapecontext.cxx|1 sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx| 21 + writerfilter/source/dmapper/DomainMapper.cxx | 58 ++ writerfilter/source/dmapper/DomainMapper_Impl.hxx |1 writerfilter/source/dmapper/PropertyMap.cxx | 33 +++ writerfilter/source/ooxml/model.xml |3 7 files changed, 115 insertions(+), 2 deletions(-) New commits: commit ec36ecb408bd77f1fa2d823454968f50d32f745c Author: Justin Luth AuthorDate: Sat Feb 3 10:08:56 2024 -0500 Commit: Miklos Vajna CommitDate: Mon Feb 26 08:42:19 2024 +0100 tdf#126533 docx import: page background vml fill This patch imports bitmaps/tiled textures (primarily), but also somewhat for gradients (because of a gradient2 -> gradient mismatch somewhere) and somewhat for patterns (because patterns are not well imported in general). Note that the imported fill likely will NOT match MSO, because their background CHANGES BASED ON THE ZOOM LEVEL. For example, my primary testing file (A6 landscape) has a logo which is only 25% visible in Word 2003 at 100%, but shows 90% of the logo at 200%, and many tiles of logos when exported as PDF. The same is true for gradients etc. Changing background on zoom is an absolutely bizarre implementation, and naturally LO could only accidentally look identical (and should never try to do so). make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_noPageBitmap make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_pageGradient This is slightly ugly, but I don't know how to make a COPY of the XPropertySet UNO junk. All I have is references, and dispose deletes everything, even the references. I took some inspiration from RTF which just disposes the shape after grabbing the background color. Thus, just change the page style known to exist and be used, and then simply remove the fill if it isn't needed in the end. Any new page styles can just copy the default page style fill. Change-Id: Id3ea002c685642ff4c289982d0108247a6e9bb8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162958 Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163861 Tested-by: Jenkins CollaboraOffice Reviewed-by: Justin Luth diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index e3242368a334..20ce2fa37434 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -251,6 +251,7 @@ ContextHandlerRef ShapeContextBase::createShapeContext( ContextHandler2Helper co return new ShapeContext( rParent, rShapes.createShape< BezierShape >(), rAttribs ); else return new ShapeContext( rParent, rShapes.createShape< ComplexShape >(), rAttribs ); +case VML_TOKEN(background): case VML_TOKEN( rect ): return new RectangleShapeContext( rParent, rAttribs, rShapes.createShape< RectangleShape >() ); case VML_TOKEN( roundrect ): diff --git a/sw/qa/core/data/ooxml/pass/fill.docx b/sw/qa/extras/ooxmlexport/data/fill.docx similarity index 100% rename from sw/qa/core/data/ooxml/pass/fill.docx rename to sw/qa/extras/ooxmlexport/data/fill.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx b/sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx new file mode 100644 index ..87dfff296be5 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index cdcdfe778577..ca0cc5438ee6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -62,6 +63,26 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159207_footerFramePrBorder) // TODO: there SHOULD BE a top border, and even if loaded, it would be lost on re-import... } +DECLARE_OOXMLEXPORT_TEST(testTdf126533_noPageBitmap, "tdf126533_noPageBitmap.docx") +{ +// given a document with a v:background bitmap, but no w:background fillcolor +uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); +// the image (or any fill for that matter) should be ignored. +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, + getProperty(xPageStyle, "FillStyle")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf126533_pageGradient) +{ +// given a document with a gradient page background +
core.git: svx/source
svx/source/sidebar/tools/ValueSetWithTextControl.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 72986a5e505f8b62b30aa890c136e07cef3f9a2b Author: Justin Luth AuthorDate: Sat Feb 24 10:04:13 2024 -0500 Commit: Justin Luth CommitDate: Sat Feb 24 18:14:54 2024 +0100 tdf#159865 tdf#136905 NBB: font looked too small in page size choices This fixes my 24.2 regression from commit 1876feb8a8805b2f80537e2828c152ccbdf67fe2 I considered reverting it, but decided to tweak the font size instead. If I reverted, the size of the choices was displayed in 16pt font. I wanted to keep the sizing as "scientific" as possible, but fixing the rounding issues didn't really make the font stand out as much as desired. In this case, my system font of 11 became 10 for the page size dialog, due to rounding, which is still a significant 10%. Although that still looks too small, it seems fairly close to the other button on the notebook bar, at least to my eyes. But it is definitely smaller/less clear than the "more option" button. Perhaps it has to do with the visible size of a font compared to the full size (with leading)? Fonts are often sized as 11/13 or 12/14 for example. Adding 20% to the font size makes it look about right. In my case, it ends up chosing a font height of 13. Change-Id: Ic0a7296aa74be542e2a38ce52cf5fd23e5d8c7f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163886 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx index 8919140b5d07..d55740315c99 100644 --- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx +++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx @@ -45,8 +45,10 @@ void ValueSetWithTextControl::SetDrawingArea(weld::DrawingArea* pDrawingArea) void ValueSetWithTextControl::SetOptimalDrawingAreaHeight() { const vcl::Font aFont(Application::GetSettings().GetStyleSettings().GetLabelFont()); -const sal_Int32 nRowHeight = aFont.GetFontSize().Height() * 9 / 4; // see UserDraw() -const Size aSize(GetOutputSizePixel().Width(), nRowHeight * maItems.size()); +double fRowHeight = aFont.GetFontSize().Height() * 9 / 4.0; // see UserDraw() +// It still looks too small. Probably the height specified should be the leading point size? +fRowHeight *= 1.2; // add 20% leading +const Size aSize(GetOutputSizePixel().Width(), fRowHeight * maItems.size()); GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); SetOutputSizePixel(aSize); }
core.git: writerfilter/source
writerfilter/source/rtftok/rtfsdrimport.cxx | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) New commits: commit fe84ced08668ef0030fbd37bea52424fd86c8e7a Author: Justin Luth AuthorDate: Fri Feb 9 13:40:10 2024 -0500 Commit: Justin Luth CommitDate: Sat Feb 24 13:14:03 2024 +0100 tdf#126533 rtf import: page background fill I worked on this mainly to see what the impact of the docx changes would be on RTF. It seemed to be OK. This patch shows that RTF can now import gradient page backgrounds. It does NOT import image backgrounds (at least no the ones I tested) because they were specified as XML_sn: fillBlip XML_sv: which is an unknown property in RTFSdrImport::resolve. The only fill type that RTFSdrImport::resolve knows about is XML_gradient. The only existing unit test I noted was page-background.rtf Change-Id: Ie40b91468d21b29a102472c859cd1eecfcb2a5f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163199 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 031f24117d00..9c673e871835 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -1136,18 +1136,6 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap return; } -if (m_rImport.isInBackground()) -{ -RTFSprms aAttributes; -aAttributes.set(NS_ooxml::LN_CT_Background_color, -new RTFValue(xPropertySet->getPropertyValue("FillColor").get())); -m_rImport.Mapper().props(new RTFReferenceProperties(std::move(aAttributes))); - -uno::Reference xComponent(xShape, uno::UNO_QUERY); -xComponent->dispose(); -return; -} - // Send it to dmapper if (xShape.is()) { @@ -1158,6 +1146,13 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap } } +if (m_rImport.isInBackground()) +{ +RTFSprms aSprms; +aSprms.set(NS_ooxml::LN_background_background, new RTFValue()); // action="end" +m_rImport.Mapper().props(new RTFReferenceProperties(RTFSprms(), std::move(aSprms))); +} + // If the shape has an inner shape, the inner object's properties should not be influenced by // the outer one. rShape.getProperties().clear();
core.git: oox/source sw/qa sw/source
oox/source/vml/vmlformatting.cxx | 17 ++-- sw/qa/extras/ooxmlexport/data/tdf126533_axialAngle2.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport7.cxx| 27 +- sw/qa/extras/rtfexport/data/tdf159824_gradientAngle3.rtf | 17 sw/qa/extras/rtfexport/data/tdf159824_gradientAngle4.rtf | 17 sw/qa/extras/rtfexport/rtfexport8.cxx| 62 +-- sw/source/filter/ww8/docxattributeoutput.cxx | 23 ++--- sw/source/filter/ww8/rtfattributeoutput.cxx | 37 8 files changed, 153 insertions(+), 47 deletions(-) New commits: commit 6dd6891a3deed8718bf2b0fcf564f229f676f8ba Author: Justin Luth AuthorDate: Thu Feb 22 09:24:12 2024 -0500 Commit: Justin Luth CommitDate: Fri Feb 23 20:28:31 2024 +0100 related tdf#126533 tdf#159824 VML: don't export: negative angles and stop an automatic 180 reversal on import. Some documents had gradient reversals on every round trip, typically when the angle was 0-179 (mainly seen in ODT examples, since DOCX/RTF imports defaulted to be angle 180). The negative sign has special meaning, indicating that the start and end colors should be swapped. Well, swapping colors was not intentional in the export logic. Previously there was a mistaken idea that any angles > 180 needed to be swapped on import, and likely that is what prompted this overly complicated formula to try to avoid any angle > 180 during export by allowing negative angles. This tdf#126533 patchset has already eliminated import checks for angles > 180, so now a sane formula can be applied on export. In order to do that, we have to avoid emulating color swaps with 180 degree rotations at import time. So ONLY do color swapping with start/end, and leave the angle alone. That GREATLY helps unit tests (which otherwise would flip-flop the angle and the color start/stop). Very unhelpful was an undocumented, indecipherable inversion when converting to DML angle. Boy, I hope I got this right... make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_gradientAngle3 make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_gradientAngle4 make CppunitTest_sw_ooxmlexport7 \ CPPUNIT_TEST_NAME=testTdf126533_axialAngle2 Eliminating the inversion for ooxml7 test is fine since inversion does nothing to an axial. Otherwise, eliminating inversions corresponds to a color swap. Change-Id: I2aae0a7595807569ffc740689ff3840692d6159d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163798 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index f4022d0639d6..5fb422e63b9d 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -800,22 +800,29 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& } else// focus of -100%, 0%, and 100% is linear gradient { +// LO linear gradients: top == start, but for MSO bottom == start == moColor +bool bSwapColors = true; + /* According to spec, a focus of -100% or 100% swaps the start and stop colors, effectively reversing the gradient. If the angle was provided as a negative, then the colors are also (again) reversed. */ if( fFocus < -0.5 || fFocus > 0.5 ) -nVmlAngle = (nVmlAngle + 180) % 360; +bSwapColors = !bSwapColors; if (moAngle.value_or(0) < 0) -nVmlAngle = (nVmlAngle + 180) % 360; +bSwapColors = !bSwapColors; +const Color& rStartColor = bSwapColors ? aColor2 : aColor1; +const Color& rEndColor = bSwapColors ? aColor1 : aColor2; // set the start and stop colors -lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 0.0, aColor1 ); -lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 1.0, aColor2 ); + lcl_setGradientStop(aFillProps.maGradientProps.maGradientStops, 0.0, +rStartColor); + lcl_setGradientStop(aFillProps.maGradientProps.maGradientStops, 1.0, +rEndColor); } // VML counts counterclockwise from bottom, DrawingML clockwise from left -sal_Int32 nDmlAngle = (630 - nVmlAngle)
core.git: sw/qa sw/source writerfilter/source
sw/qa/extras/rtfexport/data/tdf159824_gradientAngle1.rtf | 17 sw/qa/extras/rtfexport/data/tdf159824_gradientAngle2.rtf | 17 sw/qa/extras/rtfexport/rtfexport8.cxx| 57 +-- sw/source/filter/ww8/rtfattributeoutput.cxx |9 ++ writerfilter/source/rtftok/rtfsdrimport.cxx |4 + 5 files changed, 97 insertions(+), 7 deletions(-) New commits: commit 695f8fb19d839efe03a402d2a7e7ef73b6d8f436 Author: Justin Luth AuthorDate: Wed Feb 21 16:37:31 2024 -0500 Commit: Justin Luth CommitDate: Fri Feb 23 20:28:05 2024 +0100 related tdf#159824 RTF import/export gradient angle The fillAngle is important for obvious visual reasons, but also significantly because a negative angle means that the start/end colors should be swapped (which is the normal case since LO's 0 degree angle == -180 VML/RTF angle). There were no existing unit tests with a "fillAngle" specified, or with a non-180 angle (0 VML/RTF angle) in LO. make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_gradientAngle1 make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_gradientAngle2 make CppunitTest_sw_rtfexport8 \ CPPUNIT_TEST_NAME=testTdf159824_axialGradient Change-Id: I4bb2c47bd2a79833d11bedac72ba2152b65b7c73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163714 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle1.rtf b/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle1.rtf new file mode 100644 index ..37fd8ae2e339 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle1.rtf @@ -0,0 +1,17 @@ +{ tf1nsi\deff3deflang1025 + +\landscape\paperh5940\paperw8391 + +{ +\shp{\*\shpinst\shptop382\shpbottom2737\shpleft759\shpright5064 +{\sp{\sn shapeType}{\sv 202}} +{\sp{\sn fillType}{\sv 7}} +{\sp{\sn fillAngle}{\sv 6}} +{\sp{\sn fillFocus}{\sv 0}} +{\sp{\sn fillColor}{\sv 1758337}} +{\sp{\sn fillBackColor}{\sv 16777215}} + +{\shptxt\par \pard}} +} + +\par } diff --git a/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle2.rtf b/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle2.rtf new file mode 100644 index ..223864f3281b --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf159824_gradientAngle2.rtf @@ -0,0 +1,17 @@ +{ tf1nsi\deff3deflang1025 + +\landscape\paperh5940\paperw8391 + +{ +\shp{\*\shpinst\shptop382\shpbottom2737\shpleft759\shpright5064 +{\sp{\sn shapeType}{\sv 202}} +{\sp{\sn fillType}{\sv 7}} +{\sp{\sn fillAngle}{\sv -12}} +{\sp{\sn fillFocus}{\sv 0}} +{\sp{\sn fillColor}{\sv 1758337}} +{\sp{\sn fillBackColor}{\sv 16777215}} + +{\shptxt\par \pard}} +} + +\par } diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index ab787919dfa9..c0b8cbad9a0a 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -195,8 +195,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159824_axialGradient) getProperty(xFrame, "FillStyle")); awt::Gradient2 aGradient = getProperty(xFrame, "FillGradient"); -//const Color aColA(0x127622); // green -//const Color aColB(0xff); // white +const Color aColA(0x127622); // green +const Color aColB(0xff); // white // MCGR: Use the completely imported transparency gradient to check for correctness basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops); @@ -205,11 +205,54 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf159824_axialGradient) CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); -//CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[0].getStopColor())); -// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); -// CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[1].getStopColor())); -// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); -// CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[2].getStopColor())); +CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[0].getStopColor())); +CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); +CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[1].getStopColor())); +CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); +CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[2].getStopColor())); +} + +DECLARE_RTFEXPORT_TEST(testTdf159824_gradientAngle1, "tdf159824_gradientAngle1.rtf") +{ +// given a frame with a white (top) to lime (bottom) linear gradient at an RTF 1° angle +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), +
core.git: Branch 'libreoffice-24-2' - sw/qa sw/source
sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt |binary sw/qa/extras/rtfexport/rtfexport8.cxx | 34 sw/source/filter/ww8/rtfattributeoutput.cxx |6 ++ 3 files changed, 40 insertions(+) New commits: commit bb207d7816c2d32d02ee11ff784d405d2bb5de0f Author: Justin Luth AuthorDate: Wed Feb 21 11:52:36 2024 -0500 Commit: Michael Stahl CommitDate: Fri Feb 23 17:41:15 2024 +0100 tdf#159824 MCGR rtf export: don't lose gradient's axial-ness This fixes alg's 7.6 regression from commit bb198176684c3d9377e26c04a29ec66deb811949 Found when trying to import these strung-out-linears as real axials. make CppunitTest_sw_rtfexport \ CPPUNIT_TEST_NAME=testTdf159824_axialGradient Change-Id: I220f1bf689b4b219bc0ae187e95aedb1a29a7233 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163705 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna (cherry picked from commit 9ba68c769d41d1075152a22bf37e78fb9320317b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163769 Reviewed-by: Michael Stahl diff --git a/sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt b/sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt new file mode 100644 index ..c1ce5cd31d2a Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index c78298c0..ab787919dfa9 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -10,6 +10,8 @@ #include #include +#include +#include #include #include #include @@ -21,7 +23,9 @@ #include #include +#include #include +#include #include #include @@ -178,6 +182,36 @@ DECLARE_RTFEXPORT_TEST(testTdf158826_extraCR, "tdf158826_extraCR.rtf") uno::Reference xTable(getParagraphOrTable(1), uno::UNO_QUERY_THROW); } +CPPUNIT_TEST_FIXTURE(Test, testTdf159824_axialGradient) +{ +// given a frame with an axial gradient (white - green - white) +loadAndReload("tdf159824_axialGradient.odt"); + +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); +uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, + getProperty(xFrame, "FillStyle")); +awt::Gradient2 aGradient = getProperty(xFrame, "FillGradient"); + +//const Color aColA(0x127622); // green +//const Color aColB(0xff); // white + +// MCGR: Use the completely imported transparency gradient to check for correctness +basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops); + +// expected: a 3-color linear gradient (or better yet a 2-color AXIAL gradient) +CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); +CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); +CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); +//CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[0].getStopColor())); +// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); +// CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[1].getStopColor())); +// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); +// CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[2].getStopColor())); +} + DECLARE_RTFEXPORT_TEST(testTdf158830, "tdf158830.rtf") { //check centered text in table diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 8635022bad24..7dcda8f73fb2 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3754,6 +3754,12 @@ void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradie const Color aEndColor(rColorStops.back().getStopColor()); m_aFlyProperties.push_back(std::make_pair( "fillBackColor"_ostr, OString::number(wwUtility::RGBToBGR(aEndColor; + +if (rGradient.GetGradientStyle() == awt::GradientStyle_AXIAL) +{ +m_aFlyProperties.push_back( +std::make_pair("fillFocus"_ostr, OString::number(50))); +} } else {
core.git: sw/qa sw/source
sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt |binary sw/qa/extras/rtfexport/rtfexport8.cxx | 34 sw/source/filter/ww8/rtfattributeoutput.cxx |6 ++ 3 files changed, 40 insertions(+) New commits: commit 9ba68c769d41d1075152a22bf37e78fb9320317b Author: Justin Luth AuthorDate: Wed Feb 21 11:52:36 2024 -0500 Commit: Miklos Vajna CommitDate: Fri Feb 23 11:01:19 2024 +0100 tdf#159824 MCGR rtf export: don't lose gradient's axial-ness This fixes alg's 7.6 regression from commit bb198176684c3d9377e26c04a29ec66deb811949 Found when trying to import these strung-out-linears as real axials. make CppunitTest_sw_rtfexport \ CPPUNIT_TEST_NAME=testTdf159824_axialGradient Change-Id: I220f1bf689b4b219bc0ae187e95aedb1a29a7233 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163705 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt b/sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt new file mode 100644 index ..c1ce5cd31d2a Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf159824_axialGradient.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index c78298c0..ab787919dfa9 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -10,6 +10,8 @@ #include #include +#include +#include #include #include #include @@ -21,7 +23,9 @@ #include #include +#include #include +#include #include #include @@ -178,6 +182,36 @@ DECLARE_RTFEXPORT_TEST(testTdf158826_extraCR, "tdf158826_extraCR.rtf") uno::Reference xTable(getParagraphOrTable(1), uno::UNO_QUERY_THROW); } +CPPUNIT_TEST_FIXTURE(Test, testTdf159824_axialGradient) +{ +// given a frame with an axial gradient (white - green - white) +loadAndReload("tdf159824_axialGradient.odt"); + +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); +uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, + getProperty(xFrame, "FillStyle")); +awt::Gradient2 aGradient = getProperty(xFrame, "FillGradient"); + +//const Color aColA(0x127622); // green +//const Color aColB(0xff); // white + +// MCGR: Use the completely imported transparency gradient to check for correctness +basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops); + +// expected: a 3-color linear gradient (or better yet a 2-color AXIAL gradient) +CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); +CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); +CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); +//CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[0].getStopColor())); +// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); +// CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[1].getStopColor())); +// CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); +// CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[2].getStopColor())); +} + DECLARE_RTFEXPORT_TEST(testTdf158830, "tdf158830.rtf") { //check centered text in table diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 6d9271417fda..cdf6d5ce9bd1 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3751,6 +3751,12 @@ void RtfAttributeOutput::FormatFillGradient(const XFillGradientItem& rFillGradie const Color aEndColor(rColorStops.back().getStopColor()); m_aFlyProperties.push_back(std::make_pair( "fillBackColor"_ostr, OString::number(wwUtility::RGBToBGR(aEndColor; + +if (rGradient.GetGradientStyle() == awt::GradientStyle_AXIAL) +{ +m_aFlyProperties.push_back( +std::make_pair("fillFocus"_ostr, OString::number(50))); +} } else {
core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport7.cxx|3 -- sw/source/filter/ww8/docxattributeoutput.cxx | 32 +-- 2 files changed, 25 insertions(+), 10 deletions(-) New commits: commit b8071eef3b40c9fb2b161901aba9d9105317441f Author: Justin Luth AuthorDate: Tue Feb 20 22:41:22 2024 -0500 Commit: Miklos Vajna CommitDate: Fri Feb 23 10:58:18 2024 +0100 related tdf#126533 vml export: fix axial colors This is a follow-up from the earlier tdf#65295 clone which removed swapping colors on IMport for axials. Well, tdf#65295 had also removed EXport swap for the linear case, so, now that import doesn't swap, remove the axial export swap too. Additionally, some linear gradients are actually axials, so identify those symmetrical gradients that have identical start/end colors to avoid exporting as a "solid" color. [I tried changing the import to detect it was an axial, but got RTF export failures, chart2 false positives, and unit-test-the-implementation failures.] make CppunitTest_sw_ooxmlexport7 \ CPPUNIT_TEST_NAME=testTdf126533_negativeAxialAngle The only other unit test that hit this code was textframe-gradient.docx - which is dominated by DML import/export. I can see with Word 2003 that this patch fixes the VML export for this unit test file also. Change-Id: I75e993c7c127a861617b14072a98778ddde03a08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163676 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index ef4bcb2d..a362cb36c221 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -642,9 +642,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf77219_backgroundShape, "tdf77219_backgroundShape DECLARE_OOXMLEXPORT_TEST(testTdf126533_negativeAxialAngle, "tdf126533_negativeAxialAngle.docx") { -if (isExported()) -return; - // axiel gradient is purple foreground/lime background in the middle (top-left to bottom-right) uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 787908091589..8f4c8fb3dcb7 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -9648,16 +9648,34 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad switch (rGradient.GetGradientStyle()) { case css::awt::GradientStyle_AXIAL: -AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient"); -AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), XML_focus, "50%" ); -// If it is an 'axial' gradient - swap the colors -// (because in the import process they were imported swapped) -sColor1 = sEndColor; -sColor2 = sStartColor; -break; case css::awt::GradientStyle_LINEAR: +{ +bool bIsSymmetrical = rGradient.GetGradientStyle() == css::awt::GradientStyle_AXIAL; +if (!bIsSymmetrical) +{ +const basegfx::BColorStops& rColorStops = rGradient.GetColorStops(); +if (rColorStops.size() > 2 && rColorStops.isSymmetrical()) +{ +for (auto& rStop : rColorStops) +{ +if (basegfx::fTools::less(rStop.getStopOffset(), 0.5)) +continue; +if (basegfx::fTools::more(rStop.getStopOffset(), 0.5)) +break; + +// the color in the middle is considered the start color for focus 50 +sColor1 = msfilter::util::ConvertColor(Color(rStop.getStopColor())); +bIsSymmetrical = true; +} +} +} + +if (bIsSymmetrical) +AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), XML_focus, "50%" ); + AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient"); break; +} case css::awt::GradientStyle_RADIAL: case css::awt::GradientStyle_ELLIPTICAL: case css::awt::GradientStyle_SQUARE:
core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |4 sw/source/filter/ww8/docxattributeoutput.cxx | 18 +++--- 2 files changed, 15 insertions(+), 7 deletions(-) New commits: commit 1a4639dd8024484971859bcce31470584bc6b973 Author: Justin Luth AuthorDate: Wed Feb 14 10:48:08 2024 -0500 Commit: Miklos Vajna CommitDate: Fri Feb 23 10:57:11 2024 +0100 related tdf#126533 DOCX: vml export gradientRadial instead of gradient ... for everything except the linear gradients (linear/axial) Interestingly, there was nothing in make sw.check that hit this. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_pageGradient Change-Id: Id58ed8b312ec29a10ce461ff0e032838b745b11b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163470 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index d2bd3440a90b..2e6c10c99031 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -384,6 +385,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageGradient, "fill.docx") uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty(xPageStyle, "FillStyle")); + +awt::Gradient2 aGradient = getProperty(xPageStyle, "FillGradient"); +CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RECT, aGradient.Style); } DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageBitmap, "tdf126533_pageBitmap.docx") diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index c2b7ea47d395..787908091589 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -9627,8 +9627,6 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad { if (m_oFillStyle && *m_oFillStyle == drawing::FillStyle_GRADIENT && !m_rExport.SdrExporter().getDMLTextFrameSyntax()) { -AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient" ); - const basegfx::BGradient& rGradient = rFillGradient.GetGradientValue(); OString sStartColor = msfilter::util::ConvertColor(Color(rGradient.GetColorStops().front().getStopColor())); OString sEndColor = msfilter::util::ConvertColor(Color(rGradient.GetColorStops().back().getStopColor())); @@ -9650,17 +9648,23 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad switch (rGradient.GetGradientStyle()) { case css::awt::GradientStyle_AXIAL: +AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient"); AddToAttrList( m_rExport.SdrExporter().getFlyFillAttrList(), XML_focus, "50%" ); // If it is an 'axial' gradient - swap the colors // (because in the import process they were imported swapped) sColor1 = sEndColor; sColor2 = sStartColor; break; -case css::awt::GradientStyle_LINEAR: break; -case css::awt::GradientStyle_RADIAL: break; -case css::awt::GradientStyle_ELLIPTICAL: break; -case css::awt::GradientStyle_SQUARE: break; -case css::awt::GradientStyle_RECT: break; +case css::awt::GradientStyle_LINEAR: +AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, "gradient"); +break; +case css::awt::GradientStyle_RADIAL: +case css::awt::GradientStyle_ELLIPTICAL: +case css::awt::GradientStyle_SQUARE: +case css::awt::GradientStyle_RECT: +AddToAttrList(m_rExport.SdrExporter().getFlyFillAttrList(), XML_type, + "gradientRadial"); +break; default: break; }
core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |3 +-- sw/source/filter/ww8/docxexport.cxx| 21 + 2 files changed, 22 insertions(+), 2 deletions(-) New commits: commit f3efd1dc397e2801a30e705120a21a4e384596ec Author: Justin Luth AuthorDate: Tue Feb 13 13:58:08 2024 -0500 Commit: Miklos Vajna CommitDate: Fri Feb 23 10:56:07 2024 +0100 tdf#126533 DOCX: export page vml fill gradient Simplistic export of gradient fill. I just used the existing docxattribute stuff that textboxes use to export their background as VML fallback. Note that docxattribute only knows how to export gradient, not gradientRadial. (Done in follow-up patch.) Lots of stuff is missing in terms properly supporting gradients. But likely fixing page background will fix the same problem in textboxes etc. Given how incredibly different LO and MSO are in terms of gradients, it makes sense to commit this change and at least get the basics wired in. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_pageGradient Change-Id: I2ac14fdef2fe29609bc8d5a5d8f65b3f0da71889 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163469 Reviewed-by: Justin Luth Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 224f8f2aa27d..d2bd3440a90b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -377,10 +377,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_noPageBitmap, "tdf126533_noPageBitmap.doc getProperty(xPageStyle, "FillStyle")); } -CPPUNIT_TEST_FIXTURE(Test, testTdf126533_pageGradient) +DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageGradient, "fill.docx") { // given a document with a gradient page background -loadFromFile(u"fill.docx"); uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 466fe652d5dd..787c90e32b12 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -55,6 +55,7 @@ #include #include +#include #include #include @@ -1916,6 +1917,7 @@ void DocxExport::WriteMainText() msfilter::util::ConvertColor(oBrush->GetColor())); const SwAttrSet& rPageStyleAttrSet = m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet(); +const drawing::FillStyle eFillType = rPageStyleAttrSet.Get(XATTR_FILLSTYLE).GetValue(); const GraphicObject* pGraphicObj = oBrush->GetGraphicObject(); if (pGraphicObj) // image/pattern/texture { @@ -1934,6 +1936,25 @@ void DocxExport::WriteMainText() m_pDocumentFS->endElementNS(XML_v, XML_background); } } +else if (eFillType == drawing::FillStyle_GRADIENT) +{ +SfxItemSetFixed aSet(m_rDoc.GetAttrPool()); +aSet.Set(rPageStyleAttrSet); + +// Collect all of the gradient attributes into SdrExporter() AttrLists +m_pAttrOutput->OutputStyleItemSet(aSet, /*TestForDefault=*/true); +assert(SdrExporter().getFlyAttrList().is() && "type and fillcolor are always provided"); +assert(SdrExporter().getFlyFillAttrList().is() && "color2 is always provided"); + +rtl::Reference xFlyAttrList(SdrExporter().getFlyAttrList()); +rtl::Reference xFillAttrList(SdrExporter().getFlyFillAttrList()); +m_pDocumentFS->startElementNS(XML_v, XML_background, xFlyAttrList); +m_pDocumentFS->singleElementNS(XML_v, XML_fill, xFillAttrList); +m_pDocumentFS->endElementNS(XML_v, XML_background); + +SdrExporter().getFlyAttrList().clear(); +SdrExporter().getFlyFillAttrList().clear(); +} m_pDocumentFS->endElementNS(XML_w, XML_background); }
core.git: oox/source sw/qa
oox/source/vml/vmlformatting.cxx| 27 +++--- sw/qa/extras/ooxmlexport/data/tdf126533_negativeAxialAngle.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 45 ++ 3 files changed, 61 insertions(+), 11 deletions(-) New commits: commit 396ece804b3a31e4eddf56de4e557f3755331d8c Author: Justin Luth AuthorDate: Wed Feb 14 18:16:29 2024 -0500 Commit: Miklos Vajna CommitDate: Fri Feb 23 10:53:40 2024 +0100 related tdf#126533 vml import: fix gradient color swapping tdf#65295 already fixed one case by removing the test for degrees > 180 for the linear-equivalent gradients. Unfortunately the comment wasn't also removed, so that was confusing: removed comment. The test for degrees > 180 is not needed for the axial-equivalent case either: removed. The reason for that degrees > 180 case is likely due to negative degrees, which is a documented reason for swapping the colors: added swap if negative degrees. All the affected, existing unit tests are improved now: -tdf81345.docx: famous MS example: improved header gradient -fdo78300.docx: fontworks: hard to tell without MCGR... make CppunitTest_sw_ooxmlexport7 \ CPPUNIT_TEST_NAME=testTdf126533_negativeAxialAngle make CppunitTest_sw_ooxmlexport7 \ CPPUNIT_TEST_NAME=testTdf77219_backgroundShape Change-Id: I9f4d56375bb2cec28ffbd93df419d586da465b78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163417 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 6182950973ee..f4022d0639d6 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -777,15 +777,18 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& sal_Int32 nVmlAngle = getIntervalValue< sal_Int32, sal_Int32 >( moAngle.value_or( 0 ), 0, 360 ); // focus of -50% or 50% is axial gradient +// so approximate anything with a similar focus by using LO's axial gradient, +// (otherwise drop the radial aspect; linear gradient becomes the closest match) if( ((-0.75 <= fFocus) && (fFocus <= -0.25)) || ((0.25 <= fFocus) && (fFocus <= 0.75)) ) { -/* According to spec, focus of 50% is outer-to-inner, +/* According to spec, a focus of positive 50% is outer-to-inner, and -50% is inner-to-outer (color to color2). -BUT: For angles >= 180 deg., the behaviour is -reversed... that's not spec'ed of course. So, -[0;180) deg. and 50%, or [180;360) deg. and -50% is -outer-to-inner in fact. */ -bool bOuterToInner = (fFocus > 0.0) == (nVmlAngle < 180); +If the angle was provided as a negative, +then the colors are also (again) reversed. */ +bool bOuterToInner = fFocus > 0.0; +if (moAngle.value_or(0) < 0) +bOuterToInner = !bOuterToInner; + // simulate axial gradient by 3-step DrawingML gradient const Color& rOuterColor = bOuterToInner ? aColor1 : aColor2; const Color& rInnerColor = bOuterToInner ? aColor2 : aColor1; @@ -797,13 +800,15 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& } else// focus of -100%, 0%, and 100% is linear gradient { -/* According to spec, focus of -100% or 100% swaps the -start and stop colors, effectively reversing the -gradient. BUT: For angles >= 180 deg., the -behaviour is reversed. This means that in this case -a focus of 0% swaps the gradient. */ +/* According to spec, a focus of -100% or 100% swaps the +start and stop colors, effectively reversing the gradient. +If the angle was provided as a negative, +then the colors are also (again) reversed. */ if( fFocus < -0.5 || fFocus > 0.5 ) nVmlAngle = (nVmlAngle + 180) % 360; +if (moAngle.value_or(0) < 0) +nVmlAngle = (nVmlAngle + 180) % 360; + // set the start and stop colors lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 0.0, aColor1 );
core.git: oox/source sw/qa
oox/source/vml/vmlformatting.cxx | 48 sw/qa/extras/tiledrendering/data/tdf159626_blackPatternFill.docx |binary sw/qa/extras/tiledrendering/data/tdf159626_yellowPatternFill.docx |binary sw/qa/extras/tiledrendering/data/tdf159626_yellowPatternFillB.docx |binary sw/qa/extras/tiledrendering/tiledrendering.cxx | 97 ++ 5 files changed, 145 insertions(+) New commits: commit 07521972bcd1cfbbd15b2f60ada84ffc69f8f997 Author: Justin Luth AuthorDate: Wed Feb 7 17:25:50 2024 -0500 Commit: Miklos Vajna CommitDate: Wed Feb 21 08:46:39 2024 +0100 tdf#159626 vml pattern import: add color, fix back/foreground This depends on tdf#126533 which imports page style v:fill, BUT ONLY IN ORDER TO support the unit tests. The patch itself can stand alone and fixes vml import into textboxes/shapes etc. i.e. backporting could be possible by dropping the unit tests. The pattern that VML uses to indicate foreground and background is very different from what LO needs. [Fortunately LO does not use the _guess_ from vcl::bitmap::isHistorical8x8 to determine which color is the background. Instead it always uses the first pixel.] Documentation says that unspecified XML_fillcolor and XML_color should be white, but observation says it should be 25% gray (Word 2003). 25% gray == C0C0C0 == fillcolor="silver" == COL_LIGHTGRAY Currently, we simply export as a colored, tiled image, and not as a B type="pattern" so no corresponding export changes need to be made to export. Existing unit test documents that are affected: -chart2export's PieChartDataLabels.docx (page background) -ooxmlexport5's fdo77725.docx (minimized PieChartDataLabels.docx) * both foreground and background are set to white => solid white -sw/qa/core/data/ooxml/pass/fdo79131.docx (shape "inline") make CppunitTest_sw_tiledrendering \ CPPUNIT_TEST_NAME=testTdf159626_yellowPatternFill make CppunitTest_sw_tiledrendering \ CPPUNIT_TEST_NAME=testTdf159626_yellowPatternFillB make CppunitTest_sw_tiledrendering \ CPPUNIT_TEST_NAME=testTdf159626_blackPatternFill Change-Id: I9533ac4a7489081ffc62a10e900f5526abb906db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163106 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 029d5429d921..6182950973ee 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -29,6 +29,7 @@ #include #include #include + #include #include #include @@ -46,6 +47,8 @@ #include #include #include +#include +#include #include namespace oox::vml { @@ -843,6 +846,51 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& aFillProps.maBlipProps.mxFillGraphic = rGraphicHelper.importEmbeddedGraphic(moBitmapPath.value()); if (aFillProps.maBlipProps.mxFillGraphic.is()) { +if (nFillType == XML_pattern) +{ +// VML provides an 8x8 black(background) and white(foreground) pattern +// along with specified background(color2) and foreground(color) colors, +// while LO needs the color applied directly to the pattern. +const Graphic aGraphic(aFillProps.maBlipProps.mxFillGraphic); +::Color nBackColor; +::Color nPixelColor; +bool bIs8x8 = vcl::bitmap::isHistorical8x8(aGraphic.GetBitmapEx(), + nBackColor, nPixelColor); +if (bIs8x8) +{ +nBackColor += ConversionHelper::decodeColor(rGraphicHelper, moColor2, + moOpacity2, API_RGB_WHITE) + .getColor(rGraphicHelper); +// Documentation says undefined == white; observation says lightgray +nPixelColor += ConversionHelper::decodeColor(rGraphicHelper, moColor, +moOpacity, COL_LIGHTGRAY) + .getColor(rGraphicHelper); + +XOBitmap aXOB(aGraphic.GetBitmapEx()); +aXOB.Bitmap2Array(); +// LO uses the first pixel's color to represent background pixels +if (aXOB.GetBackgroundColor() ==
core.git: sw/source
sw/source/filter/ww8/docxexport.cxx |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) New commits: commit d7cd7dff0e8f71b3d83b4c91b574f39248a25e2f Author: Justin Luth AuthorDate: Fri Feb 9 17:26:52 2024 -0500 Commit: Miklos Vajna CommitDate: Wed Feb 21 08:45:08 2024 +0100 tdf#126533 docx export: page background vml fill: tiles/patterns This patch only benefits LO. MSO ignores "frame" and always treats page background as it if were tiled, but that is a trait we do NOT want to mimic. Textures are the primary fill type that needs to be tiled (instead of scaled/stretched). LO export also treats patterns as tiled bitmaps, and the end result of exporting as a tile looks the same as the original pattern. It just loses HOW the page background (i.e. as a pattern) but that is very low value. It is rather difficult to export as a true pattern and just not worth the effort of identifying the correct fore/background colors, converting to b image, and inverting the B image if the first pixel is white instead of black. [Hatching seems similar to patterns, but rarely (and only coincidentally) would it tile well. I think hatching is a new DML-only thing. Hatching is not in the page background UI of MS Word. LO just exports any hatching as a solid color.] Change-Id: I5cd3f1c6e380edb5e5b21900bad289fa298574e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163206 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index fcb55e19c314..466fe652d5dd 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -55,6 +55,7 @@ #include #include +#include #include #include @@ -1914,6 +1915,7 @@ void DocxExport::WriteMainText() m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, XML_color), msfilter::util::ConvertColor(oBrush->GetColor())); +const SwAttrSet& rPageStyleAttrSet = m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet(); const GraphicObject* pGraphicObj = oBrush->GetGraphicObject(); if (pGraphicObj) // image/pattern/texture { @@ -1922,8 +1924,12 @@ void DocxExport::WriteMainText() { m_pDocumentFS->startElementNS(XML_v, XML_background); +// Although MSO treats everything as tile, it is better for LO to not always tile +OString sType = "frame"_ostr; // single image +if (rPageStyleAttrSet.Get(XATTR_FILLBMP_TILE).GetValue()) +sType = "tile"_ostr; // primarily for patterns / textures m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, XML_id), aRelId, -XML_type, "frame"); +XML_type, sType); m_pDocumentFS->endElementNS(XML_v, XML_background); }
core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/tdf126533_pageBitmap.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 16 +++ sw/source/filter/ww8/docxexport.cxx | 22 +--- sw/source/filter/ww8/rtfexport.cxx |3 +- sw/source/filter/ww8/wrtww8.cxx |2 - 5 files changed, 37 insertions(+), 6 deletions(-) New commits: commit ed91971c9312e4b8a33c03c28d339bff6c5accc7 Author: Justin Luth AuthorDate: Fri Feb 9 15:43:32 2024 -0500 Commit: Miklos Vajna CommitDate: Wed Feb 21 08:42:31 2024 +0100 tdf#126533 docx export: page background vml fill: basic image This is the absolute minimal possible combination to export an image to page background. However, none of the other properties that I see strike me as particularly important or connected to our image properties. Plus MSO ignores things like "frame" and tiles anyway. Import is also pretty basic, so any improvement to imports can also add the corresponding export component. For example: it seems like MSO tiles all images based on somewhat magical sizing (they do always export o:targetscreensize="999,999" which we ignore). But note that MSO does pixel display and not logical display for page background - something we do NOT want to emulate, so any importing of properties needs to be done intelligently. But MSO's UI only allows for basic image insertion, so very few files will have complex settings. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_pageBitmap Change-Id: Ib410594d1e3377aefb8ee94f209a1a1155154b17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163203 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/qa/extras/ooxmlexport/data/tdf126533_pageBitmap.docx b/sw/qa/extras/ooxmlexport/data/tdf126533_pageBitmap.docx new file mode 100644 index ..67131acd2fd8 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf126533_pageBitmap.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index e455467a74ef..224f8f2aa27d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -387,6 +387,22 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126533_pageGradient) getProperty(xPageStyle, "FillStyle")); } +DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageBitmap, "tdf126533_pageBitmap.docx") +{ +// given a document with a page background image +uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, + getProperty(xPageStyle, "FillStyle")); + +if (!isExported()) +return; + +xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); +assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Target='media/image1.jpeg']"_ostr, 1); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 869862909678..fcb55e19c314 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1911,11 +1911,25 @@ void DocxExport::WriteMainText() // Write background page color if (std::unique_ptr oBrush = getBackground(); oBrush) { -Color backgroundColor = oBrush->GetColor(); -OString aBackgroundColorStr = msfilter::util::ConvertColor(backgroundColor); +m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, XML_color), + msfilter::util::ConvertColor(oBrush->GetColor())); -m_pDocumentFS->singleElementNS(XML_w, XML_background, FSNS(XML_w, XML_color), - aBackgroundColorStr); +const GraphicObject* pGraphicObj = oBrush->GetGraphicObject(); +if (pGraphicObj) // image/pattern/texture +{ +const OUString aRelId = m_pDrawingML->writeGraphicToStorage(pGraphicObj->GetGraphic()); +if (!aRelId.isEmpty()) +{ +m_pDocumentFS->startElementNS(XML_v, XML_background); + +m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, XML_id), aRelId, +XML_type, "frame"); + +m_pDocumentFS->endElementNS(XML_v, XML_background); +} +} + +m_pDocumentFS->endElementNS(XML_w, XML_background); } // body diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 135a84da36a5..7dbe10221ef1 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -471,7
core.git: oox/source sw/qa writerfilter/source
oox/source/vml/vmlshapecontext.cxx|1 sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx| 21 + writerfilter/source/dmapper/DomainMapper.cxx | 58 ++ writerfilter/source/dmapper/DomainMapper_Impl.hxx |1 writerfilter/source/dmapper/PropertyMap.cxx | 33 +++ writerfilter/source/ooxml/model.xml |3 7 files changed, 115 insertions(+), 2 deletions(-) New commits: commit c14574e7ad2d3ec2ada40808be3332fac71e9767 Author: Justin Luth AuthorDate: Sat Feb 3 10:08:56 2024 -0500 Commit: Miklos Vajna CommitDate: Tue Feb 20 16:54:57 2024 +0100 tdf#126533 docx import: page background vml fill This patch imports bitmaps/tiled textures (primarily), but also somewhat for gradients (because of a gradient2 -> gradient mismatch somewhere) and somewhat for patterns (because patterns are not well imported in general). Note that the imported fill likely will NOT match MSO, because their background CHANGES BASED ON THE ZOOM LEVEL. For example, my primary testing file (A6 landscape) has a logo which is only 25% visible in Word 2003 at 100%, but shows 90% of the logo at 200%, and many tiles of logos when exported as PDF. The same is true for gradients etc. Changing background on zoom is an absolutely bizarre implementation, and naturally LO could only accidentally look identical (and should never try to do so). make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_noPageBitmap make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf126533_pageGradient This is slightly ugly, but I don't know how to make a COPY of the XPropertySet UNO junk. All I have is references, and dispose deletes everything, even the references. I took some inspiration from RTF which just disposes the shape after grabbing the background color. Thus, just change the page style known to exist and be used, and then simply remove the fill if it isn't needed in the end. Any new page styles can just copy the default page style fill. Change-Id: Id3ea002c685642ff4c289982d0108247a6e9bb8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162958 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index e3242368a334..20ce2fa37434 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -251,6 +251,7 @@ ContextHandlerRef ShapeContextBase::createShapeContext( ContextHandler2Helper co return new ShapeContext( rParent, rShapes.createShape< BezierShape >(), rAttribs ); else return new ShapeContext( rParent, rShapes.createShape< ComplexShape >(), rAttribs ); +case VML_TOKEN(background): case VML_TOKEN( rect ): return new RectangleShapeContext( rParent, rAttribs, rShapes.createShape< RectangleShape >() ); case VML_TOKEN( roundrect ): diff --git a/sw/qa/core/data/ooxml/pass/fill.docx b/sw/qa/extras/ooxmlexport/data/fill.docx similarity index 100% rename from sw/qa/core/data/ooxml/pass/fill.docx rename to sw/qa/extras/ooxmlexport/data/fill.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx b/sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx new file mode 100644 index ..87dfff296be5 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf126533_noPageBitmap.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index f1d4a5e7121a..e455467a74ef 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -366,6 +367,26 @@ CPPUNIT_TEST_FIXTURE(Test, testPersonalMetaData) assertXPath(pCoreDoc, "/cp:coreProperties/cp:revision"_ostr, 0); } +DECLARE_OOXMLEXPORT_TEST(testTdf126533_noPageBitmap, "tdf126533_noPageBitmap.docx") +{ +// given a document with a v:background bitmap, but no w:background fillcolor +uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), + uno::UNO_QUERY); +// the image (or any fill for that matter) should be ignored. +CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, + getProperty(xPageStyle, "FillStyle")); +} + +CPPUNIT_TEST_FIXTURE(Test, testTdf126533_pageGradient) +{ +// given a document with a gradient page background +loadFromFile(u"fill.docx"); +uno::Reference xPageStyle(getStyles("PageStyles")->getByName("Standard"), +
core.git: Branch 'libreoffice-24-2' - oox/source
oox/source/export/vmlexport.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 38ff7cd25af90dcde19f33aaede23935df6758d8 Author: Justin Luth AuthorDate: Fri Feb 16 14:11:11 2024 -0500 Commit: Xisco Fauli CommitDate: Mon Feb 19 12:52:06 2024 +0100 tdf#153761 vml export: avoid corrupt docx: don't write empty r:id For the benefit of MSO, do not write r:id="", since MSO refuses to open such a document. Change-Id: I21887021c747fc9a9764befc7081e21d99e47545 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163523 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 5132255021aa61f8a1fa7d8de820cb3528699812) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163542 Reviewed-by: Xisco Fauli diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 1090b0857f5c..8438befa62af 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -741,8 +741,11 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& Graphic aGraphic; GraphicConverter::Import(aStream, aGraphic); OUString aImageId = m_pTextExport->GetDrawingML().writeGraphicToStorage(aGraphic, false); -pAttrList->add(FSNS(XML_r, XML_id), aImageId); -imageData = true; +if (!aImageId.isEmpty()) +{ +pAttrList->add(FSNS(XML_r, XML_id), aImageId); +imageData = true; +} } if (rProps.GetOpt(ESCHER_Prop_fNoFillHitTest, nValue))
core.git: oox/source
oox/source/export/vmlexport.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 5132255021aa61f8a1fa7d8de820cb3528699812 Author: Justin Luth AuthorDate: Fri Feb 16 14:11:11 2024 -0500 Commit: Justin Luth CommitDate: Sat Feb 17 03:57:47 2024 +0100 tdf#153761 vml export: avoid corrupt docx: don't write empty r:id For the benefit of MSO, do not write r:id="", since MSO refuses to open such a document. Change-Id: I21887021c747fc9a9764befc7081e21d99e47545 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163523 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 1090b0857f5c..8438befa62af 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -741,8 +741,11 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& Graphic aGraphic; GraphicConverter::Import(aStream, aGraphic); OUString aImageId = m_pTextExport->GetDrawingML().writeGraphicToStorage(aGraphic, false); -pAttrList->add(FSNS(XML_r, XML_id), aImageId); -imageData = true; +if (!aImageId.isEmpty()) +{ +pAttrList->add(FSNS(XML_r, XML_id), aImageId); +imageData = true; +} } if (rProps.GetOpt(ESCHER_Prop_fNoFillHitTest, nValue))