summaryrefslogtreecommitdiff
path: root/sc/source/core/data
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-05-16 17:13:40 +0200
committerLuboš Luňák <l.lunak@collabora.com>2019-05-20 10:02:49 +0200
commit5d5e308331e7166726264c43545798b5fb833c8a (patch)
treee3f479518767849f58b270a61a9377cf5735db3e /sc/source/core/data
parent688c5b8d64797596ee9826c3288824b5354a44a9 (diff)
cache mdds positions also in CopyTextAttrsFromClipHandler (tdf#112000)
This is basically just a copy&paste from CopyCellsFromClipHandler. Change-Id: I4abd39923cb933e73d73938a8d38913b5e5382a0 Reviewed-on: https://gerrit.libreoffice.org/72423 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/source/core/data')
-rw-r--r--sc/source/core/data/column3.cxx31
1 files changed, 25 insertions, 6 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 26847a3a6126..a02a2442ce8b 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1330,13 +1330,32 @@ public:
class CopyTextAttrsFromClipHandler
{
+ sc::CopyFromClipContext& mrCxt;
sc::CellTextAttrStoreType& mrAttrs;
- sc::CellTextAttrStoreType::iterator miPos;
size_t const mnDelta;
+ sc::ColumnBlockPosition maDestBlockPos;
+ sc::ColumnBlockPosition* mpDestBlockPos; // to save it for next iteration.
public:
- CopyTextAttrsFromClipHandler( sc::CellTextAttrStoreType& rAttrs, size_t nDelta ) :
- mrAttrs(rAttrs), miPos(mrAttrs.begin()), mnDelta(nDelta) {}
+ CopyTextAttrsFromClipHandler( sc::CopyFromClipContext& rCxt, sc::CellTextAttrStoreType& rAttrs,
+ ScColumn& rDestCol, SCTAB nDestTab, SCCOL nDestCol, size_t nDelta ) :
+ mrCxt( rCxt ),
+ mrAttrs(rAttrs),
+ mnDelta(nDelta),
+ mpDestBlockPos(mrCxt.getBlockPosition(nDestTab, nDestCol))
+ {
+ if (mpDestBlockPos)
+ maDestBlockPos = *mpDestBlockPos;
+ else
+ rDestCol.InitBlockPosition(maDestBlockPos);
+ }
+
+ ~CopyTextAttrsFromClipHandler()
+ {
+ if (mpDestBlockPos)
+ // Don't forget to save this to the context!
+ *mpDestBlockPos = maDestBlockPos;
+ }
void operator() ( const sc::CellTextAttrStoreType::value_type& aNode, size_t nOffset, size_t nDataSize )
{
@@ -1349,7 +1368,7 @@ public:
std::advance(itEnd, nDataSize);
size_t nPos = aNode.position + nOffset + mnDelta;
- miPos = mrAttrs.set(miPos, nPos, it, itEnd);
+ maDestBlockPos.miCellTextAttrPos = mrAttrs.set(maDestBlockPos.miCellTextAttrPos, nPos, it, itEnd);
}
};
@@ -1406,7 +1425,7 @@ void ScColumn::CopyFromClip(
}
// Don't forget to copy the cell text attributes.
- CopyTextAttrsFromClipHandler aFunc(maCellTextAttrs, nDy);
+ CopyTextAttrsFromClipHandler aFunc(rCxt, maCellTextAttrs, *this, nTab, nCol, nDy);
sc::ParseBlock(rColumn.maCellTextAttrs.begin(), rColumn.maCellTextAttrs, aFunc, nRow1-nDy, nRow2-nDy);
return;
@@ -1426,7 +1445,7 @@ void ScColumn::CopyFromClip(
{
// Don't forget to copy the cell text attributes.
- CopyTextAttrsFromClipHandler aFunc(maCellTextAttrs, nDy);
+ CopyTextAttrsFromClipHandler aFunc(rCxt, maCellTextAttrs, *this, nTab, nCol, nDy);
sc::ParseBlock(rColumn.maCellTextAttrs.begin(), rColumn.maCellTextAttrs, aFunc, nRow1-nDy, nRow2-nDy);
}
}