From b0a3032631003bfe5cf5e7c39773105fc50151cd Mon Sep 17 00:00:00 2001 From: Lars Langhans Date: Tue, 8 Jun 2010 08:35:09 +0200 Subject: sb123:#i111449# cleanups in ucb qa/complex tests --- ucb/prj/build.lst | 26 ++- ucb/qa/complex/tdoc/CheckContentProvider.java | 237 ++++++++++++--------- .../tdoc/CheckTransientDocumentsContent.java | 80 ++++--- .../CheckTransientDocumentsContentProvider.java | 80 ++++--- .../CheckTransientDocumentsDocumentContent.java | 93 ++++---- ucb/qa/complex/tdoc/TestDocument.java | 39 ++++ ucb/qa/complex/tdoc/interfaces/makefile.mk | 4 +- ucb/qa/complex/tdoc/makefile.mk | 73 +++---- ucb/qa/complex/tdoc/test_documents/Iterator.sxw | Bin 0 -> 5627 bytes ucb/qa/complex/tdoc/test_documents/chinese.sxw | Bin 0 -> 5757 bytes ucb/qa/complex/tdoc/test_documents/filter.sxw | Bin 0 -> 14359 bytes ucb/qa/complex/test_documents/Iterator.sxw | Bin 5627 -> 0 bytes ucb/qa/complex/test_documents/chinese.sxw | Bin 5757 -> 0 bytes ucb/qa/complex/test_documents/filter.sxw | Bin 14359 -> 0 bytes ucb/qa/complex/ucb/UCB.java | 169 +++++++++------ ucb/qa/complex/ucb/makefile.mk | 58 ++--- 16 files changed, 501 insertions(+), 358 deletions(-) create mode 100644 ucb/qa/complex/tdoc/TestDocument.java create mode 100644 ucb/qa/complex/tdoc/test_documents/Iterator.sxw create mode 100644 ucb/qa/complex/tdoc/test_documents/chinese.sxw create mode 100644 ucb/qa/complex/tdoc/test_documents/filter.sxw delete mode 100644 ucb/qa/complex/test_documents/Iterator.sxw delete mode 100644 ucb/qa/complex/test_documents/chinese.sxw delete mode 100644 ucb/qa/complex/test_documents/filter.sxw (limited to 'ucb') diff --git a/ucb/prj/build.lst b/ucb/prj/build.lst index a4d7ef6b4f6b..b6994781ca57 100644 --- a/ucb/prj/build.lst +++ b/ucb/prj/build.lst @@ -1,17 +1,21 @@ uc ucb : cppuhelper CURL:curl OPENSSL:openssl NEON:neon LIBXML2:libxml2 offapi sal salhelper ucbhelper udkapi comphelper NULL -uc ucb usr1 - all uc_mkout NULL -uc ucb\inc nmake - all uc_inc NULL -uc ucb\source\regexp nmake - all uc_regexp uc_inc NULL -uc ucb\source\core nmake - all uc_core uc_regexp uc_inc NULL -uc ucb\source\cacher nmake - all uc_cacher uc_inc NULL -uc ucb\source\sorter nmake - all uc_sorter uc_inc NULL -uc ucb\source\ucp\ftp nmake - all uc_ftp uc_inc NULL -uc ucb\source\ucp\file nmake - all uc_file uc_inc NULL -uc ucb\source\ucp\gvfs nmake - u uc_gvfs uc_inc NULL -uc ucb\source\ucp\gio nmake - u uc_gio uc_inc NULL +uc ucb usr1 - all uc_mkout NULL +uc ucb\inc nmake - all uc_inc NULL +uc ucb\source\regexp nmake - all uc_regexp uc_inc NULL +uc ucb\source\core nmake - all uc_core uc_regexp uc_inc NULL +uc ucb\source\cacher nmake - all uc_cacher uc_inc NULL +uc ucb\source\sorter nmake - all uc_sorter uc_inc NULL +uc ucb\source\ucp\ftp nmake - all uc_ftp uc_inc NULL +uc ucb\source\ucp\file nmake - all uc_file uc_inc NULL +uc ucb\source\ucp\gvfs nmake - u uc_gvfs uc_inc NULL +uc ucb\source\ucp\gio nmake - u uc_gio uc_inc NULL uc ucb\source\ucp\hierarchy nmake - all uc_hierarchy uc_inc NULL uc ucb\source\ucp\webdav nmake - all uc_webdav uc_inc NULL uc ucb\source\ucp\package nmake - all uc_package uc_inc NULL -uc ucb\source\ucp\tdoc nmake - all uc_tdoc uc_inc NULL +uc ucb\source\ucp\tdoc nmake - all uc_tdoc uc_inc NULL uc ucb\source\ucp\expand nmake - all uc_expand uc_inc NULL uc ucb\qa\unoapi nmake - all uc_qa_unoapi NULL + +uc ucb\qa\complex\ucb nmake - all uc_complex_ucb uc_inc NULL +# fails, please fix +# uc ucb\qa\complex\tdoc nmake - all uc_complex_tdoc uc_inc NULL diff --git a/ucb/qa/complex/tdoc/CheckContentProvider.java b/ucb/qa/complex/tdoc/CheckContentProvider.java index a20a96829e0b..d3dfd120611e 100755 --- a/ucb/qa/complex/tdoc/CheckContentProvider.java +++ b/ucb/qa/complex/tdoc/CheckContentProvider.java @@ -42,7 +42,6 @@ import com.sun.star.ucb.XContentIdentifier; import com.sun.star.ucb.XContentIdentifierFactory; import com.sun.star.ucb.XContentProvider; import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; import complex.tdoc.interfaces._XChild; import complex.tdoc.interfaces._XCommandInfoChangeNotifier; import complex.tdoc.interfaces._XComponent; @@ -53,9 +52,15 @@ import complex.tdoc.interfaces._XContent; import complex.tdoc.interfaces._XPropertiesChangeNotifier; import complex.tdoc.interfaces._XPropertyContainer; import complex.tdoc.interfaces._XPropertySetInfoChangeNotifier; -import lib.TestEnvironment; import util.WriterTools; -import util.utils; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; /** * Check the TransientDocumentsContentProvider (TDOC). Three documents are @@ -66,7 +71,7 @@ import util.utils; * with an accept parameter (writer is initially opened). Otherwise loaded * documents are not found. */ -public class CheckContentProvider extends ComplexTestCase { +public class CheckContentProvider { private final String testDocuments[] = new String[]{"filter.sxw", "chinese.sxw", "Iterator.sxw"}; private final int countDocs = testDocuments.length; private XMultiServiceFactory xMSF = null; @@ -89,37 +94,38 @@ public class CheckContentProvider extends ComplexTestCase { * Important is, that the test of the element comes first, then the test of * its interfaces. **/ - public String[] getTestMethodNames() { - return new String[]{"checkTDOCRoot", - "checkTDOCRootInterfaces", - "checkTDOCDocument", - "checkTDOCDocumentInterfaces", - "checkTDOCFolder", - "checkTDOCFolderInterfaces", - "checkTDOCStream", - "checkTDOCStreamInterfaces", - }; - } +// public String[] getTestMethodNames() { +// return new String[]{"checkTDOCRoot", +// "checkTDOCRootInterfaces", +// "checkTDOCDocument", +// "checkTDOCDocumentInterfaces", +// "checkTDOCFolder", +// "checkTDOCFolderInterfaces", +// "checkTDOCStream", +// "checkTDOCStreamInterfaces", +// }; +// } /** * Open some documents before the test */ - public void before() { - xMSF = (XMultiServiceFactory)param.getMSF(); + @Before public void before() { + xMSF = getMSF(); xTextDoc = new XTextDocument[countDocs]; - log.println("Open some new documents."); + System.out.println("Open some new documents."); for (int i=0; i 1) - failed("Implementation has been changed. Check this test!"); - assure("The service name '" + serviceName + "' is not valid.", !serviceName.equals("com.sun.star.ucb.DynamicContentResultSet"), true); + { + fail("Implementation has been changed. Check this test!"); + } + assertTrue("The service name '" + serviceName + "' is not valid.", !serviceName.equals("com.sun.star.ucb.DynamicContentResultSet")); XResultSet xResultSet = xDynamicResultSet.getStaticResultSet(); - XContentAccess xContentAccess = (XContentAccess)UnoRuntime.queryInterface(XContentAccess.class, xResultSet); + XContentAccess xContentAccess = UnoRuntime.queryInterface(XContentAccess.class, xResultSet); // iterate over the result: three docs were opened, we should have at least three content identifier strings int countContentIdentifiers = 0; while(xResultSet.next()) { countContentIdentifiers++; String identifier = xContentAccess.queryContentIdentifierString(); - log.println("Identifier of row " + xResultSet.getRow() + ": " + identifier); + System.out.println("Identifier of row " + xResultSet.getRow() + ": " + identifier); } // some feeble test: if the amount >2, we're ok. // 2do: check better - assure("Did only find " + countContentIdentifiers + " open documents." + + assertTrue("Did only find " + countContentIdentifiers + " open documents." + " Should have been at least 3.", countContentIdentifiers>2); } catch (com.sun.star.uno.Exception e) { - e.printStackTrace((java.io.PrintWriter)log); - failed("Could not create test objects."); + e.printStackTrace(); + fail("Could not create test objects."); } } + + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + // setup and close connections + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + } diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java index 229f5d388697..ad0001161c49 100755 --- a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java +++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java @@ -34,49 +34,49 @@ import com.sun.star.embed.XStorage; import com.sun.star.frame.XModel; import com.sun.star.frame.XTransientDocumentsDocumentContentFactory; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbc.XResultSet; import com.sun.star.sdbc.XRow; import com.sun.star.text.XTextDocument; import com.sun.star.ucb.Command; import com.sun.star.ucb.ContentInfo; -import com.sun.star.ucb.InsertCommandArgument; import com.sun.star.ucb.OpenCommandArgument2; import com.sun.star.ucb.OpenMode; import com.sun.star.ucb.XCommandProcessor; import com.sun.star.ucb.XContent; -import com.sun.star.ucb.XContentAccess; -import com.sun.star.ucb.XContentIdentifier; -import com.sun.star.ucb.XContentIdentifierFactory; -import com.sun.star.ucb.XContentProvider; import com.sun.star.ucb.XDynamicResultSet; import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; import util.WriterTools; import util.utils; - +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; /** * */ -public class CheckTransientDocumentsDocumentContent extends ComplexTestCase { +public class CheckTransientDocumentsDocumentContent { private final String testDocuments = "sForm.sxw"; private final String folderName = "TestFolder"; private XMultiServiceFactory xMSF = null; private XTextDocument xTextDoc = null; - public String[] getTestMethodNames() { - return new String[]{"checkTransientDocumentsDocumentContent"}; - } +// public String[] getTestMethodNames() { +// return new String[]{"checkTransientDocumentsDocumentContent"}; +// } - public void before() { - xMSF = (XMultiServiceFactory)param.getMSF(); - log.println("Open a document."); - String fileName = utils.getFullTestURL(testDocuments); + @Before public void before() { + xMSF = getMSF(); + System.out.println("Open a document."); + String fileName = TestDocument.getUrl(testDocuments); xTextDoc = WriterTools.loadTextDoc(xMSF, fileName); + assertNotNull(xTextDoc); } - public void after() { - log.println("Close all documents."); + @After public void after() { + System.out.println("Close all documents."); xTextDoc.dispose(); } @@ -84,30 +84,28 @@ public class CheckTransientDocumentsDocumentContent extends ComplexTestCase { * Check the provider of document content: open some documents * and look if they are accessible. */ - public void checkTransientDocumentsDocumentContent() { + @Test public void checkTransientDocumentsDocumentContent() { try { // create a content provider Object o = xMSF.createInstance("com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory"); XTransientDocumentsDocumentContentFactory xTransientDocumentsDocumentContentFactory = - (XTransientDocumentsDocumentContentFactory)UnoRuntime.queryInterface( - XTransientDocumentsDocumentContentFactory.class, o); + UnoRuntime.queryInterface(XTransientDocumentsDocumentContentFactory.class, o); // get the model from the opened document XModel xModel = xTextDoc.getCurrentController().getModel(); // a little additional check for 114733 - XDocumentSubStorageSupplier xDocumentSubStorageSupplier = (XDocumentSubStorageSupplier) - UnoRuntime.queryInterface(XDocumentSubStorageSupplier.class, xModel); + XDocumentSubStorageSupplier xDocumentSubStorageSupplier = UnoRuntime.queryInterface(XDocumentSubStorageSupplier.class, xModel); String[]names = xDocumentSubStorageSupplier.getDocumentSubStoragesNames(); for (int i=0; i +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +package complex.tdoc; + +import java.io.File; +import org.openoffice.test.OfficeFileUrl; + +final class TestDocument { + public static String getUrl(String name) { + return OfficeFileUrl.getAbsolute(new File("test_documents", name)); + } + + private TestDocument() {} +} diff --git a/ucb/qa/complex/tdoc/interfaces/makefile.mk b/ucb/qa/complex/tdoc/interfaces/makefile.mk index 3a57d1501ca4..5399383f19e6 100755 --- a/ucb/qa/complex/tdoc/interfaces/makefile.mk +++ b/ucb/qa/complex/tdoc/interfaces/makefile.mk @@ -25,10 +25,10 @@ # #************************************************************************* -PRJ = ..$/..$/..$/.. +PRJ = ../../../.. TARGET = TransientDocument PRJNAME = $(TARGET) -PACKAGE = complex$/tdoc$/interfaces +PACKAGE = complex/tdoc/interfaces # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk diff --git a/ucb/qa/complex/tdoc/makefile.mk b/ucb/qa/complex/tdoc/makefile.mk index 175184de0f27..f5f2629f5592 100755 --- a/ucb/qa/complex/tdoc/makefile.mk +++ b/ucb/qa/complex/tdoc/makefile.mk @@ -25,62 +25,43 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = TransientDocument -PRJNAME = $(TARGET) -PACKAGE = complex.tdoc - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = CheckContentProvider.java \ - CheckTransientDocumentsContent.java \ - CheckTransientDocumentsContentProvider.java \ - CheckTransientDocumentsDocumentContent.java +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -# CheckSimpleFileAccess.java \ -#----- make a jar from compiled files ------------------------------ +PRJ = ../../.. +PRJNAME = sc +TARGET = qa_complex_tdoc -MAXLINELENGTH = 100000 +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/tdoc -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE +JAVATESTFILES = \ + CheckContentProvider.java \ + CheckTransientDocumentsContent.java \ + CheckTransientDocumentsContentProvider.java \ + CheckTransientDocumentsDocumentContent.java -# --- Parameters for the test -------------------------------------- +JAVAFILES = $(JAVATESTFILES) \ + TestDocument.java -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand \ - "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -# test base is java complex -CT_TESTBASE = -TestBase java_complex -# replace $/ with . in package name -CT_PACKAGE = -o $(PACKAGE:s\$/\.\) +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +SUBDIRS = interfaces -# start the runner application -CT_APP = org.openoffice.Runner +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -# test document path -CT_TESTDOCS = -tdoc $(PWD)$/..$/test_documents +.END -# --- Targets ------------------------------------------------------ +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -run: ALLTAR - @echo . - @echo "The followig tests are available:" - @echo $(foreach,i,$(JAVAFILES) "dmake $(i:b) ") +ALLTAR : javatest -.INCLUDE : target.mk +.END -Check%: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_TESTDOCS) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).$@ diff --git a/ucb/qa/complex/tdoc/test_documents/Iterator.sxw b/ucb/qa/complex/tdoc/test_documents/Iterator.sxw new file mode 100644 index 000000000000..9a7f8961bb47 Binary files /dev/null and b/ucb/qa/complex/tdoc/test_documents/Iterator.sxw differ diff --git a/ucb/qa/complex/tdoc/test_documents/chinese.sxw b/ucb/qa/complex/tdoc/test_documents/chinese.sxw new file mode 100644 index 000000000000..53b242a292c3 Binary files /dev/null and b/ucb/qa/complex/tdoc/test_documents/chinese.sxw differ diff --git a/ucb/qa/complex/tdoc/test_documents/filter.sxw b/ucb/qa/complex/tdoc/test_documents/filter.sxw new file mode 100644 index 000000000000..e4b077c65f11 Binary files /dev/null and b/ucb/qa/complex/tdoc/test_documents/filter.sxw differ diff --git a/ucb/qa/complex/test_documents/Iterator.sxw b/ucb/qa/complex/test_documents/Iterator.sxw deleted file mode 100644 index 9a7f8961bb47..000000000000 Binary files a/ucb/qa/complex/test_documents/Iterator.sxw and /dev/null differ diff --git a/ucb/qa/complex/test_documents/chinese.sxw b/ucb/qa/complex/test_documents/chinese.sxw deleted file mode 100644 index 53b242a292c3..000000000000 Binary files a/ucb/qa/complex/test_documents/chinese.sxw and /dev/null differ diff --git a/ucb/qa/complex/test_documents/filter.sxw b/ucb/qa/complex/test_documents/filter.sxw deleted file mode 100644 index e4b077c65f11..000000000000 Binary files a/ucb/qa/complex/test_documents/filter.sxw and /dev/null differ diff --git a/ucb/qa/complex/ucb/UCB.java b/ucb/qa/complex/ucb/UCB.java index f7b1d2a8e918..c027dd95bb37 100755 --- a/ucb/qa/complex/ucb/UCB.java +++ b/ucb/qa/complex/ucb/UCB.java @@ -34,7 +34,6 @@ package complex.ucb; * Window>Preferences>Java>Code Generation>Code and Comments */ -import complexlib.ComplexTestCase; import java.util.List; import java.util.Vector; @@ -42,13 +41,22 @@ import com.sun.star.beans.Property; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdbc.XResultSet; import com.sun.star.sdbc.XRow; -import com.sun.star.uno.XComponentContext; +// import com.sun.star.uno.XComponentContext; import com.sun.star.ucb.*; -import com.sun.star.bridge.XUnoUrlResolver; +// import com.sun.star.bridge.XUnoUrlResolver; import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.beans.XPropertySet; +// import com.sun.star.uno.XComponentContext; +// import com.sun.star.lang.XMultiComponentFactory; +// import com.sun.star.beans.XPropertySet; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + /** * @author rpiterman * This class is used to copy the content of a folder to @@ -56,12 +64,12 @@ import com.sun.star.beans.XPropertySet; * There is an incosistency with argument order. * It should be always: dir,filename. */ -public class UCB extends ComplexTestCase { +public class UCB { private Object ucb; - public String[] getTestMethodNames() { - return new String[] {"checkWrongFtpConnection"}; - } +// public String[] getTestMethodNames() { +// return new String[] {"checkWrongFtpConnection"}; +// } public void init(XMultiServiceFactory xmsf) throws Exception { String[] keys = new String[2]; @@ -79,11 +87,13 @@ public class UCB extends ComplexTestCase { /** * target name can be "", in which case the name stays lige the source name - * @param sourceDir - * @param filename - * @param targetDir - * @param targetName - * @return + + * @param xContent + * @param aCommandName + * @param aArgument + * @return + * @throws com.sun.star.ucb.CommandAbortedException + * @throws com.sun.star.uno.Exception */ public Object executeCommand( @@ -92,9 +102,7 @@ public class UCB extends ComplexTestCase { Object aArgument) throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception { XCommandProcessor xCmdProcessor = - (XCommandProcessor) UnoRuntime.queryInterface( - XCommandProcessor.class, - xContent); + UnoRuntime.queryInterface(XCommandProcessor.class, xContent); Command aCommand = new Command(); aCommand.Name = aCommandName; aCommand.Handle = -1; // not available @@ -118,39 +126,44 @@ public class UCB extends ComplexTestCase { XDynamicResultSet xSet; xSet = - (XDynamicResultSet) UnoRuntime.queryInterface( - XDynamicResultSet.class, - executeCommand(xContent, "open", aArg)); + UnoRuntime.queryInterface(XDynamicResultSet.class, executeCommand(xContent, "open", aArg)); XResultSet xResultSet = xSet.getStaticResultSet(); List files = new Vector(); - if (xResultSet.first()) { + if (xResultSet.first()) + { // obtain XContentAccess interface for child content access and XRow for properties - XContentAccess xContentAccess = - (XContentAccess) UnoRuntime.queryInterface( - XContentAccess.class, - xResultSet); - XRow xRow = - (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet); - do { + XContentAccess xContentAccess = UnoRuntime.queryInterface(XContentAccess.class, xResultSet); + XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet); + do + { // Obtain URL of child. String aId = xContentAccess.queryContentIdentifierString(); // First column: Title (column numbers are 1-based!) String aTitle = xRow.getString(1); - if (aTitle.length() == 0 && xRow.wasNull()); - //ignore + if (aTitle.length() == 0 && xRow.wasNull()) + { + //ignore + } else - files.add(aTitle); + { + files.add(aTitle); + } } while (xResultSet.next()); // next child } if (verifier != null) - for (int i = 0; i < files.size(); i++) - if (!verifier.verify(files.get(i))) - files.remove(i--); - + { + for (int i = 0; i < files.size(); i++) + { + if (!verifier.verify(files.get(i))) + { + files.remove(i--); + } + } + } return files; } @@ -165,45 +178,46 @@ public class UCB extends ComplexTestCase { pv[0].Handle = -1; Object row = executeCommand(content, "getPropertyValues", pv); - XRow xrow = (XRow) UnoRuntime.queryInterface(XRow.class, row); + XRow xrow = UnoRuntime.queryInterface(XRow.class, row); if (type.equals(String.class)) - return xrow.getString(1); + { + return xrow.getString(1); + } else if (type.equals(Boolean.class)) - return xrow.getBoolean(1) ? Boolean.TRUE : Boolean.FALSE; + { + return xrow.getBoolean(1) ? Boolean.TRUE : Boolean.FALSE; + } else if (type.equals(Integer.class)) - return new Integer(xrow.getInt(1)); + { + return new Integer(xrow.getInt(1)); + } else if (type.equals(Short.class)) - return new Short(xrow.getShort(1)); + { + return new Short(xrow.getShort(1)); + } else - return null; + { + return null; + } } - public Object getContent(String path) throws Exception { - XContentIdentifier id = - ( - (XContentIdentifierFactory) UnoRuntime.queryInterface( - XContentIdentifierFactory.class, - ucb)).createContentIdentifier( - path); - - return ( - (XContentProvider) UnoRuntime.queryInterface( - XContentProvider.class, - ucb)).queryContent( - id); + public Object getContent(String path) throws Exception + { + XContentIdentifier id = (UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb)).createContentIdentifier(path); + return (UnoRuntime.queryInterface(XContentProvider.class, ucb)).queryContent(id); } public static interface Verifier { public boolean verify(Object object); } - public void checkWrongFtpConnection() { + @Test public void checkWrongFtpConnection() { //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 try { - XMultiServiceFactory xLocMSF = (XMultiServiceFactory)param.getMSF(); + XMultiServiceFactory xLocMSF = getMSF(); String acountUrl = "ftp://noname:nopasswd@nohost"; - log.println(acountUrl); + System.out.println(acountUrl); init(xLocMSF); Object content = getContent(acountUrl); @@ -211,22 +225,45 @@ public class UCB extends ComplexTestCase { aArg.Mode = OpenMode.ALL; // FOLDER, DOCUMENTS -> simple filter aArg.Priority = 32768; // Ignored by most implementations - log.println("now executing open"); + System.out.println("now executing open"); executeCommand(content, "open", aArg); - failed("Expected 'IllegalArgumentException' was not thrown."); + fail("Expected 'IllegalArgumentException' was not thrown."); } catch (com.sun.star.lang.IllegalArgumentException ex) { //TODO error message; - log.println("Correct exception thrown: " + ex.getClass().toString()); + System.out.println("Correct exception thrown: " + ex.getClass().toString()); } catch(com.sun.star.ucb.InteractiveNetworkResolveNameException ex) { - log.println("This Exception is correctly thrown when no Proxy in StarOffice is used."); - log.println("To reproduce the bug behaviour, use a Proxy and try again."); + System.out.println("This Exception is correctly thrown when no Proxy in StarOffice is used."); + System.out.println("To reproduce the bug behaviour, use a Proxy and try again."); } catch (Exception ex) { - ex.printStackTrace((java.io.PrintWriter)log); + ex.printStackTrace(); String exceptionName = ex.toString(); - log.println("ExName: '"+exceptionName+"'"); - failed("Wrong exception thrown: " + exceptionName); + System.out.println("ExName: '"+exceptionName+"'"); + fail("Wrong exception thrown: " + exceptionName); } // System.exit(0); } + + + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + // setup and close connections + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + } diff --git a/ucb/qa/complex/ucb/makefile.mk b/ucb/qa/complex/ucb/makefile.mk index 4664bd3cfae7..4ac3928c9e5e 100755 --- a/ucb/qa/complex/ucb/makefile.mk +++ b/ucb/qa/complex/ucb/makefile.mk @@ -25,54 +25,38 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = UCB -PRJNAME = $(TARGET) -PACKAGE = complex$/ucb - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = UCB.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -#----- make a jar from compiled files ------------------------------ +PRJ = ../../.. +PRJNAME = UCB +TARGET = qa_complex_ucb -MAXLINELENGTH = 100000 +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/ucb +JAVATESTFILES = \ + UCB.java -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE +JAVAFILES = $(JAVATESTFILES) -# --- Parameters for the test -------------------------------------- +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y +.END -# test base is java complex -CT_TESTBASE = -TestBase java_complex +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) +ALLTAR : javatest -# start the runner application -CT_APP = org.openoffice.Runner +.END -# --- Targets ------------------------------------------------------ -.INCLUDE : target.mk -RUN: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_TEST) -run: RUN -- cgit From bb30c0a24baa2bc671daae588b523386470984c7 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Fri, 25 Jun 2010 13:15:03 +0200 Subject: codecleanup02: #i112685# Removed ifdefs and code for WIN,W30,W31 --- ucb/source/ucp/odma/odma_lib.cxx | 4 ---- 1 file changed, 4 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/odma/odma_lib.cxx b/ucb/source/ucp/odma/odma_lib.cxx index 774bcf5f6323..cf9da3a2b942 100644 --- a/ucb/source/ucp/odma/odma_lib.cxx +++ b/ucb/source/ucp/odma/odma_lib.cxx @@ -78,10 +78,6 @@ namespace odma if (bLoaded) return sal_True; ::rtl::OUString sPath; - #ifdef WIN - sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA.DLL")); - - #endif #ifdef WNT sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA32.DLL")); #endif -- cgit From 5a55565739b5a13d395c690b871d108d11f419cd Mon Sep 17 00:00:00 2001 From: Lars Langhans Date: Thu, 1 Jul 2010 13:19:11 +0200 Subject: sb123:#i111449# cleanups in build.lst for qa/complex tests --- ucb/prj/build.lst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ucb') diff --git a/ucb/prj/build.lst b/ucb/prj/build.lst index cc40077674e0..fc66b41b74b2 100644 --- a/ucb/prj/build.lst +++ b/ucb/prj/build.lst @@ -19,4 +19,5 @@ uc ucb\qa\unoapi nmake - all uc_qa_unoapi NULL uc ucb\qa\complex\ucb nmake - all uc_complex_ucb uc_inc NULL # fails, please fix -# uc ucb\qa\complex\tdoc nmake - all uc_complex_tdoc uc_inc NULL +# uc ucb\qa\complex\tdoc\interfaces nmake - all uc_complex_tdoc_interfaces uc_inc NULL +# uc ucb\qa\complex\tdoc nmake - all uc_complex_tdoc uc_complex_tdoc_interfaces uc_inc NULL -- cgit From b5ff94fde0cc506d9c3c17c2762101a0c7a657e4 Mon Sep 17 00:00:00 2001 From: Lars Langhans Date: Mon, 23 Aug 2010 10:38:44 +0200 Subject: sb123:#i111449# remove all subdirs in complex tests --- ucb/prj/build.lst | 1 - ucb/qa/complex/tdoc/CheckContentProvider.java | 10 - .../tdoc/CheckTransientDocumentsContent.java | 1 + .../CheckTransientDocumentsContentProvider.java | 3 +- .../CheckTransientDocumentsDocumentContent.java | 1 + ucb/qa/complex/tdoc/_XChild.java | 104 ++++++++ .../complex/tdoc/_XCommandInfoChangeNotifier.java | 64 +++++ ucb/qa/complex/tdoc/_XCommandProcessor.java | 286 +++++++++++++++++++++ ucb/qa/complex/tdoc/_XComponent.java | 171 ++++++++++++ ucb/qa/complex/tdoc/_XContent.java | 86 +++++++ .../complex/tdoc/_XPropertiesChangeNotifier.java | 67 +++++ ucb/qa/complex/tdoc/_XPropertyContainer.java | 102 ++++++++ .../tdoc/_XPropertySetInfoChangeNotifier.java | 67 +++++ ucb/qa/complex/tdoc/_XServiceInfo.java | 99 +++++++ ucb/qa/complex/tdoc/_XTypeProvider.java | 95 +++++++ ucb/qa/complex/tdoc/interfaces/_XChild.java | 104 -------- .../interfaces/_XCommandInfoChangeNotifier.java | 64 ----- .../tdoc/interfaces/_XCommandProcessor.java | 286 --------------------- ucb/qa/complex/tdoc/interfaces/_XComponent.java | 171 ------------ ucb/qa/complex/tdoc/interfaces/_XContent.java | 86 ------- .../interfaces/_XPropertiesChangeNotifier.java | 67 ----- .../tdoc/interfaces/_XPropertyContainer.java | 102 -------- .../_XPropertySetInfoChangeNotifier.java | 67 ----- ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java | 99 ------- ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java | 95 ------- ucb/qa/complex/tdoc/makefile.mk | 16 +- 26 files changed, 1156 insertions(+), 1158 deletions(-) create mode 100755 ucb/qa/complex/tdoc/_XChild.java create mode 100755 ucb/qa/complex/tdoc/_XCommandInfoChangeNotifier.java create mode 100755 ucb/qa/complex/tdoc/_XCommandProcessor.java create mode 100755 ucb/qa/complex/tdoc/_XComponent.java create mode 100755 ucb/qa/complex/tdoc/_XContent.java create mode 100755 ucb/qa/complex/tdoc/_XPropertiesChangeNotifier.java create mode 100755 ucb/qa/complex/tdoc/_XPropertyContainer.java create mode 100755 ucb/qa/complex/tdoc/_XPropertySetInfoChangeNotifier.java create mode 100755 ucb/qa/complex/tdoc/_XServiceInfo.java create mode 100755 ucb/qa/complex/tdoc/_XTypeProvider.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XChild.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XComponent.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XContent.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java delete mode 100755 ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java (limited to 'ucb') diff --git a/ucb/prj/build.lst b/ucb/prj/build.lst index fc66b41b74b2..8d8c87f3ae4b 100644 --- a/ucb/prj/build.lst +++ b/ucb/prj/build.lst @@ -19,5 +19,4 @@ uc ucb\qa\unoapi nmake - all uc_qa_unoapi NULL uc ucb\qa\complex\ucb nmake - all uc_complex_ucb uc_inc NULL # fails, please fix -# uc ucb\qa\complex\tdoc\interfaces nmake - all uc_complex_tdoc_interfaces uc_inc NULL # uc ucb\qa\complex\tdoc nmake - all uc_complex_tdoc uc_complex_tdoc_interfaces uc_inc NULL diff --git a/ucb/qa/complex/tdoc/CheckContentProvider.java b/ucb/qa/complex/tdoc/CheckContentProvider.java index d3dfd120611e..a039c0c14e87 100755 --- a/ucb/qa/complex/tdoc/CheckContentProvider.java +++ b/ucb/qa/complex/tdoc/CheckContentProvider.java @@ -42,16 +42,6 @@ import com.sun.star.ucb.XContentIdentifier; import com.sun.star.ucb.XContentIdentifierFactory; import com.sun.star.ucb.XContentProvider; import com.sun.star.uno.UnoRuntime; -import complex.tdoc.interfaces._XChild; -import complex.tdoc.interfaces._XCommandInfoChangeNotifier; -import complex.tdoc.interfaces._XComponent; -import complex.tdoc.interfaces._XServiceInfo; -import complex.tdoc.interfaces._XTypeProvider; -import complex.tdoc.interfaces._XCommandProcessor; -import complex.tdoc.interfaces._XContent; -import complex.tdoc.interfaces._XPropertiesChangeNotifier; -import complex.tdoc.interfaces._XPropertyContainer; -import complex.tdoc.interfaces._XPropertySetInfoChangeNotifier; import util.WriterTools; import org.junit.After; diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java index 3320ef890841..ed121e92f9f1 100755 --- a/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java +++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java @@ -51,6 +51,7 @@ import static org.junit.Assert.*; * */ public class CheckTransientDocumentsContent { + // TODO: document doesn't exists private final String testDocuments[] = new String[]{"sForm.sxw"};//, "chinese.sxw", "Iterator.sxw"}; private final int countDocs = testDocuments.length; private XMultiServiceFactory xMSF = null; diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java index 9d3ea87b1d4a..d5aebc7fc3cd 100755 --- a/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java +++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java @@ -56,7 +56,8 @@ import static org.junit.Assert.*; * */ public class CheckTransientDocumentsContentProvider { - private final String testDocuments[] = new String[]{"sForm.sxw", "chinese.sxw", "Iterator.sxw"}; + // TODO: document doesn't exists + private final String testDocuments[] = new String[]{/*"sForm.sxw",*/ "chinese.sxw", "Iterator.sxw"}; private final int countDocs = testDocuments.length; private XMultiServiceFactory xMSF = null; private XTextDocument[] xTextDoc = null; diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java index ad0001161c49..30411458daee 100755 --- a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java +++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java @@ -59,6 +59,7 @@ import static org.junit.Assert.*; * */ public class CheckTransientDocumentsDocumentContent { + // TODO: document doesn't exists private final String testDocuments = "sForm.sxw"; private final String folderName = "TestFolder"; private XMultiServiceFactory xMSF = null; diff --git a/ucb/qa/complex/tdoc/_XChild.java b/ucb/qa/complex/tdoc/_XChild.java new file mode 100755 index 000000000000..4ed71e62008a --- /dev/null +++ b/ucb/qa/complex/tdoc/_XChild.java @@ -0,0 +1,104 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.tdoc; + +import lib.MultiMethodTest; +import lib.Status; + +import com.sun.star.container.XChild; +import com.sun.star.container.XNamed; +import com.sun.star.uno.UnoRuntime; +import share.LogWriter; + +/* +* Testing com.sun.star.container.XChild +* interface methods : +*
    +*
  • getParent()
  • +*
  • setParent()
  • +*
+* @see com.sun.star.container.XChild +*/ +public class _XChild { + + public XChild oObj = null; + public Object gotten = null; + public LogWriter log = null; + + + /** + * Test calls the method and checks return value and that + * no exceptions were thrown. Parent returned is stored.

+ * Has OK status if the method returns not null value + * and no exceptions were thrown.

+ */ + public boolean _getParent(boolean hasParent) { + gotten = oObj.getParent(); + if (!hasParent) + return gotten == null; + XNamed the_name = (XNamed) UnoRuntime.queryInterface(XNamed.class,gotten); + if (the_name != null) + log.println("Parent:"+the_name.getName()); + return gotten != null; + } + + /** + * Sets existing parent and checks that + * no exceptions were thrown.

+ * Has OK status if no exceptions were thrown.

+ * The following method tests are to be completed successfully before : + *

    + *
  • getParent() : to get the parent.
  • + *
+ */ + public boolean _setParent(boolean supported) { +// requiredMethod("getParent()") ; + + String parentComment = null;//String) tEnv.getObjRelation("cannotSwitchParent"); + + if (parentComment != null) { + log.println(parentComment); + return true; + } + + try { + oObj.setParent(gotten); + } + catch (com.sun.star.lang.NoSupportException ex) { + log.println("Exception occured during setParent() - " + (supported?"FAILED":"OK")); + if (supported) { + ex.printStackTrace((java.io.PrintWriter)log); + return false; + } + } + return true; + } + +} // finish class _XChild + + diff --git a/ucb/qa/complex/tdoc/_XCommandInfoChangeNotifier.java b/ucb/qa/complex/tdoc/_XCommandInfoChangeNotifier.java new file mode 100755 index 000000000000..ab32873e9ffb --- /dev/null +++ b/ucb/qa/complex/tdoc/_XCommandInfoChangeNotifier.java @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package complex.tdoc; + +import com.sun.star.ucb.XCommandInfoChangeListener; +import com.sun.star.ucb.XCommandInfoChangeNotifier; +import share.LogWriter; + +/** + * + */ +public class _XCommandInfoChangeNotifier { + public XCommandInfoChangeNotifier oObj = null; + public LogWriter log = null; + private CommandInfoChangeListener listener = new CommandInfoChangeListener(); + + public boolean _addCommandInfoChangeListener() { + oObj.addCommandInfoChangeListener(listener); + return true; + } + + public boolean _removeCommandInfoChangeListener() { + oObj.removeCommandInfoChangeListener(listener); + return true; + } + + private class CommandInfoChangeListener implements XCommandInfoChangeListener { + boolean disposing = false; + boolean infoChanged = false; + + public void commandInfoChange(com.sun.star.ucb.CommandInfoChangeEvent commandInfoChangeEvent) { + infoChanged = true; + } + + public void disposing(com.sun.star.lang.EventObject eventObject) { + disposing = true; + } + + } +} diff --git a/ucb/qa/complex/tdoc/_XCommandProcessor.java b/ucb/qa/complex/tdoc/_XCommandProcessor.java new file mode 100755 index 000000000000..92411d05456f --- /dev/null +++ b/ucb/qa/complex/tdoc/_XCommandProcessor.java @@ -0,0 +1,286 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.tdoc; + +import com.sun.star.beans.Property; +import com.sun.star.beans.XPropertySetInfo; +import lib.MultiMethodTest; +import lib.StatusException; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.ucb.Command; +import com.sun.star.ucb.CommandAbortedException; +import com.sun.star.ucb.CommandInfo; +import com.sun.star.ucb.GlobalTransferCommandArgument; +import com.sun.star.ucb.NameClash; +import com.sun.star.ucb.TransferCommandOperation; +import com.sun.star.ucb.UnsupportedCommandException; +import com.sun.star.ucb.XCommandInfo; +import com.sun.star.ucb.XCommandProcessor; +import com.sun.star.uno.Exception; +import com.sun.star.uno.UnoRuntime; +import share.LogWriter; + +/** +* Tests XCommandProcessor. The TestCase can pass (but doesn't have +* to) "XCommandProcessor.AbortCommand" relation, to specify command to abort in +* abort() test. +* +* Testing com.sun.star.ucb.XCommandProcessor +* interface methods : +*
    +*
  • createCommandIdentifier()
  • +*
  • execute()
  • +*
  • abort()
  • +*

+* This test needs the following object relations : +*

    +*
  • 'XCommandProcessor.AbortCommand' optional +* (of type com.sun.star.ucb.Command): +* specify command to abort in abort() test. +* If the relation is not specified the 'GlobalTransfer' +* command is used.
  • +*

      +* The following predefined files needed to complete the test: +*

        +*
      • poliball.gif : this file is required in case +* if the relation 'XCommandProcessor.AbortCommand' +* is not specified. This file is used by 'GlobalTransfer' +* command as a source file for copying.
      • +*

          +* Test is NOT multithread compilant.

          +* @see com.sun.star.ucb.XCommandProcessor +*/ +public class _XCommandProcessor { + + /** + * Conatins the tested object. + */ + public XCommandProcessor oObj; + public LogWriter log = null; + private XMultiServiceFactory xMSF = null; + + /** + * Contains the command id returned by createCommandIdentifier() + * . It is used in abort() test. + */ + int cmdId; + + public void before(XMultiServiceFactory _xMSF) { + xMSF = _xMSF; + } + + /** + * Tests createCommandIdentifier(). Calls it for two times + * and checks returned values.

          + * Has OK status if values are unique correct idenifiers: not 0. + */ + public boolean _createCommandIdentifier() { + log.println("creating a command line identifier"); + + int testCmdId = oObj.createCommandIdentifier(); + cmdId = oObj.createCommandIdentifier(); + + if (cmdId == 0 || testCmdId == 0) { + log.println("createCommandLineIdentifier() returned 0 - FAILED"); + } + + if (cmdId == testCmdId) { + log.println("the command identifier is not unique"); + } + + return testCmdId != 0 && cmdId != 0 && cmdId != testCmdId; + } + + /** + * First executes 'geCommandInfo' command and examines returned + * command info information. Second tries to execute inproper + * command.

          + * Has OK status if in the first case returned information + * contains info about 'getCommandInfo' command and in the second + * case an exception is thrown.

          + */ + public boolean _execute() { + String[]commands = new String[] {"getCommandInfo", "getPropertySetInfo"}; + boolean returnVal = true; + for (int j=0; jabort method + * is called permanently. Then a "long" command (for example, + * "transfer") is started. I case if relation is not + * specified 'GlobalTransfer' command starts to + * copy a file to temporary directory (if the relation is present + * then the its command starts to work).

          + * Has OK status if the command execution is aborted, i.e. + * CommandAbortedException is thrown.

          + * The following method tests are to be completed successfully before : + *

            + *
          • createCommandIdentifier() : to have a unique + * identifier which is used to abourt started command.
          • + *
          + */ + public boolean _abort() { + //executeMethod("createCommandIdentifier()"); + +// Command command = null;//(Command)tEnv.getObjRelation( + //"XCommandProcessor.AbortCommand"); + Command command = new Command("getCommandInfo", -1, null); + + if (command == null) { + String commandName = "globalTransfer"; + + String srcURL = util.utils.getFullTestURL("solibrary.jar") ; + String tmpURL = util.utils.getOfficeTemp(xMSF) ; + log.println("Copying '" + srcURL + "' to '" + tmpURL) ; + + GlobalTransferCommandArgument arg = new + GlobalTransferCommandArgument( + TransferCommandOperation.COPY, srcURL, + tmpURL, "", NameClash.OVERWRITE); + + command = new Command(commandName, -1, arg); + } + + Thread aborter = new Thread() { + public void run() { + for (int i = 0; i < 10; i++) { + log.println("try to abort command"); + oObj.abort(cmdId); + try { + Thread.sleep(10); + } catch (InterruptedException e) { + } + } + } + }; + + aborter.start(); + + try { + Thread.sleep(15); + } catch (InterruptedException e) { + } + + log.println("executing command"); + try { + oObj.execute(command, cmdId, null); + log.println("Command execution completed"); + log.println("CommandAbortedException is not thrown"); + log.println("This is OK since there is no command implemented "+ + "that can be aborted"); + } catch (CommandAbortedException e) { + return true; + } catch (Exception e) { + log.println("Unexpected exception " + e.getMessage()); + e.printStackTrace((java.io.PrintWriter)log); + return false; + } + + try { + aborter.join(5000); + aborter.interrupt(); + } catch(java.lang.InterruptedException e) { + } + return true; + } +} diff --git a/ucb/qa/complex/tdoc/_XComponent.java b/ucb/qa/complex/tdoc/_XComponent.java new file mode 100755 index 000000000000..16d5c9bebeea --- /dev/null +++ b/ucb/qa/complex/tdoc/_XComponent.java @@ -0,0 +1,171 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.tdoc; + +import com.sun.star.container.XNameContainer; +import lib.MultiMethodTest; + +import com.sun.star.frame.XDesktop; +import com.sun.star.lang.EventObject; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XEventListener; +import share.LogWriter; + +/** +* Testing com.sun.star.lang.XComponent +* interface methods : +*
            +*
          • dispose()
          • +*
          • addEventListener()
          • +*
          • removeEventListener()
          • +*
          +* After this interface test object must be recreated.

          +* Multithreaded test ability not implemented yet. +* @see com.sun.star.lang.XComponent +*/ +public class _XComponent { + + public static XComponent oObj = null; + private XNameContainer xContainer = null; + private XComponent altDispose = null; + public LogWriter log = null; + + boolean listenerDisposed[] = new boolean[2]; + String[] Loutput = new String[2]; + + /** + * Listener which added but not removed, and its method must be called + * on dispose call. + */ + public class MyEventListener implements XEventListener { + public void disposing ( EventObject oEvent ) { + Loutput[0] = Thread.currentThread() + " is DISPOSING EV1" + this; + listenerDisposed[0] = true; + } + }; + + /** + * Listener which added and then removed, and its method must not + * be called on dispose call. + */ + public class MyEventListener2 implements XEventListener { + public void disposing ( EventObject oEvent ) { + Loutput[0] = Thread.currentThread() + " is DISPOSING EV2" + this; + listenerDisposed[1] = true; + } + }; + + XEventListener listener1 = new MyEventListener(); + XEventListener listener2 = new MyEventListener2(); + + /** + * For the cfgmgr2.OSetElement tests: dispose the owner element. + */ + protected void before() { + // do not dispose this component, but parent instead +// altDispose = (XComponent)tEnv.getObjRelation("XComponent.DisposeThis"); + + } + + /** + * Adds two listeners.

          + * Has OK status if then the first listener will receive an event + * on dispose method call. + */ + public boolean _addEventListener() { + + listenerDisposed[0] = false; + listenerDisposed[1] = false; + + oObj.addEventListener( listener1 ); + oObj.addEventListener( listener2 ); + + return true; + } // finished _addEventListener() + + /** + * Removes the second of two added listeners.

          + * Method tests to be completed successfully : + *

            + *
          • addEventListener : method must add two listeners.
          • + *

          + * Has OK status if no events will be sent to the second listener on + * dispose method call. + */ + public boolean _removeEventListener() { +// executeMethod("addEventListener()"); + if (disposed) return true; + // the second listener should not be called + oObj.removeEventListener( listener2 ); + log.println(Thread.currentThread() + " is removing EL " + listener2); + return true; + } // finished _removeEventListener() + + static boolean disposed = false; + + /** + * Disposes the object and then check appropriate listeners were + * called or not.

          + * Method tests to be completed successfully : + *

            + *
          • removeEventListener : method must remove one of two + * listeners.
          • + *

          + * Has OK status if liseter removed wasn't called and other listener + * was. + */ + public boolean _dispose() { + disposed = false; +// executeMethod("removeEventListener()"); + + log.println( "begin dispose" + Thread.currentThread()); + oObj.dispose(); + + try { + Thread.sleep(500) ; + } catch (InterruptedException e) {} + if (Loutput[0]!=null) log.println(Loutput[0]); + if (Loutput[1]!=null) log.println(Loutput[1]); + log.println( "end dispose" + Thread.currentThread()); + disposed = true; + + // check that dispose() works OK. + return listenerDisposed[0] && !listenerDisposed[1]; + + } // finished _dispose() + + /** + * Forces object recreation. + */ + protected void after() { +// disposeEnvironment(); + } + +} // finished class _XComponent + + diff --git a/ucb/qa/complex/tdoc/_XContent.java b/ucb/qa/complex/tdoc/_XContent.java new file mode 100755 index 000000000000..820d2cef0fc7 --- /dev/null +++ b/ucb/qa/complex/tdoc/_XContent.java @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package complex.tdoc; + +import com.sun.star.ucb.XContent; +import com.sun.star.ucb.XContentEventListener; +import com.sun.star.ucb.XContentIdentifier; +import share.LogWriter; + +/** + * + * @author sg128468 + */ +public class _XContent { + public XContent oObj = null; + public LogWriter log = null; + private ContentListener listener = null; + + public boolean _addContentEventListener() { + listener = new ContentListener(); + oObj.addContentEventListener(listener); + return true; + } + public boolean _getContentType() { + String type = oObj.getContentType(); + log.println("Type: " + type); + return type != null && type.indexOf("vnd.sun.star.tdoc") != -1; + } + public boolean _getIdentifier() { + XContentIdentifier xIdent = oObj.getIdentifier(); + String id = xIdent.getContentIdentifier(); + String scheme = xIdent.getContentProviderScheme(); + log.println("Id: " + id); + log.println("Scheme: " + scheme); + return id != null && scheme != null && id.indexOf("vnd.sun.star.tdoc") != -1 && scheme.indexOf("vnd.sun.star.tdoc") != -1; + } + public boolean _removeContentEventListener() { + System.out.println("Event: " + (listener.disposed || listener.firedEvent)); + oObj.removeContentEventListener(listener); + return true; + } + + + private class ContentListener implements XContentEventListener { + private boolean disposed = false; + private boolean firedEvent = false; + + public void reset() { + disposed = false; + firedEvent = false; + } + + public void contentEvent(com.sun.star.ucb.ContentEvent contentEvent) { + firedEvent = true; + } + + public void disposing(com.sun.star.lang.EventObject eventObject) { + disposed = true; + } + + } +} diff --git a/ucb/qa/complex/tdoc/_XPropertiesChangeNotifier.java b/ucb/qa/complex/tdoc/_XPropertiesChangeNotifier.java new file mode 100755 index 000000000000..88e080cd9ec2 --- /dev/null +++ b/ucb/qa/complex/tdoc/_XPropertiesChangeNotifier.java @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package complex.tdoc; + +import com.sun.star.beans.XPropertiesChangeListener; +import com.sun.star.beans.XPropertiesChangeNotifier; +import share.LogWriter; + +/** + * Check the XPropertiesChangeNotifier + */ +public class _XPropertiesChangeNotifier { + public XPropertiesChangeNotifier oObj = null; + public LogWriter log = null; + + PropertiesChangeListener listener = new PropertiesChangeListener(); + String[] args = null; + + + public boolean _addPropertiesChangeListener() { + oObj.addPropertiesChangeListener(args, listener); + return true; + } + + public boolean _removePropertiesChangeListener() { + oObj.removePropertiesChangeListener(args, listener); + return true; + } + + private class PropertiesChangeListener implements XPropertiesChangeListener { + public boolean disposed = false; + public boolean propChanged = false; + + public void disposing(com.sun.star.lang.EventObject eventObject) { + disposed = true; + } + + public void propertiesChange(com.sun.star.beans.PropertyChangeEvent[] propertyChangeEvent) { + propChanged = true; + } + + } +} diff --git a/ucb/qa/complex/tdoc/_XPropertyContainer.java b/ucb/qa/complex/tdoc/_XPropertyContainer.java new file mode 100755 index 000000000000..e425a703d403 --- /dev/null +++ b/ucb/qa/complex/tdoc/_XPropertyContainer.java @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package complex.tdoc; + +import com.sun.star.beans.XPropertyContainer; +import share.LogWriter; + +/** + * + * @author sg128468 + */ +public class _XPropertyContainer { + public XPropertyContainer oObj = null; + public LogWriter log = null; + + public boolean _addProperty() { + boolean result = true; + // add illegal property + try { + oObj.addProperty("MyIllegalProperty", (short)0, null); + } + catch(com.sun.star.beans.PropertyExistException e) { + e.printStackTrace((java.io.PrintWriter)log); + result = false; + } + catch(com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace((java.io.PrintWriter)log); + log.println("'IllegalArgument' Unexpected but correct."); + } + catch(com.sun.star.beans.IllegalTypeException e) { + log.println("'IllegalType' Correctly thrown"); + } + // add valid property + try { + oObj.addProperty("MyLegalProperty", (short)0, "Just a value"); + } + catch(com.sun.star.beans.PropertyExistException e) { + e.printStackTrace((java.io.PrintWriter)log); + result = false; + } + catch(com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace((java.io.PrintWriter)log); + result = false; + } + catch(com.sun.star.beans.IllegalTypeException e) { + e.printStackTrace((java.io.PrintWriter)log); + result = false; + } + return result; + } + + public boolean _removeProperty() { + boolean result = true; + try { + oObj.removeProperty("MyIllegalProperty"); + } + catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("'UnknownProperty' Correctly thrown"); + } + catch(com.sun.star.beans.NotRemoveableException e) { + e.printStackTrace((java.io.PrintWriter)log); + result = false; + } + try { + oObj.removeProperty("MyLegalProperty"); + } + catch(com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace((java.io.PrintWriter)log); + result = false; + } + catch(com.sun.star.beans.NotRemoveableException e) { + e.printStackTrace((java.io.PrintWriter)log); + result = false; + } + return result; + } + +} diff --git a/ucb/qa/complex/tdoc/_XPropertySetInfoChangeNotifier.java b/ucb/qa/complex/tdoc/_XPropertySetInfoChangeNotifier.java new file mode 100755 index 000000000000..4671a0d21571 --- /dev/null +++ b/ucb/qa/complex/tdoc/_XPropertySetInfoChangeNotifier.java @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package complex.tdoc; + +import com.sun.star.beans.XPropertySetInfoChangeListener; +import com.sun.star.beans.XPropertySetInfoChangeNotifier; +import share.LogWriter; + +/** + * + */ +public class _XPropertySetInfoChangeNotifier { + public XPropertySetInfoChangeNotifier oObj = null; + public LogWriter log = null; + + PropertySetInfoChangeListener listener = new PropertySetInfoChangeListener(); + String[] args = null; + + + public boolean _addPropertiesChangeListener() { + oObj.addPropertySetInfoChangeListener(listener); + return true; + } + + public boolean _removePropertiesChangeListener() { + oObj.removePropertySetInfoChangeListener(listener); + return true; + } + + private class PropertySetInfoChangeListener implements XPropertySetInfoChangeListener { + public boolean disposed = false; + public boolean propChanged = false; + + public void disposing(com.sun.star.lang.EventObject eventObject) { + disposed = true; + } + + public void propertySetInfoChange(com.sun.star.beans.PropertySetInfoChangeEvent propertySetInfoChangeEvent) { + } + + } + +} diff --git a/ucb/qa/complex/tdoc/_XServiceInfo.java b/ucb/qa/complex/tdoc/_XServiceInfo.java new file mode 100755 index 000000000000..9c2089f212f9 --- /dev/null +++ b/ucb/qa/complex/tdoc/_XServiceInfo.java @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.tdoc; + +import lib.MultiMethodTest; + +import com.sun.star.lang.XServiceInfo; +import share.LogWriter; + +/** +* Testing com.sun.star.lang.XServiceInfo +* interface methods : +*

            +*
          • getImplementationName()
          • +*
          • supportsService()
          • +*
          • getSupportedServiceNames()
          • +*

          +* Test is multithread compilant.

          +* @see com.sun.star.lang.XServiceInfo +*/ +public class _XServiceInfo { + public static XServiceInfo oObj = null; + public static String[] names = null; + public LogWriter log = null; + + /** + * Just calls the method.

          + * Has OK status if no runtime exceptions occured. + */ + public boolean _getImplementationName() { + boolean result = true; + log.println("testing getImplementationName() ... "); + + log.println("The ImplementationName ist "+oObj.getImplementationName()); + result=true; + + return result; + + } // end getImplementationName() + + + /** + * Just calls the method.

          + * Has OK status if no runtime exceptions occured. + */ + public boolean _getSupportedServiceNames() { + boolean result = true; + log.println("getting supported Services..."); + names = oObj.getSupportedServiceNames(); + for (int i=0;igetSupportedServiceNames method and + * calls the supportsService methos with this + * name.

          + * Has OK status if true value is + * returned. + */ + public boolean _supportsService() { + log.println("testing supportsService"); + names = oObj.getSupportedServiceNames(); + return oObj.supportsService(names[0]); + } // end supportsService() +} + diff --git a/ucb/qa/complex/tdoc/_XTypeProvider.java b/ucb/qa/complex/tdoc/_XTypeProvider.java new file mode 100755 index 000000000000..f8247e7016fe --- /dev/null +++ b/ucb/qa/complex/tdoc/_XTypeProvider.java @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.tdoc; + +import lib.MultiMethodTest; + +import com.sun.star.lang.XTypeProvider; +import com.sun.star.uno.Type; +import share.LogWriter; + +/** +* Testing com.sun.star.lang.XTypeProvider +* interface methods : +*

            +*
          • getTypes()
          • +*
          • getImplementationId()
          • +*

          +* Test is NOT multithread compilant.

          +* @see com.sun.star.lang.XTypeProvider +*/ +public class _XTypeProvider { + + public static XTypeProvider oObj = null; + public static Type[] types = null; + public LogWriter log = null; + + /** + * Just calls the method.

          + * Has OK status if no runtime exceptions occured. + */ + public boolean _getImplementationId() { + boolean result = true; + log.println("testing getImplementationId() ... "); + + log.println("The ImplementationId is "+oObj.getImplementationId()); + result = true; + + return result; + + } // end getImplementationId() + + + /** + * ?alls the method and checks the return value.

          + * Has OK status if one of the return value equals to the + * type com.sun.star.lang.XTypeProvider. + */ + public boolean _getTypes() { + boolean result = false; + log.println("getting Types..."); + types = oObj.getTypes(); + for (int i=0;i"); + } + + return result; + + } // end getTypes() + +} + diff --git a/ucb/qa/complex/tdoc/interfaces/_XChild.java b/ucb/qa/complex/tdoc/interfaces/_XChild.java deleted file mode 100755 index 351fc6f84aa1..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XChild.java +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.tdoc.interfaces; - -import lib.MultiMethodTest; -import lib.Status; - -import com.sun.star.container.XChild; -import com.sun.star.container.XNamed; -import com.sun.star.uno.UnoRuntime; -import share.LogWriter; - -/* -* Testing com.sun.star.container.XChild -* interface methods : -*

            -*
          • getParent()
          • -*
          • setParent()
          • -*
          -* @see com.sun.star.container.XChild -*/ -public class _XChild { - - public XChild oObj = null; - public Object gotten = null; - public LogWriter log = null; - - - /** - * Test calls the method and checks return value and that - * no exceptions were thrown. Parent returned is stored.

          - * Has OK status if the method returns not null value - * and no exceptions were thrown.

          - */ - public boolean _getParent(boolean hasParent) { - gotten = oObj.getParent(); - if (!hasParent) - return gotten == null; - XNamed the_name = (XNamed) UnoRuntime.queryInterface(XNamed.class,gotten); - if (the_name != null) - log.println("Parent:"+the_name.getName()); - return gotten != null; - } - - /** - * Sets existing parent and checks that - * no exceptions were thrown.

          - * Has OK status if no exceptions were thrown.

          - * The following method tests are to be completed successfully before : - *

            - *
          • getParent() : to get the parent.
          • - *
          - */ - public boolean _setParent(boolean supported) { -// requiredMethod("getParent()") ; - - String parentComment = null;//String) tEnv.getObjRelation("cannotSwitchParent"); - - if (parentComment != null) { - log.println(parentComment); - return true; - } - - try { - oObj.setParent(gotten); - } - catch (com.sun.star.lang.NoSupportException ex) { - log.println("Exception occured during setParent() - " + (supported?"FAILED":"OK")); - if (supported) { - ex.printStackTrace((java.io.PrintWriter)log); - return false; - } - } - return true; - } - -} // finish class _XChild - - diff --git a/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java b/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java deleted file mode 100755 index 9800c5c0a398..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.tdoc.interfaces; - -import com.sun.star.ucb.XCommandInfoChangeListener; -import com.sun.star.ucb.XCommandInfoChangeNotifier; -import share.LogWriter; - -/** - * - */ -public class _XCommandInfoChangeNotifier { - public XCommandInfoChangeNotifier oObj = null; - public LogWriter log = null; - private CommandInfoChangeListener listener = new CommandInfoChangeListener(); - - public boolean _addCommandInfoChangeListener() { - oObj.addCommandInfoChangeListener(listener); - return true; - } - - public boolean _removeCommandInfoChangeListener() { - oObj.removeCommandInfoChangeListener(listener); - return true; - } - - private class CommandInfoChangeListener implements XCommandInfoChangeListener { - boolean disposing = false; - boolean infoChanged = false; - - public void commandInfoChange(com.sun.star.ucb.CommandInfoChangeEvent commandInfoChangeEvent) { - infoChanged = true; - } - - public void disposing(com.sun.star.lang.EventObject eventObject) { - disposing = true; - } - - } -} diff --git a/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java b/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java deleted file mode 100755 index 2fc31a4bd586..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java +++ /dev/null @@ -1,286 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.tdoc.interfaces; - -import com.sun.star.beans.Property; -import com.sun.star.beans.XPropertySetInfo; -import lib.MultiMethodTest; -import lib.StatusException; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.ucb.Command; -import com.sun.star.ucb.CommandAbortedException; -import com.sun.star.ucb.CommandInfo; -import com.sun.star.ucb.GlobalTransferCommandArgument; -import com.sun.star.ucb.NameClash; -import com.sun.star.ucb.TransferCommandOperation; -import com.sun.star.ucb.UnsupportedCommandException; -import com.sun.star.ucb.XCommandInfo; -import com.sun.star.ucb.XCommandProcessor; -import com.sun.star.uno.Exception; -import com.sun.star.uno.UnoRuntime; -import share.LogWriter; - -/** -* Tests XCommandProcessor. The TestCase can pass (but doesn't have -* to) "XCommandProcessor.AbortCommand" relation, to specify command to abort in -* abort() test. -* -* Testing com.sun.star.ucb.XCommandProcessor -* interface methods : -*
            -*
          • createCommandIdentifier()
          • -*
          • execute()
          • -*
          • abort()
          • -*

          -* This test needs the following object relations : -*

            -*
          • 'XCommandProcessor.AbortCommand' optional -* (of type com.sun.star.ucb.Command): -* specify command to abort in abort() test. -* If the relation is not specified the 'GlobalTransfer' -* command is used.
          • -*

              -* The following predefined files needed to complete the test: -*

                -*
              • poliball.gif : this file is required in case -* if the relation 'XCommandProcessor.AbortCommand' -* is not specified. This file is used by 'GlobalTransfer' -* command as a source file for copying.
              • -*

                  -* Test is NOT multithread compilant.

                  -* @see com.sun.star.ucb.XCommandProcessor -*/ -public class _XCommandProcessor { - - /** - * Conatins the tested object. - */ - public XCommandProcessor oObj; - public LogWriter log = null; - private XMultiServiceFactory xMSF = null; - - /** - * Contains the command id returned by createCommandIdentifier() - * . It is used in abort() test. - */ - int cmdId; - - public void before(XMultiServiceFactory _xMSF) { - xMSF = _xMSF; - } - - /** - * Tests createCommandIdentifier(). Calls it for two times - * and checks returned values.

                  - * Has OK status if values are unique correct idenifiers: not 0. - */ - public boolean _createCommandIdentifier() { - log.println("creating a command line identifier"); - - int testCmdId = oObj.createCommandIdentifier(); - cmdId = oObj.createCommandIdentifier(); - - if (cmdId == 0 || testCmdId == 0) { - log.println("createCommandLineIdentifier() returned 0 - FAILED"); - } - - if (cmdId == testCmdId) { - log.println("the command identifier is not unique"); - } - - return testCmdId != 0 && cmdId != 0 && cmdId != testCmdId; - } - - /** - * First executes 'geCommandInfo' command and examines returned - * command info information. Second tries to execute inproper - * command.

                  - * Has OK status if in the first case returned information - * contains info about 'getCommandInfo' command and in the second - * case an exception is thrown.

                  - */ - public boolean _execute() { - String[]commands = new String[] {"getCommandInfo", "getPropertySetInfo"}; - boolean returnVal = true; - for (int j=0; jabort method - * is called permanently. Then a "long" command (for example, - * "transfer") is started. I case if relation is not - * specified 'GlobalTransfer' command starts to - * copy a file to temporary directory (if the relation is present - * then the its command starts to work).

                  - * Has OK status if the command execution is aborted, i.e. - * CommandAbortedException is thrown.

                  - * The following method tests are to be completed successfully before : - *

                    - *
                  • createCommandIdentifier() : to have a unique - * identifier which is used to abourt started command.
                  • - *
                  - */ - public boolean _abort() { - //executeMethod("createCommandIdentifier()"); - -// Command command = null;//(Command)tEnv.getObjRelation( - //"XCommandProcessor.AbortCommand"); - Command command = new Command("getCommandInfo", -1, null); - - if (command == null) { - String commandName = "globalTransfer"; - - String srcURL = util.utils.getFullTestURL("solibrary.jar") ; - String tmpURL = util.utils.getOfficeTemp(xMSF) ; - log.println("Copying '" + srcURL + "' to '" + tmpURL) ; - - GlobalTransferCommandArgument arg = new - GlobalTransferCommandArgument( - TransferCommandOperation.COPY, srcURL, - tmpURL, "", NameClash.OVERWRITE); - - command = new Command(commandName, -1, arg); - } - - Thread aborter = new Thread() { - public void run() { - for (int i = 0; i < 10; i++) { - log.println("try to abort command"); - oObj.abort(cmdId); - try { - Thread.sleep(10); - } catch (InterruptedException e) { - } - } - } - }; - - aborter.start(); - - try { - Thread.sleep(15); - } catch (InterruptedException e) { - } - - log.println("executing command"); - try { - oObj.execute(command, cmdId, null); - log.println("Command execution completed"); - log.println("CommandAbortedException is not thrown"); - log.println("This is OK since there is no command implemented "+ - "that can be aborted"); - } catch (CommandAbortedException e) { - return true; - } catch (Exception e) { - log.println("Unexpected exception " + e.getMessage()); - e.printStackTrace((java.io.PrintWriter)log); - return false; - } - - try { - aborter.join(5000); - aborter.interrupt(); - } catch(java.lang.InterruptedException e) { - } - return true; - } -} diff --git a/ucb/qa/complex/tdoc/interfaces/_XComponent.java b/ucb/qa/complex/tdoc/interfaces/_XComponent.java deleted file mode 100755 index 1716e51d1358..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XComponent.java +++ /dev/null @@ -1,171 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.tdoc.interfaces; - -import com.sun.star.container.XNameContainer; -import lib.MultiMethodTest; - -import com.sun.star.frame.XDesktop; -import com.sun.star.lang.EventObject; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XEventListener; -import share.LogWriter; - -/** -* Testing com.sun.star.lang.XComponent -* interface methods : -*
                    -*
                  • dispose()
                  • -*
                  • addEventListener()
                  • -*
                  • removeEventListener()
                  • -*
                  -* After this interface test object must be recreated.

                  -* Multithreaded test ability not implemented yet. -* @see com.sun.star.lang.XComponent -*/ -public class _XComponent { - - public static XComponent oObj = null; - private XNameContainer xContainer = null; - private XComponent altDispose = null; - public LogWriter log = null; - - boolean listenerDisposed[] = new boolean[2]; - String[] Loutput = new String[2]; - - /** - * Listener which added but not removed, and its method must be called - * on dispose call. - */ - public class MyEventListener implements XEventListener { - public void disposing ( EventObject oEvent ) { - Loutput[0] = Thread.currentThread() + " is DISPOSING EV1" + this; - listenerDisposed[0] = true; - } - }; - - /** - * Listener which added and then removed, and its method must not - * be called on dispose call. - */ - public class MyEventListener2 implements XEventListener { - public void disposing ( EventObject oEvent ) { - Loutput[0] = Thread.currentThread() + " is DISPOSING EV2" + this; - listenerDisposed[1] = true; - } - }; - - XEventListener listener1 = new MyEventListener(); - XEventListener listener2 = new MyEventListener2(); - - /** - * For the cfgmgr2.OSetElement tests: dispose the owner element. - */ - protected void before() { - // do not dispose this component, but parent instead -// altDispose = (XComponent)tEnv.getObjRelation("XComponent.DisposeThis"); - - } - - /** - * Adds two listeners.

                  - * Has OK status if then the first listener will receive an event - * on dispose method call. - */ - public boolean _addEventListener() { - - listenerDisposed[0] = false; - listenerDisposed[1] = false; - - oObj.addEventListener( listener1 ); - oObj.addEventListener( listener2 ); - - return true; - } // finished _addEventListener() - - /** - * Removes the second of two added listeners.

                  - * Method tests to be completed successfully : - *

                    - *
                  • addEventListener : method must add two listeners.
                  • - *

                  - * Has OK status if no events will be sent to the second listener on - * dispose method call. - */ - public boolean _removeEventListener() { -// executeMethod("addEventListener()"); - if (disposed) return true; - // the second listener should not be called - oObj.removeEventListener( listener2 ); - log.println(Thread.currentThread() + " is removing EL " + listener2); - return true; - } // finished _removeEventListener() - - static boolean disposed = false; - - /** - * Disposes the object and then check appropriate listeners were - * called or not.

                  - * Method tests to be completed successfully : - *

                    - *
                  • removeEventListener : method must remove one of two - * listeners.
                  • - *

                  - * Has OK status if liseter removed wasn't called and other listener - * was. - */ - public boolean _dispose() { - disposed = false; -// executeMethod("removeEventListener()"); - - log.println( "begin dispose" + Thread.currentThread()); - oObj.dispose(); - - try { - Thread.sleep(500) ; - } catch (InterruptedException e) {} - if (Loutput[0]!=null) log.println(Loutput[0]); - if (Loutput[1]!=null) log.println(Loutput[1]); - log.println( "end dispose" + Thread.currentThread()); - disposed = true; - - // check that dispose() works OK. - return listenerDisposed[0] && !listenerDisposed[1]; - - } // finished _dispose() - - /** - * Forces object recreation. - */ - protected void after() { -// disposeEnvironment(); - } - -} // finished class _XComponent - - diff --git a/ucb/qa/complex/tdoc/interfaces/_XContent.java b/ucb/qa/complex/tdoc/interfaces/_XContent.java deleted file mode 100755 index 4c84ecc1d8df..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XContent.java +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.tdoc.interfaces; - -import com.sun.star.ucb.XContent; -import com.sun.star.ucb.XContentEventListener; -import com.sun.star.ucb.XContentIdentifier; -import share.LogWriter; - -/** - * - * @author sg128468 - */ -public class _XContent { - public XContent oObj = null; - public LogWriter log = null; - private ContentListener listener = null; - - public boolean _addContentEventListener() { - listener = new ContentListener(); - oObj.addContentEventListener(listener); - return true; - } - public boolean _getContentType() { - String type = oObj.getContentType(); - log.println("Type: " + type); - return type != null && type.indexOf("vnd.sun.star.tdoc") != -1; - } - public boolean _getIdentifier() { - XContentIdentifier xIdent = oObj.getIdentifier(); - String id = xIdent.getContentIdentifier(); - String scheme = xIdent.getContentProviderScheme(); - log.println("Id: " + id); - log.println("Scheme: " + scheme); - return id != null && scheme != null && id.indexOf("vnd.sun.star.tdoc") != -1 && scheme.indexOf("vnd.sun.star.tdoc") != -1; - } - public boolean _removeContentEventListener() { - System.out.println("Event: " + (listener.disposed || listener.firedEvent)); - oObj.removeContentEventListener(listener); - return true; - } - - - private class ContentListener implements XContentEventListener { - private boolean disposed = false; - private boolean firedEvent = false; - - public void reset() { - disposed = false; - firedEvent = false; - } - - public void contentEvent(com.sun.star.ucb.ContentEvent contentEvent) { - firedEvent = true; - } - - public void disposing(com.sun.star.lang.EventObject eventObject) { - disposed = true; - } - - } -} diff --git a/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java b/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java deleted file mode 100755 index 790f295c7be5..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.tdoc.interfaces; - -import com.sun.star.beans.XPropertiesChangeListener; -import com.sun.star.beans.XPropertiesChangeNotifier; -import share.LogWriter; - -/** - * Check the XPropertiesChangeNotifier - */ -public class _XPropertiesChangeNotifier { - public XPropertiesChangeNotifier oObj = null; - public LogWriter log = null; - - PropertiesChangeListener listener = new PropertiesChangeListener(); - String[] args = null; - - - public boolean _addPropertiesChangeListener() { - oObj.addPropertiesChangeListener(args, listener); - return true; - } - - public boolean _removePropertiesChangeListener() { - oObj.removePropertiesChangeListener(args, listener); - return true; - } - - private class PropertiesChangeListener implements XPropertiesChangeListener { - public boolean disposed = false; - public boolean propChanged = false; - - public void disposing(com.sun.star.lang.EventObject eventObject) { - disposed = true; - } - - public void propertiesChange(com.sun.star.beans.PropertyChangeEvent[] propertyChangeEvent) { - propChanged = true; - } - - } -} diff --git a/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java b/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java deleted file mode 100755 index fd7ff94c8f8f..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.tdoc.interfaces; - -import com.sun.star.beans.XPropertyContainer; -import share.LogWriter; - -/** - * - * @author sg128468 - */ -public class _XPropertyContainer { - public XPropertyContainer oObj = null; - public LogWriter log = null; - - public boolean _addProperty() { - boolean result = true; - // add illegal property - try { - oObj.addProperty("MyIllegalProperty", (short)0, null); - } - catch(com.sun.star.beans.PropertyExistException e) { - e.printStackTrace((java.io.PrintWriter)log); - result = false; - } - catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace((java.io.PrintWriter)log); - log.println("'IllegalArgument' Unexpected but correct."); - } - catch(com.sun.star.beans.IllegalTypeException e) { - log.println("'IllegalType' Correctly thrown"); - } - // add valid property - try { - oObj.addProperty("MyLegalProperty", (short)0, "Just a value"); - } - catch(com.sun.star.beans.PropertyExistException e) { - e.printStackTrace((java.io.PrintWriter)log); - result = false; - } - catch(com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace((java.io.PrintWriter)log); - result = false; - } - catch(com.sun.star.beans.IllegalTypeException e) { - e.printStackTrace((java.io.PrintWriter)log); - result = false; - } - return result; - } - - public boolean _removeProperty() { - boolean result = true; - try { - oObj.removeProperty("MyIllegalProperty"); - } - catch(com.sun.star.beans.UnknownPropertyException e) { - log.println("'UnknownProperty' Correctly thrown"); - } - catch(com.sun.star.beans.NotRemoveableException e) { - e.printStackTrace((java.io.PrintWriter)log); - result = false; - } - try { - oObj.removeProperty("MyLegalProperty"); - } - catch(com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace((java.io.PrintWriter)log); - result = false; - } - catch(com.sun.star.beans.NotRemoveableException e) { - e.printStackTrace((java.io.PrintWriter)log); - result = false; - } - return result; - } - -} diff --git a/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java b/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java deleted file mode 100755 index ec1d7d64ada5..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.tdoc.interfaces; - -import com.sun.star.beans.XPropertySetInfoChangeListener; -import com.sun.star.beans.XPropertySetInfoChangeNotifier; -import share.LogWriter; - -/** - * - */ -public class _XPropertySetInfoChangeNotifier { - public XPropertySetInfoChangeNotifier oObj = null; - public LogWriter log = null; - - PropertySetInfoChangeListener listener = new PropertySetInfoChangeListener(); - String[] args = null; - - - public boolean _addPropertiesChangeListener() { - oObj.addPropertySetInfoChangeListener(listener); - return true; - } - - public boolean _removePropertiesChangeListener() { - oObj.removePropertySetInfoChangeListener(listener); - return true; - } - - private class PropertySetInfoChangeListener implements XPropertySetInfoChangeListener { - public boolean disposed = false; - public boolean propChanged = false; - - public void disposing(com.sun.star.lang.EventObject eventObject) { - disposed = true; - } - - public void propertySetInfoChange(com.sun.star.beans.PropertySetInfoChangeEvent propertySetInfoChangeEvent) { - } - - } - -} diff --git a/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java b/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java deleted file mode 100755 index 761cca87998a..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.tdoc.interfaces; - -import lib.MultiMethodTest; - -import com.sun.star.lang.XServiceInfo; -import share.LogWriter; - -/** -* Testing com.sun.star.lang.XServiceInfo -* interface methods : -*

                    -*
                  • getImplementationName()
                  • -*
                  • supportsService()
                  • -*
                  • getSupportedServiceNames()
                  • -*

                  -* Test is multithread compilant.

                  -* @see com.sun.star.lang.XServiceInfo -*/ -public class _XServiceInfo { - public static XServiceInfo oObj = null; - public static String[] names = null; - public LogWriter log = null; - - /** - * Just calls the method.

                  - * Has OK status if no runtime exceptions occured. - */ - public boolean _getImplementationName() { - boolean result = true; - log.println("testing getImplementationName() ... "); - - log.println("The ImplementationName ist "+oObj.getImplementationName()); - result=true; - - return result; - - } // end getImplementationName() - - - /** - * Just calls the method.

                  - * Has OK status if no runtime exceptions occured. - */ - public boolean _getSupportedServiceNames() { - boolean result = true; - log.println("getting supported Services..."); - names = oObj.getSupportedServiceNames(); - for (int i=0;igetSupportedServiceNames method and - * calls the supportsService methos with this - * name.

                  - * Has OK status if true value is - * returned. - */ - public boolean _supportsService() { - log.println("testing supportsService"); - names = oObj.getSupportedServiceNames(); - return oObj.supportsService(names[0]); - } // end supportsService() -} - diff --git a/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java b/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java deleted file mode 100755 index aef931bdeef1..000000000000 --- a/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.tdoc.interfaces; - -import lib.MultiMethodTest; - -import com.sun.star.lang.XTypeProvider; -import com.sun.star.uno.Type; -import share.LogWriter; - -/** -* Testing com.sun.star.lang.XTypeProvider -* interface methods : -*

                    -*
                  • getTypes()
                  • -*
                  • getImplementationId()
                  • -*

                  -* Test is NOT multithread compilant.

                  -* @see com.sun.star.lang.XTypeProvider -*/ -public class _XTypeProvider { - - public static XTypeProvider oObj = null; - public static Type[] types = null; - public LogWriter log = null; - - /** - * Just calls the method.

                  - * Has OK status if no runtime exceptions occured. - */ - public boolean _getImplementationId() { - boolean result = true; - log.println("testing getImplementationId() ... "); - - log.println("The ImplementationId is "+oObj.getImplementationId()); - result = true; - - return result; - - } // end getImplementationId() - - - /** - * ?alls the method and checks the return value.

                  - * Has OK status if one of the return value equals to the - * type com.sun.star.lang.XTypeProvider. - */ - public boolean _getTypes() { - boolean result = false; - log.println("getting Types..."); - types = oObj.getTypes(); - for (int i=0;i"); - } - - return result; - - } // end getTypes() - -} - diff --git a/ucb/qa/complex/tdoc/makefile.mk b/ucb/qa/complex/tdoc/makefile.mk index f5f2629f5592..01f8ec0f76fa 100755 --- a/ucb/qa/complex/tdoc/makefile.mk +++ b/ucb/qa/complex/tdoc/makefile.mk @@ -43,15 +43,21 @@ JAVATESTFILES = \ CheckTransientDocumentsDocumentContent.java JAVAFILES = $(JAVATESTFILES) \ - TestDocument.java + TestDocument.java \ + _XChild.java \ + _XCommandInfoChangeNotifier.java \ + _XCommandProcessor.java \ + _XComponent.java \ + _XContent.java \ + _XPropertiesChangeNotifier.java \ + _XPropertyContainer.java \ + _XPropertySetInfoChangeNotifier.java \ + _XServiceInfo.java \ + _XTypeProvider.java JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar EXTRAJARFILES = $(OOO_JUNIT_JAR) - -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -SUBDIRS = interfaces - # Sample how to debug # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -- cgit From b9e345f57f4ecf2b27a71b0bea344ec83ecfd50a Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Mon, 28 Jun 2010 13:37:19 +0200 Subject: #i112747# - resovled ownership cicle (patch contributed by cmc). --- ucb/source/core/ucbstore.cxx | 39 ++++++++------------------------------- ucb/source/core/ucbstore.hxx | 6 ++---- 2 files changed, 10 insertions(+), 35 deletions(-) (limited to 'ucb') diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index 9500db4f45b6..cd5cb7856d7a 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -274,8 +274,9 @@ UcbStore::createPropertySetRegistry( const OUString& ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); if ( !m_pImpl->m_xTheRegistry.is() ) - m_pImpl->m_xTheRegistry = new PropertySetRegistry( m_xSMgr, *this ); + m_pImpl->m_xTheRegistry = new PropertySetRegistry( m_xSMgr, getInitArgs() ); } + return m_pImpl->m_xTheRegistry; } @@ -293,22 +294,6 @@ void SAL_CALL UcbStore::initialize( const Sequence< Any >& aArguments ) m_pImpl->m_aInitArgs = aArguments; } -//========================================================================= -// -// New methods. -// -//========================================================================= - -void UcbStore::removeRegistry() -{ - if ( m_pImpl->m_xTheRegistry.is() ) - { - osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( m_pImpl->m_xTheRegistry.is() ) - m_pImpl->m_xTheRegistry = 0; - } -} - //========================================================================= const Sequence< Any >& UcbStore::getInitArgs() const { @@ -323,7 +308,7 @@ const Sequence< Any >& UcbStore::getInitArgs() const struct PropertySetRegistry_Impl { - UcbStore* m_pCreator; + const Sequence< Any > m_aInitArgs; PropertySetMap_Impl m_aPropSets; Reference< XMultiServiceFactory > m_xConfigProvider; Reference< XInterface > m_xRootReadAccess; @@ -332,18 +317,11 @@ struct PropertySetRegistry_Impl sal_Bool m_bTriedToGetRootReadAccess; // #82494# sal_Bool m_bTriedToGetRootWriteAccess; // #82494# - PropertySetRegistry_Impl( UcbStore& rCreator ) - : m_pCreator( &rCreator ), + PropertySetRegistry_Impl( const Sequence< Any > &rInitArgs ) + : m_aInitArgs( rInitArgs ), m_bTriedToGetRootReadAccess( sal_False ), m_bTriedToGetRootWriteAccess( sal_False ) { - m_pCreator->acquire(); - } - - ~PropertySetRegistry_Impl() - { - m_pCreator->removeRegistry(); - m_pCreator->release(); } }; @@ -359,9 +337,9 @@ struct PropertySetRegistry_Impl PropertySetRegistry::PropertySetRegistry( const Reference< XMultiServiceFactory >& rXSMgr, - UcbStore& rCreator ) + const Sequence< Any > &rInitArgs ) : m_xSMgr( rXSMgr ), - m_pImpl( new PropertySetRegistry_Impl( rCreator ) ) + m_pImpl( new PropertySetRegistry_Impl( rInitArgs ) ) { } @@ -1094,8 +1072,7 @@ Reference< XMultiServiceFactory > PropertySetRegistry::getConfigProvider() osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); if ( !m_pImpl->m_xConfigProvider.is() ) { - const Sequence< Any >& rInitArgs - = m_pImpl->m_pCreator->getInitArgs(); + const Sequence< Any >& rInitArgs = m_pImpl->m_aInitArgs; if ( rInitArgs.getLength() > 0 ) { diff --git a/ucb/source/core/ucbstore.hxx b/ucb/source/core/ucbstore.hxx index 8c339337f890..7a7a76cb1b99 100644 --- a/ucb/source/core/ucbstore.hxx +++ b/ucb/source/core/ucbstore.hxx @@ -93,9 +93,6 @@ public: throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ); - // New - void removeRegistry(); - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& getInitArgs() const; }; @@ -132,7 +129,8 @@ public: PropertySetRegistry( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rXSMgr, - UcbStore& rCreator ); + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any >& rInitArgs); virtual ~PropertySetRegistry(); // XInterface -- cgit From 9551bf5a1ee5c9275a26f8ec4021e0b7f5665176 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:10:07 +0200 Subject: sb129: #i113189# change UNO components to use passive registration --- ucb/prj/d.lst | 15 ++++- ucb/source/cacher/cached1.component | 43 +++++++++++++ ucb/source/cacher/cacheserv.cxx | 77 ----------------------- ucb/source/cacher/makefile.mk | 8 +++ ucb/source/core/exports2.dxp | 1 - ucb/source/core/makefile.mk | 8 +++ ucb/source/core/ucb1.component | 46 ++++++++++++++ ucb/source/core/ucbserv.cxx | 87 -------------------------- ucb/source/sorter/makefile.mk | 8 +++ ucb/source/sorter/sortmain.cxx | 55 ---------------- ucb/source/sorter/srtrs1.component | 34 ++++++++++ ucb/source/ucp/expand/makefile.mk | 8 +++ ucb/source/ucp/expand/ucpexpand.cxx | 8 --- ucb/source/ucp/expand/ucpexpand1.component | 35 +++++++++++ ucb/source/ucp/ext/makefile.mk | 8 +++ ucb/source/ucp/ext/ucpext.component | 35 +++++++++++ ucb/source/ucp/ext/ucpext_services.cxx | 6 -- ucb/source/ucp/file/exports2.dxp | 1 - ucb/source/ucp/file/makefile.mk | 8 +++ ucb/source/ucp/file/prov.cxx | 54 ---------------- ucb/source/ucp/file/ucpfile1.component | 34 ++++++++++ ucb/source/ucp/ftp/ftpservices.cxx | 54 ---------------- ucb/source/ucp/ftp/makefile.mk | 8 +++ ucb/source/ucp/ftp/ucpftp1.component | 34 ++++++++++ ucb/source/ucp/gio/gio_provider.cxx | 35 ----------- ucb/source/ucp/gio/makefile.mk | 10 ++- ucb/source/ucp/gio/ucpgio-ucd.txt | 6 -- ucb/source/ucp/gio/ucpgio.component | 34 ++++++++++ ucb/source/ucp/gvfs/gvfs_provider.cxx | 45 ------------- ucb/source/ucp/gvfs/makefile.mk | 9 ++- ucb/source/ucp/gvfs/ucpgvfs-ucd.txt | 6 -- ucb/source/ucp/gvfs/ucpgvfs.component | 34 ++++++++++ ucb/source/ucp/hierarchy/hierarchyservices.cxx | 63 ------------------- ucb/source/ucp/hierarchy/makefile.mk | 8 +++ ucb/source/ucp/hierarchy/ucphier1.component | 38 +++++++++++ ucb/source/ucp/odma/odma_services.cxx | 39 ------------ ucb/source/ucp/package/makefile.mk | 8 +++ ucb/source/ucp/package/pkgservices.cxx | 59 ----------------- ucb/source/ucp/package/ucppkg1.component | 34 ++++++++++ ucb/source/ucp/tdoc/makefile.mk | 8 +++ ucb/source/ucp/tdoc/tdoc_services.cxx | 62 ------------------ ucb/source/ucp/tdoc/ucptdoc1.component | 37 +++++++++++ ucb/source/ucp/webdav/makefile.mk | 8 +++ ucb/source/ucp/webdav/ucpdav1.component | 34 ++++++++++ ucb/source/ucp/webdav/webdavservices.cxx | 54 ---------------- 45 files changed, 588 insertions(+), 718 deletions(-) create mode 100644 ucb/source/cacher/cached1.component create mode 100644 ucb/source/core/ucb1.component create mode 100644 ucb/source/sorter/srtrs1.component create mode 100644 ucb/source/ucp/expand/ucpexpand1.component create mode 100644 ucb/source/ucp/ext/ucpext.component create mode 100644 ucb/source/ucp/file/ucpfile1.component create mode 100644 ucb/source/ucp/ftp/ucpftp1.component delete mode 100644 ucb/source/ucp/gio/ucpgio-ucd.txt create mode 100644 ucb/source/ucp/gio/ucpgio.component delete mode 100644 ucb/source/ucp/gvfs/ucpgvfs-ucd.txt create mode 100644 ucb/source/ucp/gvfs/ucpgvfs.component create mode 100644 ucb/source/ucp/hierarchy/ucphier1.component create mode 100644 ucb/source/ucp/package/ucppkg1.component create mode 100644 ucb/source/ucp/tdoc/ucptdoc1.component create mode 100644 ucb/source/ucp/webdav/ucpdav1.component (limited to 'ucb') diff --git a/ucb/prj/d.lst b/ucb/prj/d.lst index b02c8184a6e9..65a32e21fba3 100644 --- a/ucb/prj/d.lst +++ b/ucb/prj/d.lst @@ -31,5 +31,16 @@ ..\source\ucp\gvfs\ucpgvfs.xml %_DEST%\xml%_EXT%\ucpgvfs.xml ..\source\ucp\tdoc\ucptdoc.xml %_DEST%\xml%_EXT%\ucptdoc.xml -..\%__SRC%\misc\ucpgvfs-ucd.txt %_DEST%\bin%_EXT%\ucpgvfs-ucd.txt -..\%__SRC%\misc\ucpgio-ucd.txt %_DEST%\bin%_EXT%\ucpgio-ucd.txt +..\%__SRC%\misc\ucpgvfs.component %_DEST%\xml%_EXT%\ucpgvfs.component +..\%__SRC%\misc\ucpgio.component %_DEST%\xml%_EXT%\ucpgio.component +..\%__SRC%\misc\cached1.component %_DEST%\xml%_EXT%\cached1.component +..\%__SRC%\misc\srtrs1.component %_DEST%\xml%_EXT%\srtrs1.component +..\%__SRC%\misc\ucb1.component %_DEST%\xml%_EXT%\ucb1.component +..\%__SRC%\misc\ucpdav1.component %_DEST%\xml%_EXT%\ucpdav1.component +..\%__SRC%\misc\ucpexpand1.component %_DEST%\xml%_EXT%\ucpexpand1.component +..\%__SRC%\misc\ucpext.component %_DEST%\xml%_EXT%\ucpext.component +..\%__SRC%\misc\ucpfile1.component %_DEST%\xml%_EXT%\ucpfile1.component +..\%__SRC%\misc\ucpftp1.component %_DEST%\xml%_EXT%\ucpftp1.component +..\%__SRC%\misc\ucphier1.component %_DEST%\xml%_EXT%\ucphier1.component +..\%__SRC%\misc\ucppkg1.component %_DEST%\xml%_EXT%\ucppkg1.component +..\%__SRC%\misc\ucptdoc1.component %_DEST%\xml%_EXT%\ucptdoc1.component diff --git a/ucb/source/cacher/cached1.component b/ucb/source/cacher/cached1.component new file mode 100644 index 000000000000..aa19e54b5da3 --- /dev/null +++ b/ucb/source/cacher/cached1.component @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + diff --git a/ucb/source/cacher/cacheserv.cxx b/ucb/source/cacher/cacheserv.cxx index 3aa0f1de5357..f429286cfdee 100644 --- a/ucb/source/cacher/cacheserv.cxx +++ b/ucb/source/cacher/cacheserv.cxx @@ -40,45 +40,6 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::registry; -//========================================================================= -static sal_Bool writeInfo( void * pRegistryKey, - const OUString & rImplementationName, - Sequence< OUString > const & rServiceNames ) -{ - OUString aKeyName( OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += OUString::createFromAscii( "/UNO/SERVICES" ); - - Reference< XRegistryKey > xKey; - try - { - xKey = static_cast< XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) @@ -86,44 +47,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // CachedContentResultSetFactory. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - CachedContentResultSetFactory::getImplementationName_Static(), - CachedContentResultSetFactory::getSupportedServiceNames_Static() ) && - - ////////////////////////////////////////////////////////////////////// - // CachedContentResultSetStubFactory. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - CachedContentResultSetStubFactory::getImplementationName_Static(), - CachedContentResultSetStubFactory::getSupportedServiceNames_Static() ) && - - ////////////////////////////////////////////////////////////////////// - // CachedDynamicResultSetFactory. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - CachedDynamicResultSetFactory::getImplementationName_Static(), - CachedDynamicResultSetFactory::getSupportedServiceNames_Static() ) && - - ////////////////////////////////////////////////////////////////////// - // CachedDynamicResultSetStubFactory. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - CachedDynamicResultSetStubFactory::getImplementationName_Static(), - CachedDynamicResultSetStubFactory::getSupportedServiceNames_Static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) diff --git a/ucb/source/cacher/makefile.mk b/ucb/source/cacher/makefile.mk index 600fefc174f7..24d245ec6ce8 100644 --- a/ucb/source/cacher/makefile.mk +++ b/ucb/source/cacher/makefile.mk @@ -66,3 +66,11 @@ DEF1NAME=$(SHL1TARGET) .INCLUDE: target.mk + +ALLTAR : $(MISC)/cached1.component + +$(MISC)/cached1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + cached1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt cached1.component diff --git a/ucb/source/core/exports2.dxp b/ucb/source/core/exports2.dxp index a1936474f752..8091459f4d84 100644 --- a/ucb/source/core/exports2.dxp +++ b/ucb/source/core/exports2.dxp @@ -1,5 +1,4 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory _ZTIN3com3sun4star3ucb34InteractiveBadTransferURLExceptionE diff --git a/ucb/source/core/makefile.mk b/ucb/source/core/makefile.mk index 34765eb74289..6360f82320d2 100644 --- a/ucb/source/core/makefile.mk +++ b/ucb/source/core/makefile.mk @@ -74,3 +74,11 @@ DEF1NAME=$(SHL1TARGET) .INCLUDE: target.mk + +ALLTAR : $(MISC)/ucb1.component + +$(MISC)/ucb1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucb1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucb1.component diff --git a/ucb/source/core/ucb1.component b/ucb/source/core/ucb1.component new file mode 100644 index 000000000000..e9d408822cc9 --- /dev/null +++ b/ucb/source/core/ucb1.component @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ucb/source/core/ucbserv.cxx b/ucb/source/core/ucbserv.cxx index 340fa5db0c0f..a4e5bdc1dccf 100644 --- a/ucb/source/core/ucbserv.cxx +++ b/ucb/source/core/ucbserv.cxx @@ -29,7 +29,6 @@ #include "precompiled_ucb.hxx" #include #include -#include #include "ucb.hxx" #include "ucbstore.hxx" #include "ucbprops.hxx" @@ -39,46 +38,6 @@ using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::lang; -using namespace com::sun::star::registry; - -//========================================================================= -static sal_Bool writeInfo( void * pRegistryKey, - const OUString & rImplementationName, - Sequence< OUString > const & rServiceNames ) -{ - OUString aKeyName( OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += OUString::createFromAscii( "/UNO/SERVICES" ); - - Reference< XRegistryKey > xKey; - try - { - xKey = static_cast< XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( @@ -87,52 +46,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // Universal Content Broker. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - UniversalContentBroker::getImplementationName_Static(), - UniversalContentBroker::getSupportedServiceNames_Static() ) && - - ////////////////////////////////////////////////////////////////////// - // UCB Store. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - UcbStore::getImplementationName_Static(), - UcbStore::getSupportedServiceNames_Static() ) && - - ////////////////////////////////////////////////////////////////////// - // UCB PropertiesManager. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - UcbPropertiesManager::getImplementationName_Static(), - UcbPropertiesManager::getSupportedServiceNames_Static() ) && - - ////////////////////////////////////////////////////////////////////// - // UCP Proxy Factory. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - UcbContentProviderProxyFactory::getImplementationName_Static(), - UcbContentProviderProxyFactory::getSupportedServiceNames_Static() ) && - - ////////////////////////////////////////////////////////////////////// - // Command Environment. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static(), - ucb_cmdenv::UcbCommandEnvironment::getSupportedServiceNames_Static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) diff --git a/ucb/source/sorter/makefile.mk b/ucb/source/sorter/makefile.mk index 68a9959589d2..008e39b4bce3 100644 --- a/ucb/source/sorter/makefile.mk +++ b/ucb/source/sorter/makefile.mk @@ -61,3 +61,11 @@ DEF1NAME=$(SHL1TARGET) .INCLUDE: target.mk + +ALLTAR : $(MISC)/srtrs1.component + +$(MISC)/srtrs1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + srtrs1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt srtrs1.component diff --git a/ucb/source/sorter/sortmain.cxx b/ucb/source/sorter/sortmain.cxx index d96b4bcff796..5ad9a529e1f2 100644 --- a/ucb/source/sorter/sortmain.cxx +++ b/ucb/source/sorter/sortmain.cxx @@ -30,51 +30,10 @@ #include #include #include -#include using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star::lang; -using namespace com::sun::star::registry; - -//========================================================================= -static sal_Bool writeInfo( void * pRegistryKey, - const OUString & rImplementationName, - Sequence< OUString > const & rServiceNames ) -{ - OUString aKeyName( OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += OUString::createFromAscii( "/UNO/SERVICES" ); - - Reference< XRegistryKey > xKey; - try - { - xKey = static_cast< XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( @@ -83,20 +42,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // SortedDynamicResultSetFactory. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - SortedDynamicResultSetFactory::getImplementationName_Static(), - SortedDynamicResultSetFactory::getSupportedServiceNames_Static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) diff --git a/ucb/source/sorter/srtrs1.component b/ucb/source/sorter/srtrs1.component new file mode 100644 index 000000000000..c32705160c0f --- /dev/null +++ b/ucb/source/sorter/srtrs1.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/ucb/source/ucp/expand/makefile.mk b/ucb/source/ucp/expand/makefile.mk index 32de160318f2..70e441171a44 100644 --- a/ucb/source/ucp/expand/makefile.mk +++ b/ucb/source/ucp/expand/makefile.mk @@ -59,3 +59,11 @@ DEF1NAME = $(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/ucpexpand1.component + +$(MISC)/ucpexpand1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucpexpand1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucpexpand1.component diff --git a/ucb/source/ucp/expand/ucpexpand.cxx b/ucb/source/ucp/expand/ucpexpand.cxx index 710cf137ba06..069aa894692b 100644 --- a/ucb/source/ucp/expand/ucpexpand.cxx +++ b/ucb/source/ucp/expand/ucpexpand.cxx @@ -273,14 +273,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - lang::XMultiServiceFactory * pServiceManager, - registry::XRegistryKey * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, s_entries ); -} - void * SAL_CALL component_getFactory( const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager, diff --git a/ucb/source/ucp/expand/ucpexpand1.component b/ucb/source/ucp/expand/ucpexpand1.component new file mode 100644 index 000000000000..5997e9029811 --- /dev/null +++ b/ucb/source/ucp/expand/ucpexpand1.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/ucb/source/ucp/ext/makefile.mk b/ucb/source/ucp/ext/makefile.mk index 23c30b3bda5b..e106b8e1ba31 100644 --- a/ucb/source/ucp/ext/makefile.mk +++ b/ucb/source/ucp/ext/makefile.mk @@ -63,3 +63,11 @@ SHL1DEF = $(MISC)$/$(SHL1TARGET).def DEF1NAME = $(SHL1TARGET) .INCLUDE : target.mk + +ALLTAR : $(MISC)/ucpext.component + +$(MISC)/ucpext.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucpext.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucpext.component diff --git a/ucb/source/ucp/ext/ucpext.component b/ucb/source/ucp/ext/ucpext.component new file mode 100644 index 000000000000..d673777a6707 --- /dev/null +++ b/ucb/source/ucp/ext/ucpext.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/ucb/source/ucp/ext/ucpext_services.cxx b/ucb/source/ucp/ext/ucpext_services.cxx index 8daa33f5cf8c..ce525c2da665 100644 --- a/ucb/source/ucp/ext/ucpext_services.cxx +++ b/ucb/source/ucp/ext/ucpext_services.cxx @@ -79,12 +79,6 @@ extern "C" *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - //------------------------------------------------------------------------------------------------------------------ - sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) - { - return ::cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, ::ucb::ucp::ext::s_aServiceEntries ); - } - //------------------------------------------------------------------------------------------------------------------ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/ucb/source/ucp/file/exports2.dxp b/ucb/source/ucp/file/exports2.dxp index 6c42314f228b..4804c8d0ae57 100644 --- a/ucb/source/ucp/file/exports2.dxp +++ b/ucb/source/ucp/file/exports2.dxp @@ -1,5 +1,4 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory _ZTIN3com3sun4star3ucb31InteractiveAugmentedIOExceptionE diff --git a/ucb/source/ucp/file/makefile.mk b/ucb/source/ucp/file/makefile.mk index 8007a2492399..3d97cb23873c 100644 --- a/ucb/source/ucp/file/makefile.mk +++ b/ucb/source/ucp/file/makefile.mk @@ -78,3 +78,11 @@ DEF1NAME=$(SHL1TARGET) .INCLUDE: target.mk + +ALLTAR : $(MISC)/ucpfile1.component + +$(MISC)/ucpfile1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucpfile1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucpfile1.component diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx index a456d2acbd32..2b9c09a7d0fa 100644 --- a/ucb/source/ucp/file/prov.cxx +++ b/ucb/source/ucp/file/prov.cxx @@ -31,7 +31,6 @@ #include #include #include -#include #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBBUTE_HPP_ #include #endif @@ -52,45 +51,6 @@ using namespace com::sun::star::beans; using namespace com::sun::star::ucb; using namespace com::sun::star::container; -//========================================================================= -static sal_Bool writeInfo( void * pRegistryKey, - const rtl::OUString & rImplementationName, - Sequence< rtl::OUString > const & rServiceNames ) -{ - rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" ); - - Reference< registry::XRegistryKey > xKey; - try - { - xKey = static_cast< registry::XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( registry::InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( registry::InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) @@ -98,20 +58,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // File Content Provider. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - fileaccess::shell::getImplementationName_static(), - fileaccess::shell::getSupportedServiceNames_static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) diff --git a/ucb/source/ucp/file/ucpfile1.component b/ucb/source/ucp/file/ucpfile1.component new file mode 100644 index 000000000000..28032451220a --- /dev/null +++ b/ucb/source/ucp/file/ucpfile1.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/ucb/source/ucp/ftp/ftpservices.cxx b/ucb/source/ucp/ftp/ftpservices.cxx index fb62acd1cbc0..8e5c88ad66c1 100644 --- a/ucb/source/ucp/ftp/ftpservices.cxx +++ b/ucb/source/ucp/ftp/ftpservices.cxx @@ -35,45 +35,6 @@ using namespace com::sun::star; using namespace ftp; -//========================================================================= -static sal_Bool writeInfo( void * pRegistryKey, - const rtl::OUString & rImplementationName, - uno::Sequence< rtl::OUString > const & rServiceNames ) -{ - rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" ); - - uno::Reference< registry::XRegistryKey > xKey; - try - { - xKey = static_cast< registry::XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( registry::InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( registry::InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) @@ -81,21 +42,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * /*pServiceManager*/, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // FTP Content Provider. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - FTPContentProvider::getImplementationName_Static(), - FTPContentProvider::getSupportedServiceNames_Static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) diff --git a/ucb/source/ucp/ftp/makefile.mk b/ucb/source/ucp/ftp/makefile.mk index a0f141004089..c2f1ce154a56 100644 --- a/ucb/source/ucp/ftp/makefile.mk +++ b/ucb/source/ucp/ftp/makefile.mk @@ -104,3 +104,11 @@ DEF1NAME=$(SHL1TARGET) + +ALLTAR : $(MISC)/ucpftp1.component + +$(MISC)/ucpftp1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucpftp1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucpftp1.component diff --git a/ucb/source/ucp/ftp/ucpftp1.component b/ucb/source/ucp/ftp/ucpftp1.component new file mode 100644 index 000000000000..fa4cfe6e7557 --- /dev/null +++ b/ucb/source/ucp/ftp/ucpftp1.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/ucb/source/ucp/gio/gio_provider.cxx b/ucb/source/ucp/gio/gio_provider.cxx index b39bc4462bbe..b8b16ba72c24 100644 --- a/ucb/source/ucp/gio/gio_provider.cxx +++ b/ucb/source/ucp/gio/gio_provider.cxx @@ -102,41 +102,6 @@ ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider ); } -static sal_Bool writeInfo( void *pRegistryKey, - const rtl::OUString &rImplementationName, uno::Sequence< rtl::OUString > const &rServiceNames ) -{ - rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" ); - - uno::Reference< registry::XRegistryKey > xKey; - try - { - xKey = static_cast< registry::XRegistryKey * > (pRegistryKey )->createKey( aKeyName ); - } - catch ( registry::InvalidRegistryException const & ) - {} - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( registry::InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, uno_Environment **) { diff --git a/ucb/source/ucp/gio/makefile.mk b/ucb/source/ucp/gio/makefile.mk index 86b32fbc0739..4cca611c7ece 100644 --- a/ucb/source/ucp/gio/makefile.mk +++ b/ucb/source/ucp/gio/makefile.mk @@ -37,8 +37,6 @@ NO_BSYMBOLIC=TRUE .INCLUDE: settings.mk .IF "$(L10N_framework)"=="" -UNIXTEXT=$(MISC)/$(TARGET)-ucd.txt - .IF "$(ENABLE_GIO)"!="" COMPILER_WARN_ALL=TRUE PKGCONFIG_MODULES=gio-2.0 @@ -79,3 +77,11 @@ SHL1VERSIONMAP=$(SOLARENV)/src/component.map .ENDIF # L10N_framework .INCLUDE: target.mk + +ALLTAR : $(MISC)/ucpgio.component + +$(MISC)/ucpgio.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucpgio.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucpgio.component diff --git a/ucb/source/ucp/gio/ucpgio-ucd.txt b/ucb/source/ucp/gio/ucpgio-ucd.txt deleted file mode 100644 index ce7657fa73e3..000000000000 --- a/ucb/source/ucp/gio/ucpgio-ucd.txt +++ /dev/null @@ -1,6 +0,0 @@ -[ComponentDescriptor] -ImplementationName=com.sun.star.comp.GIOContentProvider -ComponentName=ucpgio1.uno.so -LoaderName=com.sun.star.loader.SharedLibrary -[SupportedServices] -com.sun.star.ucb.GIOContentProvider diff --git a/ucb/source/ucp/gio/ucpgio.component b/ucb/source/ucp/gio/ucpgio.component new file mode 100644 index 000000000000..caa8fc361f7f --- /dev/null +++ b/ucb/source/ucp/gio/ucpgio.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/ucb/source/ucp/gvfs/gvfs_provider.cxx b/ucb/source/ucp/gvfs/gvfs_provider.cxx index 52376bf4153e..77415982c63d 100644 --- a/ucb/source/ucp/gvfs/gvfs_provider.cxx +++ b/ucb/source/ucp/gvfs/gvfs_provider.cxx @@ -143,42 +143,6 @@ ContentProvider::queryContent( //============================ shlib entry points ============================================= - -// cut and paste verbatim from webdav (that sucks). -static sal_Bool -writeInfo( void *pRegistryKey, - const rtl::OUString &rImplementationName, - uno::Sequence< rtl::OUString > const &rServiceNames ) -{ - rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" ); - - uno::Reference< registry::XRegistryKey > xKey; - try { - xKey = static_cast< registry::XRegistryKey * > - (pRegistryKey )->createKey( aKeyName ); - } - catch ( registry::InvalidRegistryException const & ) { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) { - try { - xKey->createKey( rServiceNames[ n ] ); - - } catch ( registry::InvalidRegistryException const & ) { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, uno_Environment **/*ppEnv*/ ) @@ -186,15 +150,6 @@ component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -extern "C" sal_Bool SAL_CALL -component_writeInfo( void */*pServiceManager*/, - void *pRegistryKey ) -{ - return pRegistryKey && - writeInfo( pRegistryKey, - ::gvfs::ContentProvider::getImplementationName_Static(), - ::gvfs::ContentProvider::getSupportedServiceNames_Static() ); -} extern "C" void * SAL_CALL component_getFactory( const sal_Char *pImplName, void *pServiceManager, diff --git a/ucb/source/ucp/gvfs/makefile.mk b/ucb/source/ucp/gvfs/makefile.mk index a0e8a0bda3bb..87fcca87cf70 100644 --- a/ucb/source/ucp/gvfs/makefile.mk +++ b/ucb/source/ucp/gvfs/makefile.mk @@ -37,8 +37,6 @@ NO_BSYMBOLIC=TRUE .INCLUDE: settings.mk .IF "$(L10N_framework)"=="" -UNIXTEXT=$(MISC)/$(TARGET)-ucd.txt - .IF "$(ENABLE_GNOMEVFS)"!="" COMPILER_WARN_ALL=TRUE PKGCONFIG_MODULES=gnome-vfs-2.0 @@ -84,3 +82,10 @@ SHL1VERSIONMAP=$(SOLARENV)/src/component.map .INCLUDE: target.mk +ALLTAR : $(MISC)/ucpgvfs.component + +$(MISC)/ucpgvfs.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucpgvfs.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucpgvfs.component diff --git a/ucb/source/ucp/gvfs/ucpgvfs-ucd.txt b/ucb/source/ucp/gvfs/ucpgvfs-ucd.txt deleted file mode 100644 index e9ecce6effd2..000000000000 --- a/ucb/source/ucp/gvfs/ucpgvfs-ucd.txt +++ /dev/null @@ -1,6 +0,0 @@ -[ComponentDescriptor] -ImplementationName=com.sun.star.comp.GnomeVFSContentProvider -ComponentName=ucpgvfs1.uno.so -LoaderName=com.sun.star.loader.SharedLibrary -[SupportedServices] -com.sun.star.ucb.GnomeVFSContentProvider diff --git a/ucb/source/ucp/gvfs/ucpgvfs.component b/ucb/source/ucp/gvfs/ucpgvfs.component new file mode 100644 index 000000000000..cec3e4d1e2b1 --- /dev/null +++ b/ucb/source/ucp/gvfs/ucpgvfs.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/ucb/source/ucp/hierarchy/hierarchyservices.cxx b/ucb/source/ucp/hierarchy/hierarchyservices.cxx index e645e006032e..1830ecc35625 100644 --- a/ucb/source/ucp/hierarchy/hierarchyservices.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyservices.cxx @@ -29,52 +29,12 @@ #include "precompiled_ucb.hxx" #include #include -#include #include "hierarchyprovider.hxx" #include "hierarchydatasource.hxx" using namespace com::sun::star; using namespace hierarchy_ucp; -//========================================================================= -static sal_Bool writeInfo( void * pRegistryKey, - const rtl::OUString & rImplementationName, - uno::Sequence< rtl::OUString > const & rServiceNames ) -{ - rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" ); - - uno::Reference< registry::XRegistryKey > xKey; - try - { - xKey = static_cast< registry::XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( registry::InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( registry::InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) @@ -82,29 +42,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * /*pServiceManager*/, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // Hierarchy Content Provider. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - HierarchyContentProvider::getImplementationName_Static(), - HierarchyContentProvider::getSupportedServiceNames_Static() ) && - - ////////////////////////////////////////////////////////////////////// - // Hierarchy Data Source. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - HierarchyDataSource::getImplementationName_Static(), - HierarchyDataSource::getSupportedServiceNames_Static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) diff --git a/ucb/source/ucp/hierarchy/makefile.mk b/ucb/source/ucp/hierarchy/makefile.mk index 00b481b5e7a1..9263faa24b08 100644 --- a/ucb/source/ucp/hierarchy/makefile.mk +++ b/ucb/source/ucp/hierarchy/makefile.mk @@ -82,3 +82,11 @@ DEF1NAME=$(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE: target.mk + +ALLTAR : $(MISC)/ucphier1.component + +$(MISC)/ucphier1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucphier1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucphier1.component diff --git a/ucb/source/ucp/hierarchy/ucphier1.component b/ucb/source/ucp/hierarchy/ucphier1.component new file mode 100644 index 000000000000..5483187d8674 --- /dev/null +++ b/ucb/source/ucp/hierarchy/ucphier1.component @@ -0,0 +1,38 @@ + + + + + + + + + + + + diff --git a/ucb/source/ucp/odma/odma_services.cxx b/ucb/source/ucp/odma/odma_services.cxx index 3e4639e25806..0f5666e2bb53 100644 --- a/ucb/source/ucp/odma/odma_services.cxx +++ b/ucb/source/ucp/odma/odma_services.cxx @@ -39,45 +39,6 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::registry; -//========================================================================= -static sal_Bool writeInfo( void * pRegistryKey, - const OUString & rImplementationName, - Sequence< OUString > const & rServiceNames ) -{ - OUString aKeyName( OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += OUString::createFromAscii( "/UNO/SERVICES" ); - - Reference< XRegistryKey > xKey; - try - { - xKey = static_cast< XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) diff --git a/ucb/source/ucp/package/makefile.mk b/ucb/source/ucp/package/makefile.mk index a8cdf7430703..b78150aed2cb 100644 --- a/ucb/source/ucp/package/makefile.mk +++ b/ucb/source/ucp/package/makefile.mk @@ -87,3 +87,11 @@ DEF1NAME=$(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE: target.mk + +ALLTAR : $(MISC)/ucppkg1.component + +$(MISC)/ucppkg1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucppkg1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucppkg1.component diff --git a/ucb/source/ucp/package/pkgservices.cxx b/ucb/source/ucp/package/pkgservices.cxx index 251ce8c78dd1..ad4af686d2d6 100644 --- a/ucb/source/ucp/package/pkgservices.cxx +++ b/ucb/source/ucp/package/pkgservices.cxx @@ -34,50 +34,6 @@ using namespace com::sun::star; -namespace { - -//========================================================================= -sal_Bool writeInfo( - void * pRegistryKey, - const rtl::OUString & rImplementationName, - uno::Sequence< rtl::OUString > const & rServiceNames ) -{ - rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" ); - - uno::Reference< registry::XRegistryKey > xKey; - try - { - xKey = static_cast< registry::XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( registry::InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( registry::InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - -} // namespace - //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) @@ -85,21 +41,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * /*pServiceManager*/, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // Write info into registry. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - ::package_ucp::ContentProvider::getImplementationName_Static(), - ::package_ucp::ContentProvider::getSupportedServiceNames_Static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) diff --git a/ucb/source/ucp/package/ucppkg1.component b/ucb/source/ucp/package/ucppkg1.component new file mode 100644 index 000000000000..a2e2418b5602 --- /dev/null +++ b/ucb/source/ucp/package/ucppkg1.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/ucb/source/ucp/tdoc/makefile.mk b/ucb/source/ucp/tdoc/makefile.mk index 83e9599eed72..82c76b34b206 100644 --- a/ucb/source/ucp/tdoc/makefile.mk +++ b/ucb/source/ucp/tdoc/makefile.mk @@ -92,3 +92,11 @@ DEF1NAME=$(SHL1TARGET) .INCLUDE: target.mk + +ALLTAR : $(MISC)/ucptdoc1.component + +$(MISC)/ucptdoc1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucptdoc1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucptdoc1.component diff --git a/ucb/source/ucp/tdoc/tdoc_services.cxx b/ucb/source/ucp/tdoc/tdoc_services.cxx index 6f9641d5159b..fc34fd78b1a4 100644 --- a/ucb/source/ucp/tdoc/tdoc_services.cxx +++ b/ucb/source/ucp/tdoc/tdoc_services.cxx @@ -38,45 +38,6 @@ using namespace com::sun::star; using namespace tdoc_ucp; -//========================================================================= -static sal_Bool writeInfo( void * pRegistryKey, - const rtl::OUString & rImplementationName, - uno::Sequence< rtl::OUString > const & rServiceNames ) -{ - rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" ); - - uno::Reference< registry::XRegistryKey > xKey; - try - { - xKey = static_cast< registry::XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( registry::InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( registry::InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) @@ -84,29 +45,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * /*pServiceManager*/, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // Transient Documents Content Provider. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - ContentProvider::getImplementationName_Static(), - ContentProvider::getSupportedServiceNames_Static() ) && - - ////////////////////////////////////////////////////////////////////// - // Transient Documents Document Content Factory. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - DocumentContentFactory::getImplementationName_Static(), - DocumentContentFactory::getSupportedServiceNames_Static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) diff --git a/ucb/source/ucp/tdoc/ucptdoc1.component b/ucb/source/ucp/tdoc/ucptdoc1.component new file mode 100644 index 000000000000..8ba1471bd933 --- /dev/null +++ b/ucb/source/ucp/tdoc/ucptdoc1.component @@ -0,0 +1,37 @@ + + + + + + + + + + + diff --git a/ucb/source/ucp/webdav/makefile.mk b/ucb/source/ucp/webdav/makefile.mk index 73ee298697e8..162d58266406 100644 --- a/ucb/source/ucp/webdav/makefile.mk +++ b/ucb/source/ucp/webdav/makefile.mk @@ -158,3 +158,11 @@ DEF1NAME=$(SHL1TARGET) # --- Targets ---------------------------------------------------------- .INCLUDE: target.mk + +ALLTAR : $(MISC)/ucpdav1.component + +$(MISC)/ucpdav1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ucpdav1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ucpdav1.component diff --git a/ucb/source/ucp/webdav/ucpdav1.component b/ucb/source/ucp/webdav/ucpdav1.component new file mode 100644 index 000000000000..4e18b566e1a4 --- /dev/null +++ b/ucb/source/ucp/webdav/ucpdav1.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/ucb/source/ucp/webdav/webdavservices.cxx b/ucb/source/ucp/webdav/webdavservices.cxx index 9fb6d9e82bcf..7a38636e9dc7 100644 --- a/ucb/source/ucp/webdav/webdavservices.cxx +++ b/ucb/source/ucp/webdav/webdavservices.cxx @@ -34,45 +34,6 @@ using namespace com::sun::star; -//========================================================================= -static sal_Bool writeInfo( void * pRegistryKey, - const rtl::OUString & rImplementationName, - uno::Sequence< rtl::OUString > const & rServiceNames ) -{ - rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) ); - aKeyName += rImplementationName; - aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" ); - - uno::Reference< registry::XRegistryKey > xKey; - try - { - xKey = static_cast< registry::XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); - } - catch ( registry::InvalidRegistryException const & ) - { - } - - if ( !xKey.is() ) - return sal_False; - - sal_Bool bSuccess = sal_True; - - for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n ) - { - try - { - xKey->createKey( rServiceNames[ n ] ); - } - catch ( registry::InvalidRegistryException const & ) - { - bSuccess = sal_False; - break; - } - } - return bSuccess; -} - //========================================================================= extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) @@ -80,21 +41,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * /*pServiceManager*/, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // WebDAV Content Provider. - ////////////////////////////////////////////////////////////////////// - - writeInfo( pRegistryKey, - ::webdav_ucp::ContentProvider::getImplementationName_Static(), - ::webdav_ucp::ContentProvider::getSupportedServiceNames_Static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -- cgit From 4a7e903d201016282d998960148d262aa1f31900 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 14 Sep 2010 15:14:56 +0200 Subject: sb129: #i113189# removed obviously unnecessary service registrations; allow empty --- ucb/source/ucp/expand/ucpexpand1.component | 1 - ucb/source/ucp/ext/ucpext.component | 1 - 2 files changed, 2 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/expand/ucpexpand1.component b/ucb/source/ucp/expand/ucpexpand1.component index 5997e9029811..c8a7e8e18c68 100644 --- a/ucb/source/ucp/expand/ucpexpand1.component +++ b/ucb/source/ucp/expand/ucpexpand1.component @@ -29,7 +29,6 @@ - diff --git a/ucb/source/ucp/ext/ucpext.component b/ucb/source/ucp/ext/ucpext.component index d673777a6707..2982529e539c 100644 --- a/ucb/source/ucp/ext/ucpext.component +++ b/ucb/source/ucp/ext/ucpext.component @@ -29,7 +29,6 @@ - -- cgit From ba28593e334b42d828b953213faa97ee20d1b08f Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Mon, 20 Sep 2010 16:05:13 +0200 Subject: #i114622# - Workaround for buggy Oracle Beehive server response for lockdiscovery property. --- ucb/source/ucp/webdav/LockSequence.cxx | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/webdav/LockSequence.cxx b/ucb/source/ucp/webdav/LockSequence.cxx index cd5f12708d58..98e61954032f 100644 --- a/ucb/source/ucp/webdav/LockSequence.cxx +++ b/ucb/source/ucp/webdav/LockSequence.cxx @@ -35,6 +35,8 @@ using namespace webdav_ucp; using namespace com::sun::star; +#define BEEHIVE_BUGS_WORKAROUND + ////////////////////////////////////////////////////////////////////////// struct LockSequenceParseContext @@ -128,7 +130,11 @@ extern "C" int LockSequence_startelement_callback( extern "C" int LockSequence_chardata_callback( void *userdata, int state, +#ifdef BEEHIVE_BUGS_WORKAROUND + const char *buf1, +#else const char *buf, +#endif size_t len ) { LockSequenceParseContext * pCtx @@ -136,6 +142,15 @@ extern "C" int LockSequence_chardata_callback( if ( !pCtx->pLock ) pCtx->pLock = new ucb::Lock; +#ifdef BEEHIVE_BUGS_WORKAROUND + // Beehive sends XML values containing trailing newlines. + if ( buf1[ len - 1 ] == 0x0a ) + len--; + + char * buf = new char[ len + 1 ](); + strncpy( buf, buf1, len ); +#endif + switch ( state ) { case STATE_DEPTH: @@ -203,12 +218,8 @@ extern "C" int LockSequence_chardata_callback( // @@@ // } else - { - pCtx->pLock->Timeout = sal_Int64( -1 ); - pCtx->hasTimeout = true; OSL_ENSURE( sal_False, "LockSequence_chardata_callback - Unknown timeout!" ); - } break; case STATE_HREF: @@ -223,6 +234,11 @@ extern "C" int LockSequence_chardata_callback( } } + +#ifdef BEEHIVE_BUGS_WORKAROUND + delete [] buf; +#endif + return 0; // zero to continue, non-zero to abort parsing } -- cgit From f0c8cd0ec5fbd30e2eea435872c4541fcfe3c9f3 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 21 Sep 2010 10:23:23 +0200 Subject: sb123: #i111449# relax expected exception type (some platforms apparently throw InteractiveNetworkConnectException instead of InteractiveNetworkResolveNameException here) --- ucb/qa/complex/ucb/UCB.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ucb') diff --git a/ucb/qa/complex/ucb/UCB.java b/ucb/qa/complex/ucb/UCB.java index c027dd95bb37..445525927703 100755 --- a/ucb/qa/complex/ucb/UCB.java +++ b/ucb/qa/complex/ucb/UCB.java @@ -231,7 +231,7 @@ public class UCB { } catch (com.sun.star.lang.IllegalArgumentException ex) { //TODO error message; System.out.println("Correct exception thrown: " + ex.getClass().toString()); - } catch(com.sun.star.ucb.InteractiveNetworkResolveNameException ex) { + } catch(com.sun.star.ucb.InteractiveNetworkException ex) { System.out.println("This Exception is correctly thrown when no Proxy in StarOffice is used."); System.out.println("To reproduce the bug behaviour, use a Proxy and try again."); } catch (Exception ex) { -- cgit From 04a3e68aece9ad6a0f96b66c2fcb22d26ca4780c Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Tue, 21 Sep 2010 15:50:18 +0200 Subject: #i114622# - Fixed wrong arguments for InteractiveLockingLockedExceptions- --- ucb/source/ucp/webdav/webdavcontent.cxx | 56 ++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 21 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index 26b2a044e7b6..b679b81b5d52 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -1183,7 +1183,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( std::auto_ptr< ContentProperties > xProps; std::auto_ptr< ContentProperties > xCachedProps; std::auto_ptr< DAVResourceAccess > xResAccess; - rtl::OUString aEscapedTitle; + rtl::OUString aUnescapedTitle; bool bHasAll = false; uno::Reference< lang::XMultiServiceFactory > xSMgr; uno::Reference< ucb::XContentIdentifier > xIdentifier; @@ -1192,7 +1192,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { osl::Guard< osl::Mutex > aGuard( m_aMutex ); - aEscapedTitle = NeonUri::unescape( m_aEscapedTitle ); + aUnescapedTitle = NeonUri::unescape( m_aEscapedTitle ); xSMgr.set( m_xSMgr ); xIdentifier.set( m_xIdentifier ); xProvider.set( m_xProvider.get() ); @@ -1365,7 +1365,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( m_eResourceType == NON_DAV ) xProps->addProperties( aMissingProps, ContentProperties( - aEscapedTitle, + aUnescapedTitle, false ) ); } catch ( DAVException const & e ) @@ -1386,32 +1386,32 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( // might trigger HTTP redirect. // Therefore, title must be updated here. NeonUri aUri( xResAccess->getURL() ); - aEscapedTitle = aUri.GetPathBaseName(); + aUnescapedTitle = aUri.GetPathBaseNameUnescaped(); - if ( UNKNOWN == rType ) + if ( rType == UNKNOWN ) { - xProps.reset( new ContentProperties( aEscapedTitle ) ); + xProps.reset( new ContentProperties( aUnescapedTitle ) ); } // For DAV resources we only know the Title, for non-DAV // resources we additionally know that it is a document. - if ( DAV == rType ) + else if ( rType == DAV ) { //xProps.reset( - // new ContentProperties( aEscapedTitle ) ); + // new ContentProperties( aUnescapedTitle ) ); xProps->addProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), - uno::makeAny( aEscapedTitle ), + uno::makeAny( aUnescapedTitle ), true ); } else { if ( !xProps.get() ) - xProps.reset( new ContentProperties( aEscapedTitle, false ) ); + xProps.reset( new ContentProperties( aUnescapedTitle, false ) ); else xProps->addProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), - uno::makeAny( aEscapedTitle ), + uno::makeAny( aUnescapedTitle ), true ); xProps->addProperty( @@ -1429,7 +1429,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( // No server access for just created (not yet committed) objects. // Only a minimal set of properties supported at this stage. if (m_bTransient) - xProps.reset( new ContentProperties( aEscapedTitle, + xProps.reset( new ContentProperties( aUnescapedTitle, m_bCollection ) ); } @@ -1480,7 +1480,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( m_xCachedProps->addProperties( *xProps.get() ); m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); - m_aEscapedTitle = aEscapedTitle; + m_aEscapedTitle = NeonUri::escapeSegment( aUnescapedTitle ); } return xResultRow; @@ -2947,6 +2947,20 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) // Map DAVException... uno::Any aException; + rtl::OUString aURL; + if ( m_bTransient ) + { + aURL = getParentURL(); + if ( aURL.lastIndexOf( '/' ) != ( aURL.getLength() - 1 ) ) + aURL += rtl::OUString::createFromAscii( "/" ); + + aURL += m_aEscapedTitle; + } + else + { + aURL = m_xIdentifier->getContentIdentifier(); + } + switch ( e.getStatus() ) { case SC_NOT_FOUND: @@ -2954,7 +2968,7 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= beans::PropertyValue( rtl::OUString::createFromAscii("Uri"), -1, - uno::makeAny(m_xIdentifier->getContentIdentifier()), + uno::makeAny(aURL), beans::PropertyState_DIRECT_VALUE); aException <<= @@ -3044,14 +3058,14 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) rtl::OUString::createFromAscii( "Locked!" ), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_xIdentifier->getContentIdentifier(), - sal_True ); + aURL, + sal_False ); // not SelfOwned #else { uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= beans::PropertyValue( rtl::OUString::createFromAscii("Uri"), -1, - uno::makeAny(m_xIdentifier->getContentIdentifier()), + uno::makeAny(aURL), beans::PropertyState_DIRECT_VALUE); aException <<= @@ -3071,8 +3085,8 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) rtl::OUString::createFromAscii( "Locked (self)!" ), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_xIdentifier->getContentIdentifier(), - sal_True ); + aURL, + sal_True ); // SelfOwned break; case DAVException::DAV_NOT_LOCKED: @@ -3081,7 +3095,7 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) rtl::OUString::createFromAscii( "Not locked!" ), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_xIdentifier->getContentIdentifier() ); + aURL ); break; case DAVException::DAV_LOCK_EXPIRED: @@ -3090,7 +3104,7 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) rtl::OUString::createFromAscii( "Lock expired!" ), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_xIdentifier->getContentIdentifier() ); + aURL ); break; default: -- cgit From 5698690a8bccc3c0345ad34fe27934c0027d76a9 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Tue, 21 Sep 2010 16:10:51 +0200 Subject: #i114622# - set infinite timeout in case of unknown timeout. --- ucb/source/ucp/webdav/LockSequence.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ucb') diff --git a/ucb/source/ucp/webdav/LockSequence.cxx b/ucb/source/ucp/webdav/LockSequence.cxx index 98e61954032f..bc9b9f0175f7 100644 --- a/ucb/source/ucp/webdav/LockSequence.cxx +++ b/ucb/source/ucp/webdav/LockSequence.cxx @@ -218,8 +218,12 @@ extern "C" int LockSequence_chardata_callback( // @@@ // } else + { + pCtx->pLock->Timeout = sal_Int64( -1 ); + pCtx->hasTimeout = true; OSL_ENSURE( sal_False, - "LockSequence_chardata_callback - Unknown timeout!" ); + "LockSequence_chardata_callback - Unknown timeout!" ); + } break; case STATE_HREF: -- cgit From e06b0f34ec36ddf5470d3a40d0d41c47e3814670 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 13 Oct 2010 14:32:41 +0200 Subject: #i115050# - Drop support for neon < 0.26.0 --- ucb/source/ucp/webdav/LinkSequence.cxx | 4 -- ucb/source/ucp/webdav/LockEntrySequence.cxx | 4 -- ucb/source/ucp/webdav/LockSequence.cxx | 4 -- ucb/source/ucp/webdav/NeonHeadRequest.cxx | 89 +++----------------------- ucb/source/ucp/webdav/NeonPropFindRequest.cxx | 18 ------ ucb/source/ucp/webdav/NeonSession.cxx | 20 +----- ucb/source/ucp/webdav/NeonUri.cxx | 18 ------ ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx | 4 -- 8 files changed, 10 insertions(+), 151 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/webdav/LinkSequence.cxx b/ucb/source/ucp/webdav/LinkSequence.cxx index 39d8d9cecc38..31ec14ba0adf 100644 --- a/ucb/source/ucp/webdav/LinkSequence.cxx +++ b/ucb/source/ucp/webdav/LinkSequence.cxx @@ -168,11 +168,7 @@ bool LinkSequence::createFromXML( const rtl::OString & rInData, rInData.getStr() + nStart, nEnd - nStart + TOKEN_LENGTH ); -#if NEON_VERSION >= 0x0250 success = !ne_xml_failed( parser ); -#else - success = !!ne_xml_valid( parser ); -#endif ne_xml_destroy( parser ); diff --git a/ucb/source/ucp/webdav/LockEntrySequence.cxx b/ucb/source/ucp/webdav/LockEntrySequence.cxx index 762170e7e057..1e577a47981b 100644 --- a/ucb/source/ucp/webdav/LockEntrySequence.cxx +++ b/ucb/source/ucp/webdav/LockEntrySequence.cxx @@ -215,11 +215,7 @@ bool LockEntrySequence::createFromXML( const rtl::OString & rInData, rInData.getStr() + nStart, nEnd - nStart + TOKEN_LENGTH ); -#if NEON_VERSION >= 0x0250 success = !ne_xml_failed( parser ); -#else - success = !!ne_xml_valid( parser ); -#endif ne_xml_destroy( parser ); diff --git a/ucb/source/ucp/webdav/LockSequence.cxx b/ucb/source/ucp/webdav/LockSequence.cxx index bc9b9f0175f7..f95badaf19d2 100644 --- a/ucb/source/ucp/webdav/LockSequence.cxx +++ b/ucb/source/ucp/webdav/LockSequence.cxx @@ -343,11 +343,7 @@ bool LockSequence::createFromXML( const rtl::OString & rInData, rInData.getStr() + nStart, nEnd - nStart + TOKEN_LENGTH ); -#if NEON_VERSION >= 0x0250 success = !ne_xml_failed( parser ); -#else - success = !!ne_xml_valid( parser ); -#endif ne_xml_destroy( parser ); diff --git a/ucb/source/ucp/webdav/NeonHeadRequest.cxx b/ucb/source/ucp/webdav/NeonHeadRequest.cxx index 2880a86a727d..1e5294882a03 100644 --- a/ucb/source/ucp/webdav/NeonHeadRequest.cxx +++ b/ucb/source/ucp/webdav/NeonHeadRequest.cxx @@ -37,16 +37,15 @@ using namespace com::sun::star; namespace { -#if NEON_VERSION >= 0x0250 -void process_headers(ne_request *req, - DAVResource &rResource, - const std::vector< ::rtl::OUString > &rHeaderNames) +void process_headers( ne_request * req, + DAVResource & rResource, + const std::vector< ::rtl::OUString > & rHeaderNames ) { - void *cursor = NULL; - const char *name, *value; + void * cursor = NULL; + const char * name, *value; - while ((cursor = ne_response_header_iterate(req, cursor, - &name, &value)) != NULL) { + while ( ( cursor = ne_response_header_iterate( req, cursor, + &name, &value ) ) != NULL ) { rtl::OUString aHeaderName( rtl::OUString::createFromAscii( name ) ); rtl::OUString aHeaderValue( rtl::OUString::createFromAscii( value ) ); @@ -86,69 +85,6 @@ void process_headers(ne_request *req, } } } -#else -struct NeonHeadRequestContext -{ - DAVResource * pResource; - const std::vector< ::rtl::OUString > * pHeaderNames; - - NeonHeadRequestContext( DAVResource * p, - const std::vector< ::rtl::OUString > * pHeaders ) - : pResource( p ), pHeaderNames( pHeaders ) {} -}; - -extern "C" void NHR_ResponseHeaderCatcher( void * userdata, - const char * value ) -{ - rtl::OUString aHeader( rtl::OUString::createFromAscii( value ) ); - sal_Int32 nPos = aHeader.indexOf( ':' ); - - if ( nPos != -1 ) - { - rtl::OUString aHeaderName( aHeader.copy( 0, nPos ) ); - - NeonHeadRequestContext * pCtx - = static_cast< NeonHeadRequestContext * >( userdata ); - - // Note: Empty vector means that all headers are requested. - bool bIncludeIt = ( pCtx->pHeaderNames->size() == 0 ); - - if ( !bIncludeIt ) - { - // Check whether this header was requested. - std::vector< ::rtl::OUString >::const_iterator it( - pCtx->pHeaderNames->begin() ); - const std::vector< ::rtl::OUString >::const_iterator end( - pCtx->pHeaderNames->end() ); - - while ( it != end ) - { - if ( (*it) == aHeaderName ) - break; - - ++it; - } - - if ( it != end ) - bIncludeIt = true; - } - - if ( bIncludeIt ) - { - // Create & set the PropertyValue - DAVPropertyValue thePropertyValue; - thePropertyValue.Name = aHeaderName; - thePropertyValue.IsCaseSensitive = false; - - if ( nPos < aHeader.getLength() ) - thePropertyValue.Value <<= aHeader.copy( nPos + 1 ).trim(); - - // Add the newly created PropertyValue - pCtx->pResource->properties.push_back( thePropertyValue ); - } - } -} -#endif } // namespace @@ -156,7 +92,7 @@ extern "C" void NHR_ResponseHeaderCatcher( void * userdata, // Constructor // ------------------------------------------------------------------- -NeonHeadRequest::NeonHeadRequest( HttpSession* inSession, +NeonHeadRequest::NeonHeadRequest( HttpSession * inSession, const rtl::OUString & inPath, const std::vector< ::rtl::OUString > & inHeaderNames, @@ -174,16 +110,9 @@ NeonHeadRequest::NeonHeadRequest( HttpSession* inSession, inPath, RTL_TEXTENCODING_UTF8 ) ); -#if NEON_VERSION < 0x0250 - NeonHeadRequestContext aCtx( &ioResource, &inHeaderNames ); - ne_add_response_header_catcher( req, NHR_ResponseHeaderCatcher, &aCtx ); -#endif - nError = ne_request_dispatch( req ); -#if NEON_VERSION >= 0x0250 - process_headers(req, ioResource, inHeaderNames); -#endif + process_headers( req, ioResource, inHeaderNames ); if ( nError == NE_OK && ne_get_status( req )->klass != 2 ) nError = NE_ERROR; diff --git a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx index 85b5ea0393e0..f794516d20aa 100644 --- a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx +++ b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx @@ -191,22 +191,13 @@ extern "C" int NPFR_propfind_iter( void* userdata, // ------------------------------------------------------------------- extern "C" void NPFR_propfind_results( void* userdata, -#if NEON_VERSION >= 0x0260 const ne_uri* uri, -#else - const char* href, -#endif const NeonPropFindResultSet* set ) { // @@@ href is not the uri! DAVResource ctor wants uri! -#if NEON_VERSION >= 0x0260 DAVResource theResource( OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) ); -#else - DAVResource theResource( - OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); -#endif ne_propset_iterate( set, NPFR_propfind_iter, &theResource ); @@ -233,22 +224,13 @@ extern "C" int NPFR_propnames_iter( void* userdata, // ------------------------------------------------------------------- extern "C" void NPFR_propnames_results( void* userdata, -#if NEON_VERSION >= 0x0260 const ne_uri* uri, -#else - const char* href, -#endif const NeonPropFindResultSet* results ) { // @@@ href is not the uri! DAVResourceInfo ctor wants uri! // Create entry for the resource. -#if NEON_VERSION >= 0x0260 DAVResourceInfo theResource( OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) ); -#else - DAVResourceInfo theResource( - OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); -#endif // Fill entry. ne_propset_iterate( results, NPFR_propnames_iter, &theResource ); diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index 254fae546940..dca92a040af0 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -184,11 +184,7 @@ struct NeonRequestContext // A simple Neon response_block_reader for use with an XInputStream // ------------------------------------------------------------------- -#if NEON_VERSION >= 0x0250 extern "C" int NeonSession_ResponseBlockReader(void * inUserData, -#else -extern "C" void NeonSession_ResponseBlockReader(void * inUserData, -#endif const char * inBuf, size_t inLen ) { @@ -204,9 +200,7 @@ extern "C" void NeonSession_ResponseBlockReader(void * inUserData, if ( xInputStream.is() ) xInputStream->AddToStream( inBuf, inLen ); } -#if NEON_VERSION >= 0x0250 return 0; -#endif } // ------------------------------------------------------------------- @@ -214,11 +208,7 @@ extern "C" void NeonSession_ResponseBlockReader(void * inUserData, // A simple Neon response_block_reader for use with an XOutputStream // ------------------------------------------------------------------- -#if NEON_VERSION >= 0x0250 extern "C" int NeonSession_ResponseBlockWriter( void * inUserData, -#else -extern "C" void NeonSession_ResponseBlockWriter( void * inUserData, -#endif const char * inBuf, size_t inLen ) { @@ -236,9 +226,7 @@ extern "C" void NeonSession_ResponseBlockWriter( void * inUserData, xOutputStream->writeBytes( aSeq ); } } -#if NEON_VERSION >= 0x0250 return 0; -#endif } // ------------------------------------------------------------------- @@ -1926,17 +1914,11 @@ int NeonSession::GET( ne_session * sess, void *cursor = NULL; const char *name, *value; -#if NEON_VERSION < 0x0250 - if ( getheaders ) - ne_add_response_header_catcher( - req, runResponseHeaderHandler, userdata ); -#endif ne_decompress * dc = ne_decompress_reader( req, ne_accept_2xx, reader, userdata ); ret = ne_request_dispatch( req ); -#if NEON_VERSION >= 0x0250 if ( getheaders ) { while ( ( cursor = ne_response_header_iterate( @@ -1948,7 +1930,7 @@ int NeonSession::GET( ne_session * sess, runResponseHeaderHandler(userdata, buffer); } } -#endif + if ( ret == NE_OK && ne_get_status( req )->klass != 2 ) ret = NE_ERROR; diff --git a/ucb/source/ucp/webdav/NeonUri.cxx b/ucb/source/ucp/webdav/NeonUri.cxx index 774faa06b9dd..27f24c631161 100644 --- a/ucb/source/ucp/webdav/NeonUri.cxx +++ b/ucb/source/ucp/webdav/NeonUri.cxx @@ -59,36 +59,24 @@ using namespace webdav_ucp; namespace { const ne_uri g_sUriDefaultsHTTP = { "http", -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, DEFAULT_HTTP_PORT, -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, NULL }; const ne_uri g_sUriDefaultsHTTPS = { "https", -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, DEFAULT_HTTPS_PORT, -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, NULL }; const ne_uri g_sUriDefaultsFTP = { "ftp", -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, DEFAULT_FTP_PORT, -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, NULL }; } // namespace @@ -174,11 +162,7 @@ void NeonUri::init( const rtl::OString & rUri, const ne_uri * pUri ) pUri->scheme ? pUri->scheme : pUriDefs->scheme, RTL_TEXTENCODING_UTF8 ); mUserInfo = rtl::OStringToOUString( -#if NEON_VERSION >= 0x0260 pUri->userinfo ? pUri->userinfo : pUriDefs->userinfo, -#else - pUri->authinfo ? pUri->authinfo : pUriDefs->authinfo, -#endif RTL_TEXTENCODING_UTF8 ); mHostName = rtl::OStringToOUString( pUri->host ? pUri->host : pUriDefs->host, @@ -188,7 +172,6 @@ void NeonUri::init( const rtl::OString & rUri, const ne_uri * pUri ) pUri->path ? pUri->path : pUriDefs->path, RTL_TEXTENCODING_UTF8 ); -#if NEON_VERSION >= 0x0260 if ( pUri->query ) { mPath += rtl::OUString::createFromAscii( "?" ); @@ -202,7 +185,6 @@ void NeonUri::init( const rtl::OString & rUri, const ne_uri * pUri ) mPath += rtl::OStringToOUString( pUri->fragment, RTL_TEXTENCODING_UTF8 ); } -#endif } // ------------------------------------------------------------------- diff --git a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx index 1ce4c70e6b21..42f30c665b61 100644 --- a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx +++ b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx @@ -373,11 +373,7 @@ bool UCBDeadPropertyValue::createFromXML( const rtl::OString & rInData, ne_xml_parse( parser, rInData.getStr(), rInData.getLength() ); -#if NEON_VERSION >= 0x0250 success = !ne_xml_failed( parser ); -#else - success = !!ne_xml_valid( parser ); -#endif ne_xml_destroy( parser ); -- cgit From 8d22455d3e7c7e8e25bcb8724754fc764f0e713c Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Mon, 18 Oct 2010 14:46:06 +0200 Subject: #i114970# --- ucb/source/ucp/gio/gio_provider.cxx | 8 -------- 1 file changed, 8 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/gio/gio_provider.cxx b/ucb/source/ucp/gio/gio_provider.cxx index b8b16ba72c24..750f7408e7ec 100644 --- a/ucb/source/ucp/gio/gio_provider.cxx +++ b/ucb/source/ucp/gio/gio_provider.cxx @@ -108,14 +108,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -extern "C" sal_Bool SAL_CALL component_writeInfo( void *, void *pRegistryKey ) -{ - return pRegistryKey && - writeInfo( pRegistryKey, - ::gio::ContentProvider::getImplementationName_Static(), - ::gio::ContentProvider::getSupportedServiceNames_Static() ); -} - extern "C" void * SAL_CALL component_getFactory( const sal_Char *pImplName, void *pServiceManager, void * ) { -- cgit From 3f2ff25d286a2d751292e567850e2810061a1c85 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Thu, 21 Oct 2010 17:46:55 +0200 Subject: #i114622# - Reverted wrong optimization. --- ucb/source/ucp/webdav/webdavcontent.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ucb') diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index b679b81b5d52..c58ba207199f 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -1395,7 +1395,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( // For DAV resources we only know the Title, for non-DAV // resources we additionally know that it is a document. - else if ( rType == DAV ) + + if ( rType == DAV ) { //xProps.reset( // new ContentProperties( aUnescapedTitle ) ); -- cgit From 1885dddbdd2382f95aef15df15d4cd110f8d7854 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 22 Oct 2010 10:37:46 +0200 Subject: sb131: #i115124# $(XSLTPROC) implies LIBXSLT:libxslt --- ucb/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ucb') diff --git a/ucb/prj/build.lst b/ucb/prj/build.lst index 8d8c87f3ae4b..6f2d146aabbf 100644 --- a/ucb/prj/build.lst +++ b/ucb/prj/build.lst @@ -1,4 +1,4 @@ -uc ucb : cppuhelper CURL:curl OPENSSL:openssl NEON:neon LIBXML2:libxml2 offapi sal salhelper ucbhelper udkapi comphelper tools NULL +uc ucb : cppuhelper CURL:curl OPENSSL:openssl NEON:neon LIBXML2:libxml2 LIBXSLT:libxslt offapi sal salhelper ucbhelper udkapi comphelper tools NULL uc ucb usr1 - all uc_mkout NULL uc ucb\inc nmake - all uc_inc NULL uc ucb\source\regexp nmake - all uc_regexp uc_inc NULL -- cgit From 7f79c10b2e750dca09f252e745a4e3d390ba40b3 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 19 Nov 2010 10:50:56 +0100 Subject: fwk160: #i99833# do not use ftruncate unnecessarily --- ucb/source/ucp/file/shell.cxx | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx index f324c93b878f..d045380ae7a1 100644 --- a/ucb/source/ucp/file/shell.cxx +++ b/ucb/source/ucp/file/shell.cxx @@ -1805,14 +1805,26 @@ shell::write( sal_Int32 CommandId, { aFile.close(); err = aFile.open( OpenFlag_Write ); - } - if( err != osl::FileBase::E_None ) - { - installError( CommandId, - TASKHANDLING_NO_OPEN_FILE_FOR_OVERWRITE, - err ); - return sal_False; + if( err != osl::FileBase::E_None ) + { + installError( CommandId, + TASKHANDLING_NO_OPEN_FILE_FOR_OVERWRITE, + err ); + return sal_False; + } + + // the existing file was just opened and should be overwritten now, + // truncate it first + + err = aFile.setSize( 0 ); + if( err != osl::FileBase::E_None ) + { + installError( CommandId, + TASKHANDLING_FILESIZE_FOR_WRITE, + err ); + return sal_False; + } } } else @@ -1844,7 +1856,6 @@ shell::write( sal_Int32 CommandId, sal_Bool bSuccess = sal_True; - sal_uInt64 nTotalNumberOfBytes = 0; sal_uInt64 nWrittenBytes; sal_Int32 nReadBytes = 0, nRequestedBytes = 32768 /*32k*/; uno::Sequence< sal_Int8 > seq( nRequestedBytes ); @@ -1901,20 +1912,9 @@ shell::write( sal_Int32 CommandId, bSuccess = sal_False; break; } - - nTotalNumberOfBytes += nWrittenBytes; } } while( nReadBytes == nRequestedBytes ); - err = aFile.setSize( nTotalNumberOfBytes ); - if( err != osl::FileBase::E_None ) - { - installError( CommandId, - TASKHANDLING_FILESIZE_FOR_WRITE, - err ); - bSuccess = sal_False; - } - err = aFile.close(); if( err != osl::FileBase::E_None ) { -- cgit From 8e64b97f228522f84913fb90bc14201b8a4d5b7b Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 5 Jan 2011 15:06:59 +0100 Subject: #i116314# - Do not cache certain properties, like dav:lockdiscovery --- ucb/source/ucp/webdav/ContentProperties.cxx | 120 +++++++++++++++++++++++++--- ucb/source/ucp/webdav/ContentProperties.hxx | 38 ++++++++- ucb/source/ucp/webdav/webdavcontent.cxx | 8 +- ucb/source/ucp/webdav/webdavcontent.hxx | 4 +- 4 files changed, 151 insertions(+), 19 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx index 2285ad28a888..95bc573ecaf7 100644 --- a/ucb/source/ucp/webdav/ContentProperties.cxx +++ b/ucb/source/ucp/webdav/ContentProperties.cxx @@ -120,14 +120,14 @@ ContentProperties::ContentProperties( const DAVResource& rResource ) std::vector< DAVPropertyValue >::const_iterator it = rResource.properties.begin(); - std::vector< DAVPropertyValue >::const_iterator end + std::vector< DAVPropertyValue >::const_iterator end = rResource.properties.end(); - while ( it != end ) - { + while ( it != end ) + { addProperty( (*it) ); ++it; - } + } if ( rResource.uri.getStr()[ rResource.uri.getLength() - 1 ] == sal_Unicode( '/' ) ) @@ -157,6 +157,13 @@ ContentProperties::ContentProperties( const rtl::OUString & rTitle ) = PropertyValue( uno::makeAny( rTitle ), true ); } +//========================================================================= +ContentProperties::ContentProperties() +: m_xProps( new PropertyValueMap ), + m_bTrailingSlash( sal_False ) +{ +} + //========================================================================= ContentProperties::ContentProperties( const ContentProperties & rOther ) : m_aEscapedTitle( rOther.m_aEscapedTitle ), @@ -254,7 +261,7 @@ void ContentProperties::UCBNamesToDAVNames( { if ( !bCreationDate ) { - propertyNames.push_back( DAVProperties::CREATIONDATE ); + propertyNames.push_back( DAVProperties::CREATIONDATE ); bCreationDate = sal_True; } } @@ -265,7 +272,7 @@ void ContentProperties::UCBNamesToDAVNames( { if ( !bLastModified ) { - propertyNames.push_back( + propertyNames.push_back( DAVProperties::GETLASTMODIFIED ); bLastModified = sal_True; } @@ -277,7 +284,7 @@ void ContentProperties::UCBNamesToDAVNames( { if ( !bContentType ) { - propertyNames.push_back( + propertyNames.push_back( DAVProperties::GETCONTENTTYPE ); bContentType = sal_True; } @@ -289,7 +296,7 @@ void ContentProperties::UCBNamesToDAVNames( { if ( !bContentLength ) { - propertyNames.push_back( + propertyNames.push_back( DAVProperties::GETCONTENTLENGTH ); bContentLength = sal_True; } @@ -307,7 +314,7 @@ void ContentProperties::UCBNamesToDAVNames( { if ( !bResourceType ) { - propertyNames.push_back( DAVProperties::RESOURCETYPE ); + propertyNames.push_back( DAVProperties::RESOURCETYPE ); bResourceType = sal_True; } } @@ -436,7 +443,7 @@ void ContentProperties::addProperties( const std::vector< DAVPropertyValue > & rProps ) { std::vector< DAVPropertyValue >::const_iterator it = rProps.begin(); - std::vector< DAVPropertyValue >::const_iterator end = rProps.end(); + const std::vector< DAVPropertyValue >::const_iterator end = rProps.end(); while ( it != end ) { @@ -571,3 +578,96 @@ void ContentProperties::addProperty( const rtl::OUString & rName, // Save property. (*m_xProps)[ rName ] = PropertyValue( rValue, bIsCaseSensitive ); } + +//========================================================================= +//========================================================================= +// +// CachableContentProperties Implementation. +// +//========================================================================= +//========================================================================= + +namespace +{ + bool isCachable( rtl::OUString const & rName, + bool isCaseSensitive ) + { + static rtl::OUString aNonCachableProps [] = + { + DAVProperties::LOCKDISCOVERY, + + DAVProperties::GETETAG, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ETag" ) ), + + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Last-Modified" ) ), + DAVProperties::GETLASTMODIFIED, + + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Content-Length" ) ), + DAVProperties::GETCONTENTLENGTH, + + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ) + }; + + for ( sal_uInt32 n = 0; + n < ( sizeof( aNonCachableProps ) + / sizeof( aNonCachableProps[ 0 ] ) ); + ++n ) + { + if ( isCaseSensitive ) + { + if ( rName.equals( aNonCachableProps[ n ] ) ) + return false; + } + else + if ( rName.equalsIgnoreAsciiCase( aNonCachableProps[ n ] ) ) + return false; + } + return true; + } + +} // namespace + +//========================================================================= +CachableContentProperties::CachableContentProperties( + const ContentProperties & rProps ) +{ + addProperties( rProps ); +} + +//========================================================================= +void CachableContentProperties::addProperties( + const ContentProperties & rProps ) +{ + const std::auto_ptr< PropertyValueMap > & props = rProps.getProperties(); + + PropertyValueMap::const_iterator it = props->begin(); + const PropertyValueMap::const_iterator end = props->end(); + + while ( it != end ) + { + if ( isCachable( (*it).first, (*it).second.isCaseSensitive() ) ) + m_aProps.addProperty( (*it).first, + (*it).second.value(), + (*it).second.isCaseSensitive() ); + + ++it; + } +} + +//========================================================================= +void CachableContentProperties::addProperties( + const std::vector< DAVPropertyValue > & rProps ) +{ + std::vector< DAVPropertyValue >::const_iterator it = rProps.begin(); + const std::vector< DAVPropertyValue >::const_iterator end = rProps.end(); + + while ( it != end ) + { + if ( isCachable( (*it).Name, (*it).IsCaseSensitive ) ) + m_aProps.addProperty( (*it) ); + + ++it; + } +} diff --git a/ucb/source/ucp/webdav/ContentProperties.hxx b/ucb/source/ucp/webdav/ContentProperties.hxx index 7819698bf667..fb07ad19a705 100644 --- a/ucb/source/ucp/webdav/ContentProperties.hxx +++ b/ucb/source/ucp/webdav/ContentProperties.hxx @@ -102,10 +102,12 @@ struct DAVResource; class ContentProperties { public: - ContentProperties( const DAVResource& rResource ); + ContentProperties(); + + ContentProperties( const DAVResource& rResource ); // Mini props for transient contents. - ContentProperties( const rtl::OUString & rTitle, sal_Bool bFolder ); + ContentProperties( const rtl::OUString & rTitle, sal_Bool bFolder ); // Micro props for non-existing contents. ContentProperties( const rtl::OUString & rTitle ); @@ -181,7 +183,7 @@ public: { return m_xProps; } private: - ::rtl::OUString m_aEscapedTitle; // escaped Title + ::rtl::OUString m_aEscapedTitle; std::auto_ptr< PropertyValueMap > m_xProps; bool m_bTrailingSlash; @@ -192,6 +194,34 @@ private: const PropertyValue * get( const rtl::OUString & rName ) const; }; -} +class CachableContentProperties +{ +private: + ContentProperties m_aProps; + + CachableContentProperties & operator=( const CachableContentProperties & ); // n.i. + CachableContentProperties( const CachableContentProperties & ); // n.i. + +public: + CachableContentProperties( const ContentProperties & rProps ); + + void addProperties( const ContentProperties & rProps ); + + void addProperties( const std::vector< DAVPropertyValue > & rProps ); + + bool containsAllNames( + const com::sun::star::uno::Sequence< + com::sun::star::beans::Property >& rProps, + std::vector< rtl::OUString > & rNamesNotContained ) const + { return m_aProps.containsAllNames( rProps, rNamesNotContained ); } + + const com::sun::star::uno::Any & + getValue( const rtl::OUString & rName ) const + { return m_aProps.getValue( rName ); } + + operator const ContentProperties & () const { return m_aProps; } +}; + +} // namespace webdav_ucp #endif /* !_WEBDAV_UCP_CONTENTPROPERTIES_HXX */ diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index c58ba207199f..9a77a7e941c1 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -1476,7 +1476,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( osl::Guard< osl::Mutex > aGuard( m_aMutex ); if ( !m_xCachedProps.get() ) - m_xCachedProps.reset( new ContentProperties( *xProps.get() ) ); + m_xCachedProps.reset( new CachableContentProperties( *xProps.get() ) ); else m_xCachedProps->addProperties( *xProps.get() ); @@ -2012,7 +2012,7 @@ uno::Any Content::open( // cache headers. if ( !m_xCachedProps.get()) m_xCachedProps.reset( - new ContentProperties( aResource ) ); + new CachableContentProperties( aResource ) ); else m_xCachedProps->addProperties( aResource ); @@ -2058,7 +2058,7 @@ uno::Any Content::open( // cache headers. if ( !m_xCachedProps.get()) m_xCachedProps.reset( - new ContentProperties( aResource ) ); + new CachableContentProperties( aResource ) ); else m_xCachedProps->addProperties( aResource.properties ); @@ -3229,7 +3229,7 @@ const Content::ResourceType & Content::getResourceType( if ( resources.size() == 1 ) { m_xCachedProps.reset( - new ContentProperties( resources[ 0 ] ) ); + new CachableContentProperties( resources[ 0 ] ) ); m_xCachedProps->containsAllNames( aProperties, m_aFailedPropNames ); } diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx index 0568b2bfbb54..dcc544a9b2b5 100644 --- a/ucb/source/ucp/webdav/webdavcontent.hxx +++ b/ucb/source/ucp/webdav/webdavcontent.hxx @@ -68,6 +68,7 @@ namespace webdav_ucp class ContentProvider; class ContentProperties; +class CachableContentProperties; class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator @@ -81,7 +82,8 @@ class Content : public ::ucbhelper::ContentImplHelper, }; std::auto_ptr< DAVResourceAccess > m_xResAccess; - std::auto_ptr< ContentProperties > m_xCachedProps; // locally cached props + std::auto_ptr< CachableContentProperties > + m_xCachedProps; // locally cached props rtl::OUString m_aEscapedTitle; ResourceType m_eResourceType; ContentProvider* m_pProvider; // No need for a ref, base class holds object -- cgit From 94eae11e9ee5956df320078b759ad86459df6694 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 14 Jan 2011 11:20:36 +0100 Subject: removetooltypes01: #i112600# fix TRUE/FALSE autodoc tags --- ucb/source/sorter/sortresult.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ucb') diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx index 6e546950a23a..94af36513670 100644 --- a/ucb/source/sorter/sortresult.cxx +++ b/ucb/source/sorter/sortresult.cxx @@ -490,7 +490,7 @@ sal_Int32 SAL_CALL SortedResultSet::getRow() @param row is the number of rows to move. Could be negative. @returns - if the cursor is on a row; otherwise + if the cursor is on a row; otherwise @throws SQLException if a database access error occurs or if row is 0, or the result set type is FORWARD_ONLY. @@ -552,7 +552,7 @@ sal_Bool SAL_CALL SortedResultSet::absolute( sal_Int32 row ) @param rows is the number of rows to move. Could be negative. @returns - if the cursor is on a valid row; if it is off + if the cursor is on a valid row; if it is off the result set. @throws SQLException if a database access error occurs or if there is no @@ -597,7 +597,7 @@ sal_Bool SAL_CALL SortedResultSet::relative( sal_Int32 rows )

                  Note: previous() is not the same as relative(-1) because it makes sense to call previous() when there is no current row. - @returns if the cursor is on a valid row; if it is off + @returns if the cursor is on a valid row; if it is off the result set. @throws SQLException if a database access error occurs or the result set type -- cgit From fcad8a5c8b77bfc6b3cb41d7465147ad157d0124 Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Fri, 11 Feb 2011 15:06:12 +0100 Subject: ab80: Adding changes of cws mib21, ab77, ab77run2, dr77i to dev300 ab77: #163789# Handle class module factories document specific ab77: #163732# Defer removal of documents until XCloseListener::notifyClosing ab77: #163808# make VBA symbols Application.ScreenUpdating and Application.Interactive work globally on all documents ab77: wae ab77: #163840# read UTF-8 BOM ab77: #163732# VBA UserForm_Terminate triggered too late while closing document ab77: minor correction ab77: assertion: do not call ::rtl::OUString::copy() with negative index ab77run2: #163869# do not call Class_Terminate VBA macros when document disposes dr77i: #163941# do not update drawing layer when pasting from clipboard after cut mib21: #163944# ignore trailing whitespace in Basic source lines mib21: #163948# allow to manually pack MSVC DLLs into extensions mib21: #163948# multiprocess build fix Authors: Andreas Bregas Daniel Rentz [dr] Eike Rathke [er] --- ucb/source/ucp/tdoc/tdoc_docmgr.cxx | 105 +++++++++++++++++++++++++++++++----- ucb/source/ucp/tdoc/tdoc_docmgr.hxx | 34 +++++++++++- 2 files changed, 124 insertions(+), 15 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx index 46aa1ae69ec3..5bd774d618d5 100644 --- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx +++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx @@ -27,14 +27,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_ucb.hxx" + /************************************************************************** TODO ************************************************************************** - - filter unwanted models notified by global document event broadcaster - - help documents - - others, which I don't know yet - *************************************************************************/ #include "osl/diagnose.h" @@ -44,12 +41,13 @@ #include "comphelper/namedvaluecollection.hxx" #include "comphelper/documentinfo.hxx" +#include "com/sun/star/awt/XTopWindow.hpp" #include "com/sun/star/beans/XPropertySet.hpp" #include "com/sun/star/container/XEnumerationAccess.hpp" +#include "com/sun/star/document/XStorageBasedDocument.hpp" #include "com/sun/star/frame/XStorable.hpp" #include "com/sun/star/lang/DisposedException.hpp" -#include "com/sun/star/document/XStorageBasedDocument.hpp" -#include "com/sun/star/awt/XTopWindow.hpp" +#include "com/sun/star/util/XCloseBroadcaster.hpp" #include "tdoc_docmgr.hxx" @@ -57,6 +55,53 @@ using namespace com::sun::star; using namespace tdoc_ucp; using ::comphelper::DocumentInfo; +//========================================================================= +//========================================================================= +// +// OfficeDocumentsCloseListener Implementation. +// +//========================================================================= +//========================================================================= + +//========================================================================= +// +// util::XCloseListener +// +//========================================================================= + +// virtual +void SAL_CALL OfficeDocumentsManager::OfficeDocumentsCloseListener::queryClosing( + const lang::EventObject& /*Source*/, sal_Bool /*GetsOwnership*/ ) + throw ( util::CloseVetoException, + uno::RuntimeException ) +{ +} + +//========================================================================= +void SAL_CALL OfficeDocumentsManager::OfficeDocumentsCloseListener::notifyClosing( + const lang::EventObject& Source ) + throw ( uno::RuntimeException ) +{ + document::EventObject aDocEvent; + aDocEvent.Source = Source.Source; + aDocEvent.EventName = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "OfficeDocumentsListener::notifyClosing" ) ); + m_pManager->notifyEvent( aDocEvent ); +} + +//========================================================================= +// +// lang::XEventListener (base of util::XCloseListener) +// +//========================================================================= + +// virtual +void SAL_CALL OfficeDocumentsManager::OfficeDocumentsCloseListener::disposing( + const lang::EventObject& /*Source*/ ) + throw ( uno::RuntimeException ) +{ +} + //========================================================================= //========================================================================= // @@ -70,7 +115,8 @@ OfficeDocumentsManager::OfficeDocumentsManager( OfficeDocumentsEventListener * pDocEventListener ) : m_xSMgr( xSMgr ), m_xDocEvtNotifier( createDocumentEventNotifier( xSMgr ) ), - m_pDocEventListener( pDocEventListener ) + m_pDocEventListener( pDocEventListener ), + m_xDocCloseListener( new OfficeDocumentsCloseListener( this ) ) { if ( m_xDocEvtNotifier.is() ) { @@ -188,10 +234,19 @@ void SAL_CALL OfficeDocumentsManager::notifyEvent( OSL_ENSURE( xStorage.is(), "Got no document storage!" ); rtl:: OUString aDocId = getDocumentId( Event.Source ); - rtl:: OUString aTitle = DocumentInfo::getDocumentTitle( uno::Reference< frame::XModel >( Event.Source, uno::UNO_QUERY ) ); + rtl:: OUString aTitle = DocumentInfo::getDocumentTitle( + uno::Reference< frame::XModel >( Event.Source, uno::UNO_QUERY ) ); m_aDocs[ aDocId ] = StorageInfo( aTitle, xStorage, xModel ); + uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( + Event.Source, uno::UNO_QUERY ); + OSL_ENSURE( xCloseBroadcaster.is(), + "OnLoadFinished/OnCreate event: got no close broadcaster!" ); + + if ( xCloseBroadcaster.is() ) + xCloseBroadcaster->addCloseListener( m_xDocCloseListener ); + // Propagate document closure. OSL_ENSURE( m_pDocEventListener, "OnLoadFinished/OnCreate event: no owner for insert event propagation!" ); @@ -202,12 +257,18 @@ void SAL_CALL OfficeDocumentsManager::notifyEvent( } } else if ( Event.EventName.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "OnUnload" ) ) ) + RTL_CONSTASCII_STRINGPARAM( "OfficeDocumentsListener::notifyClosing" ) ) ) { if ( isOfficeDocument( Event.Source ) ) { // Document has been closed (unloaded) + // #163732# - Official event "OnUnload" does not work here. Event + // gets fired to early. Other OnUnload listeners called after this + // listener may still need TDOC access to the document. Remove the + // document from TDOC docs list on XCloseListener::notifyClosing. + // See OfficeDocumentsManager::OfficeDocumentsListener::notifyClosing. + osl::MutexGuard aGuard( m_aMtx ); uno::Reference< frame::XModel > @@ -228,8 +289,6 @@ void SAL_CALL OfficeDocumentsManager::notifyEvent( rtl::OUString aDocId( (*it).first ); m_pDocEventListener->notifyDocumentClosed( aDocId ); } - - break; } ++it; @@ -238,8 +297,18 @@ void SAL_CALL OfficeDocumentsManager::notifyEvent( OSL_ENSURE( it != m_aDocs.end(), "OnUnload event notified for unknown document!" ); - if( it != m_aDocs.end() ) + if ( it != m_aDocs.end() ) + { + uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( + Event.Source, uno::UNO_QUERY ); + OSL_ENSURE( xCloseBroadcaster.is(), + "OnUnload event: got no XCloseBroadcaster from XModel" ); + + if ( xCloseBroadcaster.is() ) + xCloseBroadcaster->removeCloseListener( m_xDocCloseListener ); + m_aDocs.erase( it ); + } } } else if ( Event.EventName.equalsAsciiL( @@ -307,7 +376,7 @@ void SAL_CALL OfficeDocumentsManager::notifyEvent( (*it).second.xStorage = xStorage; // Adjust title. - (*it).second.aTitle = DocumentInfo::getDocumentTitle( uno::Reference< frame::XModel >( Event.Source, uno::UNO_QUERY ) ); + (*it).second.aTitle = DocumentInfo::getDocumentTitle( xModel ); break; } ++it; @@ -334,7 +403,7 @@ void SAL_CALL OfficeDocumentsManager::notifyEvent( if ( (*it).second.xModel == xModel ) { // Adjust title. - rtl:: OUString aTitle = DocumentInfo::getDocumentTitle( uno::Reference< frame::XModel >( Event.Source, uno::UNO_QUERY ) ); + rtl:: OUString aTitle = DocumentInfo::getDocumentTitle( xModel ); (*it).second.aTitle = aTitle; // Adjust storage. @@ -475,6 +544,14 @@ void OfficeDocumentsManager::buildDocumentsList() m_aDocs[ aDocId ] = StorageInfo( aTitle, xStorage, xModel ); + + uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( + xModel, uno::UNO_QUERY ); + OSL_ENSURE( xCloseBroadcaster.is(), + "buildDocumentsList: got no close broadcaster!" ); + + if ( xCloseBroadcaster.is() ) + xCloseBroadcaster->addCloseListener( m_xDocCloseListener ); } } } diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx index 8f8b2fc117f0..b1c0ed41d9d9 100644 --- a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx +++ b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx @@ -39,6 +39,7 @@ #include "com/sun/star/embed/XStorage.hpp" #include "com/sun/star/frame/XModel.hpp" #include "com/sun/star/frame/XModuleManager.hpp" +#include "com/sun/star/util/XCloseListener.hpp" namespace tdoc_ucp { @@ -88,6 +89,33 @@ namespace tdoc_ucp { class OfficeDocumentsManager : public cppu::WeakImplHelper1< com::sun::star::document::XEventListener > { + class OfficeDocumentsCloseListener : + public cppu::WeakImplHelper1< com::sun::star::util::XCloseListener > + + { + public: + OfficeDocumentsCloseListener( OfficeDocumentsManager * pMgr ) + : m_pManager( pMgr ) {}; + + // util::XCloseListener + virtual void SAL_CALL queryClosing( + const ::com::sun::star::lang::EventObject& Source, + ::sal_Bool GetsOwnership ) + throw (::com::sun::star::util::CloseVetoException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL notifyClosing( + const ::com::sun::star::lang::EventObject& Source ) + throw (::com::sun::star::uno::RuntimeException); + + // lang::XEventListener (base of util::XCloseListener) + virtual void SAL_CALL disposing( + const com::sun::star::lang::EventObject & Source ) + throw ( com::sun::star::uno::RuntimeException ); + private: + OfficeDocumentsManager * m_pManager; + }; + public: OfficeDocumentsManager( const com::sun::star::uno::Reference< @@ -131,7 +159,9 @@ namespace tdoc_ucp { createDocumentEventNotifier( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rXSMgr ); + void buildDocumentsList(); + bool isOfficeDocument( const com::sun::star::uno::Reference< @@ -163,9 +193,11 @@ namespace tdoc_ucp { com::sun::star::uno::Reference< com::sun::star::document::XEventBroadcaster > m_xDocEvtNotifier; com::sun::star::uno::Reference< - com::sun::star::frame::XModuleManager > m_xModuleMgr; + com::sun::star::frame::XModuleManager > m_xModuleMgr; DocumentList m_aDocs; OfficeDocumentsEventListener * m_pDocEventListener; + com::sun::star::uno::Reference< + com::sun::star::util::XCloseListener > m_xDocCloseListener; }; } // namespace tdoc_ucp -- cgit From 26a17669d5bbe970a603423197c18a9383c73df6 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 16 Mar 2011 17:52:46 +0200 Subject: Make the OCMA UCP build again, add .component file --- ucb/source/ucp/odma/makefile.mk | 7 +++++++ ucb/source/ucp/odma/odma_services.cxx | 16 ---------------- ucb/source/ucp/odma/ucpodma1.component | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 16 deletions(-) mode change 100755 => 100644 ucb/source/ucp/odma/makefile.mk create mode 100644 ucb/source/ucp/odma/ucpodma1.component (limited to 'ucb') diff --git a/ucb/source/ucp/odma/makefile.mk b/ucb/source/ucp/odma/makefile.mk old mode 100755 new mode 100644 index 643b4fa2788e..4af8c7649ae5 --- a/ucb/source/ucp/odma/makefile.mk +++ b/ucb/source/ucp/odma/makefile.mk @@ -102,3 +102,10 @@ LIB3OBJFILES=$(SLO3FILES) .INCLUDE: target.mk +ALLTAR : $(MISC)/$(TARGET)$(UCP_VERSION).component + +$(MISC)/$(TARGET)$(UCP_VERSION).component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + $(TARGET)$(UCP_VERSION).component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET)$(UCP_VERSION).component diff --git a/ucb/source/ucp/odma/odma_services.cxx b/ucb/source/ucp/odma/odma_services.cxx index e93674cd6ad9..5465c8a202a3 100755 --- a/ucb/source/ucp/odma/odma_services.cxx +++ b/ucb/source/ucp/odma/odma_services.cxx @@ -45,22 +45,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//========================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * /*pServiceManager*/, void * pRegistryKey ) -{ - return pRegistryKey && - - ////////////////////////////////////////////////////////////////////// - // Write info into registry. - ////////////////////////////////////////////////////////////////////// - - // @@@ Adjust namespace names. - writeInfo( pRegistryKey, - ::odma::ContentProvider::getImplementationName_Static(), - ::odma::ContentProvider::getSupportedServiceNames_Static() ); -} - //========================================================================= extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) diff --git a/ucb/source/ucp/odma/ucpodma1.component b/ucb/source/ucp/odma/ucpodma1.component new file mode 100644 index 000000000000..fa1abaee8517 --- /dev/null +++ b/ucb/source/ucp/odma/ucpodma1.component @@ -0,0 +1,34 @@ + + + + + + + + -- cgit