summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2018-02-17 15:49:27 +0100
committerAndras Timar <andras.timar@collabora.com>2018-02-19 09:22:35 +0100
commitf26899be899f1a39ea1e6b5ad8b46bad9cf1216f (patch)
tree345407df73c3eb74fbd755209b9617aba24b2ec7 /sd
parent04040bd9e4b8cf52dc75b7d4510c6fc1d104896a (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. Reviewed-on: https://gerrit.libreoffice.org/49889 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 1da3a3cb74a415a76fa547ef0c8f61780e260e7f) Change-Id: Ie22233d33a25e605de46120bfc2195038dffd63c Reviewed-on: https://gerrit.libreoffice.org/49909 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@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 1212eee9495d..c66134291e05 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -157,6 +157,7 @@ public:
void testTdf115394PPT();
void testTdf114821();
void testTdf51340();
+ void testTdf115639();
bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
void testPatternImport();
@@ -230,6 +231,7 @@ public:
CPPUNIT_TEST(testTdf115394PPT);
CPPUNIT_TEST(testTdf114821);
CPPUNIT_TEST(testTdf51340);
+ CPPUNIT_TEST(testTdf115639);
CPPUNIT_TEST_SUITE_END();
};
@@ -2409,6 +2411,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 a94c79ea4126..7082a8fef297 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();
@@ -497,6 +505,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 1a58a2102333..9b82afe0061c 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -230,6 +230,7 @@ SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode )
SetHyphenator( xHyphenator );
SetDefaultLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
+ SetHoriAlignIgnoreTrailingWhitespace( pDoc->IsHoriAlignIgnoreTrailingWhitespace() );
}
/// Nothing spectacular in the destructor.