summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2018-02-17 06:35:29 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2018-02-17 07:50:00 +0100
commit1da3a3cb74a415a76fa547ef0c8f61780e260e7f (patch)
tree0367d452050d136d6612ba708038fb9d4584987b /sd
parent71545d500e4b88e960a73d499328504ce99397a8 (diff)
tdf#115639: Align right/center with trailing spaces the same as MS PowerPoint
* Add HoriAlignIgnoreTrailingWhitespace compatibility option. ** For MSO file formats it is set to true ** For ODP format it's set to false by default ** The flag is saved to ODP format as user data if the document comes from an MSO format. Change-Id: Ie22233d33a25e605de46120bfc2195038dffd63c Reviewed-on: https://gerrit.libreoffice.org/49889 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sd')
-rwxr-xr-xsd/qa/unit/data/odp/tdf115639.odpbin0 -> 11770 bytes
-rwxr-xr-xsd/qa/unit/data/ppt/tdf115639.pptbin0 -> 124928 bytes
-rwxr-xr-xsd/qa/unit/data/pptx/tdf115639.pptxbin0 -> 20893 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx33
-rw-r--r--sd/source/ui/docshell/docshel4.cxx16
-rw-r--r--sd/source/ui/view/Outliner.cxx1
6 files changed, 50 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/tdf115639.odp b/sd/qa/unit/data/odp/tdf115639.odp
new file mode 100755
index 000000000000..b732e4e7652b
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf115639.odp
Binary files differ
diff --git a/sd/qa/unit/data/ppt/tdf115639.ppt b/sd/qa/unit/data/ppt/tdf115639.ppt
new file mode 100755
index 000000000000..dade453bfeee
--- /dev/null
+++ b/sd/qa/unit/data/ppt/tdf115639.ppt
Binary files differ
diff --git a/sd/qa/unit/data/pptx/tdf115639.pptx b/sd/qa/unit/data/pptx/tdf115639.pptx
new file mode 100755
index 000000000000..7e00b60cb397
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf115639.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 02ab05d93b0d..85c62dc146a3 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -179,6 +179,7 @@ public:
void testTdf115394();
void testTdf115394PPT();
void testTdf51340();
+ void testTdf115639();
bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
void testPatternImport();
@@ -259,6 +260,7 @@ public:
CPPUNIT_TEST(testTdf115394);
CPPUNIT_TEST(testTdf115394PPT);
CPPUNIT_TEST(testTdf51340);
+ CPPUNIT_TEST(testTdf115639);
CPPUNIT_TEST_SUITE_END();
};
@@ -2483,6 +2485,37 @@ void SdImportTest::testTdf51340()
xDocShRef->DoClose();
}
+
+void SdImportTest::testTdf115639()
+{
+ // Check whether the new compatibility option is loaded correctly
+ // For PPTX we have the flag enabled by default
+ {
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115639.pptx"), PPTX);
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
+ CPPUNIT_ASSERT( pDoc->IsHoriAlignIgnoreTrailingWhitespace() );
+ }
+
+ // For PPT we have the flag enabled by default
+ {
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/ppt/tdf115639.ppt"), PPT);
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
+ CPPUNIT_ASSERT( pDoc->IsHoriAlignIgnoreTrailingWhitespace() );
+ xDocShRef->DoClose();
+ }
+
+ // For ODP we have the flag disabled by default
+ {
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf115639.odp"), ODP);
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
+ CPPUNIT_ASSERT( !pDoc->IsHoriAlignIgnoreTrailingWhitespace() );
+ xDocShRef->DoClose();
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 2d462a44ddb1..2685d68d3c41 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -406,6 +406,14 @@ bool DrawDocShell::ImportFrom(SfxMedium &rMedium,
mpDoc->SetSummationOfParagraphs();
}
+ // Set this flag for MSO formats
+ if (aFilterName.startsWith("MS PowerPoint 97") ||
+ aFilterName.startsWith("Impress MS PowerPoint 2007 XML") ||
+ aFilterName.startsWith("Impress Office Open XML"))
+ {
+ mpDoc->SetHoriAlignIgnoreTrailingWhitespace(true);
+ }
+
const bool bRet = SfxObjectShell::ImportFrom(rMedium, xInsertPosition);
SfxItemSet* pSet = rMedium.GetItemSet();
@@ -495,6 +503,14 @@ bool DrawDocShell::ConvertFrom( SfxMedium& rMedium )
bRet = SdGRFFilter( rMedium, *this ).Import();
}
+ // Set this flag for MSO formats
+ if (aFilterName.startsWith("MS PowerPoint 97") ||
+ aFilterName.startsWith("Impress MS PowerPoint 2007 XML") ||
+ aFilterName.startsWith("Impress Office Open XML"))
+ {
+ mpDoc->SetHoriAlignIgnoreTrailingWhitespace(true);
+ }
+
FinishedLoading();
// tell SFX to change viewshell when in preview mode
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 279f0700d974..45ea0dcec4fa 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -226,6 +226,7 @@ SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode )
SetHyphenator( xHyphenator );
SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
+ SetHoriAlignIgnoreTrailingWhitespace( pDoc->IsHoriAlignIgnoreTrailingWhitespace() );
}
/// Nothing spectacular in the destructor.