[ooo-build-commit] .: patches/dev300
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Apr 23 11:53:18 PDT 2010
patches/dev300/calc-external-ref-decode-unicode-uri.diff | 25
patches/dev300/calc-external-ref-modify-link-modified.diff | 12
patches/dev300/calc-general-type-auto-decimal-svtools-fix.diff | 106
patches/dev300/calc-xls-import-shared-formula-refwrap.diff | 353 -
patches/dev300/csv-import-preserve-options-officecfg.diff | 86
patches/dev300/csv-import-preserve-options-sc.diff | 647 --
patches/dev300/cws-koheimultirangecopy-sc.diff | 2667 ----------
patches/dev300/enable-xls-export-encryption.diff | 13
8 files changed, 3909 deletions(-)
New commits:
commit 21f10c24ee1f98dcaa862eb138890469bb1276d1
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Apr 23 14:52:50 2010 -0400
Removed patches that we no longer need.
* patches/dev300/calc-external-ref-decode-unicode-uri.diff:
* patches/dev300/calc-external-ref-modify-link-modified.diff:
* patches/dev300/calc-general-type-auto-decimal-svtools-fix.diff:
* patches/dev300/calc-xls-import-shared-formula-refwrap.diff:
* patches/dev300/csv-import-preserve-options-officecfg.diff:
* patches/dev300/csv-import-preserve-options-sc.diff:
* patches/dev300/cws-koheimultirangecopy-sc.diff:
* patches/dev300/enable-xls-export-encryption.diff:
diff --git a/patches/dev300/calc-external-ref-decode-unicode-uri.diff b/patches/dev300/calc-external-ref-decode-unicode-uri.diff
deleted file mode 100644
index 4c65ca2..0000000
--- a/patches/dev300/calc-external-ref-decode-unicode-uri.diff
+++ /dev/null
@@ -1,25 +0,0 @@
-diff --git sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
-index bbb62c0..6bac207 100644
---- sc/source/core/tool/compiler.cxx
-+++ sc/source/core/tool/compiler.cxx
-@@ -1062,7 +1062,7 @@ struct ConventionOOO_A1 : public Convention_A1
- String aFile;
- const String* p = pRefMgr->getExternalFileName(nFileId);
- if (p)
-- aFile = *p;
-+ aFile = INetURLObject::decode(*p, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS);
- aFile.SearchAndReplaceAllAscii("'", String::CreateFromAscii("''"));
-
- rBuffer.append(sal_Unicode('\''));
-@@ -1319,8 +1319,9 @@ struct ConventionXL
-
- rBuffer.append(sal_Unicode('['));
- rBuffer.append(sal_Unicode('\''));
-- const sal_Unicode* pBuf = rFullName.GetBuffer();
-- xub_StrLen nLen = rFullName.Len();
-+ String aFullName = INetURLObject::decode(rFullName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS);
-+ const sal_Unicode* pBuf = aFullName.GetBuffer();
-+ xub_StrLen nLen = aFullName.Len();
- for (xub_StrLen i = 0; i < nLen; ++i)
- {
- const sal_Unicode c = pBuf[i];
diff --git a/patches/dev300/calc-external-ref-modify-link-modified.diff b/patches/dev300/calc-external-ref-modify-link-modified.diff
deleted file mode 100644
index 8550413..0000000
--- a/patches/dev300/calc-external-ref-modify-link-modified.diff
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git sc/source/ui/docshell/externalrefmgr.cxx sc/source/ui/docshell/externalrefmgr.cxx
-index b831e93..749695b 100644
---- sc/source/ui/docshell/externalrefmgr.cxx
-+++ sc/source/ui/docshell/externalrefmgr.cxx
-@@ -991,6 +991,7 @@ void ScExternalRefLink::DataChanged(const String& /*rMimeType*/, const Any& /*rV
- // The source document has changed.
- pMgr->switchSrcFile(mnFileId, aFile, aFilter);
- maFilterName = aFilter;
-+ mpDoc->GetDocumentShell()->SetModified();
- }
- }
-
diff --git a/patches/dev300/calc-general-type-auto-decimal-svtools-fix.diff b/patches/dev300/calc-general-type-auto-decimal-svtools-fix.diff
deleted file mode 100644
index 6128456..0000000
--- a/patches/dev300/calc-general-type-auto-decimal-svtools-fix.diff
+++ /dev/null
@@ -1,106 +0,0 @@
-diff --git svtools/inc/svtools/zforlist.hxx svtools/inc/svtools/zforlist.hxx
-index 2ae53fc..c06f9bd 100644
---- svtools/inc/svtools/zforlist.hxx
-+++ svtools/inc/svtools/zforlist.hxx
-@@ -342,6 +342,12 @@ public:
- */
- static const sal_uInt16 UNLIMITED_PRECISION;
-
-+ /**
-+ * Precision suitable for numbers displayed in input bar, for instance
-+ * Calc's formula input bar.
-+ */
-+ static const sal_uInt16 INPUTSTRING_PRECISION;
-+
- /// Preferred ctor with service manager and language/country enum
- SvNumberFormatter(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr,
-diff --git svtools/source/numbers/zforlist.cxx svtools/source/numbers/zforlist.cxx
-index 85807ce..2b3f196 100644
---- svtools/source/numbers/zforlist.cxx
-+++ svtools/source/numbers/zforlist.cxx
-@@ -193,7 +193,8 @@ SV_IMPL_PTRARR( NfWSStringsDtor, String* );
-
- /***********************Funktionen SvNumberFormatter**************************/
-
--const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits<sal_uInt16>::max();
-+const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits<sal_uInt16>::max();
-+const sal_uInt16 SvNumberFormatter::INPUTSTRING_PRECISION = ::std::numeric_limits<sal_uInt16>::max()-1;
-
- SvNumberFormatter::SvNumberFormatter(
- const Reference< XMultiServiceFactory >& xSMgr,
-@@ -1492,7 +1493,6 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
- String& sOutString)
- {
- SvNumberformat* pFormat;
-- short nOldPrec;
- Color* pColor;
- pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
- if (!pFormat)
-@@ -1502,7 +1502,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
- short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED;
- if (eType == 0)
- eType = NUMBERFORMAT_DEFINED;
-- nOldPrec = -1;
-+ sal_uInt16 nOldPrec = pFormatScanner->GetStandardPrec();
-+ bool bPrecChanged = false;
- if (eType == NUMBERFORMAT_NUMBER || eType == NUMBERFORMAT_PERCENT
- || eType == NUMBERFORMAT_CURRENCY
- || eType == NUMBERFORMAT_SCIENTIFIC
-@@ -1510,8 +1511,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
- {
- if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung %
- eType = NUMBERFORMAT_NUMBER;
-- nOldPrec = pFormatScanner->GetStandardPrec();
-- ChangeStandardPrec(UNLIMITED_PRECISION); // Merkwert
-+ ChangeStandardPrec(INPUTSTRING_PRECISION);
-+ bPrecChanged = true;
- }
- sal_uInt32 nKey = nFIndex;
- switch ( eType )
-@@ -1531,12 +1532,12 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
- {
- if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() )
- {
-- nOldPrec = pFormatScanner->GetStandardPrec();
-- ChangeStandardPrec(UNLIMITED_PRECISION); // Merkwert
-+ ChangeStandardPrec(INPUTSTRING_PRECISION);
-+ bPrecChanged = true;
- }
- pFormat->GetOutputString(fOutNumber, sOutString, &pColor);
- }
-- if (nOldPrec != -1)
-+ if (bPrecChanged)
- ChangeStandardPrec(nOldPrec);
- }
-
-diff --git svtools/source/numbers/zformat.cxx svtools/source/numbers/zformat.cxx
-index 494128a..1b240c2 100644
---- svtools/source/numbers/zformat.cxx
-+++ svtools/source/numbers/zformat.cxx
-@@ -2061,16 +2061,23 @@ BOOL SvNumberformat::GetOutputString(double fNumber,
- BOOL bHadStandard = FALSE;
- if (bStandard) // einzelne Standardformate
- {
-- if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION) // alle Zahlformate InputLine
-+ if (rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION) // alle Zahlformate InputLine
- {
- ImpGetOutputInputLine(fNumber, OutString);
-- return FALSE;
-+ return false;
- }
- switch (eType)
- {
- case NUMBERFORMAT_NUMBER: // Standardzahlformat
-+ {
-+ if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION)
-+ {
-+ ImpGetOutputInputLine(fNumber, OutString);
-+ return false;
-+ }
- ImpGetOutputStandard(fNumber, OutString);
- bHadStandard = TRUE;
-+ }
- break;
- case NUMBERFORMAT_DATE:
- bRes |= ImpGetDateOutput(fNumber, 0, OutString);
diff --git a/patches/dev300/calc-xls-import-shared-formula-refwrap.diff b/patches/dev300/calc-xls-import-shared-formula-refwrap.diff
deleted file mode 100644
index 6a7ff88..0000000
--- a/patches/dev300/calc-xls-import-shared-formula-refwrap.diff
+++ /dev/null
@@ -1,353 +0,0 @@
-diff --git sc/inc/compiler.hxx sc/inc/compiler.hxx
-index c41c15d..75da014 100644
---- sc/inc/compiler.hxx
-+++ sc/inc/compiler.hxx
-@@ -404,9 +404,9 @@ public:
- const ScDocument* GetDoc() const { return pDoc; }
- const ScAddress& GetPos() const { return aPos; }
-
-- void MoveRelWrap();
-- static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc,
-- const ScAddress& rPos );
-+ void MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow );
-+ static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos,
-+ SCCOL nMaxCol, SCROW nMaxRow );
-
- BOOL UpdateNameReference( UpdateRefMode eUpdateRefMode,
- const ScRange&,
-diff --git sc/inc/rangenam.hxx sc/inc/rangenam.hxx
-index ece1609..59ca4f8 100644
---- sc/inc/rangenam.hxx
-+++ sc/inc/rangenam.hxx
-@@ -83,6 +83,11 @@ private:
- USHORT nIndex;
- BOOL bModified; // wird bei UpdateReference gesetzt/geloescht
-
-+ // max row and column to use for wrapping of references. If -1 use the
-+ // application's default.
-+ SCROW mnMaxRow;
-+ SCCOL mnMaxCol;
-+
- friend class ScRangeName;
- ScRangeData( USHORT nIndex );
- public:
-@@ -158,6 +163,11 @@ public:
-
- static void MakeValidName( String& rName );
- SC_DLLPUBLIC static BOOL IsNameValid( const String& rName, ScDocument* pDoc );
-+
-+ SC_DLLPUBLIC void SetMaxRow(SCROW nRow);
-+ SCROW GetMaxRow() const;
-+ SC_DLLPUBLIC void SetMaxCol(SCCOL nCol);
-+ SCCOL GetMaxCol() const;
- };
-
- inline BOOL ScRangeData::HasType( RangeType nType ) const
-diff --git sc/source/core/data/cell2.cxx sc/source/core/data/cell2.cxx
-index 4c38b39..58d154d 100644
---- sc/source/core/data/cell2.cxx
-+++ sc/source/core/data/cell2.cxx
-@@ -891,7 +891,7 @@ void ScFormulaCell::UpdateInsertTab(SCTAB nTable)
- pCode = new ScTokenArray( *pRangeData->GetCode() );
- ScCompiler aComp2(pDocument, aPos, *pCode);
- aComp2.SetGrammar(pDocument->GetGrammar());
-- aComp2.MoveRelWrap();
-+ aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
- aComp2.UpdateInsertTab( nTable, FALSE );
- // If the shared formula contained a named range/formula containing
- // an absolute reference to a sheet, those have to be readjusted.
-@@ -927,7 +927,7 @@ BOOL ScFormulaCell::UpdateDeleteTab(SCTAB nTable, BOOL bIsMove)
- ScCompiler aComp2(pDocument, aPos, *pCode);
- aComp2.SetGrammar(pDocument->GetGrammar());
- aComp2.CompileTokenArray();
-- aComp2.MoveRelWrap();
-+ aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
- aComp2.UpdateDeleteTab( nTable, FALSE, FALSE, bRefChanged );
- // If the shared formula contained a named range/formula containing
- // an absolute reference to a sheet, those have to be readjusted.
-@@ -964,7 +964,7 @@ void ScFormulaCell::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo )
- ScCompiler aComp2(pDocument, aPos, *pCode);
- aComp2.SetGrammar(pDocument->GetGrammar());
- aComp2.CompileTokenArray();
-- aComp2.MoveRelWrap();
-+ aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
- aComp2.UpdateMoveTab( nOldPos, nNewPos, TRUE );
- bCompile = TRUE;
- }
-diff --git sc/source/core/inc/refupdat.hxx sc/source/core/inc/refupdat.hxx
-index c60cccc..1a4c66d 100644
---- sc/source/core/inc/refupdat.hxx
-+++ sc/source/core/inc/refupdat.hxx
-@@ -81,8 +81,8 @@ public:
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
- ScComplexRefData& rRef, BOOL bWrap, BOOL bAbsolute );
-
-- static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
-- ScComplexRefData& rRef );
-+ static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
-+ SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef );
-
- /// Before calling, the absolute references must be up-to-date!
- static ScRefUpdateRes UpdateTranspose( ScDocument* pDoc,
-diff --git sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
-index da0f296..c5cfce0 100644
---- sc/source/core/tool/compiler.cxx
-+++ sc/source/core/tool/compiler.cxx
-@@ -3809,7 +3809,7 @@ BOOL ScCompiler::HandleRange()
- if( pRangeData->HasReferences() )
- {
- SetRelNameReference();
-- MoveRelWrap();
-+ MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
- }
- pNew->Reset();
- if ( bAddPair )
-@@ -3861,7 +3861,7 @@ BOOL ScCompiler::HandleExternalReference(const FormulaToken& _aToken)
- if (pNew->GetNextReference() != NULL)
- {
- SetRelNameReference();
-- MoveRelWrap();
-+ MoveRelWrap(MAXCOL, MAXROW);
- }
- pNew->Reset();
- return GetToken();
-@@ -3956,33 +3956,33 @@ void ScCompiler::SetRelNameReference()
-
- // Wrap-adjust relative references of a RangeName to current position,
- // don't call for other token arrays!
--void ScCompiler::MoveRelWrap()
-+void ScCompiler::MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow )
- {
- pArr->Reset();
- for( ScToken* t = static_cast<ScToken*>(pArr->GetNextReference()); t;
- t = static_cast<ScToken*>(pArr->GetNextReference()) )
- {
- if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef )
-- ScRefUpdate::MoveRelWrap( pDoc, aPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
-+ ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
- else
-- ScRefUpdate::MoveRelWrap( pDoc, aPos, t->GetDoubleRef() );
-+ ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, t->GetDoubleRef() );
- }
- }
-
- // static
- // Wrap-adjust relative references of a RangeName to current position,
- // don't call for other token arrays!
--void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc,
-- const ScAddress& rPos )
-+void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos,
-+ SCCOL nMaxCol, SCROW nMaxRow )
- {
- rArr.Reset();
- for( ScToken* t = static_cast<ScToken*>(rArr.GetNextReference()); t;
- t = static_cast<ScToken*>(rArr.GetNextReference()) )
- {
- if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef )
-- ScRefUpdate::MoveRelWrap( pDoc, rPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
-+ ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
- else
-- ScRefUpdate::MoveRelWrap( pDoc, rPos, t->GetDoubleRef() );
-+ ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, t->GetDoubleRef() );
- }
- }
-
-@@ -4157,7 +4157,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
- SingleDoubleRefModifier aMod( rRef );
- if ( rRef.IsRelName() )
- {
-- ScRefUpdate::MoveRelWrap( pDoc, aPos, aMod.Ref() );
-+ ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, aMod.Ref() );
- rChanged = TRUE;
- }
- else
-@@ -4187,7 +4187,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
- SCTAB nTabs = rRef.Ref2.nTab - rRef.Ref1.nTab;
- if ( rRef.Ref1.IsRelName() || rRef.Ref2.IsRelName() )
- {
-- ScRefUpdate::MoveRelWrap( pDoc, aPos, rRef );
-+ ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, rRef );
- rChanged = TRUE;
- }
- else
-diff --git sc/source/core/tool/rangenam.cxx sc/source/core/tool/rangenam.cxx
-index d30a3d5..d701b2a 100644
---- sc/source/core/tool/rangenam.cxx
-+++ sc/source/core/tool/rangenam.cxx
-@@ -60,7 +60,7 @@ using namespace formula;
- // Interner ctor fuer das Suchen nach einem Index
-
- ScRangeData::ScRangeData( USHORT n )
-- : pCode( NULL ), nIndex( n ), bModified( FALSE )
-+ : pCode( NULL ), nIndex( n ), bModified( FALSE ), mnMaxRow(-1), mnMaxCol(-1)
- {}
-
- ScRangeData::ScRangeData( ScDocument* pDok,
-@@ -76,7 +76,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
- eType ( nType ),
- pDoc ( pDok ),
- nIndex ( 0 ),
-- bModified ( FALSE )
-+ bModified ( FALSE ),
-+ mnMaxRow (-1),
-+ mnMaxCol (-1)
- {
- if (rSymbol.Len() > 0)
- {
-@@ -122,7 +124,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
- eType ( nType ),
- pDoc ( pDok ),
- nIndex ( 0 ),
-- bModified ( FALSE )
-+ bModified ( FALSE ),
-+ mnMaxRow (-1),
-+ mnMaxCol (-1)
- {
- if( !pCode->GetCodeError() )
- {
-@@ -157,7 +161,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
- eType ( RT_NAME ),
- pDoc ( pDok ),
- nIndex ( 0 ),
-- bModified ( FALSE )
-+ bModified ( FALSE ),
-+ mnMaxRow (-1),
-+ mnMaxCol (-1)
- {
- ScSingleRefData aRefData;
- aRefData.InitAddress( rTarget );
-@@ -179,7 +185,9 @@ ScRangeData::ScRangeData(const ScRangeData& rScRangeData) :
- eType (rScRangeData.eType),
- pDoc (rScRangeData.pDoc),
- nIndex (rScRangeData.nIndex),
-- bModified (rScRangeData.bModified)
-+ bModified (rScRangeData.bModified),
-+ mnMaxRow (rScRangeData.mnMaxRow),
-+ mnMaxCol (rScRangeData.mnMaxCol)
- {}
-
- ScRangeData::~ScRangeData()
-@@ -247,7 +255,7 @@ void ScRangeData::UpdateSymbol( rtl::OUStringBuffer& rBuffer, const ScAddress& r
- ::std::auto_ptr<ScTokenArray> pTemp( pCode->Clone() );
- ScCompiler aComp( pDoc, rPos, *pTemp.get());
- aComp.SetGrammar(eGrammar);
-- aComp.MoveRelWrap();
-+ aComp.MoveRelWrap(GetMaxCol(), GetMaxRow());
- aComp.CreateStringFromTokenArray( rBuffer );
- }
-
-@@ -393,7 +401,7 @@ BOOL ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const
- ::std::auto_ptr<ScTokenArray> pTemp( pCode->Clone() );
- ScCompiler aComp( pDoc, rPos, *pTemp);
- aComp.SetGrammar(pDoc->GetGrammar());
-- aComp.MoveRelWrap();
-+ aComp.MoveRelWrap(MAXCOL, MAXROW);
- return pTemp->IsReference( rRange );
- }
-
-@@ -520,6 +528,26 @@ BOOL ScRangeData::IsNameValid( const String& rName, ScDocument* pDoc )
- return TRUE;
- }
-
-+void ScRangeData::SetMaxRow(SCROW nRow)
-+{
-+ mnMaxRow = nRow;
-+}
-+
-+SCROW ScRangeData::GetMaxRow() const
-+{
-+ return mnMaxRow >= 0 ? mnMaxRow : MAXROW;
-+}
-+
-+void ScRangeData::SetMaxCol(SCCOL nCol)
-+{
-+ mnMaxCol = nCol;
-+}
-+
-+SCCOL ScRangeData::GetMaxCol() const
-+{
-+ return mnMaxCol >= 0 ? mnMaxCol : MAXCOL;
-+}
-+
-
- USHORT ScRangeData::GetErrCode()
- {
-diff --git sc/source/core/tool/refupdat.cxx sc/source/core/tool/refupdat.cxx
-index 0836979..461a1d7 100644
---- sc/source/core/tool/refupdat.cxx
-+++ sc/source/core/tool/refupdat.cxx
-@@ -820,28 +820,28 @@ ScRefUpdateRes ScRefUpdate::Move( ScDocument* pDoc, const ScAddress& rPos,
- return eRet;
- }
-
--void ScRefUpdate::MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
-- ScComplexRefData& rRef )
-+void ScRefUpdate::MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
-+ SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef )
- {
- if( rRef.Ref1.IsColRel() )
- {
- rRef.Ref1.nCol = rRef.Ref1.nRelCol + rPos.Col();
-- lcl_MoveItWrap( rRef.Ref1.nCol, static_cast<SCsCOL>(0), MAXCOL );
-+ lcl_MoveItWrap( rRef.Ref1.nCol, static_cast<SCsCOL>(0), nMaxCol );
- }
- if( rRef.Ref2.IsColRel() )
- {
- rRef.Ref2.nCol = rRef.Ref2.nRelCol + rPos.Col();
-- lcl_MoveItWrap( rRef.Ref2.nCol, static_cast<SCsCOL>(0), MAXCOL );
-+ lcl_MoveItWrap( rRef.Ref2.nCol, static_cast<SCsCOL>(0), nMaxCol );
- }
- if( rRef.Ref1.IsRowRel() )
- {
- rRef.Ref1.nRow = rRef.Ref1.nRelRow + rPos.Row();
-- lcl_MoveItWrap( rRef.Ref1.nRow, static_cast<SCsROW>(0), MAXROW );
-+ lcl_MoveItWrap( rRef.Ref1.nRow, static_cast<SCsROW>(0), nMaxRow );
- }
- if( rRef.Ref2.IsRowRel() )
- {
- rRef.Ref2.nRow = rRef.Ref2.nRelRow + rPos.Row();
-- lcl_MoveItWrap( rRef.Ref2.nRow, static_cast<SCsROW>(0), MAXROW );
-+ lcl_MoveItWrap( rRef.Ref2.nRow, static_cast<SCsROW>(0), nMaxRow );
- }
- SCsTAB nMaxTab = (SCsTAB) pDoc->GetTableCount() - 1;
- if( rRef.Ref1.IsTabRel() )
-diff --git sc/source/filter/excel/namebuff.cxx sc/source/filter/excel/namebuff.cxx
-index f007482..3c71823 100644
---- sc/source/filter/excel/namebuff.cxx
-+++ sc/source/filter/excel/namebuff.cxx
-@@ -127,6 +127,9 @@ void ShrfmlaBuffer::Store( const ScRange& rRange, const ScTokenArray& rToken )
- DBG_ASSERT( mnCurrIdx <= 0xFFFF, "*ShrfmlaBuffer::Store(): Gleich wird mir schlecht...!" );
-
- ScRangeData* pData = new ScRangeData( pExcRoot->pIR->GetDocPtr(), aName, rToken, rRange.aStart, RT_SHARED );
-+ const ScAddress& rMaxPos = pExcRoot->pIR->GetMaxPos();
-+ pData->SetMaxCol(rMaxPos.Col());
-+ pData->SetMaxRow(rMaxPos.Row());
- pData->SetIndex( static_cast< USHORT >( mnCurrIdx ) );
- pExcRoot->pIR->GetNamedRanges().Insert( pData );
- index_hash[rRange.aStart] = static_cast< USHORT >( mnCurrIdx );
-diff --git sc/source/filter/excel/xeformula.cxx sc/source/filter/excel/xeformula.cxx
-index 6767ad2..0611a63 100644
---- sc/source/filter/excel/xeformula.cxx
-+++ sc/source/filter/excel/xeformula.cxx
-@@ -619,7 +619,7 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA
- DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - missing cell address" );
- // clone the passed token array, convert references relative to current cell position
- mxOwnScTokArr.reset( rScTokArr.Clone() );
-- ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos );
-+ ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW );
- // don't remember pScBasePos in mpScBasePos, shared formulas use real relative refs
- break;
- default:;
-diff --git sc/source/filter/xlsx/xlsx-xeformula.cxx sc/source/filter/xlsx/xlsx-xeformula.cxx
-index 31af0f9..c1989b8 100644
---- sc/source/filter/xlsx/xlsx-xeformula.cxx
-+++ sc/source/filter/xlsx/xlsx-xeformula.cxx
-@@ -619,7 +619,7 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA
- DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - missing cell address" );
- // clone the passed token array, convert references relative to current cell position
- mxOwnScTokArr.reset( rScTokArr.Clone() );
-- ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos );
-+ ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW );
- // don't remember pScBasePos in mpScBasePos, shared formulas use real relative refs
- break;
- default:;
diff --git a/patches/dev300/csv-import-preserve-options-officecfg.diff b/patches/dev300/csv-import-preserve-options-officecfg.diff
deleted file mode 100644
index b271f27..0000000
--- a/patches/dev300/csv-import-preserve-options-officecfg.diff
+++ /dev/null
@@ -1,86 +0,0 @@
-diff --git officecfg/registry/schema/org/openoffice/Office/Calc.xcs officecfg/registry/schema/org/openoffice/Office/Calc.xcs
-index 3c3fe6b..09e5c52 100644
---- officecfg/registry/schema/org/openoffice/Office/Calc.xcs
-+++ officecfg/registry/schema/org/openoffice/Office/Calc.xcs
-@@ -1019,6 +1019,81 @@
- <value>NULL</value>
- </prop>
- </group>
-+ <group oor:name="Dialogs">
-+ <info>
-+ <desc>Contains the dialogs settings.</desc>
-+ </info>
-+ <group oor:name="CSVImport">
-+ <info>
-+ <desc>Contains setting for Text CSV Import</desc>
-+ </info>
-+ <prop oor:name="MergeDelimiters" oor:type="xs:boolean">
-+ <info>
-+ <author>muthusuba</author>
-+ <desc>Merge Delimiter check box status</desc>
-+ <label>MergeDelimiters</label>
-+ </info>
-+ <value>false</value>
-+ </prop>
-+ <prop oor:name="QuotedFieldAsText" oor:type="xs:boolean">
-+ <info>
-+ <author>kyoshida</author>
-+ <desc>If true, quoted field is always imported as text
-+ with no exception.</desc>
-+ <label>QuotedFieldAsText</label>
-+ </info>
-+ <value>true</value>
-+ </prop>
-+ <prop oor:name="Separators" oor:type="xs:string">
-+ <info>
-+ <author>muthusuba</author>
-+ <desc>List of Separators - as a String</desc>
-+ <label>Separators</label>
-+ </info>
-+ <value>; </value>
-+ </prop>
-+ <prop oor:name="TextSeparators" oor:type="xs:string">
-+ <info>
-+ <author>muthusuba</author>
-+ <desc>Text Separators</desc>
-+ <label>TextSeparators</label>
-+ </info>
-+ <value>"</value>
-+ </prop>
-+ <prop oor:name="FixedWidth" oor:type="xs:boolean">
-+ <info>
-+ <author>muthusuba</author>
-+ <desc>Fixed width</desc>
-+ <label>FixedWidth</label>
-+ </info>
-+ <value>false</value>
-+ </prop>
-+ <prop oor:name="FromRow" oor:type="xs:int">
-+ <info>
-+ <author>muthusuba</author>
-+ <desc>From Row</desc>
-+ <label>FromRow</label>
-+ </info>
-+ <value>1</value>
-+ </prop>
-+ <prop oor:name="CharSet" oor:type="xs:int">
-+ <info>
-+ <author>muthusuba</author>
-+ <desc>Char Set</desc>
-+ <label>CharSet</label>
-+ </info>
-+ <value>-1</value>
-+ </prop>
-+ <prop oor:name="FixedWidthList" oor:type="xs:string">
-+ <info>
-+ <author>muthusuba</author>
-+ <desc>Fixed Width List of separators</desc>
-+ <label>FixedWidthList</label>
-+ </info>
-+ <value></value>
-+ </prop>
-+ </group>
-+ </group>
- <group oor:name="Calculate">
- <info>
- <desc>Contains settings that affect cell calculation.</desc>
diff --git a/patches/dev300/csv-import-preserve-options-sc.diff b/patches/dev300/csv-import-preserve-options-sc.diff
deleted file mode 100644
index 0570991..0000000
--- a/patches/dev300/csv-import-preserve-options-sc.diff
+++ /dev/null
@@ -1,647 +0,0 @@
-diff --git sc/source/ui/dbgui/asciiopt.cxx sc/source/ui/dbgui/asciiopt.cxx
-index bf6521e..df25128 100644
---- sc/source/ui/dbgui/asciiopt.cxx
-+++ sc/source/ui/dbgui/asciiopt.cxx
-@@ -56,6 +56,7 @@ ScAsciiOptions::ScAsciiOptions() :
- bFixedLen ( FALSE ),
- aFieldSeps ( ';' ),
- bMergeFieldSeps ( FALSE ),
-+ bQuotedFieldAsText(false),
- cTextSep ( cDefaultTextSep ),
- eCharSet ( gsl_getSystemTextEncoding() ),
- bCharSetSystem ( FALSE ),
-@@ -71,6 +72,7 @@ ScAsciiOptions::ScAsciiOptions(const ScAsciiOptions& rOpt) :
- bFixedLen ( rOpt.bFixedLen ),
- aFieldSeps ( rOpt.aFieldSeps ),
- bMergeFieldSeps ( rOpt.bMergeFieldSeps ),
-+ bQuotedFieldAsText(rOpt.bQuotedFieldAsText),
- cTextSep ( rOpt.cTextSep ),
- eCharSet ( rOpt.eCharSet ),
- bCharSetSystem ( rOpt.bCharSetSystem ),
-@@ -155,6 +157,7 @@ ScAsciiOptions& ScAsciiOptions::operator=( const ScAsciiOptions& rCpy )
- bFixedLen = rCpy.bFixedLen;
- aFieldSeps = rCpy.aFieldSeps;
- bMergeFieldSeps = rCpy.bMergeFieldSeps;
-+ bQuotedFieldAsText = rCpy.bQuotedFieldAsText;
- cTextSep = rCpy.cTextSep;
- eCharSet = rCpy.eCharSet;
- bCharSetSystem = rCpy.bCharSetSystem;
-@@ -169,6 +172,7 @@ BOOL ScAsciiOptions::operator==( const ScAsciiOptions& rCmp ) const
- if ( bFixedLen == rCmp.bFixedLen &&
- aFieldSeps == rCmp.aFieldSeps &&
- bMergeFieldSeps == rCmp.bMergeFieldSeps &&
-+ bQuotedFieldAsText == rCmp.bQuotedFieldAsText &&
- cTextSep == rCmp.cTextSep &&
- eCharSet == rCmp.eCharSet &&
- bCharSetSystem == rCmp.bCharSetSystem &&
-@@ -286,6 +290,13 @@ void ScAsciiOptions::ReadFromString( const String& rString )
- pColFormat = NULL;
- }
- }
-+
-+ // Import quoted field as text.
-+ if (nCount >= 6)
-+ {
-+ aToken = rString.GetToken(5, ',');
-+ bQuotedFieldAsText = aToken.EqualsAscii("true") ? true : false;
-+ }
- }
-
-
-@@ -357,6 +368,11 @@ String ScAsciiOptions::WriteToString() const
- aOutStr += String::CreateFromInt32(pColFormat[nInfo]);
- }
-
-+ aOutStr += ',';
-+
-+ // Import quoted field as text.
-+ aOutStr += String::CreateFromAscii(bQuotedFieldAsText ? "true" : "false");
-+
- return aOutStr;
- }
-
-diff --git sc/source/ui/dbgui/asciiopt.hrc sc/source/ui/dbgui/asciiopt.hrc
-index 2dcfe00..60c8500 100644
---- sc/source/ui/dbgui/asciiopt.hrc
-+++ sc/source/ui/dbgui/asciiopt.hrc
-@@ -56,4 +56,5 @@
- #define FT_AT_ROW 59
- #define NF_AT_ROW 60
- #define CB_ASONCE 90
-+#define CB_QUOTED_AS_TEXT 91
- #define STR_TEXTTOCOLUMNS 100
-diff --git sc/source/ui/dbgui/asciiopt.src sc/source/ui/dbgui/asciiopt.src
-index e6cc493..da10a39 100644
---- sc/source/ui/dbgui/asciiopt.src
-+++ sc/source/ui/dbgui/asciiopt.src
-@@ -34,24 +34,24 @@ ModalDialog RID_SCDLG_ASCII
- {
- OutputSize = TRUE ;
- SVLook = TRUE ;
-- Size = MAP_APPFONT ( 320 , 247 ) ;
-+ Size = MAP_APPFONT ( 320 , 264 ) ;
- Text [ en-US ] = "Text Import" ;
- Moveable = TRUE ;
- FixedLine FL_WIDTH
- {
-- Pos = MAP_APPFONT ( 6 , 132 ) ;
-+ Pos = MAP_APPFONT ( 6 , 147 ) ;
- Size = MAP_APPFONT ( 252 , 8 ) ;
- Text [ en-US ] = "Fields" ;
- };
- FixedText FT_TYPE
- {
-- Pos = MAP_APPFONT ( 12 , 145 ) ;
-+ Pos = MAP_APPFONT ( 12 , 160 ) ;
- Size = MAP_APPFONT ( 60 , 8 ) ;
- Text [ en-US ] = "Column t~ype";
- };
- ListBox LB_TYPE1
- {
-- Pos = MAP_APPFONT ( 76 , 143 ) ;
-+ Pos = MAP_APPFONT ( 76 , 158 ) ;
- Size = MAP_APPFONT ( 60 , 68 ) ;
- TabStop = TRUE ;
- DropDown = TRUE ;
-@@ -194,7 +194,7 @@ ModalDialog RID_SCDLG_ASCII
- HelpId = HID_SC_ASCII_TABCTR ;
- Border = TRUE ;
- DialogControl = TRUE ;
-- Pos = MAP_APPFONT ( 12 , 159 ) ;
-+ Pos = MAP_APPFONT ( 12 , 176 ) ;
- Size = MAP_APPFONT ( 243 , 82 ) ;
- };
- CheckBox CB_ASONCE
-@@ -204,6 +204,13 @@ ModalDialog RID_SCDLG_ASCII
- TabStop = TRUE ;
- Text [ en-US ] = "Merge ~delimiters" ;
- };
-+ CheckBox CB_QUOTED_AS_TEXT
-+ {
-+ Pos = MAP_APPFONT ( 20 , 129 ) ;
-+ Size = MAP_APPFONT ( 130 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "~Quoted field as text" ;
-+ };
- String STR_TEXTTOCOLUMNS
- {
- Text [ en-US ] = "Text to Columns" ;
-diff --git sc/source/ui/dbgui/csvgrid.cxx sc/source/ui/dbgui/csvgrid.cxx
-index ddbfb44..5725645 100644
---- sc/source/ui/dbgui/csvgrid.cxx
-+++ sc/source/ui/dbgui/csvgrid.cxx
-@@ -737,7 +737,8 @@ void ScCsvGrid::ImplSetTextLineSep(
- while( *pChar && (nColIx < sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT)) )
- {
- // scan for next cell text
-- pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep );
-+ bool bIsQuoted = false;
-+ pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep, bIsQuoted );
-
- // update column width
- sal_Int32 nWidth = Max( CSV_MINCOLWIDTH, aCellText.Len() + sal_Int32( 1 ) );
-diff --git sc/source/ui/dbgui/csvruler.cxx sc/source/ui/dbgui/csvruler.cxx
-index 5437f9b..b42ebaf 100644
---- sc/source/ui/dbgui/csvruler.cxx
-+++ sc/source/ui/dbgui/csvruler.cxx
-@@ -37,8 +37,76 @@
- #include "AccessibleCsvControl.hxx"
-
-
-+#include <optutil.hxx>
-+#include <com/sun/star/uno/Any.hxx>
-+#include <com/sun/star/uno/Sequence.hxx>
-+#include "miscuno.hxx"
-+
-+using namespace rtl;
-+using namespace com::sun::star::uno;
-+
-+
-+
-+// ============================================================================
-+#define SEP_PATH "Office.Calc/Dialogs/CSVImport"
-+#define FIXED_WIDTH_LIST "FixedWidthList"
-+
-+
- // ============================================================================
-
-+static void load_FixedWidthList(ScCsvSplits &aSplits)
-+{
-+ String sSplits;
-+ OUString sFixedWidthLists;
-+
-+ Sequence<Any>aValues;
-+ const Any *pProperties;
-+ Sequence<OUString> aNames(1);
-+ OUString* pNames = aNames.getArray();
-+ ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
-+
-+ pNames[0] = OUString::createFromAscii( FIXED_WIDTH_LIST );
-+ aValues = aItem.GetProperties( aNames );
-+ pProperties = aValues.getConstArray();
-+
-+ if( pProperties[0].hasValue() )
-+ {
-+ aSplits.Clear();
-+ pProperties[0] >>= sFixedWidthLists;
-+
-+ sSplits = String( sFixedWidthLists );
-+
-+ // String ends with a semi-colon so there is no 'int' after the last one.
-+ for(int i=0;i<sSplits.GetTokenCount()-1;i++ )
-+ aSplits.Insert( sSplits.GetToken(i).ToInt32() );
-+ }
-+}
-+static void save_FixedWidthList(ScCsvSplits aSplits)
-+{
-+ String sSplits;
-+ // Create a semi-colon separated string to save the splits
-+ sal_uInt32 n = aSplits.Count();
-+ for (sal_uInt32 i = 0; i < n; ++i)
-+ {
-+ sSplits.Append( String::CreateFromInt32( aSplits[i] ) );
-+ sSplits.Append((char)';');
-+ }
-+
-+ OUString sFixedWidthLists = OUString( sSplits );
-+ Sequence<Any> aValues;
-+ Any *pProperties;
-+ Sequence<OUString> aNames(1);
-+ OUString* pNames = aNames.getArray();
-+ ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
-+
-+ pNames[0] = OUString::createFromAscii( FIXED_WIDTH_LIST );
-+ aValues = aItem.GetProperties( aNames );
-+ pProperties = aValues.getArray();
-+ pProperties[0] <<= sFixedWidthLists;
-+
-+ aItem.PutProperties(aNames, aValues);
-+}
-+
- ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) :
- ScCsvControl( rParent ),
- mnPosCursorLast( 1 )
-@@ -48,6 +116,13 @@ ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) :
- InitSizeData();
- maBackgrDev.SetFont( GetFont() );
- maRulerDev.SetFont( GetFont() );
-+
-+ load_FixedWidthList( maSplits );
-+}
-+
-+ScCsvRuler::~ScCsvRuler()
-+{
-+ save_FixedWidthList( maSplits );
- }
-
-
-diff --git sc/source/ui/dbgui/scuiasciiopt.cxx sc/source/ui/dbgui/scuiasciiopt.cxx
-index 2c31e08..a10e8fb 100644
---- sc/source/ui/dbgui/scuiasciiopt.cxx
-+++ sc/source/ui/dbgui/scuiasciiopt.cxx
-@@ -44,6 +44,12 @@
- // ause
- #include "editutil.hxx"
-
-+#include <optutil.hxx>
-+#include <com/sun/star/uno/Any.hxx>
-+#include <com/sun/star/uno/Sequence.hxx>
-+#include "miscuno.hxx"
-+
-+
- //! TODO make dynamic
- #ifdef WIN
- const SCSIZE ASCIIDLG_MAXROWS = 10000;
-@@ -51,6 +57,20 @@ const SCSIZE ASCIIDLG_MAXROWS = 10000;
- const SCSIZE ASCIIDLG_MAXROWS = MAXROWCOUNT;
- #endif
-
-+
-+using namespace rtl;
-+using namespace com::sun::star::uno;
-+
-+// Defines - CSV Import Preserve Options
-+#define FIXED_WIDTH "FixedWidth"
-+#define FROM_ROW "FromRow"
-+#define CHAR_SET "CharSet"
-+#define SEPARATORS "Separators"
-+#define TEXT_SEPARATORS "TextSeparators"
-+#define MERGE_DELIMITERS "MergeDelimiters"
-+#define QUOTED_AS_TEXT "QuotedFieldAsText"
-+#define SEP_PATH "Office.Calc/Dialogs/CSVImport"
-+
- // ============================================================================
-
- void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect )
-@@ -98,11 +118,82 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList )
- return c;
- }
-
-+static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators,
-+ bool &bMergeDelimiters, bool& bQuotedAsText, bool &bFixedWidth,
-+ sal_Int32 &nFromRow, sal_Int32 &nCharSet )
-+{
-+ Sequence<Any>aValues;
-+ const Any *pProperties;
-+ Sequence<OUString> aNames(7);
-+ OUString* pNames = aNames.getArray();
-+ ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
-+
-+ pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
-+ pNames[1] = OUString::createFromAscii( SEPARATORS );
-+ pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
-+ pNames[3] = OUString::createFromAscii( FIXED_WIDTH );
-+ pNames[4] = OUString::createFromAscii( FROM_ROW );
-+ pNames[5] = OUString::createFromAscii( CHAR_SET );
-+ pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT );
-+ aValues = aItem.GetProperties( aNames );
-+ pProperties = aValues.getConstArray();
-+ if( pProperties[1].hasValue() )
-+ pProperties[1] >>= sFieldSeparators;
-+
-+ if( pProperties[2].hasValue() )
-+ pProperties[2] >>= sTextSeparators;
-+
-+ if( pProperties[0].hasValue() )
-+ bMergeDelimiters = ScUnoHelpFunctions::GetBoolFromAny( pProperties[0] );
-+
-+ if( pProperties[3].hasValue() )
-+ bFixedWidth = ScUnoHelpFunctions::GetBoolFromAny( pProperties[3] );
-+
-+ if( pProperties[4].hasValue() )
-+ pProperties[4] >>= nFromRow;
-+
-+ if( pProperties[5].hasValue() )
-+ pProperties[5] >>= nCharSet;
-+
-+ if ( pProperties[6].hasValue() )
-+ pProperties[6] >>= bQuotedAsText;
-+}
-+
-+static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDelimiters, bool bQuotedAsText,
-+ bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet )
-+{
-+ OUString sFieldSeparators = OUString( maSeparators );
-+ OUString sTextSeparators = OUString( maTxtSep );
-+ Sequence<Any> aValues;
-+ Any *pProperties;
-+ Sequence<OUString> aNames(7);
-+ OUString* pNames = aNames.getArray();
-+ ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
-+
-+ pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
-+ pNames[1] = OUString::createFromAscii( SEPARATORS );
-+ pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
-+ pNames[3] = OUString::createFromAscii( FIXED_WIDTH );
-+ pNames[4] = OUString::createFromAscii( FROM_ROW );
-+ pNames[5] = OUString::createFromAscii( CHAR_SET );
-+ pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT );
-+ aValues = aItem.GetProperties( aNames );
-+ pProperties = aValues.getArray();
-+ pProperties[1] <<= sFieldSeparators;
-+ pProperties[2] <<= sTextSeparators;
-+ ScUnoHelpFunctions::SetBoolInAny( pProperties[0], bMergeDelimiters );
-+ ScUnoHelpFunctions::SetBoolInAny( pProperties[3], bFixedWidth );
-+ pProperties[4] <<= nFromRow;
-+ pProperties[5] <<= nCharSet;
-+ pProperties[6] <<= static_cast<sal_Bool>(bQuotedAsText);
-+
-+ aItem.PutProperties(aNames, aValues);
-+}
-
- // ----------------------------------------------------------------------------
-
- ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
-- SvStream* pInStream, sal_Unicode cSep ) :
-+ SvStream* pInStream, sal_Unicode /*cSep*/ ) :
- ModalDialog ( pParent, ScResId( RID_SCDLG_ASCII ) ),
- mpDatStream ( pInStream ),
- mnStreamPos( pInStream ? pInStream->Tell() : 0 ),
-@@ -128,6 +215,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
- aCkbOther ( this, ScResId( CKB_OTHER ) ),
- aEdOther ( this, ScResId( ED_OTHER ) ),
- aCkbAsOnce ( this, ScResId( CB_ASONCE) ),
-+ aCkbQuotedAsText( this, ScResId(CB_QUOTED_AS_TEXT) ),
- aFtTextSep ( this, ScResId( FT_TEXTSEP ) ),
- aCbTextSep ( this, ScResId( CB_TEXTSEP ) ),
-
-@@ -146,14 +234,15 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
- aFldSepList ( ScResId( SCSTR_FIELDSEP ) ),
- aTextSepList( ScResId( SCSTR_TEXTSEP ) ),
- mcTextSep ( ScAsciiOptions::cDefaultTextSep ),
-- maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) )
-+ maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) ),
-+ mbFileImport(true)
- {
- FreeResource();
-+ mbFileImport = aDatName.Len() > 0;
-
- String aName = GetText();
- // aDatName is empty if invoked during paste from clipboard.
-- BOOL bClipboard = (aDatName.Len() == 0);
-- if (!bClipboard)
-+ if (mbFileImport)
- {
- aName.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" - ["));
- aName += aDatName;
-@@ -161,20 +250,51 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
- }
- SetText( aName );
-
-- switch(cSep)
-+
-+ OUString sFieldSeparators;
-+ OUString sTextSeparators;
-+ bool bMergeDelimiters = false;
-+ bool bFixedWidth = false;
-+ bool bQuotedFieldAsText = true;
-+ sal_Int32 nFromRow = 1;
-+ sal_Int32 nCharSet = -1;
-+ if (mbFileImport)
-+ // load separators only when importing csv files.
-+ load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters,
-+ bQuotedFieldAsText, bFixedWidth, nFromRow, nCharSet);
-+ maFieldSeparators = String(sFieldSeparators);
-+
-+ if( bMergeDelimiters )
-+ aCkbAsOnce.Check();
-+ if (bQuotedFieldAsText)
-+ aCkbQuotedAsText.Check();
-+ if( bFixedWidth )
-+ aRbFixed.Check();
-+ if( nFromRow != 1 )
-+ aNfRow.SetValue( nFromRow );
-+
-+ ByteString bString(maFieldSeparators,RTL_TEXTENCODING_MS_1252);
-+ const sal_Char *aSep = bString.GetBuffer();
-+ int len = maFieldSeparators.Len();
-+ for (int i = 0; i < len; ++i)
- {
-- case '\t': aCkbTab.Check(); break;
-- case ';': aCkbSemicolon.Check(); break;
-- case ',': aCkbComma.Check(); break;
-- case ' ': aCkbSpace.Check(); break;
-- default:
-- aCkbOther.Check();
-- aEdOther.SetText( cSep );
-+ switch( aSep[i] )
-+ {
-+ case '\t': aCkbTab.Check(); break;
-+ case ';': aCkbSemicolon.Check(); break;
-+ case ',': aCkbComma.Check(); break;
-+ case ' ': aCkbSpace.Check(); break;
-+ default:
-+ aCkbOther.Check();
-+ aEdOther.SetText( aEdOther.GetText() + OUString( aSep[i] ) );
-+ }
- }
-+
-+ // Get Separators from the dialog
- maFieldSeparators = GetSeparators();
-
- // Clipboard is always Unicode, else detect.
-- BOOL bPreselectUnicode = bClipboard;
-+ bool bPreselectUnicode = !mbFileImport;
- // Sniff for Unicode / not
- if( !bPreselectUnicode && mpDatStream )
- {
-@@ -210,6 +330,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
-
- // *** Separator characters ***
- lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep );
-+ aCbTextSep.SetText( sTextSeparators );
-
- Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl );
- aCbTextSep.SetSelectHdl( aSeparatorHdl );
-@@ -218,6 +339,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
- aCkbSemicolon.SetClickHdl( aSeparatorHdl );
- aCkbComma.SetClickHdl( aSeparatorHdl );
- aCkbAsOnce.SetClickHdl( aSeparatorHdl );
-+ aCkbQuotedAsText.SetClickHdl( aSeparatorHdl );
- aCkbSpace.SetClickHdl( aSeparatorHdl );
- aCkbOther.SetClickHdl( aSeparatorHdl );
- aEdOther.SetModifyHdl( aSeparatorHdl );
-@@ -230,6 +352,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
- aLbCharSet.InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, aCharSetUser );
- aLbCharSet.SelectTextEncoding( bPreselectUnicode ?
- RTL_TEXTENCODING_UNICODE : gsl_getSystemTextEncoding() );
-+
-+ if( nCharSet >= 0 )
-+ aLbCharSet.SelectEntryPos( nCharSet );
-+
- SetSelectedCharSet();
- aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) );
-
-@@ -261,6 +387,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
-
- ScImportAsciiDlg::~ScImportAsciiDlg()
- {
-+ if (mbFileImport)
-+ save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(),
-+ aCkbQuotedAsText.IsChecked(), aRbFixed.IsChecked(),
-+ aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos());
- delete[] mpRowPosArray;
- }
-
-@@ -346,6 +476,7 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
- {
- rOpt.SetFieldSeps( GetSeparators() );
- rOpt.SetMergeSeps( aCkbAsOnce.IsChecked() );
-+ rOpt.SetQuotedAsText(aCkbQuotedAsText.IsChecked());
- rOpt.SetTextSep( lcl_CharFromCombo( aCbTextSep, aTextSepList ) );
- }
- }
-@@ -357,6 +488,10 @@ void ScImportAsciiDlg::SetTextToColumnsMode()
- aLbCharSet.Disable();
- aFtRow.Disable();
- aNfRow.Disable();
-+
-+ // Quoted field as text option is not used for text to columns mode.
-+ aCkbQuotedAsText.Check(false);
-+ aCkbQuotedAsText.Disable();
- }
-
- void ScImportAsciiDlg::SetSelectedCharSet()
-@@ -393,6 +528,7 @@ void ScImportAsciiDlg::SetupSeparatorCtrls()
- aCkbOther.Enable( bEnable );
- aEdOther.Enable( bEnable );
- aCkbAsOnce.Enable( bEnable );
-+ aCkbQuotedAsText.Enable( bEnable );
- aFtTextSep.Enable( bEnable );
- aCbTextSep.Enable( bEnable );
- }
-diff --git sc/source/ui/docshell/impex.cxx sc/source/ui/docshell/impex.cxx
-index 344dcae..d2cb0cd 100644
---- sc/source/ui/docshell/impex.cxx
-+++ sc/source/ui/docshell/impex.cxx
-@@ -792,12 +792,10 @@ BOOL ScImportExport::Text2Doc( SvStream& rStrm )
- //
-
-
--bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
-- const String& rStr, BYTE nColFormat,
-- ::utl::TransliterationWrapper& rTransliteration,
-- CalendarWrapper& rCalendar,
-- ::utl::TransliterationWrapper* pSecondTransliteration,
-- CalendarWrapper* pSecondCalendar )
-+static bool lcl_PutString(
-+ ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rStr, BYTE nColFormat,
-+ ::utl::TransliterationWrapper& rTransliteration, CalendarWrapper& rCalendar,
-+ ::utl::TransliterationWrapper* pSecondTransliteration, CalendarWrapper* pSecondCalendar )
- {
- bool bMultiLine = false;
- if ( nColFormat == SC_COL_SKIP || !rStr.Len() || !ValidCol(nCol) || !ValidRow(nRow) )
-@@ -1168,7 +1166,8 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
- // SC_COL_SKIP.
- while (*p && nCol <= MAXCOL+1)
- {
-- p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge );
-+ bool bIsQuoted = false;
-+ p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge, bIsQuoted );
-
- BYTE nFmt = SC_COL_STANDARD;
- for ( i=nInfoStart; i<nInfoCount; i++ )
-@@ -1185,10 +1184,15 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
- if (nCol > MAXCOL)
- bOverflow = TRUE; // display warning on import
- else if (!bDetermineRange)
-+ {
-+ if (bIsQuoted && pExtOptions && pExtOptions->IsQuotedAsText())
-+ nFmt = SC_COL_TEXT;
-+
- bMultiLine |= lcl_PutString( pDoc, nCol, nRow,
- nTab, aCell, nFmt, aTransliteration,
- aCalendar, pEnglishTransliteration,
- pEnglishCalendar);
-+ }
- ++nCol;
- }
-
-@@ -1262,11 +1266,13 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm )
-
- // static
- const sal_Unicode* ScImportExport::ScanNextFieldFromString( const sal_Unicode* p,
-- String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps )
-+ String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted )
- {
-+ rbIsQuoted = false;
- rField.Erase();
- if ( *p == cStr ) // String in Anfuehrungszeichen
- {
-+ rbIsQuoted = true;
- const sal_Unicode* p1;
- p1 = p = lcl_ScanString( p, rField, cStr, DQM_ESCAPE );
- while ( *p && !ScGlobal::UnicodeStrChr( pSeps, *p ) )
-diff --git sc/source/ui/inc/asciiopt.hxx sc/source/ui/inc/asciiopt.hxx
-index 1d12606..394f2dc 100644
---- sc/source/ui/inc/asciiopt.hxx
-+++ sc/source/ui/inc/asciiopt.hxx
-@@ -65,6 +65,7 @@ private:
- BOOL bFixedLen;
- String aFieldSeps;
- BOOL bMergeFieldSeps;
-+ bool bQuotedFieldAsText;
- sal_Unicode cTextSep;
- CharSet eCharSet;
- BOOL bCharSetSystem;
-@@ -93,6 +94,7 @@ public:
- BOOL GetCharSetSystem() const { return bCharSetSystem; }
- const String& GetFieldSeps() const { return aFieldSeps; }
- BOOL IsMergeSeps() const { return bMergeFieldSeps; }
-+ bool IsQuotedAsText() const { return bQuotedFieldAsText; }
- sal_Unicode GetTextSep() const { return cTextSep; }
- BOOL IsFixedLen() const { return bFixedLen; }
- USHORT GetInfoCount() const { return nInfoCount; }
-@@ -105,6 +107,7 @@ public:
- void SetFixedLen( BOOL bSet ) { bFixedLen = bSet; }
- void SetFieldSeps( const String& rStr ) { aFieldSeps = rStr; }
- void SetMergeSeps( BOOL bSet ) { bMergeFieldSeps = bSet; }
-+ void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; }
- void SetTextSep( sal_Unicode c ) { cTextSep = c; }
- void SetStartRow( long nRow) { nStartRow= nRow; }
-
-diff --git sc/source/ui/inc/csvruler.hxx sc/source/ui/inc/csvruler.hxx
-index c251831..cd67708 100644
---- sc/source/ui/inc/csvruler.hxx
-+++ sc/source/ui/inc/csvruler.hxx
-@@ -71,6 +71,7 @@ private:
- // ------------------------------------------------------------------------
- public:
- explicit ScCsvRuler( ScCsvControl& rParent );
-+ ~ScCsvRuler();
-
- // common ruler handling --------------------------------------------------
- public:
-diff --git sc/source/ui/inc/impex.hxx sc/source/ui/inc/impex.hxx
-index 515063a..aaddeeb 100644
---- sc/source/ui/inc/impex.hxx
-+++ sc/source/ui/inc/impex.hxx
-@@ -98,7 +98,7 @@ public:
-
- static BOOL IsFormatSupported( ULONG nFormat );
- static const sal_Unicode* ScanNextFieldFromString( const sal_Unicode* p,
-- String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps );
-+ String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted );
- static void WriteUnicodeOrByteString( SvStream& rStrm, const String& rString, BOOL bZero = FALSE );
- static void WriteUnicodeOrByteEndl( SvStream& rStrm );
- static inline BOOL IsEndianSwap( const SvStream& rStrm );
-diff --git sc/source/ui/inc/scuiasciiopt.hxx sc/source/ui/inc/scuiasciiopt.hxx
-index 6712193..45c3e71 100644
---- sc/source/ui/inc/scuiasciiopt.hxx
-+++ sc/source/ui/inc/scuiasciiopt.hxx
-@@ -64,6 +64,7 @@ class ScImportAsciiDlg : public ModalDialog
- CheckBox aCkbOther;
- Edit aEdOther;
- CheckBox aCkbAsOnce;
-+ CheckBox aCkbQuotedAsText;
- FixedText aFtTextSep;
- ComboBox aCbTextSep;
-
-@@ -87,6 +88,7 @@ class ScImportAsciiDlg : public ModalDialog
-
- CharSet meCharSet; /// Selected char set.
- bool mbCharSetSystem; /// Is System char set selected?
-+ bool mbFileImport; /// Is this dialog involked for csv file import ?
-
- public:
- ScImportAsciiDlg(
diff --git a/patches/dev300/cws-koheimultirangecopy-sc.diff b/patches/dev300/cws-koheimultirangecopy-sc.diff
deleted file mode 100644
index 948ec4c..0000000
--- a/patches/dev300/cws-koheimultirangecopy-sc.diff
+++ /dev/null
@@ -1,2667 +0,0 @@
-diff --git sc/inc/cell.hxx sc/inc/cell.hxx
-index 96a32ab..cbc66c9 100644
---- sc/inc/cell.hxx
-+++ sc/inc/cell.hxx
-@@ -37,6 +37,7 @@
- #include <tools/mempool.hxx>
- #include <svtools/listener.hxx>
- #include "global.hxx"
-+#include "rangenam.hxx"
- #include "formula/grammar.hxx"
- #include "tokenarray.hxx"
- #include "formularesult.hxx"
-@@ -289,8 +290,6 @@ enum ScMatrixMode {
- MM_FAKE = 3 // Interpret "as-if" matrix formula (legacy)
- };
-
--class ScIndexMap;
--
- class SC_DLLPUBLIC ScFormulaCell : public ScBaseCell, public SvtListener
- {
- private:
-@@ -413,7 +412,7 @@ public:
- void UpdateCompile( BOOL bForceIfNameInUse = FALSE );
- BOOL IsRangeNameInUse(USHORT nIndex) const;
- void FindRangeNamesInUse(std::set<USHORT>& rIndexes) const;
-- void ReplaceRangeNamesInUse( const ScIndexMap& rMap );
-+ void ReplaceRangeNamesInUse( const ScRangeData::IndexMap& rMap );
- BOOL IsSubTotal() const { return bSubTotal; }
- BOOL IsChanged() const { return bChanged; }
- void ResetChanged() { bChanged = FALSE; }
-diff --git sc/inc/clipparam.hxx sc/inc/clipparam.hxx
-new file mode 100644
-index 0000000..544cef3
---- /dev/null
-+++ sc/inc/clipparam.hxx
-@@ -0,0 +1,91 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: document.hxx,v $
-+ * $Revision: 1.115.36.9 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org. If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_CLIPPARAM_HXX
-+#define SC_CLIPPARAM_HXX
-+
-+#include "rangelst.hxx"
-+#include "rangenam.hxx"
-+
-+#include <vector>
-+
-+/**
-+ * This struct stores general clipboard parameters associated with a
-+ * ScDocument instance created in clipboard mode.
-+ */
-+struct ScClipParam
-+{
-+ enum Direction { Unspecified, Column, Row };
-+
-+ ScRangeList maRanges;
-+ Direction meDirection;
-+ bool mbCutMode;
-+
-+ ScClipParam();
-+ ScClipParam(const ScRange& rRange, bool bCutMode);
-+ explicit ScClipParam(const ScClipParam& r);
-+
-+ bool isMultiRange() const;
-+
-+ /**
-+ * Get the column size of a pasted range. Note that when the range is
-+ * non-contiguous, we first compress all individual ranges into a single
-+ * range, and the size of that compressed range is returned.
-+ */
-+ SCCOL getPasteColSize();
-+
-+ /**
-+ * Same as the above method, but returns the row size of the compressed
-+ * range.
-+ */
-+ SCROW getPasteRowSize();
-+
-+ /**
-+ * Return a single range that encompasses all individual ranges.
-+ */
-+ ScRange getWholeRange() const;
-+
-+ void transpose();
-+};
-+
-+// ============================================================================
-+
-+struct ScClipRangeNameData
-+{
-+ ScRangeData::IndexMap maRangeMap;
-+ ::std::vector<ScRangeData*> mpRangeNames;
-+ bool mbReplace;
-+
-+ ScClipRangeNameData();
-+ ~ScClipRangeNameData();
-+ void insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex);
-+};
-+
-+#endif
-diff --git sc/inc/column.hxx sc/inc/column.hxx
-index fd2473b..10b303d 100644
---- sc/inc/column.hxx
-+++ sc/inc/column.hxx
-@@ -35,6 +35,7 @@
- #include "global.hxx"
- #include "compressedarray.hxx"
- #include "address.hxx"
-+#include "rangenam.hxx"
- #include <tools/solar.h>
-
- #include <set>
-@@ -97,8 +98,6 @@ struct ColEntry
- };
-
-
--class ScIndexMap;
--
- class ScColumn
- {
- private:
-@@ -297,7 +296,7 @@ public:
- void SetTabNo(SCTAB nNewTab);
- BOOL IsRangeNameInUse(SCROW nRow1, SCROW nRow2, USHORT nIndex) const;
- void FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<USHORT>& rIndexes) const;
-- void ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScIndexMap& rMap );
-+ void ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScRangeData::IndexMap& rMap );
-
- const SfxPoolItem* GetAttr( SCROW nRow, USHORT nWhich ) const;
- const ScPatternAttr* GetPattern( SCROW nRow ) const;
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index b238b46..86561eb 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -136,6 +136,8 @@ class ScLookupCache;
- struct ScLookupCacheMapImpl;
- class SfxUndoManager;
- class ScFormulaParserPool;
-+struct ScClipParam;
-+struct ScClipRangeNameData;
-
- namespace com { namespace sun { namespace star {
- namespace lang {
-@@ -280,6 +282,7 @@ private:
- ScFieldEditEngine* pCacheFieldEditEngine;
-
- ::std::auto_ptr<ScDocProtection> pDocProtection;
-+ ::std::auto_ptr<ScClipParam> mpClipParam;
-
- ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
-
-@@ -306,7 +309,6 @@ private:
-
- sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings
-
-- ScRange aClipRange;
- ScRange aEmbedRange;
- ScAddress aCurTextWidthCalcPos;
- ScAddress aOnlineSpellPos; // within whole document
-@@ -356,7 +358,6 @@ private:
- BOOL bForcedFormulaPending;
- BOOL bCalculatingFormulaTree;
- BOOL bIsClip;
-- BOOL bCutMode;
- BOOL bIsUndo;
- BOOL bIsVisible; // set from view ctor
-
-@@ -957,12 +958,11 @@ public:
- void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- SCTAB nTab, USHORT nDelFlag);
- void DeleteAreaTab(const ScRange& rRange, USHORT nDelFlag);
-- void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
-- BOOL bCut, ScDocument* pClipDoc, BOOL bAllTabs,
-- const ScMarkData* pMarks = NULL,
-- BOOL bKeepScenarioFlags = FALSE,
-- BOOL bIncludeObjects = FALSE,
-- BOOL bCloneNoteCaptions = TRUE);
-+
-+ void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc,
-+ const ScMarkData* pMarks = NULL, bool bAllTabs = false, bool bKeepScenarioFlags = false,
-+ bool bIncludeObjects = false, bool bCloneNoteCaptions = true);
-+
- 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,
-@@ -990,6 +990,12 @@ public:
- BOOL bSkipAttrForEmpty = FALSE,
- const ScRangeList * pDestRanges = NULL );
-
-+ void CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark,
-+ sal_uInt16 nInsFlag, ScDocument* pClipDoc,
-+ bool bResetCut = true, bool bAsLink = false,
-+ bool bIncludeFiltered = true,
-+ bool bSkipAttrForEmpty = false);
-+
- void GetClipArea(SCCOL& nClipX, SCROW& nClipY, BOOL bIncludeFiltered);
- void GetClipStart(SCCOL& nClipX, SCROW& nClipY);
-
-@@ -999,6 +1005,9 @@ public:
-
- SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsLink );
-
-+ ScClipParam& GetClipParam();
-+ void SetClipParam(const ScClipParam& rParam);
-+
- void MixDocument( const ScRange& rRange, USHORT nFunction, BOOL bSkipEmpty,
- ScDocument* pSrcDoc );
-
-@@ -1696,6 +1705,23 @@ public:
- SfxUndoManager* GetUndoManager();
- private: // CLOOK-Impl-Methoden
-
-+ /**
-+ * Use this class as a locale variable to merge number formatter from
-+ * another document, and set NULL pointer to pFormatExchangeList when
-+ * done.
-+ */
-+ class NumFmtMergeHandler
-+ {
-+ public:
-+ explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc);
-+ ~NumFmtMergeHandler();
-+
-+ private:
-+ ScDocument* mpDoc;
-+ };
-+
-+ void MergeNumberFormatter(ScDocument* pSrcDoc);
-+
- void ImplCreateOptions(); // bei Gelegenheit auf on-demand umstellen?
- void ImplDeleteOptions();
-
-@@ -1717,6 +1743,12 @@ private: // CLOOK-Impl-Methoden
- void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
- const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
-
-+ void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs);
-+ void CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames);
-+ void UpdateRangeNamesInFormulas(
-+ ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark,
-+ SCCOL nXw, SCROW nYw);
-+
- BOOL HasPartOfMerged( const ScRange& rRange );
-
- std::map< SCTAB, ScSortParam > mSheetSortParams;
-diff --git sc/inc/indexmap.hxx sc/inc/indexmap.hxx
-index a599e6b..e69de29 100644
---- sc/inc/indexmap.hxx
-+++ sc/inc/indexmap.hxx
-@@ -1,59 +0,0 @@
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2008 by Sun Microsystems, Inc.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * $RCSfile: indexmap.hxx,v $
-- * $Revision: 1.3 $
-- *
-- * This file is part of OpenOffice.org.
-- *
-- * OpenOffice.org is free software: you can redistribute it and/or modify
-- * it under the terms of the GNU Lesser General Public License version 3
-- * only, as published by the Free Software Foundation.
-- *
-- * OpenOffice.org is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- * GNU Lesser General Public License version 3 for more details
-- * (a copy is included in the LICENSE file that accompanied this code).
-- *
-- * You should have received a copy of the GNU Lesser General Public License
-- * version 3 along with OpenOffice.org. If not, see
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--
--#ifndef _SC_INDEXMAP_HXX
--#define _SC_INDEXMAP_HXX
--
--
--#include <tools/solar.h>
--
--
--class ScIndexMap
--{
-- // not implemented
-- ScIndexMap( const ScIndexMap& );
-- ScIndexMap& operator=( const ScIndexMap& );
--
--private:
-- USHORT* pMap;
-- USHORT nCount;
--
--public:
-- ScIndexMap( USHORT nEntries );
-- ~ScIndexMap();
--
-- void SetPair( USHORT nEntry, USHORT nIndex1, USHORT nIndex2 );
-- /// returns nIndex2 if found, else nIndex1
-- USHORT Find( USHORT nIndex1 ) const;
--};
--
--
--#endif // _SC_INDEXMAP_HXX
--
-diff --git sc/inc/rangenam.hxx sc/inc/rangenam.hxx
-index 87b279f..980f593 100644
---- sc/inc/rangenam.hxx
-+++ sc/inc/rangenam.hxx
-@@ -37,6 +37,8 @@
- #include "formula/grammar.hxx"
- #include "scdllapi.h"
-
-+#include <map>
-+
- //------------------------------------------------------------------------
-
- class ScDocument;
-@@ -65,7 +67,6 @@ typedef USHORT RangeType;
- //------------------------------------------------------------------------
-
- class ScTokenArray;
--class ScIndexMap;
-
- class ScRangeData : public ScDataObject
- {
-@@ -87,6 +88,8 @@ private:
- friend class ScRangeName;
- ScRangeData( USHORT nIndex );
- public:
-+ typedef ::std::map<sal_uInt16, sal_uInt16> IndexMap;
-+
- SC_DLLPUBLIC ScRangeData( ScDocument* pDoc,
- const String& rName,
- const String& rSymbol,
-@@ -152,7 +155,7 @@ public:
-
- void ValidateTabRefs();
-
-- void ReplaceRangeNamesInUse( const ScIndexMap& rMap );
-+ void ReplaceRangeNamesInUse( const IndexMap& rMap );
-
- static void MakeValidName( String& rName );
- SC_DLLPUBLIC static BOOL IsNameValid( const String& rName, ScDocument* pDoc );
-diff --git sc/inc/table.hxx sc/inc/table.hxx
-index a33ebb9..f8ad7a8 100644
---- sc/inc/table.hxx
-+++ sc/inc/table.hxx
-@@ -71,7 +71,6 @@ class ScStyleSheet;
- class ScTableLink;
- class ScTableProtection;
- class ScUserListData;
--class ScIndexMap;
- struct RowInfo;
- struct ScFunctionData;
- struct ScLineFlags;
-@@ -318,6 +317,8 @@ public:
- void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nDelFlag);
- void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable,
- BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions);
-+ void CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
-+ bool bKeepScenarioFlags, bool bCloneNoteCaptions);
- void CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy,
- USHORT nInsFlag, BOOL bAsLink, BOOL bSkipAttrForEmpty, ScTable* pTable);
- void StartListeningInArea( SCCOL nCol1, SCROW nRow1,
-@@ -435,7 +436,7 @@ public:
- void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- std::set<USHORT>& rIndexes) const;
- void ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
-- const ScIndexMap& rMap );
-+ const ScRangeData::IndexMap& rMap );
- void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- ULONG nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
- double nStepValue, double nMaxValue);
-diff --git sc/source/core/data/cell2.cxx sc/source/core/data/cell2.cxx
-index c92676f..40d6e45 100644
---- sc/source/core/data/cell2.cxx
-+++ sc/source/core/data/cell2.cxx
-@@ -53,7 +53,6 @@
- #include "scmatrix.hxx"
- #include "editutil.hxx"
- #include "chgtrack.hxx"
--#include "indexmap.hxx"
- #include "externalrefmgr.hxx"
-
- using namespace formula;
-@@ -1480,14 +1479,15 @@ void ScFormulaCell::FindRangeNamesInUse(std::set<USHORT>& rIndexes) const
- lcl_FindRangeNamesInUse( rIndexes, pCode, pDocument->GetRangeName() );
- }
-
--void ScFormulaCell::ReplaceRangeNamesInUse( const ScIndexMap& rMap )
-+void ScFormulaCell::ReplaceRangeNamesInUse( const ScRangeData::IndexMap& rMap )
- {
- for( FormulaToken* p = pCode->First(); p; p = pCode->Next() )
- {
- if( p->GetOpCode() == ocName )
- {
-- USHORT nIndex = p->GetIndex();
-- USHORT nNewIndex = rMap.Find( nIndex );
-+ sal_uInt16 nIndex = p->GetIndex();
-+ ScRangeData::IndexMap::const_iterator itr = rMap.find(nIndex);
-+ sal_uInt16 nNewIndex = itr == rMap.end() ? nIndex : itr->second;
- if ( nIndex != nNewIndex )
- {
- p->SetIndex( nNewIndex );
-diff --git sc/source/core/data/clipparam.cxx sc/source/core/data/clipparam.cxx
-new file mode 100644
-index 0000000..b2ec555
---- /dev/null
-+++ sc/source/core/data/clipparam.cxx
-@@ -0,0 +1,203 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: document.cxx,v $
-+ * $Revision: 1.90.36.8 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org. If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+// INCLUDE ---------------------------------------------------------------
-+
-+#include "clipparam.hxx"
-+
-+using ::std::vector;
-+
-+ScClipParam::ScClipParam() :
-+ meDirection(Unspecified),
-+ mbCutMode(false)
-+{
-+}
-+
-+ScClipParam::ScClipParam(const ScRange& rRange, bool bCutMode) :
-+ meDirection(Unspecified),
-+ mbCutMode(bCutMode)
-+{
-+ maRanges.Append(rRange);
-+}
-+
-+ScClipParam::ScClipParam(const ScClipParam& r) :
-+ maRanges(r.maRanges),
-+ meDirection(r.meDirection),
-+ mbCutMode(r.mbCutMode)
-+{
-+}
-+
-+bool ScClipParam::isMultiRange() const
-+{
-+ return maRanges.Count() > 1;
-+}
-+
-+SCCOL ScClipParam::getPasteColSize()
-+{
-+ if (!maRanges.Count())
-+ return 0;
-+
-+ switch (meDirection)
-+ {
-+ case ScClipParam::Column:
-+ {
-+ SCCOL nColSize = 0;
-+ for (ScRangePtr p = maRanges.First(); p; p = maRanges.Next())
-+ nColSize += p->aEnd.Col() - p->aStart.Col() + 1;
-+ return nColSize;
-+ }
-+ case ScClipParam::Row:
-+ {
-+ // We assume that all ranges have identical column size.
-+ const ScRange& rRange = *maRanges.First();
-+ return rRange.aEnd.Col() - rRange.aStart.Col() + 1;
-+ }
-+ case ScClipParam::Unspecified:
-+ default:
-+ ;
-+ }
-+ return 0;
-+}
-+
-+SCROW ScClipParam::getPasteRowSize()
-+{
-+ if (!maRanges.Count())
-+ return 0;
-+
-+ switch (meDirection)
-+ {
-+ case ScClipParam::Column:
-+ {
-+ // We assume that all ranges have identical row size.
-+ const ScRange& rRange = *maRanges.First();
-+ return rRange.aEnd.Row() - rRange.aStart.Row() + 1;
-+ }
-+ case ScClipParam::Row:
-+ {
-+ SCROW nRowSize = 0;
-+ for (ScRangePtr p = maRanges.First(); p; p = maRanges.Next())
-+ nRowSize += p->aEnd.Row() - p->aStart.Row() + 1;
-+ return nRowSize;
-+ }
-+ case ScClipParam::Unspecified:
-+ default:
-+ ;
-+ }
-+ return 0;
-+}
-+
-+ScRange ScClipParam::getWholeRange() const
-+{
-+ ScRange aWhole;
-+ bool bFirst = true;
-+ ScRangeList aRanges = maRanges;
-+ for (ScRange* p = aRanges.First(); p; p = aRanges.Next())
-+ {
-+ if (bFirst)
-+ {
-+ aWhole = *p;
-+ bFirst = false;
-+ continue;
-+ }
-+
-+ if (aWhole.aStart.Col() > p->aStart.Col())
-+ aWhole.aStart.SetCol(p->aStart.Col());
-+
-+ if (aWhole.aStart.Row() > p->aStart.Row())
-+ aWhole.aStart.SetRow(p->aStart.Row());
-+
-+ if (aWhole.aEnd.Col() < p->aEnd.Col())
-+ aWhole.aEnd.SetCol(p->aEnd.Col());
-+
-+ if (aWhole.aEnd.Row() < p->aEnd.Row())
-+ aWhole.aEnd.SetRow(p->aEnd.Row());
-+ }
-+ return aWhole;
-+}
-+
-+void ScClipParam::transpose()
-+{
-+ switch (meDirection)
-+ {
-+ case Column:
-+ meDirection = ScClipParam::Row;
-+ break;
-+ case Row:
-+ meDirection = ScClipParam::Column;
-+ break;
-+ case Unspecified:
-+ default:
-+ ;
-+ }
-+
-+ ScRangeList aNewRanges;
-+ if (maRanges.Count())
-+ {
-+ ScRange* p = maRanges.First();
-+ SCCOL nColOrigin = p->aStart.Col();
-+ SCROW nRowOrigin = p->aStart.Row();
-+ for (; p; p = maRanges.Next())
-+ {
-+ SCCOL nColDelta = p->aStart.Col() - nColOrigin;
-+ SCROW nRowDelta = p->aStart.Row() - nRowOrigin;
-+ SCCOL nCol1 = 0;
-+ SCCOL nCol2 = static_cast<SCCOL>(p->aEnd.Row() - p->aStart.Row());
-+ SCROW nRow1 = 0;
-+ SCROW nRow2 = static_cast<SCROW>(p->aEnd.Col() - p->aStart.Col());
-+ nCol1 += static_cast<SCCOL>(nRowDelta);
-+ nCol2 += static_cast<SCCOL>(nRowDelta);
-+ nRow1 += static_cast<SCROW>(nColDelta);
-+ nRow2 += static_cast<SCROW>(nColDelta);
-+ ScRange aNew(nCol1, nRow1, p->aStart.Tab(), nCol2, nRow2, p->aStart.Tab());
-+ aNewRanges.Append(aNew);
-+ }
-+ }
-+ maRanges = aNewRanges;
-+}
-+
-+// ============================================================================
-+
-+ScClipRangeNameData::ScClipRangeNameData() :
-+ mbReplace(false)
-+{
-+}
-+
-+ScClipRangeNameData::~ScClipRangeNameData()
-+{
-+}
-+
-+void ScClipRangeNameData::insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex)
-+{
-+ maRangeMap.insert(
-+ ScRangeData::IndexMap::value_type(nOldIndex, nNewIndex));
-+}
-diff --git sc/source/core/data/column.cxx sc/source/core/data/column.cxx
-index 0932cda..81586a1 100644
---- sc/source/core/data/column.cxx
-+++ sc/source/core/data/column.cxx
-@@ -1874,7 +1874,7 @@ void ScColumn::FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<USHORT>& r
- }
-
- void ScColumn::ReplaceRangeNamesInUse(SCROW nRow1, SCROW nRow2,
-- const ScIndexMap& rMap )
-+ const ScRangeData::IndexMap& rMap )
- {
- if (pItems)
- for (SCSIZE i = 0; i < nCount; i++)
-@@ -1886,12 +1886,11 @@ void ScColumn::ReplaceRangeNamesInUse(SCROW nRow1, SCROW nRow2,
- SCROW nRow = pItems[i].nRow;
- ((ScFormulaCell*)pItems[i].pCell)->ReplaceRangeNamesInUse( rMap );
- if ( nRow != pItems[i].nRow )
-- Search( nRow, i ); // Listener geloescht/eingefuegt?
-+ Search( nRow, i ); // Listener geloescht/eingefuegt?
- }
- }
- }
-
--
- void ScColumn::SetDirtyVar()
- {
- for (SCSIZE i=0; i<nCount; i++)
-diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
-index 4ba0bb0..cf89761 100644
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -86,7 +86,6 @@
- #include "editutil.hxx"
- #include "hints.hxx"
- #include "dpobject.hxx"
--#include "indexmap.hxx"
- #include "scrdata.hxx"
- #include "poolhelp.hxx"
- #include "unoreflist.hxx"
-@@ -96,6 +95,7 @@
- #include "externalrefmgr.hxx"
- #include "tabprotection.hxx"
- #include "formulaparserpool.hxx"
-+#include "clipparam.hxx"
-
- // pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
- // dtor plus helpers are convenient.
-@@ -155,6 +155,8 @@ ScDocument::ScDocument( ScDocumentMode eMode,
- pScriptTypeData( NULL ),
- pCacheFieldEditEngine( NULL ),
- pDocProtection( NULL ),
-+ mpClipParam( NULL),
-+ pExternalRefMgr( NULL ),
- pViewOptions( NULL ),
- pDocOptions( NULL ),
- pExtDocOptions( NULL ),
-@@ -182,7 +184,6 @@ ScDocument::ScDocument( ScDocumentMode eMode,
- bForcedFormulaPending( FALSE ),
- bCalculatingFormulaTree( FALSE ),
- bIsClip( eMode == SCDOCMODE_CLIP ),
-- bCutMode( FALSE ),
- bIsUndo( eMode == SCDOCMODE_UNDO ),
- bIsVisible( FALSE ),
- bIsEmbedded( FALSE ),
-@@ -962,23 +963,18 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
- bOldAutoCalcSrc = pSrcDoc->GetAutoCalc();
- pSrcDoc->SetAutoCalc( TRUE ); // falls was berechnet werden muss
- }
-- SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable();
-- SvNumberFormatter* pOtherFormatter = pSrcDoc->xPoolHelper->GetFormTable();
-- if (pOtherFormatter && pOtherFormatter != pThisFormatter)
-+
- {
-- SvNumberFormatterIndexTable* pExchangeList =
-- pThisFormatter->MergeFormatter(*(pOtherFormatter));
-- if (pExchangeList->Count() > 0)
-- pFormatExchangeList = pExchangeList;
-- }
-- nDestPos = Min(nDestPos, (SCTAB)(GetTableCount() - 1));
-- { // scope for bulk broadcast
-- ScBulkBroadcast aBulkBroadcast( pBASM);
-- pSrcDoc->pTab[nSrcPos]->CopyToTable(0, 0, MAXCOL, MAXROW,
-- ( bResultsOnly ? IDF_ALL & ~IDF_FORMULA : IDF_ALL),
-- FALSE, pTab[nDestPos] );
-+ NumFmtMergeHandler aNumFmtMergeHdl(this, pSrcDoc);
-+
-+ nDestPos = Min(nDestPos, (SCTAB)(GetTableCount() - 1));
-+ { // scope for bulk broadcast
-+ ScBulkBroadcast aBulkBroadcast( pBASM);
-+ pSrcDoc->pTab[nSrcPos]->CopyToTable(0, 0, MAXCOL, MAXROW,
-+ ( bResultsOnly ? IDF_ALL & ~IDF_FORMULA : IDF_ALL),
-+ FALSE, pTab[nDestPos] );
-+ }
- }
-- pFormatExchangeList = NULL;
- pTab[nDestPos]->SetTabNo(nDestPos);
-
- if ( !bResultsOnly )
-@@ -988,7 +984,7 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
- // array containing range names which might need update of indices
- ScRangeData** pSrcRangeNames = nSrcRangeNames ? new ScRangeData* [nSrcRangeNames] : NULL;
- // the index mapping thereof
-- ScIndexMap aSrcRangeMap( nSrcRangeNames );
-+ ScRangeData::IndexMap aSrcRangeMap;
- BOOL bRangeNameReplace = FALSE;
-
- // find named ranges that are used in the source sheet
-@@ -1013,7 +1009,8 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
- USHORT nExistingIndex = pExistingData->GetIndex();
-
- pSrcRangeNames[i] = NULL; // don't modify the named range
-- aSrcRangeMap.SetPair( i, nOldIndex, nExistingIndex );
-+ aSrcRangeMap.insert(
-+ ScRangeData::IndexMap::value_type(nOldIndex, nExistingIndex));
- bRangeNameReplace = TRUE;
- bNamesLost = TRUE;
- }
-@@ -1033,7 +1030,8 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
- pData->TransferTabRef( nSrcPos, nDestPos );
- pSrcRangeNames[i] = pData;
- USHORT nNewIndex = pData->GetIndex();
-- aSrcRangeMap.SetPair( i, nOldIndex, nNewIndex );
-+ aSrcRangeMap.insert(
-+ ScRangeData::IndexMap::value_type(nOldIndex, nNewIndex));
- if ( !bRangeNameReplace )
- bRangeNameReplace = ( nOldIndex != nNewIndex );
- }
-diff --git sc/source/core/data/documen3.cxx sc/source/core/data/documen3.cxx
-index a0b524f..88d8051 100644
---- sc/source/core/data/documen3.cxx
-+++ sc/source/core/data/documen3.cxx
-@@ -80,6 +80,7 @@
- #include "listenercalls.hxx"
- #include "tabprotection.hxx"
- #include "formulaparserpool.hxx"
-+#include "clipparam.hxx"
-
- #include <memory>
-
-@@ -854,7 +855,7 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode,
- {
- ScDocument* pClipDoc = SC_MOD()->GetClipDoc();
- if (pClipDoc)
-- pClipDoc->bCutMode = FALSE;
-+ pClipDoc->GetClipParam().mbCutMode = false;
- }
- }
- }
-@@ -864,7 +865,10 @@ void ScDocument::UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDo
- {
- DBG_ASSERT(pClipDoc->bIsClip, "UpdateTranspose: kein Clip");
-
-- ScRange aSource = pClipDoc->aClipRange; // Tab wird noch angepasst
-+ ScRange aSource;
-+ ScClipParam& rClipParam = GetClipParam();
-+ if (rClipParam.maRanges.Count())
-+ aSource = *rClipParam.maRanges.First();
- ScAddress aDest = rDestPos;
-
- SCTAB nClipTab = 0;
-diff --git sc/source/core/data/documen8.cxx sc/source/core/data/documen8.cxx
-index 19d6d94..f190f5b 100644
---- sc/source/core/data/documen8.cxx
-+++ sc/source/core/data/documen8.cxx
-@@ -319,20 +319,8 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet,
- void ScDocument::CopyStdStylesFrom( ScDocument* pSrcDoc )
- {
- // #b5017505# number format exchange list has to be handled here, too
--
-- SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable();
-- SvNumberFormatter* pOtherFormatter = pSrcDoc->xPoolHelper->GetFormTable();
-- if (pOtherFormatter && pOtherFormatter != pThisFormatter)
-- {
-- SvNumberFormatterIndexTable* pExchangeList =
-- pThisFormatter->MergeFormatter(*(pOtherFormatter));
-- if (pExchangeList->Count() > 0)
-- pFormatExchangeList = pExchangeList;
-- }
--
-+ NumFmtMergeHandler aNumFmtMergeHdl(this, pSrcDoc);
- xPoolHelper->GetStylePool()->CopyStdStylesFrom( pSrcDoc->xPoolHelper->GetStylePool() );
--
-- pFormatExchangeList = NULL;
- }
-
- //------------------------------------------------------------------------
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index 39ff75e..2bbdfa9 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -84,7 +84,6 @@
- #include "detdata.hxx"
- #include "cell.hxx"
- #include "dpobject.hxx"
--#include "indexmap.hxx"
- #include "detfunc.hxx" // for UpdateAllComments
- #include "scmod.hxx"
- #include "dociter.hxx"
-@@ -94,6 +93,9 @@
- #include "postit.hxx"
- #include "externalrefmgr.hxx"
- #include "tabprotection.hxx"
-+#include "clipparam.hxx"
-+
-+#include <map>
-
- namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
-
-@@ -1344,7 +1346,7 @@ void ScDocument::AddUndoTab( SCTAB nTab1, SCTAB nTab2, BOOL bColInfo, BOOL bRowI
- void ScDocument::SetCutMode( BOOL bVal )
- {
- if (bIsClip)
-- bCutMode = bVal;
-+ GetClipParam().mbCutMode = bVal;
- else
- {
- DBG_ERROR("SetCutMode without bIsClip");
-@@ -1355,7 +1357,7 @@ void ScDocument::SetCutMode( BOOL bVal )
- BOOL ScDocument::IsCutMode()
- {
- if (bIsClip)
-- return bCutMode;
-+ return GetClipParam().mbCutMode;
- else
- {
- DBG_ERROR("IsCutMode ohne bIsClip");
-@@ -1467,70 +1469,50 @@ void ScDocument::UndoToDocument(const ScRange& rRange,
- pDestDoc->SetAutoCalc( bOldAutoCalc );
- }
-
--
--void ScDocument::CopyToClip(SCCOL nCol1, SCROW nRow1,
-- SCCOL nCol2, SCROW nRow2,
-- BOOL bCut, ScDocument* pClipDoc,
-- BOOL bAllTabs, const ScMarkData* pMarks,
-- BOOL bKeepScenarioFlags, BOOL bIncludeObjects, BOOL bCloneNoteCaptions)
-+void ScDocument::CopyToClip(const ScClipParam& rClipParam,
-+ ScDocument* pClipDoc, const ScMarkData* pMarks,
-+ bool bAllTabs, bool bKeepScenarioFlags, bool bIncludeObjects, bool bCloneNoteCaptions)
- {
- DBG_ASSERT( bAllTabs || pMarks, "CopyToClip: ScMarkData fehlt" );
-
-- if (!bIsClip)
-+ if (bIsClip)
-+ return;
-+
-+ if (!pClipDoc)
- {
-- PutInOrder( nCol1, nCol2 );
-- PutInOrder( nRow1, nRow2 );
-- if (!pClipDoc)
-- {
-- DBG_ERROR("CopyToClip: no ClipDoc");
-- pClipDoc = SC_MOD()->GetClipDoc();
-- }
-+ DBG_ERROR("CopyToClip: no ClipDoc");
-+ pClipDoc = SC_MOD()->GetClipDoc();
-+ }
-
-- pClipDoc->aDocName = aDocName;
-- pClipDoc->aClipRange = ScRange( nCol1,nRow1,0, nCol2,nRow2,0 );
-- pClipDoc->ResetClip( this, pMarks );
-- USHORT i;
-- SCTAB j;
--
-- std::set<USHORT> aUsedNames; // indexes of named ranges that are used in the copied cells
-- for (j = 0; j <= MAXTAB; j++)
-- if (pTab[j] && pClipDoc->pTab[j])
-- if ( bAllTabs || !pMarks || pMarks->GetTableSelect(j) )
-- pTab[j]->FindRangeNamesInUse( nCol1, nRow1, nCol2, nRow2, aUsedNames );
--
-- pClipDoc->pRangeName->FreeAll();
-- for (i = 0; i < pRangeName->GetCount(); i++) //! DB-Bereiche Pivot-Bereiche auch !!!
-- {
-- USHORT nIndex = ((ScRangeData*)((*pRangeName)[i]))->GetIndex();
-- bool bInUse = ( aUsedNames.find(nIndex) != aUsedNames.end() );
-- if (bInUse)
-- {
-- ScRangeData* pData = new ScRangeData(*((*pRangeName)[i]));
-- if (!pClipDoc->pRangeName->Insert(pData))
-- delete pData;
-- else
-- pData->SetIndex(nIndex);
-- }
-- }
-- for (j = 0; j <= MAXTAB; j++)
-- if (pTab[j] && pClipDoc->pTab[j])
-- if ( bAllTabs || !pMarks || pMarks->GetTableSelect(j) )
-- {
-- pTab[j]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[j], bKeepScenarioFlags, bCloneNoteCaptions);
-+ pClipDoc->aDocName = aDocName;
-+ pClipDoc->SetClipParam(rClipParam);
-+ pClipDoc->ResetClip(this, pMarks);
-
-- if ( pDrawLayer && bIncludeObjects )
-- {
-- // also copy drawing objects
-+ ScRange aClipRange = rClipParam.getWholeRange();
-+ CopyRangeNamesToClip(pClipDoc, aClipRange, pMarks, bAllTabs);
-
-- Rectangle aObjRect = GetMMRect( nCol1, nRow1, nCol2, nRow2, j );
-- pDrawLayer->CopyToClip( pClipDoc, j, aObjRect );
-- }
-- }
-+ for (SCTAB i = 0; i <= MAXTAB; ++i)
-+ {
-+ if (!pTab[i] || !pClipDoc->pTab[i])
-+ continue;
-+
-+ if (pMarks && !pMarks->GetTableSelect(i))
-+ continue;
-+
-+ pTab[i]->CopyToClip(rClipParam.maRanges, pClipDoc->pTab[i], bKeepScenarioFlags, bCloneNoteCaptions);
-
-- pClipDoc->bCutMode = bCut;
-+ if (pDrawLayer && bIncludeObjects)
-+ {
-+ // also copy drawing objects
-+ Rectangle aObjRect = GetMMRect(
-+ aClipRange.aStart.Col(), aClipRange.aStart.Row(), aClipRange.aEnd.Col(), aClipRange.aEnd.Row(), i);
-+ pDrawLayer->CopyToClip(pClipDoc, i, aObjRect);
-+ }
- }
--}
-
-+ // Make sure to mark overlapped cells.
-+ pClipDoc->ExtendMerge(aClipRange, true);
-+}
-
- void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
- SCCOL nCol2, SCROW nRow2,
-@@ -1546,14 +1528,16 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
- pClipDoc = SC_MOD()->GetClipDoc();
- }
-
-+ ScClipParam& rClipParam = pClipDoc->GetClipParam();
- pClipDoc->aDocName = aDocName;
-- pClipDoc->aClipRange = ScRange( nCol1,nRow1,0, nCol2,nRow2,0 );
-+ rClipParam.maRanges.RemoveAll();
-+ rClipParam.maRanges.Append(ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0));
- pClipDoc->ResetClip( this, nTab );
-
- if (pTab[nTab] && pClipDoc->pTab[nTab])
- pTab[nTab]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[nTab], FALSE, TRUE);
-
-- pClipDoc->bCutMode = FALSE;
-+ pClipDoc->GetClipParam().mbCutMode = false;
- }
- }
-
-@@ -1583,6 +1567,7 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL
-
- // Daten
-
-+ ScRange aClipRange = GetClipParam().getWholeRange();
- if ( ValidRow(aClipRange.aEnd.Row()-aClipRange.aStart.Row()) )
- {
- for (SCTAB i=0; i<=MAXTAB; i++)
-@@ -1611,10 +1596,8 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL
- }
- }
-
-- pTransClip->aClipRange = ScRange( 0, 0, aClipRange.aStart.Tab(),
-- static_cast<SCCOL>(aClipRange.aEnd.Row() - aClipRange.aStart.Row()),
-- static_cast<SCROW>(aClipRange.aEnd.Col() - aClipRange.aStart.Col()),
-- aClipRange.aEnd.Tab() );
-+ pTransClip->SetClipParam(GetClipParam());
-+ pTransClip->GetClipParam().transpose();
- }
- else
- {
-@@ -1623,9 +1606,184 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL
-
- // Dies passiert erst beim Einfuegen...
-
-- bCutMode = FALSE;
-+ GetClipParam().mbCutMode = false;
-+}
-+
-+void ScDocument::CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs)
-+{
-+ std::set<USHORT> aUsedNames; // indexes of named ranges that are used in the copied cells
-+ for (SCTAB i = 0; i <= MAXTAB; ++i)
-+ if (pTab[i] && pClipDoc->pTab[i])
-+ if ( bAllTabs || !pMarks || pMarks->GetTableSelect(i) )
-+ pTab[i]->FindRangeNamesInUse(
-+ rClipRange.aStart.Col(), rClipRange.aStart.Row(),
-+ rClipRange.aEnd.Col(), rClipRange.aEnd.Row(), aUsedNames);
-+
-+ pClipDoc->pRangeName->FreeAll();
-+ for (USHORT i = 0; i < pRangeName->GetCount(); i++) //! DB-Bereiche Pivot-Bereiche auch !!!
-+ {
-+ USHORT nIndex = ((ScRangeData*)((*pRangeName)[i]))->GetIndex();
-+ bool bInUse = ( aUsedNames.find(nIndex) != aUsedNames.end() );
-+ if (bInUse)
-+ {
-+ ScRangeData* pData = new ScRangeData(*((*pRangeName)[i]));
-+ if (!pClipDoc->pRangeName->Insert(pData))
-+ delete pData;
-+ else
-+ pData->SetIndex(nIndex);
-+ }
-+ }
-+}
-+
-+ScDocument::NumFmtMergeHandler::NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc) :
-+ mpDoc(pDoc)
-+{
-+ mpDoc->MergeNumberFormatter(pSrcDoc);
- }
-
-+ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler()
-+{
-+ mpDoc->pFormatExchangeList = NULL;
-+}
-+
-+void ScDocument::MergeNumberFormatter(ScDocument* pSrcDoc)
-+{
-+ SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable();
-+ SvNumberFormatter* pOtherFormatter = pSrcDoc->xPoolHelper->GetFormTable();
-+ if (pOtherFormatter && pOtherFormatter != pThisFormatter)
-+ {
-+ SvNumberFormatterIndexTable* pExchangeList =
-+ pThisFormatter->MergeFormatter(*(pOtherFormatter));
-+ if (pExchangeList->Count() > 0)
-+ pFormatExchangeList = pExchangeList;
-+ }
-+}
-+
-+void ScDocument::CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames)
-+{
-+ sal_uInt16 nClipRangeNameCount = pClipDoc->pRangeName->GetCount();
-+ ScClipRangeNameData aClipRangeNames;
-+
-+ // array containing range names which might need update of indices
-+ aClipRangeNames.mpRangeNames.resize(nClipRangeNameCount, NULL);
-+
-+ for (sal_uInt16 i = 0; i < nClipRangeNameCount; ++i) //! DB-Bereiche Pivot-Bereiche auch
-+ {
-+ /* Copy only if the name doesn't exist in this document.
-+ If it exists we use the already existing name instead,
-+ another possibility could be to create new names if
-+ documents differ.
-+ A proper solution would ask the user how to proceed.
-+ The adjustment of the indices in the formulas is done later.
-+ */
-+ ScRangeData* pClipRangeData = (*pClipDoc->pRangeName)[i];
-+ USHORT k;
-+ if ( pRangeName->SearchName( pClipRangeData->GetName(), k ) )
-+ {
-+ aClipRangeNames.mpRangeNames[i] = NULL; // range name not inserted
-+ USHORT nOldIndex = pClipRangeData->GetIndex();
-+ USHORT nNewIndex = ((*pRangeName)[k])->GetIndex();
-+ aClipRangeNames.insert(nOldIndex, nNewIndex);
-+ if ( !aClipRangeNames.mbReplace )
-+ aClipRangeNames.mbReplace = ( nOldIndex != nNewIndex );
-+ }
-+ else
-+ {
-+ ScRangeData* pData = new ScRangeData( *pClipRangeData );
-+ pData->SetDocument(this);
-+ if ( pRangeName->FindIndex( pData->GetIndex() ) )
-+ pData->SetIndex(0); // need new index, done in Insert
-+ if ( pRangeName->Insert( pData ) )
-+ {
-+ aClipRangeNames.mpRangeNames[i] = pData;
-+ USHORT nOldIndex = pClipRangeData->GetIndex();
-+ USHORT nNewIndex = pData->GetIndex();
-+ aClipRangeNames.insert(nOldIndex, nNewIndex);
-+ if ( !aClipRangeNames.mbReplace )
-+ aClipRangeNames.mbReplace = ( nOldIndex != nNewIndex );
-+ }
-+ else
-+ { // must be an overflow
-+ delete pData;
-+ aClipRangeNames.mpRangeNames[i] = NULL;
-+ aClipRangeNames.insert(pClipRangeData->GetIndex(), 0);
-+ aClipRangeNames.mbReplace = true;
-+ }
-+ }
-+ }
-+ rRangeNames = aClipRangeNames;
-+}
-+
-+void ScDocument::UpdateRangeNamesInFormulas(
-+ ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark,
-+ SCCOL nXw, SCROW nYw)
-+{
-+ // nXw and nYw are the extra width and height of the destination range
-+ // extended due to presence of merged cell(s).
-+
-+ if (!rRangeNames.mbReplace)
-+ return;
-+
-+ // first update all inserted named formulas if they contain other
-+ // range names and used indices changed
-+ size_t nRangeNameCount = rRangeNames.mpRangeNames.size();
-+ for (size_t i = 0; i < nRangeNameCount; ++i) //! DB-Bereiche Pivot-Bereiche auch
-+ {
-+ if ( rRangeNames.mpRangeNames[i] )
-+ rRangeNames.mpRangeNames[i]->ReplaceRangeNamesInUse(rRangeNames.maRangeMap);
-+ }
-+ // then update the formulas, they might need just the updated range names
-+ for (ULONG nRange = 0; nRange < rDestRanges.Count(); ++nRange)
-+ {
-+ const ScRange* pRange = rDestRanges.GetObject( nRange);
-+ SCCOL nCol1 = pRange->aStart.Col();
-+ SCROW nRow1 = pRange->aStart.Row();
-+ SCCOL nCol2 = pRange->aEnd.Col();
-+ SCROW nRow2 = pRange->aEnd.Row();
-+
-+ SCCOL nC1 = nCol1;
-+ SCROW nR1 = nRow1;
-+ SCCOL nC2 = nC1 + nXw;
-+ if (nC2 > nCol2)
-+ nC2 = nCol2;
-+ SCROW nR2 = nR1 + nYw;
-+ if (nR2 > nRow2)
-+ nR2 = nRow2;
-+ do
-+ {
-+ do
-+ {
-+ for (SCTAB k = 0; k <= MAXTAB; k++)
-+ {
-+ if ( pTab[k] && rMark.GetTableSelect(k) )
-+ pTab[k]->ReplaceRangeNamesInUse(nC1, nR1,
-+ nC2, nR2, rRangeNames.maRangeMap);
-+ }
-+ nC1 = nC2 + 1;
-+ nC2 = Min((SCCOL)(nC1 + nXw), nCol2);
-+ } while (nC1 <= nCol2);
-+ nC1 = nCol1;
-+ nC2 = nC1 + nXw;
-+ if (nC2 > nCol2)
-+ nC2 = nCol2;
-+ nR1 = nR2 + 1;
-+ nR2 = Min((SCROW)(nR1 + nYw), nRow2);
-+ } while (nR1 <= nRow2);
-+ }
-+}
-+
-+ScClipParam& ScDocument::GetClipParam()
-+{
-+ if (!mpClipParam.get())
-+ mpClipParam.reset(new ScClipParam);
-+
-+ return *mpClipParam;
-+}
-+
-+void ScDocument::SetClipParam(const ScClipParam& rParam)
-+{
-+ mpClipParam.reset(new ScClipParam(rParam));
-+}
-
- BOOL ScDocument::IsClipboardSource() const
- {
-@@ -1725,7 +1883,7 @@ void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1,
- && ppClipTab[nClipTab + nFollow + 1] )
- ++nFollow;
-
-- if ( pCBFCP->pClipDoc->bCutMode )
-+ if ( pCBFCP->pClipDoc->GetClipParam().mbCutMode )
- {
- BOOL bOldInserting = IsInsertingFromOtherDoc();
- SetInsertingFromOtherDoc( TRUE);
-@@ -1767,7 +1925,9 @@ void ScDocument::CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1,
- pCBFCP->pClipDoc->GetRowFlagsArray( nFlagTab);
-
- SCROW nSourceRow = rClipStartRow;
-- SCROW nSourceEnd = pCBFCP->pClipDoc->aClipRange.aEnd.Row();
-+ SCROW nSourceEnd = 0;
-+ if (pCBFCP->pClipDoc->GetClipParam().maRanges.Count())
... etc. - the rest is truncated
More information about the ooo-build-commit
mailing list