25 #include <document.hxx>
61 Flags.bColRel =
false;
78 Flags.bRowRel =
false;
95 Flags.bTabRel =
false;
101 Flags.bTabRel =
true;
112 Flags.bColDeleted = bVal;
117 Flags.bRowDeleted = bVal;
122 Flags.bTabDeleted = bVal;
242 if (
Flags.bRowDeleted)
249 if (
Flags.bColDeleted)
256 if (
Flags.bTabDeleted)
269 ((rRef1.
Flags.bTabRel ? kTAB : 0) |
270 (rRef1.
Flags.bRowRel ? kROW : 0) |
271 (rRef1.
Flags.bColRel ? kCOL : 0)) :
275 ((rRef2.
Flags.bTabRel ? kTAB : 0) |
276 (rRef2.
Flags.bRowRel ? kROW : 0) |
277 (rRef2.
Flags.bColRel ? kCOL : 0)) :
284 rRef1.
mnCol = rRef2.
Flags.bColRel ? nCol2 - rPos.
Col() : nCol2;
285 rRef2.
mnCol = rRef1.
Flags.bColRel ? nCol1 - rPos.
Col() : nCol1;
286 if (rRef1.
Flags.bRelName && rRef1.
Flags.bColRel)
290 if (rRef2.
Flags.bRelName && rRef2.
Flags.bColRel)
294 bool bTmp = rRef1.
Flags.bColRel;
296 rRef2.
Flags.bColRel = bTmp;
297 bTmp = rRef1.
Flags.bColDeleted;
298 rRef1.
Flags.bColDeleted = rRef2.
Flags.bColDeleted;
299 rRef2.
Flags.bColDeleted = bTmp;
306 rRef1.
mnRow = rRef2.
Flags.bRowRel ? nRow2 - rPos.
Row() : nRow2;
307 rRef2.
mnRow = rRef1.
Flags.bRowRel ? nRow1 - rPos.
Row() : nRow1;
308 if (rRef1.
Flags.bRelName && rRef1.
Flags.bRowRel)
312 if (rRef2.
Flags.bRelName && rRef2.
Flags.bRowRel)
316 bool bTmp = rRef1.
Flags.bRowRel;
318 rRef2.
Flags.bRowRel = bTmp;
319 bTmp = rRef1.
Flags.bRowDeleted;
320 rRef1.
Flags.bRowDeleted = rRef2.
Flags.bRowDeleted;
321 rRef2.
Flags.bRowDeleted = bTmp;
328 rRef1.
mnTab = rRef2.
Flags.bTabRel ? nTab2 - rPos.
Tab() : nTab2;
329 rRef2.
mnTab = rRef1.
Flags.bTabRel ? nTab1 - rPos.
Tab() : nTab1;
330 if (rRef1.
Flags.bRelName && rRef1.
Flags.bTabRel)
334 if (rRef2.
Flags.bRelName && rRef2.
Flags.bTabRel)
338 bool bTmp = rRef1.
Flags.bTabRel;
340 rRef2.
Flags.bTabRel = bTmp;
341 bTmp = rRef1.
Flags.bTabDeleted;
342 rRef1.
Flags.bTabDeleted = rRef2.
Flags.bTabDeleted;
343 rRef2.
Flags.bTabDeleted = bTmp;
348 rRef1.
Flags.bRelName = (nRelState1 != 0);
349 rRef2.
Flags.bRelName = (nRelState2 != 0);
362 #if DEBUG_FORMULA_COMPILER
363 void ScSingleRefData::Dump(
int nIndent )
const
366 for (
int i = 0;
i < nIndent; ++
i)
369 cout << aIndent <<
"address type column: " << (
IsColRel()?
"relative":
"absolute")
370 <<
" row : " << (
IsRowRel()?
"relative":
"absolute") <<
" sheet: "
371 << (
IsTabRel()?
"relative":
"absolute") << endl;
372 cout << aIndent <<
"deleted column: " << (
IsColDeleted()?
"yes":
"no")
373 <<
" row : " << (
IsRowDeleted()?
"yes":
"no") <<
" sheet: "
375 cout << aIndent <<
"column: " <<
mnCol <<
" row: " <<
mnRow <<
" sheet: " <<
mnTab <<
endl;
376 cout << aIndent <<
"3d ref: " << (
IsFlag3D()?
"yes":
"no") << endl;
520 if (nCol2 == rDoc.
MaxCol())
524 if (nCol2 < rDoc.
MaxCol())
526 SCCOL nCol = ::std::min( static_cast<SCCOL>(nCol2 + nDelta), rDoc.
MaxCol());
549 if (nRow2 == rDoc.
MaxRow())
553 if (nRow2 < rDoc.
MaxRow())
555 SCROW nRow = ::std::min( static_cast<SCROW>(nRow2 + nDelta), rDoc.
MaxRow());
572 #if DEBUG_FORMULA_COMPILER
573 void ScComplexRefData::Dump(
int nIndent )
const
576 for (
int i = 0;
i < nIndent; ++
i)
579 cout << aIndent <<
"ref 1" <<
endl;
580 Ref1.Dump(nIndent+1);
581 cout << aIndent <<
"ref 2" << endl;
582 Ref2.Dump(nIndent+1);
void InitAddressRel(const ScDocument &rDoc, const ScAddress &rAdr, const ScAddress &rPos)
InitAddressRel: InitFlags and set address, everything relative to rPos.
bool IsTabDeleted() const
SC_DLLPUBLIC ScRange toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
bool Valid(const ScDocument &rDoc) const
Single reference (one address) into the sheet.
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
void SetRelCol(SCCOL nVal)
static void PutInOrder(ScSingleRefData &rRef1, ScSingleRefData &rRef2, const ScAddress &rPos)
Adjust ordering (front-top-left/rear-bottom-right) to a new position.
void SetRelTab(SCTAB nVal)
bool operator==(const ScSingleRefData &) const
bool IncEndColSticky(const ScDocument &rDoc, SCCOL nDelta, const ScAddress &rPos)
Increment or decrement end column unless or until sticky.
void SetAbsRow(SCROW nVal)
void SetRowRel(bool bVal)
void SetRowDeleted(bool bVal)
bool ColValid(const ScDocument &rDoc) const
SC_DLLPUBLIC SCROW MaxRow() const
void SetColDeleted(bool bVal)
void SetTabRel(bool bVal)
void SetRelName(bool bVal)
void SetRelRow(SCROW nVal)
SC_DLLPUBLIC SCCOL MaxCol() const
bool ValidExternal(const ScDocument &rDoc) const
In external references nTab is -1 if the external document was not loaded but the sheet was cached...
void SetFlag3D(bool bVal)
void InitAddress(const ScAddress &rAdr)
InitAddress: InitFlags and set address.
bool RowValid(const ScDocument &rDoc) const
void SetAbsCol(SCCOL nVal)
ScSheetLimits & GetSheetLimits() const
void InitFromRefAddresses(const ScDocument &rDoc, const ScRefAddress &rRef1, const ScRefAddress &rRef2, const ScAddress &rPos)
InitFlags and set range, relative to rPos if rRef1 and rRef2 say so.
bool IncEndRowSticky(const ScDocument &rDoc, SCROW nDelta, const ScAddress &rPos)
Increment or decrement end row unless or until sticky.
void SetAbsTab(SCTAB nVal)
ScComplexRefData & Extend(const ScSheetLimits &rLimits, const ScSingleRefData &rRef, const ScAddress &rPos)
Enlarge range if reference passed is not within existing range.
bool ValidRow(SCROW nRow) const
bool Valid(const ScDocument &rDoc) const
const ScAddress & GetAddress() const
bool ValidCol(SCCOL nCol) const
SvStream & endl(SvStream &rStr)
void InitFlags()
No default ctor, because used in ScRawToken union, set InitFlags!
struct ScSingleRefData::@35::@37 Flags
bool operator!=(const ScSingleRefData &) const
void SetRange(const ScSheetLimits &rLimits, const ScRange &rRange, const ScAddress &rPos)
Set a new range, assuming that the ordering of the range matches the ordering of the reference data f...
bool ValidExternal(const ScDocument &rDoc) const
In external references nTab is -1 for the start tab and -1 for the end tab if one sheet and the exter...
void SetAddress(const ScSheetLimits &rLimits, const ScAddress &rAddr, const ScAddress &rPos)
Complex reference (a range) into the sheet.
void PutInOrder(const ScAddress &rPos)
Adjust ordering (front-top-left/rear-bottom-right) to a new position.
void SetTabDeleted(bool bVal)
bool IsRowDeleted() const
void SetColRel(bool bVal)
bool ValidTab(SCTAB nTab)
bool IsColDeleted() const
void InitFromRefAddress(const ScDocument &rDoc, const ScRefAddress &rRef, const ScAddress &rPos)
InitFlags and set address, relative to rPos if rRef says so.