Kaydet (Commit) 5f4a3e7b authored tarafından Miklos Vajna's avatar Miklos Vajna

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/44385Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst ded02daf
......@@ -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
......
{\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
}
......@@ -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.
......
......@@ -112,7 +112,7 @@ void lclMovePositionWithRotation(awt::Point& aPos, const Size& rSize, sal_Int64
}
ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const * pParentFrame)
ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const* pParentFrame)
: m_rExport(rExport)
{
m_rExport.SaveData(nStt, nEnd);
......@@ -1291,7 +1291,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat
}
}
void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const * pParentFrame)
void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame)
{
const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat();
const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx();
......@@ -1357,7 +1357,7 @@ void DocxSdrExport::writeBoxItemLine(const SvxBoxItem& rBox)
pFS->endElementNS(XML_a, XML_ln);
}
void DocxSdrExport::writeDMLTextFrame(ww8::Frame const * pParentFrame, int nAnchorId, bool bTextBoxOnly)
void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAnchorId, bool bTextBoxOnly)
{
bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
m_pImpl->m_bDMLAndVMLDrawingOpen = true;
......@@ -1634,7 +1634,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const * pParentFrame, int nAnch
m_pImpl->m_bDMLAndVMLDrawingOpen = bDMLAndVMLDrawingOpen;
}
void DocxSdrExport::writeVMLTextFrame(ww8::Frame const * pParentFrame, bool bTextBoxOnly)
void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bTextBoxOnly)
{
bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
m_pImpl->m_bDMLAndVMLDrawingOpen = true;
......
......@@ -46,7 +46,7 @@ class ExportDataSaveRestore
private:
DocxExport& m_rExport;
public:
ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const * pParentFrame);
ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const* pParentFrame);
~ExportDataSaveRestore();
};
......@@ -101,13 +101,13 @@ public:
const css::uno::Reference<css::io::XOutputStream>& xOutStream, const OUString& sGrabBagProperyName,
int nAnchorId);
/// Writes text frame in DML format.
void writeDMLTextFrame(ww8::Frame const * pParentFrame, int nAnchorId, bool bTextBoxOnly = false);
void writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAnchorId, bool bTextBoxOnly = false);
/// Writes text frame in VML format.
void writeVMLTextFrame(ww8::Frame const * pParentFrame, bool bTextBoxOnly = false);
void writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bTextBoxOnly = false);
/// Is this a standalone TextFrame, or used as a TextBox of a shape?
static bool isTextBox(const SwFrameFormat& rFrameFormat);
/// Writes text from Textbox for <w:framePr>
void writeOnlyTextOfFrame(ww8::Frame const * pParentFrame);
void writeOnlyTextOfFrame(ww8::Frame const* pParentFrame);
/// Writes the drawingML <a:ln> markup of a box item.
void writeBoxItemLine(const SvxBoxItem& rBox);
};
......
......@@ -17,8 +17,8 @@ namespace vcl
{
/// Imports a PDF stream into rGraphic as a GDIMetaFile.
VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Bitmap &rBitmap,
css::uno::Sequence<sal_Int8> &rPdfFata,
VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Bitmap& rBitmap,
css::uno::Sequence<sal_Int8>& rPdfFata,
sal_uInt64 nPos = STREAM_SEEK_TO_BEGIN,
sal_uInt64 nSize = STREAM_SEEK_TO_END);
VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic);
......
......@@ -142,7 +142,7 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream,
sal_uInt64 nPos, sal_uInt64 nSize)
{
bool bCompatible = isCompatible(rInStream, nPos, nSize);
rInStream.Seek( nPos );
rInStream.Seek(nPos);
if (bCompatible)
// Not converting.
rOutStream.WriteStream(rInStream, nSize);
......@@ -205,8 +205,8 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream,
namespace vcl
{
bool ImportPDF(SvStream& rStream, Bitmap &rBitmap,
css::uno::Sequence<sal_Int8> &rPdfData,
bool ImportPDF(SvStream& rStream, Bitmap& rBitmap,
css::uno::Sequence<sal_Int8>& rPdfData,
sal_uInt64 nPos, sal_uInt64 nSize)
{
// Get the preview of the first page.
......
......@@ -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:
......
......@@ -640,11 +640,11 @@ void SigningTest::testSignatureLineImages()
// Given: A document (docx) with a signature line and a valid signature
uno::Reference< security::XDocumentDigitalSignatures > xSignatures(
security::DocumentDigitalSignatures::createWithVersion(
comphelper::getProcessComponentContext(), "1.2" ) );
comphelper::getProcessComponentContext(), "1.2"));
uno::Reference<embed::XStorage> xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL(
ZIP_STORAGE_FORMAT_STRING, m_directories.getURLFromSrc(DATA_DIRECTORY) + "signatureline.docx",
embed::ElementModes::READ);
ZIP_STORAGE_FORMAT_STRING, m_directories.getURLFromSrc(DATA_DIRECTORY) + "signatureline.docx",
embed::ElementModes::READ);
CPPUNIT_ASSERT(xStorage.is());
uno::Sequence< security::DocumentSignatureInformation > xSignatureInfo =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment