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