summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-04-22 15:07:40 +0200
committerJan Holesovsky <kendy@suse.cz>2011-04-22 15:07:40 +0200
commitbc3bbd2bb4b629ec612beeeeadd959a2fb6426c2 (patch)
tree230225ef40deb8214edb308a21876f642b341942
parent2933795a13ec243e9bff571583df409266746164 (diff)
parent1ba7b7c30f13bc3764a338a5a90c2fc7ff09afa6 (diff)
Merge commit 'ooo/DEV300_m106' into libreoffice-3-4
Conflicts: dbaccess/source/core/api/CacheSet.cxx dbaccess/source/core/api/KeySet.cxx dbaccess/source/core/api/KeySet.hxx dbaccess/source/core/api/OptimisticSet.hxx dbaccess/source/core/api/RowSet.cxx dbaccess/source/core/api/RowSetCache.cxx dbaccess/source/core/api/query.cxx dbaccess/source/core/dataaccess/SharedConnection.cxx dbaccess/source/ui/app/AppController.cxx dbaccess/source/ui/app/makefile.mk dbaccess/source/ui/control/FieldDescControl.cxx dbaccess/source/ui/querydesign/query.src dbaccess/source/ui/tabledesign/TEditControl.cxx reportdesign/source/ui/report/ReportController.cxx reportdesign/source/ui/report/ReportSection.cxx reportdesign/source/ui/report/SectionWindow.cxx reportdesign/source/ui/report/StartMarker.cxx reportdesign/source/ui/report/ViewsWindow.cxx
-rw-r--r--dbaccess/inc/dbaccess_helpid.hrc1
-rw-r--r--dbaccess/qa/complex/dbaccess/Query.java49
-rw-r--r--dbaccess/qa/complex/dbaccess/RowSet.java4
-rwxr-xr-xdbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java84
-rw-r--r--dbaccess/source/core/api/CacheSet.cxx15
-rw-r--r--dbaccess/source/core/api/CacheSet.hxx3
-rw-r--r--dbaccess/source/core/api/KeySet.cxx61
-rw-r--r--dbaccess/source/core/api/KeySet.hxx9
-rw-r--r--dbaccess/source/core/api/OptimisticSet.cxx5
-rw-r--r--dbaccess/source/core/api/OptimisticSet.hxx3
-rw-r--r--dbaccess/source/core/api/RowSet.cxx87
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx9
-rw-r--r--dbaccess/source/core/api/RowSetBase.hxx3
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx163
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx28
-rw-r--r--dbaccess/source/core/dataaccess/SharedConnection.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx2
-rw-r--r--dbaccess/source/core/misc/DatabaseDataProvider.cxx2
-rw-r--r--dbaccess/source/ui/app/AppController.cxx106
-rw-r--r--dbaccess/source/ui/app/AppControllerGen.cxx1
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx8
-rw-r--r--dbaccess/source/ui/app/app.src6
-rw-r--r--dbaccess/source/ui/app/closeveto.cxx180
-rw-r--r--dbaccess/source/ui/app/closeveto.hxx67
-rw-r--r--dbaccess/source/ui/app/makefile.mk3
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx18
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx3
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx58
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx30
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx2
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx33
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hrc1
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx1
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.src17
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx2
-rw-r--r--dbaccess/source/ui/inc/dbu_qry.hrc4
-rw-r--r--dbaccess/source/ui/inc/dsitems.hxx3
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx1
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx3
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx3
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx1
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx12
-rw-r--r--dbaccess/source/ui/querydesign/query.src8
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx1
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx22
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx32
-rw-r--r--reportdesign/source/ui/inc/ReportSection.hxx4
-rw-r--r--reportdesign/source/ui/inc/ReportWindow.hxx9
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx8
-rw-r--r--reportdesign/source/ui/misc/ColorListener.cxx16
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx23
-rw-r--r--reportdesign/source/ui/report/DesignView.cxx5
-rw-r--r--reportdesign/source/ui/report/EndMarker.cxx5
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx8
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx163
-rw-r--r--reportdesign/source/ui/report/ReportWindow.cxx14
-rw-r--r--reportdesign/source/ui/report/SectionView.cxx1
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx29
-rw-r--r--reportdesign/source/ui/report/StartMarker.cxx17
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx78
-rw-r--r--reportdesign/source/ui/report/dlgedfunc.cxx16
61 files changed, 1062 insertions, 490 deletions
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index 29094bee1882..bb37eb5affff 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -436,6 +436,7 @@
#define HID_DSADMIN_IGNORECURRENCY "DBACCESS_HID_DSADMIN_IGNORECURRENCY"
#define HID_MACRO_MIGRATION_BACKUP_LOCATION "DBACCESS_HID_MACRO_MIGRATION_BACKUP_LOCATION"
#define HID_DSADMIN_PRIMARY_KEY_SUPPORT "DBACCESS_HID_DSADMIN_PRIMARY_KEY_SUPPORT"
+#define HID_DSADMIN_RESPECTRESULTSETTYPE "DBACCESS_HID_DSADMIN_RESPECTRESULTSETTYPE"
// this one below have hid in number space HID_SBA_START
#define HID_DLG_ADABAS_NEWDB "DBACCESS_HID_DLG_ADABAS_NEWDB"
diff --git a/dbaccess/qa/complex/dbaccess/Query.java b/dbaccess/qa/complex/dbaccess/Query.java
index e78f6859fb88..40af4387bb5c 100644
--- a/dbaccess/qa/complex/dbaccess/Query.java
+++ b/dbaccess/qa/complex/dbaccess/Query.java
@@ -40,7 +40,8 @@ import org.junit.Test;
import static org.junit.Assert.*;
// ------------------------------------------
-public class Query extends TestCase {
+public class Query extends TestCase
+{
connectivity.tools.HsqlDatabase m_database;
@@ -49,17 +50,17 @@ public class Query extends TestCase {
{
try
{
- if ( m_database == null )
+ if (m_database == null)
{
- final CRMDatabase database = new CRMDatabase( getMSF(), false );
+ final CRMDatabase database = new CRMDatabase(getMSF(), false);
m_database = database.getDatabase();
}
}
- catch( Exception e )
+ catch (Exception e)
{
- System.out.println( "could not create the test case, error message:\n" + e.getMessage() );
- e.printStackTrace( System.err );
- fail( "failed to created the test case");
+ System.out.println("could not create the test case, error message:\n" + e.getMessage());
+ e.printStackTrace(System.err);
+ fail("failed to created the test case");
}
}
@@ -68,7 +69,6 @@ public class Query extends TestCase {
// {
// return (XMultiServiceFactory)param.getMSF();
// }
-
// --------------------------------------------------------------------------------------------------------
@Test
public void testQueryColumns()
@@ -90,23 +90,26 @@ public class Query extends TestCase {
for ( int i = 0; i < queryNames.length; ++i )
{
- final XPropertySet query = UnoRuntime.queryInterface(
- XPropertySet.class, queries.getByName( queryNames[i] ) );
+ if (queries.hasByName(queryNames[i]))
+ {
+ final XPropertySet query = UnoRuntime.queryInterface(
+ XPropertySet.class, queries.getByName( queryNames[i] ) );
- final XColumnsSupplier suppCols = UnoRuntime.queryInterface(
- XColumnsSupplier.class, query);
- final XIndexAccess columns = UnoRuntime.queryInterface(
- XIndexAccess.class, suppCols.getColumns());
+ final XColumnsSupplier suppCols = UnoRuntime.queryInterface(
+ XColumnsSupplier.class, query);
+ final XIndexAccess columns = UnoRuntime.queryInterface(
+ XIndexAccess.class, suppCols.getColumns());
- // check whether the columns supplied by the query match what we expected
- assertTrue( "invalid column count (found " + columns.getCount() + ", expected: " + expectedColumnNames[i].length + ") for query \"" + queryNames[i] + "\"",
- columns.getCount() == expectedColumnNames[i].length );
- for ( int col = 0; col < columns.getCount(); ++col )
- {
- final XNamed columnName = UnoRuntime.queryInterface(
- XNamed.class, columns.getByIndex(col) );
- assertTrue( "column no. " + col + " of query \"" + queryNames[i] + "\" not matching",
- columnName.getName().equals( expectedColumnNames[i][col] ) );
+ // check whether the columns supplied by the query match what we expected
+ assertTrue( "invalid column count (found " + columns.getCount() + ", expected: " + expectedColumnNames[i].length + ") for query \"" + queryNames[i] + "\"",
+ columns.getCount() == expectedColumnNames[i].length );
+ for ( int col = 0; col < columns.getCount(); ++col )
+ {
+ final XNamed columnName = UnoRuntime.queryInterface(
+ XNamed.class, columns.getByIndex(col) );
+ assertTrue( "column no. " + col + " of query \"" + queryNames[i] + "\" not matching",
+ columnName.getName().equals( expectedColumnNames[i][col] ) );
+ }
}
}
}
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index 90531b29f9ed..482da7335941 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -430,6 +430,10 @@ public class RowSet extends TestCase
testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
moves[RowSetEventListener.IS_MODIFIED] = false;
+ updRow.updateString(2, m_row.getString(2));
+ testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
+
+ moves[RowSetEventListener.IS_MODIFIED] = false;
final Class cupd = Class.forName("com.sun.star.sdbc.XResultSetUpdate");
final XResultSetUpdate upd = UnoRuntime.queryInterface( XResultSetUpdate.class, m_resultSet );
testCursorMove(upd, cupd.getMethod("moveToInsertRow", (Class[]) null), pRow, moves, null);
diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
index 89d107ed5bb1..4823f5d50e4c 100755
--- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
+++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
@@ -55,11 +55,12 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
{
private XSingleSelectQueryComposer m_composer = null;
- private final static String COMPLEXFILTER = "( \"ID\" = 1 AND \"Postal\" = '4' )" +
- " OR ( \"ID\" = 2 AND \"Postal\" = '5' )" +
- " OR ( \"ID\" = '3' AND \"Postal\" = '6' AND \"Address\" = '7' )" +
- " OR ( \"Address\" = '8' )" +
- " OR ( \"Postal\" = '9' )";
+ private final static String COMPLEXFILTER = "( \"ID\" = 1 AND \"Postal\" = '4' )"
+ + " OR ( \"ID\" = 2 AND \"Postal\" = '5' )"
+ + " OR ( \"ID\" = 3 AND \"Postal\" = '6' AND \"Address\" = '7' )"
+ + " OR ( \"Address\" = '8' )"
+ + " OR ( \"Postal\" = '9' )"
+ + " OR ( NOW( ) = {D '2010-01-01' } )";
private final static String INNERPRODUCTSQUERY = "products (inner)";
// --------------------------------------------------------------------------------------------------------
@@ -135,15 +136,15 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
try
{
final String table = "SELECT * FROM \"customers\"";
- m_composer.setCommand("customers",CommandType.TABLE);
+ m_composer.setCommand("customers", CommandType.TABLE);
assertTrue("setCommand/getQuery TABLE inconsistent", m_composer.getQuery().equals(table));
m_database.getDatabase().getDataSource().createQuery("set command test", "SELECT * FROM \"orders for customer\" \"a\", \"customers\" \"b\" WHERE \"a\".\"Product Name\" = \"b\".\"Name\"");
- m_composer.setCommand("set command test",CommandType.QUERY);
+ m_composer.setCommand("set command test", CommandType.QUERY);
assertTrue("setCommand/getQuery QUERY inconsistent", m_composer.getQuery().equals(m_database.getDatabase().getDataSource().getQueryDefinition("set command test").getCommand()));
final String sql = "SELECT * FROM \"orders for customer\" WHERE \"Product Name\" = 'test'";
- m_composer.setCommand(sql,CommandType.COMMAND);
+ m_composer.setCommand(sql, CommandType.COMMAND);
assertTrue("setCommand/getQuery COMMAND inconsistent", m_composer.getQuery().equals(sql));
}
catch (Exception e)
@@ -151,6 +152,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
fail("Exception caught: " + e);
}
}
+
/** tests accessing attributes of the composer (order, filter, group by, having)
*/
@Test
@@ -161,6 +163,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
try
{
System.out.println("check setElementaryQuery");
+
final String simpleQuery2 = "SELECT * FROM \"customers\" WHERE \"Name\" = 'oranges'";
m_composer.setElementaryQuery(simpleQuery2);
assertTrue("setElementaryQuery/getQuery inconsistent", m_composer.getQuery().equals(simpleQuery2));
@@ -177,16 +180,16 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
final XIndexAccess orderColumns = m_composer.getOrderColumns();
assertTrue("Order columns doesn't exist: \"Address\"",
- orderColumns != null && orderColumns.getCount() == 1 && orderColumns.getByIndex(0) != null);
+ orderColumns != null && orderColumns.getCount() == 1 && orderColumns.getByIndex(0) != null);
final XIndexAccess groupColumns = m_composer.getGroupColumns();
assertTrue("Group columns doesn't exist: \"City\"",
- groupColumns != null && groupColumns.getCount() == 1 && groupColumns.getByIndex(0) != null);
+ groupColumns != null && groupColumns.getCount() == 1 && groupColumns.getByIndex(0) != null);
// XColumnsSupplier
final XColumnsSupplier xSelectColumns = UnoRuntime.queryInterface(XColumnsSupplier.class, m_composer);
assertTrue("no select columns, or wrong number of select columns",
- xSelectColumns != null && xSelectColumns.getColumns() != null && xSelectColumns.getColumns().getElementNames().length == 6);
+ xSelectColumns != null && xSelectColumns.getColumns() != null && xSelectColumns.getColumns().getElementNames().length == 6);
// structured filter
m_composer.setQuery("SELECT \"ID\", \"Postal\", \"Address\" FROM \"customers\"");
@@ -194,6 +197,11 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
final PropertyValue[][] aStructuredFilter = m_composer.getStructuredFilter();
m_composer.setFilter("");
m_composer.setStructuredFilter(aStructuredFilter);
+ if (!m_composer.getFilter().equals(COMPLEXFILTER))
+ {
+ System.out.println(COMPLEXFILTER);
+ System.out.println(m_composer.getFilter());
+ }
assertTrue("Structured Filter not identical", m_composer.getFilter().equals(COMPLEXFILTER));
// structured having clause
@@ -244,6 +252,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
final XIndexAccess parameters = suppParams.getParameters();
final String expectedParamNames[] =
+
{
"cname",
"Product Name"
@@ -276,6 +285,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
m_composer.setQuery("SELECT * FROM \"customers\"");
final Object initArgs[] =
+
{
new NamedValue("AutomaticAddition", Boolean.valueOf(true))
};
@@ -288,8 +298,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
filter.addProperty("Type", PropertyAttribute.MAYBEVOID, Integer.valueOf(DataType.LONGVARCHAR));
final XPropertySet column = UnoRuntime.queryInterface(XPropertySet.class, filter);
- m_composer.appendFilterByColumn(column, true,SQLFilterOperator.LIKE);
- assertTrue("At least one row should exist",m_database.getConnection().createStatement().executeQuery(m_composer.getQuery()).next());
+ m_composer.appendFilterByColumn(column, true, SQLFilterOperator.LIKE);
+ assertTrue("At least one row should exist", m_database.getConnection().createStatement().executeQuery(m_composer.getQuery()).next());
}
catch (Exception e)
@@ -333,16 +343,16 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
{
// a simple case: WHERE clause simply is a combination of predicates knitted with AND
String query =
- "SELECT \"customers\".\"Name\", " +
- "\"customers\".\"Address\", " +
- "\"customers\".\"City\", " +
- "\"customers\".\"Postal\", " +
- "\"products\".\"Name\" " +
- "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " +
- "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " +
- "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " +
- "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " +
- ") ";
+ "SELECT \"customers\".\"Name\", "
+ + "\"customers\".\"Address\", "
+ + "\"customers\".\"City\", "
+ + "\"customers\".\"Postal\", "
+ + "\"products\".\"Name\" "
+ + "FROM \"orders\", \"customers\", \"orders_details\", \"products\" "
+ + "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" "
+ + "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" "
+ + "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" "
+ + ") ";
impl_testDisjunctiveNormalForm(query, new PropertyValue[][]
{
@@ -356,20 +366,20 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
// somewhat more challenging: One of the conjunction terms is a disjunction itself
query =
- "SELECT \"customers\".\"Name\", " +
- "\"customers\".\"Address\", " +
- "\"customers\".\"City\", " +
- "\"customers\".\"Postal\", " +
- "\"products\".\"Name\" " +
- "FROM \"orders\", \"customers\", \"orders_details\", \"products\" " +
- "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" " +
- "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" " +
- "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" " +
- ") " +
- "AND " +
- "( \"products\".\"Name\" = 'Apples' " +
- "OR \"products\".\"ID\" = 2 " +
- ")";
+ "SELECT \"customers\".\"Name\", "
+ + "\"customers\".\"Address\", "
+ + "\"customers\".\"City\", "
+ + "\"customers\".\"Postal\", "
+ + "\"products\".\"Name\" "
+ + "FROM \"orders\", \"customers\", \"orders_details\", \"products\" "
+ + "WHERE ( \"orders\".\"CustomerID\" = \"customers\".\"ID\" "
+ + "AND \"orders_details\".\"OrderID\" = \"orders\".\"ID\" "
+ + "AND \"orders_details\".\"ProductID\" = \"products\".\"ID\" "
+ + ") "
+ + "AND "
+ + "( \"products\".\"Name\" = 'Apples' "
+ + "OR \"products\".\"ID\" = 2 "
+ + ")";
impl_testDisjunctiveNormalForm(query, new PropertyValue[][]
{
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index 932652961109..f1e5f3e0dfdb 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -640,6 +640,21 @@ sal_Bool SAL_CALL OCacheSet::previous( ) throw(SQLException, RuntimeException)
return m_xDriverSet->previous();
}
+sal_Bool OCacheSet::last_checked( sal_Bool /*i_bFetchRow*/)
+{
+ return last();
+}
+
+sal_Bool OCacheSet::previous_checked( sal_Bool /*i_bFetchRow*/ )
+{
+ return previous();
+}
+
+sal_Bool OCacheSet::absolute_checked( sal_Int32 row,sal_Bool /*i_bFetchRow*/ )
+{
+ return absolute(row);
+}
+
void SAL_CALL OCacheSet::refreshRow( ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::refreshRow" );
diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx
index 961a0147e55b..a9b97dbf72d2 100644
--- a/dbaccess/source/core/api/CacheSet.hxx
+++ b/dbaccess/source/core/api/CacheSet.hxx
@@ -153,6 +153,9 @@ namespace dbaccess
virtual bool columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow);
virtual bool updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector<sal_Int32>& i_aChangedColumns);
virtual void fillMissingValues(ORowSetValueVector::Vector& io_aRow) const;
+ virtual sal_Bool previous_checked( sal_Bool i_bFetchRow );
+ virtual sal_Bool absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow );
+ virtual sal_Bool last_checked( sal_Bool i_bFetchRow);
};
}
#endif //DBACCESS_CORE_API_CACHESET_HXX
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index a749729e4c88..689d12a1434a 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -105,7 +105,8 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
const ::rtl::OUString& _rUpdateTableName, // this can be the alias or the full qualified name
const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
- sal_Int32 i_nMaxRows)
+ sal_Int32 i_nMaxRows,
+ sal_Int32& o_nRowCount)
:OCacheSet(i_nMaxRows)
,m_aParameterValueForCache(_aParameterValueForCache)
,m_pKeyColumnNames(NULL)
@@ -116,6 +117,7 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
,m_xTableKeys(_xTableKeys)
,m_xComposer(_xComposer)
,m_sUpdateTableName(_rUpdateTableName)
+ ,m_rRowCount(o_nRowCount)
,m_bRowCountFinal(sal_False)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::OKeySet" );
@@ -1112,6 +1114,12 @@ sal_Bool SAL_CALL OKeySet::next( ) throw(SQLException, RuntimeException)
++m_aKeyIter; // this is possible because we stand on begin() and this is the "beforefirst" row
if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
m_aKeyIter = m_aKeyMap.end();
+ else
+ {
+ //m_aKeyIter->second.second.second = new OPrivateRow(_rInsertRow->get());
+ m_xRow.set(m_xDriverRow,UNO_QUERY_THROW);
+ return !isAfterLast();
+ }
}
else if(!isAfterLast())
++m_aKeyIter;
@@ -1178,20 +1186,26 @@ sal_Bool SAL_CALL OKeySet::first( ) throw(SQLException, RuntimeException)
++m_aKeyIter;
if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
m_aKeyIter = m_aKeyMap.end();
-
- refreshRow();
+ else
+ refreshRow();
return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
}
sal_Bool SAL_CALL OKeySet::last( ) throw(SQLException, RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::last" );
+ return last_checked(sal_True);
+}
+
+sal_Bool OKeySet::last_checked( sal_Bool i_bFetchRow)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::last_checked" );
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
fillAllRows();
m_aKeyIter = m_aKeyMap.end();
--m_aKeyIter;
- refreshRow();
+ if ( i_bFetchRow )
+ refreshRow();
return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
}
@@ -1206,6 +1220,10 @@ sal_Int32 SAL_CALL OKeySet::getRow( ) throw(SQLException, RuntimeException)
sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
{
+ return absolute_checked(row,sal_True);
+}
+sal_Bool OKeySet::absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow )
+{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::absolute" );
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
OSL_ENSURE(row,"absolute(0) isn't allowed!");
@@ -1226,6 +1244,11 @@ sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, Runtime
sal_Bool bNext = sal_True;
for(sal_Int32 i=m_aKeyMap.size()-1;i < row && bNext;++i)
bNext = fetchRow();
+ if ( bNext )
+ {
+ m_xRow.set(m_xDriverRow,UNO_QUERY_THROW);
+ return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
+ }
}
else
m_aKeyIter = m_aKeyMap.end();
@@ -1237,7 +1260,8 @@ sal_Bool SAL_CALL OKeySet::absolute( sal_Int32 row ) throw(SQLException, Runtime
++m_aKeyIter;
}
}
- refreshRow();
+ if ( i_bFetchRow )
+ refreshRow();
return m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin();
}
@@ -1253,18 +1277,24 @@ sal_Bool SAL_CALL OKeySet::relative( sal_Int32 rows ) throw(SQLException, Runtim
return absolute(getRow()+rows);
}
-sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException)
+sal_Bool OKeySet::previous_checked( sal_Bool i_bFetchRow )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::previous" );
m_bInserted = m_bUpdated = m_bDeleted = sal_False;
if(m_aKeyIter != m_aKeyMap.begin())
{
--m_aKeyIter;
- refreshRow();
+ if ( i_bFetchRow )
+ refreshRow();
}
return m_aKeyIter != m_aKeyMap.begin();
}
+sal_Bool SAL_CALL OKeySet::previous( ) throw(SQLException, RuntimeException)
+{
+ return previous_checked(sal_True);
+}
+// -----------------------------------------------------------------------------
void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::refreshRow" );
@@ -1319,9 +1349,18 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
OSL_ENSURE(m_xSet.is(),"No resultset form statement!");
sal_Bool bOK = m_xSet->next();
if ( !bOK )
- m_aKeyIter = m_aKeyMap.end();
- m_xRow.set(m_xSet,UNO_QUERY);
- OSL_ENSURE(m_xRow.is(),"No row form statement!");
+ {
+ OKeySetMatrix::iterator aTemp = m_aKeyIter;
+ ++m_aKeyIter;
+ m_aKeyMap.erase(aTemp);
+ --m_rRowCount;
+ refreshRow();
+ }
+ else
+ {
+ m_xRow.set(m_xSet,UNO_QUERY);
+ OSL_ENSURE(m_xRow.is(),"No row form statement!");
+ }
}
sal_Bool OKeySet::fetchRow()
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 10e9f2166827..22a56da716a4 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -104,6 +104,7 @@ namespace dbaccess
::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer > m_xComposer;
::rtl::OUString m_sUpdateTableName;
::std::vector< ::rtl::OUString > m_aFilterColumns;
+ sal_Int32& m_rRowCount;
sal_Bool m_bRowCountFinal;
@@ -151,7 +152,8 @@ namespace dbaccess
const ::rtl::OUString& _rUpdateTableName,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
- sal_Int32 i_nMaxRows);
+ sal_Int32 i_nMaxRows,
+ sal_Int32& o_nRowCount);
// 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);
@@ -219,6 +221,11 @@ namespace dbaccess
virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+
+ virtual sal_Bool previous_checked( sal_Bool i_bFetchRow );
+ virtual sal_Bool absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow );
+ virtual sal_Bool last_checked( sal_Bool i_bFetchRow);
};
}
#endif // DBACCESS_CORE_API_KEYSET_HXX
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index bf9969470594..7255a470fb2e 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -102,8 +102,9 @@ OptimisticSet::OptimisticSet(const ::comphelper::ComponentContext& _rContext,
const Reference< XConnection>& i_xConnection,
const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
- sal_Int32 i_nMaxRows)
- :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows)
+ sal_Int32 i_nMaxRows,
+ sal_Int32& o_nRowCount)
+ :OKeySet(NULL,NULL,::rtl::OUString(),_xComposer,_aParameterValueForCache,i_nMaxRows,o_nRowCount)
,m_aSqlParser( _rContext.getLegacyServiceFactory() )
,m_aSqlIterator( i_xConnection, Reference<XTablesSupplier>(_xComposer,UNO_QUERY)->getTables(), m_aSqlParser, NULL )
,m_bResultSetChanged(false)
diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx
index 75cb3fdfd612..4e44de65681a 100644
--- a/dbaccess/source/core/api/OptimisticSet.hxx
+++ b/dbaccess/source/core/api/OptimisticSet.hxx
@@ -77,7 +77,8 @@ namespace dbaccess
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,
- sal_Int32 i_nMaxRows);
+ sal_Int32 i_nMaxRows,
+ sal_Int32& o_nRowCount);
// 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 54d791283ad6..8e88f4ef8a8c 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -599,6 +599,7 @@ void ORowSet::freeResources( bool _bComplete )
m_bAfterLast = sal_False;
m_bNew = sal_False;
m_bModified = sal_False;
+ m_bIsInsertRow = sal_False;
m_bLastKnownRowCountFinal = sal_False;
m_nLastKnownRowCount = 0;
if ( m_aOldRow.is() )
@@ -708,6 +709,7 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateValue(columnIndex,x,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
@@ -723,6 +725,7 @@ void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, R
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateNull(columnIndex,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
@@ -810,6 +813,7 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateCharacterStream(columnIndex,x,length,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
@@ -853,6 +857,7 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateObject(columnIndex,aNewValue,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
}
@@ -866,6 +871,7 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x,
ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
ORowSetNotifier aNotify(this,rRow);
m_pCache->updateNumericObject(columnIndex,x,scale,rRow,aNotify.getChangedColumns());
+ m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
}
@@ -882,52 +888,49 @@ void SAL_CALL ORowSet::insertRow( ) throw(SQLException, RuntimeException)
if(!m_pCache || !m_bNew || !m_bModified || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY)
throwFunctionSequenceException(*this);
- if(m_bModified)
- {
- // remember old value for fire
- sal_Bool bOld = m_bNew;
+ // remember old value for fire
+ sal_Bool bOld = m_bNew;
- ORowSetRow aOldValues;
- if ( !m_aCurrentRow.isNull() )
- aOldValues = new ORowSetValueVector( *(*m_aCurrentRow));
- Sequence<Any> aChangedBookmarks;
- RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks);
- notifyAllListenersRowBeforeChange(aGuard,aEvt);
+ ORowSetRow aOldValues;
+ if ( !m_aCurrentRow.isNull() )
+ aOldValues = new ORowSetValueVector( *(*m_aCurrentRow));
+ Sequence<Any> aChangedBookmarks;
+ RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks);
+ notifyAllListenersRowBeforeChange(aGuard,aEvt);
- ::std::vector< Any > aBookmarks;
- sal_Bool bInserted = m_pCache->insertRow(aBookmarks);
+ ::std::vector< Any > aBookmarks;
+ sal_Bool bInserted = m_pCache->insertRow(aBookmarks);
- // make sure that our row is set to the new inserted row before clearing the insert flags in the cache
- m_pCache->resetInsertRow(bInserted);
+ // make sure that our row is set to the new inserted row before clearing the insert flags in the cache
+ m_pCache->resetInsertRow(bInserted);
- // notification order
- // - column values
- setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here
+ // notification order
+ // - column values
+ setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here
- // read-only flag restored
- impl_restoreDataColumnsWriteable_throw();
+ // read-only flag restored
+ impl_restoreDataColumnsWriteable_throw();
- // - rowChanged
- notifyAllListenersRowChanged(aGuard,aEvt);
+ // - rowChanged
+ notifyAllListenersRowChanged(aGuard,aEvt);
- if ( !aBookmarks.empty() )
- {
- RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size()));
- notifyAllListenersRowChanged(aGuard,aUpEvt);
- }
+ if ( !aBookmarks.empty() )
+ {
+ RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size()));
+ notifyAllListenersRowChanged(aGuard,aUpEvt);
+ }
- // - IsModified
- if(!m_bModified)
- fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
- OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" );
+ // - IsModified
+ if(!m_bModified)
+ fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
+ OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" );
- // - IsNew
- if(m_bNew != bOld)
- fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld);
+ // - IsNew
+ if(m_bNew != bOld)
+ fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld);
- // - RowCount/IsRowCountFinal
- fireRowcount();
- }
+ // - RowCount/IsRowCountFinal
+ fireRowcount();
}
sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException)
@@ -936,7 +939,7 @@ sal_Int32 SAL_CALL ORowSet::getRow( ) throw(SQLException, RuntimeException)
checkCache();
// check if we are inserting a row
- return (m_pCache && ( m_pCache->m_bNew || m_bModified )) ? 0 : ORowSetBase::getRow();
+ return (m_pCache && isInsertRow()) ? 0 : ORowSetBase::getRow();
}
void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException)
@@ -1074,6 +1077,7 @@ void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQL
m_aBookmark = m_pCache->getBookmark();
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
m_aCurrentRow.setBookmark(m_aBookmark);
// notification order
@@ -1206,6 +1210,7 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
m_pCache->moveToInsertRow();
m_aCurrentRow = m_pCache->m_aInsertRow;
+ m_bIsInsertRow = sal_True;
// set read-only flag to false
impl_setDataColumnsWriteable_throw();
@@ -1809,6 +1814,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
}
m_pCache->setFetchSize(m_nFetchSize);
m_aCurrentRow = m_pCache->createIterator(this);
+ m_bIsInsertRow = sal_False;
m_aOldRow = m_pCache->registerOldRow();
}
@@ -2646,6 +2652,7 @@ void ORowSet::doCancelModification( )
m_pCache->cancelRowModification();
}
m_bModified = sal_False;
+ m_bIsInsertRow = sal_False;
}
sal_Bool ORowSet::isModification( )
@@ -2670,14 +2677,12 @@ sal_Bool ORowSet::isPropertyChangeNotificationEnabled() const
void ORowSet::checkUpdateIterator()
{
- if(!m_bModified && !m_bNew)
+ if(!m_bIsInsertRow)
{
m_pCache->setUpdateIterator(m_aCurrentRow);
m_aCurrentRow = m_pCache->m_aInsertRow;
- m_bModified = sal_True;
+ m_bIsInsertRow = sal_True;
}
- else if ( m_bNew ) // here we are modifying a value
- m_bModified = sal_True;
}
void ORowSet::checkUpdateConditions(sal_Int32 columnIndex)
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 7adb83248310..5b526137215e 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -111,6 +111,7 @@ ORowSetBase::ORowSetBase( const ::comphelper::ComponentContext& _rContext, ::cpp
,m_bIgnoreResult(sal_False)
,m_bBeforeFirst(sal_True) // changed from sal_False
,m_bAfterLast(sal_False)
+ ,m_bIsInsertRow(sal_False)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ORowSetBase::ORowSetBase" );
DBG_CTOR(ORowSetBase,NULL);
@@ -255,6 +256,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
// currentrow is null when the clone moves the window
positionCache( MOVE_NONE_REFRESH_ONLY );
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't stand on a valid row! Row is null.");
bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() );
@@ -396,6 +398,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS
{
positionCache( MOVE_NONE_REFRESH_ONLY );
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null.");
bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() );
@@ -1114,6 +1117,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR
m_aBookmark = m_pCache->getBookmark();
OSL_ENSURE(m_aBookmark.hasValue(),"Bookmark has no value!");
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is null!");
m_aCurrentRow.setBookmark(m_aBookmark);
OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd(),"Position of matrix iterator isn't valid!");
@@ -1129,6 +1133,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR
#endif
OSL_ENSURE(nOldRow == nNewRow,"Old position is not equal to new postion");
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!");
#if OSL_DEBUG_LEVEL > 0
ORowSetRow rRow = (*m_aCurrentRow);
@@ -1139,6 +1144,7 @@ void ORowSetBase::setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const OR
{
positionCache( MOVE_NONE_REFRESH_ONLY );
m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = sal_False;
OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!");
}
}
@@ -1569,7 +1575,8 @@ void ORowSetNotifier::firePropertyChange()
{
m_pRowSet->firePropertyChange((*aIter)-1 ,m_pImpl->aRow[(*aIter)-1], ORowSetBase::GrantNotifierAccess());
}
- m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False, ORowSetBase::GrantNotifierAccess());
+ if ( !m_pImpl->aChangedColumns.empty() )
+ m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,sal_True,sal_False, ORowSetBase::GrantNotifierAccess());
}
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx
index 58e2765d3aea..2a931d5af376 100644
--- a/dbaccess/source/core/api/RowSetBase.hxx
+++ b/dbaccess/source/core/api/RowSetBase.hxx
@@ -117,6 +117,7 @@ namespace dbaccess
sal_Bool m_bIgnoreResult ;
sal_Bool m_bBeforeFirst : 1;
sal_Bool m_bAfterLast : 1;
+ sal_Bool m_bIsInsertRow : 1;
protected:
ORowSetBase(
@@ -345,7 +346,7 @@ namespace dbaccess
inline sal_Bool isModification( const GrantNotifierAccess& ) { return isModification(); }
inline sal_Bool isModified( const GrantNotifierAccess& ) { return isModified(); }
inline sal_Bool isNew( const GrantNotifierAccess& ) { return isNew(); }
- inline sal_Bool isInsertRow() { return isNew() || isModified(); }
+ inline sal_Bool isInsertRow() { return m_bIsInsertRow; } // isNew() || isModified(); }
inline void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld, const GrantNotifierAccess& )
{
fireProperty( _nProperty, _bNew, _bOld );
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 2a5157d594f2..447137062b50 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -115,12 +115,13 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
DBG_CTOR(ORowSetCache,NULL);
// first try if the result can be used to do inserts and updates
+ Reference< XPropertySet> xProp(_xRs,UNO_QUERY);
+ Reference< XPropertySetInfo > xPropInfo = xProp->getPropertySetInfo();
+ sal_Bool bBookmarkable = sal_False;
try
{
Reference< XResultSetUpdate> xUp(_xRs,UNO_QUERY_THROW);
- Reference< XPropertySet> xProp(_xRs,UNO_QUERY);
- Reference< XPropertySetInfo > xPropInfo = xProp->getPropertySetInfo();
- sal_Bool bBookmarkable = xPropInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
+ bBookmarkable = xPropInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is();
if ( bBookmarkable )
{
@@ -138,17 +139,22 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
{
(void)ex;
}
- _xRs->beforeFirst();
+ try
+ {
+ if ( xPropInfo->hasPropertyByName(PROPERTY_RESULTSETTYPE) &&
+ ::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETTYPE)) != ResultSetType::FORWARD_ONLY)
+ _xRs->beforeFirst();
+ }
+ catch(const SQLException& e)
+ {
+ (void)e;
+ }
// check if all keys of the updateable table are fetched
sal_Bool bAllKeysFound = sal_False;
sal_Int32 nTablesCount = 0;
- Reference< XPropertySet> xProp(_xRs,UNO_QUERY);
- Reference< XPropertySetInfo > xPropInfo = xProp->getPropertySetInfo();
- sal_Bool bNeedKeySet = !(xPropInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) &&
- any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is() );
- bNeedKeySet = bNeedKeySet || (xPropInfo->hasPropertyByName(PROPERTY_RESULTSETCONCURRENCY) &&
+ sal_Bool bNeedKeySet = !bBookmarkable || (xPropInfo->hasPropertyByName(PROPERTY_RESULTSETCONCURRENCY) &&
::comphelper::getINT32(xProp->getPropertyValue(PROPERTY_RESULTSETCONCURRENCY)) == ResultSetConcurrency::READ_ONLY);
Reference< XIndexAccess> xUpdateTableKeys;
@@ -175,7 +181,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,i_nMaxRows);
+ OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
m_pCacheSet = pCursor;
m_xCacheSet = m_pCacheSet;
try
@@ -267,6 +273,16 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
if(!bAllKeysFound )
{
+ if ( bBookmarkable )
+ {
+ // here I know that we have a read only bookmarable cursor
+ _xRs->beforeFirst();
+ m_nPrivileges = Privilege::SELECT;
+ m_pCacheSet = new WrappedResultSet(i_nMaxRows);
+ m_xCacheSet = m_pCacheSet;
+ m_pCacheSet->construct(_xRs,i_sRowSetFilter);
+ return;
+ }
m_pCacheSet = new OStaticSet(i_nMaxRows);
m_xCacheSet = m_pCacheSet;
m_pCacheSet->construct(_xRs,i_sRowSetFilter);
@@ -304,7 +320,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
}
}
- OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows);
+ OKeySet* pKeySet = new OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
try
{
m_pCacheSet = pKeySet;
@@ -434,6 +450,13 @@ void ORowSetCache::setFetchSize(sal_Int32 _nSize)
m_nStartPos = 0;
m_nEndPos = _nSize;
}
+ else if (m_nStartPos < m_nPosition && m_nPosition < m_nEndPos)
+ {
+ sal_Int32 nNewSt = -1;
+ fillMatrix(nNewSt,_nSize+1);
+ m_nStartPos = 0;
+ m_nEndPos = _nSize;
+ }
}
// XResultSetMetaDataSupplier
@@ -538,13 +561,16 @@ void ORowSetCache::updateNull(sal_Int32 columnIndex,ORowSetValueVector::Vector&
checkUpdateConditions(columnIndex);
ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get());
- rInsert[columnIndex].setBound(sal_True);
- rInsert[columnIndex].setNull();
- rInsert[columnIndex].setModified();
- io_aRow[columnIndex].setNull();
+ if ( !rInsert[columnIndex].isNull() )
+ {
+ rInsert[columnIndex].setBound(sal_True);
+ rInsert[columnIndex].setNull();
+ rInsert[columnIndex].setModified();
+ io_aRow[columnIndex].setNull();
- m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
- impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
+ impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ }
}
void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x
@@ -555,13 +581,16 @@ void ORowSetCache::updateValue(sal_Int32 columnIndex,const ORowSetValue& x
checkUpdateConditions(columnIndex);
ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get());
- rInsert[columnIndex].setBound(sal_True);
- rInsert[columnIndex] = x;
- rInsert[columnIndex].setModified();
- io_aRow[columnIndex] = rInsert[columnIndex];
+ if ( rInsert[columnIndex] != x )
+ {
+ rInsert[columnIndex].setBound(sal_True);
+ rInsert[columnIndex] = x;
+ rInsert[columnIndex].setModified();
+ io_aRow[columnIndex] = rInsert[columnIndex];
- m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
- impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
+ impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ }
}
void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x
@@ -593,13 +622,18 @@ void ORowSetCache::updateObject( sal_Int32 columnIndex, const Any& x
checkUpdateConditions(columnIndex);
ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get());
- rInsert[columnIndex].setBound(sal_True);
- rInsert[columnIndex] = x;
- rInsert[columnIndex].setModified();
- io_aRow[columnIndex] = rInsert[columnIndex];
+ ORowSetValue aTemp;
+ aTemp.fill(x);
+ if ( rInsert[columnIndex] != aTemp )
+ {
+ rInsert[columnIndex].setBound(sal_True);
+ rInsert[columnIndex] = aTemp;
+ rInsert[columnIndex].setModified();
+ io_aRow[columnIndex] = rInsert[columnIndex];
- m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
- impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
+ impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ }
}
void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/
@@ -610,13 +644,18 @@ void ORowSetCache::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal
checkUpdateConditions(columnIndex);
ORowSetValueVector::Vector& rInsert = ((*m_aInsertRow)->get());
- rInsert[columnIndex].setBound(sal_True);
- rInsert[columnIndex] = x;
- rInsert[columnIndex].setModified();
- io_aRow[columnIndex] = rInsert[columnIndex];
+ ORowSetValue aTemp;
+ aTemp.fill(x);
+ if ( rInsert[columnIndex] != aTemp )
+ {
+ rInsert[columnIndex].setBound(sal_True);
+ rInsert[columnIndex] = aTemp;
+ rInsert[columnIndex].setModified();
+ io_aRow[columnIndex] = rInsert[columnIndex];
- m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
- impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ m_pCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
+ impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
+ }
}
// XResultSet
@@ -644,8 +683,6 @@ sal_Bool ORowSetCache::next( )
sal_Bool ORowSetCache::isBeforeFirst( )
{
- // return !m_nPosition;
-
return m_bBeforeFirst;
}
@@ -687,7 +724,7 @@ sal_Bool ORowSetCache::afterLast( )
if(!m_bRowCountFinal)
{
- m_pCacheSet->last();
+ m_pCacheSet->last_checked(sal_False);
m_bRowCountFinal = sal_True;
m_nRowCount = m_pCacheSet->getRow();// + 1 removed
}
@@ -703,10 +740,22 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
{
OSL_ENSURE(_nNewStartPos != _nNewEndPos,"ORowSetCache::fillMatrix: StartPos and EndPos can not be equal!");
// fill the whole window with new data
- ORowSetMatrix::iterator aIter = m_pMatrix->begin();
- sal_Bool bCheck = m_pCacheSet->absolute(_nNewStartPos); // -1 no need to
+ ORowSetMatrix::iterator aIter;
+ sal_Int32 i;
+ sal_Bool bCheck;
+ if ( _nNewStartPos == -1 )
+ {
+ aIter = m_pMatrix->begin() + m_nEndPos;
+ i = m_nEndPos+1;
+ }
+ else
+ {
+ aIter = m_pMatrix->begin();
+ i = _nNewStartPos;
+ }
+ bCheck = m_pCacheSet->absolute(i); // -1 no need to
+
- sal_Int32 i=_nNewStartPos;
for(;i<_nNewEndPos;++i,++aIter)
{
if(bCheck)
@@ -714,13 +763,15 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
if(!aIter->is())
*aIter = new ORowSetValueVector(m_xMetaData->getColumnCount());
m_pCacheSet->fillValueRow(*aIter,i);
+ if(!m_bRowCountFinal)
+ ++m_nRowCount;
}
else
{ // there are no more rows found so we can fetch some before start
if(!m_bRowCountFinal)
{
- if(m_pCacheSet->previous()) // because we stand after the last row
+ if(m_pCacheSet->previous_checked(sal_False)) // because we stand after the last row
m_nRowCount = m_pCacheSet->getRow(); // here we have the row count
if(!m_nRowCount)
m_nRowCount = i-1; // it can be that getRow return zero
@@ -749,15 +800,17 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
}
break;
}
- bCheck = m_pCacheSet->next();
+ if ( i < (_nNewEndPos-1) )
+ bCheck = m_pCacheSet->next();
}
- // we have to read one row forward to enshure that we know when we are on last row
+ // we have to read one row forward to ensure that we know when we are on last row
// but only when we don't know it already
+ /*
if(!m_bRowCountFinal)
{
if(!m_pCacheSet->next())
{
- if(m_pCacheSet->previous()) // because we stand after the last row
+ if(m_pCacheSet->previous_checked(sal_False)) // because we stand after the last row
m_nRowCount = m_pCacheSet->getRow(); // here we have the row count
m_bRowCountFinal = sal_True;
}
@@ -765,6 +818,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos,sal_Int32 _nNewEndPos
m_nRowCount = std::max(i,m_nRowCount);
}
+ */
return bCheck;
}
@@ -899,19 +953,16 @@ sal_Bool ORowSetCache::moveWindow()
// but only when we don't know it already
if ( !m_bRowCountFinal )
{
- bOk = m_pCacheSet->absolute( m_nPosition + 1 );
+ bOk = m_pCacheSet->absolute_checked( m_nPosition + 1,sal_False );
if ( bOk )
m_nRowCount = std::max(sal_Int32(m_nPosition+1),m_nRowCount);
}
}
- if(!bOk)
+ if(!bOk && !m_bRowCountFinal)
{
- if(!m_bRowCountFinal)
- {
- // because we stand after the last row
- m_nRowCount = m_pCacheSet->previous() ? m_pCacheSet->getRow() : 0;// + 1 removed
- m_bRowCountFinal = sal_True;
- }
+ // because we stand after the last row
+ m_nRowCount = m_pCacheSet->previous_checked(sal_False) ? m_pCacheSet->getRow() : 0;// + 1 removed
+ m_bRowCountFinal = sal_True;
}
}
}
@@ -942,7 +993,7 @@ sal_Bool ORowSetCache::moveWindow()
// now I can say how many rows we have
if(!bOk)
{
- m_pCacheSet->previous(); // because we stand after the last row
+ m_pCacheSet->previous_checked(sal_False); // because we stand after the last row
m_nRowCount = nPos; // here we have the row count
m_bRowCountFinal = sal_True;
}
@@ -959,7 +1010,7 @@ sal_Bool ORowSetCache::moveWindow()
if ( !m_bRowCountFinal )
{
- m_pCacheSet->previous(); // because we stand after the last row
+ m_pCacheSet->previous_checked(sal_False); // because we stand after the last row
m_nRowCount = std::max(m_nRowCount,--nPos); // here we have the row count
OSL_ENSURE(nPos == m_pCacheSet->getRow(),"nPos isn't valid!");
m_bRowCountFinal = sal_True;
@@ -975,7 +1026,7 @@ sal_Bool ORowSetCache::moveWindow()
aIter = m_pMatrix->begin();
nPos = m_nStartPos;
- bCheck = m_pCacheSet->absolute(m_nStartPos);
+ bCheck = m_pCacheSet->absolute_checked(m_nStartPos,sal_False);
for(; !aIter->is() && bCheck;++aIter)
{
OSL_ENSURE(aIter != m_pMatrix->end(),"Invalid iterator");
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index f050ee195b18..2942f5ccbe78 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -59,6 +59,7 @@
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
#include <cppuhelper/typeprovider.hxx>
+#include <connectivity/predicateinput.hxx>
#include <rtl/logfile.hxx>
#include <unotools/syslocale.hxx>
#include <tools/debug.hxx>
@@ -1216,16 +1217,12 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon
::rtl::OUString aValue;
::rtl::OUString aColumnName;
- pCondition->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pCondition->getChild(2)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
pCondition->getChild(0)->parseNodeToPredicateStr( aColumnName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep .toChar() ) );
- // don't display the column name
- aValue = aValue.copy(aColumnName.getLength());
- aValue.trim();
-
aItem.Name = getColumnName(pCondition->getChild(0),_rIterator);
aItem.Value <<= aValue;
- aItem.Handle = pCondition->getNodeType();
+ aItem.Handle = getPredicateType(pCondition->getChild(1));
rFilter.push_back(aItem);
}
else // kann sich nur um einen Expr. Ausdruck handeln
@@ -1242,7 +1239,7 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon
pLhs->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
// Kriterium
- aItem.Handle = pCondition->getChild(1)->getNodeType();
+ aItem.Handle = getPredicateType(pCondition->getChild(1));
aValue = pCondition->getChild(1)->getTokenValue();
for(i=0;i< pRhs->count();i++)
pRhs->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
@@ -1483,7 +1480,7 @@ Reference< XIndexAccess > SAL_CALL OSingleSelectQueryComposer::getOrderColumns(
namespace
{
- ::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter )
+ ::rtl::OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter,const OPredicateInputController& i_aPredicateInputController,const Reference< XNameAccess >& i_xSelectColumns)
{
::rtl::OUStringBuffer sRet;
const Sequence< PropertyValue >* pOrIter = filter.getConstArray();
@@ -1500,6 +1497,15 @@ namespace
sRet.append(pAndIter->Name);
::rtl::OUString sValue;
pAndIter->Value >>= sValue;
+ if ( i_xSelectColumns.is() && i_xSelectColumns->hasByName(pAndIter->Name) )
+ {
+ Reference<XPropertySet> xColumn(i_xSelectColumns->getByName(pAndIter->Name),UNO_QUERY);
+ sValue = i_aPredicateInputController.getPredicateValue(sValue,xColumn,sal_True);
+ }
+ else
+ {
+ sValue = i_aPredicateInputController.getPredicateValue(pAndIter->Name,sValue,sal_True);
+ }
lcl_addFilterCriteria_throw(pAndIter->Handle,sValue,sRet);
++pAndIter;
if ( pAndIter != pAndEnd )
@@ -1518,13 +1524,15 @@ namespace
void SAL_CALL OSingleSelectQueryComposer::setStructuredFilter( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, ::com::sun::star::lang::IllegalArgumentException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredFilter" );
- setFilter(lcl_getCondition(filter));
+ OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection);
+ setFilter(lcl_getCondition(filter,aPredicateInput,getColumns()));
}
void SAL_CALL OSingleSelectQueryComposer::setStructuredHavingClause( const Sequence< Sequence< PropertyValue > >& filter ) throw (SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setStructuredHavingClause" );
- setHavingClause(lcl_getCondition(filter));
+ OPredicateInputController aPredicateInput(m_aContext.getLegacyServiceFactory(),m_xConnection);
+ setHavingClause(lcl_getCondition(filter,aPredicateInput,getColumns()));
}
void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor,sal_Int32 filterOperator)
diff --git a/dbaccess/source/core/dataaccess/SharedConnection.cxx b/dbaccess/source/core/dataaccess/SharedConnection.cxx
index 87ad268e9e49..ee65cd2a024c 100644
--- a/dbaccess/source/core/dataaccess/SharedConnection.cxx
+++ b/dbaccess/source/core/dataaccess/SharedConnection.cxx
@@ -118,6 +118,8 @@ void SAL_CALL OSharedConnection::rollback( ) throw(SQLException, RuntimeExcepti
sal_Bool SAL_CALL OSharedConnection::isClosed( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_xConnection.is() )
+ return sal_True;
return m_xConnection->isClosed();
}
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 6e74d20f7aec..9302899e775f 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -200,7 +200,7 @@ void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source ) t
if ( xListener.is() )
xListener->disposing( Source );
- impl_dispose( false );
+ impl_dispose( true );
}
OAuthenticationContinuation::OAuthenticationContinuation()
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index c8e1e9091555..06c448faa700 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/sdb/XCompletedExecution.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
@@ -51,6 +52,7 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/XChartDataArray.hpp>
+#include <com/sun/star/chart/XDateCategories.hpp>
#include <vector>
#include <list>
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index ee242ea29d33..61147f4d5289 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -33,6 +33,7 @@
#include "dbustrings.hrc"
#include "advancedsettingsdlg.hxx"
#include "subcomponentmanager.hxx"
+#include "closeveto.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/beans/NamedValue.hpp>
@@ -1301,8 +1302,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
::comphelper::NamedValueCollection aCreationArgs;
aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId );
- Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
- Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY );
+ const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
+ const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY );
onDocumentOpened( ::rtl::OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, NULL );
}
}
@@ -1353,8 +1354,8 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
{
RelationDesigner aDesigner( getORB(), this, m_aCurrentFrame.getFrame() );
- Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
- Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
+ const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
+ const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
onDocumentOpened( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, NULL );
}
}
@@ -1950,6 +1951,9 @@ IMPL_LINK( OApplicationController, OnCreateWithPilot, void*, _pType )
// -----------------------------------------------------------------------------
void OApplicationController::newElementWithPilot( ElementType _eType )
{
+ CloseVeto aKeepDoc( getFrame() );
+ // prevent the document being closed while the wizard is open
+
OSL_ENSURE( getContainer(), "OApplicationController::newElementWithPilot: without a view?" );
switch ( _eType )
@@ -2708,61 +2712,83 @@ void SAL_CALL OApplicationController::attachFrame( const Reference< XFrame > & i
sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & _rxModel) throw( RuntimeException )
{
::osl::MutexGuard aGuard( getMutex() );
- Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY );
- if ( !xOfficeDoc.is() && _rxModel.is() )
+ const Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY );
+ const Reference< XModifiable > xDocModify( _rxModel, UNO_QUERY );
+ if ( ( !xOfficeDoc.is() || !xDocModify.is() ) && _rxModel.is() )
{
OSL_FAIL( "OApplicationController::attachModel: invalid model!" );
return sal_False;
}
- OSL_ENSURE( !( m_xModel.is() && ( m_xModel != _rxModel ) ),
- "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" );
- // at least: remove as property change listener from the old model/data source
+ if ( m_xModel.is() && ( m_xModel != _rxModel ) && ( _rxModel.is() ) )
+ {
+ OSL_ENSURE( false, "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" );
+ // we'd need to completely update our view here, close sub components, and the like
+ return sal_False;
+ }
+
+ const ::rtl::OUString aPropertyNames[] =
+ {
+ PROPERTY_URL, PROPERTY_USER
+ };
+
+ // disconnect from old model
+ try
+ {
+ if ( m_xDataSource.is() )
+ {
+ for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
+ {
+ m_xDataSource->removePropertyChangeListener( aPropertyNames[i], this );
+ }
+ }
+
+ Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
+ if ( xBroadcaster.is() )
+ xBroadcaster->removeModifyListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
m_xModel = _rxModel;
- if ( m_xModel.is() )
+ m_xDocumentModify = xDocModify;
+ m_xDataSource.set( xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference< XDataSource >(), UNO_QUERY );
+
+ // connect to new model
+ try
{
- m_xDocumentModify.set( m_xModel, UNO_QUERY_THROW );
+ if ( m_xDataSource.is() )
+ {
+ for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
+ {
+ m_xDataSource->addPropertyChangeListener( aPropertyNames[i], this );
+ }
+ }
+
+ Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( this );
+
}
- else
+ catch( const Exception& )
{
- m_xDocumentModify.clear();
+ DBG_UNHANDLED_EXCEPTION();
}
- m_xDataSource.set(xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference<XDataSource>(),UNO_QUERY);
+ // initial preview mode
if ( m_xDataSource.is() )
{
try
{
- m_xDataSource->addPropertyChangeListener(PROPERTY_INFO, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_URL, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_ISPASSWORDREQUIRED, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_LAYOUTINFORMATION, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_SUPPRESSVERSIONCL, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_TABLEFILTER, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_TABLETYPEFILTER, this);
- m_xDataSource->addPropertyChangeListener(PROPERTY_USER, this);
// to get the 'modified' for the data source
- Reference< XModifyBroadcaster > xBroadcaster(m_xModel, UNO_QUERY);
- if ( xBroadcaster.is() )
- xBroadcaster->addModifyListener(static_cast<XModifyListener*>(this));
-
- Sequence<PropertyValue> aFields;
- m_xDataSource->getPropertyValue(PROPERTY_LAYOUTINFORMATION) >>= aFields;
- PropertyValue *pIter = aFields.getArray();
- PropertyValue *pEnd = pIter + aFields.getLength();
- for (; pIter != pEnd && pIter->Name != INFO_PREVIEW; ++pIter)
- ;
-
- if ( pIter != pEnd )
+ ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) );
+ if ( aLayoutInfo.has( (rtl::OUString)INFO_PREVIEW ) )
{
- sal_Int32 nValue = 0;
- pIter->Value >>= nValue;
- m_ePreviewMode = static_cast<PreviewMode>(nValue);
+ const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( (rtl::OUString)INFO_PREVIEW, (sal_Int32)0 ) );
+ m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode );
if ( getView() )
- {
- getContainer()->switchPreview(m_ePreviewMode);
- }
+ getContainer()->switchPreview( m_ePreviewMode );
}
}
catch( const Exception& )
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index 5d90d8a7c104..b1bcd961438b 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -658,7 +658,6 @@ void OApplicationController::askToReconnect()
void OApplicationController::onDocumentOpened( const ::rtl::OUString& _rName, const sal_Int32 _nType,
const ElementOpenMode _eMode, const Reference< XComponent >& _xDocument, const Reference< XComponent >& _rxDefinition )
{
- OSL_PRECOND( _xDocument.is(), "OApplicationController::onDocumentOpened: illegal document!" );
if ( !_xDocument.is() )
return;
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index a2259654a858..119157b2d0fe 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -54,6 +54,7 @@
#include <algorithm>
#include "dbtreelistbox.hxx"
#include "IApplicationController.hxx"
+#include "imageprovider.hxx"
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
@@ -90,6 +91,7 @@ OCreationList::OCreationList( OTasksWindow& _rParent )
SetSpaceBetweenEntries(nSize);
SetSelectionMode( NO_SELECTION );
SetExtendedWinBits( EWB_NO_AUTO_CURENTRY );
+ SetNodeDefaultImages( );
EnableEntryMnemonics();
}
// -----------------------------------------------------------------------------
@@ -367,6 +369,12 @@ OTasksWindow::OTasksWindow(Window* _pParent,OApplicationDetailView* _pDetailView
m_aHelpText.SetHelpId(HID_APP_HELP_TEXT);
m_aDescription.SetHelpId(HID_APP_DESCRIPTION_TEXT);
m_aDescription.SetText(ModuleRes(STR_DESCRIPTION));
+
+ ImageProvider aImageProvider;
+ Image aFolderImage = aImageProvider.getFolderImage( DatabaseObject::FORM, false );
+ m_aCreation.SetDefaultCollapsedEntryBmp( aFolderImage );
+ m_aCreation.SetDefaultExpandedEntryBmp( aFolderImage );
+
ImplInitSettings(sal_True,sal_True,sal_True);
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src
index 431f434fcea3..8f558ac76f40 100644
--- a/dbaccess/source/ui/app/app.src
+++ b/dbaccess/source/ui/app/app.src
@@ -261,19 +261,19 @@ Menu RID_MENU_APP_EDIT
MenuItem
{
Identifier = SID_DB_APP_DSPROPS;
- Text[ en-US ] = "Properties";
+ Text[ en-US ] = "Properties...";
Command = ".uno:DBDSProperties";
};
MenuItem
{
Identifier = SID_DB_APP_DSCONNECTION_TYPE;
- Text[ en-US ] = "Connection Type";
+ Text[ en-US ] = "Connection Type...";
Command = ".uno:DBDSConnectionType";
};
MenuItem
{
Identifier = SID_DB_APP_DSADVANCED_SETTINGS;
- Text[ en-US ] = "Advanced Settings";
+ Text[ en-US ] = "Advanced Settings...";
Command = ".uno:DBDSAdvancedSettings";
};
};
diff --git a/dbaccess/source/ui/app/closeveto.cxx b/dbaccess/source/ui/app/closeveto.cxx
new file mode 100644
index 000000000000..558df26b643e
--- /dev/null
+++ b/dbaccess/source/ui/app/closeveto.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_dbaccess.hxx"
+
+#include "closeveto.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/util/XCloseable.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/ref.hxx>
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace dbaui
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::util::XCloseable;
+ using ::com::sun::star::util::XCloseListener;
+ using ::com::sun::star::util::CloseVetoException;
+ using ::com::sun::star::lang::EventObject;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= CloseListener_Impl
+ //==================================================================================================================
+ typedef ::cppu::WeakImplHelper1 < XCloseListener
+ > CloseListener_Base;
+ class DBACCESS_DLLPRIVATE CloseListener_Impl : public CloseListener_Base
+ {
+ public:
+ CloseListener_Impl()
+ :m_bHasOwnership( false )
+ {
+ }
+
+ // XCloseListener
+ virtual void SAL_CALL queryClosing( const EventObject& Source, ::sal_Bool GetsOwnership ) throw (CloseVetoException, RuntimeException);
+ virtual void SAL_CALL notifyClosing( const EventObject& Source ) throw (RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const EventObject& Source) throw (RuntimeException);
+
+ bool hasOwnership() const { return m_bHasOwnership; }
+
+ protected:
+ ~CloseListener_Impl()
+ {
+ }
+
+ private:
+ bool m_bHasOwnership;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL CloseListener_Impl::queryClosing( const EventObject& i_source, ::sal_Bool i_deliverOwnership ) throw (CloseVetoException, RuntimeException)
+ {
+ (void)i_source;
+
+ if ( !m_bHasOwnership )
+ m_bHasOwnership = i_deliverOwnership;
+
+ throw CloseVetoException();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL CloseListener_Impl::notifyClosing( const EventObject& i_source ) throw (RuntimeException)
+ {
+ (void)i_source;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL CloseListener_Impl::disposing( const EventObject& i_source ) throw (RuntimeException)
+ {
+ (void)i_source;
+ }
+
+ //==================================================================================================================
+ //= CloseVeto_Data
+ //==================================================================================================================
+ struct DBACCESS_DLLPRIVATE CloseVeto_Data
+ {
+ Reference< XCloseable > xCloseable;
+ ::rtl::Reference< CloseListener_Impl > pListener;
+ };
+
+ //==================================================================================================================
+ //= operations
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_init( CloseVeto_Data& i_data, const Reference< XInterface >& i_closeable )
+ {
+ i_data.xCloseable.set( i_closeable, UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( i_data.xCloseable.is(), "CloseVeto: the component is not closeable!" );
+
+ i_data.pListener = new CloseListener_Impl;
+ i_data.xCloseable->addCloseListener( i_data.pListener.get() );
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_deinit( CloseVeto_Data& i_data )
+ {
+ if ( !i_data.xCloseable.is() )
+ return;
+
+ i_data.xCloseable->removeCloseListener( i_data.pListener.get() );
+ if ( i_data.pListener->hasOwnership() )
+ {
+ try
+ {
+ i_data.xCloseable->close( sal_True );
+ }
+ catch( const CloseVetoException& ) { }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ }
+
+ //==================================================================================================================
+ //= CloseVeto
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ CloseVeto::CloseVeto( const Reference< XInterface >& i_closeable )
+ :m_pData( new CloseVeto_Data )
+ {
+ lcl_init( *m_pData, i_closeable );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ CloseVeto::~CloseVeto()
+ {
+ lcl_deinit( *m_pData );
+ }
+
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
diff --git a/dbaccess/source/ui/app/closeveto.hxx b/dbaccess/source/ui/app/closeveto.hxx
new file mode 100644
index 000000000000..f7e1c83644d1
--- /dev/null
+++ b/dbaccess/source/ui/app/closeveto.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef DBACCESS_CLOSEVETO_HXX
+#define DBACCESS_CLOSEVETO_HXX
+
+#include "dbaccessdllapi.h"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/uno/XInterface.hpp>
+/** === end UNO includes === **/
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace dbaui
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= CloseVeto
+ //==================================================================================================================
+ struct CloseVeto_Data;
+ /** will add a XCloseListener to a given component, and veto its closing as long as the <code>CloseVeto</code>
+ instance is alive.
+
+ If closing has been requested and vetoed while the <code>CloseVeto</code> instance is alive, and the ownership
+ went to the <code>CloseVeto</code> instance, then it will close the component in its dtor.
+ */
+ class DBACCESS_DLLPRIVATE CloseVeto
+ {
+ public:
+ CloseVeto( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_closeable );
+ ~CloseVeto();
+
+ private:
+ ::boost::scoped_ptr< CloseVeto_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
+
+#endif // DBACCESS_CLOSEVETO_HXX
diff --git a/dbaccess/source/ui/app/makefile.mk b/dbaccess/source/ui/app/makefile.mk
index 658456f4135b..10c1821357c7 100644
--- a/dbaccess/source/ui/app/makefile.mk
+++ b/dbaccess/source/ui/app/makefile.mk
@@ -49,7 +49,8 @@ EXCEPTIONSFILES=\
$(SLO)$/AppSwapWindow.obj \
$(SLO)$/AppTitleWindow.obj \
$(SLO)$/AppView.obj \
- $(SLO)$/subcomponentmanager.obj
+ $(SLO)$/subcomponentmanager.obj \
+ $(SLO)$/closeveto.obj
SLOFILES =\
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 7b4293318712..9a632e960499 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -738,7 +738,7 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r
const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)))
xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser;
-
+#if 0
{
const Reference< XPropertySet > xRowSetProps( getRowSet(), UNO_QUERY );
const Reference< XSingleSelectQueryAnalyzer > xAnalyzer( xRowSetProps->getPropertyValue( PROPERTY_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY );
@@ -758,15 +758,23 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r
}
}
}
+#endif
Reference< XWarningsSupplier > xWarnings( _rxLoadable, UNO_QUERY );
if ( xWarnings.is() )
{
- SQLExceptionInfo aInfo( xWarnings->getWarnings() );
- if ( aInfo.isValid() )
+ try
+ {
+ SQLExceptionInfo aInfo( xWarnings->getWarnings() );
+ if ( aInfo.isValid() )
+ {
+ showError( aInfo );
+ impl_checkForCannotSelectUnfiltered( aInfo );
+ }
+ }
+ catch(const SQLException& e)
{
- showError( aInfo );
- impl_checkForCannotSelectUnfiltered( aInfo );
+ (void)e;
}
}
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 706d58400c2d..318fdb152cde 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -896,6 +896,9 @@ void OGenericUnoController::disposing()
m_xMasterDispatcher = NULL;
m_xSlaveDispatcher = NULL;
m_xServiceFactory = NULL;
+ m_xTitleHelper.clear();
+ m_xUrlTransformer.clear();
+ m_aInitParameters.clear();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 216afb3caf2c..5c24514812fa 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -470,7 +470,7 @@ void SbaTableQueryBrowser::impl_sanitizeRowSetClauses_nothrow()
// 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;
+ bool invalidColumn = nOrderColumns == 0;
for ( sal_Int32 c=0; ( c < nOrderColumns ) && !invalidColumn; ++c )
{
const Reference< XPropertySet > xOrderColumn( xOrderColumns->getByIndex(c), UNO_QUERY_THROW );
@@ -2697,6 +2697,8 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
sStatus.SearchAndReplaceAscii("$name$", aName);
BrowserViewStatusDisplay aShowStatus(static_cast<UnoDataBrowserView*>(getView()), sStatus);
+
+ sal_Bool bEscapeProcessing = sal_True;
if(xNameAccess.is() && xNameAccess->hasByName(sSimpleName))
{
DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(_pEntry->GetUserData());
@@ -2707,38 +2709,42 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
{
pData->xObjectProperties = pData->xObjectProperties.query( xObject );
// if the query contains a parameterized statement and preview is enabled we won't get any data.
- if ( m_bPreview && nCommandType == CommandType::QUERY && xObject.is() )
+ if ( nCommandType == CommandType::QUERY && xObject.is() )
{
- ::rtl::OUString sSql;
Reference<XPropertySet> xObjectProps(xObject,UNO_QUERY);
- xObjectProps->getPropertyValue(PROPERTY_COMMAND) >>= sSql;
- Reference< XMultiServiceFactory > xFactory( pConData->xConnection, UNO_QUERY );
- if (xFactory.is())
+ xObjectProps->getPropertyValue(PROPERTY_ESCAPE_PROCESSING) >>= bEscapeProcessing;
+ if ( m_bPreview )
{
- try
+ ::rtl::OUString sSql;
+ xObjectProps->getPropertyValue(PROPERTY_COMMAND) >>= sSql;
+ Reference< XMultiServiceFactory > xFactory( pConData->xConnection, UNO_QUERY );
+ if (xFactory.is())
{
- Reference<XSingleSelectQueryAnalyzer> xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
- if ( xAnalyzer.is() )
+ try
{
- xAnalyzer->setQuery(sSql);
- Reference<XParametersSupplier> xParSup(xAnalyzer,UNO_QUERY);
- if ( xParSup->getParameters()->getCount() > 0 )
+ Reference<XSingleSelectQueryAnalyzer> xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
+ if ( xAnalyzer.is() )
{
- String sFilter = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE "));
- sFilter = sFilter + xAnalyzer->getFilter();
- String sReplace(sSql);
- sReplace.SearchAndReplace(sFilter,String());
- xAnalyzer->setQuery(sReplace);
- Reference<XSingleSelectQueryComposer> xComposer(xAnalyzer,UNO_QUERY);
- xComposer->setFilter(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0=1")));
- aName = xAnalyzer->getQuery();
- nCommandType = CommandType::COMMAND;
+ xAnalyzer->setQuery(sSql);
+ Reference<XParametersSupplier> xParSup(xAnalyzer,UNO_QUERY);
+ if ( xParSup->getParameters()->getCount() > 0 )
+ {
+ String sFilter = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE "));
+ sFilter = sFilter + xAnalyzer->getFilter();
+ String sReplace(sSql);
+ sReplace.SearchAndReplace(sFilter,String());
+ xAnalyzer->setQuery(sReplace);
+ Reference<XSingleSelectQueryComposer> xComposer(xAnalyzer,UNO_QUERY);
+ xComposer->setFilter(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0=1")));
+ aName = xAnalyzer->getQuery();
+ nCommandType = CommandType::COMMAND;
+ }
}
}
- }
- catch (Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
+ catch (Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
}
}
@@ -2747,7 +2753,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry )
}
String sDataSourceName( getDataSourceAcessor( pConnection ) );
- bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, sal_True, pConData->xConnection );
+ bSuccess = implLoadAnything( sDataSourceName, aName, nCommandType, bEscapeProcessing, pConData->xConnection );
if ( !bSuccess )
{ // clean up
criticalFail();
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index c30b36782582..a3fa95b01533 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -1680,35 +1680,7 @@ void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr )
}
if ( sDefault.getLength() )
- {
- sal_uInt32 nFormatKey;
- try
- {
- if ( isTextFormat(pFieldDescr,nFormatKey) || pBoolDefault )
- {
- pFieldDescr->SetControlDefault(makeAny(sDefault));
- }
- else
- {
- try
- {
- double nValue = GetFormatter()->convertStringToNumber(nFormatKey,sDefault);
- nValue = checkDoubleForDateFormat(nValue,nFormatKey,GetFormatter());
- pFieldDescr->SetControlDefault(makeAny(nValue));
- }
- catch(const Exception&)
- {
- if ( sDefault.getLength() )
- pFieldDescr->SetControlDefault(makeAny(sDefault));
- else
- pFieldDescr->SetControlDefault(Any());
- }
- }
- }
- catch(const Exception&)
- {
- }
- }
+ pFieldDescr->SetControlDefault(makeAny(sDefault));
else
pFieldDescr->SetControlDefault(Any());
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 968fc0127157..583f180bb8f3 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -208,6 +208,8 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_DOSLINEENDS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreferDosLikeLineEnds" ) ) ) );
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_CONN_SOCKET, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalSocket" ) ) ) );
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_NAMED_PIPE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NamedPipe" ) ) ) );
+ m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_RESPECTRESULTSETTYPE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RespectDriverResultSetType" ) ) ) );
+ m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_MAX_ROW_SCAN, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxRowScan" ) ) ) );
// special settings for adabas
m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_CONN_SHUTSERVICE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase"))));
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index d7dec225f1a8..2ee4b8b8df33 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -96,6 +96,7 @@ namespace dbaui
,m_pIgnoreCurrency(NULL)
,m_pEscapeDateTime(NULL)
,m_pPrimaryKeySupport(NULL)
+ ,m_pRespectDriverResultSetType(NULL)
,m_pBooleanComparisonModeLabel( NULL )
,m_pBooleanComparisonMode( NULL )
,m_pMaxRowScanLabel( NULL )
@@ -207,6 +208,7 @@ namespace dbaui
DELETEZ( m_pIgnoreCurrency );
DELETEZ( m_pEscapeDateTime );
DELETEZ( m_pPrimaryKeySupport );
+ DELETEZ( m_pRespectDriverResultSetType );
DELETEZ( m_pBooleanComparisonModeLabel );
DELETEZ( m_pBooleanComparisonMode );
DELETEZ( m_pMaxRowScanLabel );
@@ -220,21 +222,22 @@ namespace dbaui
// for easier maintainance, write the table in this form, then copy it to m_aBooleanSettings
BooleanSettingDesc aSettings[] = {
- { &m_pIsSQL92Check, CB_SQL92CHECK, DSID_SQL92CHECK, false },
- { &m_pAppendTableAlias, CB_APPENDTABLEALIAS, DSID_APPEND_TABLE_ALIAS, false },
- { &m_pAsBeforeCorrelationName, CB_AS_BEFORE_CORR_NAME, DSID_AS_BEFORE_CORRNAME, false },
- { &m_pEnableOuterJoin, CB_ENABLEOUTERJOIN, DSID_ENABLEOUTERJOIN, false },
- { &m_pIgnoreDriverPrivileges, CB_IGNOREDRIVER_PRIV, DSID_IGNOREDRIVER_PRIV, false },
- { &m_pParameterSubstitution, CB_PARAMETERNAMESUBST, DSID_PARAMETERNAMESUBST, false },
- { &m_pSuppressVersionColumn, CB_SUPPRESVERSIONCL, DSID_SUPPRESSVERSIONCL, true },
- { &m_pCatalog, CB_CATALOG, DSID_CATALOG, false },
- { &m_pSchema, CB_SCHEMA, DSID_SCHEMA, false },
- { &m_pIndexAppendix, CB_IGNOREINDEXAPPENDIX, DSID_INDEXAPPENDIX, false },
- { &m_pDosLineEnds, CB_DOSLINEENDS, DSID_DOSLINEENDS, false },
- { &m_pCheckRequiredFields, CB_CHECK_REQUIRED, DSID_CHECK_REQUIRED_FIELDS, false },
- { &m_pIgnoreCurrency, CB_IGNORECURRENCY, DSID_IGNORECURRENCY, false },
- { &m_pEscapeDateTime, CB_ESCAPE_DATETIME, DSID_ESCAPE_DATETIME, false },
- { &m_pPrimaryKeySupport, CB_PRIMARY_KEY_SUPPORT, DSID_PRIMARY_KEY_SUPPORT, false },
+ { &m_pIsSQL92Check, CB_SQL92CHECK, DSID_SQL92CHECK, false },
+ { &m_pAppendTableAlias, CB_APPENDTABLEALIAS, DSID_APPEND_TABLE_ALIAS, false },
+ { &m_pAsBeforeCorrelationName, CB_AS_BEFORE_CORR_NAME, DSID_AS_BEFORE_CORRNAME, false },
+ { &m_pEnableOuterJoin, CB_ENABLEOUTERJOIN, DSID_ENABLEOUTERJOIN, false },
+ { &m_pIgnoreDriverPrivileges, CB_IGNOREDRIVER_PRIV, DSID_IGNOREDRIVER_PRIV, false },
+ { &m_pParameterSubstitution, CB_PARAMETERNAMESUBST, DSID_PARAMETERNAMESUBST, false },
+ { &m_pSuppressVersionColumn, CB_SUPPRESVERSIONCL, DSID_SUPPRESSVERSIONCL, true },
+ { &m_pCatalog, CB_CATALOG, DSID_CATALOG, false },
+ { &m_pSchema, CB_SCHEMA, DSID_SCHEMA, false },
+ { &m_pIndexAppendix, CB_IGNOREINDEXAPPENDIX, DSID_INDEXAPPENDIX, false },
+ { &m_pDosLineEnds, CB_DOSLINEENDS, DSID_DOSLINEENDS, false },
+ { &m_pCheckRequiredFields, CB_CHECK_REQUIRED, DSID_CHECK_REQUIRED_FIELDS, false },
+ { &m_pIgnoreCurrency, CB_IGNORECURRENCY, DSID_IGNORECURRENCY, false },
+ { &m_pEscapeDateTime, CB_ESCAPE_DATETIME, DSID_ESCAPE_DATETIME, false },
+ { &m_pPrimaryKeySupport, CB_PRIMARY_KEY_SUPPORT, DSID_PRIMARY_KEY_SUPPORT, false },
+ { &m_pRespectDriverResultSetType, CB_RESPECTRESULTSETTYPE,DSID_RESPECTRESULTSETTYPE, false },
{ NULL, 0, 0, false }
};
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc
index 193fdf5f3853..81c296916b09 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hrc
+++ b/dbaccess/source/ui/dlg/advancedsettings.hrc
@@ -62,6 +62,7 @@
#define CB_IGNORECURRENCY 14
#define CB_ESCAPE_DATETIME 15
#define CB_PRIMARY_KEY_SUPPORT 16
+#define CB_RESPECTRESULTSETTYPE 17
#define ET_AUTOINCREMENTVALUE 1
#define ET_RETRIEVE_AUTO 2
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx
index 6a6ae93f9f8e..3b29d4ba15ad 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.hxx
@@ -74,6 +74,7 @@ namespace dbaui
CheckBox* m_pIgnoreCurrency;
CheckBox* m_pEscapeDateTime;
CheckBox* m_pPrimaryKeySupport;
+ CheckBox* m_pRespectDriverResultSetType;
FixedText* m_pBooleanComparisonModeLabel;
ListBox* m_pBooleanComparisonMode;
diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src
index 9a2dc467d586..e54ccfbaf4e5 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.src
+++ b/dbaccess/source/ui/dlg/advancedsettings.src
@@ -217,6 +217,16 @@
Text [ en-US ] = "Supports primary keys"; \
};
+#define AUTO_RESPECTRESULTSETTYPE(AUTO_Y) \
+ CheckBox CB_RESPECTRESULTSETTYPE \
+ { \
+ Pos = MAP_APPFONT ( 6 , AUTO_Y ) ; \
+ Size = MAP_APPFONT ( ADVANCED_PAGE_X - 12 , CHECKBOX_HEIGHT ) ; \
+ TabStop = TRUE ; \
+ HelpId = HID_DSADMIN_RESPECTRESULTSETTYPE; \
+ Text [ en-US ] = "Respect the result set type from the database driver"; \
+ };
+
//-------------------------------------------------------------------------
@@ -351,8 +361,9 @@ TabPage PAGE_ADVANCED_SETTINGS_SPECIAL
AUTO_IGNORECURRENCY( 13*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 12*CHECKBOX_HEIGHT + RELATED_CONTROLS )
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 )
+ AUTO_RESPECTRESULTSETTYPE( 16*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 16*CHECKBOX_HEIGHT + RELATED_CONTROLS )
+ AUTO_BOOLEANCOMPARISON( 17*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 )
+ AUTO_MAXROWSCAN( 18*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 )
};
//-------------------------------------------------------------------------
@@ -382,5 +393,5 @@ TabDialog DLG_DATABASE_ADVANCED
Text [ en-US ] = "Special Settings";
};
- Text [ en-US ] = "Advanced Properties" ;
+ Text [ en-US ] = "Advanced Settings" ;
};
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 510b1864eb0b..65929fb204d6 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 SfxStringItem(DSID_NAMED_PIPE, String());
*pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT );
*pCounter++ = new SfxInt32Item(DSID_MAX_ROW_SCAN, 100);
+ *pCounter++ = new SfxBoolItem( DSID_RESPECTRESULTSETTYPE,sal_False );
// create the pool
static SfxItemInfo const aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] =
@@ -473,6 +474,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/dbu_qry.hrc b/dbaccess/source/ui/inc/dbu_qry.hrc
index 26bd4c82b374..bf09f2356de4 100644
--- a/dbaccess/source/ui/inc/dbu_qry.hrc
+++ b/dbaccess/source/ui/inc/dbu_qry.hrc
@@ -56,8 +56,8 @@
#define STR_QUERY_NOTABLE RID_STR_QRY_START + 21
#define STR_QRY_ORDERBY_UNRELATED RID_STR_QRY_START + 22
#define STR_QUERY_HANDLETEXT RID_STR_QRY_START + 23
-#define STR_QUERY_FALSE RID_STR_QRY_START + 24
-#define STR_QUERY_TRUE RID_STR_QRY_START + 25
+// free
+// free
#define STR_QRY_TOO_MANY_COLUMNS RID_STR_QRY_START + 26
#define STR_SVT_SQL_SYNTAX_ERROR RID_STR_QRY_START + 27
#define STR_QUERYDESIGN_NO_VIEW_SUPPORT RID_STR_QRY_START + 28
diff --git a/dbaccess/source/ui/inc/dsitems.hxx b/dbaccess/source/ui/inc/dsitems.hxx
index 9cc4d85808c8..d54cf88e4a94 100644
--- a/dbaccess/source/ui/inc/dsitems.hxx
+++ b/dbaccess/source/ui/inc/dsitems.hxx
@@ -94,6 +94,7 @@ typedef sal_Int32 ItemID;
#define DSID_NAMED_PIPE 58
#define DSID_PRIMARY_KEY_SUPPORT 59
#define DSID_MAX_ROW_SCAN 60
+#define DSID_RESPECTRESULTSETTYPE 61
// don't forget to adjust DSID_LAST_ITEM_ID below!
@@ -101,7 +102,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_MAX_ROW_SCAN
+#define DSID_LAST_ITEM_ID DSID_RESPECTRESULTSETTYPE
#endif // _DBAUI_DATASOURCEITEMS_HXX_
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
index 5efa09c0c3cb..8f7b4f4f1283 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -134,6 +134,7 @@ namespace dbaui
|| has( DSID_ESCAPE_DATETIME )
|| has( DSID_PRIMARY_KEY_SUPPORT )
|| has( DSID_MAX_ROW_SCAN )
+ || has( DSID_RESPECTRESULTSETTYPE )
;
}
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index e0b0dd4d8a34..2ce3a919351b 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -446,7 +446,8 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl
if ( eNumLang != LANGUAGE_NONE )
{
nFormatKey = m_pFormatter->GetFormatForLanguageIfBuiltIn( nFormatKey, eNumLang );
- m_pFormatter->IsNumberFormat( m_sTextToken, nFormatKey, fOutNumber );
+ if ( !m_pFormatter->IsNumberFormat( m_sTextToken, nFormatKey, fOutNumber ) )
+ return NumberFormat::TEXT;
}
Reference<XPropertySet> xProp = xFormats->getByKey(nFormatKey);
xProp->getPropertyValue(PROPERTY_TYPE) >>= nNumberFormat;
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index 967f9752eb4d..572190fb746e 100644
--- a/dbaccess/source/ui/misc/databaseobjectview.cxx
+++ b/dbaccess/source/ui/misc/databaseobjectview.cxx
@@ -163,9 +163,6 @@ namespace dbaui
0,
i_rDispatchArgs.getPropertyValues()
);
-
- if ( !xReturn.is() )
- xReturn.set( m_xFrameLoader, UNO_QUERY );
}
catch( const Exception& )
{
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index 945489cf7b62..afc4f109f0ab 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -94,6 +94,7 @@ namespace dbaui
{ DSID_IGNORECURRENCY, "IgnoreCurrency" },
{ DSID_ESCAPE_DATETIME, "EscapeDateTime" },
{ DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" },
+ { DSID_RESPECTRESULTSETTYPE, "RespectDriverResultSetType" },
{ DSID_MAX_ROW_SCAN, "MaxRowScan" },
{ 0, NULL }
};
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index ccd9b3af9533..27912e355d69 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -1982,6 +1982,13 @@ namespace
break;
}
+ const OSQLParseNode* pTableExp = pParseTree->getChild(3);
+ if ( pTableExp->getChild(6)->count() > 0 || pTableExp->getChild(7)->count() > 0 || pTableExp->getChild(8)->count() > 0)
+ {
+ eErrorCode = eStatementTooComplex;
+ break;
+ }
+
Reference< XConnection> xConnection = rController.getConnection();
if ( !xConnection.is() )
{
@@ -2063,7 +2070,7 @@ namespace
pTableView->RemoveTabWin(aIterTableMap->second);
}
- if ( eOk == (eErrorCode = FillOuterJoins(_pView,pParseTree->getChild(3)->getChild(0)->getChild(1))) )
+ if ( eOk == (eErrorCode = FillOuterJoins(_pView,pTableExp->getChild(0)->getChild(1))) )
{
// check if we have a distinct statement
if(SQL_ISTOKEN(pParseTree->getChild(1),DISTINCT))
@@ -2405,9 +2412,10 @@ namespace
{
OQueryController& rController = static_cast<OQueryController&>(_pView->getController());
::connectivity::OSQLParseNode* pGroupBy = pSelectRoot->getChild(3)->getChild(2)->getChild(2);
- OTableFieldDescRef aDragInfo = new OTableFieldDesc();
+
for( sal_uInt32 i=0 ; i < pGroupBy->count() && eOk == eErrorCode; ++i )
{
+ OTableFieldDescRef aDragInfo = new OTableFieldDesc();
::connectivity::OSQLParseNode* pParamRef = NULL;
::connectivity::OSQLParseNode* pArgument = pGroupBy->getChild( i );
if(SQL_ISRULE(pArgument,column_ref))
diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src
index aae5a07545ae..e5d4b4d964e7 100644
--- a/dbaccess/source/ui/querydesign/query.src
+++ b/dbaccess/source/ui/querydesign/query.src
@@ -280,15 +280,7 @@ ErrorBox ERR_QRY_ORDERBY_ON_ASTERISK
Message [ en-US ] = "[*] cannot be used as a sort criterion.";
};
-String STR_QUERY_TRUE
-{
- Text [ en-US ] = "TRUE" ;
-};
-String STR_QUERY_FALSE
-{
- Text [ en-US ] = "FALSE" ;
-};
String STR_QRY_TOO_MANY_TABLES
{
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index a307f0766766..21b0e6f3e35a 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -610,6 +610,7 @@ TOTypeInfoSP OFieldDescription::getSpecialTypeInfo() const
*pSpecialType = *m_pType;
pSpecialType->nPrecision = GetPrecision();
pSpecialType->nMaximumScale = static_cast<sal_Int16>(GetScale());
+ pSpecialType->bAutoIncrement = IsAutoIncrement(); // http://dba.openoffice.org/issues/show_bug.cgi?id=115398 fixed by ludob
return pSpecialType;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 6884feaf2ef4..e0606f90d6fe 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -387,18 +387,14 @@ void OTableEditorCtrl::PaintCell(OutputDevice& rDev, const Rectangle& rRect,
sal_uInt16 nColumnId ) const
{
DBG_CHKTHIS(OTableEditorCtrl,NULL);
- String aText( GetCellText( m_nCurrentPos, nColumnId ));
- Point aPos(rRect.TopLeft());
- Size TxtSize(GetDataWindow().GetTextWidth(aText), GetDataWindow().GetTextHeight());
+ const String aText( GetCellText( m_nCurrentPos, nColumnId ));
+ const Point aPos(rRect.TopLeft());
+ const Size TxtSize(GetDataWindow().GetTextWidth(aText), GetDataWindow().GetTextHeight());
- if (aPos.X() < rRect.Right() || aPos.X() + TxtSize.Width() > rRect.Right() ||
- aPos.Y() < rRect.Top() || aPos.Y() + TxtSize.Height() > rRect.Bottom())
- rDev.SetClipRegion( rRect );
-
- rDev.DrawText(aPos, aText);
-
- if (rDev.IsClipRegion())
- rDev.SetClipRegion();
+ rDev.Push( PUSH_CLIPREGION );
+ rDev.SetClipRegion( rRect );
+ rDev.DrawText( rRect, aText, TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER );
+ rDev.Pop();
}
//------------------------------------------------------------------------------
@@ -1529,7 +1525,7 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ )
Reference<XPropertySet> xTable = rController.getTable();
//////////////////////////////////////////////////////////////
// Key darf nicht veraendert werden
- // Dies gilt jedoch nur, wenn die Tabelle nicht neu ist und keine ::com::sun::star::sdbcx::View. Ansonsten wird kein DROP ausgefhrt
+ // Dies gilt jedoch nur, wenn die Tabelle nicht neu ist und keine ::com::sun::star::sdbcx::View. Ansonsten wird kein DROP ausgef�hrt
if(xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW")))
return sal_False;
@@ -1551,7 +1547,7 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ )
{
//////////////////////////////////////////////////////////////
// Wenn Feldtyp Memo oder Image, kein PrimKey
- // oder wenn Spalten nicht gedroped werden knnen und das Required Flag ist nicht gesetzt
+ // oder wenn Spalten nicht gedroped werden k�nnen und das Required Flag ist nicht gesetzt
// oder wenn eine ::com::sun::star::sdbcx::View vorhanden ist und das Required Flag nicht gesetzt ist
TOTypeInfoSP pTypeInfo = pFieldDescr->getTypeInfo();
if( pTypeInfo->nSearchType == ColumnSearch::NONE
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 4969f740c7bb..09bf34044676 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -1027,14 +1027,40 @@ void OOle2Obj::NbcMove( const Size& rSize )
// stop listening
OObjectBase::EndListening(sal_False);
+ bool bPositionFixed = false;
+ Size aUndoSize(0,0);
+ bool bUndoMode = false;
if ( m_xReportComponent.is() )
{
OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ if (pRptModel->GetUndoEnv().IsUndoMode())
+ {
+ // if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode
+ bUndoMode = true;
+ }
OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
- m_xReportComponent->setPositionX(m_xReportComponent->getPositionX() + rSize.A());
- m_xReportComponent->setPositionY(m_xReportComponent->getPositionY() + rSize.B());
- }
+ // LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point?
+ int nNewX = m_xReportComponent->getPositionX() + rSize.A();
+ // can this hinder us to set components outside the area?
+ // if (nNewX < 0)
+ // {
+ // nNewX = 0;
+ // }
+ m_xReportComponent->setPositionX(nNewX);
+ int nNewY = m_xReportComponent->getPositionY() + rSize.B();
+ if (nNewY < 0 && !bUndoMode)
+ {
+ aUndoSize.B() = abs(nNewY);
+ bPositionFixed = true;
+ nNewY = 0;
+ }
+ m_xReportComponent->setPositionY(nNewY);
+ }
+ if (bPositionFixed)
+ {
+ GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
+ }
// set geometry properties
SetPropsFromRect(GetLogicRect());
diff --git a/reportdesign/source/ui/inc/ReportSection.hxx b/reportdesign/source/ui/inc/ReportSection.hxx
index cc64b29f9223..11e2ada247a0 100644
--- a/reportdesign/source/ui/inc/ReportSection.hxx
+++ b/reportdesign/source/ui/inc/ReportSection.hxx
@@ -60,6 +60,7 @@ namespace rptui
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pMulti;
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > m_xSection;
+ sal_Int32 m_nPaintEntranceCount;
DlgEdMode m_eMode;
sal_Bool m_bDialogModelChanged;
@@ -68,6 +69,9 @@ namespace rptui
/** fills the section with all control from the report section
*/
void fill();
+ /** checks all objects if they fit in the new paper width.
+ */
+ void impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_Int32 i_nLeftMargin,sal_Int32 i_nRightMargin);
OReportSection(OReportSection&);
void operator =(OReportSection&);
diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx
index 290076b6732c..27200bd2f3d0 100644
--- a/reportdesign/source/ui/inc/ReportWindow.hxx
+++ b/reportdesign/source/ui/inc/ReportWindow.hxx
@@ -37,6 +37,7 @@
#include <vector>
#include <boost/shared_ptr.hpp>
+#include <comphelper/propmultiplex.hxx>
#include <MarkedSection.hxx>
#include "ViewsWindow.hxx"
@@ -55,12 +56,16 @@ namespace rptui
class DlgEdFunc;
class DlgEdFactory;
- class OReportWindow : public Window, public IMarkedSection
+ class OReportWindow : public Window
+ , public IMarkedSection
+ , public ::cppu::BaseMutex
+ , public ::comphelper::OPropertyChangeListener
{
Ruler m_aHRuler;
ODesignView* m_pView;
OScrollWindowHelper* m_pParent;
OViewsWindow m_aViewsWindow;
+ ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
::std::auto_ptr<DlgEdFactory>
m_pObjFac;
@@ -73,6 +78,8 @@ namespace rptui
void operator =(OReportWindow&);
protected:
virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
public:
OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView);
virtual ~OReportWindow();
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 8b7cae395c33..94565d669026 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -868,7 +868,10 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const
uno::Reference< inspection::XNumericControl > xNumericControl(aOut.Control,uno::UNO_QUERY);
xNumericControl->setDecimalDigits( 2 );
xNumericControl->setValueUnit( util::MeasureUnit::MM_100TH );
- xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
+ uno::Reference< drawing::XShapeDescriptor> xShapeDesc(m_xReportComponent,uno::UNO_QUERY);
+ bool bSetMin = !xShapeDesc.is() || xShapeDesc->getShapeType() != ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape"));
+ if ( bSetMin )
+ xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
if ( nDisplayUnit != -1 )
xNumericControl->setDisplayUnit( nDisplayUnit );
uno::Reference< report::XReportComponent> xComp(m_xReportComponent,uno::UNO_QUERY);
@@ -886,7 +889,8 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const
case PROPERTY_ID_POSITIONX:
case PROPERTY_ID_POSITIONY:
case PROPERTY_ID_WIDTH:
- xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
+ if ( bSetMin )
+ xNumericControl->setMinValue(beans::Optional<double>(sal_True,0.0));
xNumericControl->setMaxValue(beans::Optional<double>(sal_True,double(aSize.Width - nLeftMargin - nRightMargin)));
if ( PROPERTY_ID_WIDTH == nId )
{
diff --git a/reportdesign/source/ui/misc/ColorListener.cxx b/reportdesign/source/ui/misc/ColorListener.cxx
index 4c37cfa888f1..fc9c57d829cf 100644
--- a/reportdesign/source/ui/misc/ColorListener.cxx
+++ b/reportdesign/source/ui/misc/ColorListener.cxx
@@ -81,15 +81,21 @@ void OColorListener::DataChanged( const DataChangedEvent& rDCEvt )
// -----------------------------------------------------------------------------
void OColorListener::setCollapsed(sal_Bool _bCollapsed)
{
- m_bCollapsed = _bCollapsed;
- if ( m_aCollapsedLink.IsSet() )
- m_aCollapsedLink.Call(this);
+ if ( m_bCollapsed != _bCollapsed )
+ {
+ m_bCollapsed = _bCollapsed;
+ if ( m_aCollapsedLink.IsSet() )
+ m_aCollapsedLink.Call(this);
+ }
}
// -----------------------------------------------------------------------------
void OColorListener::setMarked(sal_Bool _bMark)
{
- m_bMarked = _bMark;
- Invalidate();
+ if ( m_bMarked != _bMark)
+ {
+ m_bMarked = _bMark;
+ Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE);
+ }
}
// =======================================================================
}
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index a8dcd7ee351b..82a8f4cb8f64 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -869,23 +869,21 @@ SdrObject* isOver(const Rectangle& _rRect, SdrPage& _rPage, SdrView& _rView, boo
{
if ( _pIgnore != pObjIter
&& (_bAllObjects || !_rView.IsObjMarked(pObjIter))
- && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL))
{
if (_nIgnoreType == ISOVER_IGNORE_CUSTOMSHAPES && pObjIter->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
{
continue;
}
- OUnoObject* pObj = dynamic_cast<OUnoObject*>(pObjIter);
- if (pObj != NULL)
- {
-
- Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
- if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
- pOverlappedObj = pObjIter;
+ if (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL)
+ {
+ Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
+ if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
+ pOverlappedObj = pObjIter;
+ }
}
}
- }
return pOverlappedObj;
}
// -----------------------------------------------------------------------------
@@ -916,7 +914,7 @@ SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _
}
if ( (_bAllObjects || !_rView.IsObjMarked(pObjIter))
- && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL) )
{
Rectangle aRect = _rRect.GetIntersection(pObjIter->GetLastBoundRect());
if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) )
@@ -930,10 +928,9 @@ SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _
SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bUnMarkedObjects)
{
SdrObject* pOverlappedObj = NULL;
- OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(_pObj);
- if ( pUnoObj ) // this doesn't need to be done for shapes
+ if (dynamic_cast<OUnoObject*>(_pObj) != NULL || dynamic_cast<OOle2Obj*>(_pObj) != NULL) // this doesn't need to be done for shapes
{
- Rectangle aRect = pUnoObj->GetCurrentBoundRect();
+ Rectangle aRect = _pObj->GetCurrentBoundRect();
pOverlappedObj = isOver(aRect,_rPage,_rView,_bUnMarkedObjects,_pObj);
}
return pOverlappedObj;
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index b8791bc294ff..d12c5a63ff97 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -488,11 +488,8 @@ IMPL_LINK( ODesignView, SplitHdl, void*, )
if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow.getMaxMarkerWidth(sal_False) )
{
long nOldSplitPos = getController().getSplitPos();
+ (void)nOldSplitPos;
getController().setSplitPos(nTest);
- if ( nOldSplitPos != -1 && nOldSplitPos <= nTest )
- {
- Invalidate(/*INVALIDATE_NOCHILDREN*/);
- }
}
return 0L;
diff --git a/reportdesign/source/ui/report/EndMarker.cxx b/reportdesign/source/ui/report/EndMarker.cxx
index 77fb99286993..11a3b7127a88 100644
--- a/reportdesign/source/ui/report/EndMarker.cxx
+++ b/reportdesign/source/ui/report/EndMarker.cxx
@@ -47,7 +47,6 @@ OEndMarker::OEndMarker(Window* _pParent ,const ::rtl::OUString& _sColorEntry)
DBG_CTOR( rpt_OEndMarker,NULL);
SetUniqueId(HID_RPT_ENDMARKER);
ImplInitSettings();
- SetPaintTransparent(sal_True);
}
// -----------------------------------------------------------------------------
OEndMarker::~OEndMarker()
@@ -90,6 +89,10 @@ void OEndMarker::Paint( const Rectangle& /*rRect*/ )
// -----------------------------------------------------------------------
void OEndMarker::ImplInitSettings()
{
+ EnableChildTransparentMode( sal_True );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( sal_True );
+
SetBackground( Wallpaper( svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND).nColor) );
SetFillColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
}
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 3f44e172ee00..84d1b291c715 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -108,6 +108,7 @@
#include <svx/fmview.hxx>
#include <editeng/paperinf.hxx>
+#include <editeng/memberids.hrc>
#include <svx/svxids.hrc>
#include <svx/svdobj.hxx>
#include <svx/dataaccessdescriptor.hxx>
@@ -2481,8 +2482,11 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_LRSPACE,sal_True,&pItem))
{
- xProp->setPropertyValue(PROPERTY_LEFTMARGIN,uno::makeAny((sal_Int32)static_cast<const SvxLRSpaceItem*>(pItem)->GetLeft()));
- xProp->setPropertyValue(PROPERTY_RIGHTMARGIN,uno::makeAny((sal_Int32)static_cast<const SvxLRSpaceItem*>(pItem)->GetRight()));
+ Any aValue;
+ static_cast<const SvxLRSpaceItem*>(pItem)->QueryValue(aValue,MID_L_MARGIN);
+ xProp->setPropertyValue(PROPERTY_LEFTMARGIN,aValue);
+ static_cast<const SvxLRSpaceItem*>(pItem)->QueryValue(aValue,MID_R_MARGIN);
+ xProp->setPropertyValue(PROPERTY_RIGHTMARGIN,aValue);
}
if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_ULSPACE,sal_True,&pItem))
{
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index 54ccff238de2..c169d798562b 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -96,14 +96,18 @@ OReportSection::OReportSection(OSectionWindow* _pParent,const uno::Reference< re
,m_pMulti(NULL)
,m_pReportListener(NULL)
,m_xSection(_xSection)
+,m_nPaintEntranceCount(0)
,m_eMode(RPTUI_SELECT)
,m_bDialogModelChanged(sal_False)
,m_bInDrag(sal_False)
{
DBG_CTOR( rpt_OReportSection,NULL);
- EnableChildTransparentMode();
+ //EnableChildTransparentMode();
SetHelpId(HID_REPORTSECTION);
SetMapMode( MapMode( MAP_100TH_MM ) );
+ SetParentClipMode( PARENTCLIPMODE_CLIP );
+ EnableChildTransparentMode( sal_False );
+ SetPaintTransparent( sal_False );
try
{
@@ -141,8 +145,9 @@ void OReportSection::Paint( const Rectangle& rRect )
{
Window::Paint(rRect);
- if ( m_pView )
+ if ( m_pView && m_nPaintEntranceCount == 0)
{
+ ++m_nPaintEntranceCount;
// repaint, get PageView and prepare Region
SdrPageView* pPgView = m_pView->GetSdrPageView();
const Region aPaintRectRegion(rRect);
@@ -157,10 +162,7 @@ void OReportSection::Paint( const Rectangle& rRect )
OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
// draw background self using wallpaper
OutputDevice& rTargetOutDev = pTargetPaintWindow->GetTargetOutputDevice();
- sal_Int32 nColor = m_xSection->getBackColor();
- if ( nColor == (sal_Int32)COL_TRANSPARENT )
- nColor = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_BACKCOLOR);
- rTargetOutDev.DrawWallpaper(rRect, Wallpaper(Color(nColor)));
+ rTargetOutDev.DrawWallpaper(rRect, Wallpaper(pPgView->GetApplicationDocumentColor()));
}
// do paint (unbuffered) and mark repaint end
@@ -171,21 +173,13 @@ void OReportSection::Paint( const Rectangle& rRect )
}
m_pView->CompleteRedraw(this,aPaintRectRegion);
+ --m_nPaintEntranceCount;
}
}
//------------------------------------------------------------------------------
void OReportSection::Resize()
{
Window::Resize();
- if ( m_xSection.is() && m_pPage && m_pView )
- {
- uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
- m_pPage->SetSize( Size( getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width,5*m_xSection->getHeight()) );
- const Size aPageSize = m_pPage->GetSize();
- const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
- const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
- m_pView->SetWorkArea( Rectangle( Point( nLeftMargin, 0), Size(aPageSize.Width() - nLeftMargin - nRightMargin,aPageSize.Height()) ) );
- }
}
//------------------------------------------------------------------------------
void OReportSection::fill()
@@ -234,8 +228,9 @@ void OReportSection::fill()
nColor = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_BACKCOLOR);
m_pView->SetApplicationDocumentColor(nColor);
- const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_LEFTMARGIN);
- const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(m_xSection->getReportDefinition(),PROPERTY_RIGHTMARGIN);
+ uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
+ const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
m_pPage->SetLftBorder(nLeftMargin);
m_pPage->SetRgtBorder(nRightMargin);
@@ -245,15 +240,9 @@ void OReportSection::fill()
m_pView->SetDesignMode( sal_True );
m_pView->StartListening( *m_pModel );
- if ( m_xSection.is() && m_pPage && m_pView )
- {
- uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
- m_pPage->SetSize( Size( getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width,5*m_xSection->getHeight()) );
- const Size aPageSize = m_pPage->GetSize();
- const sal_Int32 nWorkAreaLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
- const sal_Int32 nWorkAreaRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
- m_pView->SetWorkArea( Rectangle( Point( nWorkAreaLeftMargin, 0), Size(aPageSize.Width() - nWorkAreaLeftMargin - nWorkAreaRightMargin,aPageSize.Height()) ) );
- }
+ m_pPage->SetSize( Size( getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width,5*m_xSection->getHeight()) );
+ const Size aPageSize = m_pPage->GetSize();
+ m_pView->SetWorkArea( Rectangle( Point( nLeftMargin, 0), Size(aPageSize.Width() - nLeftMargin - nRightMargin,aPageSize.Height()) ) );
}
// -----------------------------------------------------------------------------
void OReportSection::Paste(const uno::Sequence< beans::NamedValue >& _aAllreadyCopiedObjects,bool _bForce)
@@ -538,78 +527,90 @@ void OReportSection::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
else
{
uno::Reference<report::XReportDefinition> xReportDefinition = m_xSection->getReportDefinition();
+ const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
+ const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
+ const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
+
if ( _rEvent.PropertyName == PROPERTY_LEFTMARGIN )
{
- const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
m_pPage->SetLftBorder(nLeftMargin);
}
else if ( _rEvent.PropertyName == PROPERTY_RIGHTMARGIN )
{
- const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
m_pPage->SetRgtBorder(nRightMargin);
}
-
- try
+ const Size aOldPageSize = m_pPage->GetSize();
+ sal_Int32 nNewHeight = 5*m_xSection->getHeight();
+ if ( aOldPageSize.Height() != nNewHeight || nPaperWidth != aOldPageSize.Width() )
{
- const sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
- const sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN);
- const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
- const sal_Int32 nCount = m_xSection->getCount();
- for (sal_Int32 i = 0; i < nCount; ++i)
+ m_pPage->SetSize( Size( nPaperWidth,nNewHeight) );
+ const Size aPageSize = m_pPage->GetSize();
+ m_pView->SetWorkArea( Rectangle( Point( nLeftMargin, 0), Size(aPageSize.Width() - nLeftMargin - nRightMargin,aPageSize.Height()) ) );
+ }
+ impl_adjustObjectSizePosition(nPaperWidth,nLeftMargin,nRightMargin);
+ m_pParent->Invalidate(INVALIDATE_UPDATE | INVALIDATE_TRANSPARENT);
+ }
+ }
+}
+void OReportSection::impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_Int32 i_nLeftMargin,sal_Int32 i_nRightMargin)
+{
+ try
+ {
+ sal_Int32 nRightBorder = i_nPaperWidth - i_nRightMargin;
+ const sal_Int32 nCount = m_xSection->getCount();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ bool bChanged = false;
+ uno::Reference< report::XReportComponent> xReportComponent(m_xSection->getByIndex(i),uno::UNO_QUERY_THROW);
+ awt::Point aPos = xReportComponent->getPosition();
+ awt::Size aSize = xReportComponent->getSize();
+ SvxShape* pShape = SvxShape::getImplementation( xReportComponent );
+ SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL;
+ if ( pObject )
+ {
+ OObjectBase* pBase = dynamic_cast<OObjectBase*>(pObject);
+ pBase->EndListening(sal_False);
+ if ( aPos.X < i_nLeftMargin )
+ {
+ aPos.X = i_nLeftMargin;
+ bChanged = true;
+ }
+ if ( (aPos.X + aSize.Width) > nRightBorder )
{
- bool bChanged = false;
- uno::Reference< report::XReportComponent> xReportComponent(m_xSection->getByIndex(i),uno::UNO_QUERY_THROW);
- awt::Point aPos = xReportComponent->getPosition();
- awt::Size aSize = xReportComponent->getSize();
- SvxShape* pShape = SvxShape::getImplementation( xReportComponent );
- SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL;
- if ( pObject )
+ aPos.X = nRightBorder - aSize.Width;
+ if ( aPos.X < i_nLeftMargin )
{
- OObjectBase* pBase = dynamic_cast<OObjectBase*>(pObject);
- pBase->EndListening(sal_False);
- if ( aPos.X < nLeftMargin )
- {
- aPos.X = nLeftMargin;
- bChanged = true;
- }
- if ( (aPos.X + aSize.Width) > (nPaperWidth - nRightMargin) )
- {
- aPos.X = nPaperWidth - nRightMargin - aSize.Width;
- if ( aPos.X < nLeftMargin )
- {
- aSize.Width += aPos.X - nLeftMargin;
- aPos.X = nLeftMargin;
- // add listener around
- pBase->StartListening();
- xReportComponent->setSize(aSize);
- pBase->EndListening(sal_False);
- }
- bChanged = true;
- }
- if ( aPos.Y < 0 )
- aPos.Y = 0;
- if ( bChanged )
- {
- xReportComponent->setPosition(aPos);
- correctOverlapping(pObject,*this,false);
- Rectangle aRet(VCLPoint(xReportComponent->getPosition()),VCLSize(xReportComponent->getSize()));
- aRet.setHeight(aRet.getHeight() + 1);
- aRet.setWidth(aRet.getWidth() + 1);
- if ( m_xSection.is() && (static_cast<sal_uInt32>(aRet.getHeight() + aRet.Top()) > m_xSection->getHeight()) )
- m_xSection->setHeight(aRet.getHeight() + aRet.Top());
- }
+ aSize.Width += aPos.X - i_nLeftMargin;
+ aPos.X = i_nLeftMargin;
+ // add listener around
pBase->StartListening();
+ xReportComponent->setSize(aSize);
+ pBase->EndListening(sal_False);
}
+ bChanged = true;
}
+ if ( aPos.Y < 0 )
+ aPos.Y = 0;
+ if ( bChanged )
+ {
+ xReportComponent->setPosition(aPos);
+ correctOverlapping(pObject,*this,false);
+ Rectangle aRet(VCLPoint(xReportComponent->getPosition()),VCLSize(xReportComponent->getSize()));
+ aRet.setHeight(aRet.getHeight() + 1);
+ aRet.setWidth(aRet.getWidth() + 1);
+ if ( m_xSection.is() && (static_cast<sal_uInt32>(aRet.getHeight() + aRet.Top()) > m_xSection->getHeight()) )
+ m_xSection->setHeight(aRet.getHeight() + aRet.Top());
+
+ pObject->RecalcBoundRect();
+ }
+ pBase->StartListening();
}
- catch(uno::Exception)
- {
- OSL_FAIL("Exception caught: OReportSection::_propertyChanged(");
- }
-
- Resize();
}
}
+ catch(uno::Exception)
+ {
+ OSL_FAIL("Exception caught: OReportSection::_propertyChanged(");
+ }
}
//------------------------------------------------------------------------------
sal_Bool OReportSection::handleKeyEvent(const KeyEvent& _rEvent)
diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx
index 2a7a32408db9..318451db19c1 100644
--- a/reportdesign/source/ui/report/ReportWindow.cxx
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -32,6 +32,7 @@
#include "ViewsWindow.hxx"
#include "ReportRuler.hxx"
#include "DesignView.hxx"
+#include "UITools.hxx"
#include <tools/debug.hxx>
#include <svtools/colorcfg.hxx>
@@ -66,6 +67,7 @@ DBG_NAME( rpt_OReportWindow )
//------------------------------------------------------------------------------
OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView)
: Window(_pParent,WB_DIALOGCONTROL)
+, ::comphelper::OPropertyChangeListener(m_aMutex)
,m_aHRuler(this)
,m_pView(_pView)
,m_pParent(_pParent)
@@ -89,11 +91,14 @@ OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView)
m_aHRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
ImplInitSettings();
+ m_pReportListener = addStyleListener(_pView->getController().getReportDefinition(),this);
}
//------------------------------------------------------------------------------
OReportWindow::~OReportWindow()
{
DBG_DTOR( rpt_OReportWindow,NULL);
+ if ( m_pReportListener.is() )
+ m_pReportListener->dispose();
}
// -----------------------------------------------------------------------------
void OReportWindow::initialize()
@@ -436,6 +441,15 @@ sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const
return nZoom;
}
+// -----------------------------------------------------------------------------
+void OReportWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
+{
+ (void)_rEvent;
+ Resize();
+ m_aViewsWindow.Resize();
+ static sal_Int32 nIn = INVALIDATE_TRANSPARENT;
+ Invalidate(nIn);
+}
//==================================================================
} //rptui
//==================================================================
diff --git a/reportdesign/source/ui/report/SectionView.cxx b/reportdesign/source/ui/report/SectionView.cxx
index a0355349e361..c60c8e011403 100644
--- a/reportdesign/source/ui/report/SectionView.cxx
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -53,6 +53,7 @@ OSectionView::OSectionView( SdrModel* pModel, OReportSection* _pSectionWindow, O
,m_pSectionWindow(_pSectionWindow)
{
DBG_CTOR( rpt_OSectionView,NULL);
+ // SetPagePaintingAllowed(false);
SetBufferedOutputAllowed(true);
SetBufferedOverlayAllowed(true);
SetPageBorderVisible(false);
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
index c80f3af70db5..a682a6b01f08 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -110,7 +110,6 @@ OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< rep
}
_propertyChanged(aEvent);
- SetPaintTransparent(sal_True);
}
// -----------------------------------------------------------------------------
OSectionWindow::~OSectionWindow()
@@ -136,15 +135,15 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
const uno::Reference< report::XSection> xCurrentSection = m_aReportSection.getSection();
if ( _rEvent.PropertyName.equals(PROPERTY_HEIGHT) )
{
+ static bool t4 = true;
+ if ( t4 )
m_pParent->getView()->SetUpdateMode(sal_False);
- Resize();
+ //Resize();
m_pParent->getView()->notifySizeChanged();
m_pParent->resize(*this);
+ if ( t4 )
m_pParent->getView()->SetUpdateMode(sal_True);
- m_aStartMarker.Invalidate(INVALIDATE_NOERASE);
- m_aEndMarker.Invalidate(INVALIDATE_NOERASE);
- m_aReportSection.Invalidate(/*INVALIDATE_NOERASE*/);
- getViewsWindow()->getView()->getReportView()->getController().resetZoomType();
+ // getViewsWindow()->getView()->getReportView()->getController().resetZoomType();
}
else if ( _rEvent.PropertyName.equals(PROPERTY_NAME) && !xSection->getGroup().is() )
{
@@ -153,7 +152,9 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
|| setReportSectionTitle(xReport,RID_STR_REPORT_FOOTER,::std::mem_fun(&OReportHelper::getReportFooter),::std::mem_fun(&OReportHelper::getReportFooterOn))
|| setReportSectionTitle(xReport,RID_STR_PAGE_HEADER,::std::mem_fun(&OReportHelper::getPageHeader),::std::mem_fun(&OReportHelper::getPageHeaderOn))
|| setReportSectionTitle(xReport,RID_STR_PAGE_FOOTER,::std::mem_fun(&OReportHelper::getPageFooter),::std::mem_fun(&OReportHelper::getPageFooterOn)) )
+ {
m_aStartMarker.Invalidate(INVALIDATE_NOERASE);
+ }
else
{
String sTitle = String(ModuleRes(RID_STR_DETAIL));
@@ -165,10 +166,9 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent)
else if ( _rEvent.PropertyName.equals(PROPERTY_EXPRESSION) )
{
uno::Reference< report::XGroup > xGroup(_rEvent.Source,uno::UNO_QUERY);
- if ( xGroup.is() )
+ if ( xGroup.is() && !setGroupSectionTitle(xGroup,RID_STR_HEADER,::std::mem_fun(&OGroupHelper::getHeader),::std::mem_fun(&OGroupHelper::getHeaderOn)))
{
- if ( !setGroupSectionTitle(xGroup,RID_STR_HEADER,::std::mem_fun(&OGroupHelper::getHeader),::std::mem_fun(&OGroupHelper::getHeaderOn)) )
- setGroupSectionTitle(xGroup,RID_STR_FOOTER,::std::mem_fun(&OGroupHelper::getFooter),::std::mem_fun(&OGroupHelper::getFooterOn));
+ setGroupSectionTitle(xGroup,RID_STR_FOOTER,::std::mem_fun(&OGroupHelper::getFooter),::std::mem_fun(&OGroupHelper::getFooterOn));
}
}
}
@@ -209,6 +209,13 @@ bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>&
//------------------------------------------------------------------------------
void OSectionWindow::ImplInitSettings()
{
+ static bool t = false;
+ if ( t )
+ {
+ EnableChildTransparentMode( sal_True );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( sal_True );
+ }
SetBackground( );
}
//-----------------------------------------------------------------------------
@@ -304,8 +311,6 @@ IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker )
m_aSplitter.Show(bShow);
m_pParent->resize(*this);
- Resize();
- Invalidate();
}
return 0L;
}
@@ -397,8 +402,6 @@ void OSectionWindow::scrollChildren(long _nX)
lcl_setOrigin(m_aSplitter,_nX, 0);
lcl_scroll(m_aSplitter,aDiff);
-
- Resize();
}
//==============================================================================
} // rptui
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
index b27fcdec1f13..9d69bb79f5e8 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -70,6 +70,7 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const ::rtl::OUString& _sCol
initDefaultNodeImages();
ImplInitSettings();
m_aText.SetHelpId(HID_RPT_START_TITLE);
+ m_aText.SetPaintTransparent(sal_True);
m_aImage.SetHelpId(HID_RPT_START_IMAGE);
m_aText.Show();
m_aImage.Show();
@@ -82,7 +83,9 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const ::rtl::OUString& _sCol
m_aVRuler.SetMargin2();
const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
m_aVRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH);
- SetPaintTransparent(sal_True);
+ EnableChildTransparentMode( sal_True );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( sal_True );
}
// -----------------------------------------------------------------------------
OStartMarker::~OStartMarker()
@@ -104,20 +107,22 @@ sal_Int32 OStartMarker::getMinHeight() const
// -----------------------------------------------------------------------------
void OStartMarker::Paint( const Rectangle& rRect )
{
- Window::Paint( rRect );
+ (void)rRect;
Size aSize = GetOutputSizePixel();
long nSize = aSize.Width();
const long nCornerWidth = long(CORNER_SPACE * (double)GetMapMode().GetScaleX());
- if ( !isCollapsed() )
+ if ( isCollapsed() )
+ {
+ SetClipRegion();
+ }
+ else
{
const long nVRulerWidth = m_aVRuler.GetSizePixel().Width();
nSize = aSize.Width() - nVRulerWidth;
- SetClipRegion(Region(PixelToLogic(Rectangle(Point(),Size( nSize,aSize.Height())))));
aSize.Width() += nCornerWidth;
+ SetClipRegion(Region(PixelToLogic(Rectangle(Point(),Size(nSize,aSize.Height())))));
}
- else
- SetClipRegion();
const Point aGcc3WorkaroundTemporary;
Rectangle aWholeRect(aGcc3WorkaroundTemporary,aSize);
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 7e66ceab829a..576131433a03 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -87,7 +87,7 @@ bool lcl_getNewRectSize(const Rectangle& _aObjRect,long& _nXMov, long& _nYMov,Sd
aNewRect.Move(_nXMov,_nYMov);
break;
}
- if ( dynamic_cast<OUnoObject*>(_pObj) )
+ if (dynamic_cast<OUnoObject*>(_pObj) != NULL || dynamic_cast<OOle2Obj*>(_pObj) != NULL)
{
pOverlappedObj = isOver(aNewRect,*_pObj->GetPage(),*_pView,true,_pObj);
if ( pOverlappedObj && _pObj != pOverlappedObj )
@@ -246,8 +246,9 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)
if ( bSet )
{
impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,bSet);
- pSectionWindow->Invalidate(INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
- pSectionWindow->getStartMarker().Invalidate(INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT );
+ static sal_Int32 nIn = INVALIDATE_UPDATE | INVALIDATE_TRANSPARENT;
+ pSectionWindow->getStartMarker().Invalidate( nIn ); // INVALIDATE_NOERASE |INVALIDATE_NOCHILDREN| INVALIDATE_TRANSPARENT
+ pSectionWindow->getEndMarker().Invalidate( nIn );
}
}
Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
@@ -258,7 +259,6 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow)
m_pParent->notifySizeChanged();
Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
- Invalidate(aRect,INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN | INVALIDATE_TRANSPARENT);
}
//------------------------------------------------------------------------------
void OViewsWindow::Resize()
@@ -296,6 +296,7 @@ void OViewsWindow::Paint( const Rectangle& rRect )
//------------------------------------------------------------------------------
void OViewsWindow::ImplInitSettings()
{
+ EnableChildTransparentMode( sal_True );
SetBackground( );
SetFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
SetTextFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
@@ -318,7 +319,6 @@ void OViewsWindow::addSection(const uno::Reference< report::XSection >& _xSectio
::boost::shared_ptr<OSectionWindow> pSectionWindow( new OSectionWindow(this,_xSection,_sColorEntry) );
m_aSections.insert(getIteratorAtPos(_nPosition) , TSectionsMap::value_type(pSectionWindow));
m_pParent->setMarked(&pSectionWindow->getReportSection().getSectionView(),m_aSections.size() == 1);
-
Resize();
}
//----------------------------------------------------------------------------
@@ -544,8 +544,8 @@ void OViewsWindow::unmarkAllObjects(OSectionView* _pSectionView)
// -----------------------------------------------------------------------
void OViewsWindow::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32)
{
- ImplInitSettings();
- Invalidate();
+ ImplInitSettings();
+ Invalidate();
}
// -----------------------------------------------------------------------------
void OViewsWindow::MouseButtonDown( const MouseEvent& rMEvt )
@@ -845,7 +845,7 @@ void OViewsWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAli
TRectangleMap::iterator aInterSectRectIter = aSortRectangles.begin();
for (; aInterSectRectIter != aRectIter; ++aInterSectRectIter)
{
- if ( pView == aInterSectRectIter->second.second && dynamic_cast<OUnoObject*>(aInterSectRectIter->second.first) )
+ if ( pView == aInterSectRectIter->second.second && (dynamic_cast<OUnoObject*>(aInterSectRectIter->second.first) || dynamic_cast<OOle2Obj*>(aInterSectRectIter->second.first)))
{
SdrObject* pPreviousObj = aInterSectRectIter->second.first;
Rectangle aIntersectRect = aTest.GetIntersection(_bBoundRects ? pPreviousObj->GetCurrentBoundRect() : pPreviousObj->GetSnapRect());
@@ -921,7 +921,8 @@ void OViewsWindow::setGridSnap(sal_Bool bOn)
for (; aIter != aEnd ; ++aIter)
{
(*aIter)->getReportSection().getSectionView().SetGridSnap(bOn);
- (*aIter)->getReportSection().Invalidate();
+ static sal_Int32 nIn = 0;
+ (*aIter)->getReportSection().Invalidate(nIn);
}
}
// -----------------------------------------------------------------------------
@@ -1517,6 +1518,7 @@ void OViewsWindow::handleKey(const KeyCode& _rCode)
{
// restrict movement to work area
Rectangle rWorkArea = rView.GetWorkArea();
+ rWorkArea.Right()++;
if ( !rWorkArea.IsEmpty() )
{
@@ -1544,11 +1546,56 @@ void OViewsWindow::handleKey(const KeyCode& _rCode)
for (sal_uInt32 i = 0; !bCheck && i < rMarkList.GetMarkCount();++i )
{
SdrMark* pMark = rMarkList.GetMark(i);
- bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
+ bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL|| dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj());
}
- if ( bCheck && isOver(aMarkRect,*rReportSection.getPage(),rView) )
- break;
+
+ if ( bCheck )
+ {
+ SdrObject* pOverlapped = isOver(aMarkRect,*rReportSection.getPage(),rView);
+ if ( pOverlapped )
+ {
+ do
+ {
+ Rectangle aOver = pOverlapped->GetLastBoundRect();
+ Point aPos;
+ if ( nCode == KEY_UP )
+ {
+ aPos.X() = aMarkRect.Left();
+ aPos.Y() = aOver.Top() - aMarkRect.getHeight();
+ nY += (aPos.Y() - aMarkRect.Top());
+ }
+ else if ( nCode == KEY_DOWN )
+ {
+ aPos.X() = aMarkRect.Left();
+ aPos.Y() = aOver.Bottom();
+ nY += (aPos.Y() - aMarkRect.Top());
+ }
+ else if ( nCode == KEY_LEFT )
+ {
+ aPos.X() = aOver.Left() - aMarkRect.getWidth();
+ aPos.Y() = aMarkRect.Top();
+ nX += (aPos.X() - aMarkRect.Left());
+ }
+ else if ( nCode == KEY_RIGHT )
+ {
+ aPos.X() = aOver.Right();
+ aPos.Y() = aMarkRect.Top();
+ nX += (aPos.X() - aMarkRect.Left());
+ }
+
+ aMarkRect.SetPos(aPos);
+ if ( !rWorkArea.IsInside( aMarkRect ) )
+ {
+ break;
+ }
+ pOverlapped = isOver(aMarkRect,*rReportSection.getPage(),rView);
+ }
+ while(pOverlapped != NULL);
+ if (pOverlapped != NULL)
+ break;
+ }
+ }
}
if ( nX != 0 || nY != 0 )
@@ -1587,7 +1634,7 @@ void OViewsWindow::handleKey(const KeyCode& _rCode)
for (sal_uInt32 i = 0; !bCheck && i < rMarkList.GetMarkCount();++i )
{
SdrMark* pMark = rMarkList.GetMark(i);
- bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL;
+ bCheck = dynamic_cast<OUnoObject*>(pMark->GetMarkedSdrObj()) != NULL || dynamic_cast<OOle2Obj*>(pMark->GetMarkedSdrObj()) != NULL;
if ( bCheck )
aNewRect.Union(pMark->GetMarkedSdrObj()->GetLastBoundRect());
}
@@ -1689,7 +1736,8 @@ void OViewsWindow::zoom(const Fraction& _aZoom)
aOut = PixelToLogic(aOut);
Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
- Invalidate(aRect,INVALIDATE_NOCHILDREN);
+ static sal_Int32 nIn = INVALIDATE_NOCHILDREN;
+ Invalidate(aRect,nIn);
}
//----------------------------------------------------------------------------
void OViewsWindow::scrollChildren(const Point& _aThumbPos)
@@ -1705,8 +1753,6 @@ void OViewsWindow::scrollChildren(const Point& _aThumbPos)
aMapMode.SetOrigin( Point(aOld.X() , - aPosY.Y()));
SetMapMode( aMapMode );
Scroll(0, -( aOld.Y() + aPosY.Y()),SCROLL_CHILDREN);
- Resize();
- Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_TRANSPARENT);
}
TSectionsMap::iterator aIter = m_aSections.begin();
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index 70f130c2afe4..65308fe6fbe2 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -93,8 +93,12 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
aStartWidth *= m_pParent->GetMapMode().GetScaleX();
aOut.Width() -= (long)aStartWidth;
+ aOut.Height() = m_pParent->GetOutputSizePixel().Height();
- Rectangle aOutRect( pScrollWindow->getThumbPos(), aOut );
+ Point aPos = pScrollWindow->getThumbPos();
+ aPos.X() *= 0.5;
+ aPos.Y() *= 0.5;
+ Rectangle aOutRect( aPos, aOut );
aOutRect = m_pParent->PixelToLogic( aOutRect );
Point aGcc3WorkaroundTemporary;
Rectangle aWorkArea(aGcc3WorkaroundTemporary,pScrollWindow->getTotalSize());
@@ -438,6 +442,7 @@ void DlgEdFunc::activateOle(SdrObject* _pObj)
void DlgEdFunc::deactivateOle(bool _bSelect)
{
OLEObjCache& rObjCache = GetSdrGlobalData().GetOLEObjCache();
+ OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
const sal_uLong nCount = rObjCache.Count();
for(sal_uLong i = 0 ; i< nCount;++i)
{
@@ -451,7 +456,6 @@ void DlgEdFunc::deactivateOle(bool _bSelect)
m_bUiActive = false;
if ( m_bShowPropertyBrowser )
{
- OReportController& rController = m_pParent->getSectionWindow()->getViewsWindow()->getView()->getReportView()->getController();
rController.executeChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< beans::PropertyValue >());
}
@@ -603,7 +607,7 @@ bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt)
while( (pObjIter = aIter.Next()) != NULL && !bIsSetPoint)
{
if ( m_rView.IsObjMarked(pObjIter)
- && dynamic_cast<OUnoObject*>(pObjIter) != NULL )
+ && (dynamic_cast<OUnoObject*>(pObjIter) != NULL || dynamic_cast<OOle2Obj*>(pObjIter) != NULL) )
{
Rectangle aNewRect = pObjIter->GetLastBoundRect();
long nDx = rDragStat.IsHorFixed() ? 0 : rDragStat.GetDX();
@@ -624,15 +628,17 @@ bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt)
if (pObjOverlapped && !m_bSelectionMode)
{
colorizeOverlappedObject(pObjOverlapped);
+ }
}
}
}
}
- }
- else if ( aVEvt.pObj && !m_bSelectionMode)
+ else if ( aVEvt.pObj && (aVEvt.pObj->GetObjIdentifier() != OBJ_CUSTOMSHAPE) && !m_bSelectionMode)
{
colorizeOverlappedObject(aVEvt.pObj);
}
+ else
+ bIsSetPoint = false;
return bIsSetPoint;
}
// -----------------------------------------------------------------------------