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

(-)sc.clean/inc/rangenam.hxx (+1 lines)
Lines 155-160 public: Link Here
155
	void			UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
155
	void			UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
156
156
157
	BOOL			IsReference( ScRange& rRef ) const;
157
	BOOL			IsReference( ScRange& rRef ) const;
158
	BOOL			IsReference( ScRange& rRef, const ScAddress& rPos ) const;
158
	BOOL			IsValidReference( ScRange& rRef ) const;
159
	BOOL			IsValidReference( ScRange& rRef ) const;
159
160
160
	BOOL			IsRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const;
161
	BOOL			IsRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const;
(-)sc.clean/source/core/tool/interpr1.cxx (-3 / +71 lines)
Lines 71-76 Link Here
71
#include "jumpmatrix.hxx"
71
#include "jumpmatrix.hxx"
72
#include "cellkeytranslator.hxx"
72
#include "cellkeytranslator.hxx"
73
#include "lookupcache.hxx"
73
#include "lookupcache.hxx"
74
#include "rangenam.hxx"
74
75
75
#define	SC_DOUBLE_MAXVALUE	1.7e307
76
#define	SC_DOUBLE_MAXVALUE	1.7e307
76
77
Lines 5686-5692 void ScInterpreter::ScIndirectXL() Link Here
5686
		conv = ScAddress::CONV_XL_R1C1;
5687
		conv = ScAddress::CONV_XL_R1C1;
5687
5688
5688
	if ( MustHaveParamCount( nParamCount, 1, 2 )  )
5689
	if ( MustHaveParamCount( nParamCount, 1, 2 )  )
5689
		{
5690
    {
5690
		ScAddress::Details const details( conv, aPos );
5691
		ScAddress::Details const details( conv, aPos );
5691
		SCTAB nTab = aPos.Tab();
5692
		SCTAB nTab = aPos.Tab();
5692
		String sRefStr( GetString() );
5693
		String sRefStr( GetString() );
Lines 5697-5703 void ScInterpreter::ScIndirectXL() Link Here
5697
		else if ( ConvertSingleRef ( pDok, sRefStr, nTab, aRefAd, details ) )
5698
		else if ( ConvertSingleRef ( pDok, sRefStr, nTab, aRefAd, details ) )
5698
			PushSingleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab() );
5699
			PushSingleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab() );
5699
		else
5700
		else
5700
			SetIllegalArgument();
5701
        {
5702
            do
5703
            {
5704
                ScRangeName* pNames = pDok->GetRangeName();
5705
                if (!pNames)
5706
                    break;
5707
5708
                USHORT nPos = 0;
5709
                if (!pNames->SearchName(sRefStr, nPos)) 
5710
                    break;
5711
5712
                ScRangeData* rData = (*pNames)[nPos];
5713
                if (!rData)
5714
                    break;
5715
5716
                rData->ValidateTabRefs();
5717
        
5718
                ScRange aRange;
5719
                if (!rData->IsReference(aRange, ScAddress(aPos.Tab(), 0, 0))) 
5720
                    break;
5721
5722
                if ( aRange.aStart == aRange.aEnd )
5723
                    PushSingleRef(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab());
5724
                else
5725
                    PushDoubleRef(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab(),
5726
                                  aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aEnd.Tab());
5727
5728
                // success!
5729
                return;
5730
            } 
5731
            while (false);
5732
5733
            SetIllegalArgument();
5734
        }
5701
	}
5735
	}
5702
}
5736
}
5703
5737
Lines 5719-5725 void ScInterpreter::ScIndirect() Link Here
5719
		else if ( ConvertSingleRef( pDok, sRefStr, nTab, aRefAd ) )
5753
		else if ( ConvertSingleRef( pDok, sRefStr, nTab, aRefAd ) )
5720
			PushSingleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab() );
5754
			PushSingleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab() );
5721
		else
5755
		else
5722
			SetIllegalArgument();
5756
        {
5757
            do
5758
            {
5759
                ScRangeName* pNames = pDok->GetRangeName();
5760
                if (!pNames)
5761
                    break;
5762
5763
                USHORT nPos = 0;
5764
                if (!pNames->SearchName(sRefStr, nPos)) 
5765
                    break;
5766
5767
                ScRangeData* rData = (*pNames)[nPos];
5768
                if (!rData)
5769
                    break;
5770
5771
                // we need this in order to obtain good range
5772
                rData->ValidateTabRefs();
5773
        
5774
                ScRange aRange;
5775
                if (!rData->IsReference(aRange, aPos)) 
5776
                    break;
5777
5778
                if ( aRange.aStart == aRange.aEnd )
5779
                    PushSingleRef(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab());
5780
                else
5781
                    PushDoubleRef(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab(),
5782
                                  aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aEnd.Tab());
5783
5784
                // success!
5785
                return;
5786
            } 
5787
            while (false);
5788
5789
            SetIllegalArgument();
5790
        }
5723
	}
5791
	}
5724
}
5792
}
5725
5793
(-)sc.clean/source/core/tool/rangenam.cxx (+17 lines)
Lines 41-46 Link Here
41
41
42
#include <tools/debug.hxx>
42
#include <tools/debug.hxx>
43
#include <string.h>
43
#include <string.h>
44
#include <memory>
44
#include <unotools/collatorwrapper.hxx>
45
#include <unotools/collatorwrapper.hxx>
45
#ifndef _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
46
#ifndef _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
46
#include <unotools/transliterationwrapper.hxx>
47
#include <unotools/transliterationwrapper.hxx>
Lines 486-491 BOOL ScRangeData::IsReference( ScRange& Link Here
486
    return FALSE;
487
    return FALSE;
487
}
488
}
488
489
490
BOOL ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const
491
{
492
	if ( eType & ( RT_ABSAREA | RT_REFAREA | RT_ABSPOS ) )
493
		if ( pCode )
494
        {
495
            ::std::auto_ptr<ScTokenArray> pTemp( pCode->Clone() );
496
            ScCompiler aComp( pDoc, rPos, *pTemp );
497
            aComp.SetCompileEnglish( false );
498
            aComp.SetCompileXML( false );
499
            aComp.MoveRelWrap();
500
            return pTemp->IsReference( rRange );
501
        }
502
503
    return FALSE;
504
}
505
489
BOOL ScRangeData::IsValidReference( ScRange& rRange ) const
506
BOOL ScRangeData::IsValidReference( ScRange& rRange ) const
490
{
507
{
491
    if ( eType & ( RT_ABSAREA | RT_REFAREA | RT_ABSPOS ) )
508
    if ( eType & ( RT_ABSAREA | RT_REFAREA | RT_ABSPOS ) )

Return to issue 4695