Package org.openoffice.da.comp.w2lcommon.filter

# Class UNOPublisher

java.lang.Object
org.openoffice.da.comp.w2lcommon.filter.UNOPublisher

Direct Known Subclasses:
  `LaTeXUNOPublisher`, `XhtmlUNOPublisher`

public class UNOPublisher extends Object
This class converts an open office document to another format

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`UNOPublisher.TargetFormat`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected com.sun.star.uno.XComponentContext`
`xContext`
`protected com.sun.star.frame.XFrame`
`xFrame`

## Constructor Summary

Constructors
Constructor
Description
`UNOPublisher(com.sun.star.uno.XComponentContext xContext, com.sun.star.frame.XFrame xFrame, String sAppName)`
Create a new `UNOPublisher` based on a loaded office document

## Method Summary

Modifier and Type
Method
Description
`boolean`
`documentSaved()`
Check that the document is saved in a location, we can use
`protected String`
`filterFileName(String sFileName)`
Filter the file name to avoid unwanted characters
`String`
`getTargetFileName()`
Get the target file name (or null if the document is not saved)
`String`
`getTargetPath()`
Get the target path (or null if the document is not saved)
`protected String`
`getTargetURL(UNOPublisher.TargetFormat format)`
`protected void`
`postProcess(String sTargetURL, UNOPublisher.TargetFormat format)`
Post process the document after conversion.
`protected com.sun.star.beans.PropertyValue[]`
`postProcessMediaProps(com.sun.star.beans.PropertyValue[] mediaProps)`
Post process the media properties after displaying the dialog
`boolean`
`publish(UNOPublisher.TargetFormat format)`
Publish the document associated with this `UNOPublisher`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### xContext

protected com.sun.star.uno.XComponentContext xContext

### xFrame

protected com.sun.star.frame.XFrame xFrame

## Constructor Details

### UNOPublisher

public UNOPublisher(com.sun.star.uno.XComponentContext xContext, com.sun.star.frame.XFrame xFrame, String sAppName)
Create a new `UNOPublisher` based on a loaded office document

Parameters:
  `xContext` - the component context from which new UNO services are instantiated
  `xFrame` - the current frame
  `sAppName` - the name of the application using the `UNOPublisher`

## Method Details

### publish

public boolean publish(UNOPublisher.TargetFormat format)
Publish the document associated with this `UNOPublisher`. This involves five steps: (1) Check that the document is saved in the local file system. (2) Display the options dialog. (3) Save the document (if the modified flag is true). (4) Convert the document. (5) Post process the document, e.g. displaying the result

Parameters:
  `format` - the target format
Returns:
  true if the publishing was successful

### filterFileName

protected String filterFileName(String sFileName)
Filter the file name to avoid unwanted characters

Parameters:
  `sFileName` - the original file name
Returns:
  the filtered file name

### postProcessMediaProps

protected com.sun.star.beans.PropertyValue[] postProcessMediaProps(com.sun.star.beans.PropertyValue[] mediaProps)
Post process the media properties after displaying the dialog

Parameters:
  `mediaProps` - the media properties as set by the dialog
Returns:
  the updated media properties

### postProcess

protected void postProcess(String sTargetURL, UNOPublisher.TargetFormat format)
Post process the document after conversion.

Parameters:
  `sTargetURL` - URL of the converted document
  `format` - the target format

### documentSaved

public boolean documentSaved()
Check that the document is saved in a location, we can use

Returns:
  true if everthing is o.k.

### getTargetPath

public String getTargetPath()
Get the target path (or null if the document is not saved)

Returns:
  the path

### getTargetFileName

public String getTargetFileName()
Get the target file name (or null if the document is not saved)

Returns:
  the file name

### getTargetURL

protected String getTargetURL(UNOPublisher.TargetFormat format)