Tool to compare element styles? (or: text frame will not align in Impress)

I am copying a text frame from one Impress presentation to another, when suddenly I realized a problem with the alignment of the text inside the frame. So I made a file demonstrating the problem: it is posted as test.odp ; and also exported as Flat XML odp format: test-f.odp (NB: .fodp is currently not allowed for upload, see Add fodp, fodt … to allowed upload filename extensions for Ask.LibO - so after downloading test-f.odp, rename it to test.fodp; for more on Flat XML, see Exporting an office document as single, flat, plain-text XML file?)

Anyways, the problem can be seen more clearly here (note: composited image in Gimp - otherwise, if you select two textframes in Impress, Impress will not show their bounding boxes individually, just the total):

Note that the “This aligns center” text to the right (which was added to the .odp manually through the Text tool), aligns center by using the whole width of the text frame, as expected; however, the “This text here \n Will not align center” text to the left (which was pasted from another .odp, which may have previously had content pasted or converted from PowerPoint), while it does align center according to the width of the longest line of text - it does not align according to the text frame width!

So, I thought, that must be some sort of a problematic style entry, so I tried right-clicking on the text frame to the left, and choosing “Edit Style…”, and what I get is this:

… and I find this absolutely overwhelming - in terms of easily finding exactly what is the problem. To make it worse, LO uses “modal dialogs”, so I cannot open another “Edit Style” properties for the other text frame, so as to compare the styles to the correctly formatted text frame. (and I’m pretty sure soffice will not allow being ran in two instances, nor will it allow two Impress windows for the same document).

So my questions are:

  • Is there a GUI tool - either inside LibreOffice or standalone, which could accept references to document elements/objects as inputs, and show a side-by-side comparison of their styles?
  • Why does the problematic alignment happen, and how can I fix it using the LibreOffice GUI?

I guess the only other thing I can do, is compare the raw XML of the elements (hence the export to “Flat XML” - besides being a single file, it is also “pretty-printed” with indented lines, unlike content.xml in an .odp zip file); and try figuring out from there where the problem is…


Edit: results of analysis of XML in .fodp file; the text frames are (added linebreaks manually, for easier reading):

<draw:frame draw:style-name="gr3" draw:text-style-name="P3" 
  draw:layer="layout" svg:width="7.197cm" svg:height="1.361cm" 
  draw:transform="rotate (-1.5707963267949) translate (8.473cm 12.107cm)"
>
  <draw:text-box>
    <text:p text:style-name="P4">
      <text:span text:style-name="T1">This text here </text:span>
    </text:p>
    <text:p text:style-name="P4">
      <text:span text:style-name="T2">Will not align center</text:span>
    </text:p>
  </draw:text-box>
</draw:frame>

<draw:frame draw:style-name="gr4" draw:text-style-name="P4" 
  draw:layer="layout" svg:width="7.112cm" svg:height="0.962cm" 
  svg:x="14.478cm" svg:y="13.97cm"
>
  <draw:text-box>
    <text:p text:style-name="P4">This aligns center</text:p>
  </draw:text-box>
</draw:frame>

So, they both use style P4 as text-style, and styles gr3 and gr4 as draw styles; here are the corresponding XML snippets:

<style:style style:name="P4" style:family="paragraph">
  <style:paragraph-properties fo:text-align="center"/>
</style:style>

<style:style style:name="gr3" 
  style:family="graphic" style:parent-style-name="standard"
>
  <style:graphic-properties 
    draw:stroke="none" svg:stroke-color="#000000" 
    draw:fill="none" draw:fill-color="#ffffff" 
    draw:textarea-horizontal-align="left" 
    draw:auto-grow-height="true" draw:auto-grow-width="false" 
    fo:min-height="1.111cm" fo:min-width="4.818cm"/
  >
</style:style>

<style:style style:name="gr4" 
  style:family="graphic" style:parent-style-name="standard"
>
  <style:graphic-properties 
    draw:stroke="none" svg:stroke-color="#000000" 
    draw:fill="none" draw:fill-color="#ffffff"
    draw:auto-grow-height="true" draw:auto-grow-width="false" 
    fo:max-height="0cm" fo:min-height="0cm"/
  >
</style:style>

Style P4 is as expected; and the difference between gr3 and gr4 is:

  • gr3 has draw:textarea-horizontal-align="left", fo:min-width="4.818cm" - and fo:min-height="1.111cm"
  • gr4 has fo:max-height="0cm" - and fo:min-height="0cm"

So I tried deleting first the fo:min-width from gr3, and reloading the .fodp - that didn’t work; then I deleted the most obvious suspect: draw:textarea-horizontal-align="left" from gr3 - and that finally worked!

Ok - but notice how tedious this process is; so - how would I do this from the Impress GUI? Where would I find this draw:textarea-horizontal-align in there ??

Hi @sdaau you can install several versions in parallel, so you can compare the options in the screen.

Installing several versions of LibreOffice in parallel

Thanks for the answer, @mariosv - however, I find installing two versions of the same software, just to start two instances of it, a bit overkill. I would much more appreciate if soffice had a command line switch like, say, the text editor Geany has: -i, --new-instance Don't open files in a running instance, force opening a new instance. Cheers!

Ok, found at least the GUI part - but it is tedious. Basically, from the XML analysis in the OP edit, I know I should delete/change something corresponding to the attribute draw:textarea-horizontal-align="left".

To begin width, it seems that the LibreOffice Impress GUI cannot differentiate between: styles applied to a text frame; and styles applied to paragraph text inside. For instance, if I right-click the left text frame, and choose “Edit Styles…”, I get this:

lo-styles-1.png

Note that this is (probably) property of the text inside - even if I right-clicked on the text frame!

The only way I’ve found to get to the style of the frame: select the frame, then in “Styles and Formatting”, click the “New Style from Selection” button:

You’ll get another window, enter a name here (say, “copyframe”) and OK. It should then show in the “Styles and Formatting” tree; right-click on this new node in the tree, select “Modify…” - now in the styles editor window, you’ll get this (nb: composite image):

lo-styles-3.png

Here you should just click “Full width” checkmark, and the Text anchor will go from Left to Center automatically. Since the new style is now linked to the originating object, as soon as we click OK to confirm, finally the text frame renders with proper center alignment:

lo-styles-5.png

Pheeew… damn it… I really wonder, how did the designers of this GUI expect, that typical users would be able to troubleshoot a problem like this? I mean, most will hardly ever go through digging through XML and such… And also - if you have separate text frame and text paragraph objects, and they have their own specific attributes - why not clearly stating in the GUI, which style applies to each type of object? Actually, why not render the actual hierarchy of XML objects in the Navigator (which for this .doc, just shows four objects “Shape 1” to “… 4”)?

In any case, this is why a tool to compare elements’ styles in a document (or between documents, even) is still an open question…