summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-11-05 12:40:06 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-11-05 12:40:06 +0000
commite50213e33908daf55c086787d529a1c016b55269 (patch)
treefadb2fe8ec1235af1f20318eb0b9cc89efadc3e6 /sc
parent978f36141c10e784549f7f063c1e7a309fcdbb2c (diff)
INTEGRATION: CWS calc17 (1.4.84); FILE MERGED
2003/10/02 13:06:10 dr 1.4.84.5: #101529# new NAME import, update of imp/exp link managers 2003/09/22 16:54:41 dr 1.4.84.4: #100887# reduce SST with hash table 2003/09/19 07:43:16 dr 1.4.84.3: #100887# preparations for SST optimisation 2003/09/18 06:57:39 dr 1.4.84.2: RESYNC: (1.4-1.6); FILE MERGED 2003/08/13 15:08:33 dr 1.4.84.1: #110887# string handling changes
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/inc/xehelper.hxx289
1 files changed, 8 insertions, 281 deletions
diff --git a/sc/source/filter/inc/xehelper.hxx b/sc/source/filter/inc/xehelper.hxx
index 16c6d213931c..ae2369a1fa31 100644
--- a/sc/source/filter/inc/xehelper.hxx
+++ b/sc/source/filter/inc/xehelper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xehelper.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: rt $ $Date: 2003-09-16 08:19:08 $
+ * last change: $Author: hr $ $Date: 2003-11-05 13:40:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,274 +67,10 @@
#ifndef SC_XEROOT_HXX
#include "xeroot.hxx"
#endif
-#ifndef SC_XESTREAM_HXX
-#include "xestream.hxx"
+#ifndef SC_XESTRING_HXX
+#include "xestring.hxx"
#endif
-// Byte/Unicode Strings =======================================================
-
-class ScEditCell;
-class ScPatternAttr;
-class EditTextObject;
-class XclExpStream;
-
-/** This class stores an unformatted or formatted string for Excel export.
- @descr The class supports two completely different types of Excel strings:
- 1) BIFF2-BIFF7 byte strings: The text is encoded as a 8-bit character array.
- The strings cannot contain any character formatting.
- 2) BIFF8 Unicode strings: The text may be stored as UCS-2 character array,
- or compressed to an 8-bit array, if all characters are less than U+0100.
- Unicode strings may contain a formatting array, that specifies the used
- FONT record for different ranges of characters.
- The class fully supports NUL characters in strings. On construction or
- assignment the passed flags specify the behaviour of the string while it is
- written to a stream (the 'Write' functions and 'operator<<'). */
-class XclExpString
-{
-public:
- // constructors -----------------------------------------------------------
-
- /** Constructs an empty BIFF8 Unicode string.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- explicit XclExpString(
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
-
- /** Constructs an unformatted BIFF8 Unicode string.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- explicit XclExpString(
- const String& rString,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
- /** Constructs a formatted BIFF8 Unicode string.
- @param rFormats The formatting runs.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- explicit XclExpString(
- const String& rString,
- const XclFormatRunVec& rFormats,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
- /** Constructs an unformatted BIFF8 Unicode string.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- explicit XclExpString(
- const ::rtl::OUString& rString,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
- /** Constructs a formatted BIFF8 Unicode string.
- @param rFormats The formatting runs.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- explicit XclExpString(
- const ::rtl::OUString& rString,
- const XclFormatRunVec& rFormats,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
-
- // assign -----------------------------------------------------------------
-
- /** Assigns an unformatted string, converts this object to a BIFF8 Unicode string.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- void Assign(
- const String& rString,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
- /** Assigns a formatted string, converts this object to a BIFF8 Unicode string.
- @param rFormats The formatting runs.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- void Assign(
- const String& rString,
- const XclFormatRunVec& rFormats,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
- /** Assigns an unformatted string, converts this object to a BIFF8 Unicode string.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- void Assign(
- const ::rtl::OUString& rString,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
- /** Assigns a formatted string, converts this object to a BIFF8 Unicode string.
- @param rFormats The formatting runs.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- void Assign(
- const ::rtl::OUString& rString,
- const XclFormatRunVec& rFormats,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
- /** Assigns a Unicode character, converts this object to a BIFF8 Unicode string.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string (for appending). */
- void Assign(
- sal_Unicode cChar,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
-
- /** Assigns an unformatted string, converts this object to a BIFF2-BIFF7 byte string.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string. */
- void AssignByte(
- const String& rString,
- CharSet eCharSet,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
- /** Assigns a character, converts this object to a BIFF2-BIFF7 byte string.
- @param nFlags Modifiers for string export.
- @param nMaxLen The maximum number of characters to store in this string (for appending). */
- void AssignByte(
- sal_Unicode cChar,
- CharSet eCharSet,
- XclStrFlags nFlags = EXC_STR_DEFAULT,
- sal_uInt16 nMaxLen = 0xFFFF );
-
- // append -----------------------------------------------------------------
-
- /** Appends a string. Uses the string flags used in constructor or last Assign().
- @descr This object must be a BIFF8 Unicode string. */
- void Append( const String& rString );
- /** Appends a string. Uses the string flags used in constructor or last Assign().
- @descr This object must be a BIFF8 Unicode string. */
- void Append( const ::rtl::OUString& rString );
- /** Appends a character. Uses the string flags used in constructor or last Assign().
- @descr This object must be a BIFF8 Unicode string. */
- void Append( sal_Unicode cChar );
-
- /** Appends a string. Uses the string flags used in constructor or last Assign().
- @descr This object must be a BIFF2-BIFF7 byte string. */
- void AppendByte( const String& rString, CharSet eCharSet );
- /** Appends a character. Uses the string flags used in constructor or last Assign().
- @descr This object must be a BIFF2-BIFF7 byte string. */
- void AppendByte( sal_Unicode cChar, CharSet eCharSet );
-
- // formatting runs --------------------------------------------------------
-
- /** Sets new formatting runs for the current text. */
- void SetFormats( const XclFormatRunVec& rFormats );
- /** Appends a formatting run. nChar must be greater than last contained character index. */
- void AppendFormat( sal_uInt16 nChar, sal_uInt16 nFontIx );
- /** Removes formatting runs at the end, if the string contains too much. */
- void LimitFormatCount( sal_uInt16 nMaxCount );
- /** returns and removes the Font Index for a char index otherwise EXC_FONT_NOTFOUND from the formatting runs. */
- sal_uInt16 RemoveFontOfChar(sal_uInt16 nCharIdx);
-
- // get data ---------------------------------------------------------------
-
- /** Returns the character count of the string. */
- inline sal_uInt16 Len() const { return mnLen; }
- /** Returns true, if the string is empty. */
- inline bool IsEmpty() const { return mnLen == 0; }
- /** Returns true, if the string contains line breaks. */
- inline bool IsWrapped() const { return mbWrapped; }
-
- /** Returns true, if the string contains formatting information. */
- inline bool IsRich() const { return mbIsBiff8 && !maFormats.empty(); }
- /** Returns the current count of formatting runs for rich strings. */
- sal_uInt16 GetFormatsCount() const;
- /** Returns the vector with all formatting runs. */
- inline const XclFormatRunVec& GetFormats() const { return maFormats; }
-
- /** Returns the current string flags field to export. */
- sal_uInt8 GetFlagField() const;
- /** Returns the byte count the character buffer will take on export. */
- sal_uInt32 GetBufferSize() const;
- /** Returns the byte count the whole string will take on export. */
- sal_uInt32 GetSize() const;
-
- // streaming --------------------------------------------------------------
-
- /** Writes the string flags field (1 byte). */
- void WriteFlagField( XclExpStream& rStrm ) const;
- /** Writes 8-bit or 16-bit length field and string flags field. */
- void WriteHeader( XclExpStream& rStrm ) const;
- /** Writes the raw character buffer. */
- void WriteBuffer( XclExpStream& rStrm ) const;
- /** Writes the complete Unicode string. */
- void Write( XclExpStream& rStrm ) const;
-
- /** Writes the raw character buffer to memory (8-bit or 16-bit little-endian) */
- void WriteBuffer( void* pDest ) const;
-
-private:
- /** Returns true, if the flag field should be written. */
- bool IsWriteFlags() const;
-
- /** Sets the string length but regards the limit given in mnMaxLen. */
- void SetStrLen( sal_Int32 nNewLen );
- /** Inserts the passed character array into the internal character buffer.
- @param nBegin First index in internal buffer to fill.
- @param nLen Number of characters to insert. */
- void CharsToBuffer( const sal_Unicode* pcSource, sal_Int32 nBegin, sal_Int32 nLen );
- /** Inserts the passed character array into the internal character buffer.
- @param nBegin First index in internal buffer to fill.
- @param nLen Number of characters to insert. */
- void CharsToBuffer( const sal_Char* pcSource, sal_Int32 nBegin, sal_Int32 nLen );
-
- /** Initializes flags, string length, and resizes character buffer.
- @param nFlags Modifiers for string export.
- @param nCurrLen The requested number of characters for the string.
- @param nMaxLen The maximum length allowed of the resulting string.
- @param bBiff8 true = BIFF8 Unicode string; false = BIFF2-BIFF7 byte string. */
- void Init( sal_Int32 nCurrLen, XclStrFlags nFlags, sal_uInt16 nMaxLen, bool bBiff8 );
- /** Creates the character buffer from the given Unicode array.
- @param pcSource The source character buffer. Trailing NUL character is not necessary.
- @param nFlags Modifiers for string export.
- @param nCurrLen The real count of characters contained in the passed buffer.
- @param nMaxLen The maximum length allowed of the resulting string. */
- void Build(
- const sal_Unicode* pcSource, sal_Int32 nCurrLen,
- XclStrFlags nFlags, sal_uInt16 nMaxLen );
- /** Creates the character buffer from the given character array.
- @param pcSource The source character buffer. Trailing NUL character is not necessary.
- @param nFlags Modifiers for string export.
- @param nCurrLen The real count of characters contained in the passed buffer.
- @param nMaxLen The maximum length allowed of the resulting string. */
- void Build(
- const sal_Char* pcSource, sal_Int32 nCurrLen,
- XclStrFlags nFlags, sal_uInt16 nMaxLen );
-
- /** Initializes string length and resizes character buffers for appending operation.
- @param nAddLen The number of characters to be appended. */
- void InitAppend( sal_Int32 nAddLen );
- /** Appends the given Unicode array to the character buffer.
- @param pcSource The source character buffer. Trailing NUL character is not necessary.
- @param nAddLen The real count of characters contained in the passed buffer. */
- void BuildAppend( const sal_Unicode* pcSource, sal_Int32 nAddLen );
- /** Appends the given character array to the character buffer.
- @param pcSource The source character buffer. Trailing NUL character is not necessary.
- @param nAddLen The real count of characters contained in the passed buffer. */
- void BuildAppend( const sal_Char* pcSource, sal_Int32 nAddLen );
-
- /** Initializes write process on stream. */
- void PrepareWrite( XclExpStream& rStrm, sal_uInt32 nBytes ) const;
-
-private:
- ScfUInt16Vec maUniBuffer; /// The Unicode character buffer.
- ScfUInt8Vec maCharBuffer; /// The byte character buffer.
- XclFormatRunVec maFormats; /// All formatting runs.
- sal_uInt16 mnLen; /// Character count to export.
- sal_uInt16 mnMaxLen; /// Maximum allowed number of characters.
- bool mbIsBiff8; /// true = BIFF8 Unicode string, false = BIFF2-7 bytestring.
- bool mbIsUnicode; /// true, if at least one character is >0xFF.
- bool mb8BitLen; /// true = write 8-bit string length; false = 16-bit.
- bool mbSmartFlags; /// true = omit flags on empty string; false = always write flags.
- bool mbWrapped; /// true = text contains several paragraphs.
-};
-
-inline XclExpStream& operator<<( XclExpStream& rStrm, const XclExpString& rString )
-{
- rString.Write( rStrm );
- return rStrm;
-}
-
-//! for compatibility with old code
-typedef XclExpString XclExpUniString;
-
// EditEngine->String conversion ==============================================
@@ -354,8 +90,8 @@ public:
@param pCellAttr The set item containing the cell formatting.
@param nFlags Modifiers for string export.
@param nMaxLen The maximum number of characters to store in this string.
- @return The new string object. */
- static XclExpString* CreateString(
+ @return The new string object (shared pointer). */
+ static XclExpStringPtr CreateString(
const XclExpRoot& rRoot,
const ScEditCell& rEditCell,
const ScPatternAttr* pCellAttr,
@@ -366,8 +102,8 @@ public:
@param rTextObj The text box object.
@param nFlags Modifiers for string export.
@param nMaxLen The maximum number of characters to store in this string.
- @return The new string object. */
- static XclExpString* CreateString(
+ @return The new string object (shared pointer). */
+ static XclExpStringPtr CreateString(
const XclExpRoot& rRoot,
const SdrTextObj& rTextObj,
XclStrFlags nFlags = EXC_STR_DEFAULT,
@@ -444,15 +180,6 @@ public:
static String EncodeUrl( const XclExpRoot& rRoot, const String& rAbsUrl, const String* pTableName = NULL );
/** Encodes and returns the passed DDE link to an Excel like DDE link. */
static String EncodeDde( const String& rApplic, const String rTopic );
-
-private:
- /** Converts the URL passed in rUrl to a URL in MS-DOS mode.
- @descr Converts to a relative URL, if enabled in rRootData.
- @return True = rUrl is a file URL (local or UNC). */
- static bool ConvertToDos( String& rUrl, const XclExpRoot& rRoot );
- /** Encodes special parts of the URL, i.e. directory separators and volume names.
- @param pTableName Pointer to a table name to be encoded in this URL, or NULL. */
- static void EncodeUrl_Impl( String& rUrl, const String* pTableName );
};