Bug 79082 - FILESAVE: Tab positions not being retained in PPT and being lost in PPTX
Summary: FILESAVE: Tab positions not being retained in PPT and being lost in PPTX
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Presentation (show other bugs)
Version: Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard: BSA filter:pptx filter:ppt
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-22 18:23 UTC by Alexander
Modified: 2014-11-02 16:20 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
test case (127.80 KB, application/x-zip-compressed)
2014-05-22 18:23 UTC, Alexander
Details
Zip file with example files Tabs.odp, Tabs.ppt, Tabs2.ppt, Tabs.pptx (60.62 KB, application/zip)
2014-09-16 16:01 UTC, Piet van Oostrum
Details
Proposed patch (2.15 KB, patch)
2014-10-31 00:27 UTC, Piet van Oostrum
Details | Splinter Review

Description Alexander 2014-05-22 18:23:10 UTC
Created attachment 99595 [details]
test case

Problem description: 
On it's own adds tab positions to paragraph when saving in Office XP format

Steps to reproduce:
1. Create presentation with a paragraph with no tab stops
2. Save it to format Microsoft PowerPoint 97/2000/XP/2003 (.ppt)
3. Close and open the presentation

Current behavior:
Tab stops appeared in the paragraphs where were absent 

Expected behavior:
Tab stops shouldn't have appeared

It changes the text appearance after the document is closed and opened again.

Thanks

Operating System: Windows 8
Version: 4.2.4.2 release
Comment 1 Piet van Oostrum 2014-09-16 15:54:15 UTC
I have some additional info because I got (almost) the same problem. I use LibreOffice 4.3.1.2 on Mac OS X 10.6.8.
I got the same problem when I had defined tab stops for a paragraph (see the attached Tabs.odp and the paragraph with the sample text. I set tanb stops at 0 4 and 10cm. My default tab stops were set at 1.25cm. The tab stops in the powerpoint file (Tabs.ppt) got set at multiples of 1.25cm, but with an offset (start at 0.3cm). 

Then when I changed the default tab stops to 2.0 cm and saved the file again as PPT (Tabs2.ppt) the stops changed to multiples of 2cm (again with an offset).

And, by the way, when saving to PPTX, the tab stops just disappear (Tabs.pptx).

All the example files in Tabs.zip.
Comment 2 Piet van Oostrum 2014-09-16 16:01:47 UTC
Created attachment 106377 [details]
Zip file with example files Tabs.odp, Tabs.ppt, Tabs2.ppt, Tabs.pptx
Comment 3 Jay Philips 2014-09-30 03:28:23 UTC
Hello Alexander,

Thank you for submitting the bug. This isnt a bug because impress' default tabs spacing is 2 inches and in order to preserve this tab size in a .ppt file, it has to put them into the file, so that if you opened in up in powerpoint, the file would appear in the same way. Powerpoint on the other hand has a default tab spacing of 1 inch.

Hello Piet,

Thank you for contributing to the bug. Yes i can confirm that tabs are not being saved correctly in ppt and being lost when saving to pptx.

Version: 4.4.0.0.alpha0+
Build ID: df73f4115cfe4d07e4159adf087571687eb173ec
TinderBox: Linux-rpm_deb-x86@45-TDF, Branch:master, Time: 2014-09-25_23:36:54
Comment 4 Piet van Oostrum 2014-10-31 00:19:10 UTC
I found the problem. I loaded the Tabs.ppt file in Powerpoint (the real one on Windows) and the tabs were there. So the problem appears to be on importing the PPT file in Impress. 

In libreoffice-4.3.2.2/filter/source/msfilter/svdfppt.cxx, line 6160 there is a line

    if ( mbTab )    // makes it sense to apply tabsettings

which makes setting the tab stops in a paragraph conditional upon there being real tabs in the paragraph, supposedly as a kind of optimization. On a slide master the tabs are retained, however.

This is bad for 3 reasons:
1. It is not a good idea to throw away information that a user has put deliberately in a file.

2. If the user intends to edit the imported PPT file, and add some tabs then (s)he has to recreate the tabs.

3. [This is the most serious one]. In Powerpoint 97-2003 a text frame can only have one sets of tab stops for all paragraphs. When a PPT file is saved in e.g. Powerpoint 2007 or 2010, the tab stops of the first paragraph of the text frame is used and the tab stops of the subsequent paragraphs in the same text frame disappear. The Impress PPT export code does the same as it has no choice. Now suppose the imported PPT file has the first paragraph without tabs in it but the next one does have them. Then when you make some change to the file and save it again as PPT, the tabs in the text frame will be replaced by the default tab stops because the tab stops of the first paragraph had been deleted on the import.

So that test should be eliminated. As mbTab is only used for this purpose also the code to set it can be eliminated.

There was also a second issue, that the default tabs that were in the imported presentation had an offset of 0.3 cm. This is caused by the fact that the default tab stops that the paragraph gets come from the slide master. The paragraph in the slide master has an indent of 0.3 cm (in this presentation), because it is bulleted.

Now in PPT tab stops are relative to the left margin of the text frame, but in Impress they are relative to the text indent. So on import export this has to be compensated, which is just what happened.
Comment 5 Piet van Oostrum 2014-10-31 00:27:54 UTC
Created attachment 108711 [details] [review]
Proposed patch

I have tested this patch and it solves the problem for the PPT import
Comment 6 Markus Mohrhard 2014-11-02 16:20:04 UTC
Please send the patch either to the developer mailing list or to gerrit (https://wiki.documentfoundation.org/Development/gerrit) as we are not monitoring bugzilla for patches. Additionally patches for import/export filters are easier to review if they include a test case.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.