LibreOffice Module sc (master) 1
|
#include <sal/config.h>
#include <string_view>
#include <address.hxx>
#include <global.hxx>
#include <compiler.hxx>
#include <document.hxx>
#include <externalrefmgr.hxx>
#include <osl/diagnose.h>
#include <o3tl/underlyingenumvalue.hxx>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/sheet/ExternalLinkInfo.hpp>
#include <com/sun/star/sheet/ExternalLinkType.hpp>
#include <sfx2/objsh.hxx>
#include <tools/urlobj.hxx>
#include <sal/log.hxx>
#include <rtl/character.hxx>
#include <unotools/charclass.hxx>
Go to the source code of this file.
Functions | |
static sal_Int64 | sal_Unicode_strtol (const sal_Unicode *p, const sal_Unicode **pEnd) |
static const sal_Unicode * | lcl_eatWhiteSpace (const sal_Unicode *p) |
static bool | lcl_isString (const sal_Unicode *p1, const OUString &rStr) |
static bool | lcl_ScRange_External_TabSpan (ScRange &rRange, ScRefFlags &rFlags, ScAddress::ExternalInfo *pExtInfo, const OUString &rExternDocName, const OUString &rStartTabName, const OUString &rEndTabName, const ScDocument &rDoc) |
Determines the number of sheets an external reference spans and sets rRange.aEnd.nTab accordingly. More... | |
static const sal_Unicode * | lcl_XL_ParseSheetRef (const sal_Unicode *start, OUString &rExternTabName, bool bAllow3D, const sal_Unicode *pMsoxlQuoteStop, const OUString *pErrRef) |
Returns NULL if the string should be a sheet name, but is invalid. More... | |
static bool | lcl_XL_getExternalDoc (const sal_Unicode **ppErrRet, OUString &rExternDocName, const uno::Sequence< sheet::ExternalLinkInfo > *pExternalLinks) |
Tries to obtain the external document index and replace by actual document name. More... | |
static const sal_Unicode * | lcl_r1c1_get_col (const ScSheetLimits &rSheetLimits, const sal_Unicode *p, const ScAddress::Details &rDetails, ScAddress *pAddr, ScRefFlags *nFlags) |
static const sal_Unicode * | lcl_r1c1_get_row (const ScSheetLimits &rSheetLimits, const sal_Unicode *p, const ScAddress::Details &rDetails, ScAddress *pAddr, ScRefFlags *nFlags) |
static ScRefFlags | lcl_ScRange_Parse_XL_R1C1 (ScRange &r, const sal_Unicode *p, const ScDocument &rDoc, const ScAddress::Details &rDetails, bool bOnlyAcceptSingle, ScAddress::ExternalInfo *pExtInfo, sal_Int32 *pSheetEndPos) |
static const sal_Unicode * | lcl_a1_get_col (const ScDocument &rDoc, const sal_Unicode *p, ScAddress *pAddr, ScRefFlags *nFlags, const OUString *pErrRef) |
static const sal_Unicode * | lcl_a1_get_row (const ScDocument &rDoc, const sal_Unicode *p, ScAddress *pAddr, ScRefFlags *nFlags, const OUString *pErrRef) |
static bool | isValidSingleton (ScRefFlags nFlags, ScRefFlags nFlags2) |
B:B or 2:2, but not B:2 or 2:B or B2:B or B:B2 or ... More... | |
static ScRefFlags | lcl_ScRange_Parse_XL_A1 (ScRange &r, const sal_Unicode *p, const ScDocument &rDoc, bool bOnlyAcceptSingle, ScAddress::ExternalInfo *pExtInfo, const uno::Sequence< sheet::ExternalLinkInfo > *pExternalLinks, sal_Int32 *pSheetEndPos, const OUString *pErrRef) |
static ScRefFlags | lcl_ScAddress_Parse_OOo (const sal_Unicode *p, const ScDocument &rDoc, ScAddress &rAddr, ScRefFlags &rRawRes, ScAddress::ExternalInfo *pExtInfo, ScRange *pRange, sal_Int32 *pSheetEndPos, const OUString *pErrRef) |
static ScRefFlags | lcl_ScAddress_Parse (const sal_Unicode *p, const ScDocument &rDoc, ScAddress &rAddr, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo, const uno::Sequence< sheet::ExternalLinkInfo > *pExternalLinks, sal_Int32 *pSheetEndPos, const OUString *pErrRef) |
bool | ConvertSingleRef (const ScDocument &rDoc, const OUString &rRefString, SCTAB nDefTab, ScRefAddress &rRefAddress, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo) |
bool | ConvertDoubleRef (const ScDocument &rDoc, const OUString &rRefString, SCTAB nDefTab, ScRefAddress &rStartRefAddress, ScRefAddress &rEndRefAddress, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo) |
static ScRefFlags | lcl_ScRange_Parse_OOo (ScRange &rRange, const OUString &r, const ScDocument &rDoc, ScAddress::ExternalInfo *pExtInfo, const OUString *pErrRef) |
template<typename T > | |
static void | lcl_ScColToAlpha (T &rBuf, SCCOL nCol) |
void | ScColToAlpha (OUStringBuffer &rBuf, SCCOL nCol) |
append alpha representation of column to buffer More... | |
template<typename T > | |
static void | lcl_a1_append_c (T &rString, int nCol, bool bIsAbs) |
template<typename T > | |
static void | lcl_a1_append_r (T &rString, sal_Int32 nRow, bool bIsAbs) |
template<typename T > | |
static void | lcl_r1c1_append_c (T &rString, sal_Int32 nCol, bool bIsAbs, const ScAddress::Details &rDetails) |
template<typename T > | |
static void | lcl_r1c1_append_r (T &rString, sal_Int32 nRow, bool bIsAbs, const ScAddress::Details &rDetails) |
static OUString | getFileNameFromDoc (const ScDocument *pDoc) |
static void | lcl_string_append (OUStringBuffer &rString, std::u16string_view sString) |
static void | lcl_string_append (OStringBuffer &rString, std::u16string_view sString) |
template<typename T > | |
static void | lcl_Format (T &r, SCTAB nTab, SCROW nRow, SCCOL nCol, ScRefFlags nFlags, const ScDocument *pDoc, const ScAddress::Details &rDetails) |
static void | lcl_Split_DocTab (const ScDocument &rDoc, SCTAB nTab, const ScAddress::Details &rDetails, ScRefFlags nFlags, OUString &rTabName, OUString &rDocName) |
static void | lcl_ScRange_Format_XL_Header (OUStringBuffer &rString, const ScRange &rRange, ScRefFlags nFlags, const ScDocument &rDoc, const ScAddress::Details &rDetails) |
static bool | lcl_ColAbsFlagDiffer (const ScRefFlags nFlags) |
static bool | lcl_RowAbsFlagDiffer (const ScRefFlags nFlags) |
bool | AlphaToCol (const ScDocument &rDoc, SCCOL &rCol, std::u16string_view rStr) |
get column number of A..IV... string More... | |
bool AlphaToCol | ( | const ScDocument & | rDoc, |
SCCOL & | rCol, | ||
std::u16string_view | rStr | ||
) |
get column number of A..IV... string
Definition at line 2509 of file address.cxx.
References ScDocument::MaxCol(), nPos, ScGlobal::ToUpperAlpha(), and ScDocument::ValidCol().
Referenced by ScTableColumnsObj::GetObjectByName_Impl(), ScTableColumnsObj::hasByName(), and lcl_CheckOne_OOO().
bool ConvertDoubleRef | ( | const ScDocument & | rDoc, |
const OUString & | rRefString, | ||
SCTAB | nDefTab, | ||
ScRefAddress & | rStartRefAddress, | ||
ScRefAddress & | rEndRefAddress, | ||
const ScAddress::Details & | rDetails, | ||
ScAddress::ExternalInfo * | pExtInfo | ||
) |
Definition at line 1511 of file address.cxx.
References ScRange::aEnd, ScRange::aStart, COL2_ABS, COL_ABS, ScGlobal::FindUnquoted(), ScRange::Parse(), ROW2_ABS, ROW_ABS, SC_COMPILER_FILE_TAB_SEP, ScAddress::ScAddress(), ScRefAddress::Set(), TAB2_ABS, TAB_ABS, VALID, and ZERO.
Referenced by ScRangeUtil::IsAbsArea(), lcl_Parse(), ScRangeUtil::MakeArea(), ScInterpreter::ScIndirect(), and ScPivotLayoutDialog::UpdateSourceRange().
bool ConvertSingleRef | ( | const ScDocument & | rDoc, |
const OUString & | rRefString, | ||
SCTAB | nDefTab, | ||
ScRefAddress & | rRefAddress, | ||
const ScAddress::Details & | rDetails, | ||
ScAddress::ExternalInfo * | pExtInfo | ||
) |
Definition at line 1489 of file address.cxx.
References COL_ABS, ScGlobal::FindUnquoted(), ScAddress::Parse(), ROW_ABS, SC_COMPILER_FILE_TAB_SEP, ScRefAddress::Set(), TAB_ABS, VALID, and ZERO.
Referenced by IMPL_LINK(), ScRangeUtil::IsAbsPos(), ScRangeUtil::IsAbsTabArea(), lcl_Parse(), and ScInterpreter::ScIndirect().
|
static |
Definition at line 1937 of file address.cxx.
References aURL, ScDocument::GetDocumentShell(), SfxObjectShell::GetModel(), SfxObjectShell::GetTitle(), and xModel.
Referenced by lcl_Format(), and lcl_Split_DocTab().
|
static |
B:B or 2:2, but not B:2 or 2:B or B2:B or B:B2 or ...
Definition at line 968 of file address.cxx.
References COL2_VALID, COL_VALID, ROW2_VALID, and ROW_VALID.
Referenced by lcl_ScRange_Parse_XL_A1().
|
static |
Definition at line 1889 of file address.cxx.
References lcl_ScColToAlpha(), and ScAddress::nCol.
Referenced by ScRange::Format(), and lcl_Format().
|
static |
Definition at line 1896 of file address.cxx.
References ScAddress::nRow.
Referenced by ScRange::Format(), and lcl_Format().
|
static |
Definition at line 899 of file address.cxx.
References COL_ABS, COL_VALID, lcl_isString(), ScDocument::MaxCol(), ScAddress::nCol, p, and ScAddress::SetCol().
Referenced by lcl_ScRange_Parse_XL_A1(), and ScRange::ParseCols().
|
static |
Definition at line 935 of file address.cxx.
References lcl_isString(), ScDocument::MaxRow(), n, p, ROW_ABS, ROW_VALID, sal_Unicode_strtol(), and ScAddress::SetRow().
Referenced by lcl_ScRange_Parse_XL_A1(), and ScRange::ParseRows().
|
static |
Definition at line 2161 of file address.cxx.
References COL2_ABS, and COL_ABS.
Referenced by ScRange::Format().
|
static |
Definition at line 165 of file address.cxx.
References p.
Referenced by lcl_ScRange_Parse_XL_A1(), and ScRange::Parse_XL_Header().
|
static |
Definition at line 1973 of file address.cxx.
References ScCompiler::CheckTabQuotes(), COL_ABS, COL_VALID, formula::FormulaGrammar::CONV_OOO, formula::FormulaGrammar::CONV_XL_A1, formula::FormulaGrammar::CONV_XL_OOX, formula::FormulaGrammar::CONV_XL_R1C1, ScAddress::Details::eConv, FORCE_DOC, ScCompiler::GetDocTabPos(), getFileNameFromDoc(), ScDocument::GetName(), formula::FormulaCompiler::GetNativeSymbol(), ScDocument::GetTableCount(), lcl_a1_append_c(), lcl_a1_append_r(), lcl_r1c1_append_c(), lcl_r1c1_append_r(), lcl_string_append(), ScAddress::nCol, nPos, ScAddress::nRow, ScAddress::nTab, ocErrRef, ROW_ABS, ROW_VALID, TAB_3D, TAB_ABS, TAB_VALID, VALID, and ZERO.
Referenced by ScAddress::Format().
|
static |
Definition at line 176 of file address.cxx.
Referenced by lcl_a1_get_col(), lcl_a1_get_row(), lcl_ScAddress_Parse_OOo(), and lcl_XL_ParseSheetRef().
|
static |
Definition at line 1903 of file address.cxx.
References ScAddress::nCol, and ScAddress::Details::nCol.
Referenced by ScRange::Format(), ScAddress::GetColRowString(), and lcl_Format().
|
static |
Definition at line 1920 of file address.cxx.
References ScAddress::nRow, and ScAddress::Details::nRow.
Referenced by ScRange::Format(), ScAddress::GetColRowString(), and lcl_Format().
|
static |
Definition at line 658 of file address.cxx.
References COL_ABS, COL_VALID, ScSheetLimits::GetMaxColCount(), n, ScAddress::Details::nCol, p, sal_Unicode_strtol(), and ScAddress::SetCol().
Referenced by lcl_ScRange_Parse_XL_R1C1(), and ScRange::ParseCols().
|
static |
Definition at line 705 of file address.cxx.
References ScSheetLimits::GetMaxRowCount(), n, ScAddress::Details::nRow, p, ROW_ABS, ROW_VALID, sal_Unicode_strtol(), and ScAddress::SetRow().
Referenced by lcl_ScRange_Parse_XL_R1C1(), and ScRange::ParseRows().
|
static |
Definition at line 2165 of file address.cxx.
References ROW2_ABS, and ROW_ABS.
Referenced by ScRange::Format().
|
static |
Definition at line 1450 of file address.cxx.
References ScRange::aStart, formula::FormulaGrammar::CONV_OOO, formula::FormulaGrammar::CONV_XL_A1, formula::FormulaGrammar::CONV_XL_OOX, formula::FormulaGrammar::CONV_XL_R1C1, ScAddress::Details::eConv, lcl_ScAddress_Parse_OOo(), lcl_ScRange_Parse_XL_A1(), lcl_ScRange_Parse_XL_R1C1(), p, and ZERO.
Referenced by ScAddress::Parse().
|
static |
p | pointer to null-terminated sal_Unicode string |
rRawRes | returns ScRefFlags::... flags without the final check for full validity that is applied to the return value, with which two addresses that form a column or row singleton range, e.g. A:A or 1:1, can be detected. Used in lcl_ScRange_Parse_OOo(). |
pRange | pointer to range where rAddr effectively is *pRange->aEnd, used in conjunction with pExtInfo to determine the tab span of a 3D reference. |
Definition at line 1139 of file address.cxx.
References ScRange::aEnd, COL_ABS, COL_VALID, ScExternalRefManager::convertToAbsName(), ScGlobal::FindUnquoted(), ScExternalRefManager::getExternalFileId(), ScExternalRefManager::getExternalFileName(), ScDocument::GetExternalRefManager(), ScExternalRefManager::getSingleRefToken(), ScDocument::GetTable(), ScExternalRefManager::isOwnDocument(), lcl_isString(), lcl_ScRange_External_TabSpan(), ScAddress::ExternalInfo::maTabName, ScDocument::MaxCol(), ScDocument::MaxRow(), ScAddress::ExternalInfo::mbExternal, ScAddress::ExternalInfo::mnFileId, n, ScAddress::nCol, ScAddress::nRow, ScAddress::nTab, p, ROW_ABS, ROW_VALID, SC_COMPILER_FILE_TAB_SEP, ScAddress::Set(), ScAddress::SetTab(), ScAddress::Tab(), TAB2_VALID, TAB_3D, TAB_ABS, TAB_VALID, VALID, and ZERO.
Referenced by lcl_ScAddress_Parse(), and lcl_ScRange_Parse_OOo().
|
static |
Definition at line 1858 of file address.cxx.
References ScAddress::nCol.
Referenced by ScAddress::GetColRowString(), lcl_a1_append_c(), and ScColToAlpha().
|
static |
Determines the number of sheets an external reference spans and sets rRange.aEnd.nTab accordingly.
If a sheet is not found, the corresponding bits in rFlags are cleared. pExtInfo is filled if it wasn't already. If in cached order rStartTabName comes after rEndTabName, pExtInfo->maTabName is set to rEndTabName.
Definition at line 215 of file address.cxx.
References ScRange::aEnd, ScRange::aStart, ScExternalRefManager::getCachedTabSpan(), ScExternalRefManager::getExternalFileId(), ScDocument::GetExternalRefManager(), ScDocument::GetTable(), ScExternalRefManager::isOwnDocument(), ScAddress::ExternalInfo::maTabName, ScAddress::ExternalInfo::mbExternal, ScAddress::ExternalInfo::mnFileId, ScAddress::nTab, ScAddress::SetTab(), ScAddress::Tab(), TAB2_VALID, and TAB_VALID.
Referenced by lcl_ScAddress_Parse_OOo(), lcl_ScRange_Parse_XL_A1(), and lcl_ScRange_Parse_XL_R1C1().
|
static |
Definition at line 2118 of file address.cxx.
References ScRange::aEnd, ScRange::aStart, formula::FormulaGrammar::CONV_XL_OOX, ScAddress::Details::eConv, lcl_Split_DocTab(), ScAddress::Tab(), TAB2_3D, and TAB_3D.
Referenced by ScRange::Format().
|
static |
Definition at line 1578 of file address.cxx.
References ScRange::aEnd, applyStartToEndFlags(), ScRange::aStart, BITS, ScAddress::Col(), COL_ABS, COL_VALID, ScGlobal::FindUnquoted(), lcl_ScAddress_Parse_OOo(), ScDocument::MaxCol(), ScDocument::MaxRow(), nPos, p, ScAddress::Row(), ROW_ABS, ROW_VALID, ScAddress::SetCol(), ScAddress::SetRow(), ScAddress::SetTab(), ScAddress::Tab(), TAB_3D, TAB_ABS, TAB_VALID, VALID, and ZERO.
Referenced by ScRange::Parse().
|
static |
Definition at line 975 of file address.cxx.
References ScRange::aEnd, applyStartToEndFlags(), ScRange::aStart, ScAddress::Col(), COL2_ABS, COL2_VALID, COL_ABS, COL_VALID, ScDocument::GetTable(), isValidSingleton(), lcl_a1_get_col(), lcl_a1_get_row(), lcl_eatWhiteSpace(), lcl_ScRange_External_TabSpan(), lcl_XL_ParseSheetRef(), ScDocument::MaxCol(), ScDocument::MaxRow(), ScAddress::nTab, p, ScRange::Parse_XL_Header(), ScAddress::Row(), ROW2_ABS, ROW2_VALID, ROW_ABS, ROW_VALID, ScAddress::SetCol(), ScAddress::SetRow(), ScAddress::SetTab(), TAB2_3D, TAB2_ABS, TAB2_VALID, TAB_3D, TAB_VALID, VALID, and ZERO.
Referenced by lcl_ScAddress_Parse(), and ScRange::Parse().
|
static |
Definition at line 752 of file address.cxx.
References ScRange::aEnd, applyStartToEndFlags(), ScRange::aStart, ScAddress::Col(), COL2_ABS, COL2_VALID, COL_ABS, COL_VALID, ScDocument::GetSheetLimits(), lcl_r1c1_get_col(), lcl_r1c1_get_row(), lcl_ScRange_External_TabSpan(), ScDocument::MaxCol(), ScDocument::MaxRow(), p, ScRange::Parse_XL_Header(), ScAddress::Row(), ROW2_ABS, ROW2_VALID, ROW_ABS, ROW_VALID, ScAddress::SetCol(), ScAddress::SetRow(), TAB2_VALID, TAB_3D, TAB_VALID, VALID, and ZERO.
Referenced by lcl_ScAddress_Parse(), and ScRange::Parse().
|
static |
Definition at line 2089 of file address.cxx.
References ScCompiler::CheckTabQuotes(), ScAddress::Details::eConv, FORCE_DOC, ScCompiler::GetDocTabPos(), getFileNameFromDoc(), ScDocument::GetName(), nPos, and ScAddress::nTab.
Referenced by lcl_ScRange_Format_XL_Header().
|
static |
Definition at line 1968 of file address.cxx.
References OUStringToOString().
|
static |
Definition at line 1963 of file address.cxx.
Referenced by lcl_Format().
|
static |
Tries to obtain the external document index and replace by actual document name.
ppErrRet | Contains the default pointer the caller would return if this method returns FALSE, may be replaced by NULL for type or data errors. |
Definition at line 424 of file address.cxx.
References aStr, i, CharClass::isAsciiNumeric(), and SAL_INFO.
Referenced by ScRange::Parse_XL_Header().
|
static |
Returns NULL if the string should be a sheet name, but is invalid.
Returns a pointer to the first character after the sheet name, if there was any, else pointer to start.
pMsoxlQuoteStop | Starting within a quoted name, but still may be 3D; quoted name stops at pMsoxlQuoteStop |
Definition at line 294 of file address.cxx.
References lcl_isString(), p, and start.
Referenced by lcl_ScRange_Parse_XL_A1(), and ScRange::Parse_XL_Header().
|
static |
Definition at line 136 of file address.cxx.
References p.
Referenced by lcl_a1_get_row(), lcl_r1c1_get_col(), and lcl_r1c1_get_row().
void ScColToAlpha | ( | OUStringBuffer & | rBuf, |
SCCOL | nCol | ||
) |
append alpha representation of column to buffer
Definition at line 1884 of file address.cxx.
References lcl_ScColToAlpha(), and ScAddress::nCol.
Referenced by ScAccessiblePreviewHeaderCell::createAccessibleName(), ScFilterDlg::FillFieldLists(), ScPivotFilterDlg::FillFieldLists(), ScTabPageSortFields::FillFieldLists(), ScTpSubTotalGroup::FillListBoxes(), ScTableColumnsObj::getElementNames(), ScColBar::GetEntryText(), ScTableColumnObj::getName(), ScChangeAction::GetRefString(), IMPL_LINK_NOARG(), ScPrintFunc::PrintColHdr(), ScColToAlpha(), SCNAV_COLLETTERS(), and ScTabView::ScrollHdl().