[Libreoffice-commits] core.git: 6 commits - dbaccess/source reportbuilder/java svx/source
Lionel Elie Mamane
lionel at mamane.lu
Thu Jan 22 04:20:00 PST 2015
dbaccess/source/core/api/RowSet.cxx | 8 -
dbaccess/source/core/api/RowSetBase.cxx | 49 +++++-----
dbaccess/source/core/api/RowSetBase.hxx | 8 +
reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java | 4
svx/source/fmcomp/gridcell.cxx | 2
5 files changed, 38 insertions(+), 33 deletions(-)
New commits:
commit cc376d87859a478b6cab348f0c96ea9fa7fe7a9a
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Jan 22 13:18:02 2015 +0100
set java throwable cause argument (erroneously removed by previous commit)
Change-Id: Ib4516eec5e47d95d53dbb5002f7258514c93f2c9
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java
index 1b53cc0..8d781ae 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java
@@ -223,7 +223,7 @@ public class SOReportJobFactory
Writer result = new StringWriter();
PrintWriter printWriter = new PrintWriter(result);
e.printStackTrace(printWriter);
- throw new com.sun.star.lang.WrappedTargetException(e.toString() + '\n' + result.toString(), this, null);
+ throw new com.sun.star.lang.WrappedTargetException(e, e.toString() + '\n' + result.toString(), this, null);
}
catch (java.lang.IncompatibleClassChangeError e)
{
@@ -231,7 +231,7 @@ public class SOReportJobFactory
Writer result = new StringWriter();
PrintWriter printWriter = new PrintWriter(result);
e.printStackTrace(printWriter);
- throw new com.sun.star.lang.WrappedTargetException(e.toString() + '\n' + result.toString(), this, null);
+ throw new com.sun.star.lang.WrappedTargetException(e, e.toString() + '\n' + result.toString(), this, null);
}
Thread.currentThread().setContextClassLoader(cl);
commit 42b809228dc0971c4280871728e37261abab62da
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Jan 22 13:05:41 2015 +0100
On init of DbCellControl, load value from Model
This fixes a regression introduced by "fdo#88551 no need to update content from field when activating grid cell"
that when switching from design mode to normal mode
before one moved row at least once, the current cell (inevitably of the first row)
was always displayed empty.
Before, the update was done by the activation event (which was too often), so now we need to do it once at initialisation.
Not sure if using updateFromModel instead of UpdateFromField makes a difference. Hope not. Else need to change that.
Change-Id: I878dea0f91b370a4f83c3c1a3ed185a51ac9f0b7
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 739e649..6ddf3d7 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -919,6 +919,8 @@ void DbCellControl::Init( vcl::Window& rParent, const Reference< XRowSet >& _rxC
}
}
m_xCursor = _rxCursor;
+ if ( m_rColumn.getModel().is() )
+ updateFromModel( m_rColumn.getModel() );
}
commit 47bd9bd00edc9c0f2f4834a1b4869b45b65ab66a
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Jan 22 11:13:14 2015 +0100
RowSet: notify listeners when next() brings us afterLast
Change-Id: I6024352f9d7c68d8075d90b5954ec3ba662a06f0
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index edabd9a6..3dbd6a0 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -591,12 +591,24 @@ sal_Bool SAL_CALL ORowSetBase::next( ) throw(SQLException, RuntimeException, st
bRet = m_pCache->next();
doCancelModification( );
+ // if we were afterLast before next() then we still are,
+ // i.e. bAfterLast implies m_pCache->isAfterLast()
+ if (bAfterLast)
+ assert(m_pCache->isAfterLast());
+ // so the only way bAfterLast != m_pCache->isAfterLast()
+ // would be that we just arrived there,
+ if (bAfterLast != m_pCache->isAfterLast())
+ {
+ assert(!bAfterLast);
+ assert(m_pCache->isAfterLast());
+ }
+ // in which case we *did* move the cursor
if ( bRet || bAfterLast != m_pCache->isAfterLast() )
{
// notification order
// - column values
// - cursorMoved
- setCurrentRow( bRet, true, aOldValues, aGuard );
+ setCurrentRow( true, true, aOldValues, aGuard );
OSL_ENSURE(!m_bBeforeFirst,"BeforeFirst is true. I don't know why?");
}
else
commit 4a7089ffdf450ac285060ed4d8354e8c37f3685b
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Jan 22 11:12:32 2015 +0100
Malarkey, the cache has been positioned by our caller and we do not move it.
Even when called with _bMoved==false, that is when inserting row or when asked to move to the position we are already in.
Change-Id: Icff5a18638f7e850db4678cdf82021f56f135d1f
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 3764f3e..edabd9a6 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -1043,14 +1043,6 @@ void ORowSetBase::setCurrentRow( bool _bMoved, bool _bDoNotify, const ORowSetRow
ORowSetRow rRow = (*m_aCurrentRow);
OSL_ENSURE(rRow.is() ,"Invalid size of vector!");
#endif
- // the cache could repositioned so we need to adjust the cache
- if ( _bMoved && m_aCurrentRow.isNull() )
- {
- positionCache( MOVE_NONE_REFRESH_ONLY );
- m_aCurrentRow = m_pCache->m_aMatrixIter;
- m_bIsInsertRow = false;
- OSL_ENSURE(!m_aCurrentRow.isNull(),"CurrentRow is nul after positionCache!");
- }
}
else
{
commit 900d648f8b91fd742188e4d150cb695c1983bae2
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Jan 22 10:54:18 2015 +0100
use enum constant instead of hard-coded integer literal
Change-Id: Ide3f05cc66353787acb33b33340577624f25a8bc
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index bfaf44d..3764f3e 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -1329,7 +1329,7 @@ void ORowSetBase::onDeleteRow( const Any& _rBookmark )
::osl::MutexGuard aGuard( *m_pMutex );
//OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::onDeleteRow: Bookmark isn't valid!" );
- if ( compareBookmarks( _rBookmark, m_aBookmark ) == 0 )
+ if ( compareBookmarks( _rBookmark, m_aBookmark ) == CompareBookmark::EQUAL )
{
positionCache( MOVE_NONE );
m_nDeletedPosition = m_pCache->getRow();
@@ -1349,7 +1349,7 @@ void ORowSetBase::onDeletedRow( const Any& _rBookmark, sal_Int32 _nPos )
}
::osl::MutexGuard aGuard( *m_pMutex );
- if ( compareBookmarks( _rBookmark, m_aBookmark ) == 0 )
+ if ( compareBookmarks( _rBookmark, m_aBookmark ) == CompareBookmark::EQUAL )
{
m_aOldRow->clearRow();
m_aCurrentRow = m_pCache->getEnd();
commit d7c9a1d9d65fe8b1a56c5c280d2ca6640a549d2f
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Jan 22 10:49:42 2015 +0100
fdo#88475 RowSetBase: reposition cache before interrogating it
This partially reverts:
commit d20232a77565f46fedc0b556f4d50addff4d3559
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Dec 6 13:22:06 2012 +0100
Don't force refresh when higher up code did not request it
Change-Id: I0f415c96fc05c1d776d14885751aef020c42f4ae
which did not take into account that the cache is shared with the
clones.
Finish the above commit more deeply, that is
more aggressively avoid moving the cache if we don't need to:
when we merely reposition the cache in case another RowSet(Clone)
has moved it, no need to force a move and by that to force a refresh.
Change-Id: I28d62673fdf10ee6507d38bb7c79c08e4b40902f
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 0756e8b..079673d 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1019,7 +1019,7 @@ void SAL_CALL ORowSet::deleteRow( ) throw(SQLException, RuntimeException, std::
// this call position the cache indirect
Any aBookmarkToDelete( m_aBookmark );
- positionCache( MOVE_NONE_REFRESH_ONLY );
+ positionCache( MOVE_NONE );
sal_Int32 nDeletePosition = m_pCache->getRow();
notifyRowSetAndClonesRowDelete( aBookmarkToDelete );
@@ -1066,7 +1066,7 @@ void ORowSet::implCancelRowUpdates( bool _bNotifyModified )
if ( m_bNew || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
throwFunctionSequenceException(*this);
- positionCache( MOVE_NONE_REFRESH_ONLY );
+ positionCache( MOVE_NONE );
ORowSetRow aOldValues;
if ( !m_bModified && _bNotifyModified && !m_aCurrentRow.isNull() )
@@ -1194,7 +1194,7 @@ void SAL_CALL ORowSet::moveToInsertRow( ) throw(SQLException, RuntimeException,
setCurrentRow( true, false, aOldValues, aGuard);
}
else
- positionCache( MOVE_NONE_REFRESH_ONLY );
+ positionCache( MOVE_NONE );
// check before because the resultset could be empty
if ( !m_bBeforeFirst
@@ -1283,7 +1283,7 @@ void SAL_CALL ORowSet::moveToCurrentRow( ) throw(SQLException, RuntimeException
if ( notifyAllListenersCursorBeforeMove( aGuard ) )
{
- positionCache( MOVE_NONE_REFRESH_ONLY );
+ positionCache( MOVE_NONE_REFRESH );
ORowSetNotifier aNotifier( this );
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 57a3dc1..bfaf44d 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -221,7 +221,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
if ( !bValidCurrentRow )
{
// currentrow is null when the clone moves the window
- positionCache( MOVE_NONE_REFRESH_ONLY );
+ positionCache( MOVE_NONE );
m_aCurrentRow = m_pCache->m_aMatrixIter;
m_bIsInsertRow = false;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't stand on a valid row! Row is null.");
@@ -348,7 +348,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSetBase::getBinaryS
bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() );
if ( !bValidCurrentRow )
{
- positionCache( MOVE_NONE_REFRESH_ONLY );
+ positionCache( MOVE_NONE );
m_aCurrentRow = m_pCache->m_aMatrixIter;
m_bIsInsertRow = false;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null.");
@@ -657,6 +657,7 @@ sal_Bool SAL_CALL ORowSetBase::isFirst( ) throw(SQLException, RuntimeException,
if ( impl_rowDeleted() )
return ( m_nDeletedPosition == 1 );
+ positionCache( MOVE_NONE );
bool bIsFirst = m_pCache->isFirst();
SAL_INFO("dbaccess", "ORowSetBase::isFirst() = " << bIsFirst << " Clone = " << m_bClone);
@@ -686,6 +687,7 @@ sal_Bool SAL_CALL ORowSetBase::isLast( ) throw(SQLException, RuntimeException,
return ( m_nDeletedPosition == impl_getRowCount() );
}
+ positionCache( MOVE_NONE );
bool bIsLast = m_pCache->isLast();
SAL_INFO("dbaccess", "ORowSetBase::isLast() = " << bIsLast << " Clone = " << m_bClone);
@@ -857,13 +859,7 @@ sal_Int32 ORowSetBase::impl_getRow()
nPos = 0;
else
{
- if ( m_pCache->isAfterLast()
- || m_pCache->isBeforeFirst()
- || ( m_pCache->compareBookmarks( m_aBookmark, m_pCache->getBookmark() ) != CompareBookmark::EQUAL )
- )
- {
- positionCache( MOVE_NONE_REFRESH_ONLY );
- }
+ positionCache( MOVE_NONE );
nPos = m_pCache->getRow();
}
SAL_INFO("dbaccess", "ORowSetBase::impl_getRow() = " << nPos << " Clone = " << m_bClone);
@@ -1103,7 +1099,7 @@ void SAL_CALL ORowSetBase::refreshRow( ) throw(SQLException, RuntimeException,
{
bool bWasNew = m_pCache->m_bNew || impl_rowDeleted();
ORowSetRow aOldValues = getOldRow(bWasNew);
- positionCache( MOVE_NONE_REFRESH_ONLY );
+ positionCache( MOVE_NONE );
m_pCache->refreshRow();
firePropertyChange(aOldValues);
}
@@ -1237,7 +1233,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
bool bSuccess = false;
if ( m_aBookmark.hasValue() )
{
- if ( _ePrepareForDirection == MOVE_NONE_REFRESH_ONLY ||
+ if (_ePrepareForDirection == MOVE_NONE_REFRESH ||
m_pCache->compareBookmarks( m_aBookmark, m_pCache->getBookmark() ) != CompareBookmark::EQUAL )
bSuccess = m_pCache->moveToBookmark( m_aBookmark );
else
@@ -1278,7 +1274,8 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
bSuccess = m_pCache->absolute( m_nDeletedPosition );
break;
- case MOVE_NONE_REFRESH_ONLY:
+ case MOVE_NONE:
+ case MOVE_NONE_REFRESH:
bSuccess = false; // will be asserted below
break;
}
@@ -1334,7 +1331,7 @@ void ORowSetBase::onDeleteRow( const Any& _rBookmark )
//OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::onDeleteRow: Bookmark isn't valid!" );
if ( compareBookmarks( _rBookmark, m_aBookmark ) == 0 )
{
- positionCache( MOVE_NONE_REFRESH_ONLY );
+ positionCache( MOVE_NONE );
m_nDeletedPosition = m_pCache->getRow();
}
}
diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx
index 00bb7cd..9f23bd0 100644
--- a/dbaccess/source/core/api/RowSetBase.hxx
+++ b/dbaccess/source/core/api/RowSetBase.hxx
@@ -155,8 +155,10 @@ namespace dbaccess
MOVE_FORWARD,
/// denotes a cursor move backwards
MOVE_BACKWARD,
- /// denotes no cursor move at all, used when the current row is to be refreshed only
- MOVE_NONE_REFRESH_ONLY
+ /// denotes no cursor move at all, but move cache to current row (if it is not there already)
+ MOVE_NONE,
+ /// denotes no cursor move at all, but force the cache to move to current row (and refresh the row)
+ MOVE_NONE_REFRESH
};
/** positions the cache in preparation of a cursor move
@@ -170,7 +172,7 @@ namespace dbaccess
m_aBookmark.</br>
If, however, we're currently on a deleted row, this is used to properly position the cache
using <member>m_nDeletedPosition</member>.<br/>
- In this case, MOVE_NONE_REFRESH_ONLY is not supported. This is because the deleted row
+ In this case, MOVE_NONE(_REFRESH) is not supported. This is because the deleted row
(to which the RowSet currently points to) is not present in the cache. So, you cannot move the
cache to this row.
*/
More information about the Libreoffice-commits
mailing list