[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - 2 commits - filter/source include/filter sd/qa
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 19 21:42:02 UTC 2020
filter/source/msfilter/svdfppt.cxx | 79 +++++++++++++++---------------------
include/filter/msfilter/svdfppt.hxx | 3 -
sd/qa/unit/data/ppt/tdf79082.ppt |binary
sd/qa/unit/export-tests.cxx | 42 +++++++++++++++++++
4 files changed, 75 insertions(+), 49 deletions(-)
New commits:
commit e990859780840f431a99c7da70084c22e740ac08
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri May 1 00:26:21 2020 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue May 19 23:41:47 2020 +0200
tdf#79082 Add test for correctly importing tab stops from ppt
Change-Id: Iafccbe50e6e00e3a4c5155dabf898c12e8b8176c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93397
Tested-by: Jenkins
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94428
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sd/qa/unit/data/ppt/tdf79082.ppt b/sd/qa/unit/data/ppt/tdf79082.ppt
new file mode 100644
index 000000000000..259b8808515d
Binary files /dev/null and b/sd/qa/unit/data/ppt/tdf79082.ppt differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 57fe771339f1..38578766934d 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -52,6 +52,7 @@ public:
void testUnknownAttributes();
void testTdf80020();
void testLinkedGraphicRT();
+ void testTdf79082();
void testImageWithSpecialID();
void testTdf62176();
void testTransparentBackground();
@@ -83,6 +84,7 @@ public:
CPPUNIT_TEST(testUnknownAttributes);
CPPUNIT_TEST(testTdf80020);
CPPUNIT_TEST(testLinkedGraphicRT);
+ CPPUNIT_TEST(testTdf79082);
CPPUNIT_TEST(testImageWithSpecialID);
CPPUNIT_TEST(testTdf62176);
CPPUNIT_TEST(testTransparentBackground);
@@ -661,6 +663,46 @@ void SdExportTest::testLinkedGraphicRT()
}
}
+void SdExportTest::testTdf79082()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/ppt/tdf79082.ppt"), PPT);
+ utl::TempFile tempFile;
+ tempFile.EnableKillingFile();
+ xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile);
+ xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml");
+
+ // P1 should have 6 tab stops defined
+ assertXPathChildren(
+ pXmlDoc, "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops", 6);
+ assertXPath(pXmlDoc,
+ "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/"
+ "style:tab-stop[1]",
+ "position", "0cm");
+ assertXPath(pXmlDoc,
+ "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/"
+ "style:tab-stop[2]",
+ "position", "5.08cm");
+ assertXPath(pXmlDoc,
+ "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/"
+ "style:tab-stop[3]",
+ "position", "10.16cm");
+ assertXPath(pXmlDoc,
+ "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/"
+ "style:tab-stop[4]",
+ "position", "15.24cm");
+ assertXPath(pXmlDoc,
+ "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/"
+ "style:tab-stop[5]",
+ "position", "20.32cm");
+ assertXPath(pXmlDoc,
+ "//style:style[@style:name='P1']/style:paragraph-properties/style:tab-stops/"
+ "style:tab-stop[6]",
+ "position", "25.4cm");
+
+ xDocShRef->DoClose();
+}
+
void SdExportTest::testImageWithSpecialID()
{
// Check how LO handles when the imported graphic's ID is different from that one
commit fe99cb040ef087618973332802877fff45e9b7fc
Author: Piet van Oostrum <piet at vanoostrum.org>
AuthorDate: Thu Nov 26 18:37:56 2015 +0400
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue May 19 23:41:32 2020 +0200
tdf#79082 Correctly import PPT tabs
Change-Id: I7ac5ccb356501983da645f0a6037b5292ce8b5b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/20207
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Jenkins
(cherry picked from commit 070f44e3b2d7dcf26de68ee46c50dad5c0cf2170)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94427
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index a122e6aac203..de39c837fe3a 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5827,7 +5827,6 @@ PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, TSS_Type nIn
PPTNumberFormatCreator ( nullptr ),
mrStyleSheet ( rStyleSheet ),
mnInstance ( nInstance ),
- mbTab ( true ), // style sheets always have to get the right tabulator setting
mnCurrentObject ( 0 )
{
mxParaSet->mnDepth = sanitizeForMaxPPTLevels(nDepth);
@@ -5842,7 +5841,6 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader,
PPTTextRulerInterpreter ( rRuler ),
mrStyleSheet ( rStyleSheet ),
mnInstance ( nInstance ),
- mbTab ( false ),
mnCurrentObject ( 0 )
{
if (rnCurCharPos < rPropReader.aCharPropList.size())
@@ -5857,10 +5855,6 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader,
rPropReader.aCharPropList[rnCurCharPos].get();
std::unique_ptr<PPTPortionObj> pPPTPortion(new PPTPortionObj(
*pCharPropSet, rStyleSheet, nInstance, mxParaSet->mnDepth));
- if (!mbTab)
- {
- mbTab = pPPTPortion->HasTabulator();
- }
m_PortionList.push_back(std::move(pPPTPortion));
}
}
@@ -5874,10 +5868,6 @@ void PPTParagraphObj::AppendPortion( PPTPortionObj& rPPTPortion )
{
m_PortionList.push_back(
std::make_unique<PPTPortionObj>(rPPTPortion));
- if ( !mbTab )
- {
- mbTab = m_PortionList.back()->HasTabulator();
- }
}
void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const
@@ -6322,50 +6312,47 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >&
rSet.Put( aULSpaceItem );
}
- if ( mbTab ) // makes it sense to apply tabsettings
+ sal_uInt32 i, nDefaultTab, nTab, nTextOfs2 = 0;
+ sal_uInt32 nLatestManTab = 0;
+ GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs2, nDestinationInstance );
+ GetAttrib( PPT_ParaAttr_BulletOfs, nTab, nDestinationInstance );
+ GetAttrib( PPT_ParaAttr_BulletOn, i, nDestinationInstance );
+ GetAttrib( PPT_ParaAttr_DefaultTab, nDefaultTab, nDestinationInstance );
+ SvxTabStopItem aTabItem( 0, 0, SvxTabAdjust::Default, EE_PARA_TABS );
+ if ( GetTabCount() )
{
- sal_uInt32 i, nDefaultTab, nTab, nTextOfs2 = 0;
- sal_uInt32 nLatestManTab = 0;
- GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs2, nDestinationInstance );
- GetAttrib( PPT_ParaAttr_BulletOfs, nTab, nDestinationInstance );
- GetAttrib( PPT_ParaAttr_BulletOn, i, nDestinationInstance );
- GetAttrib( PPT_ParaAttr_DefaultTab, nDefaultTab, nDestinationInstance );
- SvxTabStopItem aTabItem( 0, 0, SvxTabAdjust::Default, EE_PARA_TABS );
- if ( GetTabCount() )
+ //paragraph offset = MIN(first_line_offset, hanging_offset)
+ sal_uInt32 nParaOffset = std::min(nTextOfs2, nTab);
+ for ( i = 0; i < GetTabCount(); i++ )
{
- //paragraph offset = MIN(first_line_offset, hanging_offset)
- sal_uInt32 nParaOffset = std::min(nTextOfs2, nTab);
- for ( i = 0; i < GetTabCount(); i++ )
+ SvxTabAdjust eTabAdjust;
+ nTab = GetTabOffsetByIndex( static_cast<sal_uInt16>(i) );
+ switch( GetTabStyleByIndex( static_cast<sal_uInt16>(i) ) )
{
- SvxTabAdjust eTabAdjust;
- nTab = GetTabOffsetByIndex( static_cast<sal_uInt16>(i) );
- switch( GetTabStyleByIndex( static_cast<sal_uInt16>(i) ) )
- {
- case 1 : eTabAdjust = SvxTabAdjust::Center; break;
- case 2 : eTabAdjust = SvxTabAdjust::Right; break;
- case 3 : eTabAdjust = SvxTabAdjust::Decimal; break;
- default : eTabAdjust = SvxTabAdjust::Left;
- }
- if ( nTab > nParaOffset )//If tab stop greater than paragraph offset
- aTabItem.Insert( SvxTabStop( ( ( (long( nTab - nTextOfs2 )) * 2540 ) / 576 ), eTabAdjust ) );
+ case 1 : eTabAdjust = SvxTabAdjust::Center; break;
+ case 2 : eTabAdjust = SvxTabAdjust::Right; break;
+ case 3 : eTabAdjust = SvxTabAdjust::Decimal; break;
+ default : eTabAdjust = SvxTabAdjust::Left;
}
- nLatestManTab = nTab;
+ if ( nTab > nParaOffset )//If tab stop greater than paragraph offset
+ aTabItem.Insert( SvxTabStop( ( ( (long( nTab - nTextOfs2 )) * 2540 ) / 576 ), eTabAdjust ) );
}
- if ( nIsBullet2 == 0 )
- aTabItem.Insert( SvxTabStop( sal_uInt16(0) ) );
- if ( nDefaultTab )
+ nLatestManTab = nTab;
+ }
+ if ( nIsBullet2 == 0 )
+ aTabItem.Insert( SvxTabStop( sal_uInt16(0) ) );
+ if ( nDefaultTab )
+ {
+ nTab = std::max( nTextOfs2, nLatestManTab );
+ nTab /= nDefaultTab;
+ nTab = nDefaultTab * ( 1 + nTab );
+ for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ )
{
- nTab = std::max( nTextOfs2, nLatestManTab );
- nTab /= nDefaultTab;
- nTab = nDefaultTab * ( 1 + nTab );
- for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ )
- {
- aTabItem.Insert( SvxTabStop( static_cast<sal_uInt16>( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) );
- nTab += nDefaultTab;
- }
+ aTabItem.Insert( SvxTabStop( static_cast<sal_uInt16>( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) );
+ nTab += nDefaultTab;
}
- rSet.Put( aTabItem );
}
+ rSet.Put( aTabItem );
}
sal_uInt32 PPTParagraphObj::GetTextSize()
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index efe56823e1c9..e7ee75ec0bde 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -1148,9 +1148,6 @@ class MSFILTER_DLLPUBLIC PPTParagraphObj
void operator=(PPTParagraphObj const&) = delete;
public:
-
- bool mbTab; // if true, this paragraph has tabulators in text
-
sal_uInt32 mnCurrentObject;
::std::vector<std::unique_ptr<PPTPortionObj>> m_PortionList;
More information about the Libreoffice-commits
mailing list