diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-11-21 22:21:40 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-11-22 12:10:30 +0100 |
commit | 117fdb9898dcc379b4f83437e858c57fd1d11911 (patch) | |
tree | 809d9346dd75a6317f9f726a27b06807781c86e0 /qadevOOo/tests | |
parent | Similar changes as in ../LibreOffice4Android (diff) | |
download | core-117fdb9898dcc379b4f83437e858c57fd1d11911.tar.gz core-117fdb9898dcc379b4f83437e858c57fd1d11911.zip |
convert users of XDocumentInfo to XDocumentProperties
Change-Id: I10f395f90d554d0ec26fe9f2654ae839e21c7ee5
Diffstat (limited to 'qadevOOo/tests')
10 files changed, 87 insertions, 105 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java index 2fde6b2a544d..9732359bf501 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java @@ -28,7 +28,8 @@ import util.SOfficeFactory; import util.XMLTools; import com.sun.star.beans.XPropertySet; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.document.XExporter; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; @@ -133,11 +134,10 @@ public class XMLMetaExporter extends TestCase { xEx.setSourceDocument(xSheetDoc); // Obtaining and changing property values - XDocumentInfoSupplier infoSup = UnoRuntime.queryInterface (XDocumentInfoSupplier.class, - xSheetDoc) ; - XPropertySet docInfo = UnoRuntime.queryInterface - (XPropertySet.class, infoSup.getDocumentInfo()) ; - docInfo.setPropertyValue("Title", "TestDocument"); + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xSheetDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + xDocProps.setTitle("TestDocument"); log.println("fill sheet 1 with contnet..."); util.CalcTools.fillCalcSheetWithContent(xSheetDoc,1, 3, 3, 50, 50); diff --git a/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java index f5df59c92d24..c494520f53cc 100644 --- a/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java @@ -27,7 +27,8 @@ import lib.TestParameters; import util.SOfficeFactory; import com.sun.star.beans.XPropertySet; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.document.XImporter; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; @@ -160,24 +161,17 @@ public class XMLMetaImporter extends TestCase { tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ; - XDocumentInfoSupplier infoSup = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xSheetDoc) ; - final XPropertySet docInfo = UnoRuntime.queryInterface - (XPropertySet.class, infoSup.getDocumentInfo()) ; + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xSheetDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); final PrintWriter logF = log ; tEnv.addObjRelation("XDocumentHandler.ImportChecker", new ifc.xml.sax._XDocumentHandler.ImportChecker() { public boolean checkImport() { - try { - String title = (String) docInfo.getPropertyValue - ("Title") ; - logF.println("Title returned = '" + title + "'") ; - return impTitle.equals(title) ; - } catch (com.sun.star.uno.Exception e) { - logF.println("Exception occurred while checking filter :") ; - e.printStackTrace(logF) ; - return false ; - } + String title = xDocProps.getTitle(); + logF.println("Title returned = '" + title + "'") ; + return impTitle.equals(title) ; } }) ; diff --git a/qadevOOo/tests/java/mod/_sm/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_sm/XMLMetaExporter.java index 9c961854c6e4..2c7535cdb13c 100644 --- a/qadevOOo/tests/java/mod/_sm/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_sm/XMLMetaExporter.java @@ -27,8 +27,9 @@ import lib.TestParameters; import util.SOfficeFactory; import util.XMLTools; -import com.sun.star.document.XDocumentInfo; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.beans.XPropertyContainer; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.document.XExporter; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; @@ -126,10 +127,11 @@ public class XMLMetaExporter extends TestCase { xEx.setSourceDocument(xMathDoc); // setting a new name and value for user info field - XDocumentInfoSupplier xDocInfoSup = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xMathDoc) ; - XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo() ; - xDocInfo.setUserFieldName((short) 0, expName) ; - xDocInfo.setUserFieldValue((short) 0, expValue) ; + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xMathDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + XPropertyContainer xProps = xDocProps.getUserDefinedProperties(); + xProps.addProperty(expName, (short)0, expValue); } catch (com.sun.star.uno.Exception e) { e.printStackTrace(log) ; throw new StatusException("Can't create component.", e) ; diff --git a/qadevOOo/tests/java/mod/_sm/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_sm/XMLMetaImporter.java index bde9b09712cb..ebd31ebca4e2 100644 --- a/qadevOOo/tests/java/mod/_sm/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_sm/XMLMetaImporter.java @@ -27,8 +27,10 @@ import lib.TestParameters; import util.SOfficeFactory; import com.sun.star.beans.XPropertySet; -import com.sun.star.document.XDocumentInfo; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.beans.XPropertySetInfo; +import com.sun.star.beans.Property; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; @@ -114,13 +116,9 @@ public class XMLMetaImporter extends TestCase { final String impValue = "XMLMetaImporter_Value" ; final String impTitle = "XMLMetaImporter Title" ; - final XDocumentInfoSupplier xDocInfoSup ; try { oObj = (XInterface)xMSF.createInstance( "com.sun.star.comp.Math.XMLMetaImporter"); - - xDocInfoSup = UnoRuntime.queryInterface - (XDocumentInfoSupplier.class, xMathDoc) ; } catch (com.sun.star.uno.Exception e) { e.printStackTrace(log); throw new StatusException("Unexpected exception", e); @@ -156,20 +154,29 @@ public class XMLMetaImporter extends TestCase { new ifc.xml.sax._XDocumentHandler.ImportChecker() { public boolean checkImport() { try { - XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo() ; - XPropertySet xDocInfoProp = UnoRuntime.queryInterface - (XPropertySet.class, xDocInfo) ; - boolean result = false ; - for (short i = 0; i < xDocInfo.getUserFieldCount(); i++) { - String gName = xDocInfo.getUserFieldName(i) ; - String gValue = xDocInfo.getUserFieldValue(i) ; + XDocumentPropertiesSupplier xPropSup = + UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xMathDoc); + final XDocumentProperties xDocProps = + xPropSup.getDocumentProperties(); + + XPropertySet xUDProps = UnoRuntime.queryInterface( + XPropertySet.class, + xDocProps.getUserDefinedProperties()); + XPropertySetInfo xInfo = + xUDProps.getPropertySetInfo(); + Property[] props = xInfo.getProperties(); + boolean result = false; + for (int i = 0; i < props.length; i++) { + String gName = props[i].Name; + String gValue = (String) + xUDProps.getPropertyValue(gName); logF.println("Field '" + gName + "' = '" + gValue + "'") ; if (impName.equals(gName) && impValue.equals(gValue)) result = true ; } - String gTitle = (String) xDocInfoProp.getPropertyValue - ("Title"); + String gTitle = xDocProps.getTitle(); logF.println("Title returned : '" + gTitle + "'"); result &= impTitle.equals(gTitle) ; diff --git a/qadevOOo/tests/java/mod/_sw/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_sw/XMLMetaExporter.java index dadcd90ddbd5..1de4f4baee13 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLMetaExporter.java @@ -28,7 +28,8 @@ import util.SOfficeFactory; import util.XMLTools; import com.sun.star.beans.XPropertySet; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.document.XExporter; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.XTextDocument; @@ -129,12 +130,10 @@ public class XMLMetaExporter extends TestCase { xEx.setSourceDocument(xTextDoc); //set some meta data - XDocumentInfoSupplier infoSup = UnoRuntime.queryInterface - (XDocumentInfoSupplier.class, xTextDoc) ; - XPropertySet docInfo = UnoRuntime.queryInterface - (XPropertySet.class, infoSup.getDocumentInfo()) ; - docInfo.setPropertyValue("Title", TITLE); - + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xTextDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + xDocProps.setTitle(TITLE); } catch (com.sun.star.uno.Exception e) { e.printStackTrace(log) ; throw new StatusException("Can't create component.", e) ; diff --git a/qadevOOo/tests/java/mod/_sw/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_sw/XMLMetaImporter.java index c234003caf8c..7e071d8e504d 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLMetaImporter.java @@ -27,7 +27,8 @@ import lib.TestParameters; import util.SOfficeFactory; import com.sun.star.beans.XPropertySet; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; @@ -153,24 +154,17 @@ public class XMLMetaImporter extends TestCase { tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ; - XDocumentInfoSupplier infoSup = UnoRuntime.queryInterface - (XDocumentInfoSupplier.class, xTextDoc) ; - final XPropertySet docInfo = UnoRuntime.queryInterface - (XPropertySet.class, infoSup.getDocumentInfo()) ; + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xTextDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); final PrintWriter logF = log ; tEnv.addObjRelation("XDocumentHandler.ImportChecker", new ifc.xml.sax._XDocumentHandler.ImportChecker() { public boolean checkImport() { - try { - String title = (String) docInfo.getPropertyValue("Title") ; - logF.println("Title returned = '" + title + "'") ; - return impTitle.equals(title) ; - } catch (com.sun.star.uno.Exception e) { - logF.println("Exception occurred while checking filter :") ; - e.printStackTrace(logF) ; - return false ; - } + String title = xDocProps.getTitle(); + logF.println("Title returned = '" + title + "'") ; + return impTitle.equals(title) ; } }) ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaExporter.java index 01b61cb665f7..af8a5b7e83b0 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaExporter.java @@ -28,7 +28,8 @@ import util.SOfficeFactory; import util.XMLTools; import com.sun.star.beans.XPropertySet; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.document.XExporter; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; @@ -128,11 +129,10 @@ public class XMLMetaExporter extends TestCase { xEx.setSourceDocument(xDrawDoc); //set some meta data - XDocumentInfoSupplier infoSup = UnoRuntime.queryInterface(XDocumentInfoSupplier.class, - xDrawDoc) ; - XPropertySet docInfo = UnoRuntime.queryInterface - (XPropertySet.class, infoSup.getDocumentInfo()) ; - docInfo.setPropertyValue("Title", TITLE); + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xDrawDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + xDocProps.setTitle(TITLE); } catch (com.sun.star.uno.Exception e) { e.printStackTrace(log) ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaImporter.java index 1fbfb34922c8..afbfad4dfd94 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Draw/XMLMetaImporter.java @@ -27,7 +27,8 @@ import lib.TestParameters; import util.SOfficeFactory; import com.sun.star.beans.XPropertySet; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; @@ -152,25 +153,17 @@ public class XMLMetaImporter extends TestCase { tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ; //set some meta data - XDocumentInfoSupplier infoSup = UnoRuntime.queryInterface - (XDocumentInfoSupplier.class, xDrawDoc); - final XPropertySet docInfo = UnoRuntime.queryInterface - (XPropertySet.class, infoSup.getDocumentInfo()); + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xDrawDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); final PrintWriter logF = log ; tEnv.addObjRelation("XDocumentHandler.ImportChecker", new ifc.xml.sax._XDocumentHandler.ImportChecker() { public boolean checkImport() { - try { - String title = (String) docInfo.getPropertyValue - ("Title") ; - logF.println("Title returned = '" + title + "'") ; - return impTitle.equals(title) ; - } catch (com.sun.star.uno.Exception e) { - logF.println("Exception occurred while checking filter :") ; - e.printStackTrace(logF) ; - return false ; - } + String title = xDocProps.getTitle(); + logF.println("Title returned = '" + title + "'") ; + return impTitle.equals(title) ; } }) ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java index 1ab04a13492c..5a21079cd266 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaExporter.java @@ -28,7 +28,8 @@ import util.SOfficeFactory; import util.XMLTools; import com.sun.star.beans.XPropertySet; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.document.XExporter; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; @@ -128,12 +129,11 @@ public class XMLMetaExporter extends TestCase { XExporter xEx = UnoRuntime.queryInterface(XExporter.class,oObj); xEx.setSourceDocument(xImpressDoc); - //change title name - XDocumentInfoSupplier infoSup = UnoRuntime.queryInterface - (XDocumentInfoSupplier.class, xImpressDoc) ; - XPropertySet docInfo = UnoRuntime.queryInterface - (XPropertySet.class, infoSup.getDocumentInfo()) ; - docInfo.setPropertyValue("Title", NAME); + // change title name + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xImpressDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); + xDocProps.setTitle(NAME); } catch (com.sun.star.uno.Exception e) { e.printStackTrace(log) ; diff --git a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java index b504d262572a..6dbd37f6c12d 100644 --- a/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java +++ b/qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java @@ -27,7 +27,8 @@ import lib.TestParameters; import util.SOfficeFactory; import com.sun.star.beans.XPropertySet; -import com.sun.star.document.XDocumentInfoSupplier; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.document.XDocumentProperties; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; @@ -151,25 +152,17 @@ public class XMLMetaImporter extends TestCase { tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ; - XDocumentInfoSupplier infoSup = UnoRuntime.queryInterface - (XDocumentInfoSupplier.class, xImpressDoc) ; - final XPropertySet docInfo = UnoRuntime.queryInterface - (XPropertySet.class, infoSup.getDocumentInfo()) ; + XDocumentPropertiesSupplier xPropSup = UnoRuntime.queryInterface + (XDocumentPropertiesSupplier.class, xImpressDoc); + final XDocumentProperties xDocProps = xPropSup.getDocumentProperties(); final PrintWriter logF = log ; tEnv.addObjRelation("XDocumentHandler.ImportChecker", new ifc.xml.sax._XDocumentHandler.ImportChecker() { public boolean checkImport() { - try { - String title = (String) - docInfo.getPropertyValue("Title") ; - logF.println("Title returned = '" + title + "'") ; - return impTitle.equals(title) ; - } catch (com.sun.star.uno.Exception e) { - logF.println("Exception occurred while checking filter :") ; - e.printStackTrace(logF) ; - return false ; - } + String title = xDocProps.getTitle(); + logF.println("Title returned = '" + title + "'") ; + return impTitle.equals(title) ; } } ); |