https://bugs.freedesktop.org/show_bug.cgi?id=75914
Priority: medium
Bug ID: 75914
Assignee: [email protected]
Summary: Opening document properties dialog removes line breaks
from custom properties
Severity: enhancement
Classification: Unclassified
OS: All
Reporter: [email protected]
Hardware: All
Status: UNCONFIRMED
Version: unspecified
Component: framework
Product: LibreOffice
This is seen on current 4.1.5 and 4.2.2 RC1. May be ultimately inherited from
Openoffice.
May appear as a corner case or even a little abuse of properties, but current
behavior is breaking an extension. Furthermore, current behavior may be non
conforming to the opendocument standard.
Issue description.
------------------
Libreoffice documents can have custom properties associated to them. These
properties can be edited using the File->Properties dialog and the Custom
Properties tab. Alternatively, custom properties may be set by macros via the
available interfaces.
Custom properties have a name, a type and a value, that is set according to the
type. Among the possible types, there is the string type (named Text in the
user interface dialog).
The programmatic interface allows to set a string type custom property whose
value is a string containing line breaks, tabs, etc. When a value containing a
line break is programmatically set, it can be programmatically retrieved and
used by other macros without any issues.
The user interface for setting custom properties has an issue with this,
though. It is sufficient to open the File->Properties dialog (without actually
editing any custom property) to have all the line breaks removed from custom
properties.
This breaks those extensions that need to store pieces of text that may include
line breaks as custom properties. One known example is the Texmaths extensions
that stores the so called 'LaTex preamble' as the 'TexMathsPreamble' property.
This bit of text needs to include line-breaks. As long as the extension is used
without touching the file document properties everything is fine. As soon as
one edits the document properties (e.g. to associate a title to the document)
all that depends on the extension is broken.
To reproduce the issue with the texmaths extension:
---------------------------------------------------
1) Install the texmath extension
2) Open a new presentation or drawing
3) click the "curly pi" icon used to enter texmaths equations
4) When the texmaths dialog opens, press the preamble button
5) Note how the default preamble is organized on multiple lines
6) Close the preamble dialog by pressing the 'save' button, to assure that
a custom document property is created
7) Close the texmaths dialog by pressing 'ESC'
8) Open the File->Properties dialog go to the 'Custom Properties' tab. Do not
edit anything, just note that there is a TexMathsPreamble custom property
9) Move to the 'Description' tab. Assign a title to the document (e.g.
'foobar') and close the dialog pressing the OK button
10) click again the "curly pi" icon used to enter texmaths equations
11) When the texmaths dialog opens, press the preamble button
12) Note that now the preamble is corrupted, with all the line breaks removed
Relationship to the opendocument file format:
---------------------------------------------
I am not an expert with this, but I believe that custom properties that include
text should be 'string' type by the standard and need not to be
'normalizedString'. If this is the case, the text type custom properties should
be allowed to contain characters like line breaks, tabs, initial spaces, etc.
If this is the case (please confirm), the current behavior is a non-conformance
to the standard.
Note that there is no need to have a GUI allowing line breaks to be entered.
But if line-breaks are being entered programmatically, the GUI should not mess
with them.
Questions
---------
1) In case I am wrong and the standard forbids the inclusion of line break
chars in custom properties, please let me know. In this case, I'll suggest the
texmaths author to use base64 encoding to store the preamble.
2) Please let me know if, apart from custom properties, there is any other
mechanism that extensions can use to store their own data together with a
document. If there is a better mechanism, this can be suggested to the texmaths
extension author.
Sorry for the long post, thanks in advance
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs