63 const OUString& rString,
73 const OUString& rString,
84 std::u16string_view rString,
85 rtl_TextEncoding eTextEnc,
93 void Append( std::u16string_view rString );
97 void AppendByte( std::u16string_view rString, rtl_TextEncoding eTextEnc );
105 void AppendFormat( sal_uInt16 nChar, sal_uInt16 nFontIdx,
bool bDropDuplicate =
true );
145 sal_uInt16
GetChar( sal_uInt16 nCharIdx )
const;
190 void CharsToBuffer(
const char* pcSource, sal_Int32 nBegin, sal_Int32 nLen );
197 void Init( sal_Int32 nCurrLen,
XclStrFlags nFlags, sal_uInt16 nMaxLen,
bool bBiff8 );
212 const char* pcSource, sal_Int32 nCurrLen,
245 return rLeft.
IsEqual( rRight );
250 return !(rLeft == rRight);
This class is used to export Excel record streams.
This class stores an unformatted or formatted string for Excel export.
void WriteHeader(XclExpStream &rStrm) const
Writes 8-bit or 16-bit length field and string flags field.
bool mb8BitLen
true, if at least one character is >0xFF.
bool IsEmpty() const
Returns true, if the string is empty.
void WriteFlagField(XclExpStream &rStrm) const
Writes the string flags field (1 byte).
void AppendByte(std::u16string_view rString, rtl_TextEncoding eTextEnc)
Appends a string.
sal_uInt8 GetFlagField() const
Returns the current string flags field to export.
void InitAppend(sal_Int32 nAddLen)
Initializes string length and resizes character buffers for appending operation.
void Build(const sal_Unicode *pcSource, sal_Int32 nCurrLen, XclStrFlags nFlags, sal_uInt16 nMaxLen)
Creates the character buffer from the given Unicode array.
ScfUInt8Vec maCharBuffer
The Unicode character buffer.
void AppendFormat(sal_uInt16 nChar, sal_uInt16 nFontIdx, bool bDropDuplicate=true)
Appends a formatting run.
void WriteLenField(XclExpStream &rStrm) const
Writes the string length field (1 byte or 2 bytes).
void WriteBufferToMem(sal_uInt8 *pnMem) const
Writes the raw character buffer to memory (8-bit or 16-bit little-endian).
void WriteToMem(sal_uInt8 *pnMem) const
Writes the entire string to memory.
bool mbSmartFlags
true = write 8-bit string length; false = 16-bit.
bool mbSkipHeader
true = text contains several paragraphs.
sal_uInt16 GetFormatsCount() const
Returns the current count of formatting runs for rich strings.
XclExpString(XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Constructs an empty BIFF8 Unicode string.
const XclFormatRunVec & GetFormats() const
Returns the vector with all formatting runs.
void Append(std::u16string_view rString)
Appends a string.
void AssignByte(std::u16string_view rString, rtl_TextEncoding eTextEnc, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Assigns an unformatted string, converts this object to a BIFF2-BIFF7 byte string.
void Init(sal_Int32 nCurrLen, XclStrFlags nFlags, sal_uInt16 nMaxLen, bool bBiff8)
Initializes flags, string length, and resizes character buffer.
void CharsToBuffer(const sal_Unicode *pcSource, sal_Int32 nBegin, sal_Int32 nLen)
Inserts the passed character array into the internal character buffer.
void SetStrLen(sal_Int32 nNewLen)
Sets the string length but regards the limit given in mnMaxLen.
void PrepareWrite(XclExpStream &rStrm, sal_uInt16 nBytes) const
Initializes write process on stream.
sal_uInt16 GetHeaderSize() const
Returns the byte count the header will take on export.
void Assign(const OUString &rString, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Assigns an unformatted string, converts this object to a BIFF8 Unicode string.
sal_uInt16 mnLen
All formatting runs.
bool mbIsUnicode
true = BIFF8 Unicode string, false = BIFF2-7 bytestring.
bool IsEqual(const XclExpString &rCmp) const
Returns true, if this string is equal to the passed string.
sal_uInt16 mnMaxLen
Character count to export.
bool mbWrapped
true = skip formats on export; false = write complete formatted string.
bool IsLessThan(const XclExpString &rCmp) const
Returns true, if this string is less than the passed string.
bool IsRich() const
Returns true, if the string contains formatting information.
void WriteFormats(XclExpStream &rStrm, bool bWriteSize=false) const
Writes the raw formatting run buffer.
std::size_t GetSize() const
Returns the byte count the whole string will take on export.
void LimitFormatCount(sal_uInt16 nMaxCount)
Removes formatting runs at the end, if the string contains too much.
sal_uInt16 GetLeadingFont()
Returns the font index of the first char in the formatting run, or EXC_FONT_NOTFOUND.
void BuildAppend(std::u16string_view)
Appends the given Unicode array to the character buffer.
XclFormatRunVec maFormats
The byte character buffer.
sal_uInt16 GetHash() const
Returns a hash value for the string.
std::size_t GetBufferSize() const
Returns the byte count the character buffer will take on export.
void WriteXml(XclExpXmlStream &rStrm) const
void WriteBuffer(XclExpStream &rStrm) const
Writes the raw character buffer.
sal_uInt16 Len() const
Returns the character count of the string.
void AppendTrailingFormat(sal_uInt16 nFontIdx)
Appends a trailing formatting run with the passed font index.
sal_uInt16 RemoveLeadingFont()
The same as above + additionally remove the given font from the formatting run.
bool mbSkipFormats
true = omit flags on empty string; false = always write flags.
bool IsWrapped() const
Returns true, if the string contains line breaks.
bool mbIsBiff8
Maximum allowed number of characters.
sal_uInt16 GetChar(sal_uInt16 nCharIdx) const
Returns the specified character from the (already encoded) string.
void WriteHeaderToMem(sal_uInt8 *pnMem) const
Writes the string header to memory.
bool IsWriteFormats() const
Returns true, if the formatting run vector should be written.
const ScfUInt16Vec & GetUnicodeBuffer() const
bool IsWriteFlags() const
Returns true, if the flag field should be written.
void Write(XclExpStream &rStrm) const
Writes the complete Unicode string.
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
bool operator<(const XclExpString &rLeft, const XclExpString &rRight)
XclExpStream & operator<<(XclExpStream &rStrm, const XclExpString &rString)
bool operator==(const XclExpString &rLeft, const XclExpString &rRight)
const sal_uInt16 EXC_STR_MAXLEN
::std::vector< XclFormatRun > XclFormatRunVec
A vector with all formatting runs for a rich-string.
XclStrFlags
Flags used to specify import/export mode of strings.