Bug 57631 - FILESAVE: [REGRESSION] After saving a drawing all formcontrol settings are not saved - reverts to default after reloading
Summary: FILESAVE: [REGRESSION] After saving a drawing all formcontrol settings are no...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
4.0.0.3 release
Hardware: All All
: medium normal
Assignee: David Tardon
URL:
Whiteboard: BSA target:4.2.0 target:4.1.0 target:...
Keywords: regression
: 49249 59898 63049 64598 (view as bug list)
Depends on:
Blocks: mab4.0
  Show dependency treegraph
 
Reported: 2012-11-27 22:01 UTC by starmatz71
Modified: 2014-07-06 09:30 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
ODG Drawing with a formcontrol textfield. LibO3.6.3.2 (8.44 KB, application/vnd.oasis.opendocument.graphics)
2012-11-27 22:01 UTC, starmatz71
Details
ODG Drawing with a formcontrol textfield. LibO3.6.3.2 (9.61 KB, application/vnd.oasis.opendocument.graphics)
2012-11-27 22:11 UTC, starmatz71
Details
This is the PDF-Version of the odf document (Hybrid-File, PDF1/A) (13.02 KB, application/pdf)
2012-11-27 22:13 UTC, starmatz71
Details
Example files for comment 7 (42.60 KB, application/zip)
2013-03-13 19:50 UTC, Jose L. Domingo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description starmatz71 2012-11-27 22:01:42 UTC
Created attachment 70696 [details]
ODG Drawing with a formcontrol textfield. LibO3.6.3.2

Problem description:

I have create a formular in LibreOffice Draw V3.6.3. The textfields are formatted with no border and a bigger font. After saving this file all settings of the formular gets lost.


              
Operating System: All
Last worked in: 3.4.6 release
Comment 1 starmatz71 2012-11-27 22:11:18 UTC
Created attachment 70697 [details]
ODG Drawing with a formcontrol textfield. LibO3.6.3.2
Comment 2 starmatz71 2012-11-27 22:13:37 UTC
Created attachment 70698 [details]
This is the PDF-Version of the odf document (Hybrid-File, PDF1/A)

In the PDF file you can see the original formatting of the text.
If you read the odg file (or the embedded drawing inside the pdf file) you see the formatting is lost.
Comment 3 Rob Snelders 2012-12-02 10:19:17 UTC
Thank you for reporting this bug.

As far as I can see the font and border also aren't changed on the screen. So it seems to me that you can't set them for formular's. Then that would be a wanted feature.

Are the font and border updated on the screen when you try? Please let me know here.
Comment 4 starmatz71 2012-12-02 11:21:16 UTC
I can set it on the screen while editing to whatever i wan't and i see this on the scrren!

If I save this document, close LibO and open the same document all settings (font, size, borders e.g.) are not there.

You can see it in the PDF file how it shoud look like, if you load the embedded odg inside the PDF with LibreOffice Draw you see it is different!

If you do the same in LibreOffice V3.4 it just works!

As workaround i can use a writer document in LibO V3.6, it seems to work for it here. In Writer all settings are saved and if I reload the file all is fine.

It does not work for Draw in LibO 3.6!
Comment 5 Rob Snelders 2012-12-13 21:35:38 UTC
Setting it as new
Comment 6 starmatz71 2013-02-04 22:12:26 UTC
The same happens in LibO V4.0.0.3.
Comment 7 Jose L. Domingo 2013-03-13 19:47:20 UTC
Commenting on this particular bug for greater visibility, and to say the problem is still there in LibreOffice Version 4.0.1.2 (Build ID: 84102822e3d61eb989ddd325abf1ac077904985). What is described here is not limited to PDF export (which ignores control settings different to those as default), as the problem also takes places when saving the file to normal .odg LibreOffice's own format. The problem can be reproduced as follows:

1. Open LibreOffice Draw application
2. Create a single "Form Control", of type "Text Box"
3. Right click on the form control , select "Control..." and edit some control general properties (for example, "Font", "Alignment" and "Border")
4. Save the drawing to default .odg format
5. Close and open LibreOffice again
6. Load the saved file on step 4
7. The form is shown without any of the non-default "Font", "Alignment" and "Border" settings you would expect after performing 3. and saving the document

However, the steps above work fine when run from Writer. That and writing to non-optimized XML format gives some clues about what is going on.

Creating a Writer document with a single "text box" control as mentioned above, with nothing but the defaults (writer-default.odt), and another one with the control settings changed to either text alignment set to center (writer-center.odt) XOR frame changed to "flat" (writer-flatframe.odt), it is clear where in the .odt file those settings are stored:
--- writer-default/content.xml	2013-03-13 19:24:50.000000000 +0100
+++ writer-center/content.xml	2013-03-13 19:25:12.000000000 +0100
@@ -17,7 +17,7 @@
    <style:text-properties fo:hyphenate="false"/>
   </style:style>
   <style:style style:name="P2" style:family="paragraph">
-   <style:paragraph-properties fo:text-align="start"/>
+   <style:paragraph-properties fo:text-align="center"/>
    <style:text-properties style:text-line-through-style="none" style:font-name="Arial" fo:font-size="12pt" fo:font-style="normal" style:text-underline-style="none" fo:font-weight="normal"/>
   </style:style>
   <style:style style:name="T1" style:family="text">

--- writer-default/content.xml	2013-03-13 19:24:50.000000000 +0100
+++ writer-flatframe/content.xml	2013-03-13 19:25:38.000000000 +0100
@@ -24,7 +24,7 @@
    <style:text-properties style:use-window-font-color="true" style:text-outline="false" style:text-line-through-style="none" style:text-position="0% 100%" style:font-name="Times New Roman" fo:font-size="12pt" fo:letter-spacing="normal" fo:language="es" fo:country="ES" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" style:text-underline-mode="continuous" style:text-overline-mode="continuous" style:text-line-through-mode="continuous" style:letter-kerning="true" style:font-name-asian="DejaVu Sans" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-name-complex="Lohit Hindi" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" style:font-style-complex="normal" style:font-weight-complex="normal" style:text-scale="100%" style:font-relief="none"/>
   </style:style>
   <style:style style:name="gr1" style:family="graphic">
-   <style:graphic-properties style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph"/>
+   <style:graphic-properties fo:border="solid" style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph"/>
   </style:style>
  </office:automatic-styles>
  <office:body>


Trying the same thing but using Draw (test file with a text box control, "draw-default.odg", the same with centered text, "draw-center.odg", and the original one with a flat frame, "draw-flatframe.odg"), you can see there is information missing when saving the file to native format:

--- draw-default/content.xml	2013-03-13 19:31:20.000000000 +0100
+++ draw-center/content.xml	2013-03-13 19:31:44.000000000 +0100
@@ -10,9 +10,6 @@
    </style:paragraph-properties>
    <style:text-properties fo:hyphenate="false"/>
   </style:style>
-  <style:style style:name="P2" style:family="paragraph">
-   <style:paragraph-properties fo:text-align="start"/>
-  </style:style>
   <style:style style:name="T1" style:family="text">
    <style:text-properties style:use-window-font-color="true" style:text-outline="false" style:text-line-through-style="none" style:text-position="0% 100%" fo:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="18pt" fo:letter-spacing="normal" fo:language="es" fo:country="ES" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" style:text-underline-mode="continuous" style:text-overline-mode="continuous" style:text-line-through-mode="continuous" style:letter-kerning="true" style:font-family-asian="&apos;DejaVu Sans&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="18pt" style:language-asian="zh" style:country-asian="CN" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-family-complex="&apos;Lohit Hindi&apos;" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="18pt" style:language-complex="hi" style:country-complex="IN" style:font-style-complex="normal" style:font-weight-complex="normal" style:text-scale="100%" style:font-relief="none"/>
   </style:style>
@@ -33,7 +30,7 @@
       </form:textarea>
      </form:form>
     </office:forms>
-    <draw:control draw:style-name="standard" draw:text-style-name="P2" draw:layer="controls" svg:width="12.907cm" svg:height="3.227cm" svg:x="3.775cm" svg:y="4.517cm" draw:control="control1"/>
+    <draw:control draw:style-name="standard" draw:layer="controls" svg:width="12.907cm" svg:height="3.227cm" svg:x="3.775cm" svg:y="4.517cm" draw:control="control1"/>
    </draw:page>
   </office:drawing>
  </office:body>

For the "text align" property for the control, the whole style is removed when saving the modified document (instead of setting fo:text-align="center").

It is curious, but if instead of having a saved Draw file with a control , that you later change and then save under a different name, you create the Draw file and modify the control and save it to some file, there is no difference between a file created for a control with all settings to default, or the file for the modified control. Tried that for the control border frame, and these are the differences:
--- draw-default/content.xml	2013-03-13 19:31:20.000000000 +0100
+++ draw-flatframe/content.xml	2013-03-13 19:38:28.000000000 +0100
@@ -33,7 +33,7 @@
       </form:textarea>
      </form:form>
     </office:forms>
-    <draw:control draw:style-name="standard" draw:text-style-name="P2" draw:layer="controls" svg:width="12.907cm" svg:height="3.227cm" svg:x="3.775cm" svg:y="4.517cm" draw:control="control1"/>
+    <draw:control draw:style-name="standard" draw:text-style-name="P2" draw:layer="controls" svg:width="13.1cm" svg:height="4.259cm" svg:x="3.937cm" svg:y="4.614cm" draw:control="control1"/>
    </draw:page>
   </office:drawing>
  </office:body>


As I manually created the controls without setting the same sizes or positions, the only difference if the coordinates and sizes stored. Basically, Dray completely ignored the control settings when storing the file, and from other testing mentioned, at some other points in the code it seems to simply remove the corresponding styles, instead of modifying them.


It seems the code is there to support this options being stored to the native LibreOffice file formats, and PDF export works fine as far as I have been able to test.

There seems to be Bug 59898 , which described a subset of the problems described here. May be good to mark that other one as a duplicate of this one.
Comment 8 Jose L. Domingo 2013-03-13 19:50:48 UTC
Created attachment 76497 [details]
Example files for comment 7
Comment 9 David Tardon 2013-06-28 08:42:58 UTC
The graphic style is not exported. In addition, the field is exported as form:text instead of form:textarea like in 3.3, which might be caused by the same problem.
Comment 10 David Tardon 2013-07-15 10:25:14 UTC
Oops, I broke this 2 years ago, by commit 42832c6da00419f200f8c6cb65e399df8e68afbe ...
Comment 11 Commit Notification 2013-07-15 10:31:37 UTC
David Tardon committed a patch related to this issue.
It has been pushed to "master":

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

fdo#57631 fix collection of property states



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 12 tommy27 2013-07-15 10:54:48 UTC
according to Comment 6 and Comment 7 is not a 4.1 MAB but rather a 4.0 MAB.

I'm gonna change the "Blocks" and "Version" fielda

@David Tardon
please consider backporting fix to the 4.0.x and 4.1.x branches as well
Comment 13 Commit Notification 2013-07-15 13:54:59 UTC
David Tardon committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

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

fdo#57631 fix collection of property states


It will be available in LibreOffice 4.1.1.

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 14 Commit Notification 2013-07-15 14:18:01 UTC
David Tardon committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5ecbe5df8034895273942fd19a3cd6c9544e1025&h=libreoffice-4-0

fdo#57631 fix collection of property states


It will be available in LibreOffice 4.0.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.
Comment 15 Commit Notification 2013-07-16 09:51:58 UTC
David Tardon committed a patch related to this issue.
It has been pushed to "libreoffice-4-1-0":

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

fdo#57631 fix collection of property states


It will be available already in LibreOffice 4.1.0.

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 16 David Tardon 2013-07-16 10:00:16 UTC
*** Bug 49249 has been marked as a duplicate of this bug. ***
Comment 17 David Tardon 2013-07-16 13:07:27 UTC
*** Bug 64598 has been marked as a duplicate of this bug. ***
Comment 18 David Tardon 2013-07-16 13:14:16 UTC
*** Bug 59898 has been marked as a duplicate of this bug. ***
Comment 19 David Tardon 2013-07-16 13:14:44 UTC
*** Bug 63049 has been marked as a duplicate of this bug. ***
Comment 20 Jose L. Domingo 2014-07-06 09:28:53 UTC
(In reply to comment #15)
> It will be available already in LibreOffice 4.1.0.
> 
> Affected users are encouraged to test the fix and report feedback.
>
I have now had the time to verify the feature now works as expected (saving form controls to ODG format keeps changes from default), and it does indeed work fine.

Done only basic testing , but the same test as described in Comment #7 now works as expected, when previously it didn't.

There are still some glitches with exporting to PDF, but that's another story.

Thank you to all who contributed to fixing this bug.

Cheers!.
Comment 21 Jose L. Domingo 2014-07-06 09:30:21 UTC
(In reply to comment #20)
> Done only basic testing , but the same test as described in Comment #7 now
> works as expected, when previously it didn't.
> 
Of course, I should have mentioned testing was performed using the following Ubunty-bundled version of LibreOffice:

Version: 4.2.4.2 Build ID: 420m0(Build:2)