Issue 125072

Summary: OOo cannot correctly import ODF with modified default styles in non-English UI
Product: Writer Reporter: Elie Roux <roux.elie>
Component: codeAssignee: Oliver-Rainer Wittmann <orw>
Status: CLOSED FIXED QA Contact:
Severity: Major    
Priority: P3 CC: rb.henschel, roux.elie
Version: 3.3.0 or older (OOo)   
Target Milestone: 4.2.0   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: 4.1.0
Developer Difficulty: ---
Attachments:
Description Flags
simple document where the problem occurs
none
patch to fix the bug (imported from LO, not tested) orw: review+

Description Elie Roux 2014-06-08 19:43:21 UTC
Created attachment 83529 [details]
simple document where the problem occurs

Steps to reproduce:
 - with the attached document where the style Marginalia has been modified:
    - open it document in an Ensligh UI, it works
    - open it in a French UI, the frame is not placed correctly
 
This issue is also present in latest LibreOffice.

When the bug occurs:
 - the Marginalia style has the correct (modified) properties
 - the frame has the good style (Marginalia)
 - the frame has the same properties as if the Marginalia style wasn't modified, and the layout follows these properties correctly
 
After debugging a little, when rendering the frame, the software looks for the style "Marginalia" (untranslated) and doesn't find it because the styles have already been translated.

This bug is quite serious and prevents many valid ODF documents to be rendered correctly.

The call to lcl_FindFrmFmt is made with the untranslated argument while it should be translated.
Comment 1 Elie Roux 2014-06-08 20:32:25 UTC
LO bug url: https://bugs.freedesktop.org/show_bug.cgi?id=40073

Just fixed the issue, patch here: https://gerrit.libreoffice.org/#/c/9683/
Comment 2 Ariel Constenla-Haile 2014-06-08 20:38:53 UTC
(In reply to Elie Roux from comment #1)
> LO bug url: https://bugs.freedesktop.org/show_bug.cgi?id=40073
> 
> Just fixed the issue, patch here: https://gerrit.libreoffice.org/#/c/9683/

Unfortunately, this project cannot take patches from LO, so code flows from here to LO but not vice versa.
Comment 3 Elie Roux 2014-06-09 07:35:37 UTC
Well, the patch is from me... or should I upload it here too so that you don't take it from LO directly?

Thank you,
Comment 4 Regina Henschel 2014-06-09 11:30:27 UTC
Yes, please attach it here too. Doing this you guarantee, that you give it under Apache License.

When you attach it, you will find a check box "patch" in the attachment form; please check it. And some lines down you will see a drop-down list "Flags". Select the question mark ? item. That will generate a mail to the developer list, so that your patch will be noticed and reviewed.

Please be not disappointed, if you do not get an immediately review.

It might be, that the patch does not apply nicely, because LO and AOO differ in some details in core, and your patch has to be adapted first.
Comment 5 Elie Roux 2014-06-09 11:54:58 UTC
Created attachment 83534 [details]
patch to fix the bug (imported from LO, not tested)

Here is a patch I submitted to LO, so I hereby release it under a license compatible with AOOo.
Comment 6 Regina Henschel 2014-06-09 13:12:18 UTC
Hi Elie, I see the problem with your attached document. But I do not think, that it is a pure problem of not finding the correct style. If I set the horizontal position to any other item, not to "From left", then the display is correct. Also other properties like background are correct. Only the property value "From left" is set wrongly.
Comment 7 Elie Roux 2014-06-09 13:23:58 UTC
That's possible. In LO, the problem was clearly what I described, but maybe in AOOo, the problem lies somewhere else (though it would be surprising)...
Comment 8 Oliver-Rainer Wittmann 2014-06-10 09:03:48 UTC
@Elie Roux: Thanks for the patch.

I am taking over to review the issue and the provided patch.
Comment 9 Oliver-Rainer Wittmann 2014-06-10 13:27:48 UTC
Comment on attachment 83534 [details]
patch to fix the bug (imported from LO, not tested)

patch looks good - I integrate it into trunk
Comment 10 Oliver-Rainer Wittmann 2014-06-10 13:30:39 UTC
I assume the same defect will happen to graphics. See method <SwGraphicProperties_Impl::AnyToItemSet(..)> which also do not 'translate' the name of the Style.
Comment 11 Oliver-Rainer Wittmann 2014-06-10 13:34:25 UTC
(In reply to Oliver-Rainer Wittmann from comment #10)
> I assume the same defect will happen to graphics. See method
> <SwGraphicProperties_Impl::AnyToItemSet(..)> which also do not 'translate'
> the name of the Style.

I can confirm my own observation :(

I will apply Elie's fix also to method <SwGraphicProperties_Impl::AnyToItemSet(..)>
Comment 12 Elie Roux 2014-06-10 13:43:26 UTC
Thank you very much for your check! Can you paste here the link to the patch you'll apply for this new bug?

Thanks
Comment 13 Oliver-Rainer Wittmann 2014-06-10 14:06:50 UTC
(In reply to Oliver-Rainer Wittmann from comment #9)
> Comment on attachment 83534 [details]
> patch to fix the bug (imported from LO, not tested)
> 
> patch looks good - I integrate it into trunk

Some minor adjustments to the patch for AOO will be needed.
Comment 14 Oliver-Rainer Wittmann 2014-06-10 14:09:00 UTC
(In reply to Elie Roux from comment #12)
> Thank you very much for your check! Can you paste here the link to the patch
> you'll apply for this new bug?
> 
> Thanks

No problem.

I am planning to make two commits. One with your adjusted patch and one for the related issue with graphics. The second one will be the same as yours - just a different method.
Comment 15 Oliver-Rainer Wittmann 2014-06-10 14:46:17 UTC
applied given patch with minor adjustments on trunk, rev. 1601654
Comment 16 Oliver-Rainer Wittmann 2014-06-10 14:46:33 UTC
(In reply to Oliver-Rainer Wittmann from comment #15)
> applied given patch with minor adjustments on trunk, rev. 1601654

revision 1601654
Comment 17 SVN Robot 2014-06-10 14:49:07 UTC
"orw" committed SVN revision 1601656 into trunk:
125072: method <SwGraphicProperties_Impl::AnyToItemSet(..)> - map given style...
Comment 18 Oliver-Rainer Wittmann 2014-06-10 14:52:20 UTC
fixed on trunk
Comment 19 Oliver-Rainer Wittmann 2014-06-10 14:53:22 UTC
(In reply to Elie Roux from comment #12)
> Thank you very much for your check! Can you paste here the link to the patch
> you'll apply for this new bug?
> 
> Thanks

revision 1601656 contain the changes for the import of graphics.
Comment 20 Elie Roux 2014-06-10 16:00:29 UTC
Thanx! For information, this was already done in Libreoffice (before I wrote my patch)