summaryrefslogtreecommitdiff
path: root/oox/inc/oox/xls
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2008-03-05 17:02:56 +0000
committerKurt Zenker <kz@openoffice.org>2008-03-05 17:02:56 +0000
commit37c18662276f5497f5e23398f064047094bb193a (patch)
tree9acb976277d861a10e605378d052aca46f07b94c /oox/inc/oox/xls
parent6999499260f74b632c31fd42fb425fe18e4eea0b (diff)
INTEGRATION: CWS xmlfilter03_DEV300 (1.2.4); FILE MERGED
2008/01/28 15:40:38 dr 1.2.4.2: BIFF stream handling 2008/01/24 14:57:20 dr 1.2.4.1: OOBIN additions, BIFF string handling
Diffstat (limited to 'oox/inc/oox/xls')
-rw-r--r--oox/inc/oox/xls/biffinputstream.hxx113
-rw-r--r--oox/inc/oox/xls/defnamesbuffer.hxx19
2 files changed, 67 insertions, 65 deletions
diff --git a/oox/inc/oox/xls/biffinputstream.hxx b/oox/inc/oox/xls/biffinputstream.hxx
index 6a295f4f1ee9..50ddb9d15cdd 100644
--- a/oox/inc/oox/xls/biffinputstream.hxx
+++ b/oox/inc/oox/xls/biffinputstream.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: biffinputstream.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: rt $ $Date: 2008-01-17 08:05:48 $
+ * last change: $Author: kz $ $Date: 2008-03-05 18:01:39 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -40,6 +40,7 @@
#include "oox/xls/biffhelper.hxx"
#include "oox/xls/biffcodec.hxx"
+namespace rtl { class OUStringBuffer; }
namespace oox { class BinaryInputStream; }
namespace oox {
@@ -50,8 +51,6 @@ namespace xls {
const sal_uInt32 BIFF_REC_SEEK_TO_BEGIN = 0;
const sal_uInt32 BIFF_REC_SEEK_TO_END = SAL_MAX_UINT32;
-const sal_Unicode BIFF_DEF_NUL_SUBST_CHAR = '?';
-
// ============================================================================
namespace prv {
@@ -324,68 +323,42 @@ public:
/** Seeks forward inside the current record. */
BiffInputStream& skip( sal_uInt32 nBytes );
- // character arrays -------------------------------------------------------
+ // strings ----------------------------------------------------------------
+
+ /** Enables/disables reading NUL characters into strings.
+
+ Default behaviour is to replace NUL characters with question marks.
+ This default behaviour is restored automatically, if a new record is
+ started using the function startNextRecord().
+
+ @param bEnable
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ inline void enableNulChars( bool bEnable ) { mbNulChars = bEnable; }
+
+ // byte strings -----------------------------------------------------------
/** Reads nChar byte characters and returns the string. */
::rtl::OString readCharArray( sal_uInt16 nChars );
/** Reads nChar byte characters and returns the string. */
::rtl::OUString readCharArray( sal_uInt16 nChars, rtl_TextEncoding eTextEnc );
- /** Reads nChars Unicode characters and returns the string. */
- ::rtl::OUString readUnicodeArray( sal_uInt16 nChars );
-
- // byte strings -----------------------------------------------------------
- /** Reads 8/16 bit string length, character array and returns the string. */
+ /** Reads 8/16 bit string length and character array, and returns the string. */
::rtl::OString readByteString( bool b16BitLen );
- /** Reads 8/16 bit string length, character array and returns the string. */
+ /** Reads 8/16 bit string length and character array, and returns the string. */
::rtl::OUString readByteString( bool b16BitLen, rtl_TextEncoding eTextEnc );
- /** Ignores 8/16 bit string length, character array. */
+ /** Ignores 8/16 bit string length and character array. */
void skipByteString( bool b16BitLen );
// Unicode strings --------------------------------------------------------
- /** Sets a replacement character for NUL characters read in Unicode strings.
-
- NUL characters should be replaced to prevent problems with string
- handling. The substitution character is reset to BIFF_DEF_NUL_SUBST_CHAR
- automatically, if a new record is started using the function
- startNextRecord().
-
- @param cNulSubst
- The character to use for NUL replacement. It is possible to specify
- NUL here. in this case strings are terminated when the first NUL
- occurs during string import.
- */
- inline void setNulSubstChar( sal_Unicode cNulSubst = BIFF_DEF_NUL_SUBST_CHAR )
- { mcNulSubst = cNulSubst; }
-
- /** Reads extended unicode string header.
-
- Detects 8/16-bit mode and all extended info, and seeks to begin of
- the character array.
-
- @return Total size of extended string data (formatting and phonetic).
- */
- sal_uInt32 readExtendedUniStringHeader(
- bool& rb16Bit, bool& rbFonts, bool& rbPhonetic,
- sal_uInt16& rnFontCount, sal_uInt32& rnPhoneticSize,
- sal_uInt8 nFlags );
-
- /** Reads extended unicode string header.
-
- Detects 8/16-bit mode and seeks to begin of the character array.
-
- @return Total size of extended data.
- */
- sal_uInt32 readExtendedUniStringHeader(
- bool& rb16Bit, sal_uInt8 nFlags );
+ /** Reads nChars Unicode characters and returns the string. */
+ ::rtl::OUString readUnicodeArray( sal_uInt16 nChars );
/** Reads nChars characters of a BIFF8 string, and returns the string. */
- ::rtl::OUString readRawUniString( sal_uInt16 nChars, bool b16Bit );
- /** Reads extended header, nChar characters, extended data of a BIFF8
- string, and returns the string. */
- ::rtl::OUString readUniString( sal_uInt16 nChars, sal_uInt8 nFlags );
+ ::rtl::OUString readUniStringChars( sal_uInt16 nChars, bool b16Bit );
/** Reads 8 bit flags, extended header, nChar characters, extended data of
a BIFF8 string, and returns the string. */
::rtl::OUString readUniString( sal_uInt16 nChars );
@@ -394,9 +367,7 @@ public:
::rtl::OUString readUniString();
/** Ignores nChars characters of a BIFF8 string. */
- void skipRawUniString( sal_uInt16 nChars, bool b16Bit );
- /** Ignores extended header, nChar characters, extended data of a BIFF8 string. */
- void skipUniString( sal_uInt16 nChars, sal_uInt8 nFlags );
+ void skipUniStringChars( sal_uInt16 nChars, bool b16Bit );
/** Ignores 8 bit flags, extended header, nChar characters, extended data
of a BIFF8 string. */
void skipUniString( sal_uInt16 nChars );
@@ -439,6 +410,11 @@ private:
/** Returns the maximum size of raw data possible to read in one block. */
sal_uInt16 getMaxRawReadSize( sal_uInt32 nBytes ) const;
+ /** Reads an array of Unicode characters and appends them to the passed buffer. */
+ void appendUnicodeArray( ::rtl::OUStringBuffer& orBuffer, sal_uInt16 nChars, bool b16Bit );
+ /** Reads the BIFF8 Unicode string header fields. */
+ void readUniStringHeader( bool& orb16Bit, sal_uInt32& ornAddSize );
+
private:
prv::BiffInputRecordBuffer maRecBuffer; /// Raw record data buffer.
@@ -450,9 +426,8 @@ private:
sal_uInt32 mnComplRecSize; /// Size of complete record data (with CONTINUEs).
bool mbHasComplRec; /// True = mnComplRecSize is valid.
- sal_Unicode mcNulSubst; /// Replacement for NUL characters.
-
bool mbCont; /// True = automatic CONTINUE lookup enabled.
+ bool mbNulChars; /// True = import NUL characters.
bool mbValid; /// True = last stream operation successful (no overread).
};
@@ -474,6 +449,32 @@ inline BiffInputStream& operator>>( BiffInputStream& rStrm, Type& ornValue )
// ============================================================================
+class BiffInputStreamPos
+{
+public:
+ explicit BiffInputStreamPos( BiffInputStream& rStrm );
+
+ bool restorePosition();
+
+ inline BiffInputStream& getStream() { return mrStrm; }
+
+private:
+ BiffInputStream& mrStrm;
+ sal_Int64 mnRecHandle;
+ sal_uInt32 mnRecPos;
+};
+
+// ============================================================================
+
+class BiffInputStreamGuard : private BiffInputStreamPos
+{
+public:
+ explicit BiffInputStreamGuard( BiffInputStream& rStrm );
+ ~BiffInputStreamGuard();
+};
+
+// ============================================================================
+
} // namespace xls
} // namespace oox
diff --git a/oox/inc/oox/xls/defnamesbuffer.hxx b/oox/inc/oox/xls/defnamesbuffer.hxx
index de3608d06c6e..7863faabd0b3 100644
--- a/oox/inc/oox/xls/defnamesbuffer.hxx
+++ b/oox/inc/oox/xls/defnamesbuffer.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: defnamesbuffer.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: rt $ $Date: 2008-01-17 08:05:48 $
+ * last change: $Author: kz $ $Date: 2008-03-05 18:02:56 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -47,6 +47,9 @@ namespace com { namespace sun { namespace star {
namespace oox {
namespace xls {
+class FormulaContext;
+class BiffInputStreamPos;
+
// ============================================================================
// codes for built-in names
@@ -73,6 +76,7 @@ struct OoxDefinedNameData
::rtl::OUString maName; /// The original name.
::rtl::OUString maFormula; /// The formula string.
sal_Int32 mnSheet; /// Sheet index for local names.
+ sal_Int32 mnFuncGroupId; /// Function group identifier.
bool mbMacro; /// True = Macro name (VBasic or sheet macro).
bool mbFunction; /// True = function, false = command.
bool mbVBName; /// True = VBasic macro, false = sheet macro.
@@ -83,8 +87,6 @@ struct OoxDefinedNameData
// ============================================================================
-class FormulaContext;
-
/** Base class for defined names and external names. */
class DefinedNameBase : public WorkbookHelper
{
@@ -158,15 +160,14 @@ private:
private:
typedef ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange > XNamedRangeRef;
- typedef ::std::auto_ptr< RecordDataSequence > RecordDataSequencePtr;
+ typedef ::std::auto_ptr< RecordDataSequence > RecordDataSeqPtr;
+ typedef ::std::auto_ptr< BiffInputStreamPos > BiffStreamPosPtr;
XNamedRangeRef mxNamedRange; /// XNamedRange interface of the defined name.
sal_Int32 mnTokenIndex; /// Name index used in API token array.
sal_Unicode mcBuiltinId; /// Identifier for built-in defined names.
- RecordDataSequencePtr mxFormula; /// Formula data for OOBIN import.
- BiffInputStream* mpStrm; /// Cached BIFF stream for formula import.
- sal_Int64 mnRecHandle; /// Cached BIFF record handle for formula import.
- sal_uInt32 mnRecPos; /// Cached BIFF record position for formula import.
+ RecordDataSeqPtr mxFormula; /// Formula data for OOBIN import.
+ BiffStreamPosPtr mxBiffStrm; /// Cached BIFF stream for formula import.
sal_uInt16 mnFmlaSize; /// Cached BIFF formula size for formula import.
};