diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2011-02-01 11:12:15 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2011-02-01 11:12:15 +0100 |
commit | c1a45b9a85bd5f221c27a73cfb9f4758b264d6f6 (patch) | |
tree | 09b80f2261cc5babc9c89df876714d6324b9928e | |
parent | 2b0eb51fb4e335e81ca660c3d2722c5861fcae7b (diff) | |
parent | ffaad89d0606aac0760052034702afb1ce6394db (diff) |
CWS-TOOLING: integrate CWS dba34booo/DEV300_m99
66 files changed, 769 insertions, 2686 deletions
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc index 55b67ee64..2ab9c80c8 100644 --- a/dbaccess/inc/dbaccess_helpid.hrc +++ b/dbaccess/inc/dbaccess_helpid.hrc @@ -292,6 +292,7 @@ #define HID_DSADMIN_ADVANCED "DBACCESS_HID_DSADMIN_ADVANCED" #define HID_DSADMIN_BOOLEANCOMPARISON "DBACCESS_HID_DSADMIN_BOOLEANCOMPARISON" #define HID_DSADMIN_ORACLE_DATABASE "DBACCESS_HID_DSADMIN_ORACLE_DATABASE" +#define HID_DSADMIN_MAXROWSCAN "DBACCESS_HID_DSADMIN_MAXROWSCAN" #define UID_APP_VIEW "DBACCESS_UID_APP_VIEW" #define HID_APP_TABLE_TREE "DBACCESS_HID_APP_TABLE_TREE" diff --git a/dbaccess/prj/build.lst b/dbaccess/prj/build.lst index b90f631db..10227f111 100644 --- a/dbaccess/prj/build.lst +++ b/dbaccess/prj/build.lst @@ -1,4 +1,4 @@ -ba dbaccess : l10n BOOST:boost connectivity svx stoc qadevOOo xmlscript LIBXSLT:libxslt NULL +ba dbaccess : l10n BOOST:boost connectivity svx stoc qadevOOo xmlscript LIBXSLT:libxslt test NULL ba dbaccess usr1 - all ba_mkout NULL ba dbaccess\inc nmake - all ba_inc NULL ba dbaccess\source\ui\inc nmake - all ba_uiinc ba_inc NULL @@ -8,7 +8,6 @@ ba dbaccess\source\core\recovery nmake - all ba_crecovery ba_inc NULL ba dbaccess\source\core\misc nmake - all ba_cmisc ba_inc NULL ba dbaccess\source\core\resource nmake - all ba_cres ba_inc NULL ba dbaccess\source\filter\xml nmake - all ba_ffilter ba_shared ba_util ba_inc NULL -ba dbaccess\source\filter\migration nmake - all ba_fmigration ba_shared ba_inc NULL ba dbaccess\source\shared nmake - all ba_shared ba_cres ba_inc NULL ba dbaccess\source\sdbtools\connection nmake - all ba_conntools ba_inc NULL ba dbaccess\source\sdbtools\misc nmake - all ba_misctools ba_inc NULL diff --git a/dbaccess/prj/d.lst b/dbaccess/prj/d.lst index 4e1ab9c7f..543714657 100644 --- a/dbaccess/prj/d.lst +++ b/dbaccess/prj/d.lst @@ -53,7 +53,6 @@ touch: ..\%__SRC%\misc\dbaccess.hid %_DEST%\bin%_EXT%\dba.hid ..\%__SRC%\misc\adabasui.component %_DEST%\xml%_EXT%\adabasui.component ..\%__SRC%\misc\dba.component %_DEST%\xml%_EXT%\dba.component -..\%__SRC%\misc\dbacfg.component %_DEST%\xml%_EXT%\dbacfg.component ..\%__SRC%\misc\dbaxml.component %_DEST%\xml%_EXT%\dbaxml.component ..\%__SRC%\misc\dbmm.component %_DEST%\xml%_EXT%\dbmm.component ..\%__SRC%\misc\dbu.component %_DEST%\xml%_EXT%\dbu.component diff --git a/dbaccess/qa/complex/dbaccess/ApplicationController.java b/dbaccess/qa/complex/dbaccess/ApplicationController.java index e635108b9..9d7544cd2 100644 --- a/dbaccess/qa/complex/dbaccess/ApplicationController.java +++ b/dbaccess/qa/complex/dbaccess/ApplicationController.java @@ -27,35 +27,27 @@ package complex.dbaccess; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; import com.sun.star.frame.FrameSearchFlag; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XModel; import com.sun.star.frame.XStorable; import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdb.XOfficeDatabaseDocument; import com.sun.star.sdb.application.XDatabaseDocumentUI; import com.sun.star.sdbcx.XTablesSupplier; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; import connectivity.tools.HsqlColumnDescriptor; import connectivity.tools.HsqlDatabase; import connectivity.tools.HsqlTableDescriptor; -import helper.URLHelper; -import java.io.File; import java.io.IOException; // ---------- junit imports ----------------- 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.*; // ------------------------------------------ @@ -74,16 +66,6 @@ public class ApplicationController extends TestCase } // -------------------------------------------------------------------------------------------------------- - -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "checkSaveAs" -// }; -// } - - // -------------------------------------------------------------------------------------------------------- public String getTestObjectName() { return getClass().getName(); @@ -129,21 +111,26 @@ public class ApplicationController extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Before public void before() throws java.lang.Exception + @Before + @Override + public void before() throws java.lang.Exception { super.before(); impl_switchToDocument(null); } // -------------------------------------------------------------------------------------------------------- - @After public void after() throws java.lang.Exception + @After + @Override + public void after() throws java.lang.Exception { impl_closeDocument(); super.after(); } // -------------------------------------------------------------------------------------------------------- - @Test public void checkSaveAs() throws Exception, IOException, java.lang.Exception + @Test + public void checkSaveAs() throws Exception, IOException, java.lang.Exception { // issue 93737 describes the problem that when you save-as a database document, and do changes to it, // then those changes are saved in the old document, actually diff --git a/dbaccess/qa/complex/dbaccess/Beamer.java b/dbaccess/qa/complex/dbaccess/Beamer.java index 92b0fc7b6..2fb885de0 100644 --- a/dbaccess/qa/complex/dbaccess/Beamer.java +++ b/dbaccess/qa/complex/dbaccess/Beamer.java @@ -70,51 +70,10 @@ public class Beamer extends TestCase super(); } -// // -------------------------------------------------------------------------------------------------------- -// protected final XComponentContext getComponentContext() -// { -// XComponentContext context = null; -// try -// { -// final XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, getORB()); -// context = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, -// orbProps.getPropertyValue("DefaultContext")); -// } -// catch (Exception ex) -// { -// failed("could not retrieve the ComponentContext"); -// } -// return context; -// } // -------------------------------------------------------------------------------------------------------- - -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testBeamer" -// }; -// } - -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return getClass().getName(); -// } - - // -------------------------------------------------------------------------------------------------------- -// protected final XMultiServiceFactory getORB() -// { -// return (XMultiServiceFactory) param.getMSF(); -// } - - // -------------------------------------------------------------------------------------------------------- - private void impl_closeDocument() - { - } - - // -------------------------------------------------------------------------------------------------------- - @Before public void before() throws Exception, java.lang.Exception + @Before + @Override + public void before() throws Exception, java.lang.Exception { // load it into a frame final Object object = getMSF().createInstance("com.sun.star.frame.Desktop"); @@ -125,18 +84,20 @@ public class Beamer extends TestCase } // -------------------------------------------------------------------------------------------------------- - @After public void after() + @After + @Override + public void after() { } - // -------------------------------------------------------------------------------------------------------- - @Test public void testBeamer() throws Exception, IOException, java.lang.Exception + // -------------------------------------------------------------------------------------------------------- + @Test + public void testBeamer() throws Exception, IOException, java.lang.Exception { final XController controller = docModel.getCurrentController(); final XFrame frame = controller.getFrame(); final XDispatchProvider dispatchP = UnoRuntime.queryInterface(XDispatchProvider.class, frame); URL command = new URL(); - // command.Complete = ".component:DB/DataSourceBrowser"; command.Complete = ".uno:ViewDataSourceBrowser"; Object instance = getMSF().createInstance("com.sun.star.util.URLTransformer"); diff --git a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java index d4de0eb0e..e803d143f 100644 --- a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java +++ b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java @@ -33,11 +33,7 @@ import java.util.logging.Logger; // ---------- junit imports ----------------- 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.*; // ------------------------------------------ @@ -60,13 +56,17 @@ public abstract class CRMBasedTestCase extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Before public void before() + @Before + @Override + public void before() { createTestCase(); } // -------------------------------------------------------------------------------------------------------- - @After public void after() + @After + @Override + public void after() { try { diff --git a/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java b/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java index 5967086df..25c044ac5 100755 --- a/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java +++ b/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java @@ -30,6 +30,8 @@ import com.sun.star.lib.uno.helper.WeakBase; import com.sun.star.task.XInteractionHandler; import com.sun.star.task.XInteractionRequest; +import static org.junit.Assert.*; + /** * * @author oj93728 @@ -37,14 +39,12 @@ import com.sun.star.task.XInteractionRequest; class CopyTableInterActionHandler extends WeakBase implements XInteractionHandler { - private final CopyTableWizard test; - public CopyTableInterActionHandler(CopyTableWizard testCase) + CopyTableInterActionHandler() { - test = testCase; } public void handle(XInteractionRequest xRequest) { - test.assure(xRequest.toString()); + fail( "interaction handler is not expected to be called" ); } } diff --git a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java index 535796001..85e6a8139 100755 --- a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java +++ b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java @@ -48,11 +48,8 @@ import util.UITools; // ---------- junit imports ----------------- 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.*; // ------------------------------------------ @@ -70,30 +67,18 @@ public class CopyTableWizard extends CRMBasedTestCase } // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "copyTable", "copyTableDbase" -// }; -// } - // -------------------------------------------------------------------------------------------------------- -// @Override -// public String getTestObjectName() -// { -// return getClass().getName(); -// } -// -------------------------------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------------------------------- - - @After public void after() + @After + @Override + public void after() { dest.store(); super.after(); } - @Before public void before() + @Before + @Override + public void before() { try { @@ -106,16 +91,14 @@ public class CopyTableWizard extends CRMBasedTestCase fail(""); } } - // -------------------------------------------------------------------------------------------------------- - - + // -------------------------------------------------------------------------------------------------------- class CopyThread implements Runnable { final XCopyTableWizard copyWizard; - public CopyThread(final XCopyTableWizard copyWizard) + CopyThread(final XCopyTableWizard copyWizard) { this.copyWizard = copyWizard; } @@ -138,17 +121,19 @@ public class CopyTableWizard extends CRMBasedTestCase return null; } - XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(XExtendedToolkit.class, toolKit); + XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, toolKit ); Object atw = tk.getActiveTopWindow(); - return (XWindow) UnoRuntime.queryInterface(XWindow.class, atw); + return UnoRuntime.queryInterface( XWindow.class, atw ); } - @Test public void copyTable() throws Exception, IOException, java.lang.Exception + @Test + public void copyTable() throws Exception, IOException, java.lang.Exception { copyTable(source,source); } - @Test public void copyTableDbase() throws Exception, IOException, java.lang.Exception + @Test + public void copyTableDbase() throws Exception, IOException, java.lang.Exception { copyTable(source,dest); } @@ -167,15 +152,10 @@ public class CopyTableWizard extends CRMBasedTestCase } } - public void assure(final String message) - { - fail(message); - } - private void copyTable(final String tableName, final XConnection sourceConnection, final XConnection destConnection) throws Exception, IOException, java.lang.Exception { - final XInteractionHandler interAction = new CopyTableInterActionHandler(this); + final XInteractionHandler interAction = new CopyTableInterActionHandler(); final XComponentContext context = getComponentContext(); final XPropertySet sourceDescriptor = DataAccessDescriptorFactory.get(context).createDataAccessDescriptor(); sourceDescriptor.setPropertyValue("CommandType", CommandType.TABLE); @@ -185,7 +165,8 @@ public class CopyTableWizard extends CRMBasedTestCase final XPropertySet destDescriptor = DataAccessDescriptorFactory.get(context).createDataAccessDescriptor(); destDescriptor.setPropertyValue("ActiveConnection", destConnection); - final XCopyTableWizard copyWizard = com.sun.star.sdb.application.CopyTableWizard.createWithInteractionHandler(context, sourceDescriptor, destDescriptor, interAction); + final XCopyTableWizard copyWizard = com.sun.star.sdb.application.CopyTableWizard.createWithInteractionHandler( + context, sourceDescriptor, destDescriptor, interAction); copyWizard.setOperation((short) 0); // com.sun.star.sdb.application.CopyDefinitionAndData Optional<String> auto = new Optional<String>(); @@ -219,7 +200,7 @@ public class CopyTableWizard extends CRMBasedTestCase } catch (java.lang.Exception exception) { - exception.printStackTrace(); + exception.printStackTrace( System.err ); } } catch (com.sun.star.lang.IndexOutOfBoundsException indexOutOfBoundsException) diff --git a/dbaccess/qa/complex/dbaccess/DataSource.java b/dbaccess/qa/complex/dbaccess/DataSource.java index 0a6395da6..19f89d646 100644 --- a/dbaccess/qa/complex/dbaccess/DataSource.java +++ b/dbaccess/qa/complex/dbaccess/DataSource.java @@ -27,23 +27,14 @@ package complex.dbaccess; import com.sun.star.container.XNameAccess; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XNamingService; -// import complexlib.ComplexTestCase; import connectivity.tools.CRMDatabase; import connectivity.tools.HsqlDatabase; -//import java.util.logging.Level; -//import java.util.logging.Logger; // ---------- junit imports ----------------- -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.*; // ------------------------------------------ @@ -55,21 +46,6 @@ public class DataSource extends TestCase connectivity.tools.DataSource m_dataSource; // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testRegistrationName" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "DataSource"; -// } - - // -------------------------------------------------------------------------------------------------------- private void createTestCase() { try @@ -92,13 +68,8 @@ public class DataSource extends TestCase } // -------------------------------------------------------------------------------------------------------- -// private XMultiServiceFactory getFactory() -// { -// return (XMultiServiceFactory) param.getMSF(); -// } - - // -------------------------------------------------------------------------------------------------------- - @Test public void testRegistrationName() + @Test + public void testRegistrationName() { try { @@ -109,8 +80,8 @@ public class DataSource extends TestCase assertEquals("pre-registered database has a wrong name!", dataSourceName, bibliography.getName()); // 2. register a newly created data source, and verify it has the proper name dataSourceName = "someDataSource"; - final XNamingService dataSourceRegistrations = (XNamingService) UnoRuntime.queryInterface( - XNamingService.class, getMSF().createInstance("com.sun.star.sdb.DatabaseContext")); + final XNamingService dataSourceRegistrations = UnoRuntime.queryInterface( + XNamingService.class, getMSF().createInstance( "com.sun.star.sdb.DatabaseContext" ) ); final XNameAccess existenceCheck = UnoRuntime.queryInterface( XNameAccess.class, dataSourceRegistrations ); if ( existenceCheck.hasByName( "someDataSource" ) ) dataSourceRegistrations.revokeObject( "someDataSource" ); diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java index c2757a4d9..44a59dc6a 100644 --- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java +++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java @@ -26,6 +26,8 @@ ************************************************************************/ package complex.dbaccess; +import com.sun.star.lang.NotInitializedException; +import com.sun.star.frame.DoubleInitializationException; import com.sun.star.awt.XTopWindow; import com.sun.star.beans.PropertyState; import com.sun.star.document.DocumentEvent; @@ -83,11 +85,8 @@ import java.util.logging.Logger; // ---------- junit imports ----------------- 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.*; // ------------------------------------------ @@ -253,25 +252,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. // ======================================================================================================== // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testLoadable", -// "testDocumentRevenants", -// "testDocumentEvents", -// "testGlobalEvents" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "DatabaseDocument"; -// } - - // -------------------------------------------------------------------------------------------------------- - @Before public void before() throws java.lang.Exception + @Before + public void before() throws java.lang.Exception { super.before(); @@ -297,7 +279,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } // -------------------------------------------------------------------------------------------------------- - @After public void after() throws java.lang.Exception + @After + public void after() throws java.lang.Exception { try { @@ -326,7 +309,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. public Class unoInterfaceClass = null; public String methodName = null; - public UnoMethodDescriptor(Class _class, String _method) + UnoMethodDescriptor(Class _class, String _method) { unoInterfaceClass = _class; methodName = _method; @@ -351,8 +334,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. for (int i = 0; i < unsupportedMethods.length; ++i) { -// assureException( _document, unsupportedMethods[i].unoInterfaceClass, -// unsupportedMethods[i].methodName, new Object[]{}, _isInitialized ? null : NotInitializedException.class ); + assureException( _document, unsupportedMethods[i].unoInterfaceClass, + unsupportedMethods[i].methodName, new Object[]{}, _isInitialized ? null : NotInitializedException.class ); } } @@ -410,7 +393,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } // -------------------------------------------------------------------------------------------------------- - @Test public void testLoadable() throws Exception, IOException + @Test + public void testLoadable() throws Exception, IOException { XModel databaseDoc = impl_createEmptyEmbeddedHSQLDocument(); String documentURL = databaseDoc.getURL(); @@ -438,10 +422,10 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_checkDocumentInitState(databaseDoc, true); // and while we are here ... initilizing the same document again should not be possible -// assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], -// DoubleInitializationException.class ); -// assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, -// DoubleInitializationException.class ); + assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], + DoubleInitializationException.class ); + assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, + DoubleInitializationException.class ); // .................................................................... // 3. XLoadable::initNew @@ -453,10 +437,10 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_checkDocumentInitState(databaseDoc, true); // same as above - initializing the document a second time must fail -// assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], -// DoubleInitializationException.class ); -// assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, -// DoubleInitializationException.class ); + assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], + DoubleInitializationException.class ); + assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, + DoubleInitializationException.class ); } // -------------------------------------------------------------------------------------------------------- @@ -571,7 +555,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. * This method here tests some of those aspects of a document which should survive the death of one * instance and re-creation as a revenant. */ - @Test public void testDocumentRevenants() throws Exception, IOException + @Test + public void testDocumentRevenants() throws Exception, IOException { // create an empty document XModel databaseDoc = impl_createDocWithMacro( "Lib", "Module", @@ -623,7 +608,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } // -------------------------------------------------------------------------------------------------------- - @Test public void testDocumentEvents() throws Exception, IOException + @Test + public void testDocumentEvents() throws Exception, IOException { // create an empty document final String libName = "EventHandlers"; @@ -691,7 +677,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } // -------------------------------------------------------------------------------------------------------- - @Test public void testGlobalEvents() throws Exception, IOException + @Test + public void testGlobalEvents() throws Exception, IOException { XModel databaseDoc = impl_createEmptyEmbeddedHSQLDocument(); final XStorable storeDoc = UnoRuntime.queryInterface(XStorable.class, databaseDoc); diff --git a/dbaccess/qa/complex/dbaccess/Parser.java b/dbaccess/qa/complex/dbaccess/Parser.java index 2f7ede904..89662f5e9 100644 --- a/dbaccess/qa/complex/dbaccess/Parser.java +++ b/dbaccess/qa/complex/dbaccess/Parser.java @@ -37,34 +37,14 @@ import com.sun.star.uno.UnoRuntime; // ---------- junit imports ----------------- -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 Parser extends CRMBasedTestCase { // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] { -// "checkJoinSyntax", -// "checkParameterTypes", -// "checkWhere", -// }; -// } - - // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "Parser"; -// } - - // -------------------------------------------------------------------------------------------------------- + @Override protected void createTestCase() { try @@ -79,7 +59,9 @@ public class Parser extends CRMBasedTestCase } } - @Test public void checkWhere() throws Exception + // -------------------------------------------------------------------------------------------------------- + @Test + public void checkWhere() throws Exception { final XSingleSelectQueryComposer composer = createQueryComposer(); final String SELECT = "SELECT \"products\".\"Name\" FROM \"products\" WHERE "; @@ -118,7 +100,8 @@ public class Parser extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** verifies that aliases for inner queries work as expected */ - @Test public void checkJoinSyntax() throws Exception + @Test + public void checkJoinSyntax() throws Exception { final XSingleSelectQueryComposer composer = createQueryComposer(); @@ -186,7 +169,8 @@ public class Parser extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** verifies that the parser properly recognizes the types of parameters */ - @Test public void checkParameterTypes() throws Exception + @Test + public void checkParameterTypes() throws Exception { impl_checkParameters( "SELECT * FROM \"all orders\" " + diff --git a/dbaccess/qa/complex/dbaccess/PropertyBag.java b/dbaccess/qa/complex/dbaccess/PropertyBag.java index 6f3a93014..ffcbb3490 100644 --- a/dbaccess/qa/complex/dbaccess/PropertyBag.java +++ b/dbaccess/qa/complex/dbaccess/PropertyBag.java @@ -29,18 +29,20 @@ package complex.dbaccess; // import complexlib.ComplexTestCase; +import com.sun.star.beans.NamedValue; +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.PropertyAttribute; +import com.sun.star.beans.XPropertyAccess; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertyContainer; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.beans.*; // ---------- junit imports ----------------- -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.*; // ------------------------------------------ @@ -52,27 +54,20 @@ public class PropertyBag extends TestCase private XPropertyAccess m_access; private XMultiServiceFactory m_orb = null; -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "checkBasics", -// "checkSequenceAccess", -// "checkDynamicSet" -// }; -// } - public String getTestObjectName() { return "PropertyBag"; } - @Before public void before() + @Before + @Override + public void before() { m_orb = getMSF(); } - @Test public void checkBasics() + @Test + public void checkBasics() { createEmptyBag(); System.out.println("testing the basics"); @@ -161,7 +156,8 @@ public class PropertyBag extends TestCase } } - @Test public void checkSequenceAccess() throws com.sun.star.uno.Exception + @Test + public void checkSequenceAccess() throws com.sun.star.uno.Exception { System.out.println( "checking PropertySetAccess via sequences" ); createStandardBag( false ); @@ -218,7 +214,8 @@ public class PropertyBag extends TestCase } } - @Test public void checkDynamicSet() throws com.sun.star.uno.Exception + @Test + public void checkDynamicSet() throws com.sun.star.uno.Exception { System.out.println( "checking proper dynamic of the set" ); createStandardBag( false ); diff --git a/dbaccess/qa/complex/dbaccess/Query.java b/dbaccess/qa/complex/dbaccess/Query.java index 1ae4a8cc9..c7f4674ee 100644 --- a/dbaccess/qa/complex/dbaccess/Query.java +++ b/dbaccess/qa/complex/dbaccess/Query.java @@ -30,19 +30,13 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNamed; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdb.XQueriesSupplier; import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.uno.UnoRuntime; import connectivity.tools.CRMDatabase; // ---------- junit imports ----------------- -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.*; // ------------------------------------------ @@ -51,19 +45,6 @@ public class Query extends TestCase { connectivity.tools.HsqlDatabase m_database; // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() { -// return new String[] -// { -// "testQueryColumns" -// }; -// } - - // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() { -// return "Query"; -// } - - // -------------------------------------------------------------------------------------------------------- private void createTestCase() { try @@ -89,7 +70,8 @@ public class Query extends TestCase { // } // -------------------------------------------------------------------------------------------------------- - @Test public void testQueryColumns() + @Test + public void testQueryColumns() { createTestCase(); diff --git a/dbaccess/qa/complex/dbaccess/QueryInQuery.java b/dbaccess/qa/complex/dbaccess/QueryInQuery.java index 95ff9a9fd..3a06313c4 100644 --- a/dbaccess/qa/complex/dbaccess/QueryInQuery.java +++ b/dbaccess/qa/complex/dbaccess/QueryInQuery.java @@ -38,37 +38,16 @@ import com.sun.star.sdbc.XStatement; import com.sun.star.sdbc.XResultSet; // ---------- junit imports ----------------- -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 QueryInQuery extends CRMBasedTestCase { private static final String QUERY_PRODUCTS = "query products"; -// // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] { -// "executeSimpleSelect", -// "executeAliasedSelect", -// "checkNameCollisions", -// "checkCyclicReferences", -// "checkStatementQiQSupport" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "QueryInQuery"; -// } // -------------------------------------------------------------------------------------------------------- + @Override protected void createTestCase() { try @@ -113,7 +92,8 @@ public class QueryInQuery extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** executes a SQL statement simply selecting all columns from a query */ - @Test public void executeSimpleSelect() throws SQLException + @Test + public void executeSimpleSelect() throws SQLException { verifyEqualRowSetContent( CommandType.COMMAND, "SELECT * FROM \"query products\"", @@ -123,7 +103,8 @@ public class QueryInQuery extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** verifies that aliases for inner queries work as expected */ - @Test public void executeAliasedSelect() throws SQLException + @Test + public void executeAliasedSelect() throws SQLException { verifyEqualRowSetContent( CommandType.COMMAND, "SELECT \"PROD\".\"ID\" FROM \"query products\" AS \"PROD\"", @@ -136,7 +117,8 @@ public class QueryInQuery extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** verifies that aliases for inner queries work as expected */ - @Test public void checkNameCollisions() + @Test + public void checkNameCollisions() { // create a query with a name which is used by a table boolean caughtExpected = false; @@ -168,7 +150,8 @@ public class QueryInQuery extends CRMBasedTestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void checkCyclicReferences() throws ElementExistException, WrappedTargetException, IllegalArgumentException + @Test + public void checkCyclicReferences() throws ElementExistException, WrappedTargetException, IllegalArgumentException { // some queries which create a cycle in the sub query tree m_database.getDatabase().getDataSource().createQuery( "orders level 1", "SELECT * FROM \"orders level 0\"" ); @@ -186,7 +169,8 @@ public class QueryInQuery extends CRMBasedTestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void checkStatementQiQSupport() + @Test + public void checkStatementQiQSupport() { try { diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java index 80fbde596..a85fb01ac 100644 --- a/dbaccess/qa/complex/dbaccess/RowSet.java +++ b/dbaccess/qa/complex/dbaccess/RowSet.java @@ -32,7 +32,6 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdb.CommandType; import com.sun.star.sdb.XParametersSupplier; import com.sun.star.sdb.XResultSetAccess; @@ -58,12 +57,7 @@ import java.lang.reflect.Method; import java.util.Random; // ---------- junit imports ----------------- -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.*; // ------------------------------------------ @@ -92,7 +86,7 @@ public class RowSet extends TestCase XRow m_row; int m_id; - public ResultSetMovementStress(XResultSet _resultSet, int _id) throws java.lang.Exception + ResultSetMovementStress(XResultSet _resultSet, int _id) throws java.lang.Exception { m_resultSet = _resultSet; m_row = UnoRuntime.queryInterface( XRow.class, m_resultSet ); @@ -123,27 +117,6 @@ public class RowSet extends TestCase } } // -------------------------------------------------------------------------------------------------------- - -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testRowSet", -// "testRowSetEvents", -// "testDeleteBehavior", -// "testCloneMovesPlusDeletions", -// "testCloneMovesPlusInsertions", -// "testParameters" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "RowSet"; -// } -// - // -------------------------------------------------------------------------------------------------------- private void createTestCase(boolean _defaultRowSet) { if (m_database == null) @@ -176,12 +149,6 @@ public class RowSet extends TestCase } // -------------------------------------------------------------------------------------------------------- -// private XMultiServiceFactory getFactory() -// { -// return (XMultiServiceFactory) param.getMSF(); -// } - - // -------------------------------------------------------------------------------------------------------- /** creates a com.sun.star.sdb.RowSet to use during the test * @param command * the command to use for the RowSet @@ -239,7 +206,8 @@ public class RowSet extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void testRowSet() throws java.lang.Exception + @Test + public void testRowSet() throws java.lang.Exception { System.out.println("testing testRowSet"); @@ -415,7 +383,8 @@ public class RowSet extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void testRowSetEvents() throws java.lang.Exception + @Test + public void testRowSetEvents() throws java.lang.Exception { System.out.println("testing RowSet Events"); createTestCase(true); @@ -632,7 +601,8 @@ public class RowSet extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void testDeleteBehavior() throws Exception + @Test + public void testDeleteBehavior() throws Exception { createTestCase(true); @@ -765,8 +735,8 @@ public class RowSet extends TestCase /** checks whether deletions on the main RowSet properly interfere (or don't interfere) with the movement * on a clone of the RowSet */ - @SuppressWarnings("empty-statement") - @Test public void testCloneMovesPlusDeletions() throws SQLException, UnknownPropertyException, WrappedTargetException + @Test + public void testCloneMovesPlusDeletions() throws SQLException, UnknownPropertyException, WrappedTargetException { createTestCase(true); // ensure that all records are known @@ -834,7 +804,8 @@ public class RowSet extends TestCase /** checks whether insertions on the main RowSet properly interfere (or don't interfere) with the movement * on a clone of the RowSet */ - @Test public void testCloneMovesPlusInsertions() throws SQLException, UnknownPropertyException, WrappedTargetException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException + @Test + public void testCloneMovesPlusInsertions() throws SQLException, UnknownPropertyException, WrappedTargetException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException { createTestCase(true); // ensure that all records are known @@ -1019,7 +990,8 @@ public class RowSet extends TestCase // -------------------------------------------------------------------------------------------------------- /** checks the XParametersSupplier functionality of a RowSet */ - @Test public void testParameters() + @Test + public void testParameters() { createTestCase(false); // use an own RowSet instance, not the one which is also used for the other cases diff --git a/dbaccess/qa/complex/dbaccess/RowSetEventListener.java b/dbaccess/qa/complex/dbaccess/RowSetEventListener.java index b0901d979..1359653fc 100644 --- a/dbaccess/qa/complex/dbaccess/RowSetEventListener.java +++ b/dbaccess/qa/complex/dbaccess/RowSetEventListener.java @@ -33,7 +33,7 @@ import com.sun.star.sdb.RowChangeEvent; import com.sun.star.lang.EventObject; import com.sun.star.beans.XPropertyChangeListener; -public class RowSetEventListener implements XRowSetApproveListener,XRowSetListener,XPropertyChangeListener +public final class RowSetEventListener implements XRowSetApproveListener,XRowSetListener,XPropertyChangeListener { public static final int APPROVE_CURSOR_MOVE = 0; public static final int APPROVE_ROW_CHANGE = 1; diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java index f9e02861e..09a597576 100755 --- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java +++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java @@ -26,23 +26,28 @@ ************************************************************************/ package complex.dbaccess; +import com.sun.star.beans.PropertyState; +import com.sun.star.sdb.SQLFilterOperator; +import com.sun.star.beans.PropertyAttribute; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertyContainer; +import com.sun.star.beans.NamedValue; +import com.sun.star.container.XNameAccess; +import com.sun.star.sdbcx.XTablesSupplier; +import com.sun.star.sdb.XParametersSupplier; +import com.sun.star.beans.PropertyValue; +import com.sun.star.sdbcx.XColumnsSupplier; +import com.sun.star.container.XIndexAccess; +import com.sun.star.sdb.CommandType; +import com.sun.star.sdb.XSingleSelectQueryComposer; import com.sun.star.uno.UnoRuntime; -import com.sun.star.beans.*; -import com.sun.star.sdbcx.*; -import com.sun.star.sdb.*; -import com.sun.star.container.*; import com.sun.star.sdbc.DataType; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; // ---------- junit imports ----------------- -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.*; // ------------------------------------------ @@ -58,32 +63,13 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase private final static String INNERPRODUCTSQUERY = "products (inner)"; // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testSetCommand", -// "testAttributes", -// "testSubQueries", -// "testParameters", -// "testDisjunctiveNormalForm", -// "testConditionByColumn" -// }; -// } - -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "SingleSelectQueryComposer"; -// } - - // -------------------------------------------------------------------------------------------------------- private void createQueries() throws Exception { m_database.getDatabase().getDataSource().createQuery(INNERPRODUCTSQUERY, "SELECT * FROM \"products\""); } // -------------------------------------------------------------------------------------------------------- + @Override protected void createTestCase() { try @@ -141,7 +127,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase /** tests setCommand of the composer */ - @Test public void testSetCommand() + @Test + public void testSetCommand() { System.out.println("testing SingleSelectQueryComposer's setCommand"); @@ -166,7 +153,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase } /** tests accessing attributes of the composer (order, filter, group by, having) */ - @Test public void testAttributes() + @Test + public void testAttributes() { System.out.println("testing SingleSelectQueryComposer's attributes (order, filter, group by, having)"); @@ -223,7 +211,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase /** test various sub query related features ("queries in queries") */ - @Test public void testSubQueries() throws Exception + @Test + public void testSubQueries() throws Exception { m_composer.setQuery("SELECT * from \"" + INNERPRODUCTSQUERY + "\""); final XTablesSupplier suppTables = UnoRuntime.queryInterface(XTablesSupplier.class, m_composer); @@ -239,7 +228,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase /** tests the XParametersSupplier functionality */ - @Test public void testParameters() + @Test + public void testParameters() { try { @@ -278,7 +268,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase } } - @Test public void testConditionByColumn() + @Test + public void testConditionByColumn() { try { @@ -337,7 +328,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase /** tests the disjunctive normal form functionality, aka the structured filter, * of the composer */ - @Test public void testDisjunctiveNormalForm() + @Test + public void testDisjunctiveNormalForm() { // a simple case: WHERE clause simply is a combination of predicates knitted with AND String query = diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java index ac6cef43d..d60bc272e 100644 --- a/dbaccess/qa/complex/dbaccess/TestCase.java +++ b/dbaccess/qa/complex/dbaccess/TestCase.java @@ -26,6 +26,8 @@ ************************************************************************/ package complex.dbaccess; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.frame.XComponentLoader; @@ -41,11 +43,8 @@ import java.net.URI; import java.net.URISyntaxException; // ---------- junit imports ----------------- -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.*; // ------------------------------------------ @@ -54,12 +53,6 @@ import static org.junit.Assert.*; public abstract class TestCase { // -------------------------------------------------------------------------------------------------------- -// protected final XMultiServiceFactory getORB() -// { -// return (XMultiServiceFactory)param.getMSF(); -// } - - // -------------------------------------------------------------------------------------------------------- protected final XComponentContext getComponentContext() { XComponentContext context = null; @@ -130,31 +123,129 @@ public abstract class TestCase } // -------------------------------------------------------------------------------------------------------- -// protected void assureException( Object _object, Class _unoInterfaceClass, String _methodName, Object[] _methodArgs, -// Class _expectedExceptionClass ) -// { -// assureException( UnoRuntime.queryInterface( _unoInterfaceClass, _object ), _methodName, -// _methodArgs, _expectedExceptionClass ); -// } + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _message + * is the message to print when the check fails + * @param _object + * is the object to invoke the method on + * @param _methodName + * is the name of the method to invoke + * @param _methodArgs + * are the arguments to pass to the method. + * @param _argClasses + * are the classes to assume for the arguments of the methods + * @param _expectedExceptionClass + * is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + protected void assureException( final String _message, final Object _object, final String _methodName, + final Class[] _argClasses, final Object[] _methodArgs, final Class _expectedExceptionClass ) + { + Class objectClass = _object.getClass(); + boolean noExceptionAllowed = ( _expectedExceptionClass == null ); + boolean caughtExpected = noExceptionAllowed ? true : false; + try + { + Method method = objectClass.getMethod( _methodName, _argClasses ); + method.invoke(_object, _methodArgs ); + } + catch ( InvocationTargetException e ) + { + caughtExpected = noExceptionAllowed + ? false + : ( e.getTargetException().getClass().equals( _expectedExceptionClass ) ); + } + catch( Exception e ) + { + caughtExpected = false; + } + + assertTrue( _message, caughtExpected ); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _message is the message to print when the check fails + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method. Those implicitly define + * the classes of the arguments of the method which is called. + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + protected void assureException( final String _message, final Object _object, final String _methodName, + final Object[] _methodArgs, final Class _expectedExceptionClass ) + { + Class[] argClasses = new Class[ _methodArgs.length ]; + for ( int i=0; i<_methodArgs.length; ++i ) + argClasses[i] = _methodArgs[i].getClass(); + assureException( _message, _object, _methodName, argClasses, _methodArgs, _expectedExceptionClass ); + } + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method. Those implicitly define + * the classes of the arguments of the method which is called. + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + protected void assureException( final Object _object, final String _methodName, final Object[] _methodArgs, + final Class _expectedExceptionClass ) + { + assureException( + "did not catch the expected exception (" + + ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + + ") while calling " + _object.getClass().getName() + "." + _methodName, + _object, _methodName, _methodArgs, _expectedExceptionClass ); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method + * @param _argClasses are the classes to assume for the arguments of the methods + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + protected void assureException( final Object _object, final String _methodName, final Class[] _argClasses, + final Object[] _methodArgs, final Class _expectedExceptionClass ) + { + assureException( + "did not catch the expected exception (" + + ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + + ") while calling " + _object.getClass().getName() + "." + _methodName, + _object, _methodName, _argClasses, _methodArgs, _expectedExceptionClass ); + } + + // -------------------------------------------------------------------------------------------------------- + protected void assureException( Object _object, Class _unoInterfaceClass, String _methodName, Object[] _methodArgs, + Class _expectedExceptionClass ) + { + assureException( UnoRuntime.queryInterface( _unoInterfaceClass, _object ), _methodName, + _methodArgs, _expectedExceptionClass ); + } + + // -------------------------------------------------------------------------------------------------------- protected 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()"); + @BeforeClass + public static void setUpConnection() throws Exception + { connection.setUp(); } - @AfterClass public static void tearDownConnection() - throws InterruptedException, com.sun.star.uno.Exception + // -------------------------------------------------------------------------------------------------------- + @AfterClass + public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception { - System.out.println("tearDownConnection()"); connection.tearDown(); } diff --git a/dbaccess/qa/complex/dbaccess/UISettings.java b/dbaccess/qa/complex/dbaccess/UISettings.java index 19a6dab05..ee0f8b541 100644 --- a/dbaccess/qa/complex/dbaccess/UISettings.java +++ b/dbaccess/qa/complex/dbaccess/UISettings.java @@ -45,24 +45,10 @@ import static org.junit.Assert.*; public class UISettings extends TestCase { // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] { -// "checkTableFormattingPersistence", -// "checkTransparentQueryColumnSettings" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "UISettings"; -// } - - // -------------------------------------------------------------------------------------------------------- /** verifies that aliases for inner queries work as expected */ - @Test public void checkTableFormattingPersistence() throws java.lang.Exception + @Test + public void checkTableFormattingPersistence() throws java.lang.Exception { // create, load, and connect a DB doc CRMDatabase database = new CRMDatabase( getMSF(), true ); @@ -114,7 +100,8 @@ public class UISettings extends TestCase * settings * @throws java.lang.Exception */ - @Test public void checkTransparentQueryColumnSettings() throws java.lang.Exception + @Test + public void checkTransparentQueryColumnSettings() throws java.lang.Exception { // create, load, and connect a DB doc CRMDatabase database = new CRMDatabase( getMSF(), true ); diff --git a/dbaccess/qa/complex/dbaccess/dbaccess.sce b/dbaccess/qa/complex/dbaccess/dbaccess.sce deleted file mode 100644 index c5fa408ff..000000000 --- a/dbaccess/qa/complex/dbaccess/dbaccess.sce +++ /dev/null @@ -1,12 +0,0 @@ --o complex.dbaccess.SingleSelectQueryComposer --o complex.dbaccess.RowSet --o complex.dbaccess.PropertyBag --o complex.dbaccess.Query --o complex.dbaccess.QueryInQuery --o complex.dbaccess.DatabaseDocument --o complex.dbaccess.DataSource --o complex.dbaccess.Parser --o complex.dbaccess.ApplicationController --o complex.dbaccess.CopyTableWizard --o complex.dbaccess.UISettings --o complex.dbaccess.Beamer diff --git a/dbaccess/qa/complex/dbaccess/makefile.mk b/dbaccess/qa/complex/dbaccess/makefile.mk index 481dbe519..760f94a29 100755 --- a/dbaccess/qa/complex/dbaccess/makefile.mk +++ b/dbaccess/qa/complex/dbaccess/makefile.mk @@ -25,22 +25,36 @@ # #************************************************************************* -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +.IF "$(OOO_JUNIT_JAR)" == "" nothing .PHONY: + @echo ----------------------------------------------------- + @echo - JUnit not available, not building anything + @echo ----------------------------------------------------- .ELSE PRJ = ../../.. PRJNAME = dbaccess TARGET = qa_complex_dbaccess - -.IF "$(OOO_JUNIT_JAR)" != "" PACKAGE = complex/dbaccess +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk + +#----- compile .java files ----------------------------------------- + +JARFILES = OOoRunner.jar ridl.jar test.jar juh.jar unoil.jar ConnectivityTools.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) + +#----- create a jar from compiled files ---------------------------- + +JARTARGET = $(TARGET).jar + +#----- Java files -------------------------------------------------- + # here store only Files which contain a @Test JAVATESTFILES = \ ApplicationController.java \ Beamer.java \ - CopyTableWizard.java \ DataSource.java \ DatabaseDocument.java \ Parser.java \ @@ -50,6 +64,7 @@ JAVATESTFILES = \ RowSet.java \ SingleSelectQueryComposer.java \ UISettings.java \ + CopyTableWizard.java \ # put here all other files JAVAFILES = $(JAVATESTFILES) \ @@ -61,73 +76,27 @@ JAVAFILES = $(JAVATESTFILES) \ TestCase.java \ -JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar ConnectivityTools.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) - # Sample how to debug # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -.END +# --- Targets ------------------------------------------------------ -.INCLUDE: settings.mk .INCLUDE: target.mk + +ALL : ALLTAR + +# --- subsequent tests --------------------------------------------- + +.IF "$(OOO_SUBSEQUENT_TESTS)" != "" + .INCLUDE: installationtest.mk ALLTAR : javatest -.END + # Sample how to debug + # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y +.END # "$(OOO_SUBSEQUENT_TESTS)" == "" + +.END # ELSE "$(OOO_JUNIT_JAR)" != "" -# -# -# PRJ = ..$/..$/.. -# TARGET = DbaComplexTests -# PRJNAME = $(TARGET) -# PACKAGE = complex$/dbaccess -# -# # --- Settings ----------------------------------------------------- -# .INCLUDE: settings.mk -# -# .IF "$(SOLAR_JAVA)" == "" -# all: -# @echo "Java not available. Build skipped" -# -# .INCLUDE : target.mk -# .ELSE -# -# #----- compile .java files ----------------------------------------- -# -# JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar ConnectivityTools.jar -# JAVAFILES := $(shell @$(FIND) ./*.java) -# JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -# -# #----- make a jar from compiled files ------------------------------ -# -# MAXLINELENGTH = 100000 -# -# JARCLASSDIRS = $(PACKAGE) -# JARTARGET = $(TARGET).jar -# JARCOMPRESS = TRUE -# -# RUNNER_ARGS = -cp "$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar" org.openoffice.Runner -TestBase java_complex -# -# RUNNER_CALL = $(AUGMENT_LIBRARY_PATH) java -# -# # --- Targets ------------------------------------------------------ -# -# .IF "$(depend)" == "" -# ALL : ALLTAR -# .ELSE -# ALL: ALLDEP -# .ENDIF -# -# .INCLUDE : target.mk -# -# -# run: $(CLASSDIR)$/$(JARTARGET) -# +$(RUNNER_CALL) $(RUNNER_ARGS) -sce dbaccess.sce -# -# run_%: $(CLASSDIR)$/$(JARTARGET) -# +$(RUNNER_CALL) $(RUNNER_ARGS) -o complex.dbaccess.$(@:s/run_//) -# -# .ENDIF # "$(SOLAR_JAVA)" == "" diff --git a/dbaccess/source/core/api/BookmarkSet.hxx b/dbaccess/source/core/api/BookmarkSet.hxx index 18df82653..e1b6566ef 100644 --- a/dbaccess/source/core/api/BookmarkSet.hxx +++ b/dbaccess/source/core/api/BookmarkSet.hxx @@ -44,7 +44,7 @@ namespace dbaccess void updateColumn(sal_Int32 nPos,::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate > _xParameter,const connectivity::ORowSetValue& _rValue); public: - OBookmarkSet() + OBookmarkSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows) {} ~OBookmarkSet() { diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx index 7f53434b3..634927a8b 100644 --- a/dbaccess/source/core/api/CacheSet.cxx +++ b/dbaccess/source/core/api/CacheSet.cxx @@ -106,8 +106,9 @@ using namespace ::osl; DBG_NAME(OCacheSet) // ------------------------------------------------------------------------- -OCacheSet::OCacheSet() - :m_bInserted(sal_False) +OCacheSet::OCacheSet(sal_Int32 i_nMaxRows) + :m_nMaxRows(i_nMaxRows) + ,m_bInserted(sal_False) ,m_bUpdated(sal_False) ,m_bDeleted(sal_False) { diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx index 59601137b..729ccf263 100644 --- a/dbaccess/source/core/api/CacheSet.hxx +++ b/dbaccess/source/core/api/CacheSet.hxx @@ -83,11 +83,12 @@ namespace dbaccess ::com::sun::star::uno::Sequence<sal_Int32> m_aColumnTypes; ORowSetRow m_aInsertRow; ::rtl::OUString m_aComposedTableName; + sal_Int32 m_nMaxRows; sal_Bool m_bInserted; sal_Bool m_bUpdated; sal_Bool m_bDeleted; - OCacheSet(); + OCacheSet(sal_Int32 i_nMaxRows); virtual ~OCacheSet(); void setParameter(sal_Int32 nPos diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 29c906b2f..34fa1b2ca 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -153,8 +153,10 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable, const Reference< XIndexAccess>& _xTableKeys, const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name const Reference< XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache) - :m_aParameterValueForCache(_aParameterValueForCache) + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows) + :OCacheSet(i_nMaxRows) + ,m_aParameterValueForCache(_aParameterValueForCache) ,m_pKeyColumnNames(NULL) ,m_pColumnNames(NULL) ,m_pParameterNames(NULL) @@ -191,7 +193,7 @@ OKeySet::~OKeySet() void OKeySet::initColumns() { Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false; + bool bCase = (xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()) ? true : false; m_pKeyColumnNames.reset( new SelectColumnsMetaData(bCase) ); m_pColumnNames.reset( new SelectColumnsMetaData(bCase) ); m_pParameterNames.reset( new SelectColumnsMetaData(bCase) ); @@ -984,8 +986,8 @@ void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sa SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end(); for(;aPosIter != aPosEnd;++aPosIter,++aIter) { - *aIter = (_rInsertRow->get())[aPosIter->second.nPosition]; - impl_convertValue_throw(_rKeyRow,aPosIter->second); + impl_convertValue_throw(_rInsertRow,aPosIter->second); + *aIter = (_rInsertRow->get())[aPosIter->second.nPosition]; aIter->setTypeKind(aPosIter->second.nType); } } @@ -1382,7 +1384,7 @@ sal_Bool OKeySet::fetchRow() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::fetchRow" ); // fetch the next row and append on the keyset sal_Bool bRet = sal_False; - if ( !m_bRowCountFinal ) + if ( !m_bRowCountFinal && (!m_nMaxRows || sal_Int32(m_aKeyMap.size()) < m_nMaxRows) ) bRet = m_xDriverSet->next(); if ( bRet ) { diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index 072440c69..5a94d1d10 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -159,7 +159,8 @@ namespace dbaccess const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xTableKeys, const ::rtl::OUString& _rUpdateTableName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache); + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows); // late ctor which can throw exceptions virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter); diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index 091ea08af..ecde8d20e 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -102,8 +102,9 @@ DBG_NAME(OptimisticSet) OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext, const Reference< XConnection>& i_xConnection, const Reference< XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache) - :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache) + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows) + :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows) ,m_aSqlParser( _rContext.getLegacyServiceFactory() ) ,m_aSqlIterator( i_xConnection, Reference<XTablesSupplier>(_xComposer,UNO_QUERY)->getTables(), m_aSqlParser, NULL ) ,m_bResultSetChanged(false) @@ -124,7 +125,7 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const :: initColumns(); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false; + bool bCase = (xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers()) ? true : false; Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY); const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns(); const Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY); diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx index fd1b304a7..cf703da5e 100644 --- a/dbaccess/source/core/api/OptimisticSet.hxx +++ b/dbaccess/source/core/api/OptimisticSet.hxx @@ -79,7 +79,8 @@ namespace dbaccess OptimisticSet(const ::comphelper::ComponentContext& _rContext, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& i_xConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer, - const ORowSetValueVector& _aParameterValueForCache); + const ORowSetValueVector& _aParameterValueForCache, + sal_Int32 i_nMaxRows); // late ctor which can throw exceptions virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter); diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 1f7c0294f..84a09390a 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -348,7 +348,7 @@ void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const case PROPERTY_ID_FETCHSIZE: if(m_pCache) { - m_pCache->setMaxRowSize(m_nFetchSize); + m_pCache->setFetchSize(m_nFetchSize); fireRowcount(); } break; @@ -1078,7 +1078,7 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL positionCache( MOVE_NONE_REFRESH_ONLY ); ORowSetRow aOldValues; - if ( !m_aCurrentRow.isNull() ) + if ( !m_bModified && _bNotifyModified && !m_aCurrentRow.isNull() ) aOldValues = new ORowSetValueVector( m_aCurrentRow->getBody() ); m_pCache->cancelRowUpdates(); @@ -1088,11 +1088,13 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL m_aCurrentRow.setBookmark(m_aBookmark); // notification order - // - column values - ORowSetBase::firePropertyChange(aOldValues); // IsModified if( !m_bModified && _bNotifyModified ) + { + // - column values + ORowSetBase::firePropertyChange(aOldValues); fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True); + } } // ------------------------------------------------------------------------- @@ -1661,6 +1663,8 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw() try { xStatementProps->setPropertyValue( PROPERTY_USEBOOKMARKS, makeAny( sal_True ) ); + xStatementProps->setPropertyValue( PROPERTY_MAXROWS, makeAny( m_nMaxRows ) ); + setStatementResultSetType( xStatementProps, m_nResultSetType, m_nResultSetConcurrency ); } catch ( const Exception& ) @@ -1817,13 +1821,13 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn: creating cache" ); - m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter ); + m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter,m_nMaxRows ); if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY ) { m_nPrivileges = Privilege::SELECT; m_pCache->m_nPrivileges = Privilege::SELECT; } - m_pCache->setMaxRowSize(m_nFetchSize); + m_pCache->setFetchSize(m_nFetchSize); m_aCurrentRow = m_pCache->createIterator(this); m_aOldRow = m_pCache->registerOldRow(); } @@ -2241,7 +2245,7 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() try { Reference<XDatabaseMetaData> xMeta = m_xActiveConnection->getMetaData(); - bCase = xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers(); + bCase = xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(); } catch(SQLException&) { @@ -2769,9 +2773,9 @@ void SAL_CALL ORowSet::refreshRow( ) throw(SQLException, RuntimeException) // notification order: if ( m_bModified && m_pCache ) - // - column values implCancelRowUpdates( sal_False ); // do _not_ notify the IsModify - will do this ourself below + // - column values ORowSetBase::refreshRow(); // - IsModified diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index e19dd8371..5afc502c0 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -1198,8 +1198,11 @@ void SAL_CALL ORowSetBase::refreshRow( ) throw(SQLException, RuntimeException) if(!(m_bBeforeFirst || m_bAfterLast)) { + sal_Bool bWasNew = m_pCache->m_bNew || impl_rowDeleted(); + ORowSetRow aOldValues = getOldRow(bWasNew); positionCache( MOVE_NONE_REFRESH_ONLY ); m_pCache->refreshRow(); + firePropertyChange(aOldValues); } } // ------------------------------------------------------------------------- diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index eda4632f7..e27e76d6f 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -91,7 +91,8 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, sal_Bool& _bModified, sal_Bool& _bNew, const ORowSetValueVector& _aParameterValueForCache, - const ::rtl::OUString& i_sRowSetFilter) + const ::rtl::OUString& i_sRowSetFilter, + sal_Int32 i_nMaxRows) :m_xSet(_xRs) ,m_xMetaData(Reference< XResultSetMetaDataSupplier >(_xRs,UNO_QUERY)->getMetaData()) ,m_aContext( _rContext ) @@ -128,7 +129,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, xUp->cancelRowUpdates(); _xRs->beforeFirst(); m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; - m_pCacheSet = new WrappedResultSet(); + m_pCacheSet = new WrappedResultSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); return; @@ -175,7 +176,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, if ( aTableNames.getLength() > 1 && !_rUpdateTableName.getLength() && bNeedKeySet ) {// here we have a join or union and nobody told us which table to update, so we update them all m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; - OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache); + OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows); m_pCacheSet = pCursor; m_xCacheSet = m_pCacheSet; try @@ -237,7 +238,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, { try { - m_pCacheSet = new OBookmarkSet(); + m_pCacheSet = new OBookmarkSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); @@ -271,7 +272,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, // oj removed because keyset uses only the next// || (xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_RESULTSETTYPE) && comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) == ResultSetType::FORWARD_ONLY) if(!bAllKeysFound ) { - m_pCacheSet = new OStaticSet(); + m_pCacheSet = new OStaticSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); m_nPrivileges = Privilege::SELECT; @@ -308,7 +309,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, } } - OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache); + OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows); try { m_pCacheSet = pKeySet; @@ -335,7 +336,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, if ( m_pCacheSet ) m_pCacheSet = NULL; m_xCacheSet = NULL; - m_pCacheSet = new OStaticSet(); + m_pCacheSet = new OStaticSet(i_nMaxRows); m_xCacheSet = m_pCacheSet; m_pCacheSet->construct(_xRs,i_sRowSetFilter); m_nPrivileges = Privilege::SELECT; @@ -373,9 +374,8 @@ ORowSetCache::~ORowSetCache() } // ------------------------------------------------------------------------- -void ORowSetCache::setMaxRowSize(sal_Int32 _nSize) +void ORowSetCache::setFetchSize(sal_Int32 _nSize) { - if(_nSize == m_nFetchSize) return; diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx index d7823a90a..065fb2fad 100644 --- a/dbaccess/source/core/api/RowSetCache.hxx +++ b/dbaccess/source/core/api/RowSetCache.hxx @@ -202,7 +202,8 @@ namespace dbaccess sal_Bool& _bModified, sal_Bool& _bNew, const ORowSetValueVector& _aParameterValueForCache, - const ::rtl::OUString& i_sRowSetFilter); + const ::rtl::OUString& i_sRowSetFilter, + sal_Int32 i_nMaxRows); ~ORowSetCache(); @@ -211,7 +212,7 @@ namespace dbaccess ORowSetCacheIterator createIterator(ORowSetBase* _pRowSet); void deleteIterator(const ORowSetBase* _pRowSet); // sets the size of the matrix - void setMaxRowSize(sal_Int32 _nSize); + void setFetchSize(sal_Int32 _nSize); TORowSetOldRowHelperRef registerOldRow(); void deregisterOldRow(const TORowSetOldRowHelperRef& _rRow); diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index eea07de9d..fbcd332f2 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -1088,7 +1088,7 @@ sal_Bool OSingleSelectQueryComposer::setANDCriteria( OSQLParseNode * pCondition, } else if (SQL_ISRULE(pCondition,test_for_null)) { - if (SQL_ISTOKEN(pCondition->getChild(1)->getChild(2),NOT) ) + if (SQL_ISTOKEN(pCondition->getChild(1)->getChild(1),NOT) ) aItem.Handle = SQLFilterOperator::NOT_SQLNULL; else aItem.Handle = SQLFilterOperator::SQLNULL; diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx index 1965791c2..7fc52cab1 100644 --- a/dbaccess/source/core/api/StaticSet.cxx +++ b/dbaccess/source/core/api/StaticSet.cxx @@ -122,7 +122,7 @@ sal_Bool OStaticSet::fetchRow() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fetchRow" ); sal_Bool bRet = sal_False; - if ( !m_bEnd ) + if ( !m_bEnd && (!m_nMaxRows || sal_Int32(m_aSet.size()) < m_nMaxRows) ) bRet = m_xDriverSet->next(); if ( bRet ) { @@ -141,9 +141,10 @@ void OStaticSet::fillAllRows() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fillAllRows" ); if(!m_bEnd) { + sal_Int32 nColumnCount = m_xSetMetaData->getColumnCount(); while(m_xDriverSet->next()) { - ORowSetRow pRow = new connectivity::ORowVector< connectivity::ORowSetValue >(m_xSetMetaData->getColumnCount()); + ORowSetRow pRow = new connectivity::ORowVector< connectivity::ORowSetValue >(nColumnCount); m_aSet.push_back(pRow); m_aSetIter = m_aSet.end() - 1; (pRow->get())[0] = getRow(); diff --git a/dbaccess/source/core/api/StaticSet.hxx b/dbaccess/source/core/api/StaticSet.hxx index 794623c07..82f122086 100644 --- a/dbaccess/source/core/api/StaticSet.hxx +++ b/dbaccess/source/core/api/StaticSet.hxx @@ -44,8 +44,8 @@ namespace dbaccess sal_Bool fetchRow(); void fillAllRows(); public: - OStaticSet() - : m_aSetIter(m_aSet.end()) + OStaticSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows) + , m_aSetIter(m_aSet.end()) , m_bEnd(sal_False) { m_aSet.push_back(NULL); // this is the beforefirst record diff --git a/dbaccess/source/core/api/WrappedResultSet.hxx b/dbaccess/source/core/api/WrappedResultSet.hxx index e78e45a14..7b9f17c68 100644 --- a/dbaccess/source/core/api/WrappedResultSet.hxx +++ b/dbaccess/source/core/api/WrappedResultSet.hxx @@ -48,7 +48,7 @@ namespace dbaccess void updateColumn(sal_Int32 nPos,::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate > _xParameter,const connectivity::ORowSetValue& _rValue); public: - WrappedResultSet() + WrappedResultSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows) {} ~WrappedResultSet() { diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index 41c8c29fe..f0be9bafe 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -228,7 +228,7 @@ void OQuery::rebuildColumns() ::vos::ORef< OSQLColumns > aParseColumns( ::connectivity::parse::OParseColumn::createColumnsForResultSet( xResultSetMeta, xDBMeta,xColumnDefinitions ) ); xColumns = OPrivateColumns::createWithIntrinsicNames( - aParseColumns, xDBMeta->storesMixedCaseQuotedIdentifiers(), *this, m_aMutex ); + aParseColumns, xDBMeta->supportsMixedCaseQuotedIdentifiers(), *this, m_aMutex ); if ( !xColumns.is() ) throw RuntimeException(); } diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src index bd20da391..a95366b25 100644 --- a/dbaccess/source/core/resource/strings.src +++ b/dbaccess/source/core/resource/strings.src @@ -273,7 +273,7 @@ String RID_STR_ROW_ALREADY_DELETED }; String RID_STR_UPDATE_FAILED { - Text [ en-US ] = "Current row could be updated."; + Text [ en-US ] = "Current row could not be updated."; }; //------------------------------------------------------------------------- String RID_STR_NO_INSERT_PRIVILEGE diff --git a/dbaccess/source/filter/migration/cfgimport.cxx b/dbaccess/source/filter/migration/cfgimport.cxx deleted file mode 100644 index 2c62a36ea..000000000 --- a/dbaccess/source/filter/migration/cfgimport.cxx +++ /dev/null @@ -1,1260 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dbaccess.hxx" - -#include "cfgimport.hxx" - -#ifndef CFG_REGHELPER_HXX -#include "cfg_reghelper.hxx" -#endif -#ifndef _SV_SVAPP_HXX -#include <vcl/svapp.hxx> -#endif -#ifndef _COM_SUN_STAR_UNO_XNAMINGSERVICE_HPP_ -#include <com/sun/star/uno/XNamingService.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_ -#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ -#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_ -#include <com/sun/star/frame/XModel.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_ -#include <com/sun/star/beans/XMultiPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_ -#include <com/sun/star/sdbcx/XAppend.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_ -#include <com/sun/star/frame/XStorable.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_ -#include <com/sun/star/sdbc/XDataSource.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XOFFICEDATABASEDOCUMENT_HPP_ -#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XDOCUMENTDATASOURCE_HPP_ -#include <com/sun/star/sdb/XDocumentDataSource.hpp> -#endif -#ifndef _URLOBJ_HXX //autogen wg. INetURLObject -#include <tools/urlobj.hxx> -#endif -#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX -#include <unotools/pathoptions.hxx> -#endif -#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_ -#include <com/sun/star/frame/XComponentLoader.hpp> -#endif -#ifndef DBACCESS_SHARED_CFGSTRINGS_HRC -#include "cfgstrings.hrc" -#endif -#ifndef _UNOTOOLS_UCBHELPER_HXX -#include <unotools/ucbhelper.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ -#include <comphelper/types.hxx> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ -#include <com/sun/star/container/XNameContainer.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ -#include <com/sun/star/container/XNameAccess.hpp> -#endif -#ifndef _SFX_DOCFILT_HACK_HXX -#include <sfx2/docfilt.hxx> -#endif -#ifndef _COMPHELPER_STREAMSECTION_HXX_ -#include <comphelper/streamsection.hxx> -#endif -#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_ -#include <com/sun/star/io/XActiveDataSink.hpp> -#endif -#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_ -#include <com/sun/star/io/XObjectInputStream.hpp> -#endif -#ifndef _COMPHELPER_BASIC_IO_HXX_ -#include <comphelper/basicio.hxx> -#endif -#ifndef _COMPHELPER_SEQSTREAM_HXX -#include <comphelper/seqstream.hxx> -#endif -#ifndef _COM_SUN_STAR_SDB_XREPORTDOCUMENTSSUPPLIER_HPP_ -#include <com/sun/star/sdb/XReportDocumentsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_XFORMDOCUMENTSSUPPLIER_HPP_ -#include <com/sun/star/sdb/XFormDocumentsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYER_HPP_ -#include <com/sun/star/configuration/backend/XLayer.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_XLOADABLE_HPP_ -#include <com/sun/star/frame/XLoadable.hpp> -#endif -#ifndef _COM_SUN_STAR_DOCUMENT_XTYPEDETECTION_HPP_ -#include <com/sun/star/document/XTypeDetection.hpp> -#endif -#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP_ -#include <com/sun/star/document/XEventsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_ -#include <com/sun/star/util/XCloseable.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEREPLACE_HPP_ -#include <com/sun/star/container/XNameReplace.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_ -#include <com/sun/star/form/FormComponentType.hpp> -#endif -#ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGESUPPLIER_HPP_ -#include <com/sun/star/drawing/XDrawPageSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_FORM_XFORMSSUPPLIER_HPP_ -#include <com/sun/star/form/XFormsSupplier.hpp> -#endif -#ifndef _TOOLS_DEBUG_HXX -#include <tools/debug.hxx> -#endif - - -extern "C" void SAL_CALL createRegistryInfo_OCfgImport( ) -{ - static ::dbacfg::OMultiInstanceAutoRegistration< ::dbacfg::OCfgImport > aAutoRegistration; -} - -#define DATASOURCES 1 -#define DATASOURCE 2 -#define DATASOURCESETTINGS 3 -#define TABLES 4 -#define QUERIES 5 -#define BOOKMARKS 6 -#define DATASOURCESETTING 7 -#define BOOKMARK 8 -#define QUERY 9 -#define TABLE 10 -#define DATASETTINGS 11 -#define COLUMNS 12 -#define COLUMN 13 -#define NO_PROP 14 -#define LOGINTIMEOUT 15 - -//-------------------------------------------------------------------------- -using namespace dbacfg; -// { - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::sdbcx; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::document; - using namespace ::com::sun::star::io; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::drawing; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::task; - using namespace ::com::sun::star::configuration::backend; - using namespace ::utl; - using namespace ::comphelper; - - void LoadTableWindows(const Reference< XObjectInputStream>& _rxIn,Sequence<PropertyValue>& _rViewProps); - void LoadTableWindowData(const Reference<XObjectInputStream>& _rxIn,PropertyValue* _pValue); - void LoadTableFields(const Reference< XObjectInputStream>& _rxIn,Sequence<PropertyValue>& _rViewProps); - void LoadTableFieldDesc(const Reference< XObjectInputStream>& _rxIn,PropertyValue& _rProperty); - sal_Bool isDocumentReport(const Reference< XMultiServiceFactory >& _xORB,const ::rtl::OUString& _sDocumentLocation); -// ------------- -// - OCfgImport - -// ------------- -DBG_NAME(OCfgImport) - -OCfgImport::OCfgImport( const Reference< XMultiServiceFactory >& _rxMSF ) - :m_xORB( _rxMSF ) - ,m_bPropertyMayBeVoid(sal_True) -{ - DBG_CTOR(OCfgImport,NULL); - -} - -// ----------------------------------------------------------------------------- - -OCfgImport::~OCfgImport() throw() -{ - - DBG_DTOR(OCfgImport,NULL); -} -// ----------------------------------------------------------------------------- -IMPLEMENT_SERVICE_INFO1_STATIC( OCfgImport, "com.sun.star.comp.sdb.DataSourceMigration", "com.sun.star.sdb.DataSourceMigration") -// ----------------------------------------------------------------------------- -// XInitialization -void SAL_CALL OCfgImport::initialize( const Sequence< Any >& _aArguments ) throw(Exception, RuntimeException) -{ - const Any* pIter = _aArguments.getConstArray(); - const Any* pEnd = pIter + _aArguments.getLength(); - Sequence<NamedValue> aOldConfigValues; - NamedValue aValue; - for(;pIter != pEnd;++pIter) - { - *pIter >>= aValue; - if ( aValue.Name.equalsAscii("OldConfiguration") && (aValue.Value >>= aOldConfigValues) ) - { - const NamedValue* configValues = aOldConfigValues.getConstArray(); - const NamedValue* configValuesEnd = configValues + aOldConfigValues.getLength(); - for(;configValues != configValuesEnd;++configValues) - { - if ( configValues->Name.equalsAscii("org.openoffice.Office.DataAccess") ) - { - configValues->Value >>= m_xLayer; - break; - } - } - break; - } - } -} -// ----------------------------------------------------------------------------- - -void LoadTableWindows(const Reference< XObjectInputStream>& _rxIn,Sequence<PropertyValue>& _rViewProps) -{ - try - { - OStreamSection aSection(_rxIn.get()); - - sal_Int32 nCount = 0; - _rxIn >> nCount; - if ( nCount > 0 ) - { - PropertyValue *pViewIter = _rViewProps.getArray(); - PropertyValue *pEnd = pViewIter + _rViewProps.getLength(); - const static ::rtl::OUString s_sTables(RTL_CONSTASCII_USTRINGPARAM("Tables")); - for (; pViewIter != pEnd && pViewIter->Name != s_sTables; ++pViewIter) - ; - - if ( pViewIter == pEnd ) - { - sal_Int32 nLen = _rViewProps.getLength(); - _rViewProps.realloc( nLen + 1 ); - pViewIter = _rViewProps.getArray() + nLen; - pViewIter->Name = s_sTables; - } - - Sequence<PropertyValue> aTables(nCount); - PropertyValue *pIter = aTables.getArray(); - - - for(sal_Int32 i=0;i<nCount;++i,++pIter) - { - pIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Table")) + ::rtl::OUString::valueOf(i+1); - LoadTableWindowData(_rxIn,pIter); - } - } - } - catch(Exception&) - { - } -} -// ----------------------------------------------------------------------------- -void LoadTableWindowData(const Reference<XObjectInputStream>& _rxIn,PropertyValue* _pValue) -{ - ::rtl::OUString sComposedName,aTableName,aWinName; - sal_Int32 nX,nY,nWidth,nHeight; - sal_Bool bShowAll; - - OStreamSection aSection(_rxIn.get()); - _rxIn >> sComposedName; - _rxIn >> aTableName; - _rxIn >> aWinName; - _rxIn >> nX; - _rxIn >> nY; - _rxIn >> nWidth; - _rxIn >> nHeight; - _rxIn >> bShowAll; - - Sequence<PropertyValue> aWindow(8); - sal_Int32 nPos = 0; - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ComposedName")); - aWindow[nPos++].Value <<= sComposedName; - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableName")); - aWindow[nPos++].Value <<= aTableName; - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowName")); - aWindow[nPos++].Value <<= aWinName; - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowTop")); - aWindow[nPos++].Value <<= nY; - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowLeft")); - aWindow[nPos++].Value <<= nX; - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowWidth")); - aWindow[nPos++].Value <<= nWidth; - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowHeight")); - aWindow[nPos++].Value <<= nHeight; - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowAll")); - aWindow[nPos++].Value <<= bShowAll; - - _pValue->Value <<= aWindow; -} -// ----------------------------------------------------------------------------- -void LoadTableFields(const Reference< XObjectInputStream>& _rxIn,Sequence<PropertyValue>& _rViewProps) -{ - LoadTableWindows(_rxIn,_rViewProps); - OStreamSection aSection(_rxIn.get()); - PropertyValue *pIter = NULL; - try - { - sal_Int32 nSplitPos,nVisibleRows; - // some data - _rxIn >> nSplitPos; - _rxIn >> nVisibleRows; - - sal_Int32 nCount = 0; - _rxIn >> nCount; - - sal_Int32 nLen = _rViewProps.getLength(); - _rViewProps.realloc( nLen + 2 + (nCount != 0 ? 1 : 0) ); - pIter = _rViewProps.getArray() + nLen; - - if ( nCount != 0 ) - { - pIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fields")); - - Sequence<PropertyValue> aFields(nCount); - PropertyValue *pFieldsIter = aFields.getArray(); - // the fielddata - for(sal_Int32 j=0;j<nCount;++j) - { - if ( aSection.available() ) - { - pFieldsIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Field")) + ::rtl::OUString::valueOf(j+1); - LoadTableFieldDesc(_rxIn,*pFieldsIter++); - } - } - pIter->Value <<= aFields; - ++pIter; - } - - pIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SplitterPosition")); - pIter->Value <<= nSplitPos; - ++pIter; - pIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleRows")); - pIter->Value <<= nVisibleRows; - } - catch(Exception&) - { - } -} -// ----------------------------------------------------------------------------- -void LoadTableFieldDesc(const Reference< XObjectInputStream>& _rxIn,PropertyValue& _rProperty) -{ - ::rtl::OUString aTableName; - ::rtl::OUString aAliasName; // table range - ::rtl::OUString aFieldName; // column - ::rtl::OUString aFieldAlias; // column alias - ::rtl::OUString aDatabaseName; // qualifier or catalog - ::rtl::OUString aFunctionName; // enth"alt den Funktionsnamen, nur wenn eFunctionType != FKT_NONE gesetzt - - sal_Int32 eDataType; - sal_Int32 eFunctionType; - sal_Int32 eFieldType; - sal_Int32 eOrderDir; - sal_Int32 nColWidth; - sal_Bool bGroupBy; - sal_Bool bVisible; - - OStreamSection aSection(_rxIn.get()); - _rxIn >> aTableName; - _rxIn >> aAliasName; - _rxIn >> aFieldName; - _rxIn >> aFieldAlias; - _rxIn >> aDatabaseName; - _rxIn >> aFunctionName; - _rxIn >> eDataType; - _rxIn >> eFunctionType; - _rxIn >> eFieldType; - _rxIn >> eOrderDir; - _rxIn >> nColWidth; - _rxIn >> bGroupBy; - _rxIn >> bVisible; - - Sequence<PropertyValue> aFieldDesc(13); - sal_Int32 nPos = 0; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AliasName")); - aFieldDesc[nPos++].Value <<= aAliasName; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableName")); - aFieldDesc[nPos++].Value <<= aTableName; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldName")); - aFieldDesc[nPos++].Value <<= aFieldName; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldAlias")); - aFieldDesc[nPos++].Value <<= aFieldAlias; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseName")); - aFieldDesc[nPos++].Value <<= aDatabaseName; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionName")); - aFieldDesc[nPos++].Value <<= aFunctionName; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataType")); - aFieldDesc[nPos++].Value <<= eDataType; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionType")); - aFieldDesc[nPos++].Value <<= (sal_Int32)eFunctionType; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldType")); - aFieldDesc[nPos++].Value <<= (sal_Int32)eFieldType; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OrderDir")); - aFieldDesc[nPos++].Value <<= (sal_Int32)eOrderDir; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColWidth")); - aFieldDesc[nPos++].Value <<= nColWidth; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GroupBy")); - aFieldDesc[nPos++].Value <<= bGroupBy; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Visible")); - aFieldDesc[nPos++].Value <<= bVisible; - - _rProperty.Value <<= aFieldDesc; -} -// ----------------------------------------------------------------------------- -void closeDocument(const Reference< XModel >& _xDocument) -{ - Reference< XCloseable > xCloseable( _xDocument, UNO_QUERY ); - if ( xCloseable.is() ) - { - try - { - xCloseable->close( sal_True ); - } - catch( Exception& ) - { - } - } -} -// ----------------------------------------------------------------------------- -sal_Bool isDocumentReport(const Reference< XMultiServiceFactory >& _xORB,const ::rtl::OUString& _sDocumentLocation) -{ - sal_Bool bReport = sal_False; - try - { - Reference< XModel > xDocument(_xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument"))),UNO_QUERY); - if ( xDocument.is() ) - { - Reference< XLoadable > xLoadable( xDocument, UNO_QUERY ); - if ( xLoadable.is() ) - { - Sequence< PropertyValue > aMedDescr(4); - sal_Int32 nPos = 0; - aMedDescr[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); - aMedDescr[nPos++].Value <<= sal_False; - aMedDescr[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden")); - aMedDescr[nPos++].Value <<= sal_False; - aMedDescr[nPos].Name = PROPERTY_URL; - aMedDescr[nPos++].Value <<= _sDocumentLocation; - aMedDescr[nPos].Name = ::rtl::OUString::createFromAscii( "ReadOnly" ); - aMedDescr[nPos++].Value <<= sal_True; - Reference< XTypeDetection > xTypeDetection(_xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection")) ),UNO_QUERY ); - - if ( !xTypeDetection.is() ) - throw RuntimeException(); // TODO - - // get TypeName - ::rtl::OUString aTypeName = xTypeDetection->queryTypeByDescriptor( aMedDescr, sal_True ); - const PropertyValue* pIter = aMedDescr.getConstArray(); - const PropertyValue* pEnd = pIter + aMedDescr.getLength(); - for( ; pIter != pEnd && !pIter->Name.equalsAscii( "FilterName" ); ++pIter) - ; - if ( aTypeName.getLength() && pIter == pEnd ) - { - Reference<XNameAccess> xNameAccess( xTypeDetection, UNO_QUERY ); - if ( xNameAccess.is() && xNameAccess->hasByName( aTypeName ) ) - { - Sequence<PropertyValue> aTypes; - xNameAccess->getByName(aTypeName) >>= aTypes; - const PropertyValue* types = aTypes.getConstArray(); - const PropertyValue* typesEnd = types + aTypes.getLength(); - for( ; types != typesEnd && !types->Name.equalsAscii( "PreferredFilter" ) ; ++types) - ; - if ( types != typesEnd ) - { - sal_Int32 nLen = aMedDescr.getLength(); - aMedDescr.realloc(nLen+1); - aMedDescr[nLen].Value = types->Value; - aMedDescr[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")); - } - } - } - try - { - xLoadable->load(aMedDescr); - - Reference< XEventsSupplier> xEventsSup(xDocument,UNO_QUERY); - Reference< XNameReplace> xEvents = xEventsSup.is() ? xEventsSup->getEvents() : Reference< XNameReplace>(); - static const ::rtl::OUString s_sOnNew = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnNew")); - if ( xEvents.is() && xEvents->hasByName(s_sOnNew) ) - { - Sequence<PropertyValue> aEventDesc; - if ( (xEvents->getByName(s_sOnNew) >>= aEventDesc ) && aEventDesc.getLength() ) - { - ::rtl::OUString sScript; - const PropertyValue* events = aEventDesc.getConstArray(); - const PropertyValue* eventsEnd = events + aEventDesc.getLength(); - for( ; events != eventsEnd && !events->Name.equalsAscii( "Script" ) ; ++events) - ; - if ( events != eventsEnd && (events->Value >>= sScript) ) - bReport = sScript.equalsAscii("service:com.sun.star.wizards.report.CallReportWizard?fill"); - } - } - if ( !bReport ) - { - sal_Bool bForm = sal_False; - Reference< XDrawPageSupplier> xDrawPageSup(xDocument,UNO_QUERY); - Reference< XFormsSupplier> xFormsSup(xDrawPageSup.is() ? xDrawPageSup->getDrawPage() : Reference< XDrawPage>(),UNO_QUERY); - Reference< XNameContainer> xForms(xFormsSup.is() ? xFormsSup->getForms() : Reference< XNameContainer>(),UNO_QUERY); - Sequence< ::rtl::OUString> aSeq = xForms.is() ? xForms->getElementNames() : Sequence< ::rtl::OUString>(); - const ::rtl::OUString* elementNames = aSeq.getConstArray(); - const ::rtl::OUString* elementNamesEnd = elementNames + aSeq.getLength(); - for(;elementNames != elementNamesEnd && !bForm;++elementNames) - { - Reference< XNameContainer> xControls(xForms->getByName(*elementNames),UNO_QUERY); - Sequence< ::rtl::OUString> aControlSeq = xControls.is() ? xControls->getElementNames() : Sequence< ::rtl::OUString>(); - const ::rtl::OUString* pControlIter = aControlSeq.getConstArray(); - const ::rtl::OUString* pControlEnd = pControlIter + aControlSeq.getLength(); - for(;pControlIter != pControlEnd && !bForm;++pControlIter) - { - Reference<XPropertySet> xProp(xControls->getByName(*pControlIter),UNO_QUERY); - sal_Int16 nClassId = 0; - const static ::rtl::OUString s_sClassId = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClassId")); - if ( xProp.is() - && xProp->getPropertySetInfo().is() - && xProp->getPropertySetInfo()->hasPropertyByName(s_sClassId) - && (xProp->getPropertyValue(s_sClassId) >>= nClassId) ) - { - bForm = nClassId != FormComponentType::HIDDENCONTROL; - } - } - } - bReport = !bForm; - } - } - catch( Exception& ) - { - closeDocument(xDocument); - } - } - closeDocument(xDocument); - } - } - catch(Exception) - { - OSL_ENSURE(0,"isDocumentReport: catched exception!"); - } - return bReport; -} -// ----------------------------------------------------------------------------- -void OCfgImport::createDataSource(const ::rtl::OUString& _sName) -{ - SvtPathOptions aPathOptions; - const String& rsWorkPath = aPathOptions.GetWorkPath(); - - ::rtl::OUString sExtension; - static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)"); - const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType); - OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!"); - if ( pFilter ) - { - String aRet = pFilter->GetDefaultExtension(); - while( aRet.SearchAndReplaceAscii( "*.", String() ) != STRING_NOTFOUND ) ; - sExtension = aRet; - } - // then look for which of them settings are stored in the configuration - ::rtl::OUString sFileName; - try - { - m_xModel.set(m_xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument"))),UNO_QUERY); - - if ( !m_xModel.is() ) - return; - - Reference<XOfficeDatabaseDocument> xOfficeDoc(m_xModel,UNO_QUERY); - if ( xOfficeDoc.is() ) - m_xCurrentDS.set(xOfficeDoc->getDataSource(),UNO_QUERY); - - - INetURLObject aURL(rsWorkPath,INetURLObject::WAS_ENCODED); - aURL.insertName(_sName,false,INetURLObject::LAST_SEGMENT,true,INetURLObject::ENCODE_ALL); - aURL.setExtension(sExtension); - - sFileName = aURL.GetMainURL(INetURLObject::NO_DECODE); - - sal_Int32 i = 0; - // create unique name - while ( UCBContentHelper::IsDocument(sFileName) ) - { - sFileName = _sName + ::rtl::OUString::valueOf(++i); - aURL.setName(sFileName,INetURLObject::LAST_SEGMENT,true,INetURLObject::ENCODE_ALL); - aURL.setExtension(sExtension); - sFileName = aURL.GetMainURL(INetURLObject::NO_DECODE); - } - - Sequence< PropertyValue > aArgs(1); - aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FileName" ) ); - aArgs[0].Value <<= sFileName; - - Reference< XLoadable > xLoad( m_xModel, UNO_QUERY_THROW ); - xLoad->load( aArgs ); - m_xModel->attachResource( sFileName, Sequence< PropertyValue >() ); - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception: convert"); - UCBContentHelper::Kill(sFileName); - } -} -// ----------------------------------------------------------------------------- -void OCfgImport::createObject(sal_Bool _bQuery ,const ::rtl::OUString& _sName) -{ - if ( !m_xCurrentObject.is() ) - { - Sequence< Any > aArguments(1); - PropertyValue aValue; - // set as folder - aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")); - aValue.Value <<= _sName; - aArguments[0] <<= aValue; - m_xCurrentObject.set(m_xORB->createInstanceWithArguments(_bQuery ? SERVICE_SDB_COMMAND_DEFINITION : SERVICE_SDB_TABLEDEFINITION ,aArguments ),UNO_QUERY); - } -} -// ----------------------------------------------------------------------------- -void OCfgImport::setProperties(sal_Int16 _eType) -{ - if ( m_aValues[_eType].getLength() ) - { - OSL_ENSURE(m_aProperties[_eType].getLength() == m_aValues[_eType].getLength(),"Count is not equal!"); - try - { - Reference< XMultiPropertySet > xFormMultiSet; - if ( _eType == COLUMN ) - xFormMultiSet.set(m_xCurrentColumn,UNO_QUERY); - else if ( _eType == TABLE || _eType == QUERY ) - xFormMultiSet.set(m_xCurrentObject,UNO_QUERY); - else if ( _eType == DATASOURCE ) - xFormMultiSet.set(m_xCurrentDS,UNO_QUERY); - - if ( xFormMultiSet.is() ) - xFormMultiSet->setPropertyValues(m_aProperties[_eType], m_aValues[_eType]); - } - catch(const Exception& e) - { - throw WrappedTargetException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property could not be set.")),*this,makeAny(e)); - } - m_aValues[_eType] = Sequence< Any>(); - m_aProperties[_eType] = Sequence< ::rtl::OUString>(); - } -} -// ----------------------------------------------------------------------------- -Any SAL_CALL OCfgImport::execute( const Sequence< NamedValue >& /*Arguments*/ ) throw (IllegalArgumentException, Exception, RuntimeException) -{ - m_xLayer->readData(this); - return Any(); -} -// ----------------------------------------------------------------------------- -// XLayerHandler -void SAL_CALL OCfgImport::startLayer() - throw(WrappedTargetException) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::endLayer() - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::overrideNode( - const ::rtl::OUString& aName, - sal_Int16 aAttributes, - sal_Bool /*bClear*/) - throw( - MalformedDataException, - WrappedTargetException ) -{ - addOrReplaceNode(aName,aAttributes); -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::addOrReplaceNode( - const ::rtl::OUString& aName, - sal_Int16 /*aAttributes*/) - throw( - MalformedDataException, - WrappedTargetException ) -{ - if ( !m_aStack.empty() ) - { - switch(m_aStack.top().second) - { - case DATASOURCES: - m_sCurrentDataSourceName = aName; - if ( m_sCurrentDataSourceName.equalsAscii("Bibliography") ) - { - Reference< XNameAccess > xDatabaseContext(m_xORB->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY); - if ( xDatabaseContext.is() && xDatabaseContext->hasByName(m_sCurrentDataSourceName) ) - { - m_xCurrentDS.set(xDatabaseContext->getByName(m_sCurrentDataSourceName),UNO_QUERY); - Reference<XDocumentDataSource> xDocumentDataSource(m_xCurrentDS,UNO_QUERY); - if ( xDocumentDataSource.is() ) - m_xModel.set(xDocumentDataSource->getDatabaseDocument(),UNO_QUERY); - } - } - if ( !m_xCurrentDS.is() ) - createDataSource(m_sCurrentDataSourceName); - - m_aStack.push(TElementStack::value_type(aName,DATASOURCE)); - break; - case DATASOURCESETTINGS: - { - PropertyValue aValue; - aValue.Name = aName; - m_aDataSourceSettings.push_back(aValue); - m_aStack.push(TElementStack::value_type(aName,DATASOURCESETTING)); - } - break; - case TABLES: - m_aStack.push(TElementStack::value_type(aName,TABLE)); - createObject(sal_False,aName); - break; - case QUERIES: - m_aStack.push(TElementStack::value_type(aName,QUERY)); - createObject(sal_True,aName); - break; - case COLUMNS: - if ( !m_xCurrentColumn.is() ) - { - Reference<XColumnsSupplier> xSupplier(m_xCurrentObject,UNO_QUERY); - if ( xSupplier.is() ) - { - Reference<XDataDescriptorFactory> xFact(xSupplier->getColumns(),UNO_QUERY); - - m_xCurrentColumn = ( xFact.is() ? xFact->createDataDescriptor() : Reference<XPropertySet>()); - if ( m_xCurrentColumn.is() ) - m_xCurrentColumn->setPropertyValue(PROPERTY_NAME,makeAny(aName)); - } - } - m_aStack.push(TElementStack::value_type(aName,COLUMN)); - break; - case BOOKMARKS: - m_aStack.push(TElementStack::value_type(aName,BOOKMARK)); - break; - } - } - /*if ( aName.equalsAscii("org.openoffice.Office.DataAccess") ) - m_aStack.push(TElementStack::value_type(aName,0)); - else*/ - if ( aName.equalsAscii("DataSources") ) - m_aStack.push(TElementStack::value_type(aName,DATASOURCES)); - else if ( aName.equalsAscii("DataSourceSettings") ) - m_aStack.push(TElementStack::value_type(aName,DATASOURCESETTINGS)); - else if ( aName.equalsAscii("Tables") ) - m_aStack.push(TElementStack::value_type(aName,TABLES)); - else if ( aName.equalsAscii("Queries") ) - m_aStack.push(TElementStack::value_type(aName,QUERIES)); - else if ( aName == CONFIGKEY_DBLINK_BOOKMARKS ) - m_aStack.push(TElementStack::value_type(aName,BOOKMARKS)); - else if ( aName == CONFIGKEY_SETTINGS ) - m_aStack.push(TElementStack::value_type(aName,DATASETTINGS)); - else if ( aName.equalsAscii("Font") ) - m_aStack.push(TElementStack::value_type(aName,DATASETTINGS)); - else if ( aName == CONFIGKEY_QRYDESCR_COLUMNS ) - m_aStack.push(TElementStack::value_type(aName,COLUMNS)); - else if ( aName.equalsAscii("Font") ) - m_aStack.push(TElementStack::value_type(aName,DATASETTINGS)); -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::addOrReplaceNodeFromTemplate( - const ::rtl::OUString& /*aName*/, - const TemplateIdentifier& /*aTemplate*/, - sal_Int16 /*aAttributes*/ ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::endNode() - throw( - MalformedDataException, - WrappedTargetException ) -{ - if ( !m_aStack.empty() ) - { - sal_Int16 nElementType = m_aStack.top().second; - ::rtl::OUString sName = m_aStack.top().first; - m_aStack.pop(); - - switch(nElementType) - { - case DATASOURCE: - { - setProperties(nElementType); - Reference<XStorable> xStr(m_xModel,UNO_QUERY); - if ( xStr.is() ) - { - xStr->store(); - xStr = NULL; - } - // register the new datbase document - - if ( !m_sCurrentDataSourceName.equalsAscii("Bibliography") ) - { - // create unique name - Reference< XNameAccess > xDatabaseContext(m_xORB->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY); - if ( xDatabaseContext.is() ) - { - sal_Int32 i = 0; - ::rtl::OUString sDataSourceName = m_sCurrentDataSourceName; - while ( xDatabaseContext->hasByName( sDataSourceName ) ) - { - sDataSourceName = m_sCurrentDataSourceName + ::rtl::OUString::valueOf(++i); - } - Reference< XNamingService>(xDatabaseContext,UNO_QUERY)->registerObject(sDataSourceName,m_xCurrentDS); - } - } - ::comphelper::disposeComponent(m_xModel); - m_xCurrentDS = NULL; - } - break; - case DATASOURCESETTINGS: - OSL_ENSURE(m_xCurrentDS.is(),"Data Source is NULL!"); - { - PropertyValue* pSettings = m_aDataSourceSettings.empty() ? NULL : &m_aDataSourceSettings[0]; - m_xCurrentDS->setPropertyValue(PROPERTY_INFO,makeAny(Sequence< PropertyValue >(pSettings, m_aDataSourceSettings.size()))); - } - break; - case TABLE: - { - setProperties(nElementType); - Reference<XTablesSupplier> xSupplier(m_xCurrentDS,UNO_QUERY); - Reference<XNameContainer> xTables(xSupplier->getTables(),UNO_QUERY); - ::rtl::OUString sTableName; - m_xCurrentObject->getPropertyValue(PROPERTY_NAME) >>= sTableName; - if ( !xTables->hasByName( sTableName ) ) - xTables->insertByName( sTableName, makeAny( m_xCurrentObject ) ); - m_xCurrentObject = NULL; - } - break; - case QUERY: - { - setProperties(nElementType); - Reference<XQueryDefinitionsSupplier> xQueriesSupplier(m_xCurrentDS,UNO_QUERY); - Reference<XNameContainer> xQueries(xQueriesSupplier->getQueryDefinitions(),UNO_QUERY); - xQueries->insertByName(sName,makeAny(m_xCurrentObject)); - m_xCurrentObject = NULL; - } - break; - case BOOKMARK: - try - { - if ( !UCBContentHelper::IsDocument(m_sDocumentLocation) ) - break; - - sal_Bool bForm = sal_True; - bForm = !isDocumentReport(m_xORB,m_sDocumentLocation); - Reference<XNameAccess> xNames; - if ( bForm ) - { - Reference<XFormDocumentsSupplier> xSup(m_xModel,UNO_QUERY); - if ( xSup.is() ) - xNames = xSup->getFormDocuments(); - } - else - { - Reference<XReportDocumentsSupplier> xSup(m_xModel,UNO_QUERY); - if ( xSup.is() ) - xNames = xSup->getReportDocuments(); - } - - if ( xNames.is() && m_sBookmarkName.getLength() ) - { - ::rtl::OUString sServiceName(SERVICE_SDB_DOCUMENTDEFINITION); - Sequence< Any > aArguments(3); - PropertyValue aValue; - // set as folder - aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")); - aValue.Value <<= m_sBookmarkName; - aArguments[0] <<= aValue; - //parent - aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parent")); - aValue.Value <<= xNames; - aArguments[1] <<= aValue; - - aValue.Name = PROPERTY_URL; - aValue.Value <<= m_sDocumentLocation; - aArguments[2] <<= aValue; - - Reference<XMultiServiceFactory> xORB(xNames,UNO_QUERY); - if ( xORB.is() ) - { - Reference<XInterface> xComponent = xORB->createInstanceWithArguments(SERVICE_SDB_DOCUMENTDEFINITION,aArguments); - Reference<XNameContainer> xNameContainer(xNames,UNO_QUERY); - if ( xNameContainer.is() ) - xNameContainer->insertByName(m_sBookmarkName,makeAny(xComponent)); - } - } - } - catch(Exception&) - { - OSL_ENSURE(0,"convertLinks: Exception catched!"); - } - m_sBookmarkName = ::rtl::OUString(); - m_sDocumentLocation = ::rtl::OUString(); - break; - case COLUMN: - if ( m_xCurrentColumn.is() ) - { - setProperties(nElementType); - Reference<XColumnsSupplier> xSupplier(m_xCurrentObject,UNO_QUERY); - Reference<XAppend> xAppend(xSupplier->getColumns(),UNO_QUERY); - if ( xAppend.is() ) - xAppend->appendByDescriptor(m_xCurrentColumn); - m_xCurrentColumn = NULL; - } - break; - } - } -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::dropNode( - const ::rtl::OUString& /*aName*/ ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::overrideProperty( - const ::rtl::OUString& aName, - sal_Int16 /*aAttributes*/, - const Type& /*aType*/, - sal_Bool /*bClear*/ ) - throw( - MalformedDataException, - WrappedTargetException ) -{ - m_bPropertyMayBeVoid = sal_True; - if ( !m_aStack.empty() ) - { - switch(m_aStack.top().second) - { - case DATASOURCE: - { - m_bPropertyMayBeVoid = sal_False; - ::rtl::OUString sProp; - if ( aName == CONFIGKEY_DBLINK_CONNECTURL ) - sProp = PROPERTY_URL; - else if ( aName == CONFIGKEY_DBLINK_USER ) - sProp = PROPERTY_USER; - else if ( aName == CONFIGKEY_DBLINK_TABLEFILTER ) - sProp = PROPERTY_TABLEFILTER; - else if ( aName == CONFIGKEY_DBLINK_TABLETYEFILTER ) - sProp = PROPERTY_TABLETYPEFILTER; - else if ( aName == CONFIGKEY_DBLINK_PASSWORDREQUIRED ) - sProp = PROPERTY_ISPASSWORDREQUIRED; - else if ( aName == CONFIGKEY_DBLINK_SUPPRESSVERSIONCL ) - sProp = PROPERTY_SUPPRESSVERSIONCL; - else if ( aName == CONFIGKEY_LAYOUTINFORMATION ) - sProp = PROPERTY_LAYOUTINFORMATION; - - if ( sProp.getLength() ) - { - if ( m_aProperties.find(m_aStack.top().second) == m_aProperties.end() ) - m_aProperties.insert(::std::map< sal_Int16 ,Sequence< ::rtl::OUString> >::value_type(m_aStack.top().second,Sequence< ::rtl::OUString>())); - sal_Int32 nPos = m_aProperties[m_aStack.top().second].getLength(); - m_aProperties[m_aStack.top().second].realloc(nPos+1); - m_aProperties[m_aStack.top().second][nPos] = sProp; - } - else if ( aName == CONFIGKEY_DBLINK_LOGINTIMEOUT ) - m_aStack.push(TElementStack::value_type(aName,LOGINTIMEOUT)); - else - m_aStack.push(TElementStack::value_type(aName,NO_PROP)); - } - break; - case QUERY: - { - m_bPropertyMayBeVoid = sal_False; - ::rtl::OUString sProp; - if ( aName == CONFIGKEY_QRYDESCR_COMMAND ) - sProp = PROPERTY_COMMAND; - else if ( aName == CONFIGKEY_QRYDESCR_ESCAPE_PROCESSING ) - sProp = PROPERTY_ESCAPE_PROCESSING; - else if ( aName == CONFIGKEY_QRYDESCR_UPDATE_TABLENAME ) - sProp = PROPERTY_UPDATE_TABLENAME; - else if ( aName == CONFIGKEY_QRYDESCR_UPDATE_SCHEMANAME ) - sProp = PROPERTY_UPDATE_SCHEMANAME; - else if ( aName == CONFIGKEY_QRYDESCR_UPDATE_CATALOGNAME ) - sProp = PROPERTY_UPDATE_CATALOGNAME; - else if ( aName == CONFIGKEY_LAYOUTINFORMATION ) - sProp = PROPERTY_LAYOUTINFORMATION; - - if ( sProp.getLength() ) - { - if ( m_aProperties.find(m_aStack.top().second) == m_aProperties.end() ) - m_aProperties.insert(::std::map< sal_Int16 ,Sequence< ::rtl::OUString> >::value_type(m_aStack.top().second,Sequence< ::rtl::OUString>())); - sal_Int32 nPos = m_aProperties[m_aStack.top().second].getLength(); - m_aProperties[m_aStack.top().second].realloc(nPos+1); - m_aProperties[m_aStack.top().second][nPos] = sProp; - } - else - m_aStack.push(TElementStack::value_type(aName,NO_PROP)); - } - break; - case DATASETTINGS: - { - m_bPropertyMayBeVoid = sal_False; - ::rtl::OUString sProp; - if ( aName == CONFIGKEY_DEFSET_FILTER ) sProp = PROPERTY_FILTER; - else if ( aName == CONFIGKEY_DEFSET_FONT_NAME ) sProp = PROPERTY_FONTNAME; - else if ( aName == CONFIGKEY_DEFSET_ORDER ) sProp = PROPERTY_ORDER; - else if ( aName == CONFIGKEY_DEFSET_APPLYFILTER ) sProp = PROPERTY_APPLYFILTER; - else if ( aName == CONFIGKEY_DEFSET_ROW_HEIGHT ) { m_bPropertyMayBeVoid = true; sProp = PROPERTY_ROW_HEIGHT; } - else if ( aName == CONFIGKEY_DEFSET_TEXTCOLOR ) { m_bPropertyMayBeVoid = true; sProp = PROPERTY_TEXTCOLOR; } - else if ( aName == CONFIGKEY_DEFSET_FONT_UNDERLINECOLOR ) { m_bPropertyMayBeVoid = true; sProp = PROPERTY_TEXTLINECOLOR; } - else if ( aName == CONFIGKEY_DEFSET_FONT_CHARACTEREMPHASIS ) sProp = PROPERTY_TEXTEMPHASIS; - else if ( aName == CONFIGKEY_DEFSET_FONT_CHARACTERRELIEF ) sProp = PROPERTY_TEXTRELIEF; - // font - else if ( aName == CONFIGKEY_DEFSET_FONT_HEIGHT ) sProp = PROPERTY_FONTHEIGHT; - else if ( aName == CONFIGKEY_DEFSET_FONT_WIDTH ) sProp = PROPERTY_FONTWIDTH; - else if ( aName == CONFIGKEY_DEFSET_FONT_STYLENAME ) sProp = PROPERTY_FONTSTYLENAME; - else if ( aName == CONFIGKEY_DEFSET_FONT_FAMILY ) sProp = PROPERTY_FONTFAMILY; - else if ( aName == CONFIGKEY_DEFSET_FONT_CHARSET ) sProp = PROPERTY_FONTCHARSET; - else if ( aName == CONFIGKEY_DEFSET_FONT_PITCH ) sProp = PROPERTY_FONTPITCH; - else if ( aName == CONFIGKEY_DEFSET_FONT_CHARACTERWIDTH ) sProp = PROPERTY_FONTCHARWIDTH; - else if ( aName == CONFIGKEY_DEFSET_FONT_WEIGHT ) sProp = PROPERTY_FONTWEIGHT; - else if ( aName == CONFIGKEY_DEFSET_FONT_UNDERLINE ) sProp = PROPERTY_FONTUNDERLINE; - else if ( aName == CONFIGKEY_DEFSET_FONT_STRIKEOUT ) sProp = PROPERTY_FONTSTRIKEOUT; - else if ( aName == CONFIGKEY_DEFSET_FONT_ORIENTATION ) sProp = PROPERTY_FONTORIENTATION; - else if ( aName == CONFIGKEY_DEFSET_FONT_KERNING ) sProp = PROPERTY_FONTKERNING; - else if ( aName == CONFIGKEY_DEFSET_FONT_WORDLINEMODE ) sProp = PROPERTY_FONTWORDLINEMODE; - else if ( aName == CONFIGKEY_DEFSET_FONT_TYPE ) sProp = PROPERTY_FONTTYPE; - else if ( aName == CONFIGKEY_DEFSET_FONT_SLANT ) sProp = PROPERTY_FONTSLANT; - - if ( sProp.getLength() ) - { - if ( m_aProperties.find(m_aStack.top().second) == m_aProperties.end() ) - m_aProperties.insert(::std::map< sal_Int16 ,Sequence< ::rtl::OUString> >::value_type(m_aStack.top().second,Sequence< ::rtl::OUString>())); - sal_Int32 nPos = m_aProperties[m_aStack.top().second].getLength(); - m_aProperties[m_aStack.top().second].realloc(nPos+1); - m_aProperties[m_aStack.top().second][nPos] = sProp; - } - else - m_aStack.push(TElementStack::value_type(aName,NO_PROP)); - } - break; - case COLUMN: - { - ::rtl::OUString sProp; - m_bPropertyMayBeVoid = sal_False; - if ( aName == CONFIGKEY_COLUMN_ALIGNMENT ) { - m_bPropertyMayBeVoid = true; - sProp = PROPERTY_ALIGN; - } else if ( aName == CONFIGKEY_COLUMN_WIDTH ) { - m_bPropertyMayBeVoid = true; - sProp = PROPERTY_WIDTH; - } else if ( aName == CONFIGKEY_COLUMN_RELPOSITION ) { - m_bPropertyMayBeVoid = true; - sProp = PROPERTY_RELATIVEPOSITION; - } else if ( aName == CONFIGKEY_COLUMN_HIDDEN ) { - sProp = PROPERTY_HIDDEN; - } else if ( aName == CONFIGKEY_COLUMN_HELPTEXT ) { - m_bPropertyMayBeVoid = true; - sProp = PROPERTY_HELPTEXT; - } else if ( aName == CONFIGKEY_COLUMN_CONTROLDEFAULT ) { - m_bPropertyMayBeVoid = true; - sProp = PROPERTY_CONTROLDEFAULT; - } else if ( aName == CONFIGKEY_COLUMN_NUMBERFORMAT ) { - m_bPropertyMayBeVoid = true; - sProp = PROPERTY_NUMBERFORMAT; - } - - - if ( sProp.getLength() ) - { - if ( m_aProperties.find(m_aStack.top().second) == m_aProperties.end() ) - m_aProperties.insert(::std::map< sal_Int16 ,Sequence< ::rtl::OUString> >::value_type(m_aStack.top().second,Sequence< ::rtl::OUString>())); - sal_Int32 nPos = m_aProperties[m_aStack.top().second].getLength(); - m_aProperties[m_aStack.top().second].realloc(nPos+1); - m_aProperties[m_aStack.top().second][nPos] = sProp; - } - else - m_aStack.push(TElementStack::value_type(aName,NO_PROP)); - } - break; - case BOOKMARK: - break; - } - } -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::setPropertyValue( - const Any& aValue ) - throw( - MalformedDataException, - WrappedTargetException ) -{ - if ( !m_aStack.empty() ) - { - switch(m_aStack.top().second) - { - case LOGINTIMEOUT: - { - Reference< ::com::sun::star::sdbc::XDataSource> xDataSource(m_xCurrentDS,UNO_QUERY); - sal_Int32 nTimeOut = 0; - aValue >>= nTimeOut; - if ( xDataSource.is() && nTimeOut >= 0 ) - xDataSource->setLoginTimeout(nTimeOut); - m_aStack.pop(); - } - break; - case DATASOURCESETTING: - OSL_ENSURE(!m_aDataSourceSettings.empty(),"Settings are emtpy!"); - if ( aValue.hasValue() ) - m_aDataSourceSettings.rbegin()->Value = aValue; - else - m_aDataSourceSettings.pop_back(); - break; - case BOOKMARK: - aValue >>= m_sDocumentLocation; - break; - case NO_PROP: - m_aStack.pop(); - break; - default: - OSL_ENSURE(m_aProperties[m_aStack.top().second].getLength(),"Properties are zero!"); - if ( m_aProperties[m_aStack.top().second].getLength() ) - { - if ( m_aProperties[m_aStack.top().second][m_aProperties[m_aStack.top().second].getLength()-1] != PROPERTY_LAYOUTINFORMATION ) - { - if ( !m_bPropertyMayBeVoid && !aValue.hasValue() ) - { - m_aProperties[m_aStack.top().second].realloc(m_aProperties[m_aStack.top().second].getLength()-1); - } - else - { - if ( m_aValues.find(m_aStack.top().second) == m_aValues.end() ) - m_aValues.insert(::std::map< sal_Int16 ,Sequence< Any> >::value_type(m_aStack.top().second,Sequence< Any>())); - sal_Int32 nPos = m_aValues[m_aStack.top().second].getLength(); - m_aValues[m_aStack.top().second].realloc(nPos+1); - m_aValues[m_aStack.top().second][nPos] = aValue; - } - } - else - { - try - { - Sequence< sal_Int8 > aInputSequence; - aValue >>= aInputSequence; - if ( m_aValues.find(m_aStack.top().second) == m_aValues.end() ) - m_aValues.insert(::std::map< sal_Int16 ,Sequence< Any> >::value_type(m_aStack.top().second,Sequence< Any>())); - sal_Int32 nPos = m_aValues[m_aStack.top().second].getLength(); - m_aValues[m_aStack.top().second].realloc(nPos+1); - Sequence< PropertyValue > aLayout; - if ( aInputSequence.getLength() ) - { - Reference< XInputStream> xInStreamHelper = new SequenceInputStream(aInputSequence);; // used for wrapping sequence to xinput - Reference< XObjectInputStream> xInStream = Reference< XObjectInputStream >(m_xORB->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")),UNO_QUERY); - Reference< XInputStream> xMarkInStream = Reference< XInputStream >(m_xORB->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")),UNO_QUERY); - Reference< XActiveDataSink >(xMarkInStream,UNO_QUERY)->setInputStream(xInStreamHelper); - Reference< XActiveDataSink > xInDataSource(xInStream, UNO_QUERY); - OSL_ENSURE(xInDataSource.is(),"Couldn't create com.sun.star.io.ObjectInputStream!"); - xInDataSource->setInputStream(xMarkInStream); - - if ( DATASOURCE == m_aStack.top().second ) - LoadTableWindows(xInStream,aLayout); - else if ( QUERY == m_aStack.top().second ) - LoadTableFields(xInStream,aLayout); - } - m_aValues[m_aStack.top().second][nPos] <<= aLayout; - } - catch(const Exception& e) - { - throw WrappedTargetException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Property could not be set.")),*this,makeAny(e)); - } - } - } - break; - } - } -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::setPropertyValueForLocale( - const Any& /*aValue*/, - const ::rtl::OUString& /*aLocale*/ ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::endProperty() - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::addProperty( - const rtl::OUString& /*aName*/, - sal_Int16 /*aAttributes*/, - const Type& /*aType*/ ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OCfgImport::addPropertyWithValue( - const rtl::OUString& /*aName*/, - sal_Int16 /*aAttributes*/, - const Any& /*aValue*/ ) - throw( - MalformedDataException, - WrappedTargetException ) -{ -} -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// }// dbacfg -// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/filter/migration/cfgimport.hxx b/dbaccess/source/filter/migration/cfgimport.hxx deleted file mode 100644 index 658991fc8..000000000 --- a/dbaccess/source/filter/migration/cfgimport.hxx +++ /dev/null @@ -1,223 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef CFG_CFGIMPORT_HXX -#define CFG_CFGIMPORT_HXX - -#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_ -#include <com/sun/star/lang/XInitialization.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ -#include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ -#include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_ -#include <com/sun/star/frame/XModel.hpp> -#endif -#ifndef _COM_SUN_STAR_TASK_XJOB_HPP_ -#include <com/sun/star/task/XJob.hpp> -#endif -#ifndef _OSL_DIAGNOSE_H_ -#include <osl/diagnose.h> -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ -#include "apitools.hxx" -#endif -#ifndef _COMPHELPER_STLTYPES_HXX_ -#include <comphelper/stl_types.hxx> -#endif -#ifndef _CPPUHELPER_IMPLBASE4_HXX_ -#include <cppuhelper/implbase4.hxx> -#endif -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERHANDLER_HPP_ -#include <com/sun/star/configuration/backend/XLayerHandler.hpp> -#endif -#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYER_HPP_ -#include <com/sun/star/configuration/backend/XLayer.hpp> -#endif - -#include <memory> -#include <stack> - -namespace dbacfg -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::frame; - -typedef ::cppu::WeakImplHelper4 < ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::lang::XInitialization - , ::com::sun::star::task::XJob - , ::com::sun::star::configuration::backend::XLayerHandler - > OCfgImport_COMPBASE; -// ------------- -// - OCfgImport - -// ------------- -class OCfgImport : public OCfgImport_COMPBASE -{ -private: - typedef ::std::pair< ::rtl::OUString, sal_Int16> TElementType; - typedef ::std::stack< TElementType > TElementStack; - typedef ::std::vector< PropertyValue > TDataSourceSettings; - - Reference< XMultiServiceFactory > m_xORB; - Reference< XMultiServiceFactory > m_xOldORB; - Reference< ::com::sun::star::configuration::backend::XLayer> m_xLayer; - Reference<XPropertySet> m_xCurrentDS; - Reference<XModel> m_xModel; - Reference<XPropertySet> m_xCurrentObject; /// can either be a query or a table - Reference<XPropertySet> m_xCurrentColumn; - ::std::map< sal_Int16 ,Sequence< ::rtl::OUString> > m_aProperties; - ::std::map< sal_Int16 ,Sequence< Any> > m_aValues; - ::rtl::OUString m_sCurrentDataSourceName; - ::rtl::OUString m_sBookmarkName; - ::rtl::OUString m_sDocumentLocation; - - TElementStack m_aStack; - TDataSourceSettings m_aDataSourceSettings; - sal_Bool m_bPropertyMayBeVoid; - - /** convert the old configuration settings into new database documents. - */ - void convert(); - void createDataSource(const ::rtl::OUString& _sName); - void createObject(sal_Bool _bQuery ,const ::rtl::OUString& _sName); - void setProperties(sal_Int16 _eType); - -protected: - virtual ~OCfgImport() throw(); -public: - - OCfgImport( const Reference< XMultiServiceFactory >& _rxMSF ); - - - // XServiceInfo - DECLARE_SERVICE_INFO_STATIC( ); - - inline Reference< XMultiServiceFactory > getORB() const { return m_xORB; } - - // lang::XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException); - // task::XJob - virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XLayerHandler - virtual void SAL_CALL startLayer() - throw(::com::sun::star::lang::WrappedTargetException); - - virtual void SAL_CALL endLayer() - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL overrideNode( - const rtl::OUString& aName, - sal_Int16 aAttributes, - sal_Bool bClear) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL addOrReplaceNode( - const rtl::OUString& aName, - sal_Int16 aAttributes) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL addOrReplaceNodeFromTemplate( - const rtl::OUString& aName, - const ::com::sun::star::configuration::backend::TemplateIdentifier& aTemplate, - sal_Int16 aAttributes ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL endNode() - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL dropNode( - const rtl::OUString& aName ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL overrideProperty( - const rtl::OUString& aName, - sal_Int16 aAttributes, - const Type& aType, - sal_Bool bClear ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL setPropertyValue( - const Any& aValue ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL setPropertyValueForLocale( - const Any& aValue, - const rtl::OUString& aLocale ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL endProperty() - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL addProperty( - const rtl::OUString& aName, - sal_Int16 aAttributes, - const Type& aType ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); - - virtual void SAL_CALL addPropertyWithValue( - const rtl::OUString& aName, - sal_Int16 aAttributes, - const Any& aValue ) - throw( - ::com::sun::star::configuration::backend::MalformedDataException, - ::com::sun::star::lang::WrappedTargetException ); -}; -// ----------------------------------------------------------------------------- -} // dbacfg -// ----------------------------------------------------------------------------- -#endif // CFG_CFGIMPORT_HXX diff --git a/dbaccess/source/filter/migration/cfgservices.cxx b/dbaccess/source/filter/migration/cfgservices.cxx deleted file mode 100644 index 695edf554..000000000 --- a/dbaccess/source/filter/migration/cfgservices.cxx +++ /dev/null @@ -1,94 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dbaccess.hxx" - -#ifndef _CPPUHELPER_FACTORY_HXX_ -#include <cppuhelper/factory.hxx> -#endif -#ifndef _OSL_DIAGNOSE_H_ -#include <osl/diagnose.h> -#endif -#ifndef CFG_REGHELPER_HXX -#include "cfg_reghelper.hxx" -#endif - - -/********************************************************************************************/ - -using namespace ::dbacfg; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -//*************************************************************************************** -// -// registry functions -extern "C" void SAL_CALL createRegistryInfo_OCfgImport(); - -//*************************************************************************************** -extern "C" void SAL_CALL createRegistryInfo_dbacfg() -{ - static sal_Bool bInit = sal_False; - if (!bInit) - { - createRegistryInfo_OCfgImport(); - bInit = sal_True; - } -} - -//--------------------------------------------------------------------------------------- - -extern "C" void SAL_CALL component_getImplementationEnvironment( - const sal_Char **ppEnvTypeName, - uno_Environment ** - ) -{ - createRegistryInfo_dbacfg(); - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//--------------------------------------------------------------------------------------- -extern "C" void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - Reference< XInterface > xRet; - if (pServiceManager && pImplementationName) - { - xRet = ::dbacfg::OModuleRegistration::getComponentFactory( - ::rtl::OUString::createFromAscii(pImplementationName), - static_cast< XMultiServiceFactory* >(pServiceManager)); - } - - if (xRet.is()) - xRet->acquire(); - return xRet.get(); -}; - diff --git a/dbaccess/source/filter/migration/dbacfg.component b/dbaccess/source/filter/migration/dbacfg.component deleted file mode 100644 index 65e92d0f5..000000000 --- a/dbaccess/source/filter/migration/dbacfg.component +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--********************************************************************** -* -* 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 -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -* -**********************************************************************--> - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.sdb.DataSourceMigration"> - <service name="com.sun.star.sdb.DataSourceMigration"/> - </implementation> -</component> diff --git a/dbaccess/source/filter/migration/makefile.mk b/dbaccess/source/filter/migration/makefile.mk deleted file mode 100644 index 3a8a37e07..000000000 --- a/dbaccess/source/filter/migration/makefile.mk +++ /dev/null @@ -1,82 +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 -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJINC=$(PRJ)$/source -PRJNAME=dbaccess -TARGET=dbacfg - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -# --- Files ------------------------------------- - -SLOFILES= $(SLO)$/cfgimport.obj \ - $(SLO)$/cfgservices.obj - -# --- Library ----------------------------------- -LIB1TARGET=$(SLB)$/dba_cfg.lib -LIB1FILES=\ - $(SLB)$/cfgshared.lib \ - $(SLB)$/$(TARGET).lib - -SHL1TARGET=$(TARGET)$(DLLPOSTFIX) - -SHL1STDLIBS=\ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SFXLIB) \ - $(SVLLIB) \ - $(SALLIB) - - -SHL1DEPN= -SHL1LIBS=$(LIB1TARGET) -SHL1IMPLIB= i$(SHL1TARGET) -# SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME=$(SHL1TARGET) - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/dbacfg.component - -$(MISC)/dbacfg.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - dbacfg.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt dbacfg.component diff --git a/dbaccess/source/inc/cfg_reghelper.hxx b/dbaccess/source/inc/cfg_reghelper.hxx deleted file mode 100644 index 039bdd82c..000000000 --- a/dbaccess/source/inc/cfg_reghelper.hxx +++ /dev/null @@ -1,60 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef CFG_REGHELPER_HXX -#define CFG_REGHELPER_HXX - -#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ -#include <com/sun/star/uno/Sequence.hxx> -#endif -#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ -#include <com/sun/star/registry/XRegistryKey.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif -#ifndef _RTL_USTRING_HXX_ -#include <rtl/ustring.hxx> -#endif -#ifndef _CPPUHELPER_FACTORY_HXX_ -#include <cppuhelper/factory.hxx> -#endif - -namespace dbacfg -{ - - #define _REGISTRATIONHELPER_INCLUDED_INDIRECTLY_ - #include "registrationhelper.hxx" - #undef _REGISTRATIONHELPER_INCLUDED_INDIRECTLY_ - -} - -#endif // CFG_REGHELPER_HXX - diff --git a/dbaccess/source/inc/cfgstrings.hrc b/dbaccess/source/inc/cfgstrings.hrc deleted file mode 100644 index 5364dca5a..000000000 --- a/dbaccess/source/inc/cfgstrings.hrc +++ /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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef DBACCESS_SHARED_CFGSTRINGS_HRC -#define DBACCESS_SHARED_CFGSTRINGS_HRC - -#ifndef _RTL_USTRING_HXX_ -#include <rtl/ustring.hxx> -#endif - -namespace dbacfg -{ -#define STRINGCONSTANTS_INCLUDED_INDIRECT -#include "stringconstants.hrc" -#undef STRINGCONSTANTS_INCLUDED_INDIRECT - - //============================================================ - //= configuration key names - //============================================================ - // (we could use PROPERTY_* strings for this, but this would mean that - // our configuration scheme would change if a property name changes for - // any reason) - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DBLINK_CONNECTURL); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DBLINK_USER); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DBLINK_TABLEFILTER); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DBLINK_TABLETYEFILTER); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DBLINK_LOGINTIMEOUT); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DBLINK_PASSWORDREQUIRED); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DBLINK_SUPPRESSVERSIONCL); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DBLINK_BOOKMARKS); - - DECLARE_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_COMMAND); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_ESCAPE_PROCESSING); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_UPDATE_TABLENAME); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_UPDATE_SCHEMANAME); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_UPDATE_CATALOGNAME); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_COLUMNS); - - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FILTER); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_APPLYFILTER); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_ORDER); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_ROW_HEIGHT); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_TEXTCOLOR); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_NAME); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_HEIGHT); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_WIDTH); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_STYLENAME); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_FAMILY); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_CHARSET); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_PITCH); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_CHARACTERWIDTH); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_WEIGHT); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_SLANT); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_UNDERLINE); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_STRIKEOUT); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_ORIENTATION); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_KERNING); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_WORDLINEMODE); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_TYPE); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_UNDERLINECOLOR); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_CHARACTEREMPHASIS); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_CHARACTERRELIEF); - - DECLARE_CONSTASCII_USTRING(CONFIGKEY_SETTINGS); - - DECLARE_CONSTASCII_USTRING(CONFIGKEY_COLUMN_ALIGNMENT); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_COLUMN_WIDTH); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_COLUMN_NUMBERFORMAT); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_COLUMN_RELPOSITION); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_COLUMN_HIDDEN); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_LAYOUTINFORMATION); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_COLUMN_HELPTEXT); - DECLARE_CONSTASCII_USTRING(CONFIGKEY_COLUMN_CONTROLDEFAULT); -} - -#endif // DBACCESS_SHARED_CFGSTRINGS_HRC diff --git a/dbaccess/source/shared/cfg_reghelper.cxx b/dbaccess/source/shared/cfg_reghelper.cxx deleted file mode 100644 index 659f14029..000000000 --- a/dbaccess/source/shared/cfg_reghelper.cxx +++ /dev/null @@ -1,49 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dbaccess.hxx" - -#ifndef CFG_REGHELPER_HXX -#include "cfg_reghelper.hxx" -#endif - -#ifndef _OSL_DIAGNOSE_H_ -#include <osl/diagnose.h> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ -#include <comphelper/sequence.hxx> -#endif - -namespace dbacfg -{ - - #define _REGISTRATIONHELPER_CXX_INCLUDED_INDIRECTLY_ - #include "registrationhelper.cxx" - #undef _REGISTRATIONHELPER_CXX_INCLUDED_INDIRECTLY_ - -} diff --git a/dbaccess/source/shared/cfgstrings.cxx b/dbaccess/source/shared/cfgstrings.cxx deleted file mode 100644 index 22ca71ea4..000000000 --- a/dbaccess/source/shared/cfgstrings.cxx +++ /dev/null @@ -1,91 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dbaccess.hxx" -#include "cfgstrings.hrc" - -namespace dbacfg -{ -#include "stringconstants.inc" - - //============================================================ - //= configuration key names - //============================================================ - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DBLINK_CONNECTURL, "URL"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DBLINK_USER, "User"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DBLINK_TABLEFILTER, "TableFilter"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DBLINK_TABLETYEFILTER, "TableTypeFilter"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DBLINK_LOGINTIMEOUT, "LoginTimeout"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DBLINK_PASSWORDREQUIRED, "IsPasswordRequired"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DBLINK_SUPPRESSVERSIONCL, "SuppressVersionColumns"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DBLINK_BOOKMARKS, "Bookmarks"); - - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_COMMAND, "Command"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_ESCAPE_PROCESSING, "EscapeProcessing"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_UPDATE_TABLENAME, "UpdateTableName"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_UPDATE_SCHEMANAME, "UpdateSchemaName"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_UPDATE_CATALOGNAME, "UpdateCatalogName"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_QRYDESCR_COLUMNS, "Columns"); - - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_SETTINGS, "Settings"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FILTER, "Filter"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_APPLYFILTER, "ApplyFilter"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_ORDER, "Order"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_ROW_HEIGHT, "RowHeight"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_LAYOUTINFORMATION, "LayoutInformation"); - - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_TEXTCOLOR, "TextColor"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_NAME, "Font/Name"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_HEIGHT, "Font/Height"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_WIDTH, "Font/Width"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_STYLENAME, "Font/StyleName"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_FAMILY, "Font/Family"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_CHARSET, "Font/CharSet"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_PITCH, "Font/Pitch"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_CHARACTERWIDTH, "Font/CharacterWidth"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_WEIGHT, "Font/Weight"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_SLANT, "Font/Slant"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_UNDERLINE, "Font/UnderLine"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_STRIKEOUT, "Font/Strikeout"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_ORIENTATION, "Font/Orientation"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_KERNING, "Font/Kerning"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_WORDLINEMODE, "Font/WordLineMode"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_TYPE, "Font/Type"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_UNDERLINECOLOR, "TextLineColor"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_CHARACTEREMPHASIS, "CharacterEmphasis"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_DEFSET_FONT_CHARACTERRELIEF, "CharacterRelief"); - - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_COLUMN_ALIGNMENT, "Align"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_COLUMN_WIDTH, "Width"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_COLUMN_NUMBERFORMAT, "FormatKey"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_COLUMN_RELPOSITION, "Position"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_COLUMN_HIDDEN, "Hidden"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_COLUMN_HELPTEXT, "HelpText"); - IMPLEMENT_CONSTASCII_USTRING(CONFIGKEY_COLUMN_CONTROLDEFAULT, "ControlDefault"); -} - diff --git a/dbaccess/source/shared/makefile.mk b/dbaccess/source/shared/makefile.mk index cbb3686c4..5f75c13f9 100644 --- a/dbaccess/source/shared/makefile.mk +++ b/dbaccess/source/shared/makefile.mk @@ -32,7 +32,6 @@ LIBTARGET=NO TARGET=shared LIB1TARGET=$(SLB)$/dbushared.lib LIB2TARGET=$(SLB)$/fltshared.lib -LIB3TARGET=$(SLB)$/cfgshared.lib LIB4TARGET=$(SLB)$/sdbtshared.lib #ENABLE_EXCEPTIONS=TRUE @@ -46,12 +45,10 @@ LIB4TARGET=$(SLB)$/sdbtshared.lib # --- Files ------------------------------------- EXCEPTIONSFILES= \ $(SLO)$/dbu_reghelper.obj \ - $(SLO)$/cfg_reghelper.obj \ $(SLO)$/flt_reghelper.obj SLOFILES= \ $(EXCEPTIONSFILES) \ - $(SLO)$/cfgstrings.obj \ $(SLO)$/xmlstrings.obj \ $(SLO)$/dbustrings.obj @@ -63,10 +60,6 @@ LIB2OBJFILES= \ $(SLO)$/flt_reghelper.obj \ $(SLO)$/xmlstrings.obj -LIB3OBJFILES= \ - $(SLO)$/cfg_reghelper.obj \ - $(SLO)$/cfgstrings.obj - LIB4OBJFILES= \ $(SLO)$/sdbtstrings.obj diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 23bd7bd99..0cc058a7a 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -737,6 +737,26 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING))) xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser; + { + const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY ); + const Reference< XSingleSelectQueryAnalyzer > xAnalyzer( xRowSetProps->getPropertyValue( PROPERTY_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY ); + if ( xAnalyzer.is() ) + { + const Reference< XIndexAccess > xOrderColumns( xAnalyzer->getOrderColumns(), UNO_SET_THROW ); + const sal_Int32 nOrderColumns( xOrderColumns->getCount() ); + for ( sal_Int32 c=0; c<nOrderColumns; ++c ) + { + const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW ); + ::rtl::OUString sColumnName; + OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumnName); + ::rtl::OUString sTableName; + OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName); + (void)sColumnName; + (void)sTableName; + } + } + } + Reference< XWarningsSupplier > xWarnings( _rxLoadable, UNO_QUERY ); if ( xWarnings.is() ) { @@ -807,7 +827,8 @@ sal_Bool SbaXDataBrowserController::Construct(Window* pParent) m_xColumnsSupplier.set(m_xRowSet,UNO_QUERY); m_xLoadable.set(m_xRowSet,UNO_QUERY); - if (!InitializeForm(m_xRowSet)) + Reference< XPropertySet > xFormProperties( m_xRowSet, UNO_QUERY ); + if ( !InitializeForm( xFormProperties ) ) return sal_False; m_xGridModel = CreateGridModel(); @@ -1205,34 +1226,16 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t } - // the filter or the sort criterias have changed ? -> update our parser - if (evt.PropertyName.equals(PROPERTY_ACTIVECOMMAND)) - { - // if (m_xParser.is()) - //DO_SAFE( m_xParser->setElementaryQuery(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new query to my parser !" ); - } - else if (evt.PropertyName.equals(PROPERTY_FILTER)) + if (evt.PropertyName.equals(PROPERTY_FILTER)) { - // if ( m_xParser.is() && m_xParser->getFilter() != ::comphelper::getString(evt.NewValue)) - //{ - // DO_SAFE( m_xParser->setFilter(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" ); - //} InvalidateFeature(ID_BROWSER_REMOVEFILTER); } else if (evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE)) { - //if ( m_xParser.is() && m_xParser->getHavingClause() != ::comphelper::getString(evt.NewValue)) - //{ - // DO_SAFE( m_xParser->setHavingClause(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" ); - //} InvalidateFeature(ID_BROWSER_REMOVEFILTER); } else if (evt.PropertyName.equals(PROPERTY_ORDER)) { - //if ( m_xParser.is() && m_xParser->getOrder() != ::comphelper::getString(evt.NewValue)) - //{ - // DO_SAFE( m_xParser->setOrder(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new order to my parser !" ); - //} InvalidateFeature(ID_BROWSER_REMOVEFILTER); } @@ -1871,25 +1874,50 @@ void SbaXDataBrowserController::applyParserFilter(const ::rtl::OUString& _rOldFi setCurrentColumnPosition(nPos); } + //------------------------------------------------------------------------------ Reference< XSingleSelectQueryComposer > SbaXDataBrowserController::createParser_nothrow() { - Reference< XSingleSelectQueryComposer > xRet; + Reference< XSingleSelectQueryComposer > xComposer; try { - Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY_THROW); - const Reference<XMultiServiceFactory> xFactory(::dbtools::getConnection(getRowSet()),UNO_QUERY_THROW); - xRet.set(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY_THROW); - xRet->setElementaryQuery(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ACTIVECOMMAND))); - xRet->setFilter(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_FILTER))); - xRet->setHavingClause(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_HAVING_CLAUSE))); - xRet->setOrder(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ORDER))); + const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW ); + const Reference< XMultiServiceFactory > xFactory( + xRowSetProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ), UNO_QUERY_THROW ); + xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY_THROW ); + + ::rtl::OUString sActiveCommand; + OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= sActiveCommand ); + if ( sActiveCommand.getLength() > 0 ) + { + xComposer->setElementaryQuery( sActiveCommand ); + } + else + { + ::rtl::OUString sCommand; + OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand ); + sal_Int32 nCommandType = CommandType::COMMAND; + OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_COMMAND_TYPE ) >>= nCommandType ); + xComposer->setCommand( sCommand, nCommandType ); + } + + ::rtl::OUString sFilter; + OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_FILTER ) >>= sFilter ); + xComposer->setFilter( sFilter ); + + ::rtl::OUString sHavingClause; + OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_HAVING_CLAUSE ) >>= sHavingClause ); + xComposer->setHavingClause( sHavingClause ); + + ::rtl::OUString sOrder; + OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ORDER ) >>= sOrder ); + xComposer->setOrder( sOrder ); } - catch(Exception&) + catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } - return xRet; + return xComposer; } //------------------------------------------------------------------------------ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter) @@ -1911,12 +1939,8 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter) { DlgFilterCrit aDlg( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() ); String aFilter; - if(!aDlg.Execute()) - { - //m_xParser->setFilter(sOldVal); - //m_xParser->setHavingClause(sOldHaving); - return; // if so we don't need to actualize the grid - } + if ( !aDlg.Execute() ) + return; // if so we don't need to update the grid aDlg.BuildWherePart(); } else @@ -1925,7 +1949,6 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter) String aOrder; if(!aDlg.Execute()) { - //m_xParser->setOrder(sOldVal); return; // if so we don't need to actualize the grid } aDlg.BuildOrderPart(); @@ -2707,22 +2730,7 @@ void SbaXDataBrowserController::initializeParser() const { // (only if the statement isn't native) // (it is allowed to use the PROPERTY_ISPASSTHROUGH : _after_ loading a form it is valid) xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser; -/* - const Reference<XMultiServiceFactory> xFactory(::dbtools::getConnection(getRowSet()),UNO_QUERY); - if ( xFactory.is() ) - m_xParser.set(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY); -*/ } -/* - // initialize the parser with the current sql-statement of the form - if ( m_xParser.is() ) - { - m_xParser->setElementaryQuery(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ACTIVECOMMAND))); - m_xParser->setFilter(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_FILTER))); - m_xParser->setHavingClause(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_HAVING_CLAUSE))); - m_xParser->setOrder(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ORDER))); - } -*/ } catch(Exception&) { @@ -2758,16 +2766,6 @@ void SbaXDataBrowserController::unloaded(const EventObject& /*aEvent*/) throw( R // change as a reaction on that event. as we have no chance to be notified of this change (which is // the one we're interested in) we give them time to do what they want to before invalidating our // bound-field-dependent slots .... - /* - try - { - ::comphelper::disposeComponent(m_xParser); - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception thrown by dispose"); - } - */ } //------------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx index 3587f07e5..899b8e2ce 100644 --- a/dbaccess/source/ui/browser/exsrcbrw.cxx +++ b/dbaccess/source/ui/browser/exsrcbrw.cxx @@ -145,7 +145,7 @@ Reference< XRowSet > SbaExternalSourceBrowser::CreateForm() } //------------------------------------------------------------------------------ -sal_Bool SbaExternalSourceBrowser::InitializeForm(const Reference< XRowSet > & /*xForm*/) +sal_Bool SbaExternalSourceBrowser::InitializeForm(const Reference< XPropertySet > & /*i_formProperties*/) { return sal_True; } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 451840e9a..548977dfe 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -67,6 +67,7 @@ #include <com/sun/star/form/XForm.hpp> #include <com/sun/star/form/XGridColumnFactory.hpp> #include <com/sun/star/form/XLoadable.hpp> +#include <com/sun/star/form/XReset.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -419,8 +420,146 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent) return sal_True; } -// ------------------------------------------------------------------------- -sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star::sdbc::XRowSet > & _rxForm) +// --------------------------------------------------------------------------------------------------------------------- +namespace +{ + // ----------------------------------------------------------------------------------------------------------------- + struct SelectValueByName : public ::std::unary_function< ::rtl::OUString, Any > + { + const Any& operator()( ::rtl::OUString const& i_name ) const + { + return m_rCollection.get( i_name ); + } + + SelectValueByName( ::comphelper::NamedValueCollection const& i_collection ) + :m_rCollection( i_collection ) + { + } + + ::comphelper::NamedValueCollection const& m_rCollection; + }; +} + +// --------------------------------------------------------------------------------------------------------------------- +void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow() +{ + try + { + Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY_THROW ); + sal_Bool bEscapeProcessing = sal_False; + OSL_VERIFY( xRowSetProps->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing ); + if ( !bEscapeProcessing ) + // don't touch or interpret anything if escape processing is disabled + return; + + Reference< XSingleSelectQueryComposer > xComposer( createParser_nothrow() ); + if ( !xComposer.is() ) + // can't do anything. Already reported via assertion in createParser_nothrow. + return; + + // the tables participating in the statement + const Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY_THROW ); + const Reference< XNameAccess > xTableNames( xSuppTables->getTables(), UNO_QUERY_THROW ); + + // the columns participating in the statement + const Reference< XColumnsSupplier > xSuppColumns( xComposer, UNO_QUERY_THROW ); + const Reference< XNameAccess > xColumnNames( xSuppColumns->getColumns(), UNO_QUERY_THROW ); + + // ............................................................................................................. + // check if the order columns apply to tables which really exist in the statement + const Reference< XIndexAccess > xOrderColumns( xComposer->getOrderColumns(), UNO_SET_THROW ); + const sal_Int32 nOrderColumns( xOrderColumns->getCount() ); + bool invalidColumn = false; + for ( sal_Int32 c=0; ( c < nOrderColumns ) && !invalidColumn; ++c ) + { + const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW ); + ::rtl::OUString sTableName; + OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName ); + ::rtl::OUString sColumnName; + OSL_VERIFY( xOrderColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumnName ); + + if ( sTableName.getLength() == 0 ) + { + if ( !xColumnNames->hasByName( sColumnName ) ) + { + invalidColumn = true; + break; + } + } + else + { + if ( !xTableNames->hasByName( sTableName ) ) + { + invalidColumn = true; + break; + } + + const Reference< XColumnsSupplier > xSuppTableColumns( xTableNames->getByName( sTableName ), UNO_QUERY_THROW ); + const Reference< XNameAccess > xTableColumnNames( xSuppTableColumns->getColumns(), UNO_QUERY_THROW ); + if ( !xTableColumnNames->hasByName( sColumnName ) ) + { + invalidColumn = true; + break; + } + } + } + + if ( invalidColumn ) + { + // reset the complete order statement at both the row set and the parser + const ::rtl::OUString sEmptyOrder; + xRowSetProps->setPropertyValue( PROPERTY_ORDER, makeAny( sEmptyOrder ) ); + xComposer->setOrder( sEmptyOrder ); + } + + // ............................................................................................................. + // check if the columns participating in the filter refer to existing tables + // TODO: there's no API at all for this. The method which comes nearest to what we need is + // "getStructuredFilter", but it returns pure column names only. That is, for a statement like + // "SELECT * FROM <table> WHERE <other_table>.<column> = <value>", it will return "<column>". But + // there's no API at all to retrieve the information about "<other_table>" - which is what would + // be needed here. + // That'd be a chance to replace getStructuredFilter with something more reasonable. This method + // has at least one other problem: For a clause like "<column> != <value>", it will return "<column>" + // as column name, "NOT_EQUAL" as operator, and "!= <value>" as value, effectively duplicating the + // information about the operator, and beding all clients to manually remove the "!=" from the value + // string. + // So, what really would be handy, is some + // XNormalizedFilter getNormalizedFilter(); + // with + // interface XDisjunctiveFilterExpression + // { + // XConjunctiveFilterTerm getTerm( int index ); + // } + // interface XConjunctiveFilterTerm + // { + // ComparisonPredicate getPredicate( int index ); + // } + // struct ComparisonPredicate + // { + // XComparisonOperand Lhs; + // SQLFilterOperator Operator; + // XComparisonOperand Rhs; + // } + // interface XComparisonOperand + // { + // SQLFilterOperand Type; + // XPropertySet getColumn(); + // string getLiteral(); + // ... + // } + // enum SQLFilterOperand { Column, Literal, ... } + // + // ... or something like this .... + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +// --------------------------------------------------------------------------------------------------------------------- +sal_Bool SbaTableQueryBrowser::InitializeForm( const Reference< XPropertySet > & i_formProperties ) { if(!m_pCurrentlyDisplayed) return sal_True; @@ -428,50 +567,46 @@ sal_Bool SbaTableQueryBrowser::InitializeForm(const Reference< ::com::sun::star: // this method set all format settings from the orignal table or query try { - // we send all properties at once, maybe the implementation is clever enough to handle one big PropertiesChanged - // more effective than many small PropertyChanged ;) - Sequence< ::rtl::OUString> aProperties(3); - Sequence< Any> aValues(3); - DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(m_pCurrentlyDisplayed->GetUserData()); - OSL_ENSURE( pData, "SbaTableQueryBrowser::InitializeForm: No user data set at the currently displayed entry!" ); - OSL_ENSURE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeForm: No table available!" ); + ENSURE_OR_RETURN_FALSE( pData, "SbaTableQueryBrowser::InitializeForm: No user data set at the currently displayed entry!" ); + ENSURE_OR_RETURN_FALSE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeForm: No table available!" ); + + Reference< XPropertySetInfo > xPSI( pData->xObjectProperties->getPropertySetInfo(), UNO_SET_THROW ); + + ::comphelper::NamedValueCollection aPropertyValues; - if ( pData->xObjectProperties.is() ) + const ::rtl::OUString aTransferProperties[] = { - sal_Int32 nPos = 0; - // is the filter intially applied ? - aProperties.getArray()[nPos] = PROPERTY_APPLYFILTER; - aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_APPLYFILTER); + PROPERTY_APPLYFILTER, + PROPERTY_FILTER, + PROPERTY_HAVING_CLAUSE, + PROPERTY_ORDER + }; + for ( size_t i=0; i < sizeof( aTransferProperties ) / sizeof( aTransferProperties[0] ); ++i ) + { + if ( !xPSI->hasPropertyByName( aTransferProperties[i] ) ) + continue; + aPropertyValues.put( aTransferProperties[i], pData->xObjectProperties->getPropertyValue( aTransferProperties[i] ) ); + } - // the initial filter - aProperties.getArray()[nPos] = PROPERTY_FILTER; - aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_FILTER); + const ::std::vector< ::rtl::OUString > aNames( aPropertyValues.getNames() ); + Sequence< ::rtl::OUString > aPropNames( aNames.size() ); + ::std::copy( aNames.begin(), aNames.end(), aPropNames.getArray() ); - if ( pData->xObjectProperties->getPropertySetInfo()->hasPropertyByName(PROPERTY_HAVING_CLAUSE) ) - { - aProperties.realloc(aProperties.getLength()+1); - aValues.realloc(aValues.getLength()+1); - // the initial having clause - aProperties.getArray()[nPos] = PROPERTY_HAVING_CLAUSE; - aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_HAVING_CLAUSE); - } + Sequence< Any > aPropValues( aNames.size() ); + ::std::transform( aNames.begin(), aNames.end(), aPropValues.getArray(), SelectValueByName( aPropertyValues ) ); - // the initial ordering - aProperties.getArray()[nPos] = PROPERTY_ORDER; - aValues.getArray()[nPos++] = pData->xObjectProperties->getPropertyValue(PROPERTY_ORDER); + Reference< XMultiPropertySet > xFormMultiSet( i_formProperties, UNO_QUERY_THROW ); + xFormMultiSet->setPropertyValues( aPropNames, aPropValues ); - Reference< XMultiPropertySet > xFormMultiSet(_rxForm, UNO_QUERY); - xFormMultiSet->setPropertyValues(aProperties, aValues); - } + impl_sanitizeRowSetClauses_nothrow(); } - catch(Exception&) + catch ( const Exception& ) { - DBG_ERROR("SbaTableQueryBrowser::InitializeForm : something went wrong !"); + DBG_UNHANDLED_EXCEPTION(); return sal_False; } - return sal_True; } @@ -601,6 +736,7 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun:: ::std::vector< NamedValue > aInitialValues; ::std::vector< ::rtl::OUString > aCopyProperties; + Any aDefault; switch(nType) { @@ -617,6 +753,8 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun:: ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TriState" ) ), makeAny( sal_Bool( ColumnValue::NO_NULLS != nNullable ) ) ) ); + if ( ColumnValue::NO_NULLS == nNullable ) + aDefault <<= (sal_Int16)STATE_NOCHECK; } break; @@ -658,18 +796,17 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun:: Reference< XPropertySetInfo > xGridColPSI( xGridCol->getPropertySetInfo(), UNO_SET_THROW ); // calculate the default - Any aDefault; if ( xGridColPSI->hasPropertyByName( PROPERTY_CONTROLDEFAULT ) ) - aDefault = xColumn->getPropertyValue( PROPERTY_CONTROLDEFAULT ); - - // default value - if ( nType == DataType::BIT || nType == DataType::BOOLEAN ) { - if ( aDefault.hasValue() ) - aDefault <<= (comphelper::getString(aDefault).toInt32() == 0) ? (sal_Int16)STATE_NOCHECK : (sal_Int16)STATE_CHECK; - else - aDefault <<= ((sal_Int16)STATE_DONTKNOW); - + aDefault = xColumn->getPropertyValue( PROPERTY_CONTROLDEFAULT ); + // default value + if ( nType == DataType::BIT || nType == DataType::BOOLEAN ) + { + if ( aDefault.hasValue() ) + aDefault <<= (comphelper::getString(aDefault).toInt32() == 0) ? (sal_Int16)STATE_NOCHECK : (sal_Int16)STATE_CHECK; + else + aDefault <<= ((sal_Int16)STATE_DONTKNOW); + } } if ( aDefault.hasValue() ) @@ -2293,77 +2430,82 @@ sal_Bool SbaTableQueryBrowser::implSelect(const ::svx::ODataAccessDescriptor& _r sal_Bool SbaTableQueryBrowser::implLoadAnything(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rCommand, const sal_Int32 _nCommandType, const sal_Bool _bEscapeProcessing, const SharedConnection& _rxConnection) { - Reference<XPropertySet> xProp(getRowSet(),UNO_QUERY); - if(xProp.is()) + try { - Reference< ::com::sun::star::form::XLoadable > xLoadable(xProp,UNO_QUERY); - try + Reference<XPropertySet> xProp( getRowSet(), UNO_QUERY_THROW ); + Reference< XLoadable > xLoadable( xProp, UNO_QUERY_THROW ); + // the values allowing the RowSet to re-execute + xProp->setPropertyValue(PROPERTY_DATASOURCENAME, makeAny(_rDataSourceName)); + if(_rxConnection.is()) + xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( _rxConnection.getTyped() ) ); + + // set this _before_ setting the connection, else the rowset would rebuild it ... + xProp->setPropertyValue(PROPERTY_COMMAND_TYPE, makeAny(_nCommandType)); + xProp->setPropertyValue(PROPERTY_COMMAND, makeAny(_rCommand)); + xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, ::cppu::bool2any(_bEscapeProcessing)); + if ( m_bPreview ) { - // the values allowing the RowSet to re-execute - xProp->setPropertyValue(PROPERTY_DATASOURCENAME, makeAny(_rDataSourceName)); - if(_rxConnection.is()) - xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( _rxConnection.getTyped() ) ); - - // set this _before_ setting the connection, else the rowset would rebuild it ... - xProp->setPropertyValue(PROPERTY_COMMAND_TYPE, makeAny(_nCommandType)); - xProp->setPropertyValue(PROPERTY_COMMAND, makeAny(_rCommand)); - xProp->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, ::cppu::bool2any(_bEscapeProcessing)); - if ( m_bPreview ) - { - xProp->setPropertyValue(PROPERTY_FETCHDIRECTION, makeAny(FetchDirection::FORWARD)); - } + xProp->setPropertyValue(PROPERTY_FETCHDIRECTION, makeAny(FetchDirection::FORWARD)); + } - // the formatter depends on the data source we're working on, so rebuild it here ... - initFormatter(); + // the formatter depends on the data source we're working on, so rebuild it here ... + initFormatter(); - // switch the grid to design mode while loading - getBrowserView()->getGridControl()->setDesignMode(sal_True); - InitializeForm(getRowSet()); + // switch the grid to design mode while loading + getBrowserView()->getGridControl()->setDesignMode(sal_True); + InitializeForm( xProp ); - sal_Bool bSuccess = sal_True; + sal_Bool bSuccess = sal_True; + { { - { - Reference< XNameContainer > xColContainer(getFormComponent(), UNO_QUERY); - // first we have to clear the grid - clearGridColumns(xColContainer); - } - FormErrorHelper aHelper(this); - // load the form - bSuccess = reloadForm(xLoadable); - - // initialize the model - InitializeGridModel(getFormComponent()); - - if ( m_bPreview ) - initializePreviewMode(); - - LoadFinished(sal_True); + Reference< XNameContainer > xColContainer(getFormComponent(), UNO_QUERY); + // first we have to clear the grid + clearGridColumns(xColContainer); } + FormErrorHelper aHelper(this); + // load the form + bSuccess = reloadForm(xLoadable); - InvalidateAll(); - return bSuccess; - } - catch( const SQLException& e ) - { - Any aException( ::cppu::getCaughtException() ); - showError( SQLExceptionInfo( aException ) ); - } - catch( const WrappedTargetException& e ) - { - SQLException aSql; - if ( e.TargetException.isExtractableTo( ::cppu::UnoType< SQLException >::get() ) ) - showError( SQLExceptionInfo( e.TargetException ) ); - else + // initialize the model + InitializeGridModel(getFormComponent()); + + Any aVal = xProp->getPropertyValue(PROPERTY_ISNEW); + if (aVal.hasValue() && ::comphelper::getBOOL(aVal)) { - DBG_UNHANDLED_EXCEPTION(); + // then set the default values and the parameters given from the parent + Reference< XReset> xReset(xProp, UNO_QUERY); + xReset->reset(); } + + if ( m_bPreview ) + initializePreviewMode(); + + LoadFinished(sal_True); } - catch(Exception&) + + InvalidateAll(); + return bSuccess; + } + catch( const SQLException& e ) + { + Any aException( ::cppu::getCaughtException() ); + showError( SQLExceptionInfo( aException ) ); + } + catch( const WrappedTargetException& e ) + { + SQLException aSql; + if ( e.TargetException.isExtractableTo( ::cppu::UnoType< SQLException >::get() ) ) + showError( SQLExceptionInfo( e.TargetException ) ); + else { DBG_UNHANDLED_EXCEPTION(); } } + catch(Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } InvalidateAll(); return sal_False; diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index 8c1c79557..72eacab68 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -97,9 +97,12 @@ namespace dbaui ,m_pPrimaryKeySupport(NULL) ,m_pBooleanComparisonModeLabel( NULL ) ,m_pBooleanComparisonMode( NULL ) + ,m_pMaxRowScanLabel( NULL ) + ,m_pMaxRowScan( NULL ) ,m_aControlDependencies() ,m_aBooleanSettings() ,m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) ) + ,m_bHasMaxRowScan( _rDSMeta.getFeatureSet().has( DSID_MAX_ROW_SCAN ) ) { impl_initBooleanSettings(); @@ -164,6 +167,21 @@ namespace dbaui m_pBooleanComparisonModeLabel->SetPosPixel( Point( aLabelPos.X(), aLabelPos.Y() - nMoveUp ) ); m_pBooleanComparisonMode->SetPosPixel( Point( aControlPos.X(), aControlPos.Y() - nMoveUp ) ); } + // create the controls for the max row scan + if ( m_bHasMaxRowScan ) + { + m_pMaxRowScanLabel = new FixedText( this, ModuleRes( FT_MAXROWSCAN ) ); + m_pMaxRowScan = new NumericField( this, ModuleRes( NF_MAXROWSCAN ) ); + m_pMaxRowScan->SetModifyHdl(getControlModifiedLink()); + m_pMaxRowScan->SetUseThousandSep(sal_False); + + Point aLabelPos( m_pMaxRowScanLabel->GetPosPixel() ); + Point aControlPos( m_pMaxRowScan->GetPosPixel() ); + long nMoveUp = aControlPos.Y() - aPos.Y(); + + m_pMaxRowScanLabel->SetPosPixel( Point( aLabelPos.X(), aLabelPos.Y() - nMoveUp ) ); + m_pMaxRowScan->SetPosPixel( Point( aControlPos.X(), aControlPos.Y() - nMoveUp ) ); + } FreeResource(); } @@ -190,6 +208,8 @@ namespace dbaui DELETEZ( m_pPrimaryKeySupport ); DELETEZ( m_pBooleanComparisonModeLabel ); DELETEZ( m_pBooleanComparisonMode ); + DELETEZ( m_pMaxRowScanLabel ); + DELETEZ( m_pMaxRowScan ); } // ----------------------------------------------------------------------- @@ -230,6 +250,10 @@ namespace dbaui { _rControlList.push_back( new ODisableWrapper< FixedText >( m_pBooleanComparisonModeLabel ) ); } + if ( m_bHasMaxRowScan ) + { + _rControlList.push_back( new ODisableWrapper< FixedText >( m_pMaxRowScanLabel ) ); + } } // ----------------------------------------------------------------------- @@ -248,6 +272,8 @@ namespace dbaui if ( m_bHasBooleanComparisonMode ) _rControlList.push_back( new OSaveValueWrapper< ListBox >( m_pBooleanComparisonMode ) ); + if ( m_bHasMaxRowScan ) + _rControlList.push_back(new OSaveValueWrapper<NumericField>(m_pMaxRowScan)); } // ----------------------------------------------------------------------- @@ -306,6 +332,12 @@ namespace dbaui m_pBooleanComparisonMode->SelectEntryPos( static_cast< USHORT >( pBooleanComparison->GetValue() ) ); } + if ( m_bHasMaxRowScan ) + { + SFX_ITEMSET_GET(_rSet, pMaxRowScan, SfxInt32Item, DSID_MAX_ROW_SCAN, sal_True); + m_pMaxRowScan->SetValue(pMaxRowScan->GetValue()); + } + OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue); } @@ -334,6 +366,10 @@ namespace dbaui bChangedSomething = sal_True; } } + if ( m_bHasMaxRowScan ) + { + fillInt32(_rSet,m_pMaxRowScan,DSID_MAX_ROW_SCAN,bChangedSomething); + } return bChangedSomething; } diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc index 8a09c0adc..320683897 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hrc +++ b/dbaccess/source/ui/dlg/advancedsettings.hrc @@ -69,7 +69,9 @@ #define FT_AUTOINCREMENTVALUE 1 #define FT_RETRIEVE_AUTO 2 #define FT_BOOLEANCOMPARISON 3 +#define FT_MAXROWSCAN 4 #define LB_BOOLEANCOMPARISON 1 +#define NF_MAXROWSCAN 1 #endif // DBAUI_ADVANCEDSETTINGS_HRC diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx index 31e1b49c7..118b758e6 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hxx +++ b/dbaccess/source/ui/dlg/advancedsettings.hxx @@ -37,6 +37,7 @@ #include <svtools/dialogcontrolling.hxx> #include <vcl/lstbox.hxx> +#include <vcl/field.hxx> #include <vector> @@ -76,12 +77,16 @@ namespace dbaui FixedText* m_pBooleanComparisonModeLabel; ListBox* m_pBooleanComparisonMode; + FixedText* m_pMaxRowScanLabel; + NumericField* m_pMaxRowScan; + ::svt::ControlDependencyManager m_aControlDependencies; BooleanSettingDescs m_aBooleanSettings; bool m_bHasBooleanComparisonMode; + bool m_bHasMaxRowScan; public: virtual BOOL FillItemSet ( SfxItemSet& _rCoreAttrs ); diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src index 50162f1cc..afff07fc7 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.src +++ b/dbaccess/source/ui/dlg/advancedsettings.src @@ -249,6 +249,24 @@ WORKAROUND \ }; \ +#define AUTO_MAXROWSCAN(AUTO_Y) \ + FixedText FT_MAXROWSCAN \ + { \ + Pos = MAP_APPFONT ( START_X , AUTO_Y + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) ; \ + Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ); \ + Text [ en-US ] = "Rows to scan column types"; \ + }; \ + NumericField NF_MAXROWSCAN \ + { \ + Pos = MAP_APPFONT ( START_X + 100, AUTO_Y ) ; \ + Size = MAP_APPFONT ( 60 , EDIT_HEIGHT ) ; \ + TabStop = TRUE ; \ + NoThousandSep = TRUE; \ + Border = TRUE; \ + HelpId = HID_DSADMIN_MAXROWSCAN; \ + }; \ + + //------------------------------------------------------------------------- TabPage PAGE_GENERATED_VALUES @@ -334,6 +352,7 @@ TabPage PAGE_ADVANCED_SETTINGS_SPECIAL AUTO_ESCAPE_DATETIME( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_PRIMARY_KEY_SUPPORT( 15*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_BOOLEANCOMPARISON( 16*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) + AUTO_MAXROWSCAN( 17*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) }; //------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 481ee3981..57960dc48 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -410,6 +410,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True); *pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, String()); *pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT ); + *pCounter++ = new SfxInt32Item(DSID_MAX_ROW_SCAN, 100); // create the pool static SfxItemInfo __READONLY_DATA aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] = @@ -472,6 +473,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp {0,0}, {0,0}, {0,0}, + {0,0}, {0,0} }; diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx index 1a1193592..e8af8bcee 100644 --- a/dbaccess/source/ui/inc/brwctrlr.hxx +++ b/dbaccess/source/ui/inc/brwctrlr.hxx @@ -254,7 +254,8 @@ namespace dbaui // (probably this needs not to be overloaded, but you may return anything you want as long as it // supports the ::com::sun::star::form::DatabaseForm service. For instance you may want to create an adapter here which // is synchronized with a foreign ::com::sun::star::form::DatabaseForm you got elsewhere) - virtual sal_Bool InitializeForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & xForm) = 0; + virtual sal_Bool InitializeForm( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_formProperties ) = 0; // called immediately after a successfull CreateForm // do any initialization (data source etc.) here. the form should be fully functional after that. // return sal_False if you didn't succeed (don't throw exceptions, they won't be caught) @@ -325,8 +326,11 @@ namespace dbaui /// loads or reloads the form virtual sal_Bool reloadForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >& _rxLoadable); - virtual sal_Bool preReloadForm(){ return sal_False; } - virtual void postReloadForm(){} + virtual sal_Bool preReloadForm(){ return sal_False; } + virtual void postReloadForm(){} + + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > + createParser_nothrow(); private: void setCurrentModified( sal_Bool _bSet ); @@ -346,7 +350,6 @@ namespace dbaui void addColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel); void impl_checkForCannotSelectUnfiltered( const ::dbtools::SQLExceptionInfo& _rError ); - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > createParser_nothrow(); // time to check the CUT/COPY/PASTE-slot-states DECL_LINK( OnInvalidateClipboard, AutoTimer* ); diff --git a/dbaccess/source/ui/inc/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx index 02825c46a..deb36c70e 100644 --- a/dbaccess/source/ui/inc/dsitems.hxx +++ b/dbaccess/source/ui/inc/dsitems.hxx @@ -92,6 +92,7 @@ typedef sal_Int32 ItemID; #define DSID_ESCAPE_DATETIME 57 #define DSID_NAMED_PIPE 58 #define DSID_PRIMARY_KEY_SUPPORT 59 +#define DSID_MAX_ROW_SCAN 60 // don't forget to adjust DSID_LAST_ITEM_ID below! @@ -99,7 +100,7 @@ typedef sal_Int32 ItemID; //= item range. Adjust this if you introduce new items above #define DSID_FIRST_ITEM_ID DSID_NAME -#define DSID_LAST_ITEM_ID DSID_PRIMARY_KEY_SUPPORT +#define DSID_LAST_ITEM_ID DSID_MAX_ROW_SCAN #endif // _DBAUI_DATASOURCEITEMS_HXX_ diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx index 7cd5beafc..9ed7afdd0 100644 --- a/dbaccess/source/ui/inc/dsmeta.hxx +++ b/dbaccess/source/ui/inc/dsmeta.hxx @@ -132,6 +132,7 @@ namespace dbaui || has( DSID_IGNORECURRENCY ) || has( DSID_ESCAPE_DATETIME ) || has( DSID_PRIMARY_KEY_SUPPORT ) + || has( DSID_MAX_ROW_SCAN ) ; } diff --git a/dbaccess/source/ui/inc/exsrcbrw.hxx b/dbaccess/source/ui/inc/exsrcbrw.hxx index 81851c0f3..f2eff7673 100644 --- a/dbaccess/source/ui/inc/exsrcbrw.hxx +++ b/dbaccess/source/ui/inc/exsrcbrw.hxx @@ -96,7 +96,7 @@ namespace dbaui ~SbaExternalSourceBrowser(); virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > CreateForm(); - virtual sal_Bool InitializeForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & xForm); + virtual sal_Bool InitializeForm( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_formProperties ); virtual sal_Bool LoadForm(); diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx index e87f1caf1..0782afe2f 100644 --- a/dbaccess/source/ui/inc/unodatbr.hxx +++ b/dbaccess/source/ui/inc/unodatbr.hxx @@ -265,7 +265,7 @@ namespace dbaui protected: // SbaXDataBrowserController overridables - virtual sal_Bool InitializeForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & xForm); + virtual sal_Bool InitializeForm( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_formProperties ); virtual sal_Bool InitializeGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid); virtual sal_Bool preReloadForm(); @@ -531,6 +531,10 @@ namespace dbaui of the load process */ void initializePreviewMode(); + + /** checks whether the Order/Filter clauses set at our row set are valid, removes them if not so + */ + void impl_sanitizeRowSetClauses_nothrow(); }; // ......................................................................... diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx index e0069d3e2..4b3af7c59 100644 --- a/dbaccess/source/ui/misc/dsmeta.cxx +++ b/dbaccess/source/ui/misc/dsmeta.cxx @@ -93,6 +93,7 @@ namespace dbaui { DSID_IGNORECURRENCY, "IgnoreCurrency" }, { DSID_ESCAPE_DATETIME, "EscapeDateTime" }, { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" }, + { DSID_MAX_ROW_SCAN, "MaxRowScan" }, { 0, NULL } }; return s_aMappings; diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index facc14ce3..0fed796e5 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -1957,7 +1957,7 @@ namespace pJoinType = pNode->getChild(2); } - if (SQL_ISRULE(pJoinType,join_type) && SQL_ISTOKEN(pJoinType->getChild(0),INNER)) + if (SQL_ISRULE(pJoinType,join_type) && (!pJoinType->count() || SQL_ISTOKEN(pJoinType->getChild(0),INNER))) { eJoinType = INNER_JOIN; } diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 032e5b117..46179356c 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1178,8 +1178,15 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou aSourceColTypes.reserve( nCount + 1 ); aSourceColTypes.push_back( -1 ); // just to avoid a everytime i-1 call + ::std::vector< sal_Int32 > aSourcePrec; + aSourcePrec.reserve( nCount + 1 ); + aSourcePrec.push_back( -1 ); // just to avoid a everytime i-1 call + for ( sal_Int32 k=1; k <= nCount; ++k ) + { aSourceColTypes.push_back( xMeta->getColumnType( k ) ); + aSourcePrec.push_back( xMeta->getPrecision( k ) ); + } // now create, fill and execute the prepared statement Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatment( xDestMetaData, _rxDestTable, aColumnMapping ), UNO_SET_THROW ); @@ -1291,7 +1298,6 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou case DataType::LONGVARBINARY: case DataType::BINARY: case DataType::VARBINARY: - case DataType::BIT: aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes ); break; @@ -1306,8 +1312,15 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou case DataType::TIMESTAMP: aTransfer.transferComplexValue( &XRow::getTimestamp, &XParameters::setTimestamp ); break; - - case DataType::BOOLEAN: + + case DataType::BIT: + if ( aSourcePrec[nSourceColumn] > 1 ) + { + aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes ); + break; + } + // run through + case DataType::BOOLEAN: aTransfer.transferValue( &XRow::getBoolean, &XParameters::setBoolean ); break; diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index 0c5ebd8c3..9850d9925 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -248,7 +248,12 @@ long ODesignView::PreNotify( NotifyEvent& rNEvt ) switch(rNEvt.GetType()) { case EVENT_KEYINPUT: - //if ( nRet != 1L ) + if ( (m_pPropWin && m_pPropWin->HasChildPathFocus()) ) + return 0L; + if ( (m_pAddField && m_pAddField->HasChildPathFocus()) ) + return 0L; + if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) ) + return 0L; { const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); if ( handleKeyEvent(*pKeyEvent) ) diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 3115b3f03..20ff68a17 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -164,7 +164,9 @@ #include <unotools/confignode.hxx> #include <helpids.hrc> -#define MAX_ROWS_FOR_PREVIEW 50 +#include <ReportControllerObserver.hxx> + +#define MAX_ROWS_FOR_PREVIEW 20 using namespace ::com::sun::star; using namespace uno; @@ -578,7 +580,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const case SID_EXPAND_SECTION: case SID_NEXT_MARK: case SID_PREV_MARK: - aReturn.bEnabled = isEditable(); + aReturn.bEnabled = isEditable() && !getDesignView()->isHandleEvent(_nId); break; case SID_SELECT: case SID_SELECT_REPORT: |