summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-17 09:19:30 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-17 09:19:30 +0000
commita0fd222ae1c9ba13d35018c763c9223bb9b88c01 (patch)
tree5e5ac4dd60b03d9053113e7db0d5242b90a553f7
parent40dce71ae36392fdf51849bb3ab11af35fec062f (diff)
CWS-TOOLING: integrate CWS tbe36
2009-01-28 10:38:01 +0100 oc r267034 : #i98551 2009-01-22 19:39:48 +0100 tbe r266755 : #i97876# Spreadsheet data changes are not notified 2009-01-20 15:39:37 +0100 tbe r266590 : CWS-TOOLING: rebase CWS tbe36 to trunk@266428 (milestone: DEV300:m39) 2009-01-15 17:52:50 +0100 tbe r266388 : #i97876# Spreadsheet data changes are not notified 2009-01-09 17:08:22 +0100 tbe r266101 : #i97876# Spreadsheet data changes are not notified
-rw-r--r--sc/inc/cellsuno.hxx1
-rw-r--r--sc/inc/docuno.hxx22
-rw-r--r--sc/source/core/data/global.cxx2
-rw-r--r--sc/source/core/tool/token.cxx2
-rw-r--r--sc/source/ui/app/inputhdl.cxx8
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx2
-rw-r--r--sc/source/ui/undo/undoblk3.cxx19
-rw-r--r--sc/source/ui/undo/undocell.cxx25
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx5
-rw-r--r--sc/source/ui/unoobj/docuno.cxx73
-rw-r--r--sc/source/ui/view/viewfun2.cxx49
-rw-r--r--sc/source/ui/view/viewfun3.cxx20
-rw-r--r--sc/source/ui/view/viewfunc.cxx154
13 files changed, 371 insertions, 11 deletions
diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 3c524fb3786f..51822f6c75c9 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -849,6 +849,7 @@ protected:
public:
static const SfxItemPropertyMap* GetEditPropertyMap();
+ static const SfxItemPropertyMap* GetCellPropertyMap();
ScCellObj(ScDocShell* pDocSh, const ScAddress& rP);
virtual ~ScCellObj();
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 05a46d53c22f..e8048a5b9618 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -55,10 +55,12 @@
#include <com/sun/star/sheet/XSheetAnnotations.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sheet/XCellRangesAccess.hpp>
+#include <com/sun/star/util/XChangesNotifier.hpp>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/interfacecontainer.h>
#include <svtools/itemprop.hxx>
#include "drwlayer.hxx"
@@ -72,6 +74,7 @@ class ScTableRowObj;
class ScTableSheetObj;
class SvxFmDrawPage;
class SvxDrawPage;
+class ScRangeList;
class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
public com::sun::star::sheet::XSpreadsheetDocument,
@@ -87,7 +90,8 @@ class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
public com::sun::star::document::XLinkTargetSupplier,
public com::sun::star::beans::XPropertySet,
public SvxFmMSFactory, // derived from XMultiServiceFactory
- public com::sun::star::lang::XServiceInfo
+ public com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::util::XChangesNotifier
{
private:
SfxItemPropertySet aPropSet;
@@ -102,6 +106,8 @@ private:
com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xDrawDashTab;
com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xChartDataProv;
+ ::cppu::OInterfaceContainerHelper maChangesListeners;
+
BOOL FillRenderMarkData( const com::sun::star::uno::Any& aSelection,
ScMarkData& rMark, ScPrintSelectionStatus& rStatus ) const;
@@ -123,6 +129,12 @@ public:
void BeforeXMLLoading();
void AfterXMLLoading(sal_Bool bRet);
+ bool HasChangesListeners() const;
+
+ void NotifyChanges( const ::rtl::OUString& rOperation, const ScRangeList& rRanges,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProperties =
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >() );
+
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
const ::com::sun::star::uno::Type & rType )
throw(::com::sun::star::uno::RuntimeException);
@@ -295,6 +307,14 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
throw(::com::sun::star::uno::RuntimeException);
+
+ // XChangesNotifier
+ virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XChangesListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XChangesListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
};
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index bd6522d12ea9..965919f2823b 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -884,7 +884,7 @@ xub_StrLen ScGlobal::FindUnquoted( const String& rString, sal_Unicode cChar, xub
while (p < pStop)
{
if (*p == cChar && !bQuoted)
- return xub_StrLen(p - pStart);
+ return sal::static_int_cast< xub_StrLen >( p - pStart );
else if (*p == cQuote)
{
if (!bQuoted)
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 63164c536d48..c081c1cb743b 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1207,7 +1207,7 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a
lcl_ExternalRefToCalc( aComplRef.Ref1, aApiCRef.Reference1 );
lcl_ExternalRefToCalc( aComplRef.Ref2, aApiCRef.Reference2 );
// NOTE: This assumes that cached sheets are in consecutive order!
- aComplRef.Ref2.nTab = aComplRef.Ref1.nTab + SCsTAB(aApiCRef.Reference2.Sheet - aApiCRef.Reference1.Sheet);
+ aComplRef.Ref2.nTab = sal::static_int_cast< SCsTAB >( aComplRef.Ref1.nTab + (aApiCRef.Reference2.Sheet - aApiCRef.Reference1.Sheet) );
AddExternalDoubleReference( nFileId, aTabName, aComplRef );
}
else
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index c1f4a15a514b..f54ed4d8b3f4 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -739,7 +739,7 @@ void ScInputHandler::ShowTipCursor()
if( ppFDesc->getFunctionName().getLength() )
{
nArgPos = aHelper.GetArgStart( aSelText, nNextFStart, 0 );
- nArgs = (USHORT)ppFDesc->getParameterCount();
+ nArgs = sal::static_int_cast< USHORT >( ppFDesc->getParameterCount() );
USHORT nActive = 0;
USHORT nCount = 0;
@@ -754,7 +754,7 @@ void ScInputHandler::ShowTipCursor()
{
for( USHORT i=0; i < nArgs; i++ )
{
- xub_StrLen nLength= (USHORT)aArgs[i].getLength();
+ xub_StrLen nLength = sal::static_int_cast< xub_StrLen >( aArgs[i].getLength() );
if( nArgPos <= aSelText.Len()-1 )
{
nActive = i+1;
@@ -977,7 +977,7 @@ void ScInputHandler::UseFormulaData()
{
{
nArgPos = aHelper.GetArgStart( aFormula, nNextFStart, 0 );
- nArgs = (USHORT)ppFDesc->getParameterCount();
+ nArgs = sal::static_int_cast< USHORT >( ppFDesc->getParameterCount() );
USHORT nActive = 0;
USHORT nCount = 0;
@@ -992,7 +992,7 @@ void ScInputHandler::UseFormulaData()
{
for( USHORT i=0; i < nArgs; i++ )
{
- xub_StrLen nLength= (USHORT)aArgs[i].getLength();
+ xub_StrLen nLength = sal::static_int_cast< xub_StrLen >( aArgs[i].getLength() );
if( nArgPos <= aFormula.Len()-1 )
{
nActive = i+1;
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 63e7ef261297..390ab5582ceb 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -622,7 +622,7 @@ SCsTAB ScExternalRefCache::getTabSpan( sal_uInt16 nFileId, const String& rStartT
size_t nStartDist = ::std::distance( itrBeg, itrStartTab);
size_t nEndDist = ::std::distance( itrBeg, itrEndTab);
- return nStartDist <= nEndDist ? (SCsTAB)(nEndDist - nStartDist + 1) : -(SCsTAB)(nStartDist - nEndDist + 1);
+ return ( nStartDist <= nEndDist ? sal::static_int_cast< SCsTAB >( nEndDist - nStartDist + 1 ) : - sal::static_int_cast< SCsTAB >( nStartDist - nEndDist + 1 ) );
}
void ScExternalRefCache::getAllNumberFormats(vector<sal_uInt32>& rNumFmts) const
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 5b4b0fc1bfbf..581204e6b64a 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -61,6 +61,7 @@
#include "cell.hxx"
#include "paramisc.hxx"
#include "postit.hxx"
+#include "docuno.hxx"
// STATIC DATA ---------------------------------------------------------------
@@ -212,6 +213,15 @@ void __EXPORT ScUndoDeleteContents::Undo()
BeginUndo();
DoChange( TRUE );
EndUndo();
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ aChangeRanges.Append( aRange );
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
}
@@ -222,6 +232,15 @@ void __EXPORT ScUndoDeleteContents::Redo()
BeginRedo();
DoChange( FALSE );
EndRedo();
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ aChangeRanges.Append( aRange );
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
}
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 692d08c6f460..026123eab417 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -60,6 +60,7 @@
#include "rangenam.hxx"
#include "chgtrack.hxx"
#include "sc.hrc"
+#include "docuno.hxx"
// STATIC DATA -----------------------------------------------------------
@@ -303,6 +304,18 @@ void __EXPORT ScUndoEnterData::Undo()
DoChange();
EndUndo();
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ aChangeRanges.Append( ScRange( nCol, nRow, pTabs[i] ) );
+ }
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
}
void __EXPORT ScUndoEnterData::Redo()
@@ -324,6 +337,18 @@ void __EXPORT ScUndoEnterData::Redo()
DoChange();
EndRedo();
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocShell->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ aChangeRanges.Append( ScRange( nCol, nRow, pTabs[i] ) );
+ }
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
}
void __EXPORT ScUndoEnterData::Repeat(SfxRepeatTarget& rTarget)
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index a4eaacd46563..2fe7c6d72348 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6095,6 +6095,11 @@ const SfxItemPropertyMap* ScCellObj::GetEditPropertyMap() // static
return lcl_GetEditPropertyMap();
}
+const SfxItemPropertyMap* ScCellObj::GetCellPropertyMap()
+{
+ return lcl_GetCellPropertyMap();
+}
+
ScCellObj::ScCellObj(ScDocShell* pDocSh, const ScAddress& rP) :
ScCellRangeObj( pDocSh, ScRange(rP,rP) ),
pUnoText( NULL ),
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7686b2c94fd4..23cca80d5da1 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -217,7 +217,8 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) :
SfxBaseModel( pDocSh ),
aPropSet( lcl_GetDocOptPropertyMap() ),
pDocShell( pDocSh ),
- pPrintFuncCache( NULL )
+ pPrintFuncCache( NULL ),
+ maChangesListeners( m_aMutex )
{
// pDocShell may be NULL if this is the base of a ScDocOptionsObj
if ( pDocShell )
@@ -312,6 +313,7 @@ uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
SC_QUERYINTERFACE( beans::XPropertySet )
SC_QUERYINTERFACE( lang::XMultiServiceFactory )
SC_QUERYINTERFACE( lang::XServiceInfo )
+ SC_QUERYINTERFACE( util::XChangesNotifier )
uno::Any aRet(SfxBaseModel::queryInterface( rType ));
if ( !aRet.hasValue() && xNumberAgg.is() )
@@ -354,7 +356,7 @@ uno::Sequence<uno::Type> SAL_CALL ScModelObj::getTypes() throw(uno::RuntimeExcep
long nAggLen = aAggTypes.getLength();
const uno::Type* pAggPtr = aAggTypes.getConstArray();
- const long nThisLen = 14;
+ const long nThisLen = 15;
aTypes.realloc( nParentLen + nAggLen + nThisLen );
uno::Type* pPtr = aTypes.getArray();
pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XSpreadsheetDocument>*)0);
@@ -371,6 +373,7 @@ uno::Sequence<uno::Type> SAL_CALL ScModelObj::getTypes() throw(uno::RuntimeExcep
pPtr[nParentLen +11] = getCppuType((const uno::Reference<beans::XPropertySet>*)0);
pPtr[nParentLen +12] = getCppuType((const uno::Reference<lang::XMultiServiceFactory>*)0);
pPtr[nParentLen +13] = getCppuType((const uno::Reference<lang::XServiceInfo>*)0);
+ pPtr[nParentLen +14] = getCppuType((const uno::Reference<util::XChangesNotifier>*)0);
long i;
for (i=0; i<nParentLen; i++)
@@ -1800,6 +1803,72 @@ ScModelObj* ScModelObj::getImplementation( const uno::Reference<uno::XInterface>
return pRet;
}
+// XChangesNotifier
+
+void ScModelObj::addChangesListener( const uno::Reference< util::XChangesListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+ maChangesListeners.addInterface( aListener );
+}
+
+void ScModelObj::removeChangesListener( const uno::Reference< util::XChangesListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+ maChangesListeners.removeInterface( aListener );
+}
+
+bool ScModelObj::HasChangesListeners() const
+{
+ return ( maChangesListeners.getLength() > 0 );
+}
+
+void ScModelObj::NotifyChanges( const ::rtl::OUString& rOperation, const ScRangeList& rRanges,
+ const uno::Sequence< beans::PropertyValue >& rProperties )
+{
+ if ( pDocShell && HasChangesListeners() )
+ {
+ util::ChangesEvent aEvent;
+ aEvent.Source.set( static_cast< cppu::OWeakObject* >( this ) );
+ aEvent.Base <<= aEvent.Source;
+
+ ULONG nRangeCount = rRanges.Count();
+ aEvent.Changes.realloc( static_cast< sal_Int32 >( nRangeCount ) );
+ for ( ULONG nIndex = 0; nIndex < nRangeCount; ++nIndex )
+ {
+ uno::Reference< table::XCellRange > xRangeObj;
+
+ ScRange aRange( *rRanges.GetObject( nIndex ) );
+ if ( aRange.aStart == aRange.aEnd )
+ {
+ xRangeObj.set( new ScCellObj( pDocShell, aRange.aStart ) );
+ }
+ else
+ {
+ xRangeObj.set( new ScCellRangeObj( pDocShell, aRange ) );
+ }
+
+ util::ElementChange& rChange = aEvent.Changes[ static_cast< sal_Int32 >( nIndex ) ];
+ rChange.Accessor <<= rOperation;
+ rChange.Element <<= rProperties;
+ rChange.ReplacedElement <<= xRangeObj;
+ }
+
+ ::cppu::OInterfaceIteratorHelper aIter( maChangesListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ try
+ {
+ static_cast< util::XChangesListener* >( aIter.next() )->changesOccurred( aEvent );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+}
+
//------------------------------------------------------------------------
ScDrawPagesObj::ScDrawPagesObj(ScDocShell* pDocSh) :
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 1d724541b679..814cc95fa189 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -87,6 +87,7 @@
#include "inputhdl.hxx"
#include "inputwin.hxx"
#include "funcdesc.hxx"
+#include "docuno.hxx"
// STATIC DATA ---------------------------------------------------------------
@@ -1247,6 +1248,15 @@ void ScViewFunc::FillSeries( FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd,
{
pDocSh->UpdateOle(GetViewData());
UpdateScrollBars();
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ aChangeRanges.Append( aRange );
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
}
}
else
@@ -1260,6 +1270,7 @@ void ScViewFunc::FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow,
{
SCTAB nTab = GetViewData()->GetTabNo();
ScRange aRange( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab );
+ ScRange aSourceRange( aRange );
ScDocShell* pDocSh = GetViewData()->GetDocShell();
const ScMarkData& rMark = GetViewData()->GetMarkData();
BOOL bSuccess = pDocSh->GetDocFunc().
@@ -1269,6 +1280,44 @@ void ScViewFunc::FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow,
MarkRange( aRange, FALSE ); // aRange ist in FillAuto veraendert worden
pDocSh->UpdateOle(GetViewData());
UpdateScrollBars();
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ ScRange aChangeRange( aRange );
+ switch ( eDir )
+ {
+ case FILL_TO_BOTTOM:
+ {
+ aChangeRange.aStart.SetRow( aSourceRange.aEnd.Row() + 1 );
+ }
+ break;
+ case FILL_TO_TOP:
+ {
+ aChangeRange.aEnd.SetRow( aSourceRange.aStart.Row() - 1 );
+ }
+ break;
+ case FILL_TO_RIGHT:
+ {
+ aChangeRange.aStart.SetCol( aSourceRange.aEnd.Col() + 1 );
+ }
+ break;
+ case FILL_TO_LEFT:
+ {
+ aChangeRange.aEnd.SetCol( aSourceRange.aStart.Col() - 1 );
+ }
+ break;
+ default:
+ {
+
+ }
+ break;
+ }
+ aChangeRanges.Append( aChangeRange );
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
}
}
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index f49c83a1a21c..3a06b3187b2b 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -208,6 +208,7 @@
#include "editable.hxx"
#include "transobj.hxx"
#include "drwtrans.hxx"
+#include "docuno.hxx"
using namespace com::sun::star;
@@ -1270,6 +1271,25 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
SelectionChanged();
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for ( SCTAB i = 0; i < nTabCount; ++i )
+ {
+ if ( rMark.GetTableSelect( i ) )
+ {
+ ScRange aChangeRange( aUserRange );
+ aChangeRange.aStart.SetTab( i );
+ aChangeRange.aEnd.SetTab( i );
+ aChangeRanges.Append( aChangeRange );
+ }
+ }
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
+
return TRUE;
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 2faf542d7544..72af71cf1b09 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -91,6 +91,8 @@
#include "editable.hxx"
#include "scui_def.hxx" //CHINA001
#include "funcdesc.hxx"
+#include "docuno.hxx"
+#include "cellsuno.hxx"
//==================================================================
ScViewFunc::ScViewFunc( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
@@ -655,6 +657,22 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rS
ShowAllCursors();
pDocSh->UpdateOle(GetViewData());
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ for ( i = 0; i < nTabCount; ++i )
+ {
+ if ( rMark.GetTableSelect( i ) )
+ {
+ aChangeRanges.Append( ScRange( nCol, nRow, i ) );
+ }
+ }
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
+
aModificator.SetDocumentModified();
}
else
@@ -844,6 +862,22 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextOb
ShowAllCursors();
pDocSh->UpdateOle(GetViewData());
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ for ( i = 0; i < nTabCount; ++i )
+ {
+ if ( rMark.GetTableSelect( i ) )
+ {
+ aChangeRanges.Append( ScRange( nCol, nRow, i ) );
+ }
+ }
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
+
aModificator.SetDocumentModified();
}
@@ -1298,10 +1332,24 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
aFuncMark.MarkToMulti();
}
+ ScRangeList aChangeRanges;
+
if (aFuncMark.IsMultiMarked() && !bCursorOnly)
{
ScRange aMarkRange;
aFuncMark.GetMultiMarkArea( aMarkRange );
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for ( SCTAB i = 0; i < nTabCount; ++i )
+ {
+ if ( aFuncMark.GetTableSelect( i ) )
+ {
+ ScRange aChangeRange( aMarkRange );
+ aChangeRange.aStart.SetTab( i );
+ aChangeRange.aEnd.SetTab( i );
+ aChangeRanges.Append( aChangeRange );
+ }
+ }
+
SCCOL nStartCol = aMarkRange.aStart.Col();
SCROW nStartRow = aMarkRange.aStart.Row();
SCTAB nStartTab = aMarkRange.aStart.Tab();
@@ -1312,7 +1360,6 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
if (bRecord)
{
ScRange aCopyRange = aMarkRange;
- SCTAB nTabCount = pDoc->GetTableCount();
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
@@ -1347,6 +1394,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
SCCOL nCol = pViewData->GetCurX();
SCROW nRow = pViewData->GetCurY();
SCTAB nTab = pViewData->GetTabNo();
+ aChangeRanges.Append( ScRange( nCol, nRow, nTab ) );
ScPatternAttr* pOldPat = new ScPatternAttr(*pDoc->GetPattern( nCol, nRow, nTab ));
pDoc->ApplyPattern( nCol, nRow, nTab, rAttr );
@@ -1369,6 +1417,36 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr,
CellContentChanged();
}
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aProperties;
+ sal_Int32 nCount = 0;
+ for ( USHORT nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; ++nWhich )
+ {
+ const SfxPoolItem* pItem = 0;
+ if ( rNewSet.GetItemState( nWhich, TRUE, &pItem ) == SFX_ITEM_SET && pItem )
+ {
+ const SfxItemPropertyMap* pMap = ScCellObj::GetCellPropertyMap();
+ while ( pMap->pName )
+ {
+ if ( pMap->nWID == nWhich )
+ {
+ ::com::sun::star::uno::Any aVal;
+ pItem->QueryValue( aVal, pMap->nMemberId );
+ aProperties.realloc( nCount + 1 );
+ aProperties[ nCount ].Name = ::rtl::OUString::createFromAscii( pMap->pName );
+ aProperties[ nCount ].Value <<= aVal;
+ ++nCount;
+ }
+ ++pMap;
+ }
+ }
+ }
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "attribute" ) ), aChangeRanges, aProperties );
+ }
+
StartFormatArea();
}
@@ -1577,6 +1655,21 @@ BOOL ScViewFunc::InsertCells( InsCellCmd eCmd, BOOL bRecord, BOOL bPartOfPaste )
{
pDocSh->UpdateOle(GetViewData());
CellContentChanged();
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ if ( eCmd == INS_INSROWS || eCmd == INS_INSCOLS )
+ {
+ ScRangeList aChangeRanges;
+ aChangeRanges.Append( aRange );
+ ::rtl::OUString aOperation = ( eCmd == INS_INSROWS ?
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert-rows" ) ) :
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert-columns" ) ) );
+ pModelObj->NotifyChanges( aOperation, aChangeRanges );
+ }
+ }
}
return bSuccess;
}
@@ -1624,6 +1717,21 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd, BOOL bRecord )
pDocSh->UpdateOle(GetViewData());
CellContentChanged();
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ if ( eCmd == DEL_DELROWS || eCmd == DEL_DELCOLS )
+ {
+ ScRangeList aChangeRanges;
+ aChangeRanges.Append( aRange );
+ ::rtl::OUString aOperation = ( eCmd == DEL_DELROWS ?
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete-rows" ) ) :
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete-columns" ) ) );
+ pModelObj->NotifyChanges( aOperation, aChangeRanges );
+ }
+ }
+
// #58106# Cursor direkt hinter den geloeschten Bereich setzen
SCCOL nCurX = GetViewData()->GetCurX();
SCROW nCurY = GetViewData()->GetCurY();
@@ -1971,6 +2079,23 @@ void ScViewFunc::DeleteContents( USHORT nFlags, BOOL bRecord )
pDocSh->PostPaint( aExtendedRange, PAINT_GRID, nExtFlags );
pDocSh->UpdateOle(GetViewData());
+
+ // #i97876# Spreadsheet data changes are not notified
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ if ( bSimple )
+ {
+ aChangeRanges.Append( aMarkRange );
+ }
+ else
+ {
+ aFuncMark.FillRangeListWithMarks( &aChangeRanges, FALSE );
+ }
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
+ }
+
aModificator.SetDocumentModified();
CellContentChanged();
ShowAllCursors();
@@ -2256,6 +2381,33 @@ void ScViewFunc::SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pR
ShowCursor();
}
+
+ // #i97876# Spreadsheet data changes are not notified
+ if ( bWidth )
+ {
+ ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
+ if ( pModelObj && pModelObj->HasChangesListeners() )
+ {
+ ScRangeList aChangeRanges;
+ for ( nTab = 0; nTab < nTabCount; ++nTab )
+ {
+ if ( pMarkData->GetTableSelect( nTab ) )
+ {
+ const SCCOLROW* pTabRanges = pRanges;
+ for ( SCCOLROW nRange = 0; nRange < nRangeCnt; ++nRange )
+ {
+ SCCOL nStartCol = static_cast< SCCOL >( *(pTabRanges++) );
+ SCCOL nEndCol = static_cast< SCCOL >( *(pTabRanges++) );
+ for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
+ {
+ aChangeRanges.Append( ScRange( nCol, 0, nTab ) );
+ }
+ }
+ }
+ }
+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "column-resize" ) ), aChangeRanges );
+ }
+ }
}
// Spaltenbreiten/Zeilenhoehen (ueber Blockmarken)