Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Jesse,

Found some where on a forum, some Basic code to set this filter options by the API

hope it helps

Fernand

' gets all shapes in the current draw page
' @param page: A XDrawPage. If page is not a XDrawPage, an empty shapes collection is returned. ' @return: a com.sun.star.drawing.ShapeCollection containing all shapes, may be empty.
function getAllShapesInDrawPage(thePage as Object)
   ' create empty collection of shapes
   theShapes= createUnoService("com.sun.star.drawing.ShapeCollection")
   if not hasUnoInterfaces(thePage, "com.sun.star.drawing.XDrawPage") then
      getAllShapesInDrawPage = theShapes
      exit function
   end if

   ' add all shapes in the page to the collection
   for i=0 to thePage.getCount() - 1
      theShapes.add(thePage.getByIndex(i))
   next i
   getAllShapesInDrawPage = theShapes
end function


' From a Draw page, export the current selection to eps. If the current selection is empty, select all ' shapes on the page and export them. If there are no shapes on the page, export the empty page.
' Parts of this code are taken from the code in ooo bug 7918.
sub exportSelectionOrPageToEps
   Dim currentPageName as String

   theDoc = StarDesktop.getCurrentComponent()
if not theDoc.SupportsService( "com.sun.star.drawing.DrawingDocument" ) Then
      Msgbox("The current document must be a Draw document", 0)
      exit sub
   end if

    theController = theDoc.currentController
   thePage = theController.currentPage
    theSelection = theController.selection

   ' if nothing is selected, select all shapes in the current page
   if isEmpty(theSelection) then
MsgBox("selection is empty, will select everything in current page", 0)
      theController.select(getAllShapesInDrawPage(thePage))
      theSelection = theDoc.currentController.selection
   end if

   'create url for storing
   Dim origUrl as String
   Dim exportUrl as new com.sun.star.util.URL
   origUrl = theDoc.url
   if isnull(thePage.name) then
exportUrl.complete = Left( origUrl, Len(origUrl) - 4 ) + "_Export" + ".eps"
    else
exportUrl.complete = Left( origUrl, Len(origUrl) - 4 ) + "_" + thePage.name + ".eps"
    endif

   ' Create the export filter.
' A GraphicExportFilter uses a page, shape or collection of shapes as source. theExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" )

    ' Export selection if something is selected, otherwise whole page.
    if not isEmpty(theSelection) then
       theExporter.SetSourceDocument(theSelection)
    else
       msgbox("no selection, exporting whole page", 0)
       theExporter.SetSourceDocument(thePage)
    endif

    ' Set the filter data
    Dim aFilterData(5) as new com.sun.star.beans.PropertyValue
    aFilterData(0).Name = "Level" '1=PS level 1, 2=PS level 2
    aFilterData(0).Value = 2
    aFilterData(1).Name = "ColorFormat" '1=color, 2=grayscale
    aFilterData(1).Value = 1
aFilterData(2).Name = "TextMode" '0=glyph outlines, 1=no glyph outlines, see ooo bug 7918
    aFilterData(2).Value = 1
    aFilterData(3).Name = "Preview" '0=none,1=TIFF,2=EPSI,3=TIFF+EPSI
    aFilterData(3).Value = 0
    aFilterData(4).Name = "CompressionMode" ' 1=LZW, 2=none
    aFilterData(4).Value = 2
    Dim aArgs (2) as new com.sun.star.beans.PropertyValue
    aArgs(0).Name = "MediaType"
    aArgs(0).Value = "image/x-eps"
    aArgs(1).Name = "URL"
    aArgs(1).Value = exportUrl
    aArgs(2).Name = "FilterData"
    aArgs(2).Value = aFilterData()
    theExporter.filter(aArgs())

    MsgBox("exported " + origUrl + " to " + exportUrl.complete, 0)
End Sub


I may have solved my own problem and found the new setting.  Try the following

* Open the file "C:\Program Files (x86)\LibreOffice
3\Basis\share\registry\main.xcd" in a text editor
* Use the Find and Replace feature in your editor.
Find:

EPS"><prop oor:name="Preview"
oor:type="xs:int"><value>0</value></prop><prop oor:name="Version"
oor:type="xs:int"><value>2</value></prop><prop oor:name="ColorFormat"
oor:type="xs:int"><value>2</value></prop><prop
oor:name="CompressionMode"
oor:type="xs:int"><value>2</value></prop><prop oor:name="TextMode"
oor:type="xs:int"><value>0

Replace with:

EPS"><prop oor:name="Preview"
oor:type="xs:int"><value>0</value></prop><prop oor:name="Version"
oor:type="xs:int"><value>2</value></prop><prop oor:name="ColorFormat"
oor:type="xs:int"><value>2</value></prop><prop
oor:name="CompressionMode"
oor:type="xs:int"><value>2</value></prop><prop oor:name="TextMode"
oor:type="xs:int"><value>2


* Restart LibreOffice
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.