From 2b47fae7e3e23ee7c733708500cb0482ad7f8af1 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 8 Apr 2024 15:26:00 +0200 Subject: [PATCH] tdf#88214 sw: text formatting: adapt empty line at end of para to Word For an empty line at the end of an empty paragraph, Writer already uses any existing text attribute in the paragraph, see for example testEmptyTrailingSpans. For an empty line at the end of a non-empty paragraph, Writer text formatting uses only paragraph attributes, ignoring any text attributes, whereas the UI will display the attributes from the text attributes (such as font height) if you move the cursor there. Word uses text attributes also in this case, so adapt the inconsistent Writer behaviour: text formatting now uses text attributes too. Apparently this can be achieved by calling SeekAndChgBefore() instead of SeekAndChg(). Add another compat flag "ApplyTextAttrToEmptyLineAtEndOfParagraph" to preserve the formatting of existing ODF documents. Adapt test document fdo74110.docx, it has a line break with "Angsana New" font. Change-Id: I0863d3077e419404194b47110e4ad2bdda3d11c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165887 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/inc/IDocumentSettingAccess.hxx | 1 + sw/qa/core/text/data/A011-charheight.rtf | 27 ++++++++++++++++++ sw/qa/core/text/itrform2.cxx | 18 ++++++++++++ sw/qa/extras/ooxmlexport/data/fdo74110.docx | Bin 20029 -> 20033 bytes sw/source/core/doc/DocumentSettingManager.cxx | 11 +++++++ sw/source/core/inc/DocumentSettingManager.hxx | 1 + sw/source/core/text/itrform2.cxx | 13 +++++++-- sw/source/filter/ww8/ww8par.cxx | 1 + sw/source/filter/xml/xmlimp.cxx | 10 +++++++ sw/source/uibase/uno/SwXDocumentSettings.cxx | 18 ++++++++++++ writerfilter/source/filter/WriterFilter.cxx | 1 + 11 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 sw/qa/core/text/data/A011-charheight.rtf diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 74b123dc462e..0dd9467bdf13 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -98,6 +98,7 @@ enum class DocumentSettingId ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK, // tdf#119908 new paragraph justification JUSTIFY_LINES_WITH_SHRINKING, + APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH, // COMPATIBILITY FLAGS END BROWSE_MODE, HTML_MODE, diff --git a/sw/qa/core/text/data/A011-charheight.rtf b/sw/qa/core/text/data/A011-charheight.rtf new file mode 100644 index 000000000000..4b56ecdd6a15 --- /dev/null +++ b/sw/qa/core/text/data/A011-charheight.rtf @@ -0,0 +1,27 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang3079\deflangfe3079\themelang3079\themelangfe0\themelangcs0 +{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2Times New Roman{\*\falt Arial};} +} +{\*\defchp \f0\fs22\lang3079\langfe1033\langfenp1033 } +{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 } +\noqfpromote +{\stylesheet +{\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 +\f0\fs23\lang3079\langfe1033\cgrid\langnp3079\langfenp1033 \snext0 \sqformat \spriority0 Normal;} +{\s15\ql \li0\ri0\widctlpar\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f0\fs23\lang3079\langfe1033\cgrid\langnp3079\langfenp1033 +\sbasedon0 \snext15 \slink16 \sunhideused header;} +{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \sbasedon10 \slink15 \slocked Kopfzeile Zchn;} +} +\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1134\gutter0\ltrsect +\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0 +\showxmlerrors1\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1417\dgvorigin1417\dghshow1\dgvshow1 +\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct +\asianbrkrule\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0 +{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0 + +\ltrpar \pard\plain \ltrpar\s15\qc \li0\ri0\widctlpar +\tqc\tx4536\tqr\tx9072\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f0\fs23\lang3079\langfe1033\cgrid\langnp3079\langfenp1033 {\rtlch\fcs1 \af0\afs16 \ltrch\fcs0 +\fs16 \line \line \line +\par \line +\par } +} diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx index 6d59140f97f0..860b2197f761 100644 --- a/sw/qa/core/text/itrform2.cxx +++ b/sw/qa/core/text/itrform2.cxx @@ -88,6 +88,24 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableLegacyWrapEmptyParagraph) CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs2.size()); } +CPPUNIT_TEST_FIXTURE(Test, testApplyTextAttrToEmptyLineAtEndOfParagraph) +{ + createSwDoc("A011-charheight.rtf"); + + calcLayout(); + + SwDoc* pDoc = getSwDoc(); + SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + auto pPage = dynamic_cast(pLayout->Lower()); + + SwContentFrame* pLastPara = pPage->FindLastBodyContent(); + // wrong was 449 (11.5pt) + CPPUNIT_ASSERT_EQUAL(static_cast(368), pLastPara->getFrameArea().Height()); + SwContentFrame* pFirstPara = pPage->FindFirstBodyContent(); + // wrong was 817 (11.5pt) + CPPUNIT_ASSERT_EQUAL(static_cast(736), pFirstPara->getFrameArea().Height()); +} + CPPUNIT_TEST_FIXTURE(Test, testFlyMinimalWrap) { // Given a document with a first page that has a shape and a table in it (not floating table), diff --git a/sw/qa/extras/ooxmlexport/data/fdo74110.docx b/sw/qa/extras/ooxmlexport/data/fdo74110.docx index 105522971d2bd1de9861b9448d1ee69ea61fe077..cda0772c5738ae7dce187e0dd16cee1abd40b5ae 100644 GIT binary patch delta 5198 zcmZ8_WmFVw(Dp99DBT?b(jna;9n#$$(hVytD6oX&E-BrJv~(>C6W9WCLqA&~Pob8ZVi9yK^2WvDuKAXdf=5 z&d&WA?QRh5g+U49<}72+o0Y>33;d18ZGc8sriz3Pjwa=nhK zX*8b3YTI$$y_8fvnskX&xfnCLvce1b+;e!4DFZ(by;NP1Ni3WV9rD2K)L4Km?76Kb zpxuB?>cgP+*_xfqLS@^<{2JI4KVpfWNE%-u-u%> zeCN(+B^jJTf{@j7K^}Y)3MIoKP3IcgG5jfS+Iq}8c$y4#z8s)ZLg*I#8W(Ld<8Cp&?0jr9 z)jfW}Z#qTEt(7@27pJN$#uG*$Po4R(Z&!Bfg1`_|qYGPejrXo)Uw*Lh}?B z>Z=Q->CO}Wk-fGF2WBR_z@UZdWy;BZ74oR`AFo3=MxlljtPo;OOjs8khN9%I&K{L} zFELKYAw?&Ym{jPivL|*xg38NOT=`IfRD*mO{o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B_*9@6M-(975hXcbp~6W2uX6q$S7?Di z#2~7_jT8g||5ahI9+0O30Ziabz^n=sJPDku7=Q@?4OKl17(WOw<7WW+RAn)q34j0( z0UBUK?eTx_P(wh$0e~IC0L%uoAq>IS07T6QyajlunS&RBQ8j&VAi$2)1a|_yNWH)3 j4I>d?HGo?E88{wz@z*DSW_2|%1%RU=jBTj&?=}AcX|j+s diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 00b9e598450a..4f768933f633 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -249,6 +249,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE: return mbAutoFirstLineIndentDisregardLineSpace; case DocumentSettingId::HYPHENATE_URLS: return mbHyphenateURLs; + case DocumentSettingId::APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH: + return mbApplyTextAttrToEmptyLineAtEndOfParagraph; case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES: return mbDoNotBreakWrappedTables; case DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK: @@ -443,6 +445,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo mbHyphenateURLs = value; break; + case DocumentSettingId::APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH: + mbApplyTextAttrToEmptyLineAtEndOfParagraph = value; + break; + case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES: mbDoNotBreakWrappedTables = value; break; @@ -1091,6 +1097,11 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(mnImagePreferredDPI).getStr())); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbApplyTextAttrToEmptyLineAtEndOfParagraph")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::boolean(mbApplyTextAttrToEmptyLineAtEndOfParagraph).getStr())); + (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterEndElement(pWriter); (void)xmlTextWriterEndElement(pWriter); diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index 561479a5f0aa..57411f66cbb4 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -178,6 +178,7 @@ class DocumentSettingManager final : bool mbDoNotBreakWrappedTables = false; bool mbAllowTextAfterFloatingTableBreak = false; bool mbJustifyLinesWithShrinking = false; + bool mbApplyTextAttrToEmptyLineAtEndOfParagraph = true; // If this is on as_char flys wrapping will be handled the same like in Word bool mbNoNumberingShowFollowBy; bool mbDropCapPunctuation; // tdf#150200, tdf#150438 diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 6f5fa905665f..2d24e103957a 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -852,6 +852,7 @@ void SwTextFormatter::CalcAscent( SwTextFormatInfo &rInf, SwLinePortion *pPor ) // In empty lines the attributes are switched on via SeekStart const bool bFirstPor = rInf.GetLineStart() == rInf.GetIdx(); + if ( pPor->IsQuoVadisPortion() ) bChg = SeekStartAndChg( rInf, true ); else @@ -860,10 +861,16 @@ void SwTextFormatter::CalcAscent( SwTextFormatInfo &rInf, SwLinePortion *pPor ) { if( !rInf.GetText().isEmpty() ) { - if ( pPor->GetLen() || !rInf.GetIdx() - || ( m_pCurr != pLast && !pLast->IsFlyPortion() ) - || !m_pCurr->IsRest() ) // instead of !rInf.GetRest() + if ((rInf.GetIdx() != TextFrameIndex(rInf.GetText().getLength()) + || rInf.GetRest() // field continued - not empty + || !GetTextFrame()->GetDoc().getIDocumentSettingAccess().get( + DocumentSettingId::APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH)) + && (pPor->GetLen() || !rInf.GetIdx() + || (m_pCurr != pLast && !pLast->IsFlyPortion()) + || !m_pCurr->IsRest())) // instead of !rInf.GetRest() + { bChg = SeekAndChg( rInf ); + } else bChg = SeekAndChgBefore( rInf ); } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 77f4f2e76be2..f50e8d56093a 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1945,6 +1945,7 @@ void SwWW8ImplReader::ImportDop() m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::CONTINUOUS_ENDNOTES, true); // rely on default for HYPHENATE_URLS=false + // rely on default for APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH=true IDocumentSettingAccess& rIDSA = m_rDoc.getIDocumentSettingAccess(); if (m_xWDop->fDontBreakWrappedTables) diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 916d58b2d7c4..fc9f4a1e1e38 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1298,6 +1298,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bool bCollapseEmptyCellPara = false; bool bAutoFirstLineIndentDisregardLineSpace = false; bool bHyphenateURLs = false; + bool bApplyTextAttrToEmptyLineAtEndOfParagraph = false; bool bDoNotBreakWrappedTables = false; bool bAllowTextAfterFloatingTableBreak = false; bool bDropCapPunctuation = false; @@ -1398,6 +1399,10 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC { bHyphenateURLs = true; } + else if (rValue.Name == "ApplyTextAttrToEmptyLineAtEndOfParagraph") + { + bApplyTextAttrToEmptyLineAtEndOfParagraph = true; + } else if (rValue.Name == "DoNotBreakWrappedTables") { rValue.Value >>= bDoNotBreakWrappedTables; @@ -1575,6 +1580,11 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC xProps->setPropertyValue("HyphenateURLs", Any(true)); } + if (!bApplyTextAttrToEmptyLineAtEndOfParagraph) + { + xProps->setPropertyValue("ApplyTextAttrToEmptyLineAtEndOfParagraph", Any(false)); + } + if (bDoNotBreakWrappedTables) { xProps->setPropertyValue("DoNotBreakWrappedTables", Any(true)); diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index e3c142122cba..6e65905ca4ff 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -159,6 +159,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_NO_NUMBERING_SHOW_FOLLOWBY, HANDLE_DROP_CAP_PUNCTUATION, HANDLE_USE_VARIABLE_WIDTH_NBSP, + HANDLE_APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH, }; } @@ -264,6 +265,7 @@ static rtl::Reference lcl_createSettingsInfo() { OUString("NoNumberingShowFollowBy"), HANDLE_NO_NUMBERING_SHOW_FOLLOWBY, cppu::UnoType::get(), 0 }, { OUString("DropCapPunctuation"), HANDLE_DROP_CAP_PUNCTUATION, cppu::UnoType::get(), 0 }, { OUString("UseVariableWidthNBSP"), HANDLE_USE_VARIABLE_WIDTH_NBSP, cppu::UnoType::get(), 0 }, + { OUString("ApplyTextAttrToEmptyLineAtEndOfParagraph"), HANDLE_APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH, cppu::UnoType::get(), 0 }, /* * As OS said, we don't have a view when we need to set this, so I have to @@ -1074,6 +1076,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } } break; + case HANDLE_APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH: + { + bool bTmp; + if (rValue >>= bTmp) + { + mpDoc->getIDocumentSettingAccess().set( + DocumentSettingId::APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH, bTmp); + } + } + break; case HANDLE_DO_NOT_BREAK_WRAPPED_TABLES: { bool bTmp; @@ -1656,6 +1668,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::HYPHENATE_URLS); } break; + case HANDLE_APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( + DocumentSettingId::APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH); + } + break; case HANDLE_DO_NOT_BREAK_WRAPPED_TABLES: { rValue <<= mpDoc->getIDocumentSettingAccess().get( diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index e7d32c4843e6..8935f462636f 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -330,6 +330,7 @@ void WriterFilter::setTargetDocument(const uno::Reference& xDo xSettings->setPropertyValue("DisableOffPagePositioning", uno::Any(true)); xSettings->setPropertyValue("DropCapPunctuation", uno::Any(true)); // rely on default for HyphenateURLs=false + // rely on default for APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH=true } void WriterFilter::setSourceDocument(const uno::Reference& xDoc)