LibreOffice Module sc (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
oox::xls::AddressConverter Class Referencefinal

Converter for cell addresses and cell ranges for OOXML and BIFF filters. More...

#include <addressconverter.hxx>

Inheritance diagram for oox::xls::AddressConverter:
[legend]
Collaboration diagram for oox::xls::AddressConverter:
[legend]

Public Member Functions

 AddressConverter (const WorkbookHelper &rHelper)
 
const ScAddressgetMaxApiAddress () const
 Returns the biggest valid cell address in the own Calc document. More...
 
const ScAddressgetMaxXlsAddress () const
 Returns the biggest valid cell address in the imported/exported Excel document. More...
 
const ScAddressgetMaxAddress () const
 Returns the biggest valid cell address in both Calc and the imported/exported Excel document. More...
 
bool checkCol (sal_Int32 nCol, bool bTrackOverflow)
 Checks if the passed column index is valid. More...
 
bool checkRow (sal_Int32 nRow, bool bTrackOverflow)
 Checks if the passed row index is valid. More...
 
bool checkTab (sal_Int16 nSheet, bool bTrackOverflow)
 Checks if the passed sheet index is valid. More...
 
bool checkCellAddress (const ScAddress &rAddress, bool bTrackOverflow)
 Checks the passed cell address if it fits into the spreadsheet limits. More...
 
bool convertToCellAddress (ScAddress &orAddress, const OUString &rString, sal_Int16 nSheet, bool bTrackOverflow)
 Tries to convert the passed string to a single cell address. More...
 
bool convertToCellAddress (ScAddress &rAddress, std::string_view pStr, sal_Int16 nSheet, bool bTrackOverflow)
 
ScAddress createValidCellAddress (const OUString &rString, sal_Int16 nSheet, bool bTrackOverflow)
 Returns a valid cell address by moving it into allowed dimensions. More...
 
bool convertToCellAddress (ScAddress &orAddress, const BinAddress &rBinAddress, sal_Int16 nSheet, bool bTrackOverflow)
 Tries to convert the passed address to a single cell address. More...
 
ScAddress createValidCellAddress (const BinAddress &rBinAddress, sal_Int16 nSheet, bool bTrackOverflow)
 Returns a valid cell address by moving it into allowed dimensions. More...
 
bool checkCellRange (const ScRange &rRange, bool bAllowOverflow, bool bTrackOverflow)
 Checks the passed cell range if it fits into the spreadsheet limits. More...
 
bool validateCellRange (ScRange &orRange, bool bAllowOverflow, bool bTrackOverflow)
 Checks the passed cell range, may try to fit it to current sheet limits. More...
 
bool convertToCellRange (ScRange &orRange, std::u16string_view aString, sal_Int16 nSheet, bool bAllowOverflow, bool bTrackOverflow)
 Tries to convert the passed string to a cell range address. More...
 
bool convertToCellRange (ScRange &orRange, const BinRange &rBinRange, sal_Int16 nSheet, bool bAllowOverflow, bool bTrackOverflow)
 Tries to convert the passed range to a cell range address. More...
 
void validateCellRangeList (ScRangeList &orRanges, bool bTrackOverflow)
 Tries to restrict the passed cell range list to current sheet limits. More...
 
void convertToCellRangeList (ScRangeList &orRanges, std::u16string_view aString, sal_Int16 nSheet, bool bTrackOverflow)
 Tries to convert the passed string to a cell range list. More...
 
void convertToCellRangeList (ScRangeList &orRanges, const BinRangeList &rBinRanges, sal_Int16 nSheet, bool bTrackOverflow)
 Tries to convert the passed range list to a cell range list. More...
 
bool isColOverflow () const
 
bool isRowOverflow () const
 
bool isTabOverflow () const
 
- Public Member Functions inherited from oox::xls::WorkbookHelper
 WorkbookHelper (WorkbookGlobals &rBookGlob)
 
virtual ~WorkbookHelper ()
 
 WorkbookHelper (WorkbookHelper const &)=default
 
 WorkbookHelper (WorkbookHelper &&)=default
 
WorkbookHelperoperator= (WorkbookHelper const &)=delete
 
WorkbookHelperoperator= (WorkbookHelper &&)=delete
 
::oox::core::FilterBasegetBaseFilter () const
 Returns the base filter object (base class of all filters). More...
 
SegmentProgressBargetProgressBar () const
 Returns the filter progress bar. More...
 
sal_Int16 getCurrentSheetIndex () const
 Returns the index of the current Calc sheet, if filter currently processes a sheet. More...
 
bool isGeneratorKnownGood () const
 Returns true when reading a file generated by a known good generator. More...
 
bool hasCalculatedFormulaCells () const
 Returns true if any formula cell is calculated. More...
 
void setCalculatedFormulaCells ()
 Set if any formula cell is calculated. More...
 
void setVbaProjectStorage (const StorageRef &rxVbaPrjStrg)
 Sets the VBA project storage used to import VBA source code and forms. More...
 
void setCurrentSheetIndex (SCTAB nSheet)
 Sets the index of the current Calc sheet, if filter currently processes a sheet. More...
 
void finalizeWorkbookImport ()
 Final conversion after importing the workbook. More...
 
void useInternalChartDataTable (bool bInternal)
 
ScDocumentgetScDocument ()
 
const ScDocumentgetScDocument () const
 
ScDocumentImportgetDocImport ()
 
const ScDocumentImportgetDocImport () const
 
ScEditEngineDefaultergetEditEngine () const
 
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument () const
 Returns a reference to the source/target spreadsheet document model. More...
 
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc (sal_Int32 nSheet) const
 Returns a reference to the specified spreadsheet in the document model. More...
 
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc (const OUString &rSheet) const
 Returns a reference to the specified spreadsheet in the document model. More...
 
css::uno::Reference< css::table::XCellRange > getCellRangeFromDoc (const ScRange &rRange) const
 Returns the XCellRange interface for the passed cell range address. More...
 
css::uno::Reference< css::container::XNameContainer > getCellStyleFamily () const
 Returns the cell styles container from the Calc document. More...
 
css::uno::Reference< css::style::XStyle > getStyleObject (const OUString &rStyleName, bool bPageStyle) const
 Returns the specified cell or page style from the Calc document. More...
 
RangeDataRet createNamedRangeObject (OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, bool bHidden) const
 Creates and returns a defined name on-the-fly in the Calc document. More...
 
RangeDataRet createLocalNamedRangeObject (OUString &orName, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden) const
 Creates and returns a defined name on-the-fly in the sheet. More...
 
css::uno::Reference< css::sheet::XDatabaseRange > createDatabaseRangeObject (OUString &orName, const ScRange &rRangeAddr) const
 Creates and returns a database range on-the-fly in the Calc document. More...
 
css::uno::Reference< css::sheet::XDatabaseRange > createUnnamedDatabaseRangeObject (const ScRange &rRangeAddr) const
 Creates and returns an unnamed database range on-the-fly in the Calc document. More...
 
ScDBDatafindDatabaseRangeByIndex (sal_uInt16 nIndex) const
 Finds the (already existing) database range of the given formula token index. More...
 
css::uno::Reference< css::style::XStyle > createStyleObject (OUString &orStyleName, bool bPageStyle) const
 Creates and returns a com.sun.star.style.Style object for cells or pages. More...
 
FormulaBuffergetFormulaBuffer () const
 
WorkbookSettingsgetWorkbookSettings () const
 Returns the global workbook settings object. More...
 
ViewSettingsgetViewSettings () const
 Returns the workbook and sheet view settings object. More...
 
WorksheetBuffergetWorksheets () const
 Returns the worksheet buffer containing sheet names and properties. More...
 
ThemeBuffergetTheme () const
 Returns the office theme object read from the theme substorage. More...
 
StylesBuffergetStyles () const
 Returns all cell formatting objects read from the styles substream. More...
 
SharedStringsBuffergetSharedStrings () const
 Returns the shared strings read from the shared strings substream. More...
 
ExternalLinkBuffergetExternalLinks () const
 Returns the external links read from the external links substream. More...
 
DefinedNamesBuffergetDefinedNames () const
 Returns the defined names read from the workbook globals. More...
 
TableBuffergetTables () const
 Returns the tables collection (equivalent to Calc's database ranges). More...
 
ScenarioBuffergetScenarios () const
 Returns the scenarios collection. More...
 
ConnectionsBuffergetConnections () const
 Returns the collection of external data connections. More...
 
PivotCacheBuffergetPivotCaches () const
 Returns the collection of pivot caches. More...
 
PivotTableBuffergetPivotTables () const
 Returns the collection of pivot tables. More...
 
FormulaParsergetFormulaParser () const
 Returns a shared import formula parser (import filter only!). More...
 
FormulaParsercreateFormulaParser () const
 Returns an unshared import formula parser (import filter only!). More...
 
UnitConvertergetUnitConverter () const
 Returns the measurement unit converter. More...
 
AddressConvertergetAddressConverter () const
 Returns the converter for string to cell address/range conversion. More...
 
oox::drawingml::chart::ChartConvertergetChartConverter () const
 Returns the chart object converter. More...
 
PageSettingsConvertergetPageSettingsConverter () const
 Returns the page and print settings converter. More...
 
::oox::core::XmlFilterBasegetOoxFilter () const
 Returns the base OOXML/BIFF12 filter object. More...
 
bool importOoxFragment (const rtl::Reference< oox::core::FragmentHandler > &rxHandler)
 Imports a fragment using the passed fragment handler, which contains the full path to the fragment stream. More...
 
bool importOoxFragment (const rtl::Reference< oox::core::FragmentHandler > &rxHandler, oox::core::FastParser &rParser)
 
rtl_TextEncoding getTextEncoding () const
 Returns the text encoding used to import/export byte strings. More...
 

Static Public Member Functions

static bool parseOoxAddress2d (sal_Int32 &ornColumn, sal_Int32 &ornRow, std::u16string_view aString, sal_Int32 nStart=0, sal_Int32 nLength=SAL_MAX_INT32)
 Tries to parse the passed string for a 2d cell address in A1 notation. More...
 
static bool parseOoxAddress2d (sal_Int32 &ornColumn, sal_Int32 &ornRow, std::string_view pStr)
 
static bool parseOoxRange2d (sal_Int32 &ornStartColumn, sal_Int32 &ornStartRow, sal_Int32 &ornEndColumn, sal_Int32 &ornEndRow, std::u16string_view aString, sal_Int32 nStart=0)
 Tries to parse the passed string for a 2d cell range in A1 notation. More...
 
static bool convertToCellAddressUnchecked (ScAddress &orAddress, const OUString &rString, sal_Int16 nSheet)
 Converts the passed string to a single cell address, without checking any sheet limits. More...
 
static bool convertToCellAddressUnchecked (ScAddress &orAddress, std::string_view pStr, sal_Int16 nSheet)
 
static void convertToCellAddressUnchecked (ScAddress &orAddress, const BinAddress &rBinAddress, sal_Int16 nSheet)
 Converts the passed address to a single cell address, without checking any sheet limits. More...
 
static bool convertToCellRangeUnchecked (ScRange &orRange, std::u16string_view aString, sal_Int16 nSheet)
 Converts the passed string to a cell range address, without checking any sheet limits. More...
 
static void convertToCellRangeUnchecked (ScRange &orRange, const BinRange &rBinRange, sal_Int16 nSheet)
 Converts the passed range to a cell range address, without checking any sheet limits. More...
 
static css::uno::Sequence< css::table::CellRangeAddress > toApiSequence (const ScRangeList &orRanges)
 Converts the passed range list to a sequence of cell range addresses. More...
 
- Static Public Member Functions inherited from oox::xls::WorkbookHelper
static WorkbookGlobalsRef constructGlobals (ExcelFilter &rFilter)
 

Private Member Functions

void initializeMaxPos (sal_Int16 nMaxXlsTab, sal_Int32 nMaxXlsCol, sal_Int32 nMaxXlsRow)
 

Private Attributes

ScAddress maMaxApiPos
 
ScAddress maMaxXlsPos
 Maximum valid cell address in Calc. More...
 
ScAddress maMaxPos
 Maximum valid cell address in Excel. More...
 
bool mbColOverflow
 Maximum valid cell address in Calc/Excel. More...
 
bool mbRowOverflow
 Flag for "columns overflow". More...
 
bool mbTabOverflow
 Flag for "rows overflow". More...
 

Additional Inherited Members

- Public Types inherited from oox::xls::WorkbookHelper
typedef std::pair< ScRangeData *, bool > RangeDataRet
 

Detailed Description

Converter for cell addresses and cell ranges for OOXML and BIFF filters.

Definition at line 95 of file addressconverter.hxx.

Constructor & Destructor Documentation

◆ AddressConverter()

oox::xls::AddressConverter::AddressConverter ( const WorkbookHelper rHelper)
explicit

Definition at line 72 of file addressconverter.cxx.

References initializeMaxPos().

Member Function Documentation

◆ checkCellAddress()

bool oox::xls::AddressConverter::checkCellAddress ( const ScAddress rAddress,
bool  bTrackOverflow 
)

Checks the passed cell address if it fits into the spreadsheet limits.

Parameters
rAddressThe cell address to be checked.
bTrackOverflowtrue = Update the internal overflow flags, if the address is outside of the supported sheet limits.
Returns
true = Passed address is valid (no index overflow).

Definition at line 250 of file addressconverter.cxx.

References checkCol(), checkRow(), checkTab(), ScAddress::Col(), ScAddress::Row(), and ScAddress::Tab().

Referenced by convertToCellAddress(), oox::xls::Scenario::finalizeImport(), and oox::xls::SheetDataContext::importCell().

◆ checkCellRange()

bool oox::xls::AddressConverter::checkCellRange ( const ScRange rRange,
bool  bAllowOverflow,
bool  bTrackOverflow 
)

Checks the passed cell range if it fits into the spreadsheet limits.

Parameters
rRangeThe cell range address to be checked.
bAllowOverflowtrue = Allow ranges that start inside the supported sheet limits but may end outside of these limits. false = Do not allow ranges that overflow the supported limits.
bTrackOverflowtrue = Update the internal overflow flags, if the passed range contains cells outside of the supported sheet limits.
Returns
true = Cell range is valid. This function returns also true, if only parts of the range are outside the current sheet limits and such an overflow is allowed via parameter bAllowOverflow. Returns false, if the entire range is outside the sheet limits, or if overflow is not allowed via parameter bAllowOverflow.

Definition at line 343 of file addressconverter.cxx.

References ScRange::aEnd, ScRange::aStart, checkCol(), checkRow(), checkTab(), ScAddress::Col(), ScAddress::Row(), and ScAddress::Tab().

Referenced by oox::xls::PivotCache::finalizeInternalSheetSource(), and validateCellRange().

◆ checkCol()

bool oox::xls::AddressConverter::checkCol ( sal_Int32  nCol,
bool  bTrackOverflow 
)

Checks if the passed column index is valid.

Parameters
nColThe column index to check.
bTrackOverflowtrue = Update the internal overflow flag, if the column index is outside of the supported limits.
Returns
true = Passed column index is valid (no index overflow).

Definition at line 226 of file addressconverter.cxx.

References ScAddress::Col(), maMaxPos, and mbColOverflow.

Referenced by oox::xls::ShapeAnchor::calcAnchorRectEmu(), checkCellAddress(), checkCellRange(), and oox::xls::SheetDataContext::importRow().

◆ checkRow()

bool oox::xls::AddressConverter::checkRow ( sal_Int32  nRow,
bool  bTrackOverflow 
)

Checks if the passed row index is valid.

Parameters
nRowThe row index to check.
bTrackOverflowtrue = Update the internal overflow flag, if the row index is outside of the supported limits.
Returns
true = Passed row index is valid (no index overflow).

Definition at line 234 of file addressconverter.cxx.

References maMaxPos, mbRowOverflow, and ScAddress::Row().

Referenced by oox::xls::ShapeAnchor::calcAnchorRectEmu(), checkCellAddress(), checkCellRange(), and oox::xls::SheetDataContext::importRow().

◆ checkTab()

bool oox::xls::AddressConverter::checkTab ( sal_Int16  nSheet,
bool  bTrackOverflow 
)

Checks if the passed sheet index is valid.

Parameters
nSheetThe sheet index to check.
bTrackOverflowtrue = Update the internal overflow flag, if the sheet index is outside of the supported limits.
Returns
true = Passed sheet index is valid (no index overflow).

Definition at line 242 of file addressconverter.cxx.

References maMaxPos, mbTabOverflow, and ScAddress::Tab().

Referenced by checkCellAddress(), and checkCellRange().

◆ convertToCellAddress() [1/3]

bool oox::xls::AddressConverter::convertToCellAddress ( ScAddress orAddress,
const BinAddress rBinAddress,
sal_Int16  nSheet,
bool  bTrackOverflow 
)

Tries to convert the passed address to a single cell address.

Parameters
orAddress(out-parameter) Returns the converted cell address.
rBinAddressBinary cell address struct.
nSheetSheet index to be inserted into orAddress (will be checked).
bTrackOverflowtrue = Update the internal overflow flags, if the address is outside of the supported sheet limits.
Returns
true = Converted address is valid (no index overflow).

Definition at line 323 of file addressconverter.cxx.

References checkCellAddress(), and convertToCellAddressUnchecked().

◆ convertToCellAddress() [2/3]

bool oox::xls::AddressConverter::convertToCellAddress ( ScAddress orAddress,
const OUString &  rString,
sal_Int16  nSheet,
bool  bTrackOverflow 
)

Tries to convert the passed string to a single cell address.

Parameters
orAddress(out-parameter) Returns the converted cell address.
rStringCell address string in A1 notation.
nSheetSheet index to be inserted into orAddress (will be checked).
bTrackOverflowtrue = Update the internal overflow flags, if the address is outside of the supported sheet limits.
Returns
true = Converted address is valid (no index overflow).

Definition at line 284 of file addressconverter.cxx.

References checkCellAddress(), and convertToCellAddressUnchecked().

Referenced by createValidCellAddress(), oox::xls::SheetDataContext::importCell(), and oox::xls::SheetDataContext::readCellHeader().

◆ convertToCellAddress() [3/3]

bool oox::xls::AddressConverter::convertToCellAddress ( ScAddress rAddress,
std::string_view  pStr,
sal_Int16  nSheet,
bool  bTrackOverflow 
)

Definition at line 292 of file addressconverter.cxx.

References checkCellAddress(), and convertToCellAddressUnchecked().

◆ convertToCellAddressUnchecked() [1/3]

void oox::xls::AddressConverter::convertToCellAddressUnchecked ( ScAddress orAddress,
const BinAddress rBinAddress,
sal_Int16  nSheet 
)
static

Converts the passed address to a single cell address, without checking any sheet limits.

Parameters
orAddress(out-parameter) Returns the converted cell address.
rBinAddressBinary cell address struct.
nSheetSheet index to be inserted into orAddress.

Definition at line 315 of file addressconverter.cxx.

References oox::xls::BinAddress::mnCol, oox::xls::BinAddress::mnRow, ScAddress::SetCol(), ScAddress::SetRow(), and ScAddress::SetTab().

◆ convertToCellAddressUnchecked() [2/3]

bool oox::xls::AddressConverter::convertToCellAddressUnchecked ( ScAddress orAddress,
const OUString &  rString,
sal_Int16  nSheet 
)
static

Converts the passed string to a single cell address, without checking any sheet limits.

Parameters
orAddress(out-parameter) Returns the converted cell address.
rStringCell address string in A1 notation.
nSheetSheet index to be inserted into orAddress.
Returns
true = Cell address could be parsed from the passed string.

Definition at line 258 of file addressconverter.cxx.

References parseOoxAddress2d(), ScAddress::SetCol(), ScAddress::SetRow(), and ScAddress::SetTab().

Referenced by convertToCellAddress(), and oox::xls::Scenario::importInputCells().

◆ convertToCellAddressUnchecked() [3/3]

bool oox::xls::AddressConverter::convertToCellAddressUnchecked ( ScAddress orAddress,
std::string_view  pStr,
sal_Int16  nSheet 
)
static

◆ convertToCellRange() [1/2]

bool oox::xls::AddressConverter::convertToCellRange ( ScRange orRange,
const BinRange rBinRange,
sal_Int16  nSheet,
bool  bAllowOverflow,
bool  bTrackOverflow 
)

Tries to convert the passed range to a cell range address.

Parameters
orRange(out-parameter) Returns the converted cell range address. If the passed original range contains cells outside the currently supported spreadsheet limits, and parameter bAllowOverflow is set to true, the range will be cropped to these limits.
rBinRangeBinary cell range struct.
nSheetSheet index to be inserted into orRange (will be checked).
bAllowOverflowtrue = Allow ranges that start inside the supported sheet limits but may end outside of these limits. The cell range returned in orRange will be cropped to these limits. false = Do not allow ranges that overflow the supported limits.
bTrackOverflowtrue = Update the internal overflow flags, if the original range contains cells outside of the supported sheet limits.
Returns
true = Converted and returned range is valid. This function returns also true, if overflowing ranges are allowed via parameter bAllowOverflow and the range has been cropped, but still contains cells inside the current sheet limits. Returns false, if the entire range is outside the sheet limits or if overflowing ranges are not allowed via parameter bAllowOverflow.

Definition at line 412 of file addressconverter.cxx.

References convertToCellRangeUnchecked(), and validateCellRange().

◆ convertToCellRange() [2/2]

bool oox::xls::AddressConverter::convertToCellRange ( ScRange orRange,
std::u16string_view  aString,
sal_Int16  nSheet,
bool  bAllowOverflow,
bool  bTrackOverflow 
)

Tries to convert the passed string to a cell range address.

Parameters
orRange(out-parameter) Returns the converted cell range address. If the original range in the passed string contains cells outside the currently supported spreadsheet limits, and parameter bAllowOverflow is set to true, the range will be cropped to these limits. Example: the range string "A1:ZZ100000" may be converted to the range A1:IV65536.
aStringCell range string in A1 notation.
nSheetSheet index to be inserted into orRange (will be checked).
bAllowOverflowtrue = Allow ranges that start inside the supported sheet limits but may end outside of these limits. The cell range returned in orRange will be cropped to these limits. false = Do not allow ranges that overflow the supported limits.
bTrackOverflowtrue = Update the internal overflow flags, if the original range contains cells outside of the supported sheet limits.
Returns
true = Converted and returned range is valid. This function returns also true, if overflowing ranges are allowed via parameter bAllowOverflow and the range has been cropped, but still contains cells inside the current sheet limits. Returns false, if the entire range is outside the sheet limits or overflowing ranges are not allowed via parameter bAllowOverflow.

Definition at line 393 of file addressconverter.cxx.

References convertToCellRangeUnchecked(), and validateCellRange().

Referenced by convertToCellRangeList(), oox::xls::SheetDataContext::importFormula(), oox::xls::ViewSettings::importOleSize(), and oox::xls::SheetDataContext::readFormulaRef().

◆ convertToCellRangeList() [1/2]

void oox::xls::AddressConverter::convertToCellRangeList ( ScRangeList orRanges,
const BinRangeList rBinRanges,
sal_Int16  nSheet,
bool  bTrackOverflow 
)

Tries to convert the passed range list to a cell range list.

Parameters
orRanges(out-parameter) Returns the converted cell range addresses. If a range in the passed string contains cells outside the currently supported spreadsheet limits, it will be cropped to these limits. Example: the range string "A1:ZZ100000" may be converted to the range A1:IV65536. If a range is completely outside the limits, it will be omitted.
rBinRangesList of binary cell range objects.
nSheetSheet index to be inserted into orRanges (will be checked).
bTrackOverflowtrue = Update the internal overflow flags, if the original ranges contain cells outside of the supported sheet limits.

Definition at line 440 of file addressconverter.cxx.

References convertToCellRange(), and ScRangeList::push_back().

◆ convertToCellRangeList() [2/2]

void oox::xls::AddressConverter::convertToCellRangeList ( ScRangeList orRanges,
std::u16string_view  aString,
sal_Int16  nSheet,
bool  bTrackOverflow 
)

Tries to convert the passed string to a cell range list.

Parameters
orRanges(out-parameter) Returns the converted cell range addresses. If a range in the passed string contains cells outside the currently supported spreadsheet limits, it will be cropped to these limits. Example: the range string "A1:ZZ100000" may be converted to the range A1:IV65536. If a range is completely outside the limits, it will be omitted.
rStringCell range list string in A1 notation, space separated.
nSheetSheet index to be inserted into orRanges (will be checked).
bTrackOverflowtrue = Update the internal overflow flags, if the original ranges contain cells outside of the supported sheet limits.

Definition at line 426 of file addressconverter.cxx.

References convertToCellRange(), o3tl::getToken(), nPos, ScRangeList::push_back(), and u.

Referenced by oox::xls::CondFormat::importCondFormatting(), oox::xls::CondFormat::importConditionalFormatting(), oox::xls::WorksheetSettings::importProtectedRange(), and oox::xls::SheetViewSettings::importSelection().

◆ convertToCellRangeUnchecked() [1/2]

void oox::xls::AddressConverter::convertToCellRangeUnchecked ( ScRange orRange,
const BinRange rBinRange,
sal_Int16  nSheet 
)
static

Converts the passed range to a cell range address, without checking any sheet limits.

Parameters
orRange(out-parameter) Returns the converted range address.
rBinRangeBinary cell range struct.
nSheetSheet index to be inserted into orRange.

Definition at line 401 of file addressconverter.cxx.

References ScRange::aEnd, ScRange::aStart, oox::xls::BinRange::maFirst, oox::xls::BinRange::maLast, oox::xls::BinAddress::mnCol, oox::xls::BinAddress::mnRow, ScAddress::SetCol(), ScAddress::SetRow(), and ScAddress::SetTab().

◆ convertToCellRangeUnchecked() [2/2]

bool oox::xls::AddressConverter::convertToCellRangeUnchecked ( ScRange orRange,
std::u16string_view  aString,
sal_Int16  nSheet 
)
static

Converts the passed string to a cell range address, without checking any sheet limits.

Parameters
orRange(out-parameter) Returns the converted range address.
rStringCell range string in A1 notation.
nSheetSheet index to be inserted into orRange.
Returns
true = Range address could be parsed from the passed string.

Definition at line 376 of file addressconverter.cxx.

References ScRange::aEnd, ScRange::aStart, ScAddress::Col(), parseOoxRange2d(), ScAddress::Row(), ScAddress::SetCol(), ScAddress::SetRow(), and ScAddress::SetTab().

Referenced by convertToCellRange(), oox::xls::AutoFilter::importAutoFilter(), oox::xls::Comment::importComment(), oox::xls::WorksheetFragment::importDimension(), oox::xls::PivotTable::importLocation(), oox::xls::PivotCache::importPCDSheetSource(), oox::xls::PivotTable::importPTLocation(), oox::xls::SortCondition::importSortCondition(), oox::xls::AutoFilter::importSortState(), oox::xls::Table::importTable(), and oox::xls::PivotCache::importWorksheetSource().

◆ createValidCellAddress() [1/2]

ScAddress oox::xls::AddressConverter::createValidCellAddress ( const BinAddress rBinAddress,
sal_Int16  nSheet,
bool  bTrackOverflow 
)

Returns a valid cell address by moving it into allowed dimensions.

Parameters
rBinAddressBinary cell address struct.
nSheetSheet index for the returned address (will be checked).
bTrackOverflowtrue = Update the internal overflow flags, if the address is outside of the supported sheet limits.
Returns
A valid cell address struct.

Definition at line 330 of file addressconverter.cxx.

References ScAddress::Col(), convertToCellAddress(), maMaxPos, oox::xls::BinAddress::mnCol, oox::xls::BinAddress::mnRow, ScAddress::Row(), ScAddress::SetCol(), ScAddress::SetRow(), ScAddress::SetTab(), and ScAddress::Tab().

◆ createValidCellAddress() [2/2]

ScAddress oox::xls::AddressConverter::createValidCellAddress ( const OUString &  rString,
sal_Int16  nSheet,
bool  bTrackOverflow 
)

Returns a valid cell address by moving it into allowed dimensions.

Parameters
rStringCell address string in A1 notation.
nSheetSheet index for the returned address (will be checked).
bTrackOverflowtrue = Update the internal overflow flags, if the address is outside of the supported sheet limits.
Returns
A valid cell address struct.

Definition at line 302 of file addressconverter.cxx.

References ScAddress::Col(), convertToCellAddress(), maMaxPos, ScAddress::Row(), ScAddress::SetCol(), ScAddress::SetRow(), ScAddress::SetTab(), and ScAddress::Tab().

Referenced by oox::xls::ShapeAnchor::calcAnchorRectEmu(), oox::xls::SheetViewSettings::importPane(), oox::xls::SheetViewSettings::importSelection(), and oox::xls::SheetViewSettings::importSheetView().

◆ getMaxAddress()

const ScAddress & oox::xls::AddressConverter::getMaxAddress ( ) const
inline

Returns the biggest valid cell address in both Calc and the imported/exported Excel document.

Definition at line 163 of file addressconverter.hxx.

References maMaxPos.

Referenced by oox::xls::DefinedName::convertFormula().

◆ getMaxApiAddress()

const ScAddress & oox::xls::AddressConverter::getMaxApiAddress ( ) const
inline

◆ getMaxXlsAddress()

const ScAddress & oox::xls::AddressConverter::getMaxXlsAddress ( ) const
inline

Returns the biggest valid cell address in the imported/exported Excel document.

Definition at line 158 of file addressconverter.hxx.

References maMaxXlsPos.

◆ initializeMaxPos()

void oox::xls::AddressConverter::initializeMaxPos ( sal_Int16  nMaxXlsTab,
sal_Int32  nMaxXlsCol,
sal_Int32  nMaxXlsRow 
)
private

◆ isColOverflow()

bool oox::xls::AddressConverter::isColOverflow ( ) const
inline

Definition at line 484 of file addressconverter.hxx.

References mbColOverflow.

Referenced by oox::xls::ExcelFilter::importDocument().

◆ isRowOverflow()

bool oox::xls::AddressConverter::isRowOverflow ( ) const
inline

Definition at line 485 of file addressconverter.hxx.

References mbRowOverflow.

Referenced by oox::xls::ExcelFilter::importDocument().

◆ isTabOverflow()

bool oox::xls::AddressConverter::isTabOverflow ( ) const
inline

Definition at line 486 of file addressconverter.hxx.

References mbTabOverflow.

Referenced by oox::xls::ExcelFilter::importDocument().

◆ parseOoxAddress2d() [1/2]

bool oox::xls::AddressConverter::parseOoxAddress2d ( sal_Int32 &  ornColumn,
sal_Int32 &  ornRow,
std::string_view  pStr 
)
static

Definition at line 142 of file addressconverter.cxx.

References aStr.

◆ parseOoxAddress2d() [2/2]

bool oox::xls::AddressConverter::parseOoxAddress2d ( sal_Int32 &  ornColumn,
sal_Int32 &  ornRow,
std::u16string_view  aString,
sal_Int32  nStart = 0,
sal_Int32  nLength = SAL_MAX_INT32 
)
static

Tries to parse the passed string for a 2d cell address in A1 notation.

This function accepts all strings that match the regular expression "[a-zA-Z]{1,6}0*[1-9][0-9]{0,8}" (without quotes), i.e. 1 to 6 letters for the column index (translated to 0-based column indexes from 0 to 321,272,405), and 1 to 9 digits for the 1-based row index (translated to 0-based row indexes from 0 to 999,999,998). The row number part may contain leading zeros, they will be ignored. It is up to the caller to handle cell addresses outside of a specific valid range (e.g. the entire spreadsheet).

Parameters
ornColumn(out-parameter) Returns the converted column index.
ornRow(out-parameter) returns the converted row index.
rStringThe string containing the cell address.
nStartStart index of string part in rString to be parsed.
nLengthLength of string part in rString to be parsed.
Returns
true = Parsed string was valid, returned values can be used.

Definition at line 81 of file addressconverter.cxx.

References nLength.

Referenced by convertToCellAddressUnchecked(), and parseOoxRange2d().

◆ parseOoxRange2d()

bool oox::xls::AddressConverter::parseOoxRange2d ( sal_Int32 &  ornStartColumn,
sal_Int32 &  ornStartRow,
sal_Int32 &  ornEndColumn,
sal_Int32 &  ornEndRow,
std::u16string_view  aString,
sal_Int32  nStart = 0 
)
static

Tries to parse the passed string for a 2d cell range in A1 notation.

This function accepts all strings that match the regular expression "ADDR(:ADDR)?" (without quotes), where ADDR is a cell address accepted by the parseOoxAddress2d() function of this class. It is up to the caller to handle cell ranges outside of a specific valid range (e.g. the entire spreadsheet).

Parameters
ornStartColumn(out-parameter) Returns the converted start column index.
ornStartRow(out-parameter) returns the converted start row index.
ornEndColumn(out-parameter) Returns the converted end column index.
ornEndRow(out-parameter) returns the converted end row index.
rStringThe string containing the cell address.
nStartStart index of string part in rString to be parsed.
Returns
true = Parsed string was valid, returned values can be used.

Definition at line 198 of file addressconverter.cxx.

References parseOoxAddress2d(), and SAL_MAX_INT32.

Referenced by convertToCellRangeUnchecked().

◆ toApiSequence()

Sequence< CellRangeAddress > oox::xls::AddressConverter::toApiSequence ( const ScRangeList orRanges)
static

Converts the passed range list to a sequence of cell range addresses.

Parameters
orRangesList of range objects.
Returns
A uno sequence of cell range addresses as used in API calls. Does not check ranges for supported sheet limits.

Definition at line 449 of file addressconverter.cxx.

References ScUnoConversion::FillApiRange(), i, and ScRangeList::size().

Referenced by oox::xls::DefinedName::convertFormula(), oox::xls::Scenario::finalizeImport(), and oox::xls::WorksheetGlobals::getCellRangeList().

◆ validateCellRange()

bool oox::xls::AddressConverter::validateCellRange ( ScRange orRange,
bool  bAllowOverflow,
bool  bTrackOverflow 
)

Checks the passed cell range, may try to fit it to current sheet limits.

First, this function reorders the column and row indexes so that the starting indexes are less than or equal to the end indexes. Then, depending on the parameter bAllowOverflow, the range is just checked or cropped to the current sheet limits.

Parameters
orRange(in-out-parameter) Converts the passed cell range into a valid cell range address. If the passed range contains cells outside the currently supported spreadsheet limits, it will be cropped to these limits.
bAllowOverflowtrue = Allow ranges that start inside the supported sheet limits but may end outside of these limits. The cell range returned in orRange will be cropped to these limits. false = Do not allow ranges that overflow the supported limits. The function will return false when the range overflows the sheet limits.
bTrackOverflowtrue = Update the internal overflow flags, if the original range contains cells outside of the supported sheet limits.
Returns
true = Converted range address is valid. This function returns also true, if overflowing ranges are allowed via parameter bAllowOverflow and the range has been cropped, but still contains cells inside the current sheet limits. Returns false, if the entire range is outside the sheet limits or overflowing ranges are not allowed via parameter bAllowOverflow.

Definition at line 353 of file addressconverter.cxx.

References ScRange::aEnd, ScRange::aStart, checkCellRange(), ScAddress::Col(), maMaxPos, ScAddress::Row(), ScAddress::SetCol(), and ScAddress::SetRow().

Referenced by convertToCellRange(), oox::xls::WorkbookGlobals::createDatabaseRangeObject(), oox::xls::WorkbookGlobals::createUnnamedDatabaseRangeObject(), and validateCellRangeList().

◆ validateCellRangeList()

void oox::xls::AddressConverter::validateCellRangeList ( ScRangeList orRanges,
bool  bTrackOverflow 
)

Tries to restrict the passed cell range list to current sheet limits.

Parameters
orRanges(in-out-parameter) Restricts the cell range addresses in the passed list to the current sheet limits and removes invalid ranges from the list.
bTrackOverflowtrue = Update the internal overflow flags, if the original ranges contain cells outside of the supported sheet limits.

Definition at line 419 of file addressconverter.cxx.

References nIndex, ScRangeList::Remove(), ScRangeList::size(), and validateCellRange().

Referenced by oox::xls::FormulaProcessorBase::extractCellRangeList().

Member Data Documentation

◆ maMaxApiPos

ScAddress oox::xls::AddressConverter::maMaxApiPos
private

Definition at line 493 of file addressconverter.hxx.

Referenced by getMaxApiAddress(), and initializeMaxPos().

◆ maMaxPos

ScAddress oox::xls::AddressConverter::maMaxPos
private

Maximum valid cell address in Excel.

Definition at line 495 of file addressconverter.hxx.

Referenced by checkCol(), checkRow(), checkTab(), createValidCellAddress(), getMaxAddress(), initializeMaxPos(), and validateCellRange().

◆ maMaxXlsPos

ScAddress oox::xls::AddressConverter::maMaxXlsPos
private

Maximum valid cell address in Calc.

Definition at line 494 of file addressconverter.hxx.

Referenced by getMaxXlsAddress(), and initializeMaxPos().

◆ mbColOverflow

bool oox::xls::AddressConverter::mbColOverflow
private

Maximum valid cell address in Calc/Excel.

Definition at line 496 of file addressconverter.hxx.

Referenced by checkCol(), and isColOverflow().

◆ mbRowOverflow

bool oox::xls::AddressConverter::mbRowOverflow
private

Flag for "columns overflow".

Definition at line 497 of file addressconverter.hxx.

Referenced by checkRow(), and isRowOverflow().

◆ mbTabOverflow

bool oox::xls::AddressConverter::mbTabOverflow
private

Flag for "rows overflow".

Definition at line 498 of file addressconverter.hxx.

Referenced by checkTab(), and isTabOverflow().


The documentation for this class was generated from the following files: