Introduce copy-from-clip context for copy handling code.
It's not used yet, and is currently empty. Change-Id: Ia377994ae042fc8b19d269adc2f94830422770f1
This commit is contained in:
parent
ef03feefcc
commit
3014160a8a
9 changed files with 93 additions and 38 deletions
|
@ -90,6 +90,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
|
|||
sc/source/core/data/cell \
|
||||
sc/source/core/data/cell2 \
|
||||
sc/source/core/data/cellvalue \
|
||||
sc/source/core/data/clipcontext \
|
||||
sc/source/core/data/clipparam \
|
||||
sc/source/core/data/column \
|
||||
sc/source/core/data/column2 \
|
||||
|
|
26
sc/inc/clipcontext.hxx
Normal file
26
sc/inc/clipcontext.hxx
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef SC_CLIPCONTEXT_HXX
|
||||
#define SC_CLIPCONTEXT_HXX
|
||||
|
||||
namespace sc {
|
||||
|
||||
class CopyFromClipContext
|
||||
{
|
||||
public:
|
||||
CopyFromClipContext();
|
||||
~CopyFromClipContext();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -50,6 +50,7 @@ namespace editeng { class SvxBorderLine; }
|
|||
namespace sc {
|
||||
struct FormulaGroupContext;
|
||||
class EndListeningContext;
|
||||
class CopyFromClipContext;
|
||||
}
|
||||
|
||||
class Fraction;
|
||||
|
@ -234,8 +235,10 @@ public:
|
|||
void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) const;
|
||||
void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol);
|
||||
void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
|
||||
void CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
|
||||
sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn);
|
||||
void CopyFromClip(
|
||||
sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, long nDy,
|
||||
sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn );
|
||||
|
||||
void StartListeningInArea( SCROW nRow1, SCROW nRow2 );
|
||||
void BroadcastInArea( SCROW nRow1, SCROW nRow2 );
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace editeng { class SvxBorderLine; }
|
|||
namespace sc {
|
||||
struct FormulaGroupContext;
|
||||
class EndListeningContext;
|
||||
class CopyFromClipContext;
|
||||
}
|
||||
class SvxFontItem;
|
||||
|
||||
|
@ -1140,13 +1141,14 @@ public:
|
|||
|
||||
void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
SCTAB nTab, ScDocument* pClipDoc = NULL);
|
||||
void CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy,
|
||||
const ScCopyBlockFromClipParams* pCBFCP );
|
||||
void CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy,
|
||||
const ScCopyBlockFromClipParams* pCBFCP,
|
||||
SCROW & rClipStartRow );
|
||||
void CopyBlockFromClip(
|
||||
sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy, const ScCopyBlockFromClipParams* pCBFCP );
|
||||
void CopyNonFilteredFromClip(
|
||||
sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy, const ScCopyBlockFromClipParams* pCBFCP,
|
||||
SCROW & rClipStartRow );
|
||||
|
||||
void StartListeningFromClip( SCCOL nCol1, SCROW nRow1,
|
||||
SCCOL nCol2, SCROW nRow2,
|
||||
const ScMarkData& rMark, sal_uInt16 nInsFlag );
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace com { namespace sun { namespace star {
|
|||
namespace sc {
|
||||
struct FormulaGroupContext;
|
||||
class EndListeningContext;
|
||||
class CopyFromClipContext;
|
||||
}
|
||||
|
||||
class SfxItemSet;
|
||||
|
@ -383,8 +384,10 @@ public:
|
|||
bool bKeepScenarioFlags, bool bCloneNoteCaptions);
|
||||
void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab);
|
||||
void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
|
||||
void CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy,
|
||||
sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable);
|
||||
void CopyFromClip(
|
||||
sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
SCsCOL nDx, SCsROW nDy, sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable );
|
||||
|
||||
void StartListeningInArea( SCCOL nCol1, SCROW nRow1,
|
||||
SCCOL nCol2, SCROW nRow2 );
|
||||
void BroadcastInArea( SCCOL nCol1, SCROW nRow1,
|
||||
|
|
19
sc/source/core/data/clipcontext.cxx
Normal file
19
sc/source/core/data/clipcontext.cxx
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "clipcontext.hxx"
|
||||
|
||||
namespace sc {
|
||||
|
||||
CopyFromClipContext::CopyFromClipContext() {}
|
||||
CopyFromClipContext::~CopyFromClipContext() {}
|
||||
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -564,9 +564,9 @@ ScFormulaCell* ScColumn::CreateRefCell( ScDocument* pDestDoc, const ScAddress& r
|
|||
// rColumn = source
|
||||
// nRow1, nRow2 = target position
|
||||
|
||||
void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
|
||||
sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty,
|
||||
ScColumn& rColumn)
|
||||
void ScColumn::CopyFromClip(
|
||||
sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, long nDy,
|
||||
sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn )
|
||||
{
|
||||
if ((nInsFlag & IDF_ATTRIB) != 0)
|
||||
{
|
||||
|
|
|
@ -90,6 +90,7 @@
|
|||
#include "stringutil.hxx"
|
||||
#include "formulaiter.hxx"
|
||||
#include "formulacell.hxx"
|
||||
#include "clipcontext.hxx"
|
||||
|
||||
#include <map>
|
||||
#include <limits>
|
||||
|
@ -2299,11 +2300,9 @@ void ScDocument::BroadcastFromClip( SCCOL nCol1, SCROW nRow1,
|
|||
}
|
||||
}
|
||||
|
||||
void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1,
|
||||
SCCOL nCol2, SCROW nRow2,
|
||||
const ScMarkData& rMark,
|
||||
SCsCOL nDx, SCsROW nDy,
|
||||
const ScCopyBlockFromClipParams* pCBFCP )
|
||||
void ScDocument::CopyBlockFromClip(
|
||||
sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy, const ScCopyBlockFromClipParams* pCBFCP )
|
||||
{
|
||||
TableContainer& rClipTabs = pCBFCP->pClipDoc->maTabs;
|
||||
SCTAB nTabEnd = pCBFCP->nTabEnd;
|
||||
|
@ -2314,8 +2313,8 @@ void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1,
|
|||
{
|
||||
while (!rClipTabs[nClipTab]) nClipTab = (nClipTab+1) % (static_cast<SCTAB>(rClipTabs.size()));
|
||||
|
||||
maTabs[i]->CopyFromClip( nCol1, nRow1, nCol2, nRow2, nDx, nDy,
|
||||
pCBFCP->nInsFlag, pCBFCP->bAsLink, pCBFCP->bSkipAttrForEmpty, rClipTabs[nClipTab] );
|
||||
maTabs[i]->CopyFromClip(rCxt, nCol1, nRow1, nCol2, nRow2, nDx, nDy,
|
||||
pCBFCP->nInsFlag, pCBFCP->bAsLink, pCBFCP->bSkipAttrForEmpty, rClipTabs[nClipTab]);
|
||||
|
||||
if ( pCBFCP->pClipDoc->pDrawLayer && ( pCBFCP->nInsFlag & IDF_OBJECTS ) )
|
||||
{
|
||||
|
@ -2382,12 +2381,10 @@ void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1,
|
|||
}
|
||||
|
||||
|
||||
void ScDocument::CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1,
|
||||
SCCOL nCol2, SCROW nRow2,
|
||||
const ScMarkData& rMark,
|
||||
SCsCOL nDx, SCsROW /* nDy */,
|
||||
const ScCopyBlockFromClipParams* pCBFCP,
|
||||
SCROW & rClipStartRow )
|
||||
void ScDocument::CopyNonFilteredFromClip(
|
||||
sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
const ScMarkData& rMark, SCsCOL nDx, SCsROW /*nDy*/, const ScCopyBlockFromClipParams* pCBFCP,
|
||||
SCROW & rClipStartRow )
|
||||
{
|
||||
// call CopyBlockFromClip for ranges of consecutive non-filtered rows
|
||||
// nCol1/nRow1 etc. is in target doc
|
||||
|
@ -2422,7 +2419,8 @@ void ScDocument::CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1,
|
|||
nFollow = nRow2 - nDestRow;
|
||||
|
||||
SCsROW nNewDy = ((SCsROW)nDestRow) - nSourceRow;
|
||||
CopyBlockFromClip( nCol1, nDestRow, nCol2, nDestRow + nFollow, rMark, nDx, nNewDy, pCBFCP );
|
||||
CopyBlockFromClip(
|
||||
rCxt, nCol1, nDestRow, nCol2, nDestRow + nFollow, rMark, nDx, nNewDy, pCBFCP);
|
||||
|
||||
nSourceRow += nFollow + 1;
|
||||
nDestRow += nFollow + 1;
|
||||
|
@ -2535,6 +2533,8 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
|
|||
|
||||
bInsertingFromOtherDoc = true; // kein Broadcast/Listener aufbauen bei Insert
|
||||
|
||||
sc::CopyFromClipContext aCxt;
|
||||
|
||||
SCCOL nClipStartCol = aClipRange.aStart.Col();
|
||||
SCROW nClipStartRow = aClipRange.aStart.Row();
|
||||
SCROW nClipEndRow = aClipRange.aEnd.Row();
|
||||
|
@ -2572,14 +2572,14 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
|
|||
SCsROW nDy = ((SCsROW)nR1) - nClipStartRow;
|
||||
if ( bIncludeFiltered )
|
||||
{
|
||||
CopyBlockFromClip( nC1, nR1, nC2, nR2, rMark, nDx,
|
||||
nDy, &aCBFCP );
|
||||
CopyBlockFromClip(
|
||||
aCxt, nC1, nR1, nC2, nR2, rMark, nDx, nDy, &aCBFCP);
|
||||
nClipStartRow += nR2 - nR1 + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CopyNonFilteredFromClip( nC1, nR1, nC2, nR2, rMark,
|
||||
nDx, nDy, &aCBFCP, nClipStartRow );
|
||||
CopyNonFilteredFromClip(
|
||||
aCxt, nC1, nR1, nC2, nR2, rMark, nDx, nDy, &aCBFCP, nClipStartRow);
|
||||
}
|
||||
nC1 = nC2 + 1;
|
||||
nC2 = std::min((SCCOL)(nC1 + nXw), nCol2);
|
||||
|
@ -2674,6 +2674,7 @@ void ScDocument::CopyMultiRangeFromClip(
|
|||
sal_uInt16 nDelFlag = IDF_CONTENTS;
|
||||
const ScBitMaskCompressedArray<SCROW, sal_uInt8>& rFlags = GetRowFlagsArray(aCBFCP.nTabStart);
|
||||
|
||||
sc::CopyFromClipContext aCxt;
|
||||
for ( size_t i = 0, n = rClipParam.maRanges.size(); i < n; ++i )
|
||||
{
|
||||
ScRange* p = rClipParam.maRanges[ i ];
|
||||
|
@ -2690,7 +2691,7 @@ void ScDocument::CopyMultiRangeFromClip(
|
|||
if (!bSkipAttrForEmpty)
|
||||
DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag);
|
||||
|
||||
CopyBlockFromClip(nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
|
||||
CopyBlockFromClip(aCxt, nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
|
||||
nRowCount -= nEndRow - nBegRow + 1;
|
||||
|
||||
while (nRowCount > 0)
|
||||
|
@ -2709,7 +2710,7 @@ void ScDocument::CopyMultiRangeFromClip(
|
|||
if (!bSkipAttrForEmpty)
|
||||
DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag);
|
||||
|
||||
CopyBlockFromClip(nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
|
||||
CopyBlockFromClip(aCxt, nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
|
||||
nRowCount -= nEndRow - nBegRow + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -745,9 +745,9 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
|
|||
}
|
||||
}
|
||||
|
||||
void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
SCsCOL nDx, SCsROW nDy, sal_uInt16 nInsFlag,
|
||||
bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable)
|
||||
void ScTable::CopyFromClip(
|
||||
sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
||||
SCsCOL nDx, SCsROW nDy, sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable )
|
||||
{
|
||||
|
||||
if (nCol2 > MAXCOL)
|
||||
|
@ -758,7 +758,7 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
|
|||
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
|
||||
{
|
||||
for ( SCCOL i = nCol1; i <= nCol2; i++)
|
||||
aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]);
|
||||
aCol[i].CopyFromClip(rCxt, nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]);
|
||||
|
||||
|
||||
if(nInsFlag != IDF_OBJECTS)
|
||||
|
|
Loading…
Reference in a new issue