LibreOffice Module sc (master) 1
|
This class contains static helper methods for the Excel import and export filters. More...
#include <xltools.hxx>
Public Member Functions | |
XclTools (const XclTools &)=delete | |
const XclTools & | operator= (const XclTools &)=delete |
XclTools ()=delete | |
We don't want anybody to instantiate this class, since it is just a collection of static items. More... | |
Static Public Member Functions | |
static double | GetDoubleFromRK (sal_Int32 nRKValue) |
GUID of file moniker (HLINK record). More... | |
static bool | GetRKFromDouble (sal_Int32 &rnRKValue, double fValue) |
Calculates an RK value (encoded integer or double) from a double value. More... | |
static Degree100 | GetScRotation (sal_uInt16 nXclRot, Degree100 nRotForStacked) |
Calculates an angle (in 1/100 of degrees) from an Excel angle value. More... | |
static sal_uInt8 | GetXclRotation (Degree100 nScRot) |
Calculates the Excel angle value from an angle in 1/100 of degrees. More... | |
static sal_uInt8 | GetXclRotFromOrient (sal_uInt8 nXclOrient) |
Calculates BIFF8 rotation angle from BIFF2-BIFF5 text orientation. More... | |
static sal_uInt8 | GetXclOrientFromRot (sal_uInt16 nXclRot) |
Calculates BIFF2-BIFF5 text orientation from BIFF8 rotation angle. More... | |
static sal_uInt8 | GetXclErrorCode (FormulaError nScError) |
Converts a Calc error code to an Excel error code. More... | |
static FormulaError | GetScErrorCode (sal_uInt8 nXclError) |
Converts an Excel error code to a Calc error code. More... | |
static double | ErrorToDouble (sal_uInt8 nXclError) |
Converts the passed BIFF error to a double containing the respective Calc error code. More... | |
static XclBoolError | ErrorToEnum (double &rfDblValue, bool bErrOrBool, sal_uInt8 nValue) |
Gets a translated error code or Boolean value from Excel error codes. More... | |
static sal_uInt16 | GetTwipsFromInch (double fInches) |
Returns the length in twips calculated from a length in inches. More... | |
static sal_uInt16 | GetTwipsFromHmm (sal_Int32 nHmm) |
Returns the length in twips calculated from a length in 1/100 mm. More... | |
static double | GetInchFromTwips (sal_Int32 nTwips) |
Returns the length in inches calculated from a length in twips. More... | |
static double | GetInchFromHmm (sal_Int32 nHmm) |
Returns the length in inches calculated from a length in 1/100 mm. More... | |
static sal_Int32 | GetHmmFromInch (double fInches) |
Returns the length in 1/100 mm calculated from a length in inches. More... | |
static sal_Int32 | GetHmmFromTwips (sal_Int32 nTwips) |
Returns the length in 1/100 mm calculated from a length in twips. More... | |
static sal_uInt16 | GetScColumnWidth (sal_uInt16 nXclWidth, tools::Long nScCharWidth) |
Returns the Calc column width (twips) for the passed Excel width. More... | |
static sal_uInt16 | GetXclColumnWidth (sal_uInt16 nScWidth, tools::Long nScCharWidth) |
Returns the Excel column width for the passed Calc width (twips). More... | |
static double | GetXclDefColWidthCorrection (tools::Long nXclDefFontHeight) |
Returns a correction value to convert column widths from/to default column widths. More... | |
static Color | GetPatternColor (const Color &rPattColor, const Color &rBackColor, sal_uInt16 nXclPattern) |
Returns the best fitting color for an Excel pattern area format. More... | |
static rtl_TextEncoding | GetTextEncoding (sal_uInt16 nCodePage) |
Returns a text encoding from an Excel code page. More... | |
static sal_uInt16 | GetXclCodePage (rtl_TextEncoding eTextEnc) |
Returns an Excel code page from a text encoding. More... | |
static OUString | GetXclFontName (const OUString &rFontName) |
Returns the matching Excel font name for a passed Calc font name. More... | |
static OUString | GetXclBuiltInDefName (sal_Unicode cBuiltIn) |
Returns the raw English UI representation of a built-in defined name used in NAME records. More... | |
static OUString | GetBuiltInDefName (sal_Unicode cBuiltIn) |
Returns the Calc UI representation of a built-in defined name used in NAME records. More... | |
static OUString | GetBuiltInDefNameXml (sal_Unicode cBuiltIn) |
Returns the Excel built-in name with OOXML prefix @descr Adds the "_xlnm." prefix to the representation returned by GetXclBuiltInDefName() More... | |
static sal_Unicode | GetBuiltInDefNameIndex (const OUString &rDefName) |
Returns the Excel built-in name index of the passed defined name from Calc. More... | |
static OUString | GetBuiltInStyleName (sal_uInt8 nStyleId, std::u16string_view rName, sal_uInt8 nLevel) |
Returns the specified built-in cell style name. More... | |
static bool | IsBuiltInStyleName (const OUString &rStyleName, sal_uInt8 *pnStyleId=nullptr, sal_Int32 *pnNextChar=nullptr) |
Returns true, if the passed string is a name of an Excel built-in style. More... | |
static bool | GetBuiltInStyleId (sal_uInt8 &rnStyleId, sal_uInt8 &rnLevel, const OUString &rStyleName) |
Returns the Excel built-in style identifier of a passed style name. More... | |
static OUString | GetCondFormatStyleName (SCTAB nScTab, sal_Int32 nFormat, sal_uInt16 nCondition) |
Returns the style name for a single condition of a conditional formatting. More... | |
static bool | IsCondFormatStyleName (const OUString &rStyleName) |
Returns true, if the passed string is a name of a conditional format style created by Excel import. More... | |
static void | SkipSubStream (XclImpStream &rStrm) |
Skips a substream (BOF/EOF record block). More... | |
static OUString | GetSbMacroUrl (const OUString &rMacroName, SfxObjectShell *pDocShell) |
Returns the full StarBasic macro URL from an Excel macro name. More... | |
static OUString | GetXclMacroName (const OUString &rSbMacroUrl) |
Returns the Excel macro name from a full StarBasic macro URL. More... | |
Static Public Attributes | |
static const XclGuid | maGuidStdLink |
static const XclGuid | maGuidUrlMoniker |
GUID of StdLink (HLINK record). More... | |
static const XclGuid | maGuidFileMoniker |
GUID of URL moniker (HLINK record). More... | |
This class contains static helper methods for the Excel import and export filters.
Definition at line 81 of file xltools.hxx.
|
delete |
|
delete |
We don't want anybody to instantiate this class, since it is just a collection of static items.
|
static |
Converts the passed BIFF error to a double containing the respective Calc error code.
Definition at line 242 of file xltools.cxx.
References CreateDoubleError(), and GetScErrorCode().
|
static |
Gets a translated error code or Boolean value from Excel error codes.
rfDblValue | Returns 0.0 for error codes or the value of a Boolean (0.0 or 1.0). |
bErrorOrBool | false = nError is a Boolean value; true = is an error value. |
nValue | The error code or Boolean value. |
Definition at line 247 of file xltools.cxx.
References eType, EXC_ERR_DIV0, EXC_ERR_NA, EXC_ERR_NAME, EXC_ERR_NULL, EXC_ERR_NUM, EXC_ERR_REF, EXC_ERR_VALUE, nValue, xlErrDiv0, xlErrFalse, xlErrNA, xlErrName, xlErrNull, xlErrNum, xlErrRef, xlErrTrue, xlErrUnknown, and xlErrValue.
Referenced by ImportExcel::ErrorToFormula(), XclImpPCItem::WriteToSource(), and XclImpCachedValue::XclImpCachedValue().
|
static |
Returns the Calc UI representation of a built-in defined name used in NAME records.
@descr Adds a prefix to the representation returned by GetXclBuiltInDefName().
cBuiltIn | Excel index of the built-in name. |
Definition at line 495 of file xltools.cxx.
References GetXclBuiltInDefName(), and maDefNamePrefix.
Referenced by XclImpName::XclImpName().
|
static |
Returns the Excel built-in name index of the passed defined name from Calc.
@descr Ignores any characters following a valid representation of a built-in name.
rDefName | raw English UI representation of a built-in defined name used in NAME records. |
Definition at line 505 of file xltools.cxx.
References EXC_BUILTIN_UNKNOWN, GetXclBuiltInDefName(), maDefNamePrefix, and maDefNamePrefixXml.
Referenced by XclExpNameManagerImpl::FindBuiltInNameIdx().
|
static |
Returns the Excel built-in name with OOXML prefix @descr Adds the "_xlnm." prefix to the representation returned by GetXclBuiltInDefName()
cBuiltIn | Excel index of the built in name. |
Definition at line 500 of file xltools.cxx.
References GetXclBuiltInDefName(), and maDefNamePrefixXml.
|
static |
Returns the Excel built-in style identifier of a passed style name.
rnStyleId | The style identifier is returned here. |
rnLevel | The zero-based outline level for RowLevel and ColLevel styles is returned here. |
rStyleName | The style name to examine. |
Definition at line 625 of file xltools.cxx.
References EXC_STYLE_COLLEVEL, EXC_STYLE_LEVELCOUNT, EXC_STYLE_NOLEVEL, EXC_STYLE_ROWLEVEL, EXC_STYLE_USERDEF, IsBuiltInStyleName(), and o3tl::toInt32().
Referenced by XclExpXFBuffer::InsertStyleXF(), and XclExpStyle::XclExpStyle().
|
static |
Returns the specified built-in cell style name.
nStyleId | The identifier of the built-in style. |
rName | Default name for unknown styles. |
nLevel | The zero-based outline level for RowLevel and ColLevel styles. |
Definition at line 550 of file xltools.cxx.
References aBuf, EXC_STYLE_COLLEVEL, EXC_STYLE_NORMAL, EXC_STYLE_ROWLEVEL, maStyleNamePrefix1, ppcStyleNames, SAL_N_ELEMENTS, and ScResId().
Referenced by XclImpXFBuffer::CreateUserStyles().
|
static |
Returns the style name for a single condition of a conditional formatting.
nScTab | The current Calc sheet index. |
nFormat | The zero-based index of the conditional formatting. |
nCondition | The zero-based index of the condition. |
Definition at line 662 of file xltools.cxx.
References maCFStyleNamePrefix1.
Referenced by XclImpCondFormat::ReadCF().
|
static |
GUID of file moniker (HLINK record).
Calculates the double value from an RK value (encoded integer or double).
Definition at line 98 of file xltools.cxx.
References EXC_RK_100FLAG, EXC_RK_INTFLAG, EXC_RK_VALUEMASK, and get_flag().
Referenced by ImportExcel::Mulrk(), XclImpAutoFilterData::ReadAutoFilter(), XclImpChangeTrack::ReadCell(), ImportExcel::ReadRk(), and XclExpRkCell::WriteXmlContents().
|
static |
Returns the length in 1/100 mm calculated from a length in inches.
Definition at line 297 of file xltools.cxx.
References o3tl::convert(), o3tl::in, and o3tl::mm100.
Referenced by XclImpChartObj::FinalizeTabChart().
|
static |
Returns the length in 1/100 mm calculated from a length in twips.
Definition at line 302 of file xltools.cxx.
References o3tl::convert(), o3tl::mm100, and o3tl::twip.
Referenced by XclImpChartObj::FinalizeTabChart(), XclChPropSetHelper::WriteMarkerProperties(), and XclExpTbxControlObj::WriteSubRecs().
|
static |
Returns the length in inches calculated from a length in 1/100 mm.
Definition at line 292 of file xltools.cxx.
References o3tl::in, and o3tl::mm100.
Referenced by XclPageData::SetDefaults().
|
static |
Returns the length in inches calculated from a length in twips.
Definition at line 287 of file xltools.cxx.
References o3tl::in, and o3tl::twip.
Referenced by XclImpPageSettings::Finalize(), and XclExpPageSettings::XclExpPageSettings().
|
static |
Returns the best fitting color for an Excel pattern area format.
Definition at line 350 of file xltools.cxx.
References ScfTools::GetMixedColor(), and SAL_N_ELEMENTS.
Referenced by XclImpCellArea::FillToItemSet(), XclImpDrawObjBase::GetSolidFillColor(), and XclChPropSetHelper::WriteAreaProperties().
|
static |
Calculates an RK value (encoded integer or double) from a double value.
rnRKValue | Returns the calculated RK value. |
fValue | The double value. |
Definition at line 124 of file xltools.cxx.
References EXC_RK_INT, and EXC_RK_INT100.
Referenced by XclExpChTrCellContent::GetCellData(), and XclExpCellTable::XclExpCellTable().
|
static |
Returns the full StarBasic macro URL from an Excel macro name.
Suffix for StarBasic macros.
Definition at line 705 of file xltools.cxx.
References ooo::vba::MacroResolvedInfo::mbFound, and ooo::vba::MacroResolvedInfo::msResolvedMacro.
Referenced by XclControlHelper::FillMacroDescriptor(), and XclImpDrawObjBase::PreProcessSdrObject().
|
static |
Returns the Calc column width (twips) for the passed Excel width.
Excel Column width is stored as 1/256th of a character.
nScCharWidth | Width of the '0' character in Calc (twips). |
Definition at line 307 of file xltools.cxx.
Referenced by ImportExcel::Colinfo(), ImportExcel::Colwidth(), ImportExcel::DefColWidth(), and ImportExcel::Standardwidth().
|
static |
Converts an Excel error code to a Calc error code.
Definition at line 226 of file xltools.cxx.
References EXC_ERR_DIV0, EXC_ERR_NA, EXC_ERR_NAME, EXC_ERR_NULL, EXC_ERR_NUM, EXC_ERR_REF, and EXC_ERR_VALUE.
Referenced by ErrorToDouble(), XclImpCachedValue::GetScError(), XclImpExtName::MOper::MOper(), and ExcelToSc::ReadExtensionArray().
Calculates an angle (in 1/100 of degrees) from an Excel angle value.
nRotForStacked | This value will be returned, if nXclRot contains 'stacked'. |
Definition at line 154 of file xltools.cxx.
References EXC_ROT_STACKED.
Referenced by XclImpChText::ConvertTitlePosition(), XclImpCellAlign::FillToItemSet(), and XclChPropSetHelper::WriteRotationProperties().
|
static |
Returns a text encoding from an Excel code page.
Definition at line 430 of file xltools.cxx.
References SAL_WARN.
Referenced by XclImpRoot::SetCodePage().
|
static |
Returns the length in twips calculated from a length in 1/100 mm.
Definition at line 282 of file xltools.cxx.
References o3tl::convert(), o3tl::mm100, and o3tl::twip.
Referenced by XclChPropSetHelper::ReadMarkerProperties().
|
static |
Returns the length in twips calculated from a length in inches.
Definition at line 277 of file xltools.cxx.
References o3tl::convert(), o3tl::in, and o3tl::twip.
Referenced by XclImpPageSettings::Finalize().
|
static |
Returns the raw English UI representation of a built-in defined name used in NAME records.
cBuiltIn | Excel index of the built-in name. |
Definition at line 484 of file xltools.cxx.
References EXC_BUILTIN_UNKNOWN, ppcDefNames, and SAL_N_ELEMENTS.
Referenced by GetBuiltInDefName(), GetBuiltInDefNameIndex(), GetBuiltInDefNameXml(), and XclImpName::XclImpName().
|
static |
Returns an Excel code page from a text encoding.
Definition at line 441 of file xltools.cxx.
References SAL_WARN.
Referenced by ExcTable::FillAsHeaderBinary().
|
static |
Returns the Excel column width for the passed Calc width (twips).
nScCharWidth | Width of the '0' character in Calc (twips). |
Definition at line 313 of file xltools.cxx.
Referenced by XclExpColinfo::XclExpColinfo().
|
static |
Returns a correction value to convert column widths from/to default column widths.
nXclDefFontHeight | Excel height of application default font. |
Definition at line 321 of file xltools.cxx.
Referenced by ImportExcel::DefColWidth().
|
static |
Converts a Calc error code to an Excel error code.
Definition at line 201 of file xltools.cxx.
References EXC_ERR_DIV0, EXC_ERR_NA, EXC_ERR_NAME, EXC_ERR_NULL, EXC_ERR_NUM, EXC_ERR_REF, and EXC_ERR_VALUE.
Referenced by XclExpFmlaCompImpl::CreateFormula(), lcl_GetErrorString(), XclExpFmlaCompImpl::ProcessMatrix(), XclExpCachedMatrix::Save(), and XclExpFormulaCell::WriteContents().
|
static |
Returns the matching Excel font name for a passed Calc font name.
Definition at line 455 of file xltools.cxx.
References GetSubsFontName().
Referenced by XclExpHFConverter::AppendPortion(), XclFontData::FillFromVclFont(), and XclExpDxfFont::SaveXml().
|
static |
Returns the Excel macro name from a full StarBasic macro URL.
Definition at line 714 of file xltools.cxx.
References maSbMacroPrefix, and maSbMacroSuffix.
Referenced by XclControlHelper::ExtractFromMacroDescriptor(), and XclExpShapeObj::XclExpShapeObj().
|
static |
Calculates BIFF2-BIFF5 text orientation from BIFF8 rotation angle.
Definition at line 189 of file xltools.cxx.
References EXC_ORIENT_90CCW, EXC_ORIENT_90CW, EXC_ORIENT_NONE, EXC_ORIENT_STACKED, and EXC_ROT_STACKED.
Referenced by XclExpCellAlign::FillFromItemSet(), XclExpChTick::SetRotation(), and XclExpChText::SetRotation().
Calculates the Excel angle value from an angle in 1/100 of degrees.
Definition at line 162 of file xltools.cxx.
References o3tl::strong_int< typename UNDERLYING_TYPE, typename PHANTOM_TYPE >::get().
Referenced by XclExpCellAlign::FillFromItemSet(), and XclChPropSetHelper::ReadRotationProperties().
Calculates BIFF8 rotation angle from BIFF2-BIFF5 text orientation.
Definition at line 176 of file xltools.cxx.
References EXC_ORIENT_90CCW, EXC_ORIENT_90CW, EXC_ORIENT_NONE, EXC_ORIENT_STACKED, EXC_ROT_90CCW, EXC_ROT_90CW, EXC_ROT_NONE, and EXC_ROT_STACKED.
Referenced by XclImpCellAlign::FillToItemSet(), XclImpChTick::ReadChTick(), and XclImpChText::ReadHeaderRecord().
|
static |
Returns true, if the passed string is a name of an Excel built-in style.
pnStyleId | If not 0, the found style identifier will be returned here. |
pnNextChar | If not 0, the index of the char after the evaluated substring will be returned here. |
Definition at line 577 of file xltools.cxx.
References EXC_STYLE_NORMAL, EXC_STYLE_USERDEF, maStyleNamePrefix1, maStyleNamePrefix2, nId, ppcStyleNames, SAL_N_ELEMENTS, and ScResId().
Referenced by GetBuiltInStyleId().
|
static |
Returns true, if the passed string is a name of a conditional format style created by Excel import.
pnNextChar | If not 0, the index of the char after the evaluated substring will be returned here. |
Definition at line 672 of file xltools.cxx.
References maCFStyleNamePrefix1, maCFStyleNamePrefix2, and maCFStyleNamePrefix3.
|
static |
Skips a substream (BOF/EOF record block).
Includes all embedded substreams.
Definition at line 688 of file xltools.cxx.
References EXC_ID2_BOF, EXC_ID3_BOF, EXC_ID4_BOF, EXC_ID5_BOF, EXC_ID_EOF, rStrm, and SkipSubStream().
Referenced by ImportExcel::Read(), ImportExcel8::Read(), XclImpChart::ReadChartSubStream(), and SkipSubStream().
|
static |
GUID of URL moniker (HLINK record).
Definition at line 97 of file xltools.hxx.
Referenced by XclImpHyperlink::ReadEmbeddedData(), and XclExpHyperlink::XclExpHyperlink().
|
static |
Definition at line 95 of file xltools.hxx.
Referenced by XclImpHyperlink::ReadEmbeddedData(), and XclExpHyperlink::WriteEmbeddedData().
|
static |
GUID of StdLink (HLINK record).
Definition at line 96 of file xltools.hxx.
Referenced by XclImpHyperlink::ReadEmbeddedData(), and XclExpHyperlink::XclExpHyperlink().