[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/filter/excel/xetable.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit c883f49f9400948001424ed10392841d93c7ce3d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Aug 12 21:20:01 2013 -0400 Return something. Change-Id: I46ff752f62d2f3fc988bbacc58097ee36e87182f diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index d7b6499..8e0d763 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -230,6 +230,8 @@ XclExpShrfmlaRef XclExpShrfmlaBuffer::CreateOrExtendShrfmla( xRec = aIt-second; xRec-ExtendRange( rScPos ); } + +return xRec; } // Multiple operations ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/filter/excel/xetable.cxx | 39 +-- sc/source/filter/excel/xlformula.cxx |7 -- sc/source/filter/inc/xetable.hxx |3 -- sc/source/filter/inc/xlformula.hxx |8 --- 4 files changed, 21 insertions(+), 36 deletions(-) New commits: commit c31f2b862804f057adeb055a5bb069dced03eaae Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Aug 9 12:09:44 2013 -0400 Export shared formulas to xls, from the new shared formula in the core. Turns out we don't export shared formulas to xlsx, so no work is needed there. Change-Id: I85604f3b80c95c5b6179bbdac41e758c5de7854a diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 99313ea..d7b6499 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -207,28 +207,29 @@ XclExpShrfmlaBuffer::XclExpShrfmlaBuffer( const XclExpRoot rRoot ) : } XclExpShrfmlaRef XclExpShrfmlaBuffer::CreateOrExtendShrfmla( -const ScTokenArray rScTokArr, const ScAddress rScPos ) +const ScFormulaCell rScCell, const ScAddress rScPos ) { XclExpShrfmlaRef xRec; -if( const ScTokenArray* pShrdScTokArr = XclTokenArrayHelper::GetSharedFormula( GetRoot(), rScTokArr ) ) +const ScTokenArray* pShrdScTokArr = rScCell.GetSharedCode(); +if (!pShrdScTokArr) +// This formula cell is not shared formula cell. +return xRec; + +XclExpShrfmlaMap::iterator aIt = maRecMap.find( pShrdScTokArr ); +if( aIt == maRecMap.end() ) { -XclExpShrfmlaMap::iterator aIt = maRecMap.find( pShrdScTokArr ); -if( aIt == maRecMap.end() ) -{ -// create a new record -XclTokenArrayRef xTokArr = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_SHARED, *pShrdScTokArr, rScPos ); -xRec.reset( new XclExpShrfmla( xTokArr, rScPos ) ); -maRecMap[ pShrdScTokArr ] = xRec; -} -else -{ -// extend existing record -OSL_ENSURE( aIt-second, XclExpShrfmlaBuffer::CreateOrExtendShrfmla - missing record ); -xRec = aIt-second; -xRec-ExtendRange( rScPos ); -} +// create a new record +XclTokenArrayRef xTokArr = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_SHARED, *pShrdScTokArr, rScPos ); +xRec.reset( new XclExpShrfmla( xTokArr, rScPos ) ); +maRecMap[ pShrdScTokArr ] = xRec; +} +else +{ +// extend existing record +OSL_ENSURE( aIt-second, XclExpShrfmlaBuffer::CreateOrExtendShrfmla - missing record ); +xRec = aIt-second; +xRec-ExtendRange( rScPos ); } -return xRec; } // Multiple operations @@ -851,7 +852,7 @@ XclExpFormulaCell::XclExpFormulaCell( // no matrix found - try to create shared formula if( !mxAddRec ) -mxAddRec = rShrfmlaBfr.CreateOrExtendShrfmla( rScTokArr, aScPos ); +mxAddRec = rShrfmlaBfr.CreateOrExtendShrfmla(mrScFmlaCell, aScPos); // no shared formula found - create a simple cell formula if( !mxAddRec ) diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index 2eff911..fa2bb20 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -763,13 +763,6 @@ void XclTokenArrayHelper::ConvertStringToList( ScTokenArray rScTokArr, sal_Unic } } -// shared formulas - -const ScTokenArray* XclTokenArrayHelper::GetSharedFormula( const XclRoot /*rRoot*/, const ScTokenArray /*rScTokArr*/ ) -{ -return NULL; -} - // multiple operations namespace { diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx index 533d2ec..0e47052 100644 --- a/sc/source/filter/inc/xetable.hxx +++ b/sc/source/filter/inc/xetable.hxx @@ -189,8 +189,7 @@ public: function updates its cell range to include the passed cell position, if there is a SHRFMLA record for the passed token array; otherwise this function creates and returns a new SHRFMLA record. */ -XclExpShrfmlaRefCreateOrExtendShrfmla( -const ScTokenArray rScTokArr, const ScAddress rScPos ); +XclExpShrfmlaRef CreateOrExtendShrfmla( const ScFormulaCell rScCell, const ScAddress rScPos ); private: typedef ::std::map const ScTokenArray*, XclExpShrfmlaRef XclExpShrfmlaMap; diff --git a/sc/source/filter/inc/xlformula.hxx b/sc/source/filter/inc/xlformula.hxx index fdf395e..0a90e08 100644 --- a/sc/source/filter/inc/xlformula.hxx +++ b/sc/source/filter/inc/xlformula.hxx @@ -523,14 +523,6 @@ public: @param bTrimLeadingSpaces true = remove leading spaces from each token. */ static void ConvertStringToList( ScTokenArray rScTokArr,
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx |4 1 file changed, 4 insertions(+) New commits: commit f344ed968081ad9227994765bc00e6089966dc8d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Aug 9 16:41:22 2013 -0400 If the formula cell is grouped, update reference only on the top cell. Change-Id: I5e2e9db621a61deba39a46962e0ca877235d7c90 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index c87b045..06fb6dc 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2598,6 +2598,10 @@ bool ScFormulaCell::UpdateReference( if (pDocument-IsClipOrUndo()) return false; +if (mxGroup mxGroup-mnStart != aPos.Row()) +// Update only the top cell in case the cell is part of a formula group. +return false; + switch (rCxt.meMode) { case URM_INSDEL: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/filter/oox/formulabuffer.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 6fdf341829d43dbaee2f1e0ebedac71379a15533 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Aug 8 07:52:45 2013 -0400 Fix the (Windows) build. No idea how this was buildable on Linux. Change-Id: I9c0701b1b8f30c36f45bbee0d95e92a59f9891fe diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 59518bc..e4277c0 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -33,12 +33,12 @@ using namespace ::com::sun::star::container; namespace oox { namespace xls { -FormulaBuffer::FormulaBuffer::SharedFormulaEntry::SharedFormulaEntry( +FormulaBuffer::SharedFormulaEntry::SharedFormulaEntry( const table::CellAddress rAddr, const table::CellRangeAddress rRange, const OUString rTokenStr, sal_Int32 nSharedId ) : maAddress(rAddr), maRange(rRange), maTokenStr(rTokenStr), mnSharedId(nSharedId) {} -FormulaBuffer::FormulaBuffer::SharedFormulaDesc::SharedFormulaDesc( +FormulaBuffer::SharedFormulaDesc::SharedFormulaDesc( const com::sun::star::table::CellAddress rAddr, sal_Int32 nSharedId, const OUString rCellValue, sal_Int32 nValueType ) : maAddress(rAddr), mnSharedId(nSharedId), maCellValue(rCellValue), mnValueType(nValueType) {} ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/filter/excel/excform8.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 06e851924bbbe9a88d4403913d0024fc29ceb4f4 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Aug 7 23:58:32 2013 -0400 Fix import of negative relative row reference from xls. Change-Id: Ibaa325396a8a06c45cf59af9809ed5cbff6d10d0 diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 35de70f..043b3f4 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -1417,7 +1417,7 @@ void ExcelToSc8::ExcRelToScRel8( sal_uInt16 nRow, sal_uInt16 nC, ScSingleRefData // R O W if( bRowRel ) -rSRD.SetRelRow(nRow); +rSRD.SetRelRow(static_castsal_Int16(nRow)); else rSRD.SetAbsRow(std::min( static_castSCROW(nRow), MAXROW)); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 99 ++-- sc/source/core/tool/token.cxx |3 - 2 files changed, 96 insertions(+), 6 deletions(-) New commits: commit a14b77f904d9ca905c6665523cca9ab452f2e4d4 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Aug 8 00:27:15 2013 -0400 Detect self-referencing groups, and disable group-calculation. And re-enable group-calculation on named ranges. Change-Id: I4957ff05bac23bd266bbc96fe5619ad5f0a65688 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index fd103bc..c87b045 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3279,6 +3279,49 @@ class GroupTokenConverter ScDocument mrDoc; ScFormulaCell mrCell; const ScAddress mrPos; + +bool isSelfReferenceRelative(const ScAddress rRefPos, SCROW nRelRow) +{ +if (rRefPos.Col() != mrPos.Col()) +return false; + +SCROW nLen = mrCell.GetCellGroup()-mnLength; +SCROW nEndRow = mrPos.Row() + nLen - 1; + +if (nRelRow 0) +{ +SCROW nTest = nEndRow; +nTest += nRelRow; +if (nTest = mrPos.Row()) +return true; +} +else if (nRelRow 0) +{ +SCROW nTest = mrPos.Row(); // top row. +nTest += nRelRow; +if (nTest = nEndRow) +return true; +} + +return false; +} + +bool isSelfReferenceAbsolute(const ScAddress rRefPos) +{ +if (rRefPos.Col() != mrPos.Col()) +return false; + +SCROW nLen = mrCell.GetCellGroup()-mnLength; +SCROW nEndRow = mrPos.Row() + nLen - 1; + +if (rRefPos.Row() mrPos.Row()) +return false; + +if (rRefPos.Row() nEndRow) +return false; + +return true; +} public: GroupTokenConverter(sc::FormulaGroupContext rCxt, ScTokenArray rGroupTokens, ScDocument rDoc, ScFormulaCell rCell, const ScAddress rPos) : mrCxt(rCxt), mrGroupTokens(rGroupTokens), mrDoc(rDoc), mrCell(rCell), mrPos(rPos) {} @@ -3302,6 +3345,7 @@ public: // absolute reference state for row directions. const ScToken* pToken = static_castconst ScToken*(p); +SCROW nLen = mrCell.GetCellGroup()-mnLength; switch (pToken-GetType()) { case svSingleRef: @@ -3310,20 +3354,26 @@ public: ScAddress aRefPos = aRef.toAbs(mrPos); if (aRef.IsRowRel()) { +if (isSelfReferenceRelative(aRefPos, aRef.Row())) +return false; + // Fetch double array guarantees that the length of the // returned array equals or greater than the requested // length. -const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, mrCell.GetCellGroup()-mnLength); +const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, nLen); if (!pArray) return false; -formula::SingleVectorRefToken aTok(pArray, mrCell.GetCellGroup()-mnLength); +formula::SingleVectorRefToken aTok(pArray, nLen); mrGroupTokens.AddToken(aTok); } else { // Absolute row reference. +if (isSelfReferenceAbsolute(aRefPos)) +return false; + formula::FormulaTokenRef pNewToken = mrDoc.ResolveStaticReference(aRefPos); if (!pNewToken) return false; @@ -3337,6 +3387,23 @@ public: ScComplexRefData aRef = pToken-GetDoubleRef(); ScRange aAbs = aRef.toAbs(mrCell.aPos); +// Check for self reference. +if (aRef.Ref1.IsRowRel()) +{ +if (isSelfReferenceRelative(aAbs.aStart, aRef.Ref1.Row())) +return false; +} +else if (isSelfReferenceAbsolute(aAbs.aStart)) +return false; + +if (aRef.Ref2.IsRowRel()) +{ +if (isSelfReferenceRelative(aAbs.aEnd, aRef.Ref2.Row())) +return false; +} +else if (isSelfReferenceAbsolute(aAbs.aEnd)) +return false; + // Row reference is relative. bool bAbsFirst = !aRef.Ref1.IsRowRel(); bool bAbsLast = !aRef.Ref2.IsRowRel(); @@ -3344,7 +3411,7 @@ public:
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/filter/inc/formulabuffer.hxx | 77 - sc/source/filter/oox/formulabuffer.cxx |2 2 files changed, 39 insertions(+), 40 deletions(-) New commits: commit a0fda3e42ab38eb358743935b47341f5e1768ffa Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Aug 6 21:25:50 2013 -0400 Some cosmetic fix Change-Id: I80baff3b1794619659e505622164e2582e762248 diff --git a/sc/source/filter/inc/formulabuffer.hxx b/sc/source/filter/inc/formulabuffer.hxx index 984f9c8..1e98060 100644 --- a/sc/source/filter/inc/formulabuffer.hxx +++ b/sc/source/filter/inc/formulabuffer.hxx @@ -25,49 +25,46 @@ #include sheetdatabuffer.hxx #include com/sun/star/sheet/XFormulaTokens.hpp -namespace oox { -namespace xls { +namespace oox { namespace xls { class FormulaBuffer : public WorkbookHelper { -private: -struct SharedFormulaEntry -{ -::com::sun::star::table::CellAddress maAddress; -OUString maTokenStr; -sal_Int32 mnSharedId; -::com::sun::star::uno::Reference ::com::sun::star::sheet::XFormulaTokens mxFormulaTokens; -SharedFormulaEntry( const ::com::sun::star::table::CellAddress rAddress, const OUString rTokenStr, sal_Int32 nSharedId ) : maAddress( rAddress ), maTokenStr( rTokenStr ), mnSharedId( nSharedId ) {} -}; - +struct SharedFormulaEntry +{ +::com::sun::star::table::CellAddress maAddress; +OUString maTokenStr; +sal_Int32 mnSharedId; +::com::sun::star::uno::Reference ::com::sun::star::sheet::XFormulaTokens mxFormulaTokens; +SharedFormulaEntry( const ::com::sun::star::table::CellAddress rAddress, const OUString rTokenStr, sal_Int32 nSharedId ) : maAddress( rAddress ), maTokenStr( rTokenStr ), mnSharedId( nSharedId ) {} +}; -struct TokenAddressItem -{ -OUString maTokenStr; -::com::sun::star::table::CellAddress maCellAddress; -TokenAddressItem( const OUString rTokenStr, const ::com::sun::star::table::CellAddress rCellAddress ) : maTokenStr( rTokenStr ), maCellAddress( rCellAddress ) {} -}; +struct TokenAddressItem +{ +OUString maTokenStr; +::com::sun::star::table::CellAddress maCellAddress; +TokenAddressItem( const OUString rTokenStr, const ::com::sun::star::table::CellAddress rCellAddress ) : maTokenStr( rTokenStr ), maCellAddress( rCellAddress ) {} +}; -struct TokenRangeAddressItem -{ -TokenAddressItem maTokenAndAddress; -::com::sun::star::table::CellRangeAddress maCellRangeAddress; -TokenRangeAddressItem( const TokenAddressItem rTokenAndAddress, const ::com::sun::star::table::CellRangeAddress rCellRangeAddress ) : maTokenAndAddress( rTokenAndAddress ), maCellRangeAddress( rCellRangeAddress ) {} -}; +struct TokenRangeAddressItem +{ +TokenAddressItem maTokenAndAddress; +::com::sun::star::table::CellRangeAddress maCellRangeAddress; +TokenRangeAddressItem( const TokenAddressItem rTokenAndAddress, const ::com::sun::star::table::CellRangeAddress rCellRangeAddress ) : maTokenAndAddress( rTokenAndAddress ), maCellRangeAddress( rCellRangeAddress ) {} +}; -typedef ::std::map sal_Int32, std::vector TokenAddressItem FormulaDataMap; -typedef ::std::map sal_Int32, std::vector TokenRangeAddressItem ArrayFormulaDataMap; -// shared formuala descriptions, the id and address the formula is at -typedef std::pair ::com::sun::star::table::CellAddress, sal_Int32 SharedFormulaDesc; -// sheet - list of shared formula descriptions -typedef ::std::map sal_Int32, std::vector SharedFormulaDesc SheetToSharedFormulaid; -// sheet - stuff needed to create shared formulae -typedef ::std::map sal_Int32, std::vector SharedFormulaEntry SheetToFormulaEntryMap; -// sharedId - tokedId -typedef ::std::map sal_Int32, sal_Int32 SharedIdToTokenIndex; -typedef ::std::map sal_Int32, SharedIdToTokenIndex SheetToSharedIdToTokenIndex; -typedef ::std::pair ::com::sun::star::table::CellAddress, double ValueAddressPair; -typedef ::std::map sal_Int32, std::vector ValueAddressPair FormulaValueMap; +typedef ::std::map sal_Int32, std::vector TokenAddressItem FormulaDataMap; +typedef ::std::map sal_Int32, std::vector TokenRangeAddressItem ArrayFormulaDataMap; +// shared formuala descriptions, the id and address the formula is at +typedef std::pair ::com::sun::star::table::CellAddress, sal_Int32 SharedFormulaDesc; +// sheet - list of shared formula descriptions +typedef ::std::map sal_Int32, std::vector SharedFormulaDesc SheetToSharedFormulaid; +// sheet - stuff needed to create shared formulae +typedef ::std::map sal_Int32, std::vector SharedFormulaEntry SheetToFormulaEntryMap; +// sharedId - tokedId +typedef ::std::map sal_Int32, sal_Int32 SharedIdToTokenIndex; +typedef ::std::map sal_Int32, SharedIdToTokenIndex SheetToSharedIdToTokenIndex; +typedef ::std::pair ::com::sun::star::table::CellAddress, double ValueAddressPair; +typedef
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/conditio.cxx | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) New commits: commit eea9c45b74c2980d76154a3755ba8f037401efbd Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 30 16:12:53 2013 -0400 More on avoiding direct access to reference data members. Change-Id: I313c6504d7c0beeb68318ce436b48fa900e4cf48 diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 591fc0f..c0939ff 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1429,22 +1429,24 @@ ScAddress ScConditionEntry::GetValidSrcPos() const while ( ( t = static_castScToken*(pFormula-GetNextReference()) ) != NULL ) { ScSingleRefData rRef1 = t-GetSingleRef(); -if ( rRef1.IsTabRel() !rRef1.IsTabDeleted() ) +ScAddress aAbs = rRef1.toAbs(aSrcPos); +if (!rRef1.IsTabDeleted()) { -if ( rRef1.nTab nMinTab ) -nMinTab = rRef1.nTab; -if ( rRef1.nTab nMaxTab ) -nMaxTab = rRef1.nTab; +if (aAbs.Tab() nMinTab) +nMinTab = aAbs.Tab(); +if (aAbs.Tab() nMaxTab) +nMaxTab = aAbs.Tab(); } if ( t-GetType() == svDoubleRef ) { ScSingleRefData rRef2 = t-GetDoubleRef().Ref2; -if ( rRef2.IsTabRel() !rRef2.IsTabDeleted() ) +aAbs = rRef2.toAbs(aSrcPos); +if (!rRef2.IsTabDeleted()) { -if ( rRef2.nTab nMinTab ) -nMinTab = rRef2.nTab; -if ( rRef2.nTab nMaxTab ) -nMaxTab = rRef2.nTab; +if (aAbs.Tab() nMinTab) +nMinTab = aAbs.Tab(); +if (aAbs.Tab() nMaxTab) +nMaxTab = aAbs.Tab(); } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/filter/excel/xetable.cxx | 31 --- sc/source/filter/inc/xetable.hxx |2 +- 2 files changed, 17 insertions(+), 16 deletions(-) New commits: commit 02b610b53d697a2d5e15674fc79ceee5b7c75207 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jul 26 10:31:50 2013 -0400 Fix exporting of array formulas to xls. Change-Id: I366f5ef21353d64561d82b025c7919a1dbdb3422 diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 8694a49..9ef8202 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -148,23 +148,24 @@ XclExpArrayRef XclExpArrayBuffer::CreateArray( const ScTokenArray rScTokArr, co return rxRec; } -XclExpArrayRef XclExpArrayBuffer::FindArray( const ScTokenArray rScTokArr ) const +XclExpArrayRef XclExpArrayBuffer::FindArray( const ScTokenArray rScTokArr, const ScAddress rBasePos ) const { XclExpArrayRef xRec; // try to extract a matrix reference token -if( rScTokArr.GetLen() == 1 ) -{ -const formula::FormulaToken* pToken = rScTokArr.GetArray()[ 0 ]; -if( pToken (pToken-GetOpCode() == ocMatRef) ) -{ -const ScSingleRefData rRef = static_castconst ScToken*(pToken)-GetSingleRef(); -ScAddress aBasePos( rRef.nCol, rRef.nRow, GetCurrScTab() ); -XclExpArrayMap::const_iterator aIt = maRecMap.find( aBasePos ); -if( aIt != maRecMap.end() ) -xRec = aIt-second; -} -} -return xRec; +if (rScTokArr.GetLen() != 1) +// Must consist of a single reference token. +return xRec; + +const formula::FormulaToken* pToken = rScTokArr.GetArray()[0]; +if (!pToken || pToken-GetOpCode() != ocMatRef) +// not a matrix reference token. +return xRec; + +const ScSingleRefData rRef = static_castconst ScToken*(pToken)-GetSingleRef(); +ScAddress aAbsPos = rRef.toAbs(rBasePos); +XclExpArrayMap::const_iterator it = maRecMap.find(aAbsPos); + +return (it == maRecMap.end()) ? xRec : xRec = it-second; } // Shared formulas @@ -840,7 +841,7 @@ XclExpFormulaCell::XclExpFormulaCell( case MM_REFERENCE: { // other formula cell covered by a matrix - find the ARRAY record -mxAddRec = rArrayBfr.FindArray( rScTokArr ); +mxAddRec = rArrayBfr.FindArray(rScTokArr, aScPos); // should always be found, if Calc document is not broken OSL_ENSURE( mxAddRec, XclExpFormulaCell::XclExpFormulaCell - no matrix found ); } diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx index 655d6ea..533d2ec 100644 --- a/sc/source/filter/inc/xetable.hxx +++ b/sc/source/filter/inc/xetable.hxx @@ -135,7 +135,7 @@ public: /** Inserts a new ARRAY record into the buffer and returns it. */ XclExpArrayRef CreateArray( const ScTokenArray rScTokArr, const ScRange rScRange ); /** Tries to find an ARRAY record that corresponds to an ocMatRef token. */ -XclExpArrayRef FindArray( const ScTokenArray rScTokArr ) const; +XclExpArrayRef FindArray( const ScTokenArray rScTokArr, const ScAddress rBasePos ) const; private: typedef ::std::map ScAddress, XclExpArrayRef XclExpArrayMap; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/filter/excel/xechart.cxx | 20 ++-- sc/source/filter/excel/xeformula.cxx |8 sc/source/filter/excel/xelink.cxx| 32 sc/source/filter/excel/xichart.cxx | 10 +- sc/source/filter/inc/xelink.hxx |4 ++-- 5 files changed, 37 insertions(+), 37 deletions(-) New commits: commit 8dff0bd635701e2c7d0600778b4dc72782dcb353 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jul 26 15:52:53 2013 -0400 More on removing direct access to reference data members. Change-Id: I9bb682da0408df76794a1bbf9d48995cd1633d99 diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 92bb939..64e3f0d 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -941,20 +941,20 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference XDataSequence x { // split 3-dimensional ranges into single sheets const ScComplexRefData rComplexRef = static_cast const ScToken* ( pToken )-GetDoubleRef(); -const ScSingleRefData rRef1 = rComplexRef.Ref1; -const ScSingleRefData rRef2 = rComplexRef.Ref2; -for( SCsTAB nScTab = rRef1.nTab; nScTab = rRef2.nTab; ++nScTab ) +ScAddress aAbs1 = rComplexRef.Ref1.toAbs(ScAddress()); +ScAddress aAbs2 = rComplexRef.Ref2.toAbs(ScAddress()); +for (SCsTAB nScTab = aAbs1.Tab(); nScTab = aAbs2.Tab(); ++nScTab) { // split 2-dimensional ranges into single columns -if( bSplitToColumns (rRef1.nCol rRef2.nCol) (rRef1.nRow rRef2.nRow) ) -for( SCsCOL nScCol = rRef1.nCol; nScCol = rRef2.nCol; ++nScCol ) -lclAddDoubleRefData( aArray, *pToken, nScTab, nScCol, rRef1.nRow, nScTab, nScCol, rRef2.nRow ); +if (bSplitToColumns (aAbs1.Col() aAbs2.Col()) (aAbs1.Row() aAbs2.Row())) +for (SCCOL nScCol = aAbs1.Col(); nScCol = aAbs2.Col(); ++nScCol) +lclAddDoubleRefData(aArray, *pToken, nScTab, nScCol, aAbs1.Row(), nScTab, nScCol, aAbs2.Row()); else -lclAddDoubleRefData( aArray, *pToken, nScTab, rRef1.nCol, rRef1.nRow, nScTab, rRef2.nCol, rRef2.nRow ); +lclAddDoubleRefData(aArray, *pToken, nScTab, aAbs1.Col(), aAbs1.Row(), nScTab, aAbs2.Col(), aAbs2.Row()); } -sal_uInt32 nTabs = static_cast sal_uInt32 ( rRef2.nTab - rRef1.nTab + 1 ); -sal_uInt32 nCols = static_cast sal_uInt32 ( rRef2.nCol - rRef1.nCol + 1 ); -sal_uInt32 nRows = static_cast sal_uInt32 ( rRef2.nRow - rRef1.nRow + 1 ); +sal_uInt32 nTabs = static_castsal_uInt32(aAbs2.Tab() - aAbs1.Tab() + 1); +sal_uInt32 nCols = static_castsal_uInt32(aAbs2.Col() - aAbs1.Col() + 1); +sal_uInt32 nRows = static_castsal_uInt32(aAbs2.Row() - aAbs1.Row() + 1); nValueCount += nCols * nRows * nTabs; } break; diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 32d3d75..a803002 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -1879,8 +1879,8 @@ void XclExpFmlaCompImpl::ConvertRefData( { // convert start and end of the range ConvertRefData( rRefData.Ref1, rXclRange.maFirst, bNatLangRef, false, false ); -bool bTruncMaxCol = !rRefData.Ref1.IsColDeleted() (rRefData.Ref1.nCol == 0); -bool bTruncMaxRow = !rRefData.Ref1.IsRowDeleted() (rRefData.Ref1.nRow == 0); +bool bTruncMaxCol = !rRefData.Ref1.IsColDeleted() (rXclRange.maFirst.mnCol == 0); +bool bTruncMaxRow = !rRefData.Ref1.IsRowDeleted() (rXclRange.maFirst.mnRow == 0); ConvertRefData( rRefData.Ref2, rXclRange.maLast, bNatLangRef, bTruncMaxCol, bTruncMaxRow ); } @@ -1916,7 +1916,7 @@ void XclExpFmlaCompImpl::ProcessCellRef( const XclExpScToken rTokData ) { // store external cell contents in CRN records if( mxData-mrCfg.mbFromCell mxData-mpLinkMgr mxData-mpScBasePos ) -mxData-mpLinkMgr-StoreCell( aRefData ); +mxData-mpLinkMgr-StoreCell(aRefData, *mxData-mpScBasePos); // create the tRef, tRefErr, tRefN, tRef3d, or tRefErr3d token if( !mxData-mrCfg.mb3DRefOnly IsRef2D( aRefData ) ) @@ -1961,7 +1961,7 @@ void XclExpFmlaCompImpl::ProcessRangeRef( const XclExpScToken rTokData ) // store external cell contents in CRN records if( mxData-mrCfg.mbFromCell mxData-mpLinkMgr mxData-mpScBasePos ) -mxData-mpLinkMgr-StoreCellRange( aRefData ); +mxData-mpLinkMgr-StoreCellRange(aRefData, *mxData-mpScBasePos); // create the tArea, tAreaErr, tAreaN, tArea3d, or tAreaErr3d token
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/filter/excel/xetable.cxx |2 +- sc/source/filter/excel/xlformula.cxx | 17 + sc/source/filter/inc/xlformula.hxx |2 +- sc/source/filter/lotus/tool.cxx | 15 --- 4 files changed, 19 insertions(+), 17 deletions(-) New commits: commit a03cf8933c7a1060bc43acaa5cc1c1a434916dca Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jul 26 16:12:07 2013 -0400 More of the same. Change-Id: I29c60f2f7a31b69b224d4c910392c88990b48572 diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 9ef8202..99313ea 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -399,7 +399,7 @@ XclExpTableopRef XclExpTableopBuffer::CreateOrExtendTableop( // try to extract cell references of a multiple operations formula XclMultipleOpRefs aRefs; -if( XclTokenArrayHelper::GetMultipleOpRefs( aRefs, rScTokArr ) ) +if (XclTokenArrayHelper::GetMultipleOpRefs(aRefs, rScTokArr, rScPos)) { // try to find an existing TABLEOP record for this cell position for( size_t nPos = 0, nSize = maTableopList.GetSize(); !xRec (nPos nSize); ++nPos ) diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index 337b971..94d9594 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -780,14 +780,14 @@ const ScTokenArray* XclTokenArrayHelper::GetSharedFormula( const XclRoot rRoot, namespace { -inline bool lclGetAddress( ScAddress rAddress, const FormulaToken rToken ) +inline bool lclGetAddress( ScAddress rAddress, const FormulaToken rToken, const ScAddress rPos ) { OpCode eOpCode = rToken.GetOpCode(); bool bIsSingleRef = (eOpCode == ocPush) (rToken.GetType() == svSingleRef); if( bIsSingleRef ) { const ScSingleRefData rRef = static_castconst ScToken(rToken).GetSingleRef(); -rAddress.Set( rRef.nCol, rRef.nRow, rRef.nTab ); +rAddress = rRef.toAbs(rPos); bIsSingleRef = !rRef.IsDeleted(); } return bIsSingleRef; @@ -795,7 +795,8 @@ inline bool lclGetAddress( ScAddress rAddress, const FormulaToken rToken ) } // namespace -bool XclTokenArrayHelper::GetMultipleOpRefs( XclMultipleOpRefs rRefs, const ScTokenArray rScTokArr ) +bool XclTokenArrayHelper::GetMultipleOpRefs( +XclMultipleOpRefs rRefs, const ScTokenArray rScTokArr, const ScAddress rScPos ) { rRefs.mbDblRefMode = false; enum @@ -817,32 +818,32 @@ bool XclTokenArrayHelper::GetMultipleOpRefs( XclMultipleOpRefs rRefs, const ScT eState = (eOpCode == ocOpen) ? stOpen : stError; break; case stOpen: -eState = lclGetAddress( rRefs.maFmlaScPos, *aIt ) ? stFormula : stError; +eState = lclGetAddress(rRefs.maFmlaScPos, *aIt, rScPos) ? stFormula : stError; break; case stFormula: eState = bIsSep ? stFormulaSep : stError; break; case stFormulaSep: -eState = lclGetAddress( rRefs.maColFirstScPos, *aIt ) ? stColFirst : stError; +eState = lclGetAddress(rRefs.maColFirstScPos, *aIt, rScPos) ? stColFirst : stError; break; case stColFirst: eState = bIsSep ? stColFirstSep : stError; break; case stColFirstSep: -eState = lclGetAddress( rRefs.maColRelScPos, *aIt ) ? stColRel : stError; +eState = lclGetAddress(rRefs.maColRelScPos, *aIt, rScPos) ? stColRel : stError; break; case stColRel: eState = bIsSep ? stColRelSep : ((eOpCode == ocClose) ? stClose : stError); break; case stColRelSep: -eState = lclGetAddress( rRefs.maRowFirstScPos, *aIt ) ? stRowFirst : stError; +eState = lclGetAddress(rRefs.maRowFirstScPos, *aIt, rScPos) ? stRowFirst : stError; rRefs.mbDblRefMode = true; break; case stRowFirst: eState = bIsSep ? stRowFirstSep : stError; break; case stRowFirstSep: -eState = lclGetAddress( rRefs.maRowRelScPos, *aIt ) ? stRowRel : stError; +eState = lclGetAddress(rRefs.maRowRelScPos, *aIt, rScPos) ? stRowRel : stError; break; case stRowRel: eState = (eOpCode == ocClose) ? stClose : stError; diff --git a/sc/source/filter/inc/xlformula.hxx b/sc/source/filter/inc/xlformula.hxx index 7768769..fdf395e 100644 --- a/sc/source/filter/inc/xlformula.hxx +++ b/sc/source/filter/inc/xlformula.hxx @@ -537,7 +537,7 @@ public: @descr Requires that the formula contains a single MULTIPLE.OPERATION function call. Spaces in the formula are silently ignored. @return true = Multiple operation found, and all references
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/table2.cxx |5 -- sc/source/core/data/table3.cxx | 12 ++--- sc/source/core/tool/token.cxx |6 +- sc/source/filter/excel/excform.cxx | 14 ++--- sc/source/filter/excel/excform8.cxx | 14 ++--- sc/source/filter/excel/frmbase.cxx | 85 +--- sc/source/filter/inc/formel.hxx |4 - 7 files changed, 67 insertions(+), 73 deletions(-) New commits: commit 311d4726572ce9c439288f198cb7373576fac2a1 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jul 26 23:06:06 2013 -0400 More of the same. Will this ever end, I'm starting to wonder... Change-Id: I36bc90e8477cba306e107fb6d6e47f5732161df8 diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 5bbb6d3..ebbd7fb 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -971,10 +971,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScAddress aDestPos( static_castSCCOL(nRow-nRow1), static_castSCROW(nCol-nCol1), pTransClip-nTab ); ScSingleRefData aRef; -aRef.nCol = nCol; -aRef.nRow = nRow; -aRef.nTab = nTab; -aRef.InitFlags(); // - all absolute +aRef.InitAddress(ScAddress(nCol,nRow,nTab)); aRef.SetFlag3D(true); ScTokenArray aArr; aArr.AddSingleReference( aRef ); diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 9971816..60df260 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1107,8 +1107,8 @@ bool ScTable::DoSubTotals( ScSubTotalParam rParam ) // now insert the formulas ScComplexRefData aRef; aRef.InitFlags(); -aRef.Ref1.nTab = nTab; -aRef.Ref2.nTab = nTab; +aRef.Ref1.SetAbsTab(nTab); +aRef.Ref2.SetAbsTab(nTab); for ( ::std::vector RowEntry ::const_iterator iEntry( aRowVector.begin()); iEntry != aRowVector.end(); ++iEntry) { @@ -1117,10 +1117,10 @@ bool ScTable::DoSubTotals( ScSubTotalParam rParam ) ScSubTotalFunc* eResFunc = rParam.pFunctions[iEntry-nGroupNo]; for ( SCCOL nResult=0; nResult nResCount; ++nResult ) { -aRef.Ref1.nCol = nResCols[nResult]; -aRef.Ref1.nRow = iEntry-nFuncStart; -aRef.Ref2.nCol = nResCols[nResult]; -aRef.Ref2.nRow = iEntry-nFuncEnd; +aRef.Ref1.SetAbsCol(nResCols[nResult]); +aRef.Ref1.SetAbsRow(iEntry-nFuncStart); +aRef.Ref2.SetAbsCol(nResCols[nResult]); +aRef.Ref2.SetAbsRow(iEntry-nFuncEnd); ScTokenArray aArr; aArr.AddOpCode( ocSubTotal ); diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index a46d33e..df54e8f 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -2070,13 +2070,13 @@ void AdjustSingleRefData( ScSingleRefData rRef, const ScAddress rOldPos, const SCsTAB nTabs = rNewPos.Tab() - rOldPos.Tab(); if (!rRef.IsColRel()) -rRef.nCol += nCols; +rRef.IncCol(nCols); if (!rRef.IsRowRel()) -rRef.nRow += nRows; +rRef.IncRow(nRows); if (!rRef.IsTabRel()) -rRef.nTab += nTabs; +rRef.IncTab(nTabs); } } diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index ec9817d..7918bad 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -1037,7 +1037,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs rRangeList, XclImpStream aIn, sal ExcRelToScRel( nUINT16, nByte, aSRD, bRangeName ); -rRangeList.Append( aSRD, nTab ); +rRangeList.Append(aSRD.toAbs(aEingPos), nTab); break; case 0x45: case 0x65: @@ -1063,7 +1063,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs rRangeList, XclImpStream aIn, sal else if( IsComplRowRange( nRowFirst, nRowLast ) ) SetComplRow( aCRD ); -rRangeList.Append( aCRD, nTab ); +rRangeList.Append(aCRD.toAbs(aEingPos), nTab); } break; case 0x46: @@ -1099,7 +1099,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs rRangeList, XclImpStream aIn, sal ExcRelToScRel( nUINT16, nByte, aSRD, bRNorSF ); -rRangeList.Append( aSRD, nTab ); +rRangeList.Append(aSRD.toAbs(aEingPos), nTab); } break; case 0x4D: @@ -1124,7 +1124,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs rRangeList, XclImpStream aIn, sal else if( IsComplRowRange( nRowFirst, nRowLast ) ) SetComplRow( aCRD ); -rRangeList.Append( aCRD, nTab ); +
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx |1 - sc/source/core/data/table2.cxx |1 - sc/source/core/tool/consoli.cxx | 16 ++-- 3 files changed, 6 insertions(+), 12 deletions(-) New commits: commit 3346bbca14734129ddd1900570b1c28afcc553db Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 23 09:50:10 2013 -0400 More on removing use of CalcRelFromAbs(). Some of them were called for all absolute references, which is not necessary. Change-Id: If19ee74731f40ca208e1cc1804c6b6e53073d891 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 83592fe..1e0ec16 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -920,7 +920,6 @@ void ScColumn::CopyFromClip( aRef.nRow = nDestRow - nDy; // Source row aDestPos.SetRow( nDestRow ); -aRef.CalcRelFromAbs( aDestPos ); ScTokenArray aArr; aArr.AddSingleReference( aRef ); SetFormulaCell(nDestRow, new ScFormulaCell(pDocument, aDestPos, aArr)); diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index f54912b..96839f1 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -975,7 +975,6 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, aRef.nTab = nTab; aRef.InitFlags(); // - all absolute aRef.SetFlag3D(true); -aRef.CalcRelFromAbs( aDestPos ); ScTokenArray aArr; aArr.AddSingleReference( aRef ); diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx index 5f05383..f7795ca 100644 --- a/sc/source/core/tool/consoli.cxx +++ b/sc/source/core/tool/consoli.cxx @@ -708,8 +708,8 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, String aString; ScSingleRefData aSRef; // Daten fuer Referenz-Formelzellen -aSRef.InitFlags(); -aSRef.SetFlag3D(sal_True); +aSRef.InitFlags(); // This reference is absolute at all times. +aSRef.SetFlag3D(true); ScComplexRefData aCRef; // Daten fuer Summen-Zellen aCRef.InitFlags(); @@ -741,9 +741,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, { // Referenz einfuegen (absolut, 3d) -aSRef.nCol = aRef.nCol; -aSRef.nRow = aRef.nRow; -aSRef.nTab = aRef.nTab; + aSRef.SetAddress(ScAddress(aRef.nCol,aRef.nRow,aRef.nTab), ScAddress()); ScTokenArray aRefArr; aRefArr.AddSingleReference(aSRef); @@ -760,11 +758,9 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, ScAddress aDest( sal::static_int_castSCCOL(nCol+nArrX), sal::static_int_castSCROW(nRow+nArrY+nNeeded), nTab ); -aCRef.Ref1.nTab = aCRef.Ref2.nTab = nTab; -aCRef.Ref1.nCol = aCRef.Ref2.nCol = sal::static_int_castSCsCOL( nCol+nArrX ); -aCRef.Ref1.nRow = nRow+nArrY; -aCRef.Ref2.nRow = nRow+nArrY+nNeeded-1; -aCRef.CalcRelFromAbs( aDest ); +ScRange aRange(sal::static_int_castSCCOL(nCol+nArrX), nRow+nArrY, nTab); +aRange.aEnd.SetRow(nRow+nArrY+nNeeded-1); +aCRef.SetRange(aRange, aDest); ScTokenArray aArr; aArr.AddOpCode(eOpCode);// ausgewaehlte Funktion ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit 268d00ef10f0abbd2c40f2b5ecdf2c0aa1f37251 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 22 20:30:29 2013 -0400 Modified reference shouldn't make the cell dirty. The 'value changed' flag is there for that purpose. Modified reference alone doesn't change the value of the cell. Change-Id: I9d7b4c7005603cd7bed8d90901f1fab0e0d49008 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index a99041d..63d2c9b 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2267,18 +2267,18 @@ bool ScFormulaCell::UpdateReferenceOnShift( pOldCode.reset(pCode-Clone()); bool bValChanged = false; -bool bRangeModified = false;// any range, not only shared formula +bool bRefModified = false; bool bRefSizeChanged = false; if (bHasRefs) { // Update cell or range references. sc::RefUpdateResult aRes = pCode-AdjustReferenceOnShift(rCxt, aOldPos); -bRangeModified = aRes.mbReferenceModified; +bRefModified = aRes.mbReferenceModified; bValChanged = aRes.mbValueChanged; } -if (bValChanged || bRangeModified) +if (bValChanged || bRefModified) bCellStateChanged = true; if (bOnRefMove) @@ -2304,7 +2304,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( bHasRelName = HasRelNameReference(); // Reference changed and new listening needed? // Except in Insert/Delete without specialties. -bNewListening = (bRangeModified || bColRowNameCompile +bNewListening = (bRefModified || bColRowNameCompile || (bValChanged (bInDeleteUndo || bRefSizeChanged)) || bHasRelName); if ( bNewListening ) @@ -2312,12 +2312,12 @@ bool ScFormulaCell::UpdateReferenceOnShift( } // NeedDirty for changes except for Copy and Move/Insert without RelNames -bool bNeedDirty = (bRangeModified || bValChanged || bColRowNameCompile || bOnRefMove); +bool bNeedDirty = (bValChanged || bColRowNameCompile || bOnRefMove); if (pUndoDoc (bValChanged || bOnRefMove)) setOldCodeToUndo(pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag); -if ( ( bCompile = (bCompile || bRangeModified || bColRowNameCompile) ) != 0 ) +if ( (bCompile = (bCompile || bColRowNameCompile)) != 0 ) { CompileTokenArray( bNewListening ); // no Listening bNeedDirty = true; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/compiler.cxx | 18 ++-- sc/source/core/tool/token.cxx| 56 +++ 2 files changed, 31 insertions(+), 43 deletions(-) New commits: commit cd4cd0bb0b68d92998148b83bdf8c9b98970f2ce Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jul 19 23:22:42 2013 -0400 More on removing use of CalcAbsIfRel(). Change-Id: I7706148d3a7376ca9b0c0d9c907559b384d57f14 diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 0f4f484..f778321 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4989,10 +4989,10 @@ void ScCompiler::CreateStringFromSingleRef(OUStringBuffer rBuffer,FormulaToken* aRef.Ref1 = aRef.Ref2 = rRef; if ( eOp == ocColRowName ) { -rRef.CalcAbsIfRel( aPos ); -if ( pDoc-HasStringData( rRef.nCol, rRef.nRow, rRef.nTab ) ) +ScAddress aAbs = rRef.toAbs(aPos); +if (pDoc-HasStringData(aAbs.Col(), aAbs.Row(), aAbs.Tab())) { -String aStr = pDoc-GetString(rRef.nCol, rRef.nRow, rRef.nTab); +String aStr = pDoc-GetString(aAbs); EnQuote( aStr ); rBuffer.append(aStr); } @@ -5111,16 +5111,16 @@ void ScCompiler::fillAddInToken(::std::vector ::com::sun::star::sheet::FormulaO bool ScCompiler::HandleSingleRef() { ScSingleRefData rRef = static_castScToken*(mpToken.get())-GetSingleRef(); -rRef.CalcAbsIfRel( aPos ); -if ( !rRef.Valid() ) +ScAddress aAbs = rRef.toAbs(aPos); +if (!ValidAddress(aAbs)) { SetError( errNoRef ); return true; } -SCCOL nCol = rRef.nCol; -SCROW nRow = rRef.nRow; -SCTAB nTab = rRef.nTab; -ScAddress aLook( nCol, nRow, nTab ); +SCCOL nCol = aAbs.Col(); +SCROW nRow = aAbs.Row(); +SCTAB nTab = aAbs.Tab(); +ScAddress aLook = aAbs; bool bColName = rRef.IsColRel(); SCCOL nMyCol = aPos.Col(); SCROW nMyRow = aPos.Row(); diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 6595881..0d3ff6b 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1890,40 +1890,34 @@ bool ScTokenArray::GetAdjacentExtendOfOuterFuncRefs( SCCOLROW nExtend, case svSingleRef : { ScSingleRefData rRef = static_castScToken*(p)-GetSingleRef(); -rRef.CalcAbsIfRel( rPos ); +ScAddress aAbs = rRef.toAbs(rPos); switch ( eDir ) { case DIR_BOTTOM : -if ( rRef.nRow == nRow - rRef.nRow nExtend ) +if (aAbs.Row() == nRow aAbs.Row() nExtend) { -nExtend = rRef.nRow; +nExtend = aAbs.Row(); bRet = true; } break; case DIR_RIGHT : -if ( rRef.nCol == nCol - static_castSCCOLROW(rRef.nCol) - nExtend ) +if (aAbs.Col() == nCol static_castSCCOLROW(aAbs.Col()) nExtend) { -nExtend = rRef.nCol; +nExtend = aAbs.Col(); bRet = true; } break; case DIR_TOP : -if ( rRef.nRow == nRow - rRef.nRow nExtend ) +if (aAbs.Row() == nRow aAbs.Row() nExtend) { -nExtend = rRef.nRow; +nExtend = aAbs.Row(); bRet = true; } break; case DIR_LEFT : -if ( rRef.nCol == nCol - static_castSCCOLROW(rRef.nCol) - nExtend ) +if (aAbs.Col() == nCol static_castSCCOLROW(aAbs.Col()) nExtend) { -nExtend = rRef.nCol; +nExtend = aAbs.Col(); bRet = true;
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 69 ++-- 1 file changed, 21 insertions(+), 48 deletions(-) New commits: commit fd9466df2c2d2c758baee9937c826be752c876a6 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jul 17 22:16:01 2013 -0400 Remove duplicated code blocks. Change-Id: Id540cf0b2884d4bbff80be11139ff3621bbb8c4d diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index aa03600..dc6570b 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2202,6 +2202,24 @@ bool checkCompileColRowName( return false; } +void setOldCodeToUndo( +ScDocument* pUndoDoc, const ScAddress aUndoPos, ScTokenArray* pOldCode, FormulaGrammar::Grammar eTempGrammar, sal_uInt8 cMatrixFlag) +{ +// Copy the cell to aUndoPos, which is its current position in the document, +// so this works when UpdateReference is called before moving the cells +// (InsertCells/DeleteCells - aPos is changed above) as well as when UpdateReference +// is called after moving the cells (MoveBlock/PasteFromClip - aOldPos is changed). + +// If there is already a formula cell in the undo document, don't overwrite it, +// the first (oldest) is the important cell. +if (pUndoDoc-GetCellType(aUndoPos) == CELLTYPE_FORMULA) +return; + +ScFormulaCell* pFCell = new ScFormulaCell(pUndoDoc, aUndoPos, pOldCode, eTempGrammar, cMatrixFlag); +pFCell-SetResultToken(NULL); // to recognize it as changed later (Cut/Paste!) +pUndoDoc-SetFormulaCell(aUndoPos, pFCell); +} + } bool ScFormulaCell::UpdateReferenceOnShift( @@ -2313,22 +2331,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( bNeedDirty = true; if (pUndoDoc (bValChanged || pSharedCode || bOnRefMove)) -{ -// Copy the cell to aUndoPos, which is its current position in the document, -// so this works when UpdateReference is called before moving the cells -// (InsertCells/DeleteCells - aPos is changed above) as well as when UpdateReference -// is called after moving the cells (MoveBlock/PasteFromClip - aOldPos is changed). - -// If there is already a formula cell in the undo document, don't overwrite it, -// the first (oldest) is the important cell. -if ( pUndoDoc-GetCellType( aUndoPos ) != CELLTYPE_FORMULA ) -{ -ScFormulaCell* pFCell = new ScFormulaCell( pUndoDoc, aUndoPos, -pOldCode.get(), eTempGrammar, cMatrixFlag ); -pFCell-aResult.SetToken( NULL); // to recognize it as changed later (Cut/Paste!) -pUndoDoc-SetFormulaCell(aUndoPos, pFCell); -} -} +setOldCodeToUndo(pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag); bValChanged = false; @@ -2487,22 +2490,7 @@ bool ScFormulaCell::UpdateReferenceOnMove( bNeedDirty = true; if (pUndoDoc (bValChanged || pSharedCode || bOnRefMove)) -{ -// Copy the cell to aUndoPos, which is its current position in the document, -// so this works when UpdateReference is called before moving the cells -// (InsertCells/DeleteCells - aPos is changed above) as well as when UpdateReference -// is called after moving the cells (MoveBlock/PasteFromClip - aOldPos is changed). - -// If there is already a formula cell in the undo document, don't overwrite it, -// the first (oldest) is the important cell. -if ( pUndoDoc-GetCellType( aUndoPos ) != CELLTYPE_FORMULA ) -{ -ScFormulaCell* pFCell = new ScFormulaCell( pUndoDoc, aUndoPos, -pOldCode.get(), eTempGrammar, cMatrixFlag ); -pFCell-aResult.SetToken( NULL); // to recognize it as changed later (Cut/Paste!) -pUndoDoc-SetFormulaCell(aUndoPos, pFCell); -} -} +setOldCodeToUndo(pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag); bValChanged = false; @@ -2650,22 +2638,7 @@ bool ScFormulaCell::UpdateReferenceOnCopy( bNeedDirty = true; if (pUndoDoc (bValChanged || pSharedCode || bOnRefMove)) -{ -// Copy the cell to aUndoPos, which is its current position in the document, -// so this works when UpdateReference is called before moving the cells -// (InsertCells/DeleteCells - aPos is changed above) as well as when UpdateReference -// is called after moving the cells (MoveBlock/PasteFromClip - aOldPos is changed). - -// If there is already a formula cell in the undo document, don't overwrite it, -// the first (oldest) is the important cell. -if ( pUndoDoc-GetCellType( aUndoPos ) != CELLTYPE_FORMULA ) -{ -ScFormulaCell* pFCell = new ScFormulaCell( pUndoDoc, aUndoPos, -pOldCode.get(), eTempGrammar, cMatrixFlag ); -pFCell-aResult.SetToken( NULL); // to recognize it as
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 63 +--- 1 file changed, 24 insertions(+), 39 deletions(-) New commits: commit 5d9dee15464c46bdfa44e49d03b309db5119fa4b Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jul 17 22:43:06 2013 -0400 Use constants from the context object directly. Change-Id: Ieb2c7c2f795bc1a56197617cf69dd34a04b4beb1 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 8e8ef5c..08ea44b 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2229,21 +2229,17 @@ bool ScFormulaCell::UpdateReferenceOnShift( // Just in case... return false; -const ScRange rRange = rCxt.maRange; -SCCOL nDx = rCxt.mnColDelta; -SCROW nDy = rCxt.mnRowDelta; -SCTAB nDz = rCxt.mnTabDelta; ScAddress aUndoPos( aPos ); // position for undo cell in pUndoDoc if ( pUndoCellPos ) aUndoPos = *pUndoCellPos; -if (rRange.In(aPos)) +if (rCxt.maRange.In(aPos)) { // This formula cell itself is being shifted during cell range // insertion or deletion. Update its position. -aPos.Move(nDx, nDy, nDz); +aPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); if (xGroup xGroup-mnStart == aPos.Row()) -xGroup-mnStart += nDy; +xGroup-mnStart += rCxt.mnRowDelta; } // Check presence of any references or column row names. @@ -2278,9 +2274,9 @@ bool ScFormulaCell::UpdateReferenceOnShift( // Update cell or range references. ScCompiler aComp(pDocument, aPos, *pCode); aComp.SetGrammar(pDocument-GetGrammar()); -pSharedCode = aComp.UpdateReference(URM_INSDEL, aPos, rRange, - nDx, nDy, nDz, - bValChanged, bRefSizeChanged); +pSharedCode = aComp.UpdateReference( +URM_INSDEL, aPos, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, +bValChanged, bRefSizeChanged); bRangeModified = aComp.HasModifiedRange(); } @@ -2336,7 +2332,8 @@ bool ScFormulaCell::UpdateReferenceOnShift( ScCompiler::MoveRelWrap(*pCode, pDocument, aPos, pSharedCode-GetMaxCol(), pSharedCode-GetMaxRow()); ScCompiler aComp2(pDocument, aPos, *pCode); aComp2.SetGrammar(pDocument-GetGrammar()); -aComp2.UpdateSharedFormulaReference(URM_INSDEL, aPos, rRange, nDx, nDy, nDz); +aComp2.UpdateSharedFormulaReference( +URM_INSDEL, aPos, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); bValChanged = true; bNeedDirty = true; } @@ -2375,25 +2372,18 @@ bool ScFormulaCell::UpdateReferenceOnMove( if (rCxt.meMode != URM_MOVE) return false; -const ScRange rRange = rCxt.maRange; -SCCOL nDx = rCxt.mnColDelta; -SCROW nDy = rCxt.mnRowDelta; -SCTAB nDz = rCxt.mnTabDelta; -SCCOL nCol = aPos.Col(); -SCROW nRow = aPos.Row(); -SCTAB nTab = aPos.Tab(); ScAddress aUndoPos( aPos ); // position for undo cell in pUndoDoc if ( pUndoCellPos ) aUndoPos = *pUndoCellPos; ScAddress aOldPos( aPos ); -if (rRange.In(aPos)) +if (rCxt.maRange.In(aPos)) { // The cell is being moved or copied to a new position. I guess the // position has been updated prior to this call? Determine // its original position before the move which will be used to adjust // relative references later. -aOldPos.Set( nCol - nDx, nRow - nDy, nTab - nDz ); +aOldPos.Set(aPos.Col() - rCxt.mnColDelta, aPos.Row() - rCxt.mnRowDelta, aPos.Tab() - rCxt.mnTabDelta); } @@ -2429,9 +2419,10 @@ bool ScFormulaCell::UpdateReferenceOnMove( // Update cell or range references. ScCompiler aComp(pDocument, aPos, *pCode); aComp.SetGrammar(pDocument-GetGrammar()); -pSharedCode = aComp.UpdateReference(URM_MOVE, aOldPos, rRange, - nDx, nDy, nDz, - bValChanged, bRefSizeChanged); +pSharedCode = aComp.UpdateReference( +URM_MOVE, aOldPos, rCxt.maRange, +rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, +bValChanged, bRefSizeChanged); bRangeModified = aComp.HasModifiedRange(); } @@ -2465,7 +2456,7 @@ bool ScFormulaCell::UpdateReferenceOnMove( // #i36299# Don't duplicate action during cutpaste / dragdrop // on a cell in the range moved, start/end listeners is done // via ScDocument::DeleteArea() and ScDocument::CopyFromClip(). - !(pDocument-IsInsertingFromOtherDoc() rRange.In(aPos)); + !(pDocument-IsInsertingFromOtherDoc() rCxt.maRange.In(aPos)); if ( bNewListening ) EndListeningTo(pDocument, pOldCode.get(),
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) New commits: commit 7dbd20530e95e77a3d7f850d832fed8be883220e Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jul 17 23:26:53 2013 -0400 Revert old position == current position during cell insertion / deletion. This reverts commit 58df2af4afd82cb23e29de6623a58da3fb3f53f5. Conflicts: sc/source/core/data/formulacell.cxx Change-Id: I9bb1b3eef426e02dcbe83c850c34e520be381c71 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 1bafd7b..f74231a 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2229,17 +2229,21 @@ bool ScFormulaCell::UpdateReferenceOnShift( // Just in case... return false; +bool bCellStateChanged = false; ScAddress aUndoPos( aPos ); // position for undo cell in pUndoDoc if ( pUndoCellPos ) aUndoPos = *pUndoCellPos; +ScAddress aOldPos( aPos ); if (rCxt.maRange.In(aPos)) { // This formula cell itself is being shifted during cell range // insertion or deletion. Update its position. aPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); -if (xGroup xGroup-mnStart == aPos.Row()) +if (xGroup xGroup-mnStart == aOldPos.Row()) xGroup-mnStart += rCxt.mnRowDelta; + +bCellStateChanged = aPos != aOldPos; } // Check presence of any references or column row names. @@ -2257,9 +2261,8 @@ bool ScFormulaCell::UpdateReferenceOnShift( if (!bHasRefs !bOnRefMove) // This formula cell contains no references, nor needs recalculating // on reference update. Bail out. -return false; +return bCellStateChanged; -bool bCellStateChanged = false; boost::scoped_ptrScTokenArray pOldCode; if (pUndoDoc) pOldCode.reset(pCode-Clone()); @@ -2274,7 +2277,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( ScCompiler aComp(pDocument, aPos, *pCode); aComp.SetGrammar(pDocument-GetGrammar()); aComp.UpdateReference( -URM_INSDEL, aPos, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, +URM_INSDEL, aOldPos, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, bValChanged, bRefSizeChanged); bRangeModified = aComp.HasModifiedRange(); } @@ -2283,7 +2286,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( if (bOnRefMove) // Cell may reference itself, e.g. ocColumn, ocRow without parameter -bOnRefMove = bValChanged; +bOnRefMove = (bValChanged || (aPos != aOldPos)); bool bColRowNameCompile = false; bool bHasRelName = false; @@ -2295,7 +2298,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( // Upon Insert ColRowNames have to be recompiled in case the // insertion occurs right in front of the range. if (bHasColRowNames) -bColRowNameCompile = checkCompileColRowName(rCxt, *pDocument, *pCode, aPos, aPos, bValChanged); +bColRowNameCompile = checkCompileColRowName(rCxt, *pDocument, *pCode, aOldPos, aPos, bValChanged); ScChangeTrack* pChangeTrack = pDocument-GetChangeTrack(); bInDeleteUndo = (pChangeTrack pChangeTrack-IsInDeleteUndo()); @@ -2308,7 +2311,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( || (bValChanged (bInDeleteUndo || bRefSizeChanged)) || bHasRelName); if ( bNewListening ) -EndListeningTo(pDocument, pOldCode.get(), aPos); +EndListeningTo(pDocument, pOldCode.get(), aOldPos); } bool bNeedDirty = false; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 132 ++-- 1 file changed, 66 insertions(+), 66 deletions(-) New commits: commit 03464912c911eedba5a540ccab603294373ea747 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 16 10:21:47 2013 -0400 More on the quest to eliminate CalcAbsIfRel(). Change-Id: I5f20752896825d40a8fc3773d5ecb76bd7c53b46 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 41a53f1..6a77c715 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -48,7 +48,6 @@ #include types.hxx #include scopetools.hxx -#include boost/bind.hpp #include boost/scoped_ptr.hpp using namespace formula; @@ -70,24 +69,24 @@ const sal_uInt16 MAXRECURSION = 400; using std::deque; -typedef SCCOLROW(*DimensionSelector)(const ScSingleRefData); +typedef SCCOLROW(*DimensionSelector)(const ScAddress, const ScSingleRefData); -static SCCOLROW lcl_GetCol(const ScSingleRefData rData) +static SCCOLROW lcl_GetCol(const ScAddress rPos, const ScSingleRefData rData) { -return rData.nCol; +return rData.toAbs(rPos).Col(); } -static SCCOLROW lcl_GetRow(const ScSingleRefData rData) +static SCCOLROW lcl_GetRow(const ScAddress rPos, const ScSingleRefData rData) { -return rData.nRow; +return rData.toAbs(rPos).Row(); } -static SCCOLROW lcl_GetTab(const ScSingleRefData rData) +static SCCOLROW lcl_GetTab(const ScAddress rPos, const ScSingleRefData rData) { -return rData.nTab; +return rData.toAbs(rPos).Tab(); } @@ -95,25 +94,22 @@ static SCCOLROW lcl_GetTab(const ScSingleRefData rData) */ static bool lcl_checkRangeDimension( -const SingleDoubleRefProvider rRef1, -const SingleDoubleRefProvider rRef2, -const DimensionSelector aWhich) +const ScAddress rPos, const SingleDoubleRefProvider rRef1, const SingleDoubleRefProvider rRef2, +const DimensionSelector aWhich) { -return -aWhich(rRef1.Ref1) == aWhich(rRef2.Ref1) - aWhich(rRef1.Ref2) == aWhich(rRef2.Ref2); +return aWhich(rPos, rRef1.Ref1) == aWhich(rPos, rRef2.Ref1) +aWhich(rPos, rRef1.Ref2) == aWhich(rPos, rRef2.Ref2); } static bool lcl_checkRangeDimensions( -const SingleDoubleRefProvider rRef1, -const SingleDoubleRefProvider rRef2, -bool bCol, bool bRow, bool bTab) +const ScAddress rPos, const SingleDoubleRefProvider rRef1, const SingleDoubleRefProvider rRef2, +bool bCol, bool bRow, bool bTab) { -const bool bSameCols(lcl_checkRangeDimension(rRef1, rRef2, lcl_GetCol)); -const bool bSameRows(lcl_checkRangeDimension(rRef1, rRef2, lcl_GetRow)); -const bool bSameTabs(lcl_checkRangeDimension(rRef1, rRef2, lcl_GetTab)); +const bool bSameCols(lcl_checkRangeDimension(rPos, rRef1, rRef2, lcl_GetCol)); +const bool bSameRows(lcl_checkRangeDimension(rPos, rRef1, rRef2, lcl_GetRow)); +const bool bSameTabs(lcl_checkRangeDimension(rPos, rRef1, rRef2, lcl_GetTab)); // Test if exactly two dimensions are equal if (!(bSameCols ^ bSameRows ^ bSameTabs) @@ -133,9 +129,10 @@ lcl_checkRangeDimensions( */ static bool lcl_checkRangeDimensions( -const dequeScToken*::const_iterator aBegin, -const dequeScToken*::const_iterator aEnd, -bool bCol, bool bRow, bool bTab) +const ScAddress rPos, +const dequeScToken*::const_iterator aBegin, +const dequeScToken*::const_iterator aEnd, +bool bCol, bool bRow, bool bTab) { dequeScToken*::const_iterator aCur(aBegin); ++aCur; @@ -143,7 +140,7 @@ lcl_checkRangeDimensions( bool bOk(false); { const SingleDoubleRefProvider aRefCur(**aCur); -bOk = lcl_checkRangeDimensions(aRef, aRefCur, bCol, bRow, bTab); +bOk = lcl_checkRangeDimensions(rPos, aRef, aRefCur, bCol, bRow, bTab); } while (bOk aCur != aEnd) { @@ -151,7 +148,7 @@ lcl_checkRangeDimensions( bool bColTmp(false); bool bRowTmp(false); bool bTabTmp(false); -bOk = lcl_checkRangeDimensions(aRef, aRefCur, bColTmp, bRowTmp, bTabTmp); +bOk = lcl_checkRangeDimensions(rPos, aRef, aRefCur, bColTmp, bRowTmp, bTabTmp); bOk = bOk (bCol == bColTmp bRow == bRowTmp bTab == bTabTmp); ++aCur; } @@ -163,81 +160,84 @@ lcl_checkRangeDimensions( return false; } - -bool -lcl_lessReferenceBy( -const ScToken* const pRef1, const ScToken* const pRef2, -const DimensionSelector aWhich) +class LessByReference : std::binary_functionconst ScToken*, const ScToken*, bool { -const SingleDoubleRefProvider rRef1(*pRef1); -const SingleDoubleRefProvider rRef2(*pRef2); -return aWhich(rRef1.Ref1) aWhich(rRef2.Ref1); -} +ScAddress maPos; +DimensionSelector maFunc; +public: +LessByReference(const ScAddress rPos, const DimensionSelector rFunc) : +maPos(rPos), maFunc(rFunc) {} +bool operator() (const
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/interpr2.cxx | 43 +++ 1 file changed, 21 insertions(+), 22 deletions(-) New commits: commit a04935f50ab2f6060b9418f6e9e4c755daffd298 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 16 13:29:21 2013 -0400 Remove CalcAbsIfRel() from ScInterpreter::ScIntersect(). Change-Id: Ifa40c454265e9a08e906038896543e99ce8be638 diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index a53c6da..e7319c6 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2005,8 +2005,6 @@ void ScInterpreter::ScIntersect() } x1 = xt[0], x2 = xt[1]; -x1-CalcAbsIfRel( aPos); -x2-CalcAbsIfRel( aPos); ScTokenRef xRes = new ScRefListToken; ScRefList* pRefList = xRes-GetRefList(); ScRefList::const_iterator end1( x1-GetRefList()-end()); @@ -2014,19 +2012,19 @@ void ScInterpreter::ScIntersect() for (ScRefList::const_iterator it1( x1-GetRefList()-begin()); it1 != end1; ++it1) { -const ScSingleRefData r11 = (*it1).Ref1; -const ScSingleRefData r12 = (*it1).Ref2; +const ScAddress r11 = (*it1).Ref1.toAbs(aPos); +const ScAddress r12 = (*it1).Ref2.toAbs(aPos); for (ScRefList::const_iterator it2( x2-GetRefList()-begin()); it2 != end2; ++it2) { -const ScSingleRefData r21 = (*it2).Ref1; -const ScSingleRefData r22 = (*it2).Ref2; -SCCOL nCol1 = ::std::max( r11.nCol, r21.nCol); -SCROW nRow1 = ::std::max( r11.nRow, r21.nRow); -SCTAB nTab1 = ::std::max( r11.nTab, r21.nTab); -SCCOL nCol2 = ::std::min( r12.nCol, r22.nCol); -SCROW nRow2 = ::std::min( r12.nRow, r22.nRow); -SCTAB nTab2 = ::std::min( r12.nTab, r22.nTab); +const ScAddress r21 = (*it2).Ref1.toAbs(aPos); +const ScAddress r22 = (*it2).Ref2.toAbs(aPos); +SCCOL nCol1 = ::std::max( r11.Col(), r21.Col()); +SCROW nRow1 = ::std::max( r11.Row(), r21.Row()); +SCTAB nTab1 = ::std::max( r11.Tab(), r21.Tab()); +SCCOL nCol2 = ::std::min( r12.Col(), r22.Col()); +SCROW nRow2 = ::std::min( r12.Row(), r22.Row()); +SCTAB nTab2 = ::std::min( r12.Tab(), r22.Tab()); if (nCol2 nCol1 || nRow2 nRow1 || nTab2 nTab1) ; // nothing else @@ -2064,19 +2062,19 @@ void ScInterpreter::ScIntersect() { case svSingleRef: case svDoubleRef: -pt[i]-CalcAbsIfRel( aPos); +{ { -const ScSingleRefData r = pt[i]-GetSingleRef(); -nC1[i] = r.nCol; -nR1[i] = r.nRow; -nT1[i] = r.nTab; +const ScAddress r = pt[i]-GetSingleRef().toAbs(aPos); +nC1[i] = r.Col(); +nR1[i] = r.Row(); +nT1[i] = r.Tab(); } if (sv[i] == svDoubleRef) { -const ScSingleRefData r = pt[i]-GetSingleRef2(); -nC2[i] = r.nCol; -nR2[i] = r.nRow; -nT2[i] = r.nTab; +const ScAddress r = pt[i]-GetSingleRef2().toAbs(aPos); +nC2[i] = r.Col(); +nR2[i] = r.Row(); +nT2[i] = r.Tab(); } else { @@ -2084,7 +2082,8 @@ void ScInterpreter::ScIntersect() nR2[i] = nR1[i]; nT2[i] = nT1[i]; } -break; +} +break; default: ; // nothing, prevent compiler warning } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 32 sc/source/core/inc/refupdat.hxx |6 ++ sc/source/core/tool/rangenam.cxx|6 +- sc/source/core/tool/refupdat.cxx| 24 ++-- 4 files changed, 33 insertions(+), 35 deletions(-) New commits: commit b46ba50bd76ef9f0b861ff50abca2a098cae0578 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 16 14:25:47 2013 -0400 UpdateTranspose() without calling CalcAbsIfRel(). Change-Id: Iddef01a82017ba75c50ed82a54f6ee25fe0df901 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index bf3782e..5b7f8bf 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2631,17 +2631,13 @@ void ScFormulaCell::UpdateTranspose( const ScRange rSource, const ScAddress rD } else if( t-GetType() != svIndex ) { -t-CalcAbsIfRel( aOldPos ); -bool bMod; -{ // Own scope for SingleDoubleRefModifier dtor if SingleRef -SingleDoubleRefModifier aMod( *t ); -ScComplexRefData rRef = aMod.Ref(); -bMod = (ScRefUpdate::UpdateTranspose( pDocument, rSource, -rDest, rRef ) != UR_NOTHING || bPosChanged); -} -if ( bMod ) +SingleDoubleRefModifier aMod(*t); +ScComplexRefData rRef = aMod.Ref(); +ScRange aAbs = rRef.toAbs(aOldPos); +bool bMod = (ScRefUpdate::UpdateTranspose(pDocument, rSource, rDest, aAbs) != UR_NOTHING || bPosChanged); +if (bMod) { -t-CalcRelFromAbs( aPos ); +rRef.SetRange(aAbs, aPos); // based on the new anchor position. bRefChanged = true; } } @@ -2658,16 +2654,12 @@ void ScFormulaCell::UpdateTranspose( const ScRange rSource, const ScAddress rD { if( t-GetType() != svIndex ) { -t-CalcAbsIfRel( aOldPos ); -bool bMod; -{ // Own scope for SingleDoubleRefModifier dtor if SingleRef -SingleDoubleRefModifier aMod( *t ); -ScComplexRefData rRef = aMod.Ref(); -bMod = (ScRefUpdate::UpdateTranspose( pDocument, rSource, -rDest, rRef ) != UR_NOTHING || bPosChanged); -} -if ( bMod ) -t-CalcRelFromAbs( aPos ); +SingleDoubleRefModifier aMod(*t); +ScComplexRefData rRef = aMod.Ref(); +ScRange aAbs = rRef.toAbs(aOldPos); +bool bMod = (ScRefUpdate::UpdateTranspose(pDocument, rSource, rDest, aAbs) != UR_NOTHING || bPosChanged); +if (bMod) +rRef.SetRange(aAbs, aPos); // based on the new anchor position. } } } diff --git a/sc/source/core/inc/refupdat.hxx b/sc/source/core/inc/refupdat.hxx index 58b4cc9..a5f688d 100644 --- a/sc/source/core/inc/refupdat.hxx +++ b/sc/source/core/inc/refupdat.hxx @@ -73,10 +73,8 @@ public: 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, -const ScRange rSource, const ScAddress rDest, -ScComplexRefData rRef ); +static ScRefUpdateRes UpdateTranspose( +ScDocument* pDoc, const ScRange rSource, const ScAddress rDest, ScRange rRef ); static void DoTranspose( SCsCOL rCol, SCsROW rRow, SCsTAB rTab, ScDocument* pDoc, const ScRange rSource, const ScAddress rDest ); diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 42662ae..75e79ec 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -317,8 +317,12 @@ void ScRangeData::UpdateTranspose( const ScRange rSource, const ScAddress rDes (!rRef.Ref2.IsColRel() !rRef.Ref2.IsRowRel() (!rRef.Ref2.IsFlag3D() || !rRef.Ref2.IsTabRel() { -if ( ScRefUpdate::UpdateTranspose( pDoc, rSource, rDest, rRef ) != UR_NOTHING ) +ScRange aAbs = rRef.toAbs(aPos); +if (ScRefUpdate::UpdateTranspose(pDoc, rSource, rDest, aAbs) != UR_NOTHING) +{ +rRef.SetRange(aAbs, aPos); bChanged = true; +} } } } diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index 4541768..df0b0a4 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -866,18 +866,22 @@ void ScRefUpdate::DoTranspose( SCsCOL
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/compiler.cxx |8 +- sc/source/core/tool/refupdat.cxx | 117 --- 2 files changed, 64 insertions(+), 61 deletions(-) New commits: commit 7c03f3b0e2be8cd682bbbf0d177b80334b1cebb7 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 16 17:22:00 2013 -0400 Annotate this function before reworking. To have a good understanding of the code flow in this function. Change-Id: I6324201b5b0c3871ba0d804a9ac7fa5dc37462a5 diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 1787f5a..cd5cef0 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4297,11 +4297,9 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, case svSingleRef: { t-CalcAbsIfRel( rOldPos ); -if ( ScRefUpdate::Update( pDoc, eUpdateRefMode, -aPos, r, nDx, nDy, nDz, -SingleDoubleRefModifier( -t-GetSingleRef()).Ref()) -!= UR_NOTHING) +SingleDoubleRefModifier aRefMod(t-GetSingleRef()); +ScComplexRefData rRef = aRefMod.Ref(); +if (ScRefUpdate::Update(pDoc, eUpdateRefMode, aPos, r, nDx, nDy, nDz, rRef) != UR_NOTHING) rChanged = true; } break; diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index 4f97c40..c4e493d 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -488,6 +488,7 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, UpdateRefMode eMode, { ScRefUpdateRes eRet = UR_NOTHING; +// Range that shifted. SCCOL nCol1 = r.aStart.Col(); SCROW nRow1 = r.aStart.Row(); SCTAB nTab1 = r.aStart.Tab(); @@ -497,18 +498,20 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, UpdateRefMode eMode, if( eMode == URM_INSDEL ) { +// Insertion or deletion bool bExpand = pDoc-IsExpandRefs(); const ScChangeTrack* pChangeTrack = pDoc-GetChangeTrack(); bool bInDeleteUndo = ( pChangeTrack ? pChangeTrack-IsInDeleteUndo() : false ); -SCCOL oldCol1 = rRef.Ref1.nCol; -SCROW oldRow1 = rRef.Ref1.nRow; -SCTAB oldTab1 = rRef.Ref1.nTab; -SCCOL oldCol2 = rRef.Ref2.nCol; -SCROW oldRow2 = rRef.Ref2.nRow; -SCTAB oldTab2 = rRef.Ref2.nTab; +// Store the old reference range. +SCCOL nOldCol1 = rRef.Ref1.nCol; +SCROW nOldRow1 = rRef.Ref1.nRow; +SCTAB nOldTab1 = rRef.Ref1.nTab; +SCCOL nOldCol2 = rRef.Ref2.nCol; +SCROW nOldRow2 = rRef.Ref2.nRow; +SCTAB nOldTab2 = rRef.Ref2.nTab; bool bRef1ColDel = rRef.Ref1.IsColDeleted(); bool bRef2ColDel = rRef.Ref2.IsColDeleted(); @@ -517,14 +520,13 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, UpdateRefMode eMode, bool bRef1TabDel = rRef.Ref1.IsTabDeleted(); bool bRef2TabDel = rRef.Ref2.IsTabDeleted(); -if( nDx -((rRef.Ref1.nRow = nRow1 -rRef.Ref2.nRow = nRow2) || (bRef1RowDel || bRef2RowDel)) - -((rRef.Ref1.nTab = nTab1 -rRef.Ref2.nTab = nTab2) || (bRef1TabDel || bRef2TabDel)) - ) +if (nDx +((nRow1 = rRef.Ref1.nRow rRef.Ref2.nRow = nRow2) || (bRef1RowDel || bRef2RowDel)) +((nTab1 = rRef.Ref1.nTab rRef.Ref2.nTab = nTab2) || (bRef1TabDel || bRef2TabDel))) { +// Shift in the column direction, reference range has at least one +// deleted row or sheet, and the reference range is within the +// shifted region. bool bExp = (bExpand !bInDeleteUndo IsExpand( rRef.Ref1.nCol, rRef.Ref2.nCol, nCol1, nDx )); bool bDo1 = (eWhat == ScRefUpdate::ALL || (eWhat == @@ -559,14 +561,14 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, UpdateRefMode eMode, eRet = UR_UPDATED; } } -if( nDy -((rRef.Ref1.nCol = nCol1 -rRef.Ref2.nCol = nCol2) || (bRef1ColDel || bRef2ColDel)) - -((rRef.Ref1.nTab = nTab1 -rRef.Ref2.nTab = nTab2) || (bRef1TabDel || bRef2TabDel)) - ) + +if (nDy +((nCol1 = rRef.Ref1.nCol rRef.Ref2.nCol = nCol2) || (bRef1ColDel || bRef2ColDel)) +((nTab1 = rRef.Ref1.nTab rRef.Ref2.nTab = nTab2) || (bRef1TabDel || bRef2TabDel))) { +// Shift in the row direction, reference range has at least one +// deleted column or sheet, and the reference range is within the +// shifted region. bool bExp = (bExpand !bInDeleteUndo IsExpand(
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/opencl/formulagroupcl.cxx | 38 +-- 1 file changed, 36 insertions(+), 2 deletions(-) New commits: commit 69f2c96b3196cb8e9430d8abab84032a6da61352 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 15 11:30:40 2013 -0400 Example code on how to handle input and output for matrix inversion. Right now this code simply puts the original matrix values back. Re-write this code to perform inversion for real. Change-Id: I0330db77b000ed14cc810cc3ddf616e56d036c1b diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index dee465e..c24f13a 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -57,9 +57,43 @@ public: const ScFormulaCellGroupRef xGroup, ScTokenArray rCode); }; -ScMatrixRef FormulaGroupInterpreterOpenCL::inverseMatrix(const ScMatrix /* rMat */) +ScMatrixRef FormulaGroupInterpreterOpenCL::inverseMatrix(const ScMatrix rMat) { -return ScMatrixRef(); +SCSIZE nC, nR; +rMat.GetDimensions(nC, nR); +if (nC != nR || nC == 0) +// Input matrix must be square. Return an empty matrix on failure and +// the caller will calculate it via CPU. +return ScMatrixRef(); + +// This vector will contain a series of doubles from the first column to +// the last, chained together in a single array. +std::vectordouble aDoubles; +rMat.GetDoubleArray(aDoubles); + +// TODO: Inverse this matrix and put the result back into xInv. Right now, +// I'll just put the original, non-inversed matrix values back, just to +// demonstrate how to put the values back after inversion. There are two +// ways to put the values back (depending on what the GPU output is). +ScMatrixRef xInv(new ScMatrix(nR, nR, 0.0)); + +#if 0 +// One way is to put the whole value as one array. This method assumes +// that the array size equals column x row, and is oriented column-wise. +// This method is slightly more efficient than the second, but I wouldn't +// expect too much of a difference. +xInv-PutDouble(aDoubles[0], aDoubles.size(), 0, 0); +#else +// Another way is to put the values one column at a time. +const double* p = aDoubles[0]; +for (SCSIZE i = 0; i nC; ++i) +{ +xInv-PutDouble(p, nR, i, 0); +p += nR; +} +#endif + +return xInv; } bool FormulaGroupInterpreterOpenCL::interpret(ScDocument rDoc, const ScAddress rTopPos, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) New commits: commit 466cb70c14ffbf6831b68f44173941af0e617f82 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 15 13:48:07 2013 -0400 No point having this indirection. Change-Id: Idab46933ef6740e478f44e8b420805de9bc39b82 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 07d6e94..5288cc5 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -66,11 +66,8 @@ using ::com::sun::star::i18n::LocaleDataItem; // Err527 Workaroand extern const ScFormulaCell* pLastFormulaTreeTop; // in cellform.cxx using namespace formula; -// STATIC DATA --- -namespace { - -void broadcastCells(ScDocument rDoc, SCCOL nCol, SCROW nTab, const std::vectorSCROW rRows) +void ScColumn::BroadcastCells( const std::vectorSCROW rRows ) { if (rRows.empty()) return; @@ -81,17 +78,10 @@ void broadcastCells(ScDocument rDoc, SCCOL nCol, SCROW nTab, const std::vector for (; itRow != itRowEnd; ++itRow) { aHint.GetAddress().SetRow(*itRow); -rDoc.Broadcast(aHint); +pDocument-Broadcast(aHint); } } -} - -void ScColumn::BroadcastCells( const std::vectorSCROW rRows ) -{ -broadcastCells(*pDocument, nCol, nTab, rRows); -} - struct DirtyCellInterpreter { void operator() (size_t, ScFormulaCell* p) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/opencl/formulagroupcl.cxx | 77 ++- 1 file changed, 26 insertions(+), 51 deletions(-) New commits: commit b39e0e515c0dd6fbc18e3062e2d3b3878340e56e Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jul 10 22:09:29 2013 -0400 Parse the token array in the RPN order. Change-Id: I3770269e23980597c16dd613704bd7a9feb0aec9 diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 04a67d2..dee465e 100755 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -295,7 +295,7 @@ public: const ScFormulaCellGroupRef xGroup, ScTokenArray rCode); }; -#define RETURN_IF_FAIL(a,b) do { if (!(a)) { fprintf (stderr,b); return false; } } while (0) +#define RETURN_IF_FAIL(a,b) do { if (!(a)) { fprintf (stderr,b\n); return false; } } while (0) #include compiler.hxx @@ -313,61 +313,36 @@ bool FormulaGroupInterpreterGroundwater::interpret(ScDocument rDoc, const ScAdd const double *pArrayToSubtractOneElementFrom; const double *pGroundWaterDataArray; -// Output: -std::vectordouble aMatrixContent; +const formula::FormulaToken* p = rCode.FirstRPN(); +RETURN_IF_FAIL(p != NULL p-GetOpCode() == ocPush p-GetType() == formula::svDoubleVectorRef, double vector ref expected); -const formula::FormulaToken *p; +// Get the range reference vector. +const formula::DoubleVectorRefToken* pDvr = static_castconst formula::DoubleVectorRefToken*(p); +const std::vectorconst double* rArrays = pDvr-GetArrays(); +RETURN_IF_FAIL(rArrays.size() == 1, unexpectedly large double ref array); +RETURN_IF_FAIL(pDvr-GetArrayLength() == (size_t)xGroup-mnLength, wrong double ref length); +RETURN_IF_FAIL(pDvr-IsStartFixed() pDvr-IsEndFixed(), non-fixed ranges )); +pGroundWaterDataArray = rArrays[0]; -// special cased formula parser: +// Function: +p = rCode.NextRPN(); +RETURN_IF_FAIL(p != NULL, no operator); +eOp = p-GetOpCode(); +RETURN_IF_FAIL(eOp == ocAverage || eOp == ocMax || eOp == ocMin, unexpected opcode - expected either average, max, or min); -p = rCode.FirstNoSpaces(); -RETURN_IF_FAIL(p != NULL p-GetOpCode() == ocOpen, no opening (); +p = rCode.NextRPN(); +RETURN_IF_FAIL(p != NULL p-GetOpCode() == ocPush p-GetType() == formula::svSingleVectorRef, single vector ref expected); -{ -p = rCode.NextNoSpaces(); -RETURN_IF_FAIL(p != NULL, no operator); - -// Function: -eOp = p-GetOpCode(); -RETURN_IF_FAIL(eOp == ocAverage || eOp == ocMax || eOp == ocMin, unexpected opcode); - -{ // function arguments -p = rCode.NextNoSpaces(); -RETURN_IF_FAIL(p != NULL p-GetOpCode() == ocOpen, missing opening (); - -p = rCode.NextNoSpaces(); -RETURN_IF_FAIL(p != NULL, no function argument); -RETURN_IF_FAIL(p-GetType() == formula::svDoubleVectorRef, wrong type of fn argument); -const formula::DoubleVectorRefToken* pDvr = static_castconst formula::DoubleVectorRefToken*(p); -const std::vectorconst double* rArrays = pDvr-GetArrays(); -RETURN_IF_FAIL(rArrays.size() == 1, unexpectedly large double ref array); -RETURN_IF_FAIL(pDvr-GetArrayLength() == (size_t)xGroup-mnLength, wrong double ref length); -RETURN_IF_FAIL(pDvr-IsStartFixed() pDvr-IsEndFixed(), non-fixed ranges )); -pGroundWaterDataArray = rArrays[0]; - -p = rCode.NextNoSpaces(); -RETURN_IF_FAIL(p != NULL p-GetOpCode() == ocClose, missing closing )); -} +// Get the single reference vector. +const formula::SingleVectorRefToken* pSvr = static_castconst formula::SingleVectorRefToken*(p); +pArrayToSubtractOneElementFrom = pSvr-GetArray(); +RETURN_IF_FAIL(pSvr-GetArrayLength() == (size_t)xGroup-mnLength, wrong single ref length); -// Subtract operator -p = rCode.NextNoSpaces(); -RETURN_IF_FAIL(p != NULL p-GetOpCode() == ocSub, missing subtract opcode); - -{ // subtract parameter -p = rCode.NextNoSpaces(); -RETURN_IF_FAIL(p != NULL, no tokens); -RETURN_IF_FAIL(p-GetType() == formula::svSingleVectorRef, not a single ref); -const formula::SingleVectorRefToken* pSvr = static_castconst formula::SingleVectorRefToken*(p); -pArrayToSubtractOneElementFrom = pSvr-GetArray(); -RETURN_IF_FAIL(pSvr-GetArrayLength() == (size_t)xGroup-mnLength, wrong single ref length); -} - -p = rCode.NextNoSpaces(); -RETURN_IF_FAIL(p != NULL p-GetOpCode() == ocClose, missing closing )); -} +p = rCode.NextRPN(); +RETURN_IF_FAIL(p != NULL p-GetOpCode() == ocSub, missing subtract opcode); -p = rCode.NextNoSpaces(); -RETURN_IF_FAIL(p == NULL, has 5th); +p
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 74c29d7d5a29086f6c05e6561488f17d7f40a0cf Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 9 23:17:07 2013 -0400 Remove this marker. Change-Id: Ia6216631aea17492ed7d864e6033b4677b6d7eb9 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 7ce2d5b..ae463b7 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1957,7 +1957,6 @@ void ScColumn::CopyToColumn( sc::ParseBlock(maCells.begin(), maCells, aFunc, nRow1, nRow2); } -rColumn.RegroupFormulaCells(nRow1, nRow2); rColumn.CellStorageModified(); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) New commits: commit 6d9f0ed332aeb421d71b8cf1fb8baf9f8bededce Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 8 10:15:27 2013 -0400 Re-group formula cells in DeleteRow(). Change-Id: Ic67af048baa55cf1aee118ec741f140831127a95 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index f39d1f8..e363ab0 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -296,9 +296,14 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize ) maCells.erase(nStartRow, nEndRow); maCells.resize(MAXROWCOUNT); +// Get the position again after the container change. +aPos = maCells.position(nStartRow); + // Shift the formula cell positions below the start row. ShiftFormulaPosHandler aShiftFormulaFunc; -sc::ProcessFormula(maCells.begin(), maCells, nStartRow, MAXROW, aShiftFormulaFunc); +sc::ProcessFormula(aPos.first, maCells, nStartRow, MAXROW, aShiftFormulaFunc); + +JoinFormulaCellAbove(aPos); // Single cell broadcasts on deleted cells. BroadcastCells(aDeleteRowsFunc.getNonEmptyRows()); @@ -307,7 +312,6 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize ) maCellTextAttrs.erase(nStartRow, nEndRow); maCellTextAttrs.resize(MAXROWCOUNT); -RegroupFormulaCells(nStartRow); CellStorageModified(); if (!bShiftCells) @@ -598,8 +602,6 @@ void ScColumn::JoinFormulaCellAbove( const sc::CellStoreType::position_type aPo // cell is not a formula cell. return; -SCROW nRow = aPos.first-position + aPos.second; - ScFormulaCell rPrev = *sc::formula_block::at(*aPos.first-data, aPos.second-1); ScFormulaCell rCell = *sc::formula_block::at(*aPos.first-data, aPos.second); sc::CellStoreType::position_type aPosPrev = aPos; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 59 +--- 1 file changed, 22 insertions(+), 37 deletions(-) New commits: commit 4c68b4d57c562f5e26f7708900a24f7964c53c18 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 8 11:09:00 2013 -0400 Always use DoubleVectorRefToken when resolving a range reference. ResolveStaticReference is reserved for calculating invariant formula groups. Change-Id: I58aeabb01f11f98a5c300780734b31079417f4c7 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index f8928e5..8d84221 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3021,49 +3021,34 @@ public: { ScComplexRefData aRef = pToken-GetDoubleRef(); aRef.CalcAbsIfRel(mrCell.aPos); -if (aRef.Ref1.IsRowRel() || aRef.Ref2.IsRowRel()) -{ -// Row reference is relative. -bool bAbsFirst = !aRef.Ref1.IsRowRel(); -bool bAbsLast = !aRef.Ref2.IsRowRel(); -ScAddress aRefPos(aRef.Ref1.nCol, aRef.Ref1.nRow, aRef.Ref1.nTab); -size_t nCols = aRef.Ref2.nCol - aRef.Ref1.nCol + 1; -std::vectorconst double* aArrays; -aArrays.reserve(nCols); -SCROW nArrayLength = mrCell.GetCellGroup()-mnLength; -SCROW nRefRowSize = aRef.Ref2.nRow - aRef.Ref1.nRow + 1; -if (!bAbsLast) -{ -// range end position is relative. Extend the array length. -nArrayLength += nRefRowSize - 1; -} - -for (SCCOL i = aRef.Ref1.nCol; i = aRef.Ref2.nCol; ++i) -{ -aRefPos.SetCol(i); -const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, nArrayLength); -if (!pArray) -return false; -aArrays.push_back(pArray); -} - -formula::DoubleVectorRefToken aTok(aArrays, nArrayLength, nRefRowSize, bAbsFirst, bAbsLast); -mrGroupTokens.AddToken(aTok); -} -else +// Row reference is relative. +bool bAbsFirst = !aRef.Ref1.IsRowRel(); +bool bAbsLast = !aRef.Ref2.IsRowRel(); +ScAddress aRefPos(aRef.Ref1.nCol, aRef.Ref1.nRow, aRef.Ref1.nTab); +size_t nCols = aRef.Ref2.nCol - aRef.Ref1.nCol + 1; +std::vectorconst double* aArrays; +aArrays.reserve(nCols); +SCROW nArrayLength = mrCell.GetCellGroup()-mnLength; +SCROW nRefRowSize = aRef.Ref2.nRow - aRef.Ref1.nRow + 1; +if (!bAbsLast) { -// Absolute row reference. -ScRange aRefRange( -aRef.Ref1.nCol, aRef.Ref1.nRow, aRef.Ref1.nTab, -aRef.Ref2.nCol, aRef.Ref2.nRow, aRef.Ref2.nTab); +// range end position is relative. Extend the array length. +nArrayLength += nRefRowSize - 1; +} -formula::FormulaTokenRef pNewToken = mrDoc.ResolveStaticReference(aRefRange); -if (!pNewToken) +for (SCCOL i = aRef.Ref1.nCol; i = aRef.Ref2.nCol; ++i) +{ +aRefPos.SetCol(i); +const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, nArrayLength); +if (!pArray) return false; -mrGroupTokens.AddToken(*pNewToken); +aArrays.push_back(pArray); } + +formula::DoubleVectorRefToken aTok(aArrays, nArrayLength, nRefRowSize, bAbsFirst, bAbsLast); +mrGroupTokens.AddToken(aTok); } break; case svIndex: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit d40265492ea50405f6cb32a45d1e8cc85ba96e67 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 8 13:50:23 2013 -0400 Remove this marker. Change-Id: Iab8695f579abb009f12aa76f4e161f106527f493 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index f77502b..6744c13 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2293,7 +2293,6 @@ bool ScColumn::UpdateReference( } UpdateRefOnNonCopy aHandler(nCol, nTab, rRange, nDx, nDy, nDz, eUpdateRefMode, pUndoDoc); -FormulaCellsUndecided(0, MAXROW); sc::ProcessFormula(maCells, aHandler); return aHandler.isUpdated(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) New commits: commit e4f9097d7542c8dbecfa133757d76fb6a3f66505 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 8 15:19:04 2013 -0400 Re-group formula cells on paste. Change-Id: Ia5251a3bc8387289056abacbb4836b77262aad12 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 6744c13..fad7edd 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2267,9 +2267,23 @@ bool ScColumn::UpdateReference( { if (eUpdateRefMode == URM_COPY) { +// When copying, the range equals the destination range where cells +// are pasted, and the dx, dy, dz refer to the distance from the +// source range. + UpdateRefOnCopy aHandler(rRange, nDx, nDy, nDz, pUndoDoc); -FormulaCellsUndecided(rRange.aStart.Row(), rRange.aEnd.Row()); -sc::ProcessBlock(maCells.begin(), maCells, aHandler, rRange.aStart.Row(), rRange.aEnd.Row()); +sc::CellStoreType::position_type aPos = maCells.position(rRange.aStart.Row()); +sc::ProcessBlock(aPos.first, maCells, aHandler, rRange.aStart.Row(), rRange.aEnd.Row()); + +// The formula groups at the top and bottom boundaries are expected to +// have been split prior to this call. Here, we only do the joining. +JoinFormulaCellAbove(aPos); +if (rRange.aEnd.Row() MAXROW) +{ +aPos = maCells.position(aPos.first, rRange.aEnd.Row()+1); +JoinFormulaCellAbove(aPos); +} + return aHandler.isUpdated(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit 799db5800de7e93bca3bf39709867032243fac38 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 9 00:48:01 2013 -0400 Remove these markers. CopyToClip is covered by the previous commit. CopyStaticToClip doesn't copy any formula cells. Change-Id: Iaca9d1875396629e00a86b6a9ec8048553ec3053 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index bb6677d..ea48739 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1395,7 +1395,6 @@ void ScColumn::CopyToClip( CopyToClipHandler aFunc(*this, rColumn, rCxt.getBlockPosition(rColumn.nTab, rColumn.nCol)); sc::ParseBlock(maCells.begin(), maCells, aFunc, nRow1, nRow2); -rColumn.RegroupFormulaCells(nRow1, nRow2); rColumn.CellStorageModified(); } @@ -1502,7 +1501,6 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn rDestCol break; } -rDestCol.RegroupFormulaCells(nRow1, nRow2); rDestCol.CellStorageModified(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 08ecce611ac190dea8f0ec9e2407ae527cb817ed Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 9 00:54:46 2013 -0400 Group a new formula cell in CopyCellToDocument. Change-Id: I8a8a24f4d40210700979ef249636b85b6b81e8cd diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index ea48739..c69a3c1 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1535,7 +1535,7 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn rDes ScAddress aDestPos = p-aPos; aDestPos.SetRow(nDestRow); ScFormulaCell* pNew = new ScFormulaCell(*p, *rDestCol.pDocument, aDestPos); -rDestCol.maCells.set(nDestRow, pNew); +rDestCol.SetFormulaCell(nDestRow, pNew); } break; case sc::element_type_empty: @@ -1550,7 +1550,6 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn rDes else rDestCol.maCellTextAttrs.set_empty(nDestRow, nDestRow); -rDestCol.RegroupFormulaCells(nDestRow); rDestCol.CellStorageModified(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column2.cxx | 25 + 1 file changed, 25 insertions(+) New commits: commit 180ba887e532d6e0764e99665a852a787b9954ad Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jul 3 15:12:32 2013 -0400 Allow fallback to cell-based calculation. when cell groups are circular dependent. Change-Id: I20b3e522d6bfe4b70e0f59fe64eac065c9509bd9 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 82daadf..98081356 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -62,6 +62,7 @@ #include svl/broadcast.hxx #include svl/listeneriter.hxx #include vcl/outdev.hxx +#include formula/errorcodes.hxx #include boost/scoped_ptr.hpp @@ -2172,7 +2173,15 @@ bool appendDouble( { ScFormulaCell rFC = **itData; if (!rFC.GetErrorOrValue(nErr, fVal) || nErr) +{ +if (nErr == ScErrorCodes::errCircularReference) +{ +// This cell needs to be recalculated on next visit. +rFC.SetErrCode(0); +rFC.SetDirtyVar(); +} return false; +} rArray.push_back(fVal); } @@ -2261,7 +2270,15 @@ const double* ScColumn::FetchDoubleArray( sc::FormulaGroupContext rCxt, SCROW n { ScFormulaCell rCell = **it; if (!rCell.GetErrorOrValue(nErr, fVal) || nErr) +{ +if (nErr == ScErrorCodes::errCircularReference) +{ +// This cell needs to be recalculated on next visit. +rCell.SetErrCode(0); +rCell.SetDirtyVar(); +} return NULL; +} rArray.push_back(fVal); } @@ -2276,7 +2293,15 @@ const double* ScColumn::FetchDoubleArray( sc::FormulaGroupContext rCxt, SCROW n { ScFormulaCell rCell = **it; if (!rCell.GetErrorOrValue(nErr, fVal) || nErr) +{ +if (nErr == ScErrorCodes::errCircularReference) +{ +// This cell needs to be recalculated on next visit. +rCell.SetErrCode(0); +rCell.SetDirtyVar(); +} return NULL; +} rArray.push_back(fVal); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |9 - 1 file changed, 9 deletions(-) New commits: commit 697a73b070b2be75685dc6f1c2c695064a4d6148 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jul 3 21:34:13 2013 -0400 These methods shouldn't affect formula grouping. They only change sheet index values in all formula cells uniformly; they should not affect how they are grouped. Change-Id: Ie05152de1d6fc5799145e5721c57fd74f8f58239 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 6a2dbd3..2ec0647 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2782,10 +2782,7 @@ void ScColumn::UpdateDeleteTab(SCTAB nDelPos, bool bIsMove, ScColumn* /*pRefUndo DeleteTabUpdater aFunc(maCellTextAttrs, nDelPos, nSheets, nTab, bIsMove); sc::ProcessFormulaEditText(maCells, aFunc); if (aFunc.isModified()) -{ -RegroupFormulaCells(); CellStorageModified(); -} } void ScColumn::UpdateInsertTabAbs(SCTAB nNewPos) @@ -2793,10 +2790,7 @@ void ScColumn::UpdateInsertTabAbs(SCTAB nNewPos) InsertAbsTabUpdater aFunc(maCellTextAttrs, nTab, nNewPos); sc::ProcessFormulaEditText(maCells, aFunc); if (aFunc.isModified()) -{ -RegroupFormulaCells(); CellStorageModified(); -} } void ScColumn::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo ) @@ -2807,10 +2801,7 @@ void ScColumn::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo ) MoveTabUpdater aFunc(maCellTextAttrs, nTab, nOldPos, nNewPos); sc::ProcessFormulaEditText(maCells, aFunc); if (aFunc.isModified()) -{ -RegroupFormulaCells(); CellStorageModified(); -} } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 9e559f4e73ef0a0a90822d0cd5644d8ebc7ed01f Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jul 3 21:38:53 2013 -0400 ??? Change-Id: Id13bf81cd65fdc0677832993bded37e08f226c0d diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 2ec0647..68f7aa3 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2015,8 +2015,7 @@ void ScColumn::CopyScenarioTo( ScColumn rDestCol ) const if ( ((ScMergeFlagAttr)pPattern-GetItem( ATTR_MERGE_FLAG )).IsScenario() ) { rDestCol.DeleteArea( nStart, nEnd, IDF_CONTENTS ); -((ScColumn*)this)- -CopyToColumn(aCxt, nStart, nEnd, IDF_CONTENTS, false, rDestCol); +CopyToColumn(aCxt, nStart, nEnd, IDF_CONTENTS, false, rDestCol); // UpdateUsed not needed, is already done in TestCopyScenario (obsolete comment ?) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column2.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 346845ddff96ff14851dda8e6eb64ab8e4778a56 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 2 09:24:09 2013 -0400 Try not to iterate beyond the end of the formula block. Or else a crash would ensue... Change-Id: Ib08163ba91e4bac023ae778c704a0c052fa48ebb diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index abe2806..4becbb7 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2258,8 +2258,9 @@ const double* ScColumn::FetchDoubleArray( sc::FormulaGroupContext rCxt, SCROW n return rArray[0]; } +// Requested length goes beyond a single block. Fill the array +// with the content of this formula block first. itEnd = sc::formula_block::end(*aPos.first-data); -std::advance(itEnd, nLenRequested); for (; it != itEnd; ++it) { ScFormulaCell rCell = **it; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/token.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 967792d2297f3bb0520b408ebdcfc078c3da9230 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 2 12:00:02 2013 -0400 Enable group calculation on COUNT and COUNT2. Change-Id: I7a1cb5aa485bd54e1f6e41262435129b6ac6b98b diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index ad8fdf2..dcee784 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1319,6 +1319,8 @@ void ScTokenArray::CheckToken( const FormulaToken r ) case ocSum: case ocSumProduct: case ocMatInv: +case ocCount: +case ocCount2: // Don't change the state. break; default: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/interpr1.cxx | 767 -- sc/source/core/tool/interpr6.cxx | 775 ++- 2 files changed, 774 insertions(+), 768 deletions(-) New commits: commit 64447d69d7b8742a087b4c1bca37de68b75c7511 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 2 15:43:57 2013 -0400 Move this to another file to distribute the compiler load. interpr1.cxx is getting way too big Change-Id: Ic3e4879daebd09c8dcb86a42b305864dcc1c67c4 diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 93bcfef..8b738fa 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -58,8 +58,6 @@ #include queryparam.hxx #include queryentry.hxx #include tokenarray.hxx -#include columnspanset.hxx -#include column.hxx #include comphelper/processfactory.hxx #include comphelper/string.hxx @@ -3852,771 +3850,6 @@ void ScInterpreter::ScMax( bool bTextAsZero ) PushDouble(nMax); } -namespace { - -class FuncCount : public sc::ColumnSpanSet::ColumnAction -{ -sc::ColumnBlockConstPosition maPos; -ScColumn* mpCol; -size_t mnCount; -sal_uInt32 mnNumFmt; - -public: -FuncCount() : mnCount(0), mnNumFmt(0) {} - -virtual void startColumn(ScColumn* pCol) -{ -mpCol = pCol; -mpCol-InitBlockPosition(maPos); -} - -virtual void execute(SCROW nRow1, SCROW nRow2, bool bVal) -{ -if (!bVal) -return; - -mnCount += mpCol-CountNumericCells(maPos, nRow1, nRow2); -mnNumFmt = mpCol-GetNumberFormat(nRow2); -}; - -size_t getCount() const { return mnCount; } -sal_uInt32 getNumberFormat() const { return mnNumFmt; } -}; - -class FuncSum : public sc::ColumnSpanSet::ColumnAction -{ -sc::ColumnBlockConstPosition maPos; -ScColumn* mpCol; -double mfSum; -sal_uInt32 mnNumFmt; - -public: -FuncSum() : mfSum(0.0), mnNumFmt(0) {} - -virtual void startColumn(ScColumn* pCol) -{ -mpCol = pCol; -mpCol-InitBlockPosition(maPos); -} - -virtual void execute(SCROW nRow1, SCROW nRow2, bool bVal) -{ -if (!bVal) -return; - -mfSum += mpCol-SumNumericCells(maPos, nRow1, nRow2); -mnNumFmt = mpCol-GetNumberFormat(nRow2); -}; - -double getSum() const { return mfSum; } -sal_uInt32 getNumberFormat() const { return mnNumFmt; } -}; - -void IterateMatrix( -const ScMatrixRef pMat, ScIterFunc eFunc, bool bTextAsZero, -sal_uLong rCount, short rFuncFmtType, double fRes, double fMem, bool bNull) -{ -if (!pMat) -return; - -rFuncFmtType = NUMBERFORMAT_NUMBER; -switch (eFunc) -{ -case ifAVERAGE: -case ifSUM: -{ -ScMatrix::IterateResult aRes = pMat-Sum(bTextAsZero); -if (bNull) -{ -bNull = false; -fMem = aRes.mfFirst; -fRes += aRes.mfRest; -} -else -fRes += aRes.mfFirst + aRes.mfRest; -rCount += aRes.mnCount; -} -break; -case ifCOUNT: -rCount += pMat-Count(bTextAsZero); -break; -case ifCOUNT2: -rCount += pMat-Count(true); -break; -case ifPRODUCT: -{ -ScMatrix::IterateResult aRes = pMat-Product(bTextAsZero); -fRes *= aRes.mfRest; -rCount += aRes.mnCount; -} -break; -case ifSUMSQ: -{ -ScMatrix::IterateResult aRes = pMat-SumSquare(bTextAsZero); -fRes += aRes.mfRest; -rCount += aRes.mnCount; -} -break; -default: -; -} -} - -} - -double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero ) -{ -RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, sc, er, ScInterpreter::IterateParameters ); -short nParamCount = GetByte(); -double fRes = ( eFunc == ifPRODUCT ) ? 1.0 : 0.0; -double fVal = 0.0; -double fMem = 0.0; // first numeric value. -bool bNull = true; -sal_uLong nCount = 0; -ScAddress aAdr; -ScRange aRange; -size_t nRefInList = 0; -if ( nGlobalError ( eFunc == ifCOUNT2 || eFunc == ifCOUNT ) ) -nGlobalError = 0; -while (nParamCount-- 0) -{ -switch (GetStackType()) -{ -case svString: -{ -if( eFunc == ifCOUNT ) -{ -String aStr( PopString() ); -sal_uInt32 nFIndex = 0; // damit default Land/Spr. -if ( bTextAsZero || pFormatter-IsNumberFormat(aStr, nFIndex, fVal)) -nCount++; -} -else -{ -switch ( eFunc ) -{ -case ifAVERAGE: -case ifSUM: -
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/formulagroup.cxx | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) New commits: commit 64fdd070cbafb16ad38fb48bbf47175d18333e90 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 2 16:47:31 2013 -0400 Be aware that the top row may not always be the top of the group. Adjust the length and the starting row position for accordingly. Change-Id: I2f9c5a515887b98334bad51c5409461d5dd1505d diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index 4754bd0..3dd43e3 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -18,6 +18,8 @@ #include formula/vectortoken.hxx +#include vector + namespace sc { ScMatrixRef FormulaGroupInterpreterSoftware::inverseMatrix(const ScMatrix /*rMat*/) @@ -29,12 +31,16 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument rDoc, const ScAddres const ScFormulaCellGroupRef xGroup, ScTokenArray rCode) { -// Until we implement group calculation for real, decompose the group into -// individual formula token arrays for individual calculation. +// Decompose the group into individual cells and calculate them individually. + ScAddress aTmpPos = rTopPos; -for (sal_Int32 i = 0; i xGroup-mnLength; ++i) +SCROW nOffset = rTopPos.Row() - xGroup-mnStart; +SCROW nLength = xGroup-mnLength - nOffset; +std::vectordouble aResults; +aResults.reserve(nLength); +for (SCROW i = 0; i nLength; ++i) { -aTmpPos.SetRow(xGroup-mnStart + i); +aTmpPos.SetRow(rTopPos.Row() + i); ScTokenArray aCode2; for (const formula::FormulaToken* p = rCode.First(); p; p = rCode.Next()) { @@ -89,11 +95,12 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument rDoc, const ScAddres aComp.CompileTokenArray(); // Create RPN token array. ScInterpreter aInterpreter(pDest, rDoc, aTmpPos, aCode2); aInterpreter.Interpret(); -pDest-SetResultToken(aInterpreter.GetResultToken().get()); -pDest-ResetDirty(); -pDest-SetChanged(true); +aResults.push_back(aInterpreter.GetResultToken()-GetDouble()); } // for loop end (xGroup-mnLength) +if (!aResults.empty()) +rDoc.SetFormulaResults(rTopPos, aResults[0], aResults.size()); + return true; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx |6 -- 1 file changed, 6 deletions(-) New commits: commit 0d736e22850322ba3d4d8344d0b2ff1d228ef358 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 2 22:23:56 2013 -0400 Forgot to remove these debug statements. Change-Id: I680750c43dce4b6e7f9b9ed0a6b8550bdf485a8c diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 132ed5c..f8928e5 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3115,12 +3115,8 @@ bool ScFormulaCell::InterpretFormulaGroup() if (!xGroup || !pCode) return false; -fprintf(stdout, ScFormulaCell::InterpretFormulaGroup: calc state = %d\n, xGroup-meCalcState); if (xGroup-meCalcState == sc::GroupCalcDisabled) -{ -fprintf(stdout, ScFormulaCell::InterpretFormulaGroup: group calc disabled.\n); return false; -} switch (pCode-GetVectorState()) { @@ -3145,7 +3141,6 @@ bool ScFormulaCell::InterpretFormulaGroup() GroupTokenConverter aConverter(aCxt, aCode, *pDocument, *this, aTopPos); if (!aConverter.convert(*pCode)) { -fprintf(stdout, ScFormulaCell::InterpretFormulaGroup: disabling group calc due to failed conversion\n); xGroup-meCalcState = sc::GroupCalcDisabled; return false; } @@ -3153,7 +3148,6 @@ bool ScFormulaCell::InterpretFormulaGroup() xGroup-meCalcState = sc::GroupCalcRunning; if (!sc::FormulaGroupInterpreter::getStatic()-interpret(*pDocument, aTopPos, xGroup, aCode)) { -fprintf(stdout, ScFormulaCell::InterpretFormulaGroup: disabling group calc due to failed calculation\n); xGroup-meCalcState = sc::GroupCalcDisabled; return false; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 747988e8362faeb3f18271d8b33cf55905e5e860 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 1 09:02:13 2013 -0400 Fix a crasher on copy to clip. The logical row position equals the top block position plus offset within block, not minus. Change-Id: Ia6376d8e971f9d3379977895d14f97f43c5664ba diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index a224b6f..aa82f4d1 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1276,7 +1276,7 @@ public: void operator() (const sc::CellStoreType::value_type aNode, size_t nOffset, size_t nDataSize) { -size_t nTopRow = aNode.position - nOffset; +size_t nTopRow = aNode.position + nOffset; switch (aNode.type) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/opencl/formulagroupcl.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit c498a34d7c039a9cfc4162f91c66831ea13527b9 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 1 19:24:39 2013 -0400 Fix build breakage when opencl is enabled. Change-Id: I8ffa87c19ce110452c8280f4ee91536cd6f563d4 diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 54fd8e8..41e439c 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -15,6 +15,7 @@ #include compiler.hxx #include interpre.hxx #include formula/vectortoken.hxx +#include scmatrix.hxx #include openclwrapper.hxx ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 74361c91782832f07d3ef9b76c765997648dbe52 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Jul 1 23:30:00 2013 -0400 Unused variable. Change-Id: I1df58281896687e61d40675206d0fc3854d93866 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 2a59e7e..8d3f625 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -474,7 +474,7 @@ class NumericCellCounter public: NumericCellCounter() : mnCount(0) {} -void operator() (const sc::CellStoreType::value_type rNode, size_t nOffset, size_t nDataSize) +void operator() (const sc::CellStoreType::value_type rNode, size_t /*nOffset*/, size_t nDataSize) { if (rNode.type != sc::element_type_numeric) return; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column2.cxx | 39 +-- 1 file changed, 21 insertions(+), 18 deletions(-) New commits: commit 87137126374d52d29ae070c5686b9f08c613062f Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jun 28 11:50:25 2013 -0400 ResolveStaticReference() to also dynamically recalc formula cells. Change-Id: If42e5105be0e6db7c63d7c4e7c43de23716d6cbf diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 82990ab..a7056d0 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1859,13 +1859,10 @@ formula::FormulaTokenRef ScColumn::ResolveStaticReference( SCROW nRow ) case sc::element_type_formula: { ScFormulaCell* p = sc::formula_block::at(*it-data, aPos.second); -if (p-GetDirty()) -// Dirty formula cell is not considered static (for now). -// Return null token. Later we will switch to dynamically -// interpreting all dirty formula cells. -return formula::FormulaTokenRef(); +if (p-IsValue()) +return formula::FormulaTokenRef(new formula::FormulaDoubleToken(p-GetValue())); -return formula::FormulaTokenRef(new formula::FormulaDoubleToken(p-GetResultDouble())); +return formula::FormulaTokenRef(new formula::FormulaStringToken(p-GetString())); } case sc::element_type_empty: default: @@ -1881,28 +1878,34 @@ class ToMatrixHandler ScMatrix mrMat; SCCOL mnMatCol; SCROW mnTopRow; -bool mbSuccess; public: ToMatrixHandler(ScMatrix rMat, SCCOL nMatCol, SCROW nTopRow) : -mrMat(rMat), mnMatCol(nMatCol), mnTopRow(nTopRow), mbSuccess(true) {} +mrMat(rMat), mnMatCol(nMatCol), mnTopRow(nTopRow) {} void operator() (size_t nRow, double fVal) { mrMat.PutDouble(fVal, mnMatCol, nRow - mnTopRow); } -void operator() (size_t nRow, ScFormulaCell* p) +void operator() (size_t nRow, const ScFormulaCell* p) { -if (p-GetDirty()) -{ -mbSuccess = false; -return; -} +// Formula cell may need to re-calculate. +ScFormulaCell rCell = const_castScFormulaCell(*p); +if (rCell.IsValue()) +mrMat.PutDouble(rCell.GetValue(), mnMatCol, nRow - mnTopRow); +else +mrMat.PutString(rCell.GetString(), mnMatCol, nRow - mnTopRow); +} -mrMat.PutDouble(p-GetResultDouble(), mnMatCol, nRow - mnTopRow); +void operator() (size_t nRow, const OUString rStr) +{ +mrMat.PutString(rStr, mnMatCol, nRow - mnTopRow); } -bool isSuccess() const { return mbSuccess; } +void operator() (size_t nRow, const EditTextObject* pStr) +{ +mrMat.PutString(ScEditUtil::GetString(*pStr), mnMatCol, nRow - mnTopRow); +} }; } @@ -1913,8 +1916,8 @@ bool ScColumn::ResolveStaticReference( ScMatrix rMat, SCCOL nMatCol, SCROW nRow return false; ToMatrixHandler aFunc(rMat, nMatCol, nRow1); -sc::ProcessFormulaNumeric(maCells.begin(), maCells, nRow1, nRow2, aFunc); -return aFunc.isSuccess(); +sc::ParseAllNonEmpty(maCells.begin(), maCells, nRow1, nRow2, aFunc); +return true; } namespace { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/documen9.cxx|6 +- sc/source/core/data/formulacell.cxx |3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) New commits: commit 6972c788286b151145067ac5be65540fc6ac7bc6 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jun 28 13:28:31 2013 -0400 Ensure that the group calculation path won't get called when it's disabled. Change-Id: I0ea45616558bebf99c63862a0458776c67789bbc diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 2938009..c4c1409 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -690,11 +690,7 @@ void ScDocument::ApplyAsianEditSettings( ScEditEngineDefaulter rEngine ) void ScDocument::RebuildFormulaGroups() { -bool bEnableFormulaGroups; - -bEnableFormulaGroups = ScInterpreter::GetGlobalConfig().mbOpenCLEnabled; - -if ( !bEnableFormulaGroups ) +if (!ScInterpreter::GetGlobalConfig().mbOpenCLEnabled) return; SCTAB nTab; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 26d7ee5..f2d72da 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3084,6 +3084,9 @@ public: bool ScFormulaCell::InterpretFormulaGroup() { +if (!ScInterpreter::GetGlobalConfig().mbOpenCLEnabled) +return false; + // Re-build formulae groups if necessary - ideally this is done at // import / insert / delete etc. and is integral to the data structures pDocument-RebuildFormulaGroups(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit bbfdd5955cd867929c30ec11c3d11a62b6a55efd Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jun 28 14:21:37 2013 -0400 This is obviously a mistake, caused Calc to crash on Ctrl-D. Change-Id: I85787366313e38ce0ff503c7677e4407c1e2e30e diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 9f75ad8..a224b6f 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1595,7 +1595,7 @@ public: void operator() (const sc::CellStoreType::value_type aNode, size_t nOffset, size_t nDataSize) { -size_t nRow = aNode.position - nOffset; +size_t nRow = aNode.position + nOffset; switch (aNode.type) { @@ -1773,7 +1773,7 @@ public: void operator() (const sc::CellStoreType::value_type aNode, size_t nOffset, size_t nDataSize) { -size_t nRow = aNode.position - nOffset; +size_t nRow = aNode.position + nOffset; switch (aNode.type) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/documen9.cxx |3 --- 1 file changed, 3 deletions(-) New commits: commit 33b265463ede87a25fe3a13ede65c846be5b74d7 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jun 28 16:38:19 2013 -0400 This is not needed. Change-Id: I382b9d485b7bb58656561c4790580c9bc6339889 diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index c4c1409..3d9110b 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -690,9 +690,6 @@ void ScDocument::ApplyAsianEditSettings( ScEditEngineDefaulter rEngine ) void ScDocument::RebuildFormulaGroups() { -if (!ScInterpreter::GetGlobalConfig().mbOpenCLEnabled) -return; - SCTAB nTab; for (nTab=0; nTab static_castSCTAB(maTabs.size()); nTab++) if (maTabs[nTab]) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx |1 sc/source/core/tool/compiler.cxx| 56 2 files changed, 1 insertion(+), 56 deletions(-) New commits: commit 2deeac0fd6a47981292d9045d9c5321b8078bfaa Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jun 27 13:52:50 2013 -0400 Remove this old attempt of shared formula code. We'll devise a brand-new solution for this. Change-Id: Ib4e04b3ce0b5d1ab511aecfab35f81e43dd4edf9 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 9fc515d..96efc40 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2055,7 +2055,6 @@ bool ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode, if ( pUndoCellPos ) aUndoPos = *pUndoCellPos; ScAddress aOldPos( aPos ); -// bool bPosChanged = false; // if this cell was moved bool bIsInsert = (eUpdateRefMode == URM_INSDEL nDx = 0 nDy = 0 nDz = 0); if (eUpdateRefMode == URM_INSDEL r.In( aPos )) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index afd50e1..759eef2 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4267,14 +4267,6 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, } else { -/* - * Set SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE to 1 if we wanted to preserve as - * many shared formulas as possible instead of replacing them with direct code. - * Note that this may produce shared formula usage Excel doesn't understand, - * which would have to be adapted for in the export filter. Advisable as a long - * term goal, since it could decrease memory footprint. - */ -#define SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE 0 ScRangeData* pRangeData = NULL; ScToken* t; pArr-Reset(); @@ -4286,9 +4278,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, if (pName pName-HasType(RT_SHAREDMOD)) { pRangeData = pName; // maybe need a replacement of shared with own code -#if ! SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE rChanged = true; -#endif } } else if( t-GetType() != svIndex ) // it may be a DB area!!! @@ -4335,24 +4325,11 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, } } } -#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE -bool bEasyShared, bPosInRange; -if ( !pRangeData ) -bEasyShared = bPosInRange = false; -else -{ -bEasyShared = true; -bPosInRange = r.In( eUpdateRefMode == URM_MOVE ? aPos : rOldPos ); -} -#endif pArr-Reset(); while ( (t = static_castScToken*(pArr-GetNextReferenceRPN())) != NULL ) { if ( t-GetRef() != 1 ) { -#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE -bEasyShared = false; -#endif } else { // if nRefCnt1 it's already updated in token code @@ -4374,15 +4351,6 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, ) rChanged = true; } -#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE -if ( bEasyShared ) -{ -const ScSingleRefData rSRD = aMod.Ref().Ref1; -ScAddress aRef( rSRD.nCol, rSRD.nRow, rSRD.nTab ); -if ( r.In( aRef ) != bPosInRange ) -bEasyShared = false; -} -#endif } else { @@ -4408,35 +4376,13 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, rRef.Ref2.nTab - rRef.Ref1.nTab != nTabs) { rRefSizeChanged = true; -#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE -bEasyShared = false; -#endif } } } -#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE -if ( bEasyShared ) -{ -ScRange aRef( rRef.Ref1.nCol, rRef.Ref1.nRow, -rRef.Ref1.nTab, rRef.Ref2.nCol, rRef.Ref2.nRow, -rRef.Ref2.nTab ); -if ( r.In( aRef ) != bPosInRange ) -bEasyShared = false; -} -#endif } } } -#if SC_PRESERVE_SHARED_FORMULAS_IF_POSSIBLE -if ( pRangeData ) -{ -if ( bEasyShared ) -pRangeData = 0; -else -
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/compiler.cxx | 183 ++- 1 file changed, 86 insertions(+), 97 deletions(-) New commits: commit 50052ef0c677f9af8f89f8b671ceef5b4a378dd0 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jun 27 14:03:27 2013 -0400 Reduce indentation to a sane level. Change-Id: I2940ca21f8cee0d780e58cfcda50705be61568d9 diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 759eef2..4748aef 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4265,126 +4265,115 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, } return pRangeData; } -else + +ScRangeData* pRangeData = NULL; +ScToken* t; +pArr-Reset(); +while( (t = static_castScToken*(pArr-GetNextReferenceOrName())) != NULL ) { -ScRangeData* pRangeData = NULL; -ScToken* t; -pArr-Reset(); -while( (t = static_castScToken*(pArr-GetNextReferenceOrName())) != NULL ) +if( t-GetOpCode() == ocName ) { -if( t-GetOpCode() == ocName ) +ScRangeData* pName = GetRangeData( *t); +if (pName pName-HasType(RT_SHAREDMOD)) { -ScRangeData* pName = GetRangeData( *t); -if (pName pName-HasType(RT_SHAREDMOD)) -{ -pRangeData = pName; // maybe need a replacement of shared with own code -rChanged = true; -} -} -else if( t-GetType() != svIndex ) // it may be a DB area!!! -{ -t-CalcAbsIfRel( rOldPos ); -switch (t-GetType()) -{ -case svExternalSingleRef: -case svExternalDoubleRef: -// External references never change their positioning -// nor point to parts that will be removed or expanded. -// In fact, calling ScRefUpdate::Update() for URM_MOVE -// may have negative side effects. Simply adapt -// relative references to the new position. -t-CalcRelFromAbs( aPos); -break; -case svSingleRef: -{ -if ( ScRefUpdate::Update( pDoc, eUpdateRefMode, -aPos, r, nDx, nDy, nDz, -SingleDoubleRefModifier( -t-GetSingleRef()).Ref()) -!= UR_NOTHING) -rChanged = true; -} -break; -default: -{ -ScComplexRefData rRef = t-GetDoubleRef(); -SCCOL nCols = rRef.Ref2.nCol - rRef.Ref1.nCol; -SCROW nRows = rRef.Ref2.nRow - rRef.Ref1.nRow; -SCTAB nTabs = rRef.Ref2.nTab - rRef.Ref1.nTab; -if ( ScRefUpdate::Update( pDoc, eUpdateRefMode, -aPos, r, nDx, nDy, nDz, -t-GetDoubleRef()) != UR_NOTHING) -{ -rChanged = true; -if (rRef.Ref2.nCol - rRef.Ref1.nCol != nCols || -rRef.Ref2.nRow - rRef.Ref1.nRow != nRows || -rRef.Ref2.nTab - rRef.Ref1.nTab != nTabs) -rRefSizeChanged = true; -} -} -} +pRangeData = pName; // maybe need a replacement of shared with own code +rChanged = true; } } -pArr-Reset(); -while ( (t = static_castScToken*(pArr-GetNextReferenceRPN())) != NULL ) +else if( t-GetType() != svIndex ) // it may be a DB area!!! { -if ( t-GetRef() != 1 ) +t-CalcAbsIfRel( rOldPos ); +switch (t-GetType()) { -} -else -{ // if nRefCnt1 it's already updated in token code -if ( t-GetType() == svSingleRef ) +case svExternalSingleRef: +case svExternalDoubleRef: +// External references never change their positioning +// nor point to parts that will be removed or expanded. +// In fact, calling ScRefUpdate::Update() for URM_MOVE +// may have negative side effects. Simply adapt +// relative references to the new position. +t-CalcRelFromAbs( aPos); +
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 18 +- sc/source/core/tool/compiler.cxx| 24 2 files changed, 21 insertions(+), 21 deletions(-) New commits: commit d2ac8eef9e437a409efd7ca79a2b0f3cadecade7 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jun 27 15:12:10 2013 -0400 Rename a variable to something more meaningful. Change-Id: I860e5301e3fec3f06f318b28787f71b63dbaf0ab diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 224bbea..e432d79 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2100,7 +2100,7 @@ bool ScFormulaCell::UpdateReference( if (pUndoDoc) pOldCode.reset(pCode-Clone()); -ScRangeData* pRangeData = NULL; +ScRangeData* pSharedCode = NULL; bool bValChanged = false; bool bRangeModified = false;// any range, not only shared formula bool bRefSizeChanged = false; @@ -2110,7 +2110,7 @@ bool ScFormulaCell::UpdateReference( // Update cell or range references. ScCompiler aComp(pDocument, aPos, *pCode); aComp.SetGrammar(pDocument-GetGrammar()); -pRangeData = aComp.UpdateReference(eUpdateRefMode, aOldPos, rRange, +pSharedCode = aComp.UpdateReference(eUpdateRefMode, aOldPos, rRange, nDx, nDy, nDz, bValChanged, bRefSizeChanged); bRangeModified = aComp.HasModifiedRange(); @@ -2215,7 +2215,7 @@ bool ScFormulaCell::UpdateReference( bHasRelName = HasRelNameReference(); // Reference changed and new listening needed? // Except in Insert/Delete without specialties. -bNewListening = (bRangeModified || pRangeData || bColRowNameCompile +bNewListening = (bRangeModified || pSharedCode || bColRowNameCompile || (bValChanged (eUpdateRefMode != URM_INSDEL || bInDeleteUndo || bRefSizeChanged)) || (bHasRelName eUpdateRefMode != URM_COPY)) @@ -2231,14 +2231,14 @@ bool ScFormulaCell::UpdateReference( bool bNeedDirty = false; // NeedDirty for changes except for Copy and Move/Insert without RelNames -if ( bRangeModified || pRangeData || bColRowNameCompile || +if ( bRangeModified || pSharedCode || bColRowNameCompile || (bValChanged eUpdateRefMode != URM_COPY (eUpdateRefMode != URM_MOVE || bHasRelName) (!bIsInsert || bHasRelName || bInDeleteUndo || bRefSizeChanged)) || bOnRefMove) bNeedDirty = true; -if (pUndoDoc (bValChanged || pRangeData || bOnRefMove)) +if (pUndoDoc (bValChanged || pSharedCode || bOnRefMove)) { // Copy the cell to aUndoPos, which is its current position in the document, // so this works when UpdateReference is called before moving the cells @@ -2258,13 +2258,13 @@ bool ScFormulaCell::UpdateReference( bValChanged = false; -if ( pRangeData ) +if ( pSharedCode ) { // Replace shared formula with own formula pDocument-RemoveFromFormulaTree( this ); // update formula count delete pCode; -pCode = pRangeData-GetCode()-Clone(); +pCode = pSharedCode-GetCode()-Clone(); // #i18937# #i110008# call MoveRelWrap, but with the old position -ScCompiler::MoveRelWrap(*pCode, pDocument, aOldPos, pRangeData-GetMaxCol(), pRangeData-GetMaxRow()); +ScCompiler::MoveRelWrap(*pCode, pDocument, aOldPos, pSharedCode-GetMaxCol(), pSharedCode-GetMaxRow()); ScCompiler aComp2(pDocument, aPos, *pCode); aComp2.SetGrammar(pDocument-GetGrammar()); aComp2.UpdateSharedFormulaReference( eUpdateRefMode, aOldPos, rRange, @@ -2297,7 +2297,7 @@ bool ScFormulaCell::UpdateReference( } } -if ( bNeedDirty (!(eUpdateRefMode == URM_INSDEL bHasRelName) || pRangeData) ) +if ( bNeedDirty (!(eUpdateRefMode == URM_INSDEL bHasRelName) || pSharedCode) ) { // Cut off references, invalid or similar? sc::AutoCalcSwitch(*pDocument, false); SetDirty(); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 4748aef..d22c54f 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4222,25 +4222,25 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, } } // Check for SharedFormulas. -ScRangeData* pRangeData = NULL; +ScRangeData* pSharedCode = NULL; pArr-Reset(); -for( FormulaToken* j = pArr-GetNextName(); j !pRangeData; +for( FormulaToken* j = pArr-GetNextName(); j !pSharedCode; j = pArr-GetNextName() ) { if( j-GetOpCode() == ocName ) { ScRangeData* pName = GetRangeData( *j); if (pName pName-HasType(RT_SHARED)) -
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/formulagroup.cxx |2 +- sc/source/ui/optdlg/calcoptionsdlg.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 1f5c360c8464d43d0fd0a4816af723bfd001841d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jun 27 16:44:24 2013 -0400 These should be ifdef, per compiler warnings. Change-Id: I302d9ca63bc289fce99bf3e64d9aa3fcbcabf694 diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index f9d251b..436 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -111,7 +111,7 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic() if ( !msInstance ) { -#if HAVE_FEATURE_OPENCL +#ifdef HAVE_FEATURE_OPENCL if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled ) msInstance = sc::opencl::createFormulaGroupInterpreter(); #endif diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 11ec4cb..26434bf 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -199,7 +199,7 @@ void ScCalcOptionsDialog::FillOptionsList() } pModel-Insert(createBoolItem(maCaptionEmptyStringAsZero,maConfig.mbEmptyStringAsZero)); -#if HAVE_FEATURE_OPENCL +#ifdef HAVE_FEATURE_OPENCL pModel-Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled)); #endif ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/documen2.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit 431bd5a6b739aaa280d113b58088876d0795d4d8 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jun 27 16:47:17 2013 -0400 We don't need these header includes. Change-Id: Ia2f7226fa3c7dc5ac98bd23833e67d7262cd8b9b diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 6244eac..b1b3160 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -86,8 +86,6 @@ #include macromgr.hxx #include formulacell.hxx #include clipcontext.hxx -#include interpre.hxx -#include formulagroup.hxx using namespace com::sun::star; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 5941ced5309b707b132cab44c75e9c764b312c08 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jun 26 15:56:46 2013 -0400 Don't forget to transfer this too when splitting group. Change-Id: I3337504f6b95f273106e809da90d089cd76d8bdb diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 6cac968..7fd16f0 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -403,6 +403,7 @@ sc::CellStoreType::iterator ScColumn::GetPositionToInsert( const sc::CellStoreTy ScFormulaCellGroupRef xGroup2(new ScFormulaCellGroup); xGroup2-mnStart = rCell.aPos.Row() + 1; xGroup2-mnLength = nEndRow - rCell.aPos.Row(); +xGroup2-mbInvariant = xGroup-mbInvariant; #if DEBUG_COLUMN_STORAGE if (xGroup2-mnStart + xGroup2-mnLength itRet-position + itRet-size) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/dociter.cxx | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) New commits: commit fbc67f736ba39c43d6a2320c074e1e96af896b29 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jun 25 11:54:10 2013 -0400 Move a common if statement into the function. Change-Id: Ic13c9e7bdfea97c4f7782181dc70d6965ba0b6b9 diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 032362b..9c92fc8 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1762,6 +1762,10 @@ namespace { bool advanceBlock(size_t nRow, sc::CellStoreType::const_iterator rPos, const sc::CellStoreType::const_iterator rEnd) { +if (nRow rPos-position + rPos-size) +// Block already contains the specified row. Nothing to do. +return true; + // This block is behind the current row position. Advance the block. for (++rPos; rPos != rEnd; ++rPos) { @@ -1789,9 +1793,8 @@ void ScHorizontalCellIterator::Advance() if (nRow r.maPos-position) continue; -if (r.maPos-position + r.maPos-size = nRow) -if (!advanceBlock(nRow, r.maPos, r.maEnd)) -continue; +if (!advanceBlock(nRow, r.maPos, r.maEnd)) +continue; if (r.maPos-type == sc::element_type_empty) continue; @@ -1827,9 +1830,8 @@ void ScHorizontalCellIterator::Advance() continue; } -if (r.maPos-position + r.maPos-size = nRow) -if (!advanceBlock(nRow, r.maPos, r.maEnd)) -continue; +if (!advanceBlock(nRow, r.maPos, r.maEnd)) +continue; if (r.maPos-type == sc::element_type_empty) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/ui/app/transobj.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 75d85ab7ae4cb5b6f36ba7ac17c3177b95fd5058 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jun 25 13:38:20 2013 -0400 I forgot to pass the string param objects. Change-Id: I691de93daa1a6acaa99fba3af359f062406023d3 diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 1fecb49..c929a62 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -808,7 +808,7 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, ScSetStringParam aParam; aParam.setTextInput(); -pDestDoc-SetString(aPos, ScGlobal::GetErrorString(nErrCode)); +pDestDoc-SetString(aPos, ScGlobal::GetErrorString(nErrCode), aParam); } else if (pFCell-IsValue()) { @@ -827,7 +827,7 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, { ScSetStringParam aParam; aParam.setTextInput(); -pDestDoc-SetString(aPos, aStr); +pDestDoc-SetString(aPos, aStr, aParam); } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/ui/optdlg/calcoptionsdlg.hrc |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 39b246ee6a4c91b0ff155c19415a9ee70c8eb1dd Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jun 25 14:20:20 2013 -0400 Avoid ID number clash. Change-Id: I7fbaad5ffc89e4df0d9ce79595e9e0426802e3cf diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hrc b/sc/source/ui/optdlg/calcoptionsdlg.hrc index a6f5ee4..be1dbbe 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hrc +++ b/sc/source/ui/optdlg/calcoptionsdlg.hrc @@ -35,8 +35,8 @@ #define STR_EMPTY_STRING_AS_ZERO_CAPTION 27 #define STR_EMPTY_STRING_AS_ZERO_DESC 28 -#define STR_OPENCL_ENABLED 28 -#define STR_OPENCL_ENABLED_DESC 29 +#define STR_OPENCL_ENABLED 29 +#define STR_OPENCL_ENABLED_DESC 30 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx | 31 --- 1 file changed, 8 insertions(+), 23 deletions(-) New commits: commit 62df0aefa69dd9b1d10d4f86372d379b0337d6f2 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jun 25 21:01:37 2013 -0400 Remove this inheritance. Change-Id: I37e0a6b8e95f56210df823af7aa8828189edfbef diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index ac3ab98..cfea95d 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2002,22 +2002,19 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn rCol) namespace { -class UpdateRefHandler +class UpdateRefOnCopy { protected: ScRange maRange; SCCOL mnDx; SCROW mnDy; SCTAB mnDz; -UpdateRefMode meMode; ScDocument* mpUndoDoc; bool mbUpdated; public: -UpdateRefHandler(const ScRange rRange, SCCOL nDx, SCROW nDy, SCTAB nDz, UpdateRefMode eMode, ScDocument* pUndoDoc) : -maRange(rRange), mnDx(nDx), mnDy(nDy), mnDz(nDz), meMode(eMode), mpUndoDoc(pUndoDoc), mbUpdated(false) {} - -virtual ~UpdateRefHandler() {} +UpdateRefOnCopy(const ScRange rRange, SCCOL nDx, SCROW nDy, SCTAB nDz, ScDocument* pUndoDoc) : +maRange(rRange), mnDx(nDx), mnDy(nDy), mnDz(nDz), mpUndoDoc(pUndoDoc), mbUpdated(false) {} bool isUpdated() const { return mbUpdated; } @@ -2031,23 +2028,11 @@ public: sc::formula_block::iterator itEnd = it; std::advance(itEnd, nDataSize); -size_t nRow = node.position + nOffset; -for (; it != itEnd; ++it, ++nRow) -updateReference(**it, static_castSCROW(nRow)); -} - -virtual void updateReference(ScFormulaCell rCell, SCROW nRow) = 0; -}; - -class UpdateRefOnCopy : public UpdateRefHandler -{ -public: -UpdateRefOnCopy(const ScRange rRange, SCCOL nDx, SCROW nDy, SCTAB nDz, ScDocument* pUndoDoc) : -UpdateRefHandler(rRange, nDx, nDy, nDz, URM_COPY, pUndoDoc) {} - -virtual void updateReference(ScFormulaCell rCell, SCROW /*nRow*/) -{ -mbUpdated |= rCell.UpdateReference(meMode, maRange, mnDx, mnDy, mnDz, mpUndoDoc); +for (; it != itEnd; ++it) +{ +ScFormulaCell rCell = **it; +mbUpdated |= rCell.UpdateReference(URM_COPY, maRange, mnDx, mnDy, mnDz, mpUndoDoc); +} } }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) New commits: commit 7a8f1b95ac66b06865e5d31d525bf43e822fdd54 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jun 25 23:14:43 2013 -0400 Let's not forget to store the position afterward. Change-Id: Ia5067db46460e164643dd8cc6d21b68a05b3b33a diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 600eb58..2ff8780 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1275,6 +1275,7 @@ class CopyToClipHandler const ScColumn mrSrcCol; ScColumn mrDestCol; sc::ColumnBlockPosition maDestPos; +sc::ColumnBlockPosition* mpDestPos; void setDefaultAttrsToDest(size_t nRow, size_t nSize) { @@ -1285,14 +1286,20 @@ class CopyToClipHandler public: CopyToClipHandler(const ScColumn rSrcCol, ScColumn rDestCol, sc::ColumnBlockPosition* pDestPos) : -mrSrcCol(rSrcCol), mrDestCol(rDestCol) +mrSrcCol(rSrcCol), mrDestCol(rDestCol), mpDestPos(pDestPos) { -if (pDestPos) -maDestPos = *pDestPos; +if (mpDestPos) +maDestPos = *mpDestPos; else mrDestCol.InitBlockPosition(maDestPos); } +~CopyToClipHandler() +{ +if (mpDestPos) +*mpDestPos = maDestPos; +} + void operator() (const sc::CellStoreType::value_type aNode, size_t nOffset, size_t nDataSize) { size_t nTopRow = aNode.position; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) New commits: commit 1bb5724be6e3e8844526a8d160013b25d6ce976f Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jun 25 23:30:56 2013 -0400 CopyUpdated() to use ParseBlock() instead of CopyCellsInRangeToColumn(). Change-Id: I7f1456462ac3bb9d551d3d1bb303a68d74fa16f1 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 2ff8780..c561035 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1897,13 +1897,7 @@ void ScColumn::UndoToColumn( void ScColumn::CopyUpdated( const ScColumn rPosCol, ScColumn rDestCol ) const { // Copy cells from this column to the destination column only for those -// rows that are present in the position column. - -sc::CellBlockCloneHandler aHdl(*pDocument, *rDestCol.pDocument, rDestCol.maCells, rDestCol.maCellTextAttrs); -sc::ColumnBlockConstPosition aSrcPos; -sc::ColumnBlockPosition aDestPos; -InitBlockPosition(aSrcPos); -rDestCol.InitBlockPosition(aDestPos); +// rows that are present in the position column (rPosCol). // First, mark all the non-empty cell ranges from the position column. sc::SingleColumnSpanSet aRangeSet; @@ -1913,9 +1907,17 @@ void ScColumn::CopyUpdated( const ScColumn rPosCol, ScColumn rDestCol ) const // marked row ranges. sc::SingleColumnSpanSet::SpansType aRanges; aRangeSet.getSpans(aRanges); + +CopyToClipHandler aFunc(*this, rDestCol, NULL); +sc::CellStoreType::const_iterator itPos = maCells.begin(); sc::SingleColumnSpanSet::SpansType::const_iterator it = aRanges.begin(), itEnd = aRanges.end(); for (; it != itEnd; ++it) -CopyCellsInRangeToColumn(aSrcPos, aDestPos, aHdl, it-mnRow1, it-mnRow2, rDestCol); +{ +itPos = sc::ParseBlock(itPos, maCells, aFunc, it-mnRow1, it-mnRow2); +rDestCol.RegroupFormulaCells(it-mnRow1, it-mnRow2); +} + +rDestCol.CellStorageModified(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/fillinfo.cxx | 184 ++- 1 file changed, 89 insertions(+), 95 deletions(-) New commits: commit 975351bf07cd83261258d60b5d734d34074c4804 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jun 21 16:09:22 2013 -0400 A little more cleanup. Remove CELLINFO macro, and rename nArrX and nArrY to nArrCol and nArrRow. Change-Id: Id105cfefc44e454be2df96a4084dee9185435fab diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index d34d914..c0c02d6 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -42,10 +42,6 @@ #include cellvalue.hxx #include mtvcellfunc.hxx -#include iostream - -// --- - const sal_uInt16 ROWINFO_MAX = 1024; @@ -129,8 +125,6 @@ static void lcl_GetMergeRange( SCsCOL nX, SCsROW nY, SCSIZE nArrY, rEndY = rStartY + pMerge-GetRowMerge() - 1; } -#define CELLINFO(x,y) pRowInfo[nArrY+y].pCellInfo[nArrX+x] - namespace { class RowInfoFiller @@ -224,8 +218,8 @@ void ScDocument::FillInfo( SCCOL nX; SCROW nY; SCsROW nSignedY; -SCCOL nArrX; -SCSIZE nArrY; +SCCOL nArrCol; +SCSIZE nArrRow; SCSIZE nArrCount; bool bAnyMerged = false; bool bAnyShadow = false; @@ -259,7 +253,7 @@ void ScDocument::FillInfo( // zuerst nur die Eintraege fuer die ganze Spalte -nArrY=0; +nArrRow=0; SCROW nYExtra = nRow2+1; sal_uInt16 nDocHeight = ScGlobal::nStdRowHeight; SCROW nDocHeightEndRow = -1; @@ -278,9 +272,9 @@ void ScDocument::FillInfo( nDocHeight = ScGlobal::nStdRowHeight; } -if ( nArrY==0 || nDocHeight || nY MAXROW ) +if ( nArrRow==0 || nDocHeight || nY MAXROW ) { -RowInfo* pThisRowInfo = pRowInfo[nArrY]; +RowInfo* pThisRowInfo = pRowInfo[nArrRow]; pThisRowInfo-pCellInfo = NULL; // wird unten belegt sal_uInt16 nHeight = (sal_uInt16) ( nDocHeight * fRowScale ); @@ -296,8 +290,8 @@ void ScDocument::FillInfo( pThisRowInfo-bPivotButton = false; pThisRowInfo-nRotMaxCol= SC_ROTMAX_NONE; -++nArrY; -if (nArrY = ROWINFO_MAX) +++nArrRow; +if (nArrRow = ROWINFO_MAX) { OSL_FAIL(FillInfo: Range too big ); nYExtra = nSignedY; // Ende @@ -308,7 +302,7 @@ void ScDocument::FillInfo( if (nSignedY==(SCsROW) nYExtra) // zusaetzliche Zeile verdeckt ? ++nYExtra; } -nArrCount = nArrY; // incl. Dummys +nArrCount = nArrRow; // incl. Dummys // rotierter Text... @@ -333,28 +327,28 @@ void ScDocument::FillInfo( FindMaxRotCol( nTab, pRowInfo[1], nArrCount-1, nCol1, nCol2 ); // FindMaxRotCol setzt nRotMaxCol -for (nArrY=0; nArrYnArrCount; nArrY++) -if (pRowInfo[nArrY].nRotMaxCol != SC_ROTMAX_NONE pRowInfo[nArrY].nRotMaxCol nRotMax) -nRotMax = pRowInfo[nArrY].nRotMaxCol; +for (nArrRow=0; nArrRownArrCount; nArrRow++) +if (pRowInfo[nArrRow].nRotMaxCol != SC_ROTMAX_NONE pRowInfo[nArrRow].nRotMaxCol nRotMax) +nRotMax = pRowInfo[nArrRow].nRotMaxCol; } // Zell-Infos erst nach dem Test auf gedrehte allozieren // bis nRotMax wegen nRotateDir Flag -for (nArrY=0; nArrYnArrCount; nArrY++) +for (nArrRow=0; nArrRownArrCount; nArrRow++) { -RowInfo* pThisRowInfo = pRowInfo[nArrY]; +RowInfo* pThisRowInfo = pRowInfo[nArrRow]; nY = pThisRowInfo-nRowNo; pThisRowInfo-pCellInfo = new CellInfo[ nRotMax+1+2 ]; // vom Aufrufer zu loeschen ! -for (nArrX=0; nArrX=nRotMax+2; nArrX++)// Zell-Infos vorbelegen +for (nArrCol=0; nArrCol=nRotMax+2; nArrCol++)// Zell-Infos vorbelegen { -if (nArrX0) -nX = nArrX-1; +if (nArrCol0) +nX = nArrCol-1; else nX = MAXCOL+1; // ungueltig -CellInfo* pInfo = pThisRowInfo-pCellInfo[nArrX]; +CellInfo* pInfo = pThisRowInfo-pCellInfo[nArrCol]; pInfo-bEmptyCellText = true; pInfo-maCell.clear(); if (bPaintMarks) @@ -392,9 +386,9 @@ void ScDocument::FillInfo( } } -for (nArrX=nCol2+3; nArrX=nRotMax+2; nArrX++)// restliche Breiten eintragen +for (nArrCol=nCol2+3; nArrCol=nRotMax+2; nArrCol++)// restliche Breiten eintragen { -nX = nArrX-1; +nX = nArrCol-1; if ( ValidCol(nX) ) { if (!ColHidden(nX, nTab)) @@ -403,7 +397,7 @@ void
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/scmatrix.cxx | 39 +++ 1 file changed, 19 insertions(+), 20 deletions(-) New commits: commit 093146191760973c5c05e57f43c05aede71a8641 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Sat Jun 22 01:20:04 2013 -0400 Use position objects for more efficient element value lookups. The underlying multi_type_vector didn't have the concept of position objects back when the matrix was reworked. It is now available, and there is no reason why we shouldn't use it to speed things up. Change-Id: Iac75a5584779c16e6eff7fcd577fc3d717c3c2e7 diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 010f8dc..26fe7d3 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -128,12 +128,13 @@ void compareMatrix(MatrixImplType rMat) { for (size_t j = 0; j aDim.column; ++j) { -mdds::mtm::element_t eType = rMat.get_type(i, j); +MatrixImplType::const_position_type aPos = rMat.position(i, j); +mdds::mtm::element_t eType = rMat.get_type(aPos); if (eType != mdds::mtm::element_numeric eType != mdds::mtm::element_boolean) // must be of numeric type (boolean can be numeric). continue; -double fVal = rMat.get_numeric(i, j); +double fVal = rMat.get_numeric(aPos); if (!::rtl::math::isFinite(fVal)) /* FIXME: this silently skips an error instead of propagating it! */ continue; @@ -469,20 +470,17 @@ OUString ScMatrixImpl::GetString(SCSIZE nC, SCSIZE nR) const if (ValidColRowOrReplicated( nC, nR )) { double fErr = 0.0; -switch (maMat.get_type(nR, nC)) +MatrixImplType::const_position_type aPos = maMat.position(nR, nC); +switch (maMat.get_type(aPos)) { case mdds::mtm::element_string: -return maMat.getOUString(nR, nC); +return maMat.get_string(aPos); case mdds::mtm::element_empty: return EMPTY_OUSTRING; case mdds::mtm::element_numeric: -OSL_FAIL(ScMatrixImpl::GetString: access error, no string); -fErr = maMat.getdouble(nR, nC); -break; case mdds::mtm::element_boolean: OSL_FAIL(ScMatrixImpl::GetString: access error, no string); -fErr = maMat.getbool(nR, nC); -break; +fErr = maMat.get_numeric(aPos); default: OSL_FAIL(ScMatrixImpl::GetString: access error, no string); } @@ -511,10 +509,11 @@ OUString ScMatrixImpl::GetString( SvNumberFormatter rFormatter, SCSIZE nC, SCSI } double fVal = 0.0; -switch (maMat.get_type(nR, nC)) +MatrixImplType::const_position_type aPos = maMat.position(nR, nC); +switch (maMat.get_type(aPos)) { case mdds::mtm::element_string: -return maMat.getOUString(nR, nC); +return maMat.get_string(aPos); case mdds::mtm::element_empty: { if (!maMatFlag.getbool(nR, nC)) @@ -530,10 +529,8 @@ OUString ScMatrixImpl::GetString( SvNumberFormatter rFormatter, SCSIZE nC, SCSI return aStr; } case mdds::mtm::element_numeric: -fVal = maMat.getdouble(nR, nC); -break; case mdds::mtm::element_boolean: -fVal = maMat.getbool(nR, nC); +fVal = maMat.get_numeric(aPos); break; default: ; @@ -558,20 +555,21 @@ ScMatrixValue ScMatrixImpl::Get(SCSIZE nC, SCSIZE nR) const ScMatrixValue aVal; if (ValidColRowOrReplicated(nC, nR)) { -mdds::mtm::element_t eType = maMat.get_type(nR, nC); +MatrixImplType::const_position_type aPos = maMat.position(nR, nC); +mdds::mtm::element_t eType = maMat.get_type(aPos); switch (eType) { case mdds::mtm::element_boolean: aVal.nType = SC_MATVAL_BOOLEAN; -aVal.fVal = maMat.get_boolean(nR, nC); +aVal.fVal = maMat.get_boolean(aPos); break; case mdds::mtm::element_numeric: aVal.nType = SC_MATVAL_VALUE; -aVal.fVal = maMat.get_numeric(nR, nC); +aVal.fVal = maMat.get_numeric(aPos); break; case mdds::mtm::element_string: aVal.nType = SC_MATVAL_STRING; -aVal.aStr = maMat.get_string(nR, nC); +aVal.aStr = maMat.get_string(aPos); break; case mdds::mtm::element_empty: // Empty path equals empty plus flag. @@ -775,12 +773,13 @@ double EvalMatrix(const MatrixImplType rMat) { for (size_t j = 0; j nCols; ++j) { -mdds::mtm::element_t eType = rMat.get_type(i, j); +
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/dociter.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit f1d92cb02d801bbac413f9027d8d5a4ffe98c07b Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jun 19 11:54:12 2013 -0400 Don't forget to return true if we are successful. Else we'd never get out of this inifite loop Change-Id: I96e072eb79cce77302b27cad42da31f9a66c3401 diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index ab0035f..7479097 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -936,6 +936,7 @@ bool ScCellIterator::getCurrent() } maCurCell.assign(maCurColPos.first, maCurColPos.second); +return true; } return false; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) New commits: commit b8f1fb252d45a7b97390264d4f3536562d868017 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jun 19 18:04:26 2013 -0400 Update references on all cells. Passed row range is the range of moved cells, not the range of cells to update. This alone fixes 3 unit tests. Change-Id: I4cb154879c6c33bc277bc2ab136f7580c35e479e diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index a239a0f..a62b05c 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2055,20 +2055,33 @@ public: } }; -class UpdateRefOnNonCopy : public UpdateRefHandler +class UpdateRefOnNonCopy { SCCOL mnCol; SCROW mnTab; +ScRange maRange; +SCCOL mnDx; +SCROW mnDy; +SCTAB mnDz; +UpdateRefMode meMode; +ScDocument* mpUndoDoc; +bool mbUpdated; + public: -UpdateRefOnNonCopy(SCCOL nCol, SCTAB nTab, const ScRange rRange, SCCOL nDx, SCROW nDy, SCTAB nDz, UpdateRefMode eMode, ScDocument* pUndoDoc) : -UpdateRefHandler(rRange, nDx, nDy, nDz, eMode, pUndoDoc), -mnCol(nCol), mnTab(nTab) {} +UpdateRefOnNonCopy( +SCCOL nCol, SCTAB nTab, const ScRange rRange, +SCCOL nDx, SCROW nDy, SCTAB nDz, UpdateRefMode eMode, +ScDocument* pUndoDoc) : +mnCol(nCol), mnTab(nTab), maRange(rRange), +mnDx(nDx), mnDy(nDy), mnDz(nDz), meMode(eMode), mpUndoDoc(pUndoDoc), mbUpdated(false) {} -virtual void updateReference(ScFormulaCell rCell, SCROW nRow) +void operator() (size_t nRow, ScFormulaCell* pCell) { ScAddress aUndoPos(mnCol, nRow, mnTab); -mbUpdated |= rCell.UpdateReference(meMode, maRange, mnDx, mnDy, mnDz, mpUndoDoc, aUndoPos); +mbUpdated |= pCell-UpdateReference(meMode, maRange, mnDx, mnDy, mnDz, mpUndoDoc, aUndoPos); } + +bool isUpdated() const { return mbUpdated; } }; } @@ -2087,7 +2100,7 @@ bool ScColumn::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW } UpdateRefOnNonCopy aHandler(nCol, nTab, aRange, nDx, nDy, nDz, eUpdateRefMode, pUndoDoc); -sc::ProcessBlock(maCells.begin(), maCells, aHandler, nRow1, nRow2); +sc::ProcessFormula(maCells, aHandler); return aHandler.isUpdated(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |2 ++ sc/source/core/data/table2.cxx |3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) New commits: commit 74c3f9fd840c38249d0acc8bc4ce94d785c274b3 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jun 18 16:28:10 2013 -0400 Compiler warnings. Change-Id: I79b8370429bccaf8467a5c87ee5b68b643fb2f75 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 82ccdf9..ea9570e 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1998,6 +1998,8 @@ public: UpdateRefHandler(const ScRange rRange, SCCOL nDx, SCROW nDy, SCTAB nDz, UpdateRefMode eMode, ScDocument* pUndoDoc) : maRange(rRange), mnDx(nDx), mnDy(nDy), mnDz(nDz), meMode(eMode), mpUndoDoc(pUndoDoc), mbUpdated(false) {} +virtual ~UpdateRefHandler() {} + bool isUpdated() const { return mbUpdated; } void operator() (sc::CellStoreType::value_type node, size_t nOffset, size_t nDataSize) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 6b80609..51e8e12 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -3484,8 +3484,7 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC continue; OutlineArrayFinder aFunc(aRef, nCol, nTab, pArray, bSizeChanged); -std::pairsc::CellStoreType::const_iterator,size_t aPos = -sc::FindFormula(aCol[nCol].maCells, nStartRow, nEndRow, aFunc); +sc::FindFormula(aCol[nCol].maCells, nStartRow, nEndRow, aFunc); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx | 20 1 file changed, 16 insertions(+), 4 deletions(-) New commits: commit 4a01dc6db2ba07bb22b539e5f6c3373bd6e1ed4c Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jun 18 23:16:00 2013 -0400 When deleting cells, be sure to delete the corresponding cell attrs as well. The cell and cell attr arrays must - be - in - sync - at - all - times. Change-Id: I2854c977eada389e5b9d908b97dd3fa78fc62097 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 53eb88a..6edafee 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -573,15 +573,18 @@ public: class EmptyCells { +sc::ColumnBlockPosition mrPos; sc::CellStoreType::iterator miPos; sc::CellStoreType mrCells; +sc::CellTextAttrStoreType mrAttrs; public: -EmptyCells(sc::CellStoreType::iterator itPos, sc::CellStoreType rCells) : -miPos(itPos), mrCells(rCells) {} +EmptyCells(sc::ColumnBlockPosition rPos, sc::CellStoreType rCells, sc::CellTextAttrStoreType rAttrs) : +mrPos(rPos), mrCells(rCells), mrAttrs(rAttrs) {} void operator() (const sc::SingleColumnSpanSet::Span rSpan) { -miPos = mrCells.set_empty(miPos, rSpan.mnRow1, rSpan.mnRow2); +mrPos.miCellPos = mrCells.set_empty(mrPos.miCellPos, rSpan.mnRow1, rSpan.mnRow2); +mrPos.miCellTextAttrPos = mrAttrs.set_empty(mrPos.miCellTextAttrPos, rSpan.mnRow1, rSpan.mnRow2); } }; @@ -599,15 +602,24 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag) if (!IsEmptyData() nContFlag) { +// There are cells to delete. Determine which cells to delete based on the deletion flags. DeleteAreaHandler aFunc(*pDocument, nDelFlag); sc::CellStoreType::iterator itPos = maCells.position(nStartRow).first; sc::ProcessBlock(itPos, maCells, aFunc, nStartRow, nEndRow); aFunc.endFormulas(); // Have the formula cells stop listening. aFunc.getSpans().getRows(aDeletedRows); +// Get the deletion spans. sc::SingleColumnSpanSet::SpansType aSpans; aFunc.getSpans().getSpans(aSpans); -std::for_each(aSpans.begin(), aSpans.end(), EmptyCells(itPos, maCells)); + +sc::ColumnBlockPosition aBlockPos; +aBlockPos.miCellPos = itPos; +aBlockPos.miCellTextAttrPos = maCellTextAttrs.begin(); + +// Delete the cells for real. +std::for_each(aSpans.begin(), aSpans.end(), EmptyCells(aBlockPos, maCells, maCellTextAttrs)); +CellStorageModified(); } if ( nDelFlag IDF_EDITATTR ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column2.cxx |7 --- 1 file changed, 7 deletions(-) New commits: commit 96af3caabee934baf5bb602064ad9aa7f7cb7ab9 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 22 14:08:50 2013 -0400 Remove unnecessary debug outputs that would slow down perf tests. Change-Id: I221c5ffd2614b547a1d8ea0fab8794e468a1df7e diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index fbd0c0a..eec2b96 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1390,17 +1390,11 @@ void ScColumn::CellStorageModified() return; } -cout -- begin endl; -std::vectorColEntry::const_iterator it = maItems.begin(), itEnd = maItems.end(); -for (; it != itEnd; ++it) -cout ScColumn::CellStorageModified: entry: row = it-nRow ; cell = it-pCell endl; - ScColumnTextWidthIterator aIter(*this, 0, MAXROW); for (; aIter.hasCell(); aIter.next()) { SCROW nRow = aIter.getPos(); ScBaseCell* pCell = GetCell(nRow); -cout ScColumn::CellStorageModified: row = nRow ; cell = pCell endl; if (!pCell) { cout ScColumn::CellStorageModified: Cell and text width storages are out of sync! endl; @@ -1408,7 +1402,6 @@ void ScColumn::CellStorageModified() abort(); } } -cout -- end endl; #endif } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column2.cxx | 36 ++-- sc/source/core/data/column3.cxx | 18 +- 2 files changed, 27 insertions(+), 27 deletions(-) New commits: commit 310c20adc13a4b10d9de66272611198e364f6a6c Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 22 21:00:56 2013 -0400 Re-org the headers a bit. In column?.cxx, column.hxx must be the first. Change-Id: I5014c06a8dd8335b5dd5c127f86a59331d54af88 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index e43b84b..344d4f4 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -17,25 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include scitems.hxx -#include editeng/eeitem.hxx - -#include svx/algitem.hxx -#include editeng/editobj.hxx -#include editeng/editstat.hxx -#include editeng/emphasismarkitem.hxx -#include editeng/fhgtitem.hxx -#include editeng/forbiddencharacterstable.hxx -#include svx/rotmodit.hxx -#include editeng/scripttypeitem.hxx -#include editeng/unolingu.hxx -#include editeng/justifyitem.hxx -#include svl/zforlist.hxx -#include svl/broadcast.hxx -#include svl/listeneriter.hxx -#include vcl/outdev.hxx - #include column.hxx +#include scitems.hxx #include cell.hxx #include formulacell.hxx #include document.hxx @@ -62,6 +45,23 @@ #include math.h +#include editeng/eeitem.hxx + +#include svx/algitem.hxx +#include editeng/editobj.hxx +#include editeng/editstat.hxx +#include editeng/emphasismarkitem.hxx +#include editeng/fhgtitem.hxx +#include editeng/forbiddencharacterstable.hxx +#include svx/rotmodit.hxx +#include editeng/scripttypeitem.hxx +#include editeng/unolingu.hxx +#include editeng/justifyitem.hxx +#include svl/zforlist.hxx +#include svl/broadcast.hxx +#include svl/listeneriter.hxx +#include vcl/outdev.hxx + #include boost/scoped_ptr.hpp #if DEBUG_COLUMN_STORAGE diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 60eb8e3..2341261 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -17,17 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include boost/scoped_ptr.hpp - -#include mdds/flat_segment_tree.hpp - -#include sfx2/objsh.hxx -#include svl/zforlist.hxx -#include svl/zformat.hxx -#include svl/broadcast.hxx +#include column.hxx #include scitems.hxx -#include column.hxx #include cell.hxx #include formulacell.hxx #include document.hxx @@ -53,6 +45,14 @@ #include com/sun/star/i18n/LocaleDataItem.hpp +#include boost/scoped_ptr.hpp + +#include mdds/flat_segment_tree.hpp + +#include sfx2/objsh.hxx +#include svl/zforlist.hxx +#include svl/zformat.hxx +#include svl/broadcast.hxx #include cstdio using ::com::sun::star::i18n::LocaleDataItem; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/document.cxx | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) New commits: commit 34da5c4cd4d4dbbffe347b8cc425630b255d9333 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon May 20 12:35:05 2013 -0400 A bit of cleanup. Change-Id: I9f200377c1f5bf44eb4ba60c272b02ae3d632a19 diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index d47f837..d9145b0 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2229,26 +2229,29 @@ ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler() SvtBroadcaster* ScDocument::GetBroadcaster( const ScAddress rPos ) { -if (!TableExists(rPos.Tab())) +ScTable* pTab = FetchTable(rPos.Tab()); +if (!pTab) return NULL; -return maTabs[rPos.Tab()]-GetBroadcaster(rPos.Col(), rPos.Row()); +return pTab-GetBroadcaster(rPos.Col(), rPos.Row()); } const SvtBroadcaster* ScDocument::GetBroadcaster( const ScAddress rPos ) const { -if (!TableExists(rPos.Tab())) +ScTable* pTab = FetchTable(rPos.Tab()); +if (!pTab) return NULL; -return maTabs[rPos.Tab()]-GetBroadcaster(rPos.Col(), rPos.Row()); +return pTab-GetBroadcaster(rPos.Col(), rPos.Row()); } void ScDocument::DeleteBroadcasters( const ScAddress rTopPos, SCROW nLength ) { -if (!TableExists(rTopPos.Tab()) || nLength = 0) +ScTable* pTab = FetchTable(rTopPos.Tab()); +if (!pTab || nLength = 0) return; -maTabs[rTopPos.Tab()]-DeleteBroadcasters(rTopPos.Col(), rTopPos.Row(), rTopPos.Row()+nLength-1); +pTab-DeleteBroadcasters(rTopPos.Col(), rTopPos.Row(), rTopPos.Row()+nLength-1); } bool ScDocument::TableExists( SCTAB nTab ) const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/document.cxx | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) New commits: commit fbd16ee01bd9d69b21e1c6ba0746a2bc02028f7b Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri May 17 13:43:18 2013 -0400 Make it exception safe. Change-Id: Ib9b734ac9800b1ecf005dcd3a66beac6fcfc3a4f diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 4e54630..cf2ae95 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -94,6 +94,7 @@ #include map #include limits +#include boost/scoped_ptr.hpp using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -2869,7 +2870,7 @@ void ScDocument::FillTab( const ScRange rSrcArea, const ScMarkData rMark, SCROW nStartRow = rSrcArea.aStart.Row(); SCCOL nEndCol = rSrcArea.aEnd.Col(); SCROW nEndRow = rSrcArea.aEnd.Row(); -ScDocument* pMixDoc = NULL; +boost::scoped_ptrScDocument pMixDoc; bool bDoMix = ( bSkipEmpty || nFunction ) ( nFlags IDF_CONTENTS ); bool bOldAutoCalc = GetAutoCalc(); @@ -2887,7 +2888,7 @@ void ScDocument::FillTab( const ScRange rSrcArea, const ScMarkData rMark, { if (!pMixDoc) { -pMixDoc = new ScDocument( SCDOCMODE_UNDO ); +pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO)); pMixDoc-InitUndo( this, i, i ); } else @@ -2906,8 +2907,6 @@ void ScDocument::FillTab( const ScRange rSrcArea, const ScMarkData rMark, nFunction, bSkipEmpty, pMixDoc-maTabs[i] ); } -delete pMixDoc; - SetAutoCalc( bOldAutoCalc ); } else @@ -2927,7 +2926,7 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData rMark, if (ValidTab(nSrcTab) nSrcTab static_castSCTAB(maTabs.size()) maTabs[nSrcTab]) { -ScDocument* pMixDoc = NULL; +boost::scoped_ptrScDocument pMixDoc; bool bDoMix = ( bSkipEmpty || nFunction ) ( nFlags IDF_CONTENTS ); bool bOldAutoCalc = GetAutoCalc(); @@ -2952,7 +2951,7 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData rMark, { if (!pMixDoc) { -pMixDoc = new ScDocument( SCDOCMODE_UNDO ); +pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO)); pMixDoc-InitUndo( this, i, i ); } else @@ -2972,8 +2971,6 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData rMark, maTabs[i]-MixMarked( rMark, nFunction, bSkipEmpty, pMixDoc-maTabs[i] ); } -delete pMixDoc; - SetAutoCalc( bOldAutoCalc ); } else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 17de72429221d33877623062bca4a59207f75948 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri May 17 22:16:45 2013 -0400 Compiler warning. Change-Id: I6f358f89348a23b3c70f8b7db8a1f01d659393ba diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 9339e8b..f573011 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -906,8 +906,7 @@ void ScColumn::MixData( SCSIZE nIndex; Search( nRow1, nIndex ); -// SCSIZE nSrcIndex = 0; -SCSIZE nSrcIndex, nDestIndex; +SCSIZE nSrcIndex = 0, nDestIndex = 0; rSrcCol.Search( nRow1, nSrcIndex ); // See if data is at the beginning SCROW nNextThis = MAXROW+1; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx | 73 1 file changed, 38 insertions(+), 35 deletions(-) New commits: commit 3d636ac17f37da247a803ae20d84660d2ff3ad3d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri May 17 22:45:43 2013 -0400 Prefer early bail-out. Change-Id: I112a4be56910c07007b28715336fcd82d56bb313 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index f573011..70d007d 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -1103,38 +1103,40 @@ ScAttrIterator* ScColumn::CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) c void ScColumn::StartAllListeners() { -if ( !maItems.empty() ) -for (SCSIZE i = 0; i maItems.size(); i++) +if (maItems.empty()) +return; + +for (SCSIZE i = 0; i maItems.size(); i++) +{ +ScBaseCell* pCell = maItems[i].pCell; +if ( pCell-GetCellType() == CELLTYPE_FORMULA ) { -ScBaseCell* pCell = maItems[i].pCell; -if ( pCell-GetCellType() == CELLTYPE_FORMULA ) -{ -SCROW nRow = maItems[i].nRow; -((ScFormulaCell*)pCell)-StartListeningTo( pDocument ); -if ( nRow != maItems[i].nRow ) -Search( nRow, i ); // Insert Listener? -} +SCROW nRow = maItems[i].nRow; +((ScFormulaCell*)pCell)-StartListeningTo( pDocument ); +if ( nRow != maItems[i].nRow ) +Search( nRow, i ); // Insert Listener? } +} } void ScColumn::StartNeededListeners() { -if ( !maItems.empty() ) +if (maItems.empty()) +return; + +for (SCSIZE i = 0; i maItems.size(); i++) { -for (SCSIZE i = 0; i maItems.size(); i++) +ScBaseCell* pCell = maItems[i].pCell; +if ( pCell-GetCellType() == CELLTYPE_FORMULA ) { -ScBaseCell* pCell = maItems[i].pCell; -if ( pCell-GetCellType() == CELLTYPE_FORMULA ) +ScFormulaCell* pFCell = static_castScFormulaCell*(pCell); +if (pFCell-NeedsListening()) { -ScFormulaCell* pFCell = static_castScFormulaCell*(pCell); -if (pFCell-NeedsListening()) -{ -SCROW nRow = maItems[i].nRow; -pFCell-StartListeningTo( pDocument ); -if ( nRow != maItems[i].nRow ) -Search( nRow, i ); // Insert Listener? -} +SCROW nRow = maItems[i].nRow; +pFCell-StartListeningTo( pDocument ); +if ( nRow != maItems[i].nRow ) +Search( nRow, i ); // Insert Listener? } } } @@ -1166,20 +1168,21 @@ void ScColumn::BroadcastInArea( SCROW nRow1, SCROW nRow2 ) void ScColumn::StartListeningInArea( SCROW nRow1, SCROW nRow2 ) { -if ( !maItems.empty() ) +if (maItems.empty()) +return; + +SCROW nRow; +SCSIZE nIndex; +Search( nRow1, nIndex ); +while ( nIndex maItems.size() (nRow = maItems[nIndex].nRow) = nRow2 ) { -SCROW nRow; -SCSIZE nIndex; -Search( nRow1, nIndex ); -while ( nIndex maItems.size() (nRow = maItems[nIndex].nRow) = nRow2 ) -{ -ScBaseCell* pCell = maItems[nIndex].pCell; -if ( pCell-GetCellType() == CELLTYPE_FORMULA ) -((ScFormulaCell*)pCell)-StartListeningTo( pDocument ); -if ( nRow != maItems[nIndex].nRow ) -Search( nRow, nIndex ); // Inserted via Listening -nIndex++; -} +ScBaseCell* pCell = maItems[nIndex].pCell; +if ( pCell-GetCellType() == CELLTYPE_FORMULA ) +((ScFormulaCell*)pCell)-StartListeningTo( pDocument ); +if ( nRow != maItems[nIndex].nRow ) +Search( nRow, nIndex ); // Inserted via Listening + +++nIndex; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 49 ++-- 1 file changed, 14 insertions(+), 35 deletions(-) New commits: commit 8935351b3785661e13d661b39397693b4e2bdebe Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri May 17 23:33:30 2013 -0400 A bit of cleanup before refactoring. Change-Id: I3627a83669b6a69c299aef96b8b2ead1352eabe2 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index b243ea2..30810df 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3188,53 +3188,32 @@ void ScFormulaCell::StartListeningTo( ScDocument* pDoc ) switch( eType ) { case svSingleRef: -rRef1.CalcAbsIfRel(aPos); -if ( rRef1.Valid() ) -{ -pDoc-StartListeningCell( -ScAddress( rRef1.nCol, - rRef1.nRow, - rRef1.nTab ), this ); -} +{ +ScAddress aCell = rRef1.toAbs(aPos); +if (aCell.IsValid()) +pDoc-StartListeningCell(aCell, this); +} break; case svDoubleRef: -t-CalcAbsIfRel(aPos); -if ( rRef1.Valid() rRef2.Valid() ) +{ +ScAddress aCell1 = rRef1.toAbs(aPos); +ScAddress aCell2 = rRef2.toAbs(aPos); +if (aCell1.IsValid() aCell2.IsValid()) { -if ( t-GetOpCode() == ocColRowNameAuto ) +if (t-GetOpCode() == ocColRowNameAuto) { // automagically if ( rRef1.IsColRel() ) { // ColName -pDoc-StartListeningArea( ScRange ( -rRef1.nCol, -rRef1.nRow, -rRef1.nTab, -rRef2.nCol, -MAXROW, -rRef2.nTab ), this ); +aCell2.SetRow(MAXROW); } else { // RowName -pDoc-StartListeningArea( ScRange ( -rRef1.nCol, -rRef1.nRow, -rRef1.nTab, -MAXCOL, -rRef2.nRow, -rRef2.nTab ), this ); +aCell2.SetCol(MAXCOL); } } -else -{ -pDoc-StartListeningArea( ScRange ( -rRef1.nCol, -rRef1.nRow, -rRef1.nTab, -rRef2.nCol, -rRef2.nRow, -rRef2.nTab ), this ); -} +pDoc-StartListeningArea(ScRange(aCell1, aCell2), this); } +} break; default: ; // nothing ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column2.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 496ccaad1c2ad6ed17af5efac0b632d7a3ebf38a Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu May 16 20:53:58 2013 -0400 Get the script type in an efficient manner. This alone makes AdjustRowHeight() fly on large ranges, by eliminating the silly O(n^2) algorithm. Change-Id: Id2693aab7fb9b2a5575c6390fcaae5a404549962 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 1b8afa2..05430f3 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -781,9 +781,10 @@ void ScColumn::GetOptimalHeight( SCSIZE nIndex; Search(nStart,nIndex); +sc::CellTextAttrStoreType::iterator itAttr = maCellTextAttrs.begin(); while ( nIndex maItems.size() (nRow=maItems[nIndex].nRow) = nEnd ) { -sal_uInt8 nScript = pDocument-GetScriptType(nCol, nRow, nTab); +sal_uInt8 nScript = GetRangeScriptType(itAttr, nRow, nRow); if ( nScript != nDefScript ) { if ( nScript == SCRIPTTYPE_ASIAN ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 115 +++- 1 file changed, 38 insertions(+), 77 deletions(-) New commits: commit 1a8c826099bf9df196d58d84e67704b31ca4adc1 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue May 14 15:55:10 2013 -0400 Remove duplicate code blocks. Change-Id: I945c7ae834393c760d8a552043c391ff0eb9ce22 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index a91722f..b243ea2 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3243,8 +3243,34 @@ void ScFormulaCell::StartListeningTo( ScDocument* pDoc ) SetNeedsListening( false); } -// pArr gesetzt - Referenzen von anderer Zelle nehmen -// Then aPos must also be commited +namespace { + +void endListeningArea( +ScFormulaCell* pCell, ScDocument rDoc, const ScAddress rPos, const ScToken rToken) +{ +const ScSingleRefData rRef1 = rToken.GetSingleRef(); +const ScSingleRefData rRef2 = rToken.GetSingleRef2(); +ScAddress aCell1 = rRef1.toAbs(rPos); +ScAddress aCell2 = rRef2.toAbs(rPos); +if (aCell1.IsValid() aCell2.IsValid()) +{ +if (rToken.GetOpCode() == ocColRowNameAuto) +{ // automagically +if ( rRef1.IsColRel() ) +{ // ColName +aCell2.SetRow(MAXROW); +} +else +{ // RowName +aCell2.SetCol(MAXCOL); +} +} + +rDoc.EndListeningArea(ScRange(aCell1, aCell2), pCell); +} +} + +} void ScFormulaCell::EndListeningTo( ScDocument* pDoc, ScTokenArray* pArr, ScAddress aCellPos ) @@ -3269,60 +3295,17 @@ void ScFormulaCell::EndListeningTo( ScDocument* pDoc, ScTokenArray* pArr, ScToken* t; while ( ( t = static_castScToken*(pArr-GetNextReferenceRPN()) ) != NULL ) { -StackVar eType = t-GetType(); -ScSingleRefData rRef1 = t-GetSingleRef(); -ScSingleRefData rRef2 = (eType == svDoubleRef ? -t-GetDoubleRef().Ref2 : rRef1); -switch( eType ) +switch (t-GetType()) { case svSingleRef: -rRef1.CalcAbsIfRel( aCellPos ); -if ( rRef1.Valid() ) -{ -pDoc-EndListeningCell( -ScAddress( rRef1.nCol, - rRef1.nRow, - rRef1.nTab ), this ); -} +{ +ScAddress aCell = t-GetSingleRef().toAbs(aPos); +if (aCell.IsValid()) +pDoc-EndListeningCell(aCell, this); +} break; case svDoubleRef: -t-CalcAbsIfRel( aCellPos ); -if ( rRef1.Valid() rRef2.Valid() ) -{ -if ( t-GetOpCode() == ocColRowNameAuto ) -{ // automagically -if ( rRef1.IsColRel() ) -{ // ColName -pDoc-EndListeningArea( ScRange ( -rRef1.nCol, -rRef1.nRow, -rRef1.nTab, -rRef2.nCol, -MAXROW, -rRef2.nTab ), this ); -} -else -{ // RowName -pDoc-EndListeningArea( ScRange ( -rRef1.nCol, -rRef1.nRow, -rRef1.nTab, -MAXCOL, -rRef2.nRow, -rRef2.nTab ), this ); -} -} -else -{ -pDoc-EndListeningArea( ScRange ( -rRef1.nCol, -rRef1.nRow, -rRef1.nTab, -rRef2.nCol, -rRef2.nRow, -rRef2.nTab ), this ); -} -} +endListeningArea(this, *pDoc, aCellPos, *t); break; default: ; // nothing @@ -3348,39 +3331,17 @@ void ScFormulaCell::EndListeningTo( sc::EndListeningContext rCxt ) ScToken* t; while ( ( t = static_castScToken*(pCode-GetNextReferenceRPN()) ) != NULL ) { -StackVar eType = t-GetType(); -ScSingleRefData rRef1 = t-GetSingleRef(); -ScSingleRefData rRef2 = (eType == svDoubleRef ? t-GetDoubleRef().Ref2 : rRef1); -switch (eType) +switch (t-GetType()) { case svSingleRef: { -ScAddress aCell = rRef1.toAbs(aPos); +ScAddress aCell =
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/document.cxx | 303 +++ 1 file changed, 152 insertions(+), 151 deletions(-) New commits: commit 79b86d051f5c4e7d2c744201bde146ba5e5bf7e5 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue May 14 21:33:22 2013 -0400 Reduce indentation level by early bail-out. Change-Id: I5e108efa0219620696d15a304d2f4e3566d58d57 diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 3cfdaa6..c51804a 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2434,173 +2434,174 @@ void ScDocument::CopyFromClip( const ScRange rDestRange, const ScMarkData rMar bool bAsLink, bool bIncludeFiltered, bool bSkipAttrForEmpty, const ScRangeList * pDestRanges ) { -if (!bIsClip) +if (bIsClip) +return; + +if (!pClipDoc) { -if (!pClipDoc) +OSL_FAIL(CopyFromClip: no ClipDoc); +pClipDoc = SC_MOD()-GetClipDoc(); +} + +if (!pClipDoc-bIsClip || !pClipDoc-GetTableCount()) +return; + +bool bOldAutoCalc = GetAutoCalc(); +SetAutoCalc( false ); // avoid multiple recalculations + +NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc); + +SCCOL nAllCol1 = rDestRange.aStart.Col(); +SCROW nAllRow1 = rDestRange.aStart.Row(); +SCCOL nAllCol2 = rDestRange.aEnd.Col(); +SCROW nAllRow2 = rDestRange.aEnd.Row(); + +SCCOL nXw = 0; +SCROW nYw = 0; +ScRange aClipRange = pClipDoc-GetClipParam().getWholeRange(); +for (SCTAB nTab = 0; nTab static_castSCTAB(pClipDoc-maTabs.size()); nTab++)// find largest merge overlap +if (pClipDoc-maTabs[nTab]) // all sheets of the clipboard content { -OSL_FAIL(CopyFromClip: no ClipDoc); -pClipDoc = SC_MOD()-GetClipDoc(); +SCCOL nThisEndX = aClipRange.aEnd.Col(); +SCROW nThisEndY = aClipRange.aEnd.Row(); +pClipDoc-ExtendMerge( aClipRange.aStart.Col(), +aClipRange.aStart.Row(), +nThisEndX, nThisEndY, nTab ); +// only extra value from ExtendMerge +nThisEndX = sal::static_int_castSCCOL( nThisEndX - aClipRange.aEnd.Col() ); +nThisEndY = sal::static_int_castSCROW( nThisEndY - aClipRange.aEnd.Row() ); +if ( nThisEndX nXw ) +nXw = nThisEndX; +if ( nThisEndY nYw ) +nYw = nThisEndY; } -if (pClipDoc-bIsClip pClipDoc-GetTableCount()) -{ -bool bOldAutoCalc = GetAutoCalc(); -SetAutoCalc( false ); // avoid multiple recalculations -NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc); +SCCOL nDestAddX; +SCROW nDestAddY; +pClipDoc-GetClipArea( nDestAddX, nDestAddY, bIncludeFiltered ); +nXw = sal::static_int_castSCCOL( nXw + nDestAddX ); +nYw = sal::static_int_castSCROW( nYw + nDestAddY ); // ClipArea, plus ExtendMerge value + +/* Decide which contents to delete before copying. Delete all +contents if nInsFlag contains any real content flag. +#i102056# Notes are pasted from clipboard in a second pass, +together with the special flag IDF_ADDNOTES that states to not +overwrite/delete existing cells but to insert the notes into +these cells. In this case, just delete old notes from the +destination area. */ +sal_uInt16 nDelFlag = IDF_NONE; +if ( (nInsFlag (IDF_CONTENTS | IDF_ADDNOTES)) == (IDF_NOTE | IDF_ADDNOTES) ) +nDelFlag |= IDF_NOTE; +else if ( nInsFlag IDF_CONTENTS ) +nDelFlag |= IDF_CONTENTS; +// With bSkipAttrForEmpty, don't remove attributes, copy +// on top of existing attributes instead. +if ( ( nInsFlag IDF_ATTRIB ) !bSkipAttrForEmpty ) +nDelFlag |= IDF_ATTRIB; -SCCOL nAllCol1 = rDestRange.aStart.Col(); -SCROW nAllRow1 = rDestRange.aStart.Row(); -SCCOL nAllCol2 = rDestRange.aEnd.Col(); -SCROW nAllRow2 = rDestRange.aEnd.Row(); +ScCopyBlockFromClipParams aCBFCP; +aCBFCP.pRefUndoDoc = pRefUndoDoc; +aCBFCP.pClipDoc = pClipDoc; +aCBFCP.nInsFlag = nInsFlag; +aCBFCP.bAsLink = bAsLink; +aCBFCP.bSkipAttrForEmpty = bSkipAttrForEmpty; +aCBFCP.nTabStart = MAXTAB; // wird in der Schleife angepasst +aCBFCP.nTabEnd = 0; // wird in der Schleife angepasst -SCCOL nXw = 0; -SCROW nYw = 0; -ScRange aClipRange = pClipDoc-GetClipParam().getWholeRange(); -for (SCTAB nTab = 0; nTab static_castSCTAB(pClipDoc-maTabs.size()); nTab++)// find largest merge overlap -if (pClipDoc-maTabs[nTab]) // all sheets of the clipboard content -{ -SCCOL nThisEndX = aClipRange.aEnd.Col(); -
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/documentimport.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c9890aa1b1a588ff0cc5727137ecd249343694d8 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 8 14:51:16 2013 -0400 Script types are unsigned char now. Change-Id: I744d66da3abd18753550692b931c6a1a52b83401 diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index e0df2a2..bb638af 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -115,7 +115,7 @@ void ScDocumentImport::finalize() for (; itCell != itCellEnd; ++itCell) { itWidthPos = rCol.maTextWidths.setunsigned short(itWidthPos, itCell-nRow, TEXTWIDTH_DIRTY); -itScriptPos = rCol.maScriptTypes.setunsigned short(itScriptPos, itCell-nRow, SC_SCRIPTTYPE_UNKNOWN); +itScriptPos = rCol.maScriptTypes.setunsigned char(itScriptPos, itCell-nRow, SC_SCRIPTTYPE_UNKNOWN); } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) New commits: commit ee6c86684bdc672fe1e493b901f6bea1bc7c1e1f Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 8 15:15:15 2013 -0400 No need to check for broadcaster's presence here. The old code did because it would then have to create a ScNoteCell to optionally store the broadcaster. That's no longer the case. Change-Id: I5e031270e0ed77425b2be192a1705c64c6fa8f45 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index e9ecd31..e36312b 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -328,10 +328,9 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe for ( SCSIZE nIdx = nStartIndex; nIdx = nEndIndex; ++nIdx ) { -SCROW nRow = maItems[nIdx].nRow; -if (((nDelFlag IDF_CONTENTS) == IDF_CONTENTS) maBroadcasters.is_empty(nRow)) +if (((nDelFlag IDF_CONTENTS) == IDF_CONTENTS)) { -// all content is deleted and cell does not contain broadcaster +// all content is to be deleted. ScBaseCell* pOldCell = maItems[ nIdx ].pCell; if (pOldCell-GetCellType() == CELLTYPE_FORMULA) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 38aa448312398842f434c7c62a822e7fc23fe249 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 8 15:43:36 2013 -0400 This is not necessary either. Change-Id: I9651d58209afd1dd9a77d859db0925b586c3c8ab diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 1ffa949..97b361e 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1211,7 +1211,6 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize ) if (pBC) { MoveListeners( *pBC, pDelRows[i] - nSize ); -maBroadcasters.set_empty(nDelRow, nDelRow); ppDelCells[i]-Delete(); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx | 31 --- 1 file changed, 8 insertions(+), 23 deletions(-) New commits: commit c5d188a7cbd4f0e85e4911ce3d97c606d07de4f2 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 8 16:04:50 2013 -0400 Simplify this a bit. By taking advantage of 1) cell array being std::vector, and 2) broadcasters are no longer stored with cells. Change-Id: I9ba1d3004e62d7bb7810d8fed0c4e8fd17605d0f diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 97b361e..af373d6 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1194,29 +1194,14 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize ) if (bCountChanged) { -SCSIZE nDelCount = maItems.size() - nNewCount; -ScBaseCell** ppDelCells = new ScBaseCell*[nDelCount]; -SCROW* pDelRows = new SCROW[nDelCount]; -for (i = 0; i nDelCount; i++) -{ -ppDelCells[i] = maItems[nNewCount+i].pCell; -pDelRows[i] = maItems[nNewCount+i].nRow; -} -maItems.resize( nNewCount ); - -for (i = 0; i nDelCount; i++) -{ -SCROW nDelRow = pDelRows[i]; -SvtBroadcaster* pBC = GetBroadcaster(nDelRow); -if (pBC) -{ -MoveListeners( *pBC, pDelRows[i] - nSize ); -ppDelCells[i]-Delete(); -} -} - -delete [] pDelRows; -delete [] ppDelCells; +// Some cells in the lower part of the cell array have been pushed out +// beyond MAXROW. Delete them. +std::vectorColEntry::iterator itBeg = maItems.begin(); +std::advance(itBeg, nNewCount); +for (std::vectorColEntry::iterator it = itBeg; it != maItems.end(); ++it) +it-pCell-Delete(); + +maItems.erase(itBeg, maItems.end()); } pDocument-SetAutoCalc( bOldAutoCalc ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx |3 --- 1 file changed, 3 deletions(-) New commits: commit c7a07fc3cc179fa3928e4de11e237774c30e19d8 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 8 00:08:14 2013 -0400 Change of plan. ScColumn::DeleteRange() will NOT broadcast. Ever. Change-Id: I610cafaab2d29d0260ebeacdd9b2bf75722a95f2 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 9290e3a..e9ecd31 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -435,9 +435,6 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe (*aIt)-Delete(); } } - -// TODO: Broadcasting is temporarily removed from this method. Add it back -// once the broadcaster refactoring is finished. } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/dpfilteredcache.cxx|2 +- sc/source/core/data/segmenttree.cxx|2 +- sc/source/filter/excel/colrowst.cxx|4 ++-- sc/source/filter/xml/XMLStylesExportHelper.cxx |2 +- 4 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 4a8e36d20609f1f7918976d4db13d720524a3c9c Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon May 6 10:27:55 2013 -0400 Adjust for API change in mdds 0.8.0. The return value of search_tree() in flat_segment_tree has changed. Change-Id: I51d8676bd0621bd43b3f8a8f6be4bf4056d45904 diff --git a/sc/source/core/data/dpfilteredcache.cxx b/sc/source/core/data/dpfilteredcache.cxx index 47adbbe..51bf571 100644 --- a/sc/source/core/data/dpfilteredcache.cxx +++ b/sc/source/core/data/dpfilteredcache.cxx @@ -172,7 +172,7 @@ void ScDPFilteredCache::fillTable( { if (nRow nEndSegment) { -if (!maShowByFilter.search_tree(nRow, bShow, NULL, nEndSegment)) +if (!maShowByFilter.search_tree(nRow, bShow, NULL, nEndSegment).second) { OSL_FAIL(Tree search failed!); continue; diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx index e74b0fd..b02f164 100644 --- a/sc/source/core/data/segmenttree.cxx +++ b/sc/source/core/data/segmenttree.cxx @@ -159,7 +159,7 @@ bool ScFlatSegmentsImpl_ValueType, _ExtValueType::getRangeData(SCCOLROW nPos, if (!maSegments.is_tree_valid()) maSegments.build_tree(); -if (!maSegments.search_tree(nPos, nValue, nPos1, nPos2)) +if (!maSegments.search_tree(nPos, nValue, nPos1, nPos2).second) return false; rData.mnPos1 = nPos1; diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx index 53aa04b..bc43a1e 100644 --- a/sc/source/filter/excel/colrowst.cxx +++ b/sc/source/filter/excel/colrowst.cxx @@ -208,7 +208,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) if (GetColFlag(nCol, EXC_COLROW_USED)) { sal_uInt16 nTmp; -if (maColWidths.search_tree(nCol, nTmp)) +if (maColWidths.search_tree(nCol, nTmp).second) nWidth = nTmp; } @@ -258,7 +258,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) for (SCROW i = nPrevRow; i = nRow - 1; ++i) { SCROW nLast; -if (!maRowHeights.search_tree(i, nHeight, NULL, nLast)) +if (!maRowHeights.search_tree(i, nHeight, NULL, nLast).second) { // search failed for some reason return; diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx index 4f7a937..cefa640 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx @@ -1280,7 +1280,7 @@ sal_Int32 ScRowStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 r.build_tree(); sal_Int32 nStyle; sal_Int32 nStart, nEnd; -if (r.search_tree(nField, nStyle, nStart, nEnd)) +if (r.search_tree(nField, nStyle, nStart, nEnd).second) { // Cache this value for better performance. maCache.mnTable = nTable; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |4 ++-- sc/source/core/data/column2.cxx |8 +++- sc/source/core/data/column3.cxx |2 +- 3 files changed, 6 insertions(+), 8 deletions(-) New commits: commit 75fb7b653e86dae9b18cadce48f03232052864e3 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri May 3 15:13:27 2013 -0400 A bit of cleanup. Change-Id: Id7e11540755b727475fb82c872c718fefea26567 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 188932b..4e061ab 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2131,7 +2131,7 @@ void ScColumn::SetDirty( const ScRange rRange ) else { aHint.GetAddress().SetRow( nRow ); -aHint.SetBroadcaster(maBroadcasters.getSvtBroadcaster*(nRow)); +aHint.SetBroadcaster(GetBroadcaster(nRow)); pDocument-Broadcast( aHint ); } nIndex++; @@ -2160,7 +2160,7 @@ void ScColumn::SetTableOpDirty( const ScRange rRange ) else { aHint.GetAddress().SetRow( nRow ); -aHint.SetBroadcaster(maBroadcasters.getSvtBroadcaster*(nRow)); +aHint.SetBroadcaster(GetBroadcaster(nRow)); pDocument-Broadcast( aHint ); } nIndex++; diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 817fca0..3301e00 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1887,14 +1887,12 @@ void ScColumn::MoveListeners( SvtBroadcaster rSource, SCROW nDestRow ) return; // See if the destination position already has a broadcaster, if not, create one. -SvtBroadcaster* pBC = NULL; -if (maBroadcasters.is_empty(nDestRow)) +SvtBroadcaster* pBC = GetBroadcaster(nDestRow); +if (!pBC) { pBC = new SvtBroadcaster; maBroadcasters.set(nDestRow, pBC); } -else -pBC = maBroadcasters.getSvtBroadcaster*(nDestRow); SvtListenerIter aIter(rSource); for (SvtListener* pLst = aIter.GoStart(); pLst; pLst = aIter.GoNext()) @@ -1906,7 +1904,7 @@ void ScColumn::MoveListeners( SvtBroadcaster rSource, SCROW nDestRow ) void ScColumn::EndListening( SvtListener rLst, SCROW nRow ) { -SvtBroadcaster* pBC = maBroadcasters.getSvtBroadcaster*(nRow); +SvtBroadcaster* pBC = GetBroadcaster(nRow); if (!pBC) return; diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 8cd890e..5084c3e 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -125,7 +125,7 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex ) ScBaseCell* pCell = maItems[nIndex].pCell; SCROW nRow = maItems[nIndex].nRow; pDocument-Broadcast( -ScHint(SC_HINT_DYING, ScAddress(nCol, nRow, nTab), maBroadcasters.getSvtBroadcaster*(nRow))); +ScHint(SC_HINT_DYING, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow))); maItems.erase(maItems.begin() + nIndex); if (pCell-GetCellType() == CELLTYPE_FORMULA) static_castScFormulaCell*(pCell)-EndListeningTo(pDocument); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) New commits: commit bfe2ddfbee6657008f7a4d1226f0eadbcc8b717a Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri May 3 15:46:16 2013 -0400 Broadcast change on cell deletion. We don't broadcast in DeleteRange() anymore. The callers of DeleteRange() is now responsible for broadcasting the changes. Change-Id: I515a4237dc8f56d0f65f96184b4fed99a263e4c9 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 5084c3e..dd22051 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -472,8 +472,19 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag) } // Delete attributes just now -if ((nDelFlag IDF_ATTRIB) == IDF_ATTRIB) pAttrArray-DeleteArea( nStartRow, nEndRow ); -else if ((nDelFlag IDF_ATTRIB) != 0) pAttrArray-DeleteHardAttr( nStartRow, nEndRow ); +if ((nDelFlag IDF_ATTRIB) == IDF_ATTRIB) +pAttrArray-DeleteArea( nStartRow, nEndRow ); +else if ((nDelFlag IDF_ATTRIB) != 0) +pAttrArray-DeleteHardAttr( nStartRow, nEndRow ); + +// Broadcast the changes. +ScHint aHint(SC_HINT_DATACHANGED, ScAddress(nCol, 0, nTab), NULL); +for (SCROW i = nStartRow; i = nEndRow; ++i) +{ +aHint.GetAddress().SetRow(i); +aHint.SetBroadcaster(GetBroadcaster(i)); +pDocument-Broadcast(aHint); +} } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column2.cxx |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) New commits: commit 62c30328a038b85c5b51d39306629d383fa4b61e Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri May 3 18:05:25 2013 -0400 I should first check whether a broadcaster exists at this position. Change-Id: I014e2054dda4103bb90b84db3bf20c5efd5dabab diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 3301e00..db9a3e8 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1874,8 +1874,12 @@ void ScColumn::FindUsed( SCROW nStartRow, SCROW nEndRow, bool* pUsed ) const void ScColumn::StartListening( SvtListener rLst, SCROW nRow ) { -SvtBroadcaster* pBC = new SvtBroadcaster; -maBroadcasters.set(nRow, pBC); +SvtBroadcaster* pBC = GetBroadcaster(nRow); +if (!pBC) +{ +pBC = new SvtBroadcaster; +maBroadcasters.set(nRow, pBC); +} rLst.StartListening(*pBC); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx |9 + 1 file changed, 9 insertions(+) New commits: commit 0642bd4c8be643033a7bb9e94d88e15bdc154c30 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri May 3 18:51:23 2013 -0400 We need to broadcast here... With this, all unit tests pass, for now. Change-Id: I151d4425e7d82d1598fae32460dcb94c8b1d74f7 diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 8983fa1..d9eb7f8 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -75,6 +75,15 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell ) CellType eCellType = pNewCell-GetCellType(); if (eCellType == CELLTYPE_FORMULA) static_castScFormulaCell*(pNewCell)-StartListeningTo(pDocument); + +if (!pDocument-IsCalcingAfterLoad()) +{ +if ( eCellType == CELLTYPE_FORMULA ) +((ScFormulaCell*)pNewCell)-SetDirty(); +else +pDocument-Broadcast( +ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow))); +} } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column.cxx |8 sc/source/core/data/column2.cxx | 14 +++--- sc/source/core/data/column3.cxx |4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) New commits: commit 8877c7834df8dad05aa5698b2a493286a93a1b77 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu May 2 20:38:06 2013 -0400 Switch script type storage from unsigned short to unsigned char. This will save quite a bit of storage. It requires the next version of mdds (probably will be 0.8.0). Change-Id: I11e972c043ad58e8b76e241d3312b5a1de952cf7 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 2933e9f..be9e5d6 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -75,13 +75,13 @@ ScNeededSizeOptions::ScNeededSizeOptions() : void ScColumn::SwapScriptTypes( ScriptType rSrc, SCROW nSrcRow, ScriptType rDest, SCROW nDestRow ) { -unsigned short nSrcVal = 0; -unsigned short nDestVal = 0; +unsigned char nSrcVal = 0; +unsigned char nDestVal = 0; if (!rSrc.is_empty(nSrcRow)) -nSrcVal = rSrc.getunsigned short(nSrcRow); +nSrcVal = rSrc.getunsigned char(nSrcRow); if (!rDest.is_empty(nDestRow)) -nDestVal = rDest.getunsigned short(nDestRow); +nDestVal = rDest.getunsigned char(nDestRow); if (nDestVal) rSrc.set(nSrcRow, nDestVal); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index c93e043..bad84e9 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1469,7 +1469,7 @@ void ScColumn::CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn rDe nRowPos = static_castsize_t(nRow2); // End row position. // Keep copying until we hit the end row position. -mdds::mtv::ushort_element_block::const_iterator itData, itDataEnd; +mdds::mtv::uchar_element_block::const_iterator itData, itDataEnd; for (; itBlk != itBlkEnd; ++itBlk, nBlockStart = nBlockEnd, nOffsetInBlock = 0) { nBlockEnd = nBlockStart + itBlk-size; @@ -1486,15 +1486,15 @@ void ScColumn::CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn rDe } // Non-empty block. -itData = mdds::mtv::ushort_element_block::begin(*itBlk-data); -itDataEnd = mdds::mtv::ushort_element_block::end(*itBlk-data); +itData = mdds::mtv::uchar_element_block::begin(*itBlk-data); +itDataEnd = mdds::mtv::uchar_element_block::end(*itBlk-data); std::advance(itData, nOffsetInBlock); if (nBlockStart = nRowPos nRowPos = nBlockEnd) { // This block contains the end row. Only copy partially. size_t nOffset = nRowPos - nBlockStart + 1; -itDataEnd = mdds::mtv::ushort_element_block::begin(*itBlk-data); +itDataEnd = mdds::mtv::uchar_element_block::begin(*itBlk-data); std::advance(itDataEnd, nOffset); rDestCol.maScriptTypes.set(nBlockStart + nOffsetInBlock, itData, itDataEnd); @@ -1545,7 +1545,7 @@ void ScColumn::SetCell(SCROW nRow, ScBaseCell* pNewCell) } maTextWidths.setunsigned short(nRow, TEXTWIDTH_DIRTY); -maScriptTypes.setunsigned short(nRow, SC_SCRIPTTYPE_UNKNOWN); +maScriptTypes.setunsigned char(nRow, SC_SCRIPTTYPE_UNKNOWN); CellStorageModified(); } } @@ -1565,7 +1565,7 @@ sal_uInt8 ScColumn::GetScriptType( SCROW nRow ) const if (!ValidRow(nRow) || maScriptTypes.is_empty(nRow)) return 0; -return maScriptTypes.getunsigned short(nRow); +return maScriptTypes.getunsigned char(nRow); } void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType ) @@ -1576,7 +1576,7 @@ void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType ) if (!nType) maScriptTypes.set_empty(nRow, nRow); else -maScriptTypes.setunsigned short(nRow, nType); +maScriptTypes.setunsigned char(nRow, nType); } size_t ScColumn::GetFormulaHash( SCROW nRow ) const diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 63b3a5f..2334330 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -104,7 +104,7 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell ) maItems.back().nRow = nRow; maTextWidths.setunsigned short(nRow, TEXTWIDTH_DIRTY); -maScriptTypes.setunsigned short(nRow, SC_SCRIPTTYPE_UNKNOWN); +maScriptTypes.setunsigned char(nRow, SC_SCRIPTTYPE_UNKNOWN); CellStorageModified(); } @@ -1415,7 +1415,7 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String rString, pOldCell-Delete(); maItems[i].pCell = pNewCell; // Replace maTextWidths.setunsigned short(nRow, TEXTWIDTH_DIRTY); -maScriptTypes.setunsigned short(nRow, SC_SCRIPTTYPE_UNKNOWN); +maScriptTypes.setunsigned char(nRow,
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/ui/docshell/dbdocimp.cxx |1 - sc/source/ui/docshell/docsh.cxx|1 - sc/source/ui/docshell/docsh8.cxx |1 - sc/source/ui/docshell/impex.cxx|1 - sc/source/ui/unoobj/cellsuno.cxx |1 - 5 files changed, 5 deletions(-) New commits: commit fec5202b7eb901d34f3e976140372a4bf414f92a Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu May 2 22:18:47 2013 -0400 Remove unnecessary inclusion of column.hxx. Change-Id: I93c4e017790b1b1de611ad9f440aa6aa9caaa2df diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index a54b1f0..2501fe9 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -53,7 +53,6 @@ #include hints.hxx #include miscuno.hxx #include chgtrack.hxx -#include column.hxx using namespace com::sun::star; diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c99ca76..e9cd312 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -64,7 +64,6 @@ #include sot/formats.hxx #include formulacell.hxx -#include column.hxx #include postit.hxx #include global.hxx #include filter.hxx diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 58ac364..7821df3 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -59,7 +59,6 @@ #include filter.hxx #include progress.hxx #include formulacell.hxx -#include column.hxx #include editutil.hxx #include cellform.hxx #include dbdocutl.hxx diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index b6c4869..b92cb08 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -35,7 +35,6 @@ #include filter.hxx #include asciiopt.hxx #include formulacell.hxx -#include column.hxx #include docoptio.hxx #include progress.hxx #include scitems.hxx diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index dc40193..e23e362 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -88,7 +88,6 @@ #include olinefun.hxx #include hints.hxx #include formulacell.hxx -#include column.hxx #include undocell.hxx #include undotab.hxx #include undoblk.hxx // fuer lcl_ApplyBorder - nach docfunc verschieben! ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/token.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 4d4cb9acda9cc754f0afc5504d29d56c6b24cfab Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 1 11:13:49 2013 -0400 Add SUMPRODUCT and MINVERSE to the list of vectorizable functions. Change-Id: I79e19acdcc3c20db2a795961f486415a8069d177 diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index acadb7f..d17cda9 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1267,6 +1267,8 @@ void ScTokenArray::CheckToken( const FormulaToken r ) case ocMax: case ocMaxA: case ocSum: +case ocSumProduct: +case ocMatInv: // Don't change the state. break; default: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 25ebf6357816bdb7a39fa83f791e9254434fa76d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 1 11:43:09 2013 -0400 Don't forget to calculate hash when importing from xls. Change-Id: I11f3a9096a96fa70f59d7ba4f22fe6daa55991b8 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 80305c2..aa36598 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -466,6 +466,8 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress rPos, if (bSubTotal) pDocument-AddSubTotalCell(this); + +pCode-GenHash(); } ScFormulaCell::ScFormulaCell( const ScFormulaCell rCell, ScDocument rDoc, const ScAddress rPos, int nCloneFlags ) : ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 8ab8c0b0f5389d98abd40919fe784af6a2d2ad04 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Apr 30 10:01:43 2013 -0400 Reset dirty. Change-Id: I20a8b56a9241081192e32b3d3a0de9295277e38a diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 7158b69..3e85a9e 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3137,6 +3137,7 @@ bool ScFormulaCell::InterpretFormulaGroup() aInterpreter.Interpret(); pDest-aResult.SetToken(aInterpreter.GetResultToken().get()); +pDest-ResetDirty(); } return true; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/table1.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e0d295eacf3e7c5a19f3c7a2d764bcafe74e6d8d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Apr 30 10:19:58 2013 -0400 Typo. Change-Id: I46eba8fff2a1b18d267b0fce0bb1a2abcce779a8 diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 34be0d1..7abc279 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2149,7 +2149,7 @@ const double* ScTable::FetchDoubleArray( if (!ValidCol(nCol) || !ValidRow(nRow1) || !ValidRow(nRow2)) return NULL; -return aCol[nCol].FetchDoubleArray(rCxt, nRow1, nRow1); +return aCol[nCol].FetchDoubleArray(rCxt, nRow1, nRow2); } ScRefCellValue ScTable::GetRefCellValue( SCCOL nCol, SCROW nRow ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/tool/formulagroup.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ca525b2b323685c3cca1eff59fda92bff44fdc31 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Apr 30 11:27:46 2013 -0400 Surpress warning on comparison between signed and unsigned. Change-Id: Ia155114817e3b28a201f734647b758cf7cebefce diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index c554e9c..1ee57b5 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -39,7 +39,7 @@ bool FormulaGroupInterpreter::interpret() { const formula::SingleVectorRefToken* p2 = static_castconst formula::SingleVectorRefToken*(p); const double* pArray = p2-GetArray(); -aCode2.AddDouble(i p2-GetArrayLength() ? pArray[i] : 0.0); +aCode2.AddDouble(static_castsize_t(i) p2-GetArrayLength() ? pArray[i] : 0.0); } break; case formula::svDoubleVectorRef: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 72 ++-- 1 file changed, 45 insertions(+), 27 deletions(-) New commits: commit 57999ad590589b13ad7fd32e8c7f2712ec335f81 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Apr 29 15:09:42 2013 -0400 Test-drive grouped formula calculation. But of course since we haven't yet implemented the real vectorized calculation backend, we calculate the cells individually... Change-Id: I27e0a3e846f62a7fcda86a79e9455c81e3737ddf diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 20ec752..278a299 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3037,34 +3037,52 @@ bool ScFormulaCell::InterpretFormulaGroup() } } -// scan the formula ... -// have a document method: Get2DRangeAsDoublesArray that does the -// column-based heavy lifting call it for each absolute range from the -// first cell pos in the formula group. -// -// Project single references to ranges by adding their vector * xGroup-mnLength -// -// TODO: -//elide multiple dimensional movement in vectors eg. =SUM(A11,1) -//produces a diagonal 'column' that serves no useful purpose for us. -//these should be very rare. Should elide in GetDeltas anyway and -//assert here. -// -// Having built our input data ... -// Throw it, and the formula over to some 'OpenCLCalculage' hook -// -// on return - release references on these double buffers -// -// transfer the result to the formula cells (as above) -// store the doubles in the columns' maDoubles array for -// dependent formulae -// -// TODO: -//need to abort/fail when we get errors returned and fallback to -//stock interpreting [ I guess ], unless we can use NaN etc. to -//signal errors. +#if 0 +// TODO: Calculate the formula group via vectorization. +#else +// Until we implement group calculation for real, decompose the group into +// individual formula token arrays for individual calculation. +ScAddress aTmpPos = aPos; +for (sal_Int32 i = 0; i xGroup-mnLength; ++i) +{ +aTmpPos.SetRow(xGroup-mnStart + i); +ScTokenArray aCode2; +for (const formula::FormulaToken* p = aCode.First(); p; p = aCode.Next()) +{ +switch (p-GetType()) +{ +case svSingleVectorRef: +{ +const formula::SingleVectorRefToken* p2 = static_castconst formula::SingleVectorRefToken*(p); +const formula::VectorArray rArray = p2-GetArray(); +aCode2.AddDouble(rArray.mpArray[i]); +} +break; +case svDoubleVectorRef: +return false; +break; +default: +aCode2.AddToken(*p); +} +} -return false; +ScFormulaCell* pDest = pDocument-GetFormulaCell(aTmpPos); +if (!pDest) +return false; + +ScCompiler aComp(pDocument, aPos, aCode2); +aComp.SetGrammar(pDocument-GetGrammar()); +OUStringBuffer aBuf; +aComp.CreateStringFromTokenArray(aBuf); +aComp.CompileTokenArray(); // Create RPN token array. +ScInterpreter aInterpreter(pDest, pDocument, aTmpPos, aCode2); +aInterpreter.Interpret(); + +pDest-aResult.SetToken(aInterpreter.GetResultToken().get()); +} + +return true; +#endif } bool ScFormulaCell::InterpretInvariantFormulaGroup() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 36dd73bbe0b098ddb677724eec799f4e9fb47dc8 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Apr 29 17:22:31 2013 -0400 Some comment. Change-Id: Ie7015231944547254562031864e7691333f02947 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 236474d..5753e44 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2993,6 +2993,12 @@ bool ScFormulaCell::InterpretFormulaGroup() // Fetch double array guarantees that the length of the // returned array equals or greater than the requested // length. + +// TODO: For now, it returns an array pointer only when +// the entire array is in contiguous memory space. Once +// we finish cell storage rework, we'll support temporary +// generation of a double array which is a combination of +// multiple cell array segments. const double* pArray = pDocument-FetchDoubleArray(aCxt, aRefPos, xGroup-mnLength); if (!pArray) return false; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 28 ++-- 1 file changed, 26 insertions(+), 2 deletions(-) New commits: commit 2ea9b75327755aca7d5ee66ab25b371e57f8f5ee Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Apr 29 17:51:41 2013 -0400 Handle range reference as well for group calculation. Not tested yet. Change-Id: I3bf58a20f0b8c017862ae23202e4b2272f7c952c diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index ba039b6..5987253 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3023,8 +3023,32 @@ bool ScFormulaCell::InterpretFormulaGroup() aRef.CalcAbsIfRel(aPos); if (aRef.Ref1.IsRowRel() || aRef.Ref2.IsRowRel()) { -// TODO: Implement this. -return false; +// Row reference is relative. +bool bAbsFirst = !aRef.Ref1.IsRowRel(); +bool bAbsLast = !aRef.Ref2.IsRowRel(); +ScAddress aRefPos(aRef.Ref1.nCol, aRef.Ref1.nRow, aRef.Ref1.nTab); +size_t nCols = aRef.Ref2.nCol - aRef.Ref1.nCol + 1; +std::vectorconst double* aArrays; +aArrays.reserve(nCols); +SCROW nLength = xGroup-mnLength; +if (!bAbsLast) +{ +// range end position is relative. Extend it. +nLength += aRef.Ref2.nRow - aRef.Ref1.nRow; +} + +for (SCCOL i = aRef.Ref1.nCol; i = aRef.Ref2.nCol; ++i) +{ +aRefPos.SetCol(i); +const double* pArray = pDocument-FetchDoubleArray(aCxt, aRefPos, nLength); +if (!pArray) +return false; + +aArrays.push_back(pArray); +} + +formula::DoubleVectorRefToken aTok(aArrays, nLength, bAbsFirst, bAbsLast); +aCode.AddToken(aTok); } else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit b1e2e5973f7fe2da67213599c060574dfb661ae9 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Apr 29 19:27:41 2013 -0400 We don't need this code. Change-Id: I7be5869672be17faefd369d03f69cac5ed2d03b6 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 7e85225..7158b69 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3132,8 +3132,6 @@ bool ScFormulaCell::InterpretFormulaGroup() ScCompiler aComp(pDocument, aPos, aCode2); aComp.SetGrammar(pDocument-GetGrammar()); -OUStringBuffer aBuf; -aComp.CreateStringFromTokenArray(aBuf); aComp.CompileTokenArray(); // Create RPN token array. ScInterpreter aInterpreter(pDest, pDocument, aTmpPos, aCode2); aInterpreter.Interpret(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column2.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit d0f49af360ed35c3c3be6e8151c8b2ebd9b6e6e1 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Apr 26 23:07:03 2013 -0400 Don't forget to add breaks here... Change-Id: I2887382d8eb30a0ba715493a38dda3d0e5ec4d7d diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 20483f8..6bcf282 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1649,6 +1649,7 @@ bool ScColumn::ResolveStaticReference( ScMatrix rMat, SCCOL nMatCol, SCROW nRow ScValueCell* pVC = static_castScValueCell*(it-pCell); rMat.PutDouble(pVC-GetValue(), nMatCol, it-nRow - nRow1); } +break; case CELLTYPE_FORMULA: { ScFormulaCell* pFC = static_castScFormulaCell*(it-pCell); @@ -1658,6 +1659,7 @@ bool ScColumn::ResolveStaticReference( ScMatrix rMat, SCCOL nMatCol, SCROW nRow rMat.PutDouble(pFC-GetResultDouble(), nMatCol, it-nRow - nRow1); } +break; default: ; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/formulacell.cxx | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) New commits: commit 300b57c602e3a55d357ecedf3c663a4f0380648d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Apr 25 11:23:41 2013 -0400 We can't support all cases until we have real range-based dep tracking. Note that an absolute reference may indirectly reference one of the cells in current formula group, and we aren't fully prepare for that use case yet. Change-Id: Ibd24a25b80963fe1235c2afb431ff7c7ceb27215 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index fe956f5..e73641d 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2948,9 +2948,24 @@ bool ScFormulaCell::InterpretFormulaGroup() // import / insert / delete etc. and is integral to the data structures pDocument-RebuildFormulaGroups(); -if( !xGroup.get() ) +if (!xGroup || !pCode) return false; +switch (pCode-GetVectorState()) +{ +case FormulaVectorEnabled: +// Good. +break; +case FormulaVectorCheckReference: +// To support this we would need a real range-based dependency +// tracking. We can't support this right now. +return false; +case FormulaVectorDisabled: +case FormulaVectorUnknown: +default: +return false; +} + //fprintf( stderr, Interpret cell %d, %d\n, (int)aPos.Col(), (int)aPos.Row() ); if (xGroup-mbInvariant) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/data/column3.cxx |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) New commits: commit e7d9a4de9d8d714a6ec99a6aebd4597ff7295279 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Apr 24 10:57:51 2013 -0400 We have function object for this. Change-Id: I9021771a6d6be9980ca1c46a0b5034f84fa0d49f diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 60e4b64..e69a8cc 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -48,6 +48,7 @@ #include globalnames.hxx #include cellvalue.hxx #include tokenarray.hxx +#include stlalgorithm.hxx #include com/sun/star/i18n/LocaleDataItem.hpp @@ -2058,9 +2059,7 @@ void ScColumn::RebuildFormulaGroups() return; // clear double groups -for (std::vector ColDoubleEntry *::iterator it = maDoubles.begin(); - it != maDoubles.end(); ++it ) -delete *it; +std::for_each(maDoubles.begin(), maDoubles.end(), ScDeleteObjectByPtrColDoubleEntry()); maDoubles.clear(); // clear previous groups @@ -2186,7 +2185,6 @@ void ScColumn::RebuildFormulaGroups() } #endif - bDirtyGroups = false; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source
sc/source/core/inc/interpre.hxx | 15 +- sc/source/core/tool/interpr1.cxx | 262 --- sc/source/core/tool/interpr2.cxx | 16 +- sc/source/core/tool/interpr4.cxx | 84 ++-- 4 files changed, 200 insertions(+), 177 deletions(-) New commits: commit c5e2e1552cfd4fe8fb3fab6e3ff82882d57fba91 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Mar 28 09:43:57 2013 -0400 Removing use of ScBaseCell in ScInterpreter. Change-Id: I1edfbc08a0fe705e3d0ad07b8cc0d48ffddaad9f diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 0fdc89c..5eb74f3 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -150,7 +150,7 @@ private: const formula::FormulaToken* pCur; // current token -String aTempStr; // for GetString() +OUStringaTempStr; // for GetString() ScTokenStack* pStackObj;// contains the stacks formula::FormulaToken** pStack; // the current stack sal_uInt16 nGlobalError; // global (local to this formula expression) error @@ -185,7 +185,7 @@ void PushNA(); void ReplaceCell( ScAddress ); // for TableOp void ReplaceCell( SCCOL rCol, SCROW rRow, SCTAB rTab ); // for TableOp bool IsTableOpInRange( const ScRange ); -sal_uLong GetCellNumberFormat( const ScAddress, const ScBaseCell* ); +sal_uLong GetCellNumberFormat( const ScAddress rPos, ScRefCellValue rCell ); double ConvertStringToValue( const String ); double GetCellValue( const ScAddress, const ScBaseCell* ); double GetCellValue( const ScAddress, ScRefCellValue rCell ); @@ -195,8 +195,7 @@ double GetValueCellValue( const ScAddress, const ScValueCell* ); ScBaseCell* GetCell( const ScAddress rPos ); void GetCellString( String rStr, const ScBaseCell* pCell ); void GetCellString( OUString rStr, ScRefCellValue rCell ); -sal_uInt16 GetCellErrCode( const ScBaseCell* pCell ); -CellType GetCellType( const ScBaseCell* pCell ); +sal_uInt16 GetCellErrCode( const ScRefCellValue rCell ); bool HasCellEmptyData( const ScBaseCell* pCell ); bool HasCellValueData( const ScBaseCell* pCell ); bool HasCellStringData( const ScBaseCell* pCell ); @@ -265,7 +264,7 @@ formula::FormulaTokenRef PopToken(); void Pop(); void PopError(); double PopDouble(); -const String PopString(); +const OUString PopString(); void ValidateRef( const ScSingleRefData rRef ); void ValidateRef( const ScComplexRefData rRef ); void ValidateRef( const ScRefList rRefList ); @@ -339,10 +338,10 @@ double GetDouble(); double GetDoubleWithDefault(double nDefault); bool IsMissing(); bool GetBool() { return GetDouble() != 0.0; } -const String GetString(); -const String GetStringFromMatrix(const ScMatrixRef pMat); +const OUString GetString(); +const OUString GetStringFromMatrix(const ScMatrixRef pMat); // pop matrix and obtain one element, upper left or according to jump matrix -ScMatValType GetDoubleOrStringFromMatrix( double rDouble, String rString ); +ScMatValType GetDoubleOrStringFromMatrix( double rDouble, OUString rString ); ScMatrixRef CreateMatrixFromDoubleRef( const formula::FormulaToken* pToken, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2 ); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 574612c..3e480e1 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -301,8 +301,10 @@ void ScInterpreter::ScIfError( bool bNAonly ) bError = true; else { -ScBaseCell* pCell = GetCell( aAdr); -nGlobalError = GetCellErrCode( pCell); + +ScRefCellValue aCell; +aCell.assign(*pDok, aAdr); +nGlobalError = GetCellErrCode(aCell); if (nGlobalError) bError = true; } @@ -310,16 +312,16 @@ void ScInterpreter::ScIfError( bool bNAonly ) break; case svExternalSingleRef: case svExternalDoubleRef: -{ -double fVal; -String aStr; -// Handles also existing jump matrix case and sets error on -// elements. -GetDoubleOrStringFromMatrix( fVal, aStr); -if (nGlobalError) -bError = true; -} -break; +{ +double fVal; +OUString aStr; +// Handles also existing jump matrix case and sets error on +// elements. +GetDoubleOrStringFromMatrix( fVal, aStr); +if (nGlobalError) +bError = true; +} +break; case svMatrix: { const ScMatrixRef pMat = PopMatrix(); @@ -2114,9 +2116,9 @@ void ScInterpreter::ScIsEmpty()