View | Details | Raw Unified | Return to issue 120962
Collapse All | Expand All

(-)inc/cell.hxx (-2 / +2 lines)
Lines 19-26 Link Here
19
 * 
19
 * 
20
 *************************************************************/
20
 *************************************************************/
21
21
22
23
24
#ifndef SC_CELL_HXX
22
#ifndef SC_CELL_HXX
25
#define SC_CELL_HXX
23
#define SC_CELL_HXX
26
24
Lines 309-314 Link Here
309
    sal_Bool            bInChangeTrack : 1; // Cell is in ChangeTrack
307
    sal_Bool            bInChangeTrack : 1; // Cell is in ChangeTrack
310
    sal_Bool            bTableOpDirty  : 1; // Dirty flag for TableOp
308
    sal_Bool            bTableOpDirty  : 1; // Dirty flag for TableOp
311
    sal_Bool            bNeedListening : 1; // Listeners need to be re-established after UpdateReference
309
    sal_Bool            bNeedListening : 1; // Listeners need to be re-established after UpdateReference
310
    ScToken*            pValidRefToken; // i120962, get the valid reference token if the cell was applied a reference formula
312
311
313
                    enum ScInterpretTailParameter
312
                    enum ScInterpretTailParameter
314
                    {
313
                    {
Lines 485-490 Link Here
485
484
486
    /** Determines whether or not the result string contains more than one paragraph */
485
    /** Determines whether or not the result string contains more than one paragraph */
487
    bool            IsMultilineResult();
486
    bool            IsMultilineResult();
487
    ScToken*        GetValidRefToken() { return pValidRefToken; }   // i120962
488
};
488
};
489
489
490
//			Iterator fuer Referenzen in einer Formelzelle
490
//			Iterator fuer Referenzen in einer Formelzelle
(-)source/core/data/cell.cxx (-6 / +15 lines)
Lines 19-26 Link Here
19
 * 
19
 * 
20
 *************************************************************/
20
 *************************************************************/
21
21
22
23
24
// MARKER(update_precomp.py): autogen include statement, do not remove
22
// MARKER(update_precomp.py): autogen include statement, do not remove
25
#include "precompiled_sc.hxx"
23
#include "precompiled_sc.hxx"
26
24
Lines 644-650 Link Here
644
	bInChangeTrack( sal_False ),
642
	bInChangeTrack( sal_False ),
645
	bTableOpDirty( sal_False ),
643
	bTableOpDirty( sal_False ),
646
	bNeedListening( sal_False ),
644
	bNeedListening( sal_False ),
647
	aPos(0,0,0)
645
	aPos(0,0,0),
646
	pValidRefToken( NULL )
648
{
647
{
649
}
648
}
650
649
Lines 673-679 Link Here
673
	bInChangeTrack( sal_False ),
672
	bInChangeTrack( sal_False ),
674
	bTableOpDirty( sal_False ),
673
	bTableOpDirty( sal_False ),
675
	bNeedListening( sal_False ),
674
	bNeedListening( sal_False ),
676
	aPos( rPos )
675
	aPos( rPos ),
676
	pValidRefToken( NULL )
677
{
677
{
678
    Compile( rFormula, sal_True, eGrammar );    // bNoListening, Insert does that
678
    Compile( rFormula, sal_True, eGrammar );    // bNoListening, Insert does that
679
}
679
}
Lines 704-710 Link Here
704
	bInChangeTrack( sal_False ),
704
	bInChangeTrack( sal_False ),
705
	bTableOpDirty( sal_False ),
705
	bTableOpDirty( sal_False ),
706
	bNeedListening( sal_False ),
706
	bNeedListening( sal_False ),
707
	aPos( rPos )
707
	aPos( rPos ),
708
	pValidRefToken( NULL )
708
{
709
{
709
	// UPN-Array erzeugen
710
	// UPN-Array erzeugen
710
	if( pCode->GetLen() && !pCode->GetCodeError() && !pCode->GetCodeLen() )
711
	if( pCode->GetLen() && !pCode->GetCodeError() && !pCode->GetCodeLen() )
Lines 745-751 Link Here
745
	bInChangeTrack( sal_False ),
746
	bInChangeTrack( sal_False ),
746
	bTableOpDirty( sal_False ),
747
	bTableOpDirty( sal_False ),
747
	bNeedListening( sal_False ),
748
	bNeedListening( sal_False ),
748
	aPos( rPos )
749
	aPos( rPos ),
750
	pValidRefToken( rCell.pValidRefToken )
749
{
751
{
750
	pCode = (rCell.pCode) ? rCell.pCode->Clone() : NULL;
752
	pCode = (rCell.pCode) ? rCell.pCode->Clone() : NULL;
751
753
Lines 823-828 Link Here
823
#ifdef DBG_UTIL
825
#ifdef DBG_UTIL
824
	eCellType = CELLTYPE_DESTROYED;
826
	eCellType = CELLTYPE_DESTROYED;
825
#endif
827
#endif
828
    DELETEZ(pValidRefToken);
826
}
829
}
827
830
828
void ScFormulaCell::GetFormula( rtl::OUStringBuffer& rBuffer,
831
void ScFormulaCell::GetFormula( rtl::OUStringBuffer& rBuffer,
Lines 1556-1561 Link Here
1556
            return;
1559
            return;
1557
        }
1560
        }
1558
        bRunning = bOldRunning;
1561
        bRunning = bOldRunning;
1562
//-> i120962: If the cell was applied reference formula, get the valid token
1563
        if (pValidRefToken)
1564
            DELETEZ(pValidRefToken);
1565
        if (p->IsReferenceFunc() && p->GetLastStackRefToken())
1566
            pValidRefToken = static_cast<ScToken*>(p->GetLastStackRefToken()->Clone());
1567
//<- i120962
1559
1568
1560
        // #i102616# For single-sheet saving consider only content changes, not format type,
1569
        // #i102616# For single-sheet saving consider only content changes, not format type,
1561
        // because format type isn't set on loading (might be changed later)
1570
        // because format type isn't set on loading (might be changed later)
(-)source/core/inc/interpre.hxx (-5 / +7 lines)
Lines 19-26 Link Here
19
 * 
19
 * 
20
 *************************************************************/
20
 *************************************************************/
21
21
22
23
24
#ifndef SC_INTERPRE_HXX
22
#ifndef SC_INTERPRE_HXX
25
#define SC_INTERPRE_HXX
23
#define SC_INTERPRE_HXX
26
24
Lines 146-152 Link Here
146
    ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR);
144
    ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR);
147
private:
145
private:
148
    static ScTokenStack*    pGlobalStack;
146
    static ScTokenStack*    pGlobalStack;
149
    static sal_Bool             bGlobalStackInUse;
147
    static sal_Bool         bGlobalStackInUse;
150
148
151
    formula::FormulaTokenIterator aCode;
149
    formula::FormulaTokenIterator aCode;
152
    ScAddress   aPos;
150
    ScAddress   aPos;
Lines 160-165 Link Here
160
158
161
    const formula::FormulaToken* 
159
    const formula::FormulaToken* 
162
                pCur;                // current token
160
                pCur;                // current token
161
    ScToken*    pLastStackRefToken;     // i120962: current valid reference token
162
    bool        bRefFunc;               // i120962: is a reference function
163
    String      aTempStr;               // for GetString()
163
    String      aTempStr;               // for GetString()
164
    ScTokenStack* pStackObj;            // contains the stacks
164
    ScTokenStack* pStackObj;            // contains the stacks
165
    formula::FormulaToken**   pStack;                 // the current stack
165
    formula::FormulaToken**   pStack;                 // the current stack
Lines 812-825 Link Here
812
    void SetError(sal_uInt16 nError)
812
    void SetError(sal_uInt16 nError)
813
            { if (nError && !nGlobalError) nGlobalError = nError; }
813
            { if (nError && !nGlobalError) nGlobalError = nError; }
814
814
815
    sal_uInt16 GetError()                               const   { return nGlobalError; }
815
    sal_uInt16 GetError()                           const   { return nGlobalError; }
816
    formula::StackVar  GetResultType()              const   { return xResult->GetType(); }
816
    formula::StackVar  GetResultType()              const   { return xResult->GetType(); }
817
    const String&   GetStringResult()               const   { return xResult->GetString(); }
817
    const String&   GetStringResult()               const   { return xResult->GetString(); }
818
    double          GetNumResult()                  const   { return xResult->GetDouble(); }
818
    double          GetNumResult()                  const   { return xResult->GetDouble(); }
819
    formula::FormulaTokenRef 
819
    formula::FormulaTokenRef 
820
                    GetResultToken()                const   { return xResult; }
820
                    GetResultToken()                const   { return xResult; }
821
    short           GetRetFormatType()              const   { return nRetFmtType; }
821
    short           GetRetFormatType()              const   { return nRetFmtType; }
822
    sal_uLong           GetRetFormatIndex()             const   { return nRetFmtIndex; }
822
    sal_uLong       GetRetFormatIndex()             const   { return nRetFmtIndex; }
823
    ScToken*        GetLastStackRefToken() { return pLastStackRefToken; }
824
    bool            IsReferenceFunc() { return bRefFunc; }
823
};
825
};
824
826
825
827
(-)source/core/tool/interpr4.cxx (-2 / +22 lines)
Lines 19-26 Link Here
19
 * 
19
 * 
20
 *************************************************************/
20
 *************************************************************/
21
21
22
23
24
// MARKER(update_precomp.py): autogen include statement, do not remove
22
// MARKER(update_precomp.py): autogen include statement, do not remove
25
#include "precompiled_sc.hxx"
23
#include "precompiled_sc.hxx"
26
// INCLUDE ---------------------------------------------------------------
24
// INCLUDE ---------------------------------------------------------------
Lines 62-67 Link Here
62
#include "parclass.hxx"
60
#include "parclass.hxx"
63
#include "externalrefmgr.hxx"
61
#include "externalrefmgr.hxx"
64
#include "doubleref.hxx"
62
#include "doubleref.hxx"
63
#include "token.hxx"
65
64
66
#include <math.h>
65
#include <math.h>
67
#include <float.h>
66
#include <float.h>
Lines 1170-1175 Link Here
1170
                SingleRefToVars( static_cast<ScToken*>(p)->GetSingleRef(), rCol, rRow, rTab);
1169
                SingleRefToVars( static_cast<ScToken*>(p)->GetSingleRef(), rCol, rRow, rTab);
1171
                if ( pDok->aTableOpList.Count() > 0 )
1170
                if ( pDok->aTableOpList.Count() > 0 )
1172
                    ReplaceCell( rCol, rRow, rTab );
1171
                    ReplaceCell( rCol, rRow, rTab );
1172
                DELETEZ(pLastStackRefToken);
1173
                pLastStackRefToken = static_cast<ScToken*>(p->Clone());
1174
                ((ScSingleRefToken*)pLastStackRefToken)->GetSingleRef().SetFlag3D(sal_True);
1173
                break;
1175
                break;
1174
            default:
1176
            default:
1175
                SetError( errIllegalParameter);
1177
                SetError( errIllegalParameter);
Lines 1201-1206 Link Here
1201
                    rAdr.Set( nCol, nRow, nTab );
1203
                    rAdr.Set( nCol, nRow, nTab );
1202
                    if ( pDok->aTableOpList.Count() > 0 )
1204
                    if ( pDok->aTableOpList.Count() > 0 )
1203
                        ReplaceCell( rAdr );
1205
                        ReplaceCell( rAdr );
1206
                    DELETEZ(pLastStackRefToken);
1207
                    pLastStackRefToken = static_cast<ScToken*>(p->Clone());
1208
                    ((ScSingleRefToken*)pLastStackRefToken)->GetSingleRef().SetFlag3D(sal_True);
1204
                }
1209
                }
1205
                break;
1210
                break;
1206
            default:
1211
            default:
Lines 1283-1288 Link Here
1283
            case svDoubleRef:
1288
            case svDoubleRef:
1284
                DoubleRefToVars( static_cast<ScToken*>(p), rCol1, rRow1, rTab1, rCol2, rRow2, rTab2,
1289
                DoubleRefToVars( static_cast<ScToken*>(p), rCol1, rRow1, rTab1, rCol2, rRow2, rTab2,
1285
                        bDontCheckForTableOp);
1290
                        bDontCheckForTableOp);
1291
                DELETEZ(pLastStackRefToken);
1292
                pLastStackRefToken = static_cast<ScToken*>(p->Clone());
1293
                ((ScDoubleRefToken*)pLastStackRefToken)->GetSingleRef().SetFlag3D(sal_True);
1286
                break;
1294
                break;
1287
            default:
1295
            default:
1288
                SetError( errIllegalParameter);
1296
                SetError( errIllegalParameter);
Lines 1327-1332 Link Here
1327
            case svDoubleRef:
1335
            case svDoubleRef:
1328
                --sp;
1336
                --sp;
1329
                DoubleRefToRange( p->GetDoubleRef(), rRange);
1337
                DoubleRefToRange( p->GetDoubleRef(), rRange);
1338
                DELETEZ(pLastStackRefToken);
1339
                pLastStackRefToken = static_cast<ScToken*>(p->Clone());
1340
                ((ScDoubleRefToken*)pLastStackRefToken)->GetSingleRef().SetFlag3D(sal_True);
1330
                break;
1341
                break;
1331
            case svRefList:
1342
            case svRefList:
1332
                {
1343
                {
Lines 1373-1378 Link Here
1373
                break;
1384
                break;
1374
            case svDoubleRef:
1385
            case svDoubleRef:
1375
                DoubleRefToRange( static_cast<ScToken*>(p)->GetDoubleRef(), rRange, bDontCheckForTableOp);
1386
                DoubleRefToRange( static_cast<ScToken*>(p)->GetDoubleRef(), rRange, bDontCheckForTableOp);
1387
                DELETEZ(pLastStackRefToken);
1388
                pLastStackRefToken = static_cast<ScToken*>(p->Clone());
1389
                ((ScDoubleRefToken*)pLastStackRefToken)->GetSingleRef().SetFlag3D(sal_True);
1376
                break;
1390
                break;
1377
            default:
1391
            default:
1378
                SetError( errIllegalParameter);
1392
                SetError( errIllegalParameter);
Lines 3286-3291 Link Here
3286
    pMyFormulaCell( pCell ),
3300
    pMyFormulaCell( pCell ),
3287
    pFormatter( pDoc->GetFormatTable() ),
3301
    pFormatter( pDoc->GetFormatTable() ),
3288
    mnStringNoValueError( errNoValue),
3302
    mnStringNoValueError( errNoValue),
3303
    pLastStackRefToken( NULL ),
3304
    bRefFunc( false ),
3289
    bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() )
3305
    bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() )
3290
{
3306
{
3291
    RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTT" );
3307
    RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTT" );
Lines 3317-3322 Link Here
3317
        delete pStackObj;
3333
        delete pStackObj;
3318
    if (pTokenMatrixMap)
3334
    if (pTokenMatrixMap)
3319
        delete pTokenMatrixMap;
3335
        delete pTokenMatrixMap;
3336
    DELETEZ(pLastStackRefToken);
3320
}
3337
}
3321
3338
3322
3339
Lines 3865-3870 Link Here
3865
3882
3866
    // End: obtain result
3883
    // End: obtain result
3867
3884
3885
    bRefFunc = false;
3868
    if( sp )
3886
    if( sp )
3869
    {
3887
    {
3870
        pCur = pStack[ sp-1 ];
3888
        pCur = pStack[ sp-1 ];
Lines 3891-3896 Link Here
3891
                break;
3909
                break;
3892
                case svSingleRef :
3910
                case svSingleRef :
3893
                {
3911
                {
3912
                    bRefFunc = true;
3894
                    ScAddress aAdr;
3913
                    ScAddress aAdr;
3895
                    PopSingleRef( aAdr );
3914
                    PopSingleRef( aAdr );
3896
                    if( !nGlobalError )
3915
                    if( !nGlobalError )
Lines 3911-3916 Link Here
3911
                    }
3930
                    }
3912
                    else
3931
                    else
3913
                    {
3932
                    {
3933
                        bRefFunc = true;
3914
                        ScRange aRange;
3934
                        ScRange aRange;
3915
                        PopDoubleRef( aRange );
3935
                        PopDoubleRef( aRange );
3916
                        ScAddress aAdr;
3936
                        ScAddress aAdr;
(-)source/ui/unoobj/chart2uno.cxx (-2 / +48 lines)
Lines 19-26 Link Here
19
 * 
19
 * 
20
 *************************************************************/
20
 *************************************************************/
21
21
22
23
24
// MARKER(update_precomp.py): autogen include statement, do not remove
22
// MARKER(update_precomp.py): autogen include statement, do not remove
25
#include "precompiled_sc.hxx"
23
#include "precompiled_sc.hxx"
26
24
Lines 39-44 Link Here
39
#include "compiler.hxx"
37
#include "compiler.hxx"
40
#include "reftokenhelper.hxx"
38
#include "reftokenhelper.hxx"
41
#include "chartlis.hxx"
39
#include "chartlis.hxx"
40
#include "rangenam.hxx"
42
41
43
#include <sfx2/objsh.hxx>
42
#include <sfx2/objsh.hxx>
44
#include <tools/table.hxx>
43
#include <tools/table.hxx>
Lines 2035-2040 Link Here
2035
2034
2036
    vector<ScSharedTokenRef> aRefTokens;
2035
    vector<ScSharedTokenRef> aRefTokens;
2037
    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
2036
    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
2037
	if (aRefTokens.empty())	// i120962: If haven't get reference, that means aRangeRepresentation is not a simple address, then try formulas
2038
	{
2039
		ScRangeName	aLocalRangeName(*(m_pDocument->GetRangeName()));
2040
		sal_uInt16	nCurPos = 0;
2041
		sal_Bool	bFindName = aLocalRangeName.SearchName(aRangeRepresentation, nCurPos);	// Find global name first
2042
2043
		for (SCTAB Scope = 0; Scope < MAXTABCOUNT && !bFindName; Scope++ )	// Find name in sheet scope
2044
			bFindName = aLocalRangeName.SearchName(aRangeRepresentation, nCurPos, Scope);
2045
2046
		if (bFindName)
2047
		{
2048
			ScRangeData*	pData =(ScRangeData*)(aLocalRangeName.At(nCurPos));
2049
			ScTokenArray*	pArray = pData->GetCode();
2050
			sal_uInt16 nLen = pArray->GetLen();
2051
			if (!nLen)
2052
				;
2053
			else if (nLen == 1)	// range names
2054
			{
2055
				pArray->Reset();
2056
				const FormulaToken* p = pArray->GetNextReference();
2057
				if (p)
2058
					aRefTokens.push_back(
2059
							ScSharedTokenRef(static_cast<ScToken*>(p->Clone())));
2060
			}
2061
			else	// formulas
2062
			{
2063
				String	aSymbol;
2064
				pData->GetSymbol(aSymbol, FormulaGrammar::GRAM_ENGLISH);
2065
2066
				String	aFormulaStr('=');
2067
				aFormulaStr += aSymbol;
2068
2069
				ScAddress	aAddr;
2070
				ScFormulaCell*	pCell = new ScFormulaCell(m_pDocument, aAddr, aFormulaStr, FormulaGrammar::GRAM_ENGLISH);
2071
				pCell->Interpret();
2072
2073
				if (pCell->GetValidRefToken())
2074
				{
2075
					aRefTokens.push_back(
2076
						ScSharedTokenRef(static_cast<ScToken*>(pCell->GetValidRefToken()->Clone())));
2077
				}
2078
2079
				DELETEZ( pCell );
2080
			}
2081
		}
2082
	}
2083
2038
    if (aRefTokens.empty())
2084
    if (aRefTokens.empty())
2039
        return xResult;
2085
        return xResult;
2040
2086

Return to issue 120962