tdf#113550 RTF import: fix incorrect text indent

Left indent was set to non-zero in the style, but direct formatting set
it back to zero. Teach deduplication to remove the
NS_ooxml::LN_CT_PPrBase_ind SPRM itself in case the last attribute was
removed.

Change-Id: I01b202f0241b02816b2b392326737b1150caffc2
Reviewed-on: https://gerrit.libreoffice.org/44385
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
Miklos Vajna
2017-11-07 09:02:11 +01:00
parent ded02dafbc
commit 5f4a3e7bd7
9 changed files with 47 additions and 17 deletions

View File

@@ -17753,6 +17753,7 @@ vcl/inc/outdev.h
vcl/inc/outdevstatestack.hxx
vcl/inc/pch/precompiled_vcl.cxx
vcl/inc/pch/precompiled_vcl.hxx
vcl/inc/pdfread.hxx
vcl/inc/print.h
vcl/inc/printdlg.hxx
vcl/inc/printerinfomanager.hxx
@@ -18201,7 +18202,6 @@ vcl/source/filter/igif/gifread.cxx
vcl/source/filter/igif/gifread.hxx
vcl/source/filter/ipdf/pdfdocument.cxx
vcl/source/filter/ipdf/pdfread.cxx
vcl/source/filter/ipdf/pdfread.hxx
vcl/source/filter/ixbm/xbmread.cxx
vcl/source/filter/ixbm/xbmread.hxx
vcl/source/filter/ixpm/rgbtable.hxx

View File

@@ -0,0 +1,17 @@
{\rtf1\adeflang1037\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0
{\fonttbl
{\f0\fbidi \froman\fcharset238\fprq2 Times New Roman;}
}
{\stylesheet
{\ql \li0\ri0 Normal;}
{\s22\ql \li0\ri0 S22;}
{\s442\ql \li1418\ri0 \sbasedon22 S442;}
}
\paperw12240\paperh15840\margl1134\margr1134\margt1134\margb1410
\trowd \cellx10008
\pard\plain \ltrpar\s442\ql \li0\ri0\intbl
hello\par
\pard\cell\row
}
\pard\plain\par
}

View File

@@ -1204,6 +1204,16 @@ DECLARE_RTFEXPORT_TEST(testTdf104085, "tdf104085.rtf")
CPPUNIT_FAIL("no BulletChar property");
}
DECLARE_RTFEXPORT_TEST(testTdf113550, "tdf113550.rtf")
{
uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xCell->getText());
// This was 2501, 0 as direct formatting was ignored on the paragraph (and
// the style had this larger value).
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
}
DECLARE_RTFEXPORT_TEST(testLeveljcCenter, "leveljc-center.rtf")
{
// Tests that \leveljc1 is mapped to Adjust=Center for a numbering rule.

View File

@@ -185,6 +185,9 @@ static bool isSPRMChildrenExpected(Id nId)
SAL_FALLTHROUGH;
case NS_ooxml::LN_CT_PrBase_shd:
// Expected children are NS_ooxml::LN_CT_Shd_*.
SAL_FALLTHROUGH;
case NS_ooxml::LN_CT_PPrBase_ind:
// Expected children are NS_ooxml::LN_CT_Ind_*.
return true;
default: