Patch from r151 applied to trunk + some minor edits

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@154 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2014-08-04 08:11:41 +00:00
parent d62ce9ad22
commit 8d15813690
4 changed files with 18 additions and 42 deletions

View file

@ -8,7 +8,7 @@
<project name="w2l" default="help" basedir=".">
<!-- set this property to the location of your SO/OOo installation -->
<property name="OFFICE_CLASSES" location="/usr/share/libreoffice/program/classes" />
<property name="OFFICE_CLASSES" location="/usr/share/java" />
<property name="URE_CLASSES" location="/usr/share/java" />
<description>writer2latex - build file</description>

Binary file not shown.

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2011 by Henrik Just
* Copyright: 2002-2014 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2011-06-07)
* Version 1.3.1 (2014-08-04)
*
*/
@ -33,7 +33,7 @@ import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertyAccess;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
import com.sun.star.document.XDocumentInfoSupplier;
import com.sun.star.document.XDocumentPropertiesSupplier;
import com.sun.star.frame.XDesktop;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
@ -179,13 +179,9 @@ public abstract class OptionsDialogBase extends DialogBase implements
XComponent xComponent = xDesktop.getCurrentComponent();
// Get the document info property set
XDocumentInfoSupplier xDocInfoSuppl = (XDocumentInfoSupplier)
UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xComponent);
Object docInfo = xDocInfoSuppl.getDocumentInfo();
XPropertySet xDocInfo = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, docInfo);
return XPropertySetHelper.getPropertyValueAsString(xDocInfo,"Template");
XDocumentPropertiesSupplier xDocPropsSuppl =
UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xComponent);
return xDocPropsSuppl.getDocumentProperties().getTemplateName();
}
catch (Exception e) {
return "";

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-16)
* Version 1.3.1 (2014-08-04)
*
*/
@ -34,15 +34,13 @@ import java.net.URISyntaxException;
import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter;
import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.UnknownPropertyException;
import com.sun.star.beans.XPropertySet;
import com.sun.star.document.XDocumentInfoSupplier;
import com.sun.star.document.XDocumentProperties;
import com.sun.star.document.XDocumentPropertiesSupplier;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XStorable;
import com.sun.star.io.NotConnectedException;
import com.sun.star.io.XInputStream;
import com.sun.star.io.XOutputStream;
import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XServiceName;
@ -367,32 +365,14 @@ public class BatchConverter implements
}
// Get the title and the description of the document
XDocumentInfoSupplier docInfo = (XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xDocument);
XPropertySet infoProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, docInfo.getDocumentInfo());
if (infoProps!=null) {
try {
Object loadedTitle = infoProps.getPropertyValue("Title");
if (AnyConverter.isString(loadedTitle)) {
String sLoadedTitle = AnyConverter.toString(loadedTitle);
if (bUseTitle && sLoadedTitle.length()>0) {
entry.setDisplayName(sLoadedTitle);
}
}
Object loadedDescription = infoProps.getPropertyValue("Description");
if (AnyConverter.isString(loadedDescription)) {
String sLoadedDescription = AnyConverter.toString(loadedDescription);
if (bUseDescription && sLoadedDescription.length()>0) {
entry.setDescription(sLoadedDescription);
}
}
}
catch (UnknownPropertyException e) {
}
catch (WrappedTargetException e) {
}
catch (com.sun.star.lang.IllegalArgumentException e) {
}
XDocumentProperties docProps = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xDocument).getDocumentProperties();
String loadedTitle = docProps.getTitle();
if (bUseTitle && loadedTitle.length()>0) {
entry.setDisplayName(loadedTitle);
}
String loadedDescription = docProps.getDescription();
if (bUseDescription && loadedDescription.length()>0) {
entry.setDescription(loadedDescription);
}
// Determine the type of the component