Reveal code, old macros convert them to LO

Dan Lewis elderdanlewis at gmail.com
Fri Jul 5 14:02:20 UTC 2019


On 7/4/19 8:06 AM, Thorsten Behrens wrote:
> Hi Uwe,
>
> Uwe Brauer wrote:
>> Is there somebody with enough knownledge in macros to translate those
>> macros to LO 6.2?
>>
> Perhaps - I'd suggest you upload them somewhere (provided they are
> available under an open source license) & post a link here.
>
> Preferably as a bug report at bugs.documentfoundation.org; you can
> include a description on how to run them / what is expected to work
> there.
>
> All the best,
>
> -- Thorsten
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libreoffice

I see in the two threads on this topic that there is a much discussion 
without looking at what is the basics of the ODT layout. I this is a 
mistake, and here is why.

I have some .sxw files from which I had earlier an .odt copy. From them 
I obtained the following information:

This is the ODT layout:

Which types of data source can OpenOffice.org use?
     • A database server  using Java Database Connectivity (JDBC).
     • A database server using Open Database Connectivity (ODBC).
     • The built-in dbase source.
     • The built-in Adabas source.
     • ActiveX data objects (ADO) -only available on Windows.
     • Text files.
     • Spreadsheets.
     • Address Books.
The help manual that comes with OpenOffice.org does a good job of 
describing these data sources and how to connect to them. Use 
Help>Contents>Database Functionality>Data Sources.

This is the styles markup of it:

<text:p text:style-name="P3">Which types of data source can 
OpenOffice.org use?
  </text:p>
  <text:unordered-list text:style-name="L1">
       <text:list-item>
            <text:p text:style-name="P4">A database server
                <text:s/>using Java Database Connectivity (JDBC).
             </text:p>
     </text:list-item>
     <text:list-item>
         <text:p text:style-name="P4">A database server using Open 
Database Connectivity (ODBC).
         </text:p>
     </text:list-item>
     <text:list-item>
          <text:p text:style-name="P4">The built-in dbase source.
          </text:p>
     </text:list-item>
     <text:list-item>
         <text:p text:style-name="P4">The built-in Adabas source.
         </text:p>
     </text:list-item>
     <text:list-item>
         <text:p text:style-name="P4">ActiveX data objects (ADO) -only 
available on Windows.
         </text:p>
     </text:list-item>
     <text:list-item>
         <text:p text:style-name="P4">Text files.
         </text:p>
     </text:list-item>
     <text:list-item>
         <text:p text:style-name="P4">Spreadsheets.
         </text:p>
     </text:list-item>
     <text:list-item>
         <text:p text:style-name="P3">Which types of data source can 
OpenOffice.org use? </text:p>
<text:unordered-list text:style-name="L1">
     <text:list-item><text:p text:style-name="P4">A database server
         <text:s/>using Java Database Connectivity (JDBC).
     </text:p>
     </text:list-item><text:list-item>
         <text:p text:style-name="P4">A database server using Open 
Database Connectivity (ODBC).
         </text:p>
     </text:list-item><text:list-item>
         <text:p text:style-name="P4">The built-in dbase source.
         </text:p>
     </text:list-item><text:list-item>
         <text:p text:style-name="P4">The built-in Adabas source.
         </text:p>
     </text:list-item><text:list-item>
         <text:p text:style-name="P4">ActiveX data objects (ADO) -only 
available on Windows.
</text:p></text:list-item><text:list-item>
         <text:p text:style-name="P4">Text files.
         </text:p>
     </text:list-item><text:list-item>
         <text:p text:style-name="P4">Spreadsheets.
         </text:p>
     </text:list-item><text:list-item>
         <text:p text:style-name="P4">Address Books.
         </text:p>
     </text:list-item></text:unordered-list>
         <text:p text:style-name="P5">The help manual that comes with 
OpenOffice.org does a good job of describing these data sources and how 
to connect to them. Use Help>Contents>Database 
Functionality>Data Sources.
         </text:p>Address Books.
         </text:p>
     </text:list-item>
</text:unordered-list>
<text:p text:style-name="P5">The help manual that comes with 
OpenOffice.org does a good job of describing these data sources and how 
to connect to them. Use Help>Contents>Database 
Functionality>Data Sources.
</text:p>

The markup comes directly from the Content.xml file of either the .sxw 
or .odt file. I should mention for those who wondered but did not know: 
the mark up for both files (.sxw, its .odt copy) is identical. To open 
the Content.xml, rename the .odt or .sxw file to .zip. Then unzip it. 
When opening Content.xml, use a browser or similar program which will 
give you an outline layout.

Each of these styles (L1, P3, P4, P5) are defined in the beginning lines 
of Content.xml. For example, L1 contains the styles for "List 1"; P3 
contains the styles for "Heading 3". P4 and P5 both use the paragraph 
style "text body"; P4 also contains the list-item style "L1". Search for 
P4 in the Content.xml beginning from the top to see this.

Looking at the markup above, I do not see any way to get "reveal codes". 
I do think a macro is possible which would reveal the styles used for a 
given part of a document in outline form as above. It would have to 
gather that information from the Content.xml file. Could it then expand 
the name of given style such as L1, P3, P4, p5 so that it would appear 
in place of the style name?

For example, <text:p text:style-name="P4"> becomes
<style:style style:name="P4" style:family="paragraph" 
style:parent-style-name="Text body" style:list-style-name="L1"> (This 
would replace the tag used in the text with the tag used in the list of 
definitions at the beginning of Content.xml.

Comments: Perhaps this could be called "reveal styles"? Also one 
personal point that I learned back when OOo 1.14 was the latest version: 
Do not use direct formatting for any reason. That is what styles are 
for. In the long run, direct formatting does not save any time even when 
you make no errors with them. But needing to change some of the direct 
formatting can be very time consuming!

A few years ago, someone needed a "pamphlet" formatted which I did for 
her using styles. Later she wanted to change some of the characteristics 
of a heading. All I had to do was to change the settings for that 
heading style. This took seconds, and all of that particular heading now 
had been changed. Going through over 50 pages to change each heading 
separately would have taken much longer. (OK, I will get down off my 
soapbox now.)

Dan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20190705/5a43a781/attachment.html>


More information about the LibreOffice mailing list