diff options
-rw-r--r-- | sc/inc/rangelst.hxx | 26 | ||||
-rw-r--r-- | sc/source/core/tool/rangelst.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/inc/viewfunc.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 22 |
4 files changed, 40 insertions, 24 deletions
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index cc2c83abea88..e497e49b4c42 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -39,20 +39,18 @@ class ScDocument; class SC_DLLPUBLIC ScRangeList : public SvRefBase { public: - ScRangeList() {} - ScRangeList( const ScRangeList& rList ); - virtual ~ScRangeList(); - ScRangeList& operator=(const ScRangeList& rList); - void Append( const ScRange& rRange ) - { - ScRange* pR = new ScRange( rRange ); - maRanges.push_back( pR ); - } - - sal_uInt16 Parse( const String&, ScDocument* = NULL, - sal_uInt16 nMask = SCA_VALID, - formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, - sal_Unicode cDelimiter = 0 ); + ScRangeList(); + ScRangeList( const ScRangeList& rList ); + ScRangeList( const ScRange& rRange ); + virtual ~ScRangeList(); + + ScRangeList& operator=(const ScRangeList& rList); + void Append( const ScRange& rRange ); + + sal_uInt16 Parse( const String&, ScDocument* = NULL, + sal_uInt16 nMask = SCA_VALID, + formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, + sal_Unicode cDelimiter = 0 ); void Format( String&, sal_uInt16 nFlags = 0, ScDocument* = NULL, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 7a5f0a29c96a..9a6ded06d249 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -409,6 +409,8 @@ ScRange* ScRangeList::Find( const ScAddress& rAdr ) return itr == maRanges.end() ? NULL : *itr; } +ScRangeList::ScRangeList() {} + ScRangeList::ScRangeList( const ScRangeList& rList ) : SvRefBase() { @@ -416,6 +418,12 @@ ScRangeList::ScRangeList( const ScRangeList& rList ) : for_each(rList.maRanges.begin(), rList.maRanges.end(), AppendToList(maRanges)); } +ScRangeList::ScRangeList( const ScRange& rRange ) +{ + maRanges.reserve(1); + Append(rRange); +} + ScRangeList& ScRangeList::operator=(const ScRangeList& rList) { RemoveAll(); @@ -424,6 +432,12 @@ ScRangeList& ScRangeList::operator=(const ScRangeList& rList) return *this; } +void ScRangeList::Append( const ScRange& rRange ) +{ + ScRange* pR = new ScRange( rRange ); + maRanges.push_back( pR ); +} + bool ScRangeList::Intersects( const ScRange& rRange ) const { vector<ScRange*>::const_iterator itrEnd = maRanges.end(); diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index e8b265123f95..29e10f36e8d1 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -367,7 +367,7 @@ private: bool bSkipEmpty, bool bTranspose, bool bAsLink, bool bAllowDialogs, InsCellCmd eMoveMode, sal_uInt16 nUndoFlags ); - void PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark); + void PostPasteFromClip(const ScRangeList& rPasteRanges, const ScMarkData& rMark); sal_uInt16 GetOptimalColWidth( SCCOL nCol, SCTAB nTab, sal_Bool bFormula ); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 490bd9c29744..5aa8c5066cd8 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1855,12 +1855,12 @@ bool ScViewFunc::PasteFromClipToMultiRanges( pUndoMgr->LeaveListAction(); } aModificator.SetDocumentModified(); -// PostPasteFromClip(aMarkedRange, aMark); + PostPasteFromClip(aRanges, aMark); return false; } -void ScViewFunc::PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark) +void ScViewFunc::PostPasteFromClip(const ScRangeList& rPasteRanges, const ScMarkData& rMark) { ScViewData* pViewData = GetViewData(); ScDocShell* pDocSh = pViewData->GetDocShell(); @@ -1870,19 +1870,23 @@ void ScViewFunc::PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& // #i97876# Spreadsheet data changes are not notified ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() ); - if ( pModelObj && pModelObj->HasChangesListeners() ) + if (!pModelObj || !pModelObj->HasChangesListeners()) + return; + + ScRangeList aChangeRanges; + for (size_t i = 0, n = rPasteRanges.size(); i < n; ++i) { - ScRangeList aChangeRanges; + const ScRange& r = *rPasteRanges[i]; ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); for (; itr != itrEnd; ++itr) { - ScRange aChangeRange(rPasteRange); - aChangeRange.aStart.SetTab( *itr ); - aChangeRange.aEnd.SetTab( *itr ); - aChangeRanges.Append( aChangeRange ); + ScRange aChangeRange(r); + aChangeRange.aStart.SetTab(*itr); + aChangeRange.aEnd.SetTab(*itr); + aChangeRanges.Append(aChangeRange); } - pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges ); } + pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges ); } |