summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-10-02 16:52:54 +0300
committerTor Lillqvist <tml@collabora.com>2014-10-02 21:09:52 +0300
commit96d210bf9ca0a99fc8256d6e0a4952207cce69e0 (patch)
tree2b01dce7c6f0dcc915c9a19dae4900f72180d908 /sd
parent72a7450c027dd816ff6eaf231f58de7b5ad9c0a8 (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
Diffstat (limited to 'sd')
-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 1108721603da..3be0607ac414 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -23,6 +23,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>
@@ -374,6 +376,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();