LibreOffice Module sc (master) 1
Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
ScfTools Class Reference

Contains static methods used anywhere in the filters. More...

#include <ftools.hxx>

Public Member Functions

 ScfTools ()=delete
 We don't want anybody to instantiate this class, since it is just a collection of static items. More...
 
 ScfTools (const ScfTools &)=delete
 
const ScfToolsoperator= (const ScfTools &)=delete
 

Static Public Member Functions

static void ReadLongDouble (SvStream &rStrm, double &fResult)
 Reads a 10-byte-long-double and converts it to double. More...
 
static rtl_TextEncoding GetSystemTextEncoding ()
 Returns system text encoding for byte string conversion. More...
 
static OUString GetHexStr (sal_uInt16 nValue)
 Returns a string representing the hexadecimal value of nValue. More...
 
static sal_uInt8 GetMixedColorComp (sal_uInt8 nFore, sal_uInt8 nBack, sal_uInt8 nTrans)
 Mixes RGB components with given transparence. More...
 
static Color GetMixedColor (const Color &rFore, const Color &rBack, sal_uInt8 nTrans)
 Mixes colors with given transparence. More...
 
static OUString ConvertToScDefinedName (const OUString &rName)
 Converts a string to a valid Calc defined name or database range name. More...
 
static tools::SvRef< SotStorageOpenStorageRead (tools::SvRef< SotStorage > const &xStrg, const OUString &rStrgName)
 Tries to open an existing storage with the specified name in the passed storage (read-only). More...
 
static tools::SvRef< SotStorageOpenStorageWrite (tools::SvRef< SotStorage > const &xStrg, const OUString &rStrgName)
 Creates and opens a storage with the specified name in the passed storage (read/write). More...
 
static tools::SvRef< SotStorageStreamOpenStorageStreamRead (tools::SvRef< SotStorage > const &xStrg, const OUString &rStrmName)
 Tries to open an existing stream with the specified name in the passed storage (read-only). More...
 
static tools::SvRef< SotStorageStreamOpenStorageStreamWrite (tools::SvRef< SotStorage > const &xStrg, const OUString &rStrmName)
 Creates and opens a stream with the specified name in the passed storage (read/write). More...
 
static bool CheckItem (const SfxItemSet &rItemSet, sal_uInt16 nWhichId, bool bDeep)
 Returns true, if the passed item set contains the item. More...
 
static bool CheckItems (const SfxItemSet &rItemSet, const sal_uInt16 *pnWhichIds, bool bDeep)
 Returns true, if the passed item set contains at least one of the items. More...
 
static void PutItem (SfxItemSet &rItemSet, const SfxPoolItem &rItem, sal_uInt16 nWhichId, bool bSkipPoolDef)
 Puts the item into the passed item set. More...
 
static void PutItem (SfxItemSet &rItemSet, const SfxPoolItem &rItem, bool bSkipPoolDef)
 Puts the item into the passed item set. More...
 
static ScStyleSheetMakeCellStyleSheet (ScStyleSheetPool &rPool, const OUString &rStyleName, bool bForceName)
 Creates and returns a cell style sheet and inserts it into the pool. More...
 
static ScStyleSheetMakePageStyleSheet (ScStyleSheetPool &rPool, const OUString &rStyleName, bool bForceName)
 Creates and returns a page style sheet and inserts it into the pool. More...
 
static OString read_zeroTerminated_uInt8s_ToOString (SvStream &rStrm, sal_Int32 &rnBytesLeft)
 Reads and returns a zero terminated byte string and decreases a stream counter. More...
 
static OUString read_zeroTerminated_uInt8s_ToOUString (SvStream &rStrm, sal_Int32 &rnBytesLeft, rtl_TextEncoding eTextEnc)
 Reads and returns a zero terminated byte string and decreases a stream counter. More...
 
static void AppendCString (SvStream &rStrm, OUString &rString, rtl_TextEncoding eTextEnc)
 Appends a zero terminated byte string. More...
 
static const OUString & GetHTMLDocName ()
 Returns the built-in range name for an HTML document. More...
 
static const OUString & GetHTMLTablesName ()
 Returns the built-in range name for all HTML tables. More...
 
static OUString GetNameFromHTMLIndex (sal_uInt32 nIndex)
 Returns the built-in range name for an HTML table, specified by table index. More...
 
static OUString GetNameFromHTMLName (std::u16string_view rTabName)
 Returns the built-in range name for an HTML table, specified by table name. More...
 
static bool IsHTMLDocName (std::u16string_view rSource)
 Returns true, if rSource is the built-in range name for an HTML document. More...
 
static bool IsHTMLTablesName (std::u16string_view rSource)
 Returns true, if rSource is the built-in range name for all HTML tables. More...
 
static bool GetHTMLNameFromName (const OUString &rSource, OUString &rName)
 Converts a built-in range name to an HTML table name. More...
 

Static Private Member Functions

static const OUString & GetHTMLIndexPrefix ()
 Returns the prefix for table index names. More...
 
static const OUString & GetHTMLNamePrefix ()
 Returns the prefix for table names. More...
 

Detailed Description

Contains static methods used anywhere in the filters.

Definition at line 119 of file ftools.hxx.

Constructor & Destructor Documentation

◆ ScfTools() [1/2]

ScfTools::ScfTools ( )
delete

We don't want anybody to instantiate this class, since it is just a collection of static items.

◆ ScfTools() [2/2]

ScfTools::ScfTools ( const ScfTools )
delete

Member Function Documentation

◆ AppendCString()

void ScfTools::AppendCString ( SvStream rStrm,
OUString &  rString,
rtl_TextEncoding  eTextEnc 
)
static

Appends a zero terminated byte string.

Definition at line 278 of file ftools.cxx.

References read_zeroTerminated_uInt8s_ToOUString(), and rStrm.

Referenced by ImportLotus::Read().

◆ CheckItem()

bool ScfTools::CheckItem ( const SfxItemSet rItemSet,
sal_uInt16  nWhichId,
bool  bDeep 
)
static

◆ CheckItems()

bool ScfTools::CheckItems ( const SfxItemSet rItemSet,
const sal_uInt16 *  pnWhichIds,
bool  bDeep 
)
static

Returns true, if the passed item set contains at least one of the items.

Parameters
pnWhichIdsZero-terminated array of Which-IDs.
bDeeptrue = Searches in parent item sets too.

Definition at line 205 of file ftools.cxx.

References CheckItem().

Referenced by XclExpFontHelper::CheckItems().

◆ ConvertToScDefinedName()

OUString ScfTools::ConvertToScDefinedName ( const OUString &  rName)
static

Converts a string to a valid Calc defined name or database range name.

@descr Defined names in Calc may contain letters, digits (*), underscores, periods (*), colons (*), question marks, and dollar signs. (*) = not allowed at first position.

Definition at line 149 of file ftools.cxx.

References CharName, ScCompiler::IsCharFlagAllConventions(), Name, nPos, sName, and u.

Referenced by OP_NamedRange(), OP_SymphNamedRange(), XclImpExtName::XclImpExtName(), and XclImpName::XclImpName().

◆ GetHexStr()

OUString ScfTools::GetHexStr ( sal_uInt16  nValue)
static

Returns a string representing the hexadecimal value of nValue.

Definition at line 121 of file ftools.cxx.

References aStr, and nValue.

Referenced by XclImpPivotCache::ReadPivotCacheStream(), and XclExpPivotCache::WriteCacheStream().

◆ GetHTMLDocName()

const OUString & ScfTools::GetHTMLDocName ( )
static

Returns the built-in range name for an HTML document.

Definition at line 285 of file ftools.cxx.

Referenced by IsHTMLDocName(), XclImpWebQuery::ReadParamqry(), and ScHTMLImport::WriteToDocument().

◆ GetHTMLIndexPrefix()

const OUString & ScfTools::GetHTMLIndexPrefix ( )
staticprivate

Returns the prefix for table index names.

Definition at line 297 of file ftools.cxx.

Referenced by GetHTMLNameFromName(), and GetNameFromHTMLIndex().

◆ GetHTMLNameFromName()

bool ScfTools::GetHTMLNameFromName ( const OUString &  rSource,
OUString &  rName 
)
static

Converts a built-in range name to an HTML table name.

Parameters
rSourceThe string to be determined.
rNameThe HTML table name.
Returns
true, if conversion was successful.

Definition at line 332 of file ftools.cxx.

References ScGlobal::AddQuotes(), aIndex, GetHTMLIndexPrefix(), GetHTMLNamePrefix(), getLength(), and CharClass::isAsciiNumeric().

Referenced by XclExpWebQuery::XclExpWebQuery().

◆ GetHTMLNamePrefix()

const OUString & ScfTools::GetHTMLNamePrefix ( )
staticprivate

Returns the prefix for table names.

Definition at line 304 of file ftools.cxx.

Referenced by GetHTMLNameFromName(), and GetNameFromHTMLName().

◆ GetHTMLTablesName()

const OUString & ScfTools::GetHTMLTablesName ( )
static

Returns the built-in range name for all HTML tables.

Definition at line 291 of file ftools.cxx.

Referenced by IsHTMLTablesName(), XclImpWebQuery::ReadParamqry(), and ScHTMLImport::WriteToDocument().

◆ GetMixedColor()

Color ScfTools::GetMixedColor ( const Color rFore,
const Color rBack,
sal_uInt8  nTrans 
)
static

Mixes colors with given transparence.

Parameters
nTransForeground transparence (0x00 == full rFore ... 0x80 = full rBack).

Definition at line 137 of file ftools.cxx.

References Color::GetBlue(), Color::GetGreen(), GetMixedColorComp(), and Color::GetRed().

Referenced by XclTools::GetPatternColor(), and XclImpChRoot::GetSeriesFillAutoColor().

◆ GetMixedColorComp()

sal_uInt8 ScfTools::GetMixedColorComp ( sal_uInt8  nFore,
sal_uInt8  nBack,
sal_uInt8  nTrans 
)
static

Mixes RGB components with given transparence.

Parameters
nTransForeground transparence (0x00 == full nFore ... 0x80 = full nBack).

Definition at line 131 of file ftools.cxx.

Referenced by GetMixedColor().

◆ GetNameFromHTMLIndex()

OUString ScfTools::GetNameFromHTMLIndex ( sal_uInt32  nIndex)
static

Returns the built-in range name for an HTML table, specified by table index.

Definition at line 310 of file ftools.cxx.

References aName, GetHTMLIndexPrefix(), and nIndex.

Referenced by ScHTMLImport::GetHTMLRangeNameList(), XclImpWebQuery::ReadWqtables(), and ScHTMLImport::WriteToDocument().

◆ GetNameFromHTMLName()

OUString ScfTools::GetNameFromHTMLName ( std::u16string_view  rTabName)
static

Returns the built-in range name for an HTML table, specified by table name.

Definition at line 317 of file ftools.cxx.

References GetHTMLNamePrefix().

Referenced by XclImpWebQuery::ReadWqtables().

◆ GetSystemTextEncoding()

rtl_TextEncoding ScfTools::GetSystemTextEncoding ( )
static

Returns system text encoding for byte string conversion.

Definition at line 116 of file ftools.cxx.

Referenced by oox::xls::Font::fillToItemSet(), XclImpFont::FillToItemSet(), and XclExpFontBuffer::InitDefaultFonts().

◆ IsHTMLDocName()

bool ScfTools::IsHTMLDocName ( std::u16string_view  rSource)
static

Returns true, if rSource is the built-in range name for an HTML document.

Definition at line 322 of file ftools.cxx.

References o3tl::equalsIgnoreAsciiCase(), and GetHTMLDocName().

Referenced by XclExpWebQuery::XclExpWebQuery().

◆ IsHTMLTablesName()

bool ScfTools::IsHTMLTablesName ( std::u16string_view  rSource)
static

Returns true, if rSource is the built-in range name for all HTML tables.

Definition at line 327 of file ftools.cxx.

References o3tl::equalsIgnoreAsciiCase(), and GetHTMLTablesName().

Referenced by ScHTMLImport::GetHTMLRangeNameList(), and XclExpWebQuery::XclExpWebQuery().

◆ MakeCellStyleSheet()

ScStyleSheet & ScfTools::MakeCellStyleSheet ( ScStyleSheetPool rPool,
const OUString &  rStyleName,
bool  bForceName 
)
static

Creates and returns a cell style sheet and inserts it into the pool.

@descr If the style sheet is already in the pool, another unused style name is used.

Parameters
bForceNameControls behaviour, if the style already exists: true = Old existing style will be renamed; false = New style gets another name.

Definition at line 257 of file ftools.cxx.

Referenced by oox::xls::StylesBuffer::createDxfStyle(), oox::xls::StylesBuffer::createExtDxfStyle(), and XclImpCondFormat::ReadCF().

◆ MakePageStyleSheet()

ScStyleSheet & ScfTools::MakePageStyleSheet ( ScStyleSheetPool rPool,
const OUString &  rStyleName,
bool  bForceName 
)
static

Creates and returns a page style sheet and inserts it into the pool.

@descr If the style sheet is already in the pool, another unused style name is used.

Parameters
bForceNameControls behaviour, if the style already exists: true = Old existing style will be renamed; false = New style gets another name.

Definition at line 262 of file ftools.cxx.

Referenced by XclImpPageSettings::Finalize().

◆ OpenStorageRead()

tools::SvRef< SotStorage > ScfTools::OpenStorageRead ( tools::SvRef< SotStorage > const &  xStrg,
const OUString &  rStrgName 
)
static

Tries to open an existing storage with the specified name in the passed storage (read-only).

Definition at line 165 of file ftools.cxx.

References tools::SvRef< typename T >::is().

Referenced by XclRoot::OpenStorage().

◆ OpenStorageStreamRead()

tools::SvRef< SotStorageStream > ScfTools::OpenStorageStreamRead ( tools::SvRef< SotStorage > const &  xStrg,
const OUString &  rStrmName 
)
static

Tries to open an existing stream with the specified name in the passed storage (read-only).

Definition at line 181 of file ftools.cxx.

References tools::SvRef< typename T >::is().

Referenced by XclRoot::OpenStream(), and ScFormatFilterPluginImpl::ScImportExcel().

◆ OpenStorageStreamWrite()

tools::SvRef< SotStorageStream > ScfTools::OpenStorageStreamWrite ( tools::SvRef< SotStorage > const &  xStrg,
const OUString &  rStrmName 
)
static

Creates and opens a stream with the specified name in the passed storage (read/write).

Definition at line 189 of file ftools.cxx.

References tools::SvRef< typename T >::is().

Referenced by lcl_ExportExcelBiff(), and XclRoot::OpenStream().

◆ OpenStorageWrite()

tools::SvRef< SotStorage > ScfTools::OpenStorageWrite ( tools::SvRef< SotStorage > const &  xStrg,
const OUString &  rStrgName 
)
static

Creates and opens a storage with the specified name in the passed storage (read/write).

Definition at line 173 of file ftools.cxx.

References tools::SvRef< typename T >::is().

Referenced by XclRoot::OpenStorage().

◆ operator=()

const ScfTools & ScfTools::operator= ( const ScfTools )
delete

◆ PutItem() [1/2]

void ScfTools::PutItem ( SfxItemSet rItemSet,
const SfxPoolItem rItem,
bool  bSkipPoolDef 
)
static

Puts the item into the passed item set.

@descr The item will be put into the item set, if bSkipPoolDef is false, or if the item differs from the default pool item.

Parameters
rItemSetThe destination item set.
rItemThe item to put into the item set.
bSkipPoolDeftrue = Do not put item if it is equal to pool default; false = Always put the item.

Definition at line 222 of file ftools.cxx.

References PutItem(), and SfxPoolItem::Which().

◆ PutItem() [2/2]

void ScfTools::PutItem ( SfxItemSet rItemSet,
const SfxPoolItem rItem,
sal_uInt16  nWhichId,
bool  bSkipPoolDef 
)
static

Puts the item into the passed item set.

@descr The item will be put into the item set, if bSkipPoolDef is false, or if the item differs from the default pool item.

Parameters
rItemSetThe destination item set.
rItemThe item to put into the item set.
nWhichIdThe Which-ID to set with the item.
bSkipPoolDeftrue = Do not put item if it is equal to pool default; false = Always put the item.

Definition at line 214 of file ftools.cxx.

References SfxPoolItem::CloneSetWhich(), SfxItemPool::GetDefaultItem(), SfxItemSet::GetPool(), and SfxItemSet::Put().

Referenced by oox::xls::Xf::createPattern(), XclImpXF::CreatePattern(), XclImpNumFmtBuffer::FillScFmtToItemSet(), oox::xls::Font::fillToItemSet(), oox::xls::NumberFormat::fillToItemSet(), oox::xls::Alignment::fillToItemSet(), oox::xls::Protection::fillToItemSet(), oox::xls::Border::fillToItemSet(), oox::xls::Fill::fillToItemSet(), XclImpCellProt::FillToItemSet(), XclImpCellAlign::FillToItemSet(), XclImpCellBorder::FillToItemSet(), XclImpCellArea::FillToItemSet(), XclImpPageSettings::Finalize(), and PutItem().

◆ read_zeroTerminated_uInt8s_ToOString()

OString ScfTools::read_zeroTerminated_uInt8s_ToOString ( SvStream rStrm,
sal_Int32 &  rnBytesLeft 
)
static

Reads and returns a zero terminated byte string and decreases a stream counter.

Definition at line 269 of file ftools.cxx.

References SvStream::good(), read_zeroTerminated_uInt8s_ToOString(), and rStrm.

Referenced by read_zeroTerminated_uInt8s_ToOString(), and read_zeroTerminated_uInt8s_ToOUString().

◆ read_zeroTerminated_uInt8s_ToOUString()

static OUString ScfTools::read_zeroTerminated_uInt8s_ToOUString ( SvStream rStrm,
sal_Int32 &  rnBytesLeft,
rtl_TextEncoding  eTextEnc 
)
inlinestatic

Reads and returns a zero terminated byte string and decreases a stream counter.

Definition at line 215 of file ftools.hxx.

References read_zeroTerminated_uInt8s_ToOString(), and rStrm.

Referenced by AppendCString(), and LotusToSc::Convert().

◆ ReadLongDouble()

void ScfTools::ReadLongDouble ( SvStream rStrm,
double &  fResult 
)
static

Reads a 10-byte-long-double and converts it to double.

Definition at line 42 of file ftools.cxx.

References rStrm.

Referenced by LotusToSc::Convert(), and ImportLotus::Read().


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