summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-10-02 16:52:54 +0300
committerAndras Timar <andras.timar@collabora.com>2014-10-03 09:57:40 +0200
commit18b9cb260a5ec358f6a7b73362bbc306af0417b1 (patch)
treef48b3a44f9d1f5944c1b6471f7011997b85c460f
parent5401e1b618a59c4a4df7fa073b4a5f481bd1ede7 (diff)
bnc#657899: Paragraph vertical spacing differs from PowerPoint
We need to set the "paragraph summation" flag also for .pptx import. (As is already done for .ppt import.) This is what in the Options (Preferences) UI is called "Add spacing between paragraphs and tables (in current document)", on the LibreOffice Impress:General page. This is a setting that when set becomes local to the document. I actually don't really understand why this needs to be a user-visible option, wouldn't it be enough for it to be an internal flag that is set for documents imported from .ppt and .pptx, and is clear otherwise? Change-Id: I525178957276e7d587b6ac4be8ae7919fc245a27 (cherry picked from commit 96d210bf9ca0a99fc8256d6e0a4952207cce69e0) Signed-off-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sd/source/ui/docshell/docshel4.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 654d6a8f204a..952d3075dd30 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -24,6 +24,8 @@
#include <sfx2/progress.hxx>
#include <vcl/waitobj.hxx>
#include <svx/svxids.hrc>
+#include <editeng/editeng.hxx>
+#include <editeng/editstat.hxx>
#include <editeng/flstitem.hxx>
#include <editeng/eeitem.hxx>
#include <svl/aeitem.hxx>
@@ -378,6 +380,26 @@ bool DrawDocShell::LoadFrom( SfxMedium& rMedium )
bool DrawDocShell::ImportFrom(SfxMedium &rMedium,
uno::Reference<text::XTextRange> const& xInsertPosition)
{
+ const OUString aFilterName( rMedium.GetFilter()->GetFilterName() );
+ if( aFilterName == "Impress MS PowerPoint 2007 XML" ||
+ aFilterName == "Impress MS PowerPoint 2007 XML AutoPlay" )
+ {
+ // As this is a MSFT format, we should use the "MS Compat"
+ // mode for spacing before and after paragraphs.
+
+ // This is copied from what is done for .ppt import in
+ // ImplSdPPTImport::Import() in sd/source/filter/ppt/pptin.cxx
+ // in. We need to tell both the edit engine of the draw outliner,
+ // and the document, to do "summation of paragraphs".
+ SdrOutliner& rOutl = mpDoc->GetDrawOutliner();
+ sal_uInt32 nControlWord = rOutl.GetEditEngine().GetControlWord();
+ nControlWord |= EE_CNTRL_ULSPACESUMMATION;
+ nControlWord &=~ EE_CNTRL_ULSPACEFIRSTPARA;
+ ((EditEngine&)rOutl.GetEditEngine()).SetControlWord( nControlWord );
+
+ mpDoc->SetSummationOfParagraphs( true );
+ }
+
const bool bRet = SfxObjectShell::ImportFrom(rMedium, xInsertPosition);
SfxItemSet* pSet = rMedium.GetItemSet();