LibreOffice Module sc (master) 1
formulaiter.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <formulaiter.hxx>
21
22#include <formulacell.hxx>
23#include <tokenarray.hxx>
24#include <formula/token.hxx>
25#include <token.hxx>
26
27using namespace formula;
28
30 mrDoc(rDoc),
31 maIter(*pCell->GetCode()),
32 aPos(pCell->aPos)
33{
34}
35
37{
38 ScSingleRefData& rRef1 = *p->GetSingleRef();
39 ScAddress aAbs1 = rRef1.toAbs(rDoc, rPos);
40 if (!rDoc.ValidAddress(aAbs1))
41 return true;
42 if ( p->GetType() == svDoubleRef || p->GetType() == svExternalDoubleRef )
43 {
44 ScSingleRefData& rRef2 = p->GetDoubleRef()->Ref2;
45 ScAddress aAbs2 = rRef2.toAbs(rDoc, rPos);
46 if (!rDoc.ValidAddress(aAbs2))
47 return true;
48 }
49 return false;
50}
51
53{
54 bool bRet = false;
56 if( p )
57 {
58 SingleDoubleRefProvider aProv( *p );
59 rRange.aStart = aProv.Ref1.toAbs(mrDoc, aPos);
60 rRange.aEnd = aProv.Ref2.toAbs(mrDoc, aPos);
61 bRet = true;
62 }
63
64 return bRet;
65}
66
68{
71 {
73 }
74 return p;
75}
76
77/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< Reference< XAnimationNode > >::iterator maIter
formula::FormulaTokenArrayPlainIterator maIter
Definition: formulaiter.hxx:35
ScDetectiveRefIter(const ScDocument &rDoc, ScFormulaCell *pCell)
Definition: formulaiter.cxx:29
const ScDocument & mrDoc
Definition: formulaiter.hxx:34
bool GetNextRef(ScRange &rRange)
Definition: formulaiter.cxx:52
formula::FormulaToken * GetNextRefToken()
Definition: formulaiter.cxx:67
bool ValidAddress(const ScAddress &rAddress) const
Definition: document.hxx:904
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
const ScSingleRefData & Ref2
Definition: token.hxx:445
const ScSingleRefData & Ref1
Definition: token.hxx:444
static bool lcl_ScDetectiveRefIter_SkipRef(const ScDocument &rDoc, formula::FormulaToken *p, const ScAddress &rPos)
Definition: formulaiter.cxx:36
void * p
svExternalDoubleRef
svDoubleRef
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Definition: refdata.cxx:193