Fernand Vanrie | 9 Jan 14:47 2012
Picon

Re: Re: Names of output filters? Name of HTML output filter?

Tom,
With the API and some Basic code from the good old Danny B. can do the job
gives us a 65 pages writer Doc.
Hope its helps

Greetz

Ferand

Sub Main
     oFF = createUnoService( "com.sun.star.document.FilterFactory" )
     oFilterNames = oFF.getElementNames()

     ' Now print the filter names.
'    For i = LBound( oFilterNames ) To UBound( oFilterNames )
'        Print oFilterNames(i)
'    Next

     ' Create a Writer doc and save the filter names to it.
     oDoc = StarDesktop.loadComponentFromURL( "private:factory/swriter", 
"_blank", 0, Array() )
     oText = oDoc.getText()
     oCursor = oText.createTextCursor()
     oCursor.gotoEnd( False )

     oText.insertString( oCursor, "Filter Names", False )
     oCursor.ParaStyleName = "Heading 1"
     InsertParaBreak( oText, oCursor )
     oCursor.ParaStyleName = "Default"
     InsertParaBreak( oText, oCursor )

     ' Print the filter names into a Writer document.
     For i = LBound( oFilterNames ) To UBound( oFilterNames )
         oText.insertString( oCursor, oFilterNames(i), False )
         InsertLineBreak( oText, oCursor )
     Next
     InsertParaBreak( oText, oCursor )

     InsertParaBreak( oText, oCursor )
     oText.insertString( oCursor, "Filter Names and their Properties", 
False )
     oCursor.ParaStyleName = "Heading 1"
     InsertParaBreak( oText, oCursor )
     oCursor.ParaStyleName = "Default"

     ' Tab stops at:
     '        0.25 inch    (2.54 cm x 0.25)
     '        0.50 inch    (2.54 cm x 0.50)
     '        2.00 inch    (2.54 cm x 2.00)
     oCursor.ParaTabStops = Array(_
         MakeTabStop( 2540 * 0.25 ),_
         MakeTabStop( 2540 * 0.50 ),_
         MakeTabStop( 2540 * 2.00 ) )

     ' Print the filter names and their parameters.
     For i = LBound( oFilterNames ) To UBound( oFilterNames )
         InsertParaBreak( oText, oCursor )

         cFilterName = oFilterNames(i)
         aFilterProps = oFF.getByName( cFilterName )

         oText.insertString( oCursor, cFilterName, False )

         For j = LBound( aFilterProps ) To UBound( aFilterProps )
             oFilterProp = aFilterProps(j)

             InsertLineBreak( oText, oCursor )
             oText.insertString( oCursor, CHR(9)+oFilterProp.Name, False )

             nFilterPropValueVarType = VarType( oFilterProp.Value )
             If nFilterPropValueVarType = 8201 Then
                 ' VarType 8201 means a sequence of PropertyValue's.
                 oFilterPropNames = oFilterProp.Value
                 For k = LBound( oFilterPropNames ) To UBound( 
oFilterPropNames )
                     InsertLineBreak( oText, oCursor )
                     oText.insertString( oCursor, 
CHR(9)+CHR(9)+oFilterPropNames(k).Name+CHR(9)+CSTR(oFilterPropNames(k).Value), 
False )
                 Next k
             ElseIf nFilterPropValueVarType = 8200 Then
                 ' VarType 8200 means a sequence of Strings.
                 oFilterPropNames = oFilterProp.Value
                 For k = LBound( oFilterPropNames ) To UBound( 
oFilterPropNames )
                     InsertLineBreak( oText, oCursor )
                     oText.insertString( oCursor, 
CHR(9)+CHR(9)+oFilterPropNames(k), False )
                 Next k
             ElseIf nFilterPropValueVarType > 1  And  
nFilterPropValueVarType <= 12 Then
                 oText.insertString( oCursor, 
CHR(9)+CSTR(oFilterProp.Value), False )
             Else
                 oText.insertString( oCursor, CHR(9)+"?? unknown type ?? 
- "+CSTR(nFilterPropValueVarType), False )
             EndIf
         Next j

         InsertParaBreak( oText, oCursor )
     Next i

     InsertParaBreak( oText, oCursor )
End Sub

Sub InsertLineBreak( oText, oCursor )
     oText.insertControlCharacter( oCursor, 
com.sun.star.text.ControlCharacter.LINE_BREAK, False )
End Sub

Sub InsertParaBreak( oText, oCursor )
     oText.insertControlCharacter( oCursor, 
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False )
End Sub

' Create and return a tab stop.
' An array of what this function returns, is used
'  to set the tab stops of a paragraph.
'
' Parameters....
'    nPosition - position in tab stop, in 1000'th of cm.
'    nAlign - optional, if specified, must be one of...
'                com.sun.star.style.TabAlign.LEFT = 0
'                com.sun.star.style.TabAlign.CENTER = 1
'                com.sun.star.style.TabAlign.RIGHT = 2
'                com.sun.star.style.TabAlign.DECIMAL = 3
'                com.sun.star.style.TabAlign.DEFAULT = 4
'    cDecimalChar - optional, if specified, only applies to a DECIMAL 
tab stop,
'                    and specified the character which is recognized as
'                    the decimal point separator.
'    cFillChar - optional, if specified, specifies the char that fills 
the space
'                    between tab stops.
Function MakeTabStop( ByVal nPosition As Long,_
                         Optional nAlign,_
                         Optional cDecimalChar,_
                         Optional cFillChar _
                     ) As com.sun.star.style.TabStop
     If IsMissing( nAlign ) Then
         nAlign = com.sun.star.style.TabAlign.LEFT
     EndIf

     oTabStop = createUnoStruct( "com.sun.star.style.TabStop" )

     oTabStop.Position = nPosition
     oTabStop.Alignment = nAlign

     If Not IsMissing( cDecimalChar ) Then
         oTabStop.DecimalChar = cDecimalChar
     EndIf
     If Not IsMissing( cFillChar ) Then
         oTabStop.FillChar = cFillChar
     EndIf

     MakeTabStop() = oTabStop
End Function

> Hi :)
>
> All i could find was this wiki-page
> http://help.libreoffice.org/Common/About_Import_and_Export_Filters
> last updated in May so i think things are likely to have moved on quite a
> lot!  Also i suspect there are add-ons/extensions that can add to the list.
>
> I tried looking up release notes
> http://www.libreoffice.org/download/release-notes/
> http://wiki.documentfoundation.org/ReleaseNotes/3.5
> which led me to
> http://wiki.documentfoundation.org/Releases/3.4.4_info_about_fixes
> but there is not much detail listed in there.  mostly it seems
> broad-brushstrokes rather than fine-grained detail .
>
> Apols and regards from
> Tom :)
>
> --
> View this message in context: http://nabble.documentfoundation.org/Names-of-output-filters-Name-of-HTML-output-filter-tp3639830p3644521.html
> Sent from the Users mailing list archive at Nabble.com.
>

--

-- 
For unsubscribe instructions e-mail to: users+help <at> global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


Gmane