Kaydet (Commit) 5d5e3083 authored tarafından Luboš Luňák's avatar Luboš Luňák

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: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst 688c5b8d
...@@ -1330,13 +1330,32 @@ public: ...@@ -1330,13 +1330,32 @@ public:
class CopyTextAttrsFromClipHandler class CopyTextAttrsFromClipHandler
{ {
sc::CopyFromClipContext& mrCxt;
sc::CellTextAttrStoreType& mrAttrs; sc::CellTextAttrStoreType& mrAttrs;
sc::CellTextAttrStoreType::iterator miPos;
size_t const mnDelta; size_t const mnDelta;
sc::ColumnBlockPosition maDestBlockPos;
sc::ColumnBlockPosition* mpDestBlockPos; // to save it for next iteration.
public: public:
CopyTextAttrsFromClipHandler( sc::CellTextAttrStoreType& rAttrs, size_t nDelta ) : CopyTextAttrsFromClipHandler( sc::CopyFromClipContext& rCxt, sc::CellTextAttrStoreType& rAttrs,
mrAttrs(rAttrs), miPos(mrAttrs.begin()), mnDelta(nDelta) {} 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 ) void operator() ( const sc::CellTextAttrStoreType::value_type& aNode, size_t nOffset, size_t nDataSize )
{ {
...@@ -1349,7 +1368,7 @@ public: ...@@ -1349,7 +1368,7 @@ public:
std::advance(itEnd, nDataSize); std::advance(itEnd, nDataSize);
size_t nPos = aNode.position + nOffset + mnDelta; 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( ...@@ -1406,7 +1425,7 @@ void ScColumn::CopyFromClip(
} }
// Don't forget to copy the cell text attributes. // 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); sc::ParseBlock(rColumn.maCellTextAttrs.begin(), rColumn.maCellTextAttrs, aFunc, nRow1-nDy, nRow2-nDy);
return; return;
...@@ -1426,7 +1445,7 @@ void ScColumn::CopyFromClip( ...@@ -1426,7 +1445,7 @@ void ScColumn::CopyFromClip(
{ {
// Don't forget to copy the cell text attributes. // 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); sc::ParseBlock(rColumn.maCellTextAttrs.begin(), rColumn.maCellTextAttrs, aFunc, nRow1-nDy, nRow2-nDy);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment