Bug 75735 - RTF: FILEOPEN: RTF import sometimes fails to unstack tabs
Summary: RTF: FILEOPEN: RTF import sometimes fails to unstack tabs
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.0.0.3 release
Hardware: Other All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: BSA target:4.3.0 target:4.2.5
Keywords: regression
Depends on:
Blocks:
 
Reported: 2014-03-04 01:05 UTC by Rhodes
Modified: 2014-04-19 15:51 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rhodes 2014-03-04 01:05:41 UTC
Problem description: 
RTF groups, denoted by enclosing curly brackets, are supposed to stack the current character/ruler state and restore it after the closing bracket. If the previous state included tab settings, LibreOffice fails to delete tabs set within the brackets, leading to column misalignment.

Steps to reproduce:
1. This small RTF file displays the problem:
{\rtf1\ansi
{\fonttbl \f0\froman Times;}
\deftab31680
\pard\tx1440\plain\ql\f0\fs40
{\tx360\tx720\tx1080\tab\tab\tab\tab This is line one.\
}{\tx480\tx960\tab\tab\tab This is line two.\
}{\tx720\tab\tab This is line three.\
}{\tab This is line four.\
\tab All these lines should start one inch from the left margin.\
}}

2. This similar file doesn't, as it has no tabs set outside the groups:
{\rtf1\ansi
{\fonttbl \f0\froman Times;}
\deftab31680
\pard\plain\ql\f0\fs40
{\tx360\tx720\tx1080\tx1440\tab\tab\tab\tab This is line one.\
}{\tx480\tx960\tx1440\tab\tab\tab This is line two.\
}{\tx720\tx1440\tab\tab This is line three.\
}{\tx1440\tab This is line four.\
\tab All these lines should start one inch from the left margin.\
}}

Current behavior:
The first file shows misaligned lines; the second doesn't.

Expected behavior:
Both files should display like the second file, as they do in Microsoft Word, (Mac) TextEdit, Nisus Writer, and other RTF readers.

It's a somewhat obscure bug. I hope the fix is easy.


              
Operating System: Mac OS X
Version: 4.2.1.1 release
Comment 1 Andras Timar 2014-03-31 16:25:46 UTC
It was good in 3.6.4. Confirmed with 4.0.
Comment 2 Miklos Vajna 2014-04-18 14:34:09 UTC
Regression from a48e2fd9049797110b3b2505c363557284987ca8, the problem is that when we set an attribute in a nested structure, then ensureCopyBeforeWrite() before set() is only called for the child, not for the parent.
Comment 3 Commit Notification 2014-04-18 15:35:58 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6b6e4d471c2954d34d280398ed1c986d7fb27ae1

fdo#75735 RTF import: fix COW when writing a nested structure



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 4 Miklos Vajna 2014-04-18 19:43:41 UTC
-4-2 review: https://gerrit.libreoffice.org/9100
Comment 5 Commit Notification 2014-04-19 15:51:53 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d65fff78bfcb4c557d35eec8293c9109ab34fc03&h=libreoffice-4-2

fdo#75735 RTF import: fix COW when writing a nested structure


It will be available in LibreOffice 4.2.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.