diff options
author | Jonathan Clark <jonathan@libreoffice.org> | 2024-11-08 01:12:48 -0700 |
---|---|---|
committer | Jonathan Clark <jonathan@libreoffice.org> | 2024-11-13 15:01:11 +0100 |
commit | 2cb039f570379213ffc9469a132f5b24f425b7be (patch) | |
tree | e67e7cb151de276cec6d3a4bc24d7f184aeac001 /vcl/qa | |
parent | a095909899622ce16bac020fa7034ff162fe0df5 (diff) |
tdf#36709 editeng: Layout for font-relative first-line indent
This change extends layout for font-relative paragraph first-line
indentation into Edit Engine.
Change-Id: I5906f493b91fbcb87ded165709fb132b33ce1906
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176487
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Diffstat (limited to 'vcl/qa')
-rw-r--r-- | vcl/qa/cppunit/pdfexport/data/tdf36709.fodt | 95 | ||||
-rw-r--r-- | vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 24 |
2 files changed, 94 insertions, 25 deletions
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf36709.fodt b/vcl/qa/cppunit/pdfexport/data/tdf36709.fodt index 9aa29be8086b..d7dc9310b2b0 100644 --- a/vcl/qa/cppunit/pdfexport/data/tdf36709.fodt +++ b/vcl/qa/cppunit/pdfexport/data/tdf36709.fodt @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='UTF-8'?> <office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> - <office:meta><meta:creation-date>2024-10-31T13:46:50.189497642</meta:creation-date><meta:generator>LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/5f12ad737bbb930b76299df0433c8635ae27a7bd</meta:generator><dc:date>2024-10-31T13:49:19.200988598</dc:date><meta:editing-duration>PT2M30S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="8" meta:word-count="32" meta:character-count="144" meta:non-whitespace-character-count="120"/></office:meta> + <office:meta><meta:creation-date>2024-10-31T13:46:50.189497642</meta:creation-date><meta:generator>LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/372a9f642e1268a1888f6a85d42da0499e1f8516</meta:generator><dc:date>2024-11-08T04:00:30.046342730</dc:date><meta:editing-duration>PT4M32S</meta:editing-duration><meta:editing-cycles>3</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="8" meta:word-count="32" meta:character-count="144" meta:non-whitespace-character-count="120"/></office:meta> <office:font-face-decls> <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> <style:font-face style:name="Noto Sans1" svg:font-family="'Noto Sans'" style:font-family-generic="system" style:font-pitch="variable"/> @@ -8,8 +8,8 @@ </office:font-face-decls> <office:styles> <style:default-style style:family="graphic"> - <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/> - <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0in" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:writing-mode="lr-tb" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0in" style:font-independent-line-spacing="false"> <style:tab-stops/> </style:paragraph-properties> <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> @@ -26,52 +26,52 @@ </style:default-style> <style:style style:name="Standard" style:family="paragraph" style:class="text"/> <text:outline-style style:name="Outline"> - <text:outline-level-style text:level="1" style:num-format=""> + <text:outline-level-style text:level="1" loext:num-list-format="%1%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> </text:outline-level-style> - <text:outline-level-style text:level="2" style:num-format=""> + <text:outline-level-style text:level="2" loext:num-list-format="%2%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> </text:outline-level-style> - <text:outline-level-style text:level="3" style:num-format=""> + <text:outline-level-style text:level="3" loext:num-list-format="%3%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> </text:outline-level-style> - <text:outline-level-style text:level="4" style:num-format=""> + <text:outline-level-style text:level="4" loext:num-list-format="%4%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> </text:outline-level-style> - <text:outline-level-style text:level="5" style:num-format=""> + <text:outline-level-style text:level="5" loext:num-list-format="%5%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> </text:outline-level-style> - <text:outline-level-style text:level="6" style:num-format=""> + <text:outline-level-style text:level="6" loext:num-list-format="%6%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> </text:outline-level-style> - <text:outline-level-style text:level="7" style:num-format=""> + <text:outline-level-style text:level="7" loext:num-list-format="%7%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> </text:outline-level-style> - <text:outline-level-style text:level="8" style:num-format=""> + <text:outline-level-style text:level="8" loext:num-list-format="%8%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> </text:outline-level-style> - <text:outline-level-style text:level="9" style:num-format=""> + <text:outline-level-style text:level="9" loext:num-list-format="%9%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> </text:outline-level-style> - <text:outline-level-style text:level="10" style:num-format=""> + <text:outline-level-style text:level="10" loext:num-list-format="%10%" style:num-format=""> <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> <style:list-level-label-alignment text:label-followed-by="listtab"/> </style:list-level-properties> @@ -103,30 +103,67 @@ </style:style> <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Standard"> <style:paragraph-properties loext:text-indent="2em" style:auto-text-indent="false"/> - <style:text-properties/> - </style:style> - <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Standard"> - <style:paragraph-properties loext:text-indent="2em" style:auto-text-indent="false"/> <style:text-properties fo:font-size="16pt" style:font-size-asian="16pt" style:font-size-complex="16pt"/> </style:style> - <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard"> + <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Standard"> <style:paragraph-properties loext:text-indent="2em" style:auto-text-indent="false"/> <style:text-properties fo:font-size="20pt" style:font-size-asian="20pt" style:font-size-complex="20pt"/> </style:style> - <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Standard"> + <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Standard"> <style:paragraph-properties loext:text-indent="2em" style:auto-text-indent="false"/> <style:text-properties fo:font-size="24pt" style:font-size-asian="24pt" style:font-size-complex="24pt"/> </style:style> + <style:style style:name="P9" style:family="paragraph"> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt"/> + </style:style> + <style:style style:name="P10" style:family="paragraph"> + <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="1em"/> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt"/> + </style:style> + <style:style style:name="P11" style:family="paragraph"> + <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="2em"/> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt"/> + </style:style> + <style:style style:name="P12" style:family="paragraph"> + <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="3em"/> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="12pt"/> + </style:style> + <style:style style:name="P13" style:family="paragraph"> + <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="2em"/> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="16pt" style:font-size-complex="16pt"/> + </style:style> + <style:style style:name="P14" style:family="paragraph"> + <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="2em"/> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="20pt" style:font-size-complex="20pt"/> + </style:style> + <style:style style:name="P15" style:family="paragraph"> + <style:paragraph-properties fo:margin-left="0in" fo:margin-right="0in" loext:text-indent="2em"/> + <style:text-properties style:font-name="Liberation Serif" fo:font-size="24pt" style:font-size-complex="24pt"/> + </style:style> + <style:style style:name="P16" style:family="paragraph"> + <loext:graphic-properties draw:fill="none" draw:fill-color="#ffffff"/> + <style:text-properties style:font-name="Liberation Serif"/> + </style:style> + <style:style style:name="T1" style:family="text"> + <style:text-properties style:font-name="Liberation Serif"/> + </style:style> + <style:style style:name="gr1" style:family="graphic"> + <style:graphic-properties draw:stroke="none" svg:stroke-color="#000000" draw:fill="none" draw:fill-color="#ffffff" fo:min-height="3.7945in" loext:decorative="false" style:run-through="foreground" style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph"/> + <style:paragraph-properties style:writing-mode="lr-tb"/> + </style:style> <style:page-layout style:name="pm1"> - <style:page-layout-properties fo:page-width="8.2681in" fo:page-height="11.6929in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:footnote-max-height="0in" loext:margin-gutter="0in"> + <style:page-layout-properties fo:page-width="8.2681in" fo:page-height="11.6929in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.278in" style:layout-grid-ruby-height="0.139in" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0in" loext:margin-gutter="0in"> <style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> </style:page-layout-properties> <style:header-style/> <style:footer-style/> </style:page-layout> + <style:style style:name="dp1" style:family="drawing-page"> + <style:drawing-page-properties draw:background-size="full"/> + </style:style> </office:automatic-styles> <office:master-styles> - <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/> </office:master-styles> <office:body> <office:text> @@ -142,10 +179,22 @@ <text:p text:style-name="P3">2 em constant size</text:p> <text:p text:style-name="P4">3 em constant size</text:p> <text:p text:style-name="P5"/> + <text:p text:style-name="P3">2 em variable size</text:p> <text:p text:style-name="P6">2 em variable size</text:p> <text:p text:style-name="P7">2 em variable size</text:p> - <text:p text:style-name="P8">2 em variable size</text:p> - <text:p text:style-name="P9">2 em variable size</text:p> + <text:p text:style-name="P8"><draw:frame text:anchor-type="paragraph" draw:z-index="0" draw:name="Text Frame 1" draw:style-name="gr1" draw:text-style-name="P16" svg:width="6.4587in" svg:height="3.7949in" svg:x="0.0689in" svg:y="0.5937in"> + <draw:text-box> + <text:p text:style-name="P9"><text:span text:style-name="T1">0 em constant size</text:span></text:p> + <text:p text:style-name="P10"><text:span text:style-name="T1">1 em constant size</text:span></text:p> + <text:p text:style-name="P11"><text:span text:style-name="T1">2 em constant size</text:span></text:p> + <text:p text:style-name="P12"><text:span text:style-name="T1">3 em constant size</text:span></text:p> + <text:p text:style-name="P9"><text:span text:style-name="T1"/></text:p> + <text:p text:style-name="P11"><text:span text:style-name="T1">2 em variable size</text:span></text:p> + <text:p text:style-name="P13"><text:span text:style-name="T1">2 em variable size</text:span></text:p> + <text:p text:style-name="P14"><text:span text:style-name="T1">2 em variable size</text:span></text:p> + <text:p text:style-name="P15"><text:span text:style-name="T1">2 em variable size</text:span></text:p> + </draw:text-box> + </draw:frame>2 em variable size</text:p> </office:text> </office:body> </office:document>
\ No newline at end of file diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index 4bd91576bfec..ed035f6f8fb9 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -5836,7 +5836,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf36709FirstLineIndentEm) int nPageObjectCount = pPdfPage->getObjectCount(); - CPPUNIT_ASSERT_EQUAL(8, nPageObjectCount); + CPPUNIT_ASSERT_EQUAL(16, nPageObjectCount); std::vector<OUString> aText; std::vector<basegfx::B2DRectangle> aRect; @@ -5852,8 +5852,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf36709FirstLineIndentEm) } } - CPPUNIT_ASSERT_EQUAL(size_t(8), aText.size()); + CPPUNIT_ASSERT_EQUAL(size_t(16), aText.size()); + // Lines from the Writer portion CPPUNIT_ASSERT_EQUAL(u"0 em constant size"_ustr, aText.at(0).trim()); CPPUNIT_ASSERT_DOUBLES_EQUAL(57.256, aRect.at(0).getMinX(), /*delta*/ 2.0); CPPUNIT_ASSERT_EQUAL(u"1 em constant size"_ustr, aText.at(1).trim()); @@ -5871,6 +5872,25 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf36709FirstLineIndentEm) CPPUNIT_ASSERT_DOUBLES_EQUAL(97.680, aRect.at(6).getMinX(), /*delta*/ 2.0); CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(7).trim()); CPPUNIT_ASSERT_DOUBLES_EQUAL(105.856, aRect.at(7).getMinX(), /*delta*/ 2.0); + + // Lines from the Edit Engine portion + CPPUNIT_ASSERT_EQUAL(u"0 em constant size"_ustr, aText.at(8).trim()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(62.106, aRect.at(8).getMinX(), /*delta*/ 2.0); + CPPUNIT_ASSERT_EQUAL(u"1 em constant size"_ustr, aText.at(9).trim()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(76.010, aRect.at(9).getMinX(), /*delta*/ 2.0); + CPPUNIT_ASSERT_EQUAL(u"2 em constant size"_ustr, aText.at(10).trim()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(88.778, aRect.at(10).getMinX(), /*delta*/ 2.0); + CPPUNIT_ASSERT_EQUAL(u"3 em constant size"_ustr, aText.at(11).trim()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(102.126, aRect.at(11).getMinX(), /*delta*/ 2.0); + + CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(12).trim()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(88.778, aRect.at(12).getMinX(), /*delta*/ 2.0); + CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(13).trim()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(97.754, aRect.at(13).getMinX(), /*delta*/ 2.0); + CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(14).trim()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(106.830, aRect.at(14).getMinX(), /*delta*/ 2.0); + CPPUNIT_ASSERT_EQUAL(u"2 em variable size"_ustr, aText.at(15).trim()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(115.906, aRect.at(15).getMinX(), /*delta*/ 2.0); } } // end anonymous namespace |