diff options
Diffstat (limited to 'sc/source/filter/inc')
42 files changed, 1556 insertions, 785 deletions
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx index c12705f29523..984e6c001cc8 100644 --- a/sc/source/filter/inc/XclExpChangeTrack.hxx +++ b/sc/source/filter/inc/XclExpChangeTrack.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XclExpChangeTrack.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:20:39 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:04:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/XclImpChangeTrack.hxx b/sc/source/filter/inc/XclImpChangeTrack.hxx index 2687d934ea83..309f1d532a19 100644 --- a/sc/source/filter/inc/XclImpChangeTrack.hxx +++ b/sc/source/filter/inc/XclImpChangeTrack.hxx @@ -2,9 +2,9 @@ * * $RCSfile: XclImpChangeTrack.hxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:04:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/colrowst.hxx b/sc/source/filter/inc/colrowst.hxx index 22054edc126f..313a2eac48a5 100644 --- a/sc/source/filter/inc/colrowst.hxx +++ b/sc/source/filter/inc/colrowst.hxx @@ -2,9 +2,9 @@ * * $RCSfile: colrowst.hxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:20:41 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:04:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/dif.hxx b/sc/source/filter/inc/dif.hxx index 3fae570e6e1c..bc71287788ad 100644 --- a/sc/source/filter/inc/dif.hxx +++ b/sc/source/filter/inc/dif.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dif.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:12 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:04:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,15 +86,17 @@ class SvNumberFormatter; class ScDocument; class ScPatternAttr; -extern const sal_Char* pKeyTABLE; -extern const sal_Char* pKeyVECTORS; -extern const sal_Char* pKeyTUPLES; -extern const sal_Char* pKeyDATA; -extern const sal_Char* pKeyBOT; -extern const sal_Char* pKeyEOD; -extern const sal_Char* pKeyTRUE; -extern const sal_Char* pKeyFALSE; -extern const sal_Char* pKeyNA; +extern const sal_Unicode pKeyTABLE[]; +extern const sal_Unicode pKeyVECTORS[]; +extern const sal_Unicode pKeyTUPLES[]; +extern const sal_Unicode pKeyDATA[]; +extern const sal_Unicode pKeyBOT[]; +extern const sal_Unicode pKeyEOD[]; +extern const sal_Unicode pKeyTRUE[]; +extern const sal_Unicode pKeyFALSE[]; +extern const sal_Unicode pKeyNA[]; +extern const sal_Unicode pKeyV[]; +extern const sal_Unicode pKey1_0[]; enum TOPIC @@ -112,7 +114,7 @@ enum DATASET { D_BOT, D_EOD, D_NUMERIC, D_STRING, D_UNKNOWN, D_SYNT_ERROR }; class DifParser { public: - ByteString aData; + String aData; double fVal; UINT32 nVector; UINT32 nVal; @@ -122,31 +124,10 @@ private: SvNumberFormatter* pNumFormatter; SvStream& rIn; BOOL bPlain; -#if __ALIGNMENT4 == 1 - static UINT32 nBOT; - static UINT32 nEOD; - static UINT32 n1_0; - static UINT16 nV; -#else - static sal_Char cBOT_0; - static sal_Char cEOD_0; - static sal_Char c1_0_0; - static sal_Char cBOT_1; - static sal_Char cEOD_1; - static sal_Char c1_0_1; - static sal_Char cBOT_2; - static sal_Char cEOD_2; - static sal_Char c1_0_2; - static sal_Char cBOT_3; - static sal_Char cEOD_3; - static sal_Char c1_0_3; - static sal_Char cV_0; - static sal_Char cV_1; -#endif - static inline BOOL IsBOT( const sal_Char* pRef ); - static inline BOOL IsEOD( const sal_Char* pRef ); - static inline BOOL Is1_0( const sal_Char* pRef ); + static inline BOOL IsBOT( const sal_Unicode* pRef ); + static inline BOOL IsEOD( const sal_Unicode* pRef ); + static inline BOOL Is1_0( const sal_Unicode* pRef ); public: DifParser( SvStream&, const UINT32 nOption, ScDocument&, CharSet ); @@ -154,75 +135,59 @@ public: DATASET GetNextDataset( void ); - const sal_Char* ScanIntVal( const sal_Char* pStart, UINT32& rRet ); - BOOL ScanFloatVal( const sal_Char* pStart ); + const sal_Unicode* ScanIntVal( const sal_Unicode* pStart, UINT32& rRet ); + BOOL ScanFloatVal( const sal_Unicode* pStart ); - inline BOOL IsNumber( const sal_Char cChar ); - inline BOOL IsNumberEnding( const sal_Char cChar ); + inline BOOL IsNumber( const sal_Unicode cChar ); + inline BOOL IsNumberEnding( const sal_Unicode cChar ); - static inline BOOL IsV( const sal_Char* pRef ); + static inline BOOL IsV( const sal_Unicode* pRef ); inline BOOL IsPlain( void ) const; }; -inline BOOL DifParser::IsBOT( const sal_Char* pRef ) +inline BOOL DifParser::IsBOT( const sal_Unicode* pRef ) { -#if __ALIGNMENT4 == 1 - return ( nBOT == *( ( UINT32* ) pRef ) ); -#else - return ( pRef[ 0 ] == cBOT_0 && - pRef[ 1 ] == cBOT_1 && - pRef[ 2 ] == cBOT_2 && - pRef[ 3 ] == cBOT_3 ); -#endif + return ( pRef[ 0 ] == pKeyBOT[0] && + pRef[ 1 ] == pKeyBOT[1] && + pRef[ 2 ] == pKeyBOT[2] && + pRef[ 3 ] == pKeyBOT[3] ); } -inline BOOL DifParser::IsEOD( const sal_Char* pRef ) +inline BOOL DifParser::IsEOD( const sal_Unicode* pRef ) { -#if __ALIGNMENT4 == 1 - return ( nEOD == *( ( UINT32* ) pRef ) ); -#else - return ( pRef[ 0 ] == cEOD_0 && - pRef[ 1 ] == cEOD_1 && - pRef[ 2 ] == cEOD_2 && - pRef[ 3 ] == cEOD_3 ); -#endif + return ( pRef[ 0 ] == pKeyEOD[0] && + pRef[ 1 ] == pKeyEOD[1] && + pRef[ 2 ] == pKeyEOD[2] && + pRef[ 3 ] == pKeyEOD[3] ); } -inline BOOL DifParser::Is1_0( const sal_Char* pRef ) +inline BOOL DifParser::Is1_0( const sal_Unicode* pRef ) { -#if __ALIGNMENT4 == 1 - return ( n1_0 == *( ( UINT32* ) pRef ) ); -#else - return ( pRef[ 0 ] == c1_0_0 && - pRef[ 1 ] == c1_0_1 && - pRef[ 2 ] == c1_0_2 && - pRef[ 3 ] == c1_0_3 ); -#endif + return ( pRef[ 0 ] == pKey1_0[0] && + pRef[ 1 ] == pKey1_0[1] && + pRef[ 2 ] == pKey1_0[2] && + pRef[ 3 ] == pKey1_0[3] ); } -inline BOOL DifParser::IsV( const sal_Char* pRef ) +inline BOOL DifParser::IsV( const sal_Unicode* pRef ) { -#if __ALIGNMENT4 == 1 - return ( nV == *( ( UINT16 * ) pRef ) ); -#else - return ( pRef[ 0 ] == cV_0 && - pRef[ 1 ] == cV_1 ); -#endif + return ( pRef[ 0 ] == pKeyV[0] && + pRef[ 1 ] == pKeyV[1] ); } -inline BOOL DifParser::IsNumber( const sal_Char cChar ) +inline BOOL DifParser::IsNumber( const sal_Unicode cChar ) { return ( cChar >= '0' && cChar <= '9' ); } -inline BOOL DifParser::IsNumberEnding( const sal_Char cChar ) +inline BOOL DifParser::IsNumberEnding( const sal_Unicode cChar ) { return ( cChar == 0x00 ); } diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx index 90384518866d..e9b482a65f37 100644 --- a/sc/source/filter/inc/eeparser.hxx +++ b/sc/source/filter/inc/eeparser.hxx @@ -2,9 +2,9 @@ * * $RCSfile: eeparser.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:12 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:04:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -120,13 +120,21 @@ struct ScEEParseEntry USHORT nOffset; // HTML PixelOffset USHORT nWidth; // HTML PixelWidth BOOL bHasGraphic; // HTML any image loaded + bool bEntirePara; // TRUE = use entire paragraph, false = use selection ScEEParseEntry( SfxItemPool* pPool ) : aItemSet( *pPool ), pValStr( NULL ), pNumStr( NULL ), pName( NULL ), pImageList( NULL ), nCol((USHORT)~0), nRow((USHORT)~0), nTab(0), nColOverlap(1), nRowOverlap(1), - nOffset(0), nWidth(0), bHasGraphic(FALSE) + nOffset(0), nWidth(0), bHasGraphic(FALSE), bEntirePara(true) + {} + ScEEParseEntry( const SfxItemSet& rItemSet ) : + aItemSet( rItemSet ), pValStr( NULL ), + pNumStr( NULL ), pName( NULL ), pImageList( NULL ), + nCol((USHORT)~0), nRow((USHORT)~0), nTab(0), + nColOverlap(1), nRowOverlap(1), + nOffset(0), nWidth(0), bHasGraphic(FALSE), bEntirePara(true) {} ~ScEEParseEntry() { diff --git a/sc/source/filter/inc/excdefs.hxx b/sc/source/filter/inc/excdefs.hxx index 1aca20f52dcc..58fc05d568e7 100644 --- a/sc/source/filter/inc/excdefs.hxx +++ b/sc/source/filter/inc/excdefs.hxx @@ -2,9 +2,9 @@ * * $RCSfile: excdefs.hxx,v $ * - * $Revision: 1.36 $ + * $Revision: 1.37 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:20:41 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:04:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,11 +70,6 @@ #define EXC_TABBUF_INVALID 0xFFFF -// Style info ================================================================= - -#define EXC_ROT_STACKED 0xFF - - // (0x001C) NOTE ============================================================== #define EXC_NOTE5_MAXTEXT 2048 diff --git a/sc/source/filter/inc/excdoc.hxx b/sc/source/filter/inc/excdoc.hxx index b79baa869e4a..a1be69b8de34 100644 --- a/sc/source/filter/inc/excdoc.hxx +++ b/sc/source/filter/inc/excdoc.hxx @@ -2,9 +2,9 @@ * * $RCSfile: excdoc.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:20:41 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:04:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/excform.hxx b/sc/source/filter/inc/excform.hxx index d787fd48fca3..f6423f171812 100644 --- a/sc/source/filter/inc/excform.hxx +++ b/sc/source/filter/inc/excform.hxx @@ -2,9 +2,9 @@ * * $RCSfile: excform.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:20:42 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:04:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,7 +63,7 @@ #ifndef _EXCFORM_HXX #define _EXCFORM_HXX -#ifndef _XLTOOLS_HXX +#ifndef SC_XLTOOLS_HXX #include "xltools.hxx" #endif diff --git a/sc/source/filter/inc/excimp8.hxx b/sc/source/filter/inc/excimp8.hxx index 4eee3395e38a..4f2812158d9e 100644 --- a/sc/source/filter/inc/excimp8.hxx +++ b/sc/source/filter/inc/excimp8.hxx @@ -2,9 +2,9 @@ * * $RCSfile: excimp8.hxx,v $ * - * $Revision: 1.45 $ + * $Revision: 1.46 $ * - * last change: $Author: jmarmion $ $Date: 2002-12-10 14:05:37 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -107,8 +107,6 @@ class XclImpAutoFilterBuffer; class XclImpWebQueryBuffer; -class FilterProgressBar; - class ExcCondForm : private ExcRoot, private XclImpRoot @@ -151,9 +149,6 @@ class ExcCondFormList : protected List class ImportExcel8 : public ImportExcel { protected: - XclImpObjectManager aObjManager; - BOOL bObjSection; - ExcScenarioList aScenList; XclImpPivotTableList aPivotTabList; @@ -165,6 +160,8 @@ class ImportExcel8 : public ImportExcel XclImpAutoFilterBuffer* pAutoFilterBuffer; // ranges for autofilter and advanced filter + BOOL bObjSection; + BOOL bHasBasic; BOOL bFirstScl; // only one Scl-Record has to be read per chart! @@ -225,9 +222,7 @@ class ImportExcel8 : public ImportExcel virtual void EndAllChartObjects( void ); // -> excobj.cxx virtual void PostDocLoad( void ); - virtual FltError ReadChart8( ScfProgressBar&, const BOOL bOwnTab ); - void CreateTmpCtrlStorage( void ); - // if possible generate a SvxMSConvertOCXControls compatibel storage + virtual FltError ReadChart8( ScfSimpleProgressBar&, const BOOL bOwnTab ); public: ImportExcel8( @@ -256,10 +251,15 @@ private: BOOL bActive; BOOL bHasDropDown; BOOL bHasConflict; + BOOL bCriteria; + BOOL bAutoOrAdvanced; + ScRange aCriteriaRange; + String aFilterName; void CreateFromDouble( String& rStr, double fVal ); void SetCellAttribs(); void InsertQueryParam(); + void AmendAFName(const BOOL bUseUnNamed); protected: public: @@ -280,13 +280,18 @@ public: inline void Activate() { bActive = TRUE; } void SetAdvancedRange( const ScRange* pRange ); void SetExtractPos( const ScAddress& rAddr ); - void Apply(); + inline void SetAutoOrAdvanced() { bAutoOrAdvanced = TRUE; } + void Apply( const BOOL bUseUnNamed = FALSE ); + void CreateScDBData( const BOOL bUseUnNamed ); + void EnableRemoveFilter(); }; class XclImpAutoFilterBuffer : private List { private: + UINT16 nAFActiveCount; + inline XclImpAutoFilterData* _First() { return (XclImpAutoFilterData*) List::First(); } inline XclImpAutoFilterData* _Next() { return (XclImpAutoFilterData*) List::Next(); } @@ -294,6 +299,7 @@ private: { List::Insert( pData, LIST_APPEND ); } protected: public: + XclImpAutoFilterBuffer(); virtual ~XclImpAutoFilterBuffer(); void Insert( RootData* pRoot, const ScRange& rRange, @@ -304,6 +310,8 @@ public: XclImpAutoFilterData* GetByTab( UINT16 nTab ); BOOL HasDropDown( UINT16 nCol, UINT16 nRow, UINT16 nTab ); + inline void IncrementActiveAF() { nAFActiveCount++; } + inline BOOL UseUnNamed() { return nAFActiveCount == 1; } }; diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx index 897f8b80d676..d2487e6eaa46 100644 --- a/sc/source/filter/inc/excrecds.hxx +++ b/sc/source/filter/inc/excrecds.hxx @@ -2,9 +2,9 @@ * * $RCSfile: excrecds.hxx,v $ * - * $Revision: 1.30 $ + * $Revision: 1.31 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -354,34 +354,6 @@ public: }; -//--------------------------------------------------------- class ExcDummy_XF - -// Ersatz fuer Default XF Records - -class ExcDummy_XF : public ExcDummyRec -{ -private: - static const BYTE pMyData[]; - static const ULONG nMyLen; -public: - virtual ULONG GetLen( void ) const; - virtual const BYTE* GetData( void ) const; -}; - - -//------------------------------------------------------ class ExcDummy_Style - -// Ersatz fuer Default Style Records - -class ExcDummy_Style : public ExcDummyRec -{ -private: - static const BYTE pMyData[]; - static const ULONG nMyLen; -public: - virtual ULONG GetLen( void ) const; - virtual const BYTE* GetData( void ) const; -}; - - //------------------------------------------------------ class ExcBundlesheet - class ExcBundlesheetBase : public ExcRecord @@ -493,8 +465,7 @@ protected: const ScAddress rPos, const ScPatternAttr* pAttr, RootData& rRootData, - const ULONG nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND, - BOOL bForceAltNumForm = FALSE ); + const ULONG nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND ); virtual void SaveCont( XclExpStream& rStrm ); virtual void SaveDiff( XclExpStream& rStrm ); @@ -697,6 +668,21 @@ public: virtual UINT16 GetNum( void ) const; }; +/*----------------------------------------------------------------------*/ + +class ExcFmlaResultStr : public XclExpRecord +{ +private: + XclExpString maResultText; + +public: + + ExcFmlaResultStr(const XclExpString &aFmlaText); + virtual ~ExcFmlaResultStr(); + +private: + virtual void WriteBody( XclExpStream& rStrm ); +}; //---------------------------------------------------------- class ExcFormula - @@ -706,6 +692,7 @@ private: sal_Char* pData; UINT16 nFormLen; BOOL bShrdFmla; + ScFormulaCell* pFCell; virtual void SaveDiff( XclExpStream& rStrm ); // instead of SaveCont() virtual ULONG GetDiffLen( void ) const; @@ -716,12 +703,13 @@ public: const ScPatternAttr *pAttr, RootData& rRootData, const ULONG nAltNumForm, - BOOL bForceAltNumForm, const ScTokenArray& rCode, ExcArray** ppArray = NULL, ScMatrixMode eMM = MM_NONE, ExcShrdFmla** ppShrdFmla = NULL, - ExcArrays* pShrdFmlas = NULL ); + ExcArrays* pShrdFmlas = NULL, + ScFormulaCell* pFCell = NULL, + ExcFmlaResultStr **pFormulaResult = NULL); ~ExcFormula(); inline const ScAddress& GetPosition() const { return aPos; } // from ExcCell @@ -729,6 +717,8 @@ public: void SetTableOp( USHORT nCol, USHORT nRow ); // for TableOp export virtual UINT16 GetNum( void ) const; + + static BYTE ScErrorCodeToExc(UINT16 nErrorCode); }; @@ -838,6 +828,7 @@ private: void SetName( const String& rRangeName ); void SetUniqueName( const String& rRangeName ); BOOL SetBuiltInName( const String& rName, UINT8 nKey ); + BOOL IsBuiltInAFName( const String& rName, UINT8 nKey ); virtual void SaveCont( XclExpStream& rStrm ); @@ -1076,7 +1067,6 @@ private: public: ExcColinfo( UINT16 nCol, UINT16 nTab, UINT16 nXF, RootData&, ExcEOutline& rOutline ); - void SetWidth( UINT16 nWidth, double fColScale ); // if expandable, delete rpExp and set to NULL void Expand( ExcColinfo*& rpExp ); @@ -1086,68 +1076,6 @@ public: }; -//--------------------------------------------------------------- class ExcXf - - -class ExcXf : public ExcRecord, protected XclExpRoot -{ -protected: - UINT16 nIfnt; - UINT16 nIfmt; - - UINT16 nOffs8; - - UINT32 nIcvForeSer; - UINT32 nIcvBackSer; - UINT16 nFls; - - UINT32 nIcvTopSer; - UINT32 nIcvBotSer; - UINT32 nIcvLftSer; - UINT32 nIcvRigSer; - - UINT16 nDgTop; - UINT16 nDgBottom; - UINT16 nDgLeft; - UINT16 nDgRight; - - XclHorAlign eAlc; - XclVerAlign eAlcV; - XclTextOrient eOri; - BOOL bFWrap; - BOOL bFSxButton; - - BOOL bStyle; - - BOOL bAtrNum; - BOOL bAtrFnt; - BOOL bAtrAlc; - BOOL bAtrBdr; - BOOL bAtrPat; - BOOL bAtrProt; - -#ifdef DBG_UTIL - static UINT16 nObjCnt; -#endif - - virtual void SaveCont( XclExpStream& rStrm ); - -public: - ExcXf( const XclExpRoot& rRoot, - UINT16 nFont, UINT16 nForm, const ScPatternAttr*, BOOL& rbLineBreak, - BOOL bStyle = FALSE ); - // rbLineBreak = TRUE erzwingt Wrap, - // return von rbLineBreak enthaelt immer tatsaechliches Wrap -#ifdef DBG_UTIL - virtual ~ExcXf(); -#endif - - virtual UINT16 GetNum( void ) const; - virtual ULONG GetLen( void ) const; - - static void ScToExcBorderLine( XclExpPalette& rPalette, const SvxBorderLine*, UINT32& rIcvSer, UINT16& rDg ); -}; - - //------------------------------------------------------ class ExcExterncount - class ExcExterncount : public ExcRecord, ExcRoot @@ -1250,68 +1178,6 @@ public: }; -//------------------------------------------------------------ class UsedList - - -class UsedList : public List, public ExcEmptyRec -{ -private: -protected: - UINT16 nBaseIndex; - -public: - inline UsedList() {} - - inline void SetBaseIndex( UINT16 nNewVal ) { nBaseIndex = nNewVal; } - - virtual void Save( XclExpStream& rStrm ); -}; - - -//-------------------------------------------------------- class UsedAttrList - -// a list of ENTRY structs - -class UsedAttrList : public UsedList, ExcRoot -{ -private: - struct ENTRY - { - const ScPatternAttr* pPattAttr; - ExcXf* pXfRec; - BOOL bLineBreak; - ULONG nAltNumForm; - - inline ENTRY() : nAltNumForm( NUMBERFORMAT_ENTRY_NOT_FOUND ), pXfRec( NULL ) {} - inline ~ENTRY() { if( pXfRec ) delete pXfRec; } - - inline BOOL Equal( const ScPatternAttr* p, const ULONG n ) const - { - return pPattAttr == p && nAltNumForm == n; - } - }; - - inline ENTRY* _First() { return (ENTRY*) List::First(); } - inline ENTRY* _Next() { return (ENTRY*) List::Next(); } - - XclExpFontBuffer& rFntLst; - XclExpNumFmtBuffer& rFrmLst; - - void AddNewXF( const ScPatternAttr* pAttr, - const BOOL bStyle, const BOOL bExplLineBreak, - const ULONG nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND, - BOOL bForceAltNumForm = FALSE ); - -public: - UsedAttrList( RootData* pRD ); - virtual ~UsedAttrList(); - UINT16 Find( const ScPatternAttr* pSearch, const BOOL bStyle = FALSE, - const ULONG nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND, - BOOL bForceAltNumForm = FALSE ); - UINT16 FindWithLineBreak( const ScPatternAttr* pSearch ); - - virtual void Save( XclExpStream& rStrm ); // overloaded to get ExcRecord from ENTRY -}; - - // XclExpWsbool =============================================================== class XclExpWsbool : public XclExpUInt16Record @@ -1685,6 +1551,7 @@ public: }; + //--------------------------- class XclExpTableOp, class XclExpTableOpManager - // multiple operations aka table operations (record TABLE) diff --git a/sc/source/filter/inc/exp_op.hxx b/sc/source/filter/inc/exp_op.hxx index 803bf2a200bc..4232eb93bde2 100644 --- a/sc/source/filter/inc/exp_op.hxx +++ b/sc/source/filter/inc/exp_op.hxx @@ -2,9 +2,9 @@ * * $RCSfile: exp_op.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:20:42 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/fapihelper.hxx b/sc/source/filter/inc/fapihelper.hxx index 28068cc40556..c2603a89c059 100644 --- a/sc/source/filter/inc/fapihelper.hxx +++ b/sc/source/filter/inc/fapihelper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fapihelper.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:08 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/filt_pch.hxx b/sc/source/filter/inc/filt_pch.hxx index 9a31b219d7df..cd34460dce80 100644 --- a/sc/source/filter/inc/filt_pch.hxx +++ b/sc/source/filter/inc/filt_pch.hxx @@ -2,9 +2,9 @@ * * $RCSfile: filt_pch.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dr $ $Date: 2001-10-18 14:55:34 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -348,8 +348,6 @@ #include <tools/urlobj.hxx> #include <svx/colritem.hxx> #include <vcl/wrkwin.hxx> -#include <fltprgrs.hxx> -#include <excsst.hxx> #include <excimp8.hxx> #include <excscen.hxx> #include <com/sun/star/frame/XFrameActionListener.hpp> diff --git a/sc/source/filter/inc/fprogressbar.hxx b/sc/source/filter/inc/fprogressbar.hxx index 8bfe4c50f8fb..a13096323656 100644 --- a/sc/source/filter/inc/fprogressbar.hxx +++ b/sc/source/filter/inc/fprogressbar.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fprogressbar.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:09 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,21 +64,89 @@ #ifndef SC_FPROGRESSBAR_HXX #define SC_FPROGRESSBAR_HXX +#include "globstr.hrc" + #ifndef SC_FTOOLS_HXX #include "ftools.hxx" #endif +class SfxObjectShell; class ScProgress; // ============================================================================ -/** Progress bar for complex progress representation. */ +/** Progress bar for complex progress representation. + @descr The progress bar contains one or more segments, each with customable + size. Each segment is represented by a unique identifier. While showing the + progress bar, several segments can be started simultaneously. The progress + bar displays the sum of all started segments on screen. + + It is possible to create a full featured ScfProgressBar object from + any segment. This sub progress bar works only on that parent segment, with + the effect, that if the sub progress bar reaches 100%, the parent segment is + filled completely. + + After adding segments, the progress bar has to be activated. In this step the + total size of all segments is calculated. Therefore it is not possible to add + more segments from here. + + If a sub progress bar is created from a segment, and the main progress bar + has been started (but not the sub progress bar), it is still possible to add + segments to the sub progress bar. It is not allowed to get the sub progress bar + of a started segment. And it is not allowed to modify the segment containing + a sub progress bar directly. + + Following a few code examples, how to use the progress bar. + + Example 1: Simple progress bar (see also ScfSimpleProgressBar below). + + ScfProgressBar aProgress( ... ); + sal_Int32 nSeg = aProgress.AddSegment( 50 ); // segment with 50 steps (1 step = 2%) + + aProgress.ActivateSegment( nSeg ); // start segment nSeg + aProgress.Progress(); // 0->1; display: 2% + aProgress.Progress( 9 ); // 1->9; display: 18% + + Example 2: Progress bar with 2 segments. + + ScfProgressBar aProgress( ... ); + sal_Int32 nSeg1 = aProgress.AddSegment( 70 ); // segment with 70 steps + sal_Int32 nSeg2 = aProgress.AddSegment( 30 ); // segment with 30 steps + // both segments: 100 steps (1 step = 1%) + + aProgress.ActivateSegment( nSeg1 ); // start first segment + aProgress.Progress(); // 0->1, display: 1% + aProgress.Progress( 3 ); // 1->3, display: 3% + aProgress.ActivateSegment( nSeg2 ); // start second segment + aProgress.Progress( 5 ); // 0->5, display: 8% (5+3 steps) + aProgress.ActivateSegment( nSeg1 ); // continue with first segment + aProgress.Progress(); // 3->4, display: 9% (5+4 steps) + + Example 3: Progress bar with 2 segments, one contains a sub progress bar. + + ScfProgressBar aProgress( ... ); + sal_Int32 nSeg1 = aProgress.AddSegment( 75 ); // segment with 75 steps + sal_Int32 nSeg2 = aProgress.AddSegment( 25 ); // segment with 25 steps + // both segments: 100 steps (1 step = 1%) + + aProgress.ActivateSegment( nSeg1 ); // start first segment + aProgress.Progress(); // 0->1, display: 1% + + ScfProgressBar& rSubProgress = aProgress.GetSegmentProgressBar( nSeg2 ); + // sub progress bar from second segment + sal_Int32 nSubSeg = rSubProgress.AddSegment( 5 ); // 5 steps, mapped to second segment + // => 1 step = 5 steps in parent = 5% + + rSubProgress.ActivateSegment( nSubSeg ); // start the segment (auto activate parent segment) + rSubProgress.Progress(); // 0->1 (0->5 in parent); display: 6% (1+5) + + // not allowed (second segment active): aProgress.Progress(); + // not allowed (first segment not empty): aProgress.GetSegmentProgressBar( nSeg1 ); + */ class ScfProgressBar : ScfNoCopy { private: - typedef ::std::auto_ptr< ScProgress > ScProgressPtr; - /** Contains all data of a segment of the progress bar. */ struct ScfProgressSegment { @@ -92,10 +160,14 @@ private: ~ScfProgressSegment(); }; - ScfDelList< ScfProgressSegment > maSegments; /// List of progress segments. + typedef ::std::auto_ptr< ScProgress > ScProgressPtr; + typedef ScfDelList< ScfProgressSegment > ScfSegmentList; + + ScfSegmentList maSegments; /// List of progress segments. String maText; /// UI string for system progress. ScProgressPtr mpSysProgress; /// System progress bar. + SfxObjectShell* mpDocShell; /// The document shell for the progress bar. ScfProgressBar* mpParentProgress; /// Parent progress bar, if this is a segment progress bar. ScfProgressSegment* mpParentSegment; /// Parent segment, if this is a segment progress bar. ScfProgressSegment* mpCurrSegment; /// Current segment for progress. @@ -107,24 +179,24 @@ private: bool mbInProgress; /// true = progress bar started. public: - /** Creates a system progress bar with a resource string. */ - explicit ScfProgressBar( const String& rText ); - ~ScfProgressBar(); + explicit ScfProgressBar( SfxObjectShell* pDocShell, const String& rText ); + explicit ScfProgressBar( SfxObjectShell* pDocShell, sal_uInt16 nResId ); + virtual ~ScfProgressBar(); /** Adds a new segment to the progress bar. @return the identifier of the segment. */ - sal_uInt32 AddSegment( sal_uInt32 nSize ); + sal_Int32 AddSegment( sal_uInt32 nSize ); /** Returns a complete progress bar for the specified segment. @descr The progress bar can be used to create sub segments inside of the segment. Do not delete it (done by root progress bar)! @return A reference to an ScfProgressBar connected to the segment. */ - ScfProgressBar& GetSegmentProgressBar( sal_uInt32 nSegment ); + ScfProgressBar& GetSegmentProgressBar( sal_Int32 nSegment ); /** Returns true, if any progress segment has been started. */ inline bool IsStarted() const { return mbInProgress; } /** Starts the progress bar or activates another segment. */ - void ActivateSegment( sal_uInt32 nSegment ); + void ActivateSegment( sal_Int32 nSegment ); /** Starts the progress bar (with first segment). */ inline void Activate() { ActivateSegment( 0 ); } /** Set current segment to the specified position. */ @@ -135,15 +207,16 @@ public: private: /** Used to create sub progress bars. */ explicit ScfProgressBar( - ScfProgressBar* pParProgress, + ScfProgressBar& rParProgress, ScfProgressSegment* pParSegment ); - /** Returns the segment specified by list index. */ - ScfProgressSegment* GetSegment( sal_uInt32 nSegment ) const; + /** Initializes all members on construction. */ + void Init( SfxObjectShell* pDocShell ); + /** Returns the segment specified by list index. */ + ScfProgressSegment* GetSegment( sal_Int32 nSegment ) const; /** Activates progress bar and sets current segment. */ void SetCurrSegment( ScfProgressSegment* pSegment ); - /** Increases mnTotalPos and calls the system progress bar. */ void IncreaseProgressBar( sal_uInt32 nDelta ); }; @@ -151,5 +224,52 @@ private: // ============================================================================ +/** A simplified progress bar with only one segment. */ +class ScfSimpleProgressBar +{ +private: + ScfProgressBar maProgress; /// The used progress bar. + +public: + explicit ScfSimpleProgressBar( sal_uInt32 nSize, SfxObjectShell* pDocShell, const String& rText ); + explicit ScfSimpleProgressBar( sal_uInt32 nSize, SfxObjectShell* pDocShell, sal_uInt16 nResId ); + + /** Set progress bar to the specified position. */ + inline void Progress( sal_uInt32 nPos ) { maProgress.Progress( nPos ); } + /** Increase progress bar by 1. */ + inline void Progress() { maProgress.Progress(); } + +private: + /** Initializes and starts the progress bar. */ + void Init( sal_uInt32 nSize ); +}; + + +// ============================================================================ + +/** A simplified progress bar based on the stream position of an existing stream. */ +class ScfStreamProgressBar +{ +private: + typedef ::std::auto_ptr< ScfSimpleProgressBar > ScfSimpleProgressBarPtr; + + ScfSimpleProgressBarPtr mpProgress; /// The used progress bar. + SvStream& mrStrm; /// The used stream. + +public: + explicit ScfStreamProgressBar( SvStream& rStrm, SfxObjectShell* pDocShell, const String& rText ); + explicit ScfStreamProgressBar( SvStream& rStrm, SfxObjectShell* pDocShell, sal_uInt16 nResId = STR_LOAD_DOC ); + + /** Sets the progress bar to the current stream position. */ + void Progress(); + +private: + /** Initializes and starts the progress bar. */ + void Init( SfxObjectShell* pDocShell, const String& rText ); +}; + + +// ============================================================================ + #endif diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index 86c8c4798ec4..31545eebe12e 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ftools.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:09 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,13 +83,12 @@ #include <memory> -class SvStream; - - // Global static helpers ====================================================== -/** Returns the size of a STATIC data array. */ +/** Expands to the size of a STATIC data array. */ #define STATIC_TABLE_SIZE( array ) (sizeof(array)/sizeof(*(array))) +/** Expands to a pointer behind the last element of a STATIC data array (like STL end()). */ +#define STATIC_TABLE_END( array ) ((array)+STATIC_TABLE_SIZE(array)) // Read from bitfields -------------------------------------------------------- @@ -130,8 +129,8 @@ inline void set_flag( Type& rnBitField, Type nMask, bool bSet = true ) template< typename Type, typename InsertType > void insert_value( Type& rnBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount ) { - Type nMask = ((1UL << nBitCount) - 1); - Type nNewValue = static_cast< Type >( nValue ) & nMask; + sal_uInt32 nMask = ((1UL << nBitCount) - 1); + Type nNewValue = static_cast< Type >( nValue & nMask ); (rnBitField &= ~(nMask << nStartBit)) |= (nNewValue << nStartBit); } @@ -196,15 +195,13 @@ class ScfNoInstance : private ScfNoCopy {}; // ============================================================================ +class SvStorage; +class SvStorageStreamRef; +class SvStream; + /** Contains static methods used anywhere in the filters. */ class ScfTools : ScfNoInstance { -private: - static const String maHTMLDoc; /// Built-in name for an HTML document. - static const String maHTMLTables; /// Built-in name for all HTML tables. - static const String maHTMLTableIndex; /// Built-in prefix for an HTML table index. - static const String maHTMLTableName; /// Built-in prefix for an HTML table name. - public: // *** common methods *** @@ -232,22 +229,35 @@ public: // *** conversion of names *** - /** Converts an Excel name to a valid Calc name. - @param bKeepPeriod false = '.' will be converted to '_'; true = '.' leaves unmodified. */ - static void ConvertName( String& rName, bool bKeepPeriod = false ); + /** Converts an external name to a valid Calc sheet name. + @descr Sheet names in Calc may contain letters, digits, underscores, and spaces + (space characters are not allowed at first position). */ + static void ConvertToScSheetName( String& rName ); + /** Converts an external name 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. */ + static void ConvertToScDefinedName( String& rName ); + +// *** streams and storages *** + + /** Tries to open the stream with the specified name in the passed storage (read-only). */ + static const SvStorageStreamRef OpenStorageStreamRead( SvStorage* pStorage, const String& rStrmName ); + /** Tries to create or open a stream with the specified name in the passed storage (read/write). */ + static const SvStorageStreamRef OpenStorageStreamWrite( SvStorage* pStorage, const String& rStrmName ); // *** byte string import operations *** /** Reads and returns a zero terminted byte string. */ static ByteString ReadCString( SvStream& rStrm ); /** Reads and returns a zero terminted byte string. */ - static inline String ReadCString( SvStream& rStrm, CharSet eSrc ) + inline static String ReadCString( SvStream& rStrm, CharSet eSrc ) { return String( ReadCString( rStrm ), eSrc ); } /** Reads and returns a zero terminted byte string and decreases a stream counter. */ static ByteString ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft ); /** Reads and returns a zero terminted byte string and decreases a stream counter. */ - static inline String ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft, CharSet eSrc ) + inline static String ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft, CharSet eSrc ) { return String( ReadCString( rStrm, rnBytesLeft ), eSrc ); } /** Appends a zero terminted byte string. */ @@ -258,25 +268,29 @@ public: // *** HTML table names <-> named range names *** /** Returns the built-in range name for an HTML document. */ - static inline const String& GetHTMLDocName() { return maHTMLDoc; } + static const String& GetHTMLDocName(); /** Returns the built-in range name for all HTML tables. */ - static inline const String& GetHTMLTablesName() { return maHTMLTables; } + static const String& GetHTMLTablesName(); /** Returns the built-in range name for an HTML table, specified by table index. */ static String GetNameFromHTMLIndex( sal_uInt32 nIndex ); /** Returns the built-in range name for an HTML table, specified by table name. */ static String GetNameFromHTMLName( const String& rTabName ); /** Returns true, if rSource is the built-in range name for an HTML document. */ - static inline bool IsHTMLDocName( const String& rSource ) - { return rSource.EqualsIgnoreCaseAscii( maHTMLDoc ) == TRUE; } + static bool IsHTMLDocName( const String& rSource ); /** Returns true, if rSource is the built-in range name for all HTML tables. */ - static inline bool IsHTMLTablesName( const String& rSource ) - { return rSource.EqualsIgnoreCaseAscii( maHTMLTables ) == TRUE; } + static bool IsHTMLTablesName( const String& rSource ); /** Converts a built-in range name to an HTML table name. @param rSource The string to be determined. @param rName The HTML table name. @return true, if conversion was successful. */ static bool GetHTMLNameFromName( const String& rSource, String& rName ); + +private: + /** Returns the prefix for table index names. */ + static const String& GetHTMLIndexPrefix(); + /** Returns the prefix for table names. */ + static const String& GetHTMLNamePrefix(); }; diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx index 541d158d2939..73563659e433 100644 --- a/sc/source/filter/inc/htmlpars.hxx +++ b/sc/source/filter/inc/htmlpars.hxx @@ -2,9 +2,9 @@ * * $RCSfile: htmlpars.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dr $ $Date: 2001-04-06 12:38:30 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,12 +66,43 @@ #include <tools/stack.hxx> #endif +#include <memory> +#include <vector> +#include <list> +#include <map> + #include "rangelst.hxx" #include "eeparser.hxx" -#define SC_HTML_FONTSIZES 7 // wie Export, HTML-Options +const sal_uInt32 SC_HTML_FONTSIZES = 7; // wie Export, HTML-Options #define SC_HTML_OFFSET_TOL 10 // Pixeltoleranz fuer SeekOffset +// ============================================================================ +// BASE class for HTML parser classes +// ============================================================================ + +class ScHTMLTable; + +/** Base class for HTML parser classes. */ +class ScHTMLParser : public ScEEParser +{ +protected: + sal_uInt32 maFontHeights[ SC_HTML_FONTSIZES ]; + ScDocument* mpDoc; /// The destination document. + +public: + explicit ScHTMLParser( EditEngine* pEditEngine, ScDocument* pDoc ); + virtual ~ScHTMLParser(); + + virtual sal_uInt32 Read( SvStream& rStrm ) = 0; + + /** Returns the "global table" which contains the entire HTML document. */ + virtual const ScHTMLTable* GetGlobalTable() const = 0; +}; + + +// ============================================================================ + SV_DECL_VARARR_SORT( ScHTMLColOffset, ULONG, 16, 4); struct ScHTMLTableStackEntry @@ -123,161 +154,20 @@ struct ScHTMLAdjustStackEntry DECLARE_STACK( ScHTMLAdjustStack, ScHTMLAdjustStackEntry* ); -//------------------------------------------------------------------------ - -enum ScHTMLTableDataKey { tdCol, tdRow }; - -class ScHTMLTableDataTable; - -class ScHTMLTableData // data for one HTML table -{ -private: - String aTableName; // <TABLE ID="name"> - Table aColCount; // count of cells per HTML column - Table aRowCount; // count of cells per HTML row - USHORT nFirstCol; // first column index - USHORT nFirstRow; // first row index - USHORT nLastCol; // last column index - USHORT nLastRow; // last row index - USHORT nColSpan; // column spanning of the parent cell - USHORT nRowSpan; // row spanning of the parent cell - USHORT nDocCol; // resulting position in ScDoc - USHORT nDocRow; // resulting position in ScDoc - BOOL bBorderOn; // table borders - - ScHTMLTableDataTable* pNestedTables; // table of nested HTML tables - - inline Table& GetDataTable( ScHTMLTableDataKey eCRKey ) - { return (eCRKey == tdCol) ? aColCount : aRowCount; } - inline const Table& GetDataTable( ScHTMLTableDataKey eCRKey ) const - { return (eCRKey == tdCol) ? aColCount : aRowCount; } - - static USHORT GetCount( const Table& rDataTab, ULONG nIndex ); - static USHORT GetSize( const Table& rDataTab, ULONG nStart, ULONG nEnd ); - - USHORT CalcDocPos( ScHTMLTableDataKey eCRKey, ULONG nIndex ) const; - USHORT CalcSpan( ScHTMLTableDataKey eCRKey, ULONG nIndex, USHORT nSpan ) const; - - void SetMaxCount( Table& rDataTab, ULONG nIndex, USHORT nCount ); - void ChangeDocCoord( short nColDiff, short nRowDiff ); - - void RecalcSizeDim( ScHTMLTableDataKey eCRKey ); - -public: - ScHTMLTableData( - const String& rTabName, - USHORT _nFirstCol, USHORT _nFirstRow, - USHORT _nColSpan, USHORT _nRowSpan, - BOOL bBorder ); - ~ScHTMLTableData(); - - inline USHORT GetFirstCol() const { return nFirstCol; } - inline USHORT GetFirstRow() const { return nFirstRow; } - inline USHORT GetLastCol() const { return nLastCol; } - inline USHORT GetLastRow() const { return nLastRow; } - inline const String& GetTableName() const { return aTableName; } - void GetRange( ScRange& rRange ) const; - - inline USHORT GetFirst( ScHTMLTableDataKey eCRKey ) const - { return (eCRKey == tdCol) ? nFirstCol : nFirstRow; } - inline USHORT GetLast( ScHTMLTableDataKey eCRKey ) const - { return (eCRKey == tdCol) ? nLastCol : nLastRow; } - inline USHORT GetDocPos( ScHTMLTableDataKey eCRKey ) const - { return (eCRKey == tdCol) ? nDocCol : nDocRow; } - inline USHORT GetSpan( ScHTMLTableDataKey eCRKey ) const - { return (eCRKey == tdCol) ? nColSpan : nRowSpan; } - inline USHORT GetCount( ScHTMLTableDataKey eCRKey, ULONG nIndex ) const - { return GetCount( GetDataTable( eCRKey ), nIndex ); } - inline USHORT GetSize( ScHTMLTableDataKey eCRKey ) const - { return GetSize( GetDataTable( eCRKey ), GetFirst( eCRKey ), GetLast( eCRKey ) ); } - - inline USHORT CalcDocCol( ULONG nIndex ) const { return CalcDocPos( tdCol, nIndex ); } - inline USHORT CalcDocRow( ULONG nIndex ) const { return CalcDocPos( tdRow, nIndex ); } - inline USHORT CalcColSpan( ULONG nIndex, USHORT nSpan ) const { return CalcSpan( tdCol, nIndex, nSpan ); } - inline USHORT CalcRowSpan( ULONG nIndex, USHORT nSpan ) const { return CalcSpan( tdRow, nIndex, nSpan ); } - - ScHTMLTableData* GetNestedTable( ULONG nTab ) const; - - ScHTMLTableData* InsertNestedTable( - ULONG nTab, const String& rTabName, - USHORT _nFirstCol, USHORT _nFirstRow, - USHORT _nColSpan, USHORT _nRowSpan, - BOOL bBorder ); - inline void SetCellCoord( USHORT nCol, USHORT nRow ); - void SetDocCoord( USHORT nCol, USHORT nRow ); - - void RecalcSize(); - void SetCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ); -}; - -inline void ScHTMLTableData::SetCellCoord( USHORT nCol, USHORT nRow ) -{ - nLastCol = Max( nLastCol, nCol ); - nLastRow = Max( nLastRow, nRow ); -} - - - -class ScHTMLTableDataTable : private Table -{ -private: - ScHTMLTableData* pCurrTab; - ULONG nCurrTab; - - USHORT nSearchMin1; - USHORT nSearchMin2; - ScHTMLTableDataKey eSearchKey; - - inline void _Insert( ULONG nTab, ScHTMLTableData* pTable ) - { Table::Insert( nTab, pTable ); } - - inline ScHTMLTableData* _Get( ULONG nTab ) const - { return (ScHTMLTableData*) Table::Get( nTab ); } - - inline void SetCurrTable( ULONG nTab, ScHTMLTableData* pTab ) - { nCurrTab = nTab; pCurrTab = pTab; } -public: - ScHTMLTableDataTable(); - virtual ~ScHTMLTableDataTable(); - - ScHTMLTableData* GetTable( ULONG nTab ); - inline ScHTMLTableData* GetFirst() { return (ScHTMLTableData*) Table::First(); } - inline ScHTMLTableData* GetNext() { return (ScHTMLTableData*) Table::Next(); } - ScHTMLTableData* GetFirstInOrder( ScHTMLTableDataKey eKey ); - ScHTMLTableData* GetNextInOrder(); - - USHORT GetNextFreeRow( ULONG nTab ); - - ScHTMLTableData* InsertTable( - ULONG nTab, const String& rTabName, - USHORT nFirstCol, USHORT nFirstRow, - USHORT nColSpan, USHORT nRowSpan, - BOOL bBorder, ULONG nNestedIn = 0 ); - void SetCellCoord( ULONG nTab, USHORT nCol, USHORT nRow ); - void RecalcSizes(); - - void Recalc(); - void SetCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ); -}; - -//------------------------------------------------------------------------ - +// ============================================================================ class EditEngine; class ScDocument; class HTMLOption; -class ScHTMLParser : public ScEEParser +class ScHTMLLayoutParser : public ScHTMLParser { private: - ULONG aFontHeights[SC_HTML_FONTSIZES]; + Size aPageSize; ScHTMLTableStack aTableStack; - Size aPageSize; // in Pixeln String aString; ScRangeListRef xLockedList; // je Table - ScDocument* pDoc; Table* pTables; - ScHTMLTableDataTable* pTableData; // data for each HTML table ScHTMLColOffset* pColOffset; ScHTMLColOffset* pLocalColOffset; // je Table ULONG nFirstTableCell; // je Table @@ -322,28 +212,450 @@ private: USHORT GetWidth( ScEEParseEntry* ); void SetWidths(); void Adjust(); - void AdjustNoWidthHeight(); USHORT GetWidthPixel( const HTMLOption* ); BOOL IsAtBeginningOfText( ImportInfo* ); void TableOn( ImportInfo* ); void ColOn( ImportInfo* ); + void TableRowOn( ImportInfo* ); + void TableRowOff( ImportInfo* ); void TableDataOn( ImportInfo* ); + void TableDataOff( ImportInfo* ); void TableOff( ImportInfo* ); void Image( ImportInfo* ); void AnchorOn( ImportInfo* ); void FontOn( ImportInfo* ); public: - ScHTMLParser( EditEngine*, const Size& aPageSize, - ScDocument*, BOOL _bCalcWidthHeight ); - virtual ~ScHTMLParser(); + ScHTMLLayoutParser( EditEngine*, const Size& aPageSize, ScDocument* ); + virtual ~ScHTMLLayoutParser(); virtual ULONG Read( SvStream& ); + virtual const ScHTMLTable* GetGlobalTable() const; +}; + + + +// ============================================================================ +// HTML DATA QUERY PARSER +// ============================================================================ + +/** Declares the orientation in or for a table: column or row. */ +enum ScHTMLOrient { tdCol = 0 , tdRow = 1 }; + +/** Type for a unique identifier for each table. */ +typedef sal_uInt16 ScHTMLTableId; +/** Identifier of the "global table" (the entire HTML document). */ +const ScHTMLTableId SC_HTML_GLOBAL_TABLE = 0; +/** Used as table index for normal (non-table) entries in ScHTMLEntry structs. */ +const ScHTMLTableId SC_HTML_NO_TABLE = 0; + + +// ============================================================================ + +/** A 2D cell position in an HTML table. */ +struct ScHTMLPos +{ + sal_uInt16 mnCol; + sal_uInt16 mnRow; + + inline explicit ScHTMLPos() : mnCol( 0 ), mnRow( 0 ) {} + inline explicit ScHTMLPos( sal_uInt16 nCol, sal_uInt16 nRow ) : + mnCol( nCol ), mnRow( nRow ) {} + inline explicit ScHTMLPos( const ScAddress& rAddr ) { Set( rAddr ); } + + inline sal_uInt16 Get( ScHTMLOrient eOrient ) const + { return (eOrient == tdCol) ? mnCol : mnRow; } + inline void Set( sal_uInt16 nCol, sal_uInt16 nRow ) + { mnCol = nCol; mnRow = nRow; } + inline void Set( const ScAddress& rAddr ) + { Set( rAddr.Col(), rAddr.Row() ); } + inline void Move( sal_Int16 nColDiff, sal_Int16 nRowDiff ) + { mnCol += nColDiff; mnRow += nRowDiff; } + inline ScAddress MakeAddr() const + { return ScAddress( mnCol, mnRow, 0 ); } +}; - ScHTMLTableDataTable* GetHTMLTables() const { return pTableData; } +inline bool operator==( const ScHTMLPos& rPos1, const ScHTMLPos& rPos2 ) +{ + return (rPos1.mnRow == rPos2.mnRow) && (rPos1.mnCol == rPos2.mnCol); +} + +inline bool operator<( const ScHTMLPos& rPos1, const ScHTMLPos& rPos2 ) +{ + return (rPos1.mnRow < rPos2.mnRow) || ((rPos1.mnRow == rPos2.mnRow) && (rPos1.mnCol < rPos2.mnCol)); +} + + +// ---------------------------------------------------------------------------- + +/** A 2D cell size in an HTML table. */ +struct ScHTMLSize +{ + sal_uInt16 mnCols; + sal_uInt16 mnRows; + + inline explicit ScHTMLSize() : mnCols( 0 ), mnRows( 0 ) {} + inline explicit ScHTMLSize( sal_uInt16 nCols, sal_uInt16 nRows ) : + mnCols( nCols ), mnRows( nRows ) {} + + inline sal_uInt16 Get( ScHTMLOrient eOrient ) const + { return (eOrient == tdCol) ? mnCols : mnRows; } + inline void Set( sal_uInt16 nCols, sal_uInt16 nRows ) + { mnCols = nCols; mnRows = nRows; } + inline void Expand( sal_Int16 nColDiff, sal_Int16 nRowDiff ) + { mnCols += nColDiff; mnRows += nRowDiff; } +}; + +inline bool operator==( const ScHTMLSize& rSize1, const ScHTMLSize& rSize2 ) +{ + return (rSize1.mnRows == rSize2.mnRows) && (rSize1.mnCols == rSize2.mnCols); +} + + +// ============================================================================ + +/** A single entry containing a line of text or representing a table. */ +struct ScHTMLEntry : public ScEEParseEntry +{ +private: + bool mbImportAlways; /// true = Always import this entry. + +public: + explicit ScHTMLEntry( + const SfxItemSet& rItemSet, + ScHTMLTableId nTableId = SC_HTML_NO_TABLE ); + + /** Returns true, if the selection of the entry is empty. */ + inline bool IsEmpty() const { return !aSel.HasRange(); } + /** Returns true, if the entry has any content to be imported. */ + bool HasContents() const; + /** Returns true, if the entry represents a table. */ + inline bool IsTable() const { return nTab != SC_HTML_NO_TABLE; } + /** Returns true, if the entry represents a table. */ + inline ScHTMLTableId GetTableId() const { return nTab; } + + /** Sets or cleares the import always state. */ + inline void SetImportAlways( bool bSet = true ) { mbImportAlways = bSet; } + /** Sets start point of the entry selection to the start of the import info object. */ + void AdjustStart( const ImportInfo& rInfo ); + /** Sets end point of the entry selection to the end of the import info object. */ + void AdjustEnd( const ImportInfo& rInfo ); + /** Deletes leading and trailing empty paragraphs from the entry. */ + void Strip( const EditEngine& rEditEngine ); +}; + + +// ============================================================================ + +/** This struct handles creation of unique table identifiers. */ +struct ScHTMLTableAutoId +{ + const ScHTMLTableId mnTableId; /// The created unique table identifier. + ScHTMLTableId& mrnUnusedId; /// Reference to global unused identifier variable. + + /** The constructor assigns an unused identifier to member mnTableId. */ + explicit ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId ); +}; + + +// ---------------------------------------------------------------------------- + +class ScHTMLTableMap; + +/** Stores data for one table in an HTML document. + @descr This class does the main work for importing an HTML document. It manages + the correct insertion of parse entries into the correct cells and the creation + of nested tables. Recalculation of resulting document size and position is done + recursively in all nested tables. */ +class ScHTMLTable +{ +private: + typedef ::std::auto_ptr< ScHTMLTableMap > ScHTMLTableMapPtr; + typedef ::std::auto_ptr< SfxItemSet > SfxItemSetPtr; + typedef ::std::vector< sal_uInt16 > ScSizeVec; + typedef ::std::list< ScHTMLEntry* > ScHTMLEntryList; + typedef ::std::map< ScHTMLPos, ScHTMLEntryList > ScHTMLEntryMap; + typedef ::std::auto_ptr< ScHTMLEntry > ScHTMLEntryPtr; + + ScHTMLTable* mpParentTable; /// Pointer to parent table. + ScHTMLTableMapPtr mpNestedTables; /// Table of nested HTML tables. + String maTableName; /// Table name from <table id> option. + ScHTMLTableAutoId maTableId; /// Unique identifier of this table. + SfxItemSet maTableItemSet; /// Items for the entire table. + SfxItemSetPtr mpRowItemSet; /// Items for the current table row. + SfxItemSetPtr mpDataItemSet; /// Items for the current cell. + ScRangeList maLockList; /// Locked cells (needed for merged cells). + EditEngine& mrEditEngine; /// Edit engine (from ScEEParser). + ScEEParseList& mrEEParseList; /// List that owns the parse entries (from ScEEParser). + ScHTMLEntryMap maEntryMap; /// List of entries for each cell. + ScHTMLEntryList* mpCurrEntryList; /// Current entry list from map for faster access. + ScHTMLEntryPtr mpCurrEntry; /// Working entry, not yet inserted in a list. + ScSizeVec maSizes[ 2 ]; /// Calc cell count of each HTML table column/row. + ScHTMLSize maSize; /// Size of the table. + ScHTMLPos maCurrCell; /// Address of current cell to fill. + ScHTMLPos maDocBasePos; /// Resulting base address in a Calc document. + bool mbBorderOn; /// true = Table borders on. + bool mbPreFormText; /// true = Table from preformatted text (<pre> tag). + bool mbRowOn; /// true = Inside of <tr> </tr>. + bool mbDataOn; /// true = Inside of <td> </td> or <th> </th>. + bool mbPushEmptyLine; /// true = Insert empty line before current entry. + +public: + /** Creates a new HTML table without content. + @descr Internally handles a current cell position. This position is invalid + until first calls of RowOn() and DataOn(). + @param rParentTable Reference to the parent table that owns this table. + @param bPreFormText true = Table is based on preformatted text (<pre> tag). */ + explicit ScHTMLTable( + ScHTMLTable& rParentTable, + const ImportInfo& rInfo, + bool bPreFormText ); + + virtual ~ScHTMLTable(); + + /** Returns the name of the table, specified in the TABLE tag. */ + inline const String& GetTableName() const { return maTableName; } + /** Returns the unique identifier of the table. */ + inline ScHTMLTableId GetTableId() const { return maTableId.mnTableId; } + /** Returns the table size. */ + inline const ScHTMLSize& GetSize() const { return maSize; } + /** Returns the cell spanning of the specified cell. */ + ScHTMLSize GetSpan( const ScHTMLPos& rCellPos ); + + /** Searches in all nested tables for the specified table. + @param nTableId Unique identifier of the table. */ + ScHTMLTable* FindNestedTable( ScHTMLTableId nTableId ) const; + + /** Puts the item into the item set of the current entry. */ + void PutItem( const SfxPoolItem& rItem ); + /** Inserts a text portion into current entry. */ + void PutText( const ImportInfo& rInfo ); + /** Inserts a new line, if in preformatted text, else does nothing. */ + void InsertPara( const ImportInfo& rInfo ); + + /** Inserts a line break (<br> tag). + @descr Inserts the current entry regardless if it is empty. */ + void BreakOn(); + /** Inserts a heading line (<p> and <h*> tags). */ + void HeadingOn(); + /** Processes a hyperlink (<a> tag). */ + void AnchorOn(); + + /** Starts a *new* table nested in this table (<table> tag). + @return Pointer to the new table. */ + ScHTMLTable* TableOn( const ImportInfo& rInfo ); + /** Closes *this* table (</table> tag). + @return Pointer to the parent table. */ + ScHTMLTable* TableOff( const ImportInfo& rInfo ); + /** Starts a *new* table based on preformatted text (<pre> tag). + @return Pointer to the new table. */ + ScHTMLTable* PreOn( const ImportInfo& rInfo ); + /** Closes *this* table based on preformatted text (</pre> tag). + @return Pointer to the parent table. */ + ScHTMLTable* PreOff( const ImportInfo& rInfo ); + + /** Starts next row (<tr> tag). + @descr Cell address is invalid until first call of DataOn(). */ + void RowOn( const ImportInfo& rInfo ); + /** Closes the current row (<tr> tag). + @descr Cell address is invalid until call of RowOn() and DataOn(). */ + void RowOff( const ImportInfo& rInfo ); + /** Starts the next cell (<td> or <th> tag). */ + void DataOn( const ImportInfo& rInfo ); + /** Closes the current cell (</td> or </th> tag). + @descr Cell address is invalid until next call of DataOn(). */ + void DataOff( const ImportInfo& rInfo ); + + /** Starts the body of the HTML document (<body> tag). */ + void BodyOn( const ImportInfo& rInfo ); + /** Closes the body of the HTML document (</body> tag). */ + void BodyOff( const ImportInfo& rInfo ); + + /** Returns the resulting document row/column count of the specified HTML row/column. */ + sal_uInt16 GetDocSize( ScHTMLOrient eOrient, sal_uInt16 nCellPos ) const; + /** Returns the resulting document row/column count in the range [nCellBegin, nCellEnd). */ + sal_uInt16 GetDocSize( ScHTMLOrient eOrient, sal_uInt16 nCellBegin, sal_uInt16 nCellEnd ) const; + /** Returns the total document row/column count in the specified direction. */ + sal_uInt16 GetDocSize( ScHTMLOrient eOrient ) const; + + /** Returns the resulting Calc position of the top left edge of the table. */ + inline const ScHTMLPos& GetDocPos() const { return maDocBasePos; } + /** Calculates the resulting Calc position of the specified HTML column/row. */ + sal_uInt16 GetDocPos( ScHTMLOrient eOrient, sal_uInt16 nCellPos = 0 ) const; + /** Calculates the resulting Calc position of the specified HTML cell. */ + ScHTMLPos GetDocPos( const ScHTMLPos& rCellPos ) const; + /** Calculates the current Calc document area of this table. */ + void GetDocRange( ScRange& rRange ) const; + + /** Applies border formatting to the passed document. */ + void ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ) const; + +private: + /** Returns true, if the current cell does not contain an entry yet. */ + bool IsEmptyCell() const; + /** Returns the item set from cell, row, or table, depending on current state. */ + const SfxItemSet& GetCurrItemSet() const; + + /** Returns true, if import info represents a space character. */ + static bool IsSpaceCharInfo( const ImportInfo& rInfo ); + + /** Creates and returns a new empty flying entry at position (0,0). */ + ScHTMLEntry* CreateEntry() const; + /** Creates a new flying entry. + @param rInfo Contains the initial edit engine selection for the entry. */ + void CreateNewEntry( const ImportInfo& rInfo ); + + /** Inserts an empty line in front of the next entry. */ + void InsertLeadingEmptyLine(); + + /** Pushes the passed entry into the list of the current cell. */ + void ImplPushEntryToList( ScHTMLEntryList& rEntryList, ScHTMLEntryPtr& rpEntry ); + /** Tries to insert the entry into the current cell. + @descr If insertion is not possible (i.e., currently no cell open), the + entry will be inserted into the parent table. */ + void PushEntry( ScHTMLEntryPtr& rpEntry ); + /** Puts the current entry into the entry list, if it is not empty. + @param rInfo The import info struct containing the end position of the current entry. + @param bLastInCell true = If cell is still empty, put this entry always. */ + void PushEntry( const ImportInfo& rInfo, bool bLastinCell = false ); + /** Pushes a new entry into current cell which references a nested table. */ + void PushTableEntry( ScHTMLTableId nTableId ); + + /** Tries to find a table from the table container. + @descr Assumes that the table is located in the current container or + that the passed table identifier is 0. + @param nTableId Unique identifier of the table or 0. */ + ScHTMLTable* GetExistingTable( ScHTMLTableId nTableId ) const; + /** Inserts a nested table in the current cell at the specified position. + @param bPreFormText true = New table is based on preformatted text (<pre> tag). */ + ScHTMLTable* InsertNestedTable( const ImportInfo& rInfo, bool bPreFormText ); + /** Closes this table and inserts it into parent table. + @return Pointer to the parent table, or this, if no parent found. */ + ScHTMLTable* CloseTable( const ImportInfo& rInfo ); + + /** Inserts a new cell in an unused position, starting from current cell position. */ + void InsertNewCell( const ScHTMLSize& rSpanSize ); + + /** Set internal states for a new table row. */ + void ImplRowOn(); + /** Set internal states for leaving a table row. */ + void ImplRowOff(); + /** Set internal states for entering a new table cell. */ + void ImplDataOn( const ScHTMLSize& rSpanSize ); + /** Set internal states for leaving a table cell. */ + void ImplDataOff(); + + /** Inserts additional formatting options from import info into the item set. */ + void ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo& rInfo ); + + /** Updates the document column/row size of the specified column or row. + @descr Only increases the present count, never decreases. */ + void SetDocSize( ScHTMLOrient eOrient, sal_uInt16 nCellPos, sal_uInt16 nSize ); + /** Calculates and sets the resulting size the cell needs in the document. + @descr Reduces the needed size in merged cells. + @param nCellPos The first column/row position of the (merged) cell. + @param nCellSpan The cell spanning in the specified orientation. + @param nRealDocSize The raw document size of all entries of the cell. */ + void CalcNeededDocSize( + ScHTMLOrient eOrient, sal_uInt16 nCellPos, + sal_uInt16 nCellSpan, sal_uInt16 nRealDocSize ); + +protected: + /** Creates a new HTML table without parent. + @descr This constructor is used to create the "global table". */ + explicit ScHTMLTable( + SfxItemPool& rPool, + EditEngine& rEditEngine, + ScEEParseList& rEEParseList, + ScHTMLTableId& rnUnusedId ); + + /** Fills all empty cells in this and nested tables with dummy parse entries. */ + void FillEmptyCells(); + /** Recalculates the size of all columns/rows in the table, regarding nested tables. */ + void RecalcDocSize(); + /** Recalculates the position of all cell entries and nested tables. + @param rBasePos The origin of the table in the Calc document. */ + void RecalcDocPos( const ScHTMLPos& rBasePos ); +}; + + +// ---------------------------------------------------------------------------- + +/** The "global table" representing the entire HTML document. */ +class ScHTMLGlobalTable : public ScHTMLTable +{ +public: + explicit ScHTMLGlobalTable( + SfxItemPool& rPool, + EditEngine& rEditEngine, + ScEEParseList& rEEParseList, + ScHTMLTableId& rnUnusedId ); + + virtual ~ScHTMLGlobalTable(); + + /** Recalculates sizes and resulting positions of all document entries. */ + void Recalc(); }; +// ============================================================================ + +/** The HTML parser for data queries. Focuses on data import, not on layout. + @descr Builds the table structure correctly, ignores extended formatting + like pictures or column widths. */ +class ScHTMLQueryParser : public ScHTMLParser +{ +private: + typedef ::std::auto_ptr< ScHTMLGlobalTable > ScHTMLGlobalTablePtr; + + String maTitle; /// The title of the document. + ScHTMLGlobalTablePtr mpGlobTable; /// Contains the entire imported document. + ScHTMLTable* mpCurrTable; /// Pointer to current table (performance). + ScHTMLTableId mnUnusedId; /// First unused table identifier. + bool mbTitleOn; /// true = Inside of <title> </title>. + +public: + explicit ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc ); + virtual ~ScHTMLQueryParser(); + + virtual sal_uInt32 Read( SvStream& rStrm ); + + /** Returns the "global table" which contains the entire HTML document. */ + virtual const ScHTMLTable* GetGlobalTable() const; + +private: + /** Returns the specified table (may be maGlobTable, if no real table can be found). */ + ScHTMLTable* GetTable( ScHTMLTableId nTableId ) const; + + /** Handles all possible tags in the HTML document. */ + void ProcessToken( const ImportInfo& rInfo ); + /** Inserts a text portion into current entry. */ + void InsertText( const ImportInfo& rInfo ); + /** Processes the <font> tag. */ + void FontOn( const ImportInfo& rInfo ); + + /** Processes the <meta> tag. */ + void MetaOn( const ImportInfo& rInfo ); + /** Opens the title of the HTML document (<title> tag). */ + void TitleOn( const ImportInfo& rInfo ); + /** Closes the title of the HTML document (</title> tag). */ + void TitleOff( const ImportInfo& rInfo ); + + /** Opens a new table at the current position. */ + void TableOn( const ImportInfo& rInfo ); + /** Closes the current table. */ + void TableOff( const ImportInfo& rInfo ); + /** Opens a new table based on preformatted text. */ + void PreOn( const ImportInfo& rInfo ); + /** Closes the current preformatted text table. */ + void PreOff( const ImportInfo& rInfo ); + + DECL_LINK( HTMLImportHdl, const ImportInfo* ); +}; + + +// ============================================================================ + #endif diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx index e56ef6d36387..fd0d5b94423b 100644 --- a/sc/source/filter/inc/imp_op.hxx +++ b/sc/source/filter/inc/imp_op.hxx @@ -2,9 +2,9 @@ * * $RCSfile: imp_op.hxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: jmarmion $ $Date: 2002-12-06 16:03:48 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -359,7 +359,6 @@ protected: virtual void SetTextCell( const UINT16 nCol, const UINT16 nRow, String& rUnconvertedText, const UINT16 nXF ); // Achtung: rUnconvertedText wird moeglicherweise veraendert - UINT16 CalcColWidth( const UINT16 nExcColWidth ); /** Sets a margin item into an item set. @param rItemSet The destination item set. diff --git a/sc/source/filter/inc/lotimpop.hxx b/sc/source/filter/inc/lotimpop.hxx index ffe2063e5d89..be02c442d78b 100644 --- a/sc/source/filter/inc/lotimpop.hxx +++ b/sc/source/filter/inc/lotimpop.hxx @@ -2,9 +2,9 @@ * * $RCSfile: lotimpop.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:20:43 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/namebuff.hxx b/sc/source/filter/inc/namebuff.hxx index 2acff65591c2..dfe0b6b27ed6 100644 --- a/sc/source/filter/inc/namebuff.hxx +++ b/sc/source/filter/inc/namebuff.hxx @@ -2,9 +2,9 @@ * * $RCSfile: namebuff.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: dr $ $Date: 2001-10-31 10:52:49 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,6 +77,8 @@ #include "root.hxx" #endif +#include "rangenam.hxx" + class ScDocument; class ScTokenArray; class NameBuffer; @@ -218,9 +220,9 @@ public: inline RangeNameBuffer( RootData* p ); // Name, Definition void Store( ByteString&, const ScTokenArray*, - UINT16 nAltSheet = 0, const BOOL bPrintarea = FALSE ); + UINT16 nAltSheet = 0, const RangeType eNameType = RT_ABSAREA ); void Store( String&, const ScTokenArray*, - UINT16 nAltSheet = 0, const BOOL bPrintarea = FALSE ); + UINT16 nAltSheet = 0, const RangeType eNameType = RT_ABSAREA ); inline UINT16 operator[]( UINT16 nExcInd ) const; inline UINT16 GetPos( void ) const; }; diff --git a/sc/source/filter/inc/root.hxx b/sc/source/filter/inc/root.hxx index 38b2ecb6a6ef..d0535139d696 100644 --- a/sc/source/filter/inc/root.hxx +++ b/sc/source/filter/inc/root.hxx @@ -2,9 +2,9 @@ * * $RCSfile: root.hxx,v $ * - * $Revision: 1.26 $ + * $Revision: 1.27 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,9 +102,7 @@ class XclExpUserBViewList; class XclExpCellMerging; class ExcNameList; -class UsedAttrList; class XclObjList; -class XclNoteList; class XclEscher; class XclPivotCacheList; class SfxStyleSheet; @@ -119,7 +117,6 @@ class XclExpRoot; struct RootData // -> Inkarnation jeweils im ImportExcel-Objekt! { SvStorage* pRootStorage; // THE storage - double fColScale; // Skalierungs-Faktoren fuer double fRowScale; // Spaltenbreiten / Zeilenhoehen ScDocument* pDoc; ScRangeName* pScRangeName; @@ -144,9 +141,6 @@ struct RootData // -> Inkarnation jeweils im ImportExcel-Objekt! SvStorage* pPivotCacheStorage; XclImpPivotCacheList* pImpPivotCacheList; // pivot caches for import - SvStorageRef xCtrlStorage; // SvxMSConvertOCXControls compatibel storage -// SvStorage* pCtrlStorage; // SvxMSConvertOCXControls compatibel storage - UINT32 nCondRangeCnt; UINT16 nLastCond; String GetCondFormStyleName( const UINT16 nCondCnt ); // -> exctools.cxx @@ -158,13 +152,11 @@ struct RootData // -> Inkarnation jeweils im ImportExcel-Objekt! ExcNameList* pNameList; ScRangeName* pScNameList; // stores range names and DB ranges - UsedAttrList* pXFRecs; ExcExternDup* pExtSheetCntAndRecs; UINT16 nColMax; UINT16 nRowMax; // Biff8 XclObjList* pObjRecs; - XclNoteList* pNoteRecs; String sAddNoteText; // text to append at current note (multiple hyperlinks) XclEscher* pEscher; diff --git a/sc/source/filter/inc/scflt.hxx b/sc/source/filter/inc/scflt.hxx index 74dff29b267d..898653e46795 100644 --- a/sc/source/filter/inc/scflt.hxx +++ b/sc/source/filter/inc/scflt.hxx @@ -2,9 +2,9 @@ * * $RCSfile: scflt.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: er $ $Date: 2002-12-06 17:44:47 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -732,7 +732,7 @@ public: }; -class FilterProgressBar; +class ScfStreamProgressBar; // Import-Klasse class Sc10Import @@ -752,7 +752,7 @@ class Sc10Import INT16 TabCount; USHORT nShowTab; ScViewOptions aSc30ViewOpt; - FilterProgressBar* pPrgrsBar; + ScfStreamProgressBar* pPrgrsBar; public: Sc10Import( SvStream& rStr, ScDocument* pDocument ); diff --git a/sc/source/filter/inc/xcl97dum.hxx b/sc/source/filter/inc/xcl97dum.hxx index 308e98d892b5..c1a09297d36d 100644 --- a/sc/source/filter/inc/xcl97dum.hxx +++ b/sc/source/filter/inc/xcl97dum.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xcl97dum.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,28 +112,6 @@ public: }; -class ExcDummy8_XF : public ExcDummyRec -{ -private: - static const BYTE pMyData[]; - static const ULONG nMyLen; -public: - virtual ULONG GetLen() const; - virtual const BYTE* GetData() const; -}; - - -class ExcDummy8_Style : public ExcDummyRec -{ -private: - static const BYTE pMyData[]; - static const ULONG nMyLen; -public: - virtual ULONG GetLen() const; - virtual const BYTE* GetData() const; -}; - - class ExcDummy8_UsesElfs : public ExcDummyRec { private: diff --git a/sc/source/filter/inc/xcl97esc.hxx b/sc/source/filter/inc/xcl97esc.hxx index 952e09c6c626..9747016ad277 100644 --- a/sc/source/filter/inc/xcl97esc.hxx +++ b/sc/source/filter/inc/xcl97esc.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xcl97esc.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dr $ $Date: 2002-12-12 11:50:27 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,6 +73,10 @@ #include <tools/stack.hxx> #endif +#ifndef SC_XLOCX_HXX +#include "xlocx.hxx" +#endif + namespace utl { class TempFile; } // --- class XclEscherEx --------------------------------------------- @@ -89,6 +93,9 @@ class XclEscherEx : public EscherEx private: List aOffsetMap; Stack aStack; +#if EXC_INCL_EXP_OCX + XclExpOcxConverter aOcxConverter; /// Export of form controls. +#endif RootData& rRootData; utl::TempFile* pPicTempFile; SvStream* pPicStrm; diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx index 77942f548f63..959900a3854f 100644 --- a/sc/source/filter/inc/xcl97rec.hxx +++ b/sc/source/filter/inc/xcl97rec.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xcl97rec.hxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -228,7 +228,11 @@ protected: UINT16 nGrbit; BOOL bFirstOnSheet; - XclObj( ObjType eObjType, RootData& rRoot ); + bool mbOwnEscher; /// true = Escher part created on the fly. + + /** @param bOwnEscher If set to true, this object will create its escher data. + See SetOwnEscher() for details. */ + explicit XclObj( ObjType eObjType, RootData& rRoot, bool bOwnEscher = false ); // overwritten for writing MSODRAWING record virtual void SaveCont( XclExpStream& rStrm ); @@ -252,6 +256,17 @@ public: void SetEscherShapeType( UINT16 nType ); inline void SetEscherShapeTypeGroup() { eObjType = otGroup; } + /** If set to true, this object has created its own escher data. This causes the + function EscherEx::EndShape() to not post process this object. This is used + i.e. for form controls. They are not handled in the svx base code, so the + XclExpObjControl c'tor creates the escher data itself. The svx base code does + not receive the correct shape ID after the EscherEx::StartShape() call, which + would result in deleting the object in EscherEx::EndShape(). */ + inline void SetOwnEscher( bool bOwnEscher = true ) { mbOwnEscher = bOwnEscher; } + /** Returns true, if the object has created the escher data itself. + See SetOwnEscher() for details. */ + inline bool IsOwnEscher() const { return mbOwnEscher; } + //! actually writes ESCHER_ClientTextbox void SetText( RootData& rRoot, const SdrTextObj& rObj ); @@ -282,7 +297,7 @@ private: public: XclObjComment( RootData& rRoot, - const ScAddress& rPos, const String& rStr ); + const ScAddress& rPos, const String& rStr, bool bVisible ); virtual ~XclObjComment(); virtual void Save( XclExpStream& rStrm ); @@ -356,6 +371,34 @@ public: }; +// ---------------------------------------------------------------------------- + +#if EXC_INCL_EXP_OCX + +/** Represents an OBJ record for a form control. */ +class XclExpObjControl : public XclObj +{ +private: + String maClassName; /// Class name of the control. + sal_uInt32 mnStrmStart; /// Start position in 'Ctls' stream. + sal_uInt32 mnStrmSize; /// Size in 'Ctls' stream. + +public: + XclExpObjControl( + const XclRoot& rRoot, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape >& rxShape, + const String& rClassName, + sal_uInt32 nStrmStart, sal_uInt32 nStrmSize ); + + virtual sal_uInt32 GetLen() const; + +private: + virtual void SaveCont( XclExpStream& rStrm ); +}; + +#endif + // --- class XclObjAny ----------------------------------------------- class XclObjAny : public XclObj @@ -372,48 +415,45 @@ public: }; -// --- class XclNoteList --------------------------------------------- +// ============================================================================ -class XclNote; - -class XclNoteList : public List, public ExcEmptyRec +/** Represents a NOTE record containing the author and the note object ID. + @descr Creates the note Escher object internally. */ +class XclExpNote : public XclExpRecord { private: -public: - XclNoteList(); - virtual ~XclNoteList(); - - XclNote* First() { return (XclNote*) List::First(); } - XclNote* Next() { return (XclNote*) List::Next(); } - - void Add( XclNote* ); - + XclExpString maAuthor; /// Name of the author. + ScAddress maPos; /// Cell address of the note. + sal_uInt16 mnObjId; /// Escher object ID. + bool mbVisible; /// true = permanently visible. + +public: + /** Constructs a NOTE record from the passed note object and/or the text. + @descr The additional text will be separated from the note text with an empty line. + Creates the Escher object containing the drawing information and the note text. + @param rPos The Calc cell address of the note. + @param pScNote The Calc note object. + @param rAddText Additional text appended to the note text. */ + explicit XclExpNote( + const XclExpRoot& rRoot, + const ScAddress& rPos, + const ScPostIt* pScNote, + const String& rAddText ); + + /** Writes the NOTE record, if the respective Escher object is present. */ virtual void Save( XclExpStream& rStrm ); -}; - -// --- class XclNote ------------------------------------------------- - -class XclNote : public ExcRecord -{ private: - XclExpUniString aAuthor; - ScAddress aPos; - UINT16 nGrbit; - UINT16 nObjId; + /** Writes the body of the NOTE record. */ + virtual void WriteBody( XclExpStream& rStrm ); +}; - virtual void SaveCont( XclExpStream& rStrm ); -public: - XclNote( RootData& rD, const ScAddress& rPos, - const String& rNoteText, const String& rNoteAuthor ); - virtual ~XclNote(); +/** A list of NOTE record objects. */ +typedef XclExpRecordList< XclExpNote > XclExpNoteList; - virtual void Save( XclExpStream& rStrm ); - virtual UINT16 GetNum() const; - virtual ULONG GetLen() const; -}; +// ============================================================================ // --- class ExcBof8_Base -------------------------------------------- @@ -490,34 +530,6 @@ public: }; -// --- class ExcXf8 -------------------------------------------------- - -class ExcXf8 : public ExcXf -{ -private: - XclTextDirection eTextDir; - UINT16 nTrot; - UINT16 nCIndent; - - UINT16 nGrbitDiag; - UINT32 nIcvDiagSer; - UINT16 nDgDiag; - - BOOL bFShrinkToFit; - BOOL bFMergeCell; - - virtual void SaveCont( XclExpStream& rStrm ); - -public: - ExcXf8( const XclExpRoot& rRoot, UINT16 nFont, UINT16 nForm, - const ScPatternAttr* pPattAttr, - BOOL& rbLineBreak, BOOL bStyle = FALSE ); - - virtual UINT16 GetNum() const; - virtual ULONG GetLen() const; -}; - - // --- class ExcBundlesheet8 ----------------------------------------- class ExcBundlesheet8 : public ExcBundlesheetBase @@ -609,7 +621,7 @@ class ScRangeList; struct RootData; class XclCf; -class XclCondFormat : public ExcEmptyRec, protected List +class XclCondFormat : public ExcEmptyRec, protected ScfDelList< XclCf > { // writes multiple cf _and_ condfmt records! private: @@ -618,9 +630,6 @@ private: UINT16 nTabNum; ULONG nComplLen; - inline XclCf* _First() { return (XclCf*) List::First(); } - inline XclCf* _Next() { return (XclCf*) List::Next(); } - void WriteCondfmt( XclExpStream& rStrm ); public: @@ -661,17 +670,10 @@ private: UINT32 nIcvTextSer; BOOL bHasLine; - UINT8 nLineData1; - UINT8 nLineData2; - UINT32 nIcvTopSer; - UINT32 nIcvBotSer; - UINT32 nIcvLftSer; - UINT32 nIcvRigSer; + XclExpXFBorder maBorder; BOOL bHasPattern; - UINT16 nPatt; - UINT32 nIcvForeSer; - UINT32 nIcvBackSer; + XclExpXFArea maArea; virtual void SaveCont( XclExpStream& rStrm ); diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx index d55b51921696..f2f3f9804407 100644 --- a/sc/source/filter/inc/xecontent.hxx +++ b/sc/source/filter/inc/xecontent.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xecontent.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:10 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/xehelper.hxx b/sc/source/filter/inc/xehelper.hxx index 65589f48c50b..1db07acad757 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.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -316,8 +316,10 @@ class EditEngine; &N page count &D current date &T current time - &F file name without path (converted to full file name) &A table name + &F file name without path + &Z file path without file name + &Z&F file path and name &U underlining on/off &E double underlining on/off &S strikeout characters on/off @@ -327,7 +329,6 @@ class EditEngine; Known but unsupported control sequences: &X superscript on/off &Y subscript on/off - &Z file path without file name &G picture */ class XclExpHFConverter : protected XclExpRoot, ScfNoCopy diff --git a/sc/source/filter/inc/xelink.hxx b/sc/source/filter/inc/xelink.hxx index c6e2b1936211..f3ef7eddd71d 100644 --- a/sc/source/filter/inc/xelink.hxx +++ b/sc/source/filter/inc/xelink.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xelink.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/xerecord.hxx b/sc/source/filter/inc/xerecord.hxx index f57150df8f8c..55526628b5b9 100644 --- a/sc/source/filter/inc/xerecord.hxx +++ b/sc/source/filter/inc/xerecord.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xerecord.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,9 @@ public: /** Overwrite this method to do any operation while saving the record list. */ virtual void Save( XclExpStream& rStrm ); + + /** Calls Save(XclExpStream&) nCount times. */ + void SaveRepeated( XclExpStream& rStrm, sal_uInt32 nCount ); }; @@ -106,7 +109,7 @@ private: public: /** @param nRecId The record ID of this record. May be set later with SetRecId(). @param nRecSize The predicted record size. May be set later with SetRecSize(). */ - XclExpRecord( + explicit XclExpRecord( sal_uInt16 nRecId = EXC_ID_UNKNOWN, sal_uInt32 nRecSize = 0 ); @@ -114,13 +117,15 @@ public: /** Returns the current record ID. */ inline sal_uInt16 GetRecId() const { return mnRecId; } - /** Sets a new record ID. */ - inline void SetRecId( sal_uInt16 nRecId ) { mnRecId = nRecId; } - /** Returns the current record size prediction. */ inline sal_uInt32 GetRecSize() const { return mnRecSize; } + + /** Sets a new record ID. */ + inline void SetRecId( sal_uInt16 nRecId ) { mnRecId = nRecId; } /** Sets a new record size prediction. */ inline void SetRecSize( sal_uInt32 nRecSize ) { mnRecSize = nRecSize; } + /** Sets record ID and size with one call. */ + void SetRecHeader( sal_uInt16 nRecId, sal_uInt32 nRecSize ); /** Writes the record header and calls WriteBody(). */ virtual void Save( XclExpStream& rStrm ); @@ -139,10 +144,7 @@ class XclExpEmptyRecord : public XclExpRecord { public: /** @param nRecId The record ID of this record. */ - inline XclExpEmptyRecord( sal_uInt16 nRecId ); - -private: - void SetRecSize( sal_uInt32 ); + inline explicit XclExpEmptyRecord( sal_uInt16 nRecId ); }; inline XclExpEmptyRecord::XclExpEmptyRecord( sal_uInt16 nRecId ) : @@ -165,7 +167,7 @@ public: /** @param nRecId The record ID of this record. @param rValue The value for the record body. @param nSize Record size. Uses sizeof( Type ), if this parameter is omitted. */ - inline XclExpValueRecord( + inline explicit XclExpValueRecord( sal_uInt16 nRecId, const Type& rValue, sal_uInt32 nSize = sizeof( Type ) ); @@ -218,7 +220,7 @@ private: public: /** @param nRecId The record ID of this record. @param nValue The value for the record body. */ - inline XclExpBoolRecord( sal_uInt16 nRecId, bool bValue ) : + inline explicit XclExpBoolRecord( sal_uInt16 nRecId, bool bValue ) : XclExpRecord( nRecId, 2 ), mbValue( bValue ) {} /** Returns the Boolean value of the record. */ @@ -234,6 +236,30 @@ private: // ---------------------------------------------------------------------------- +/** Record which exports a memory data array. */ +class XclExpDummyRecord : public XclExpRecord +{ +private: + const void* mpData; /// The record data. + +public: + /** @param nRecId The record ID of this record. + @param nRecData Pointer to the data array representing the record body. + @param nRecSize Size of the data array. */ + explicit XclExpDummyRecord( + sal_uInt16 nRecId, const void* pRecData, sal_uInt32 nRecSize ); + + /** Sets a data array. */ + void SetData( const void* pRecData, sal_uInt32 nRecSize ); + +private: + /** Writes the body of the record. */ + virtual void WriteBody( XclExpStream& rStrm ); +}; + + +// ---------------------------------------------------------------------------- + /** A record that stores a reference to an existing record object. @descr The record object does not take ownership of the passed record. This class should be used to insert an existing record into another record list. @@ -244,7 +270,7 @@ protected: XclExpRecordBase& mrRec; /// Reference to the record. public: - inline XclExpRefRecord( XclExpRecordBase& rRec ) : mrRec( rRec ) {} + inline explicit XclExpRefRecord( XclExpRecordBase& rRec ) : mrRec( rRec ) {} /** Writes the entire record. */ virtual void Save( XclExpStream& rStrm ); diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx index 30c6940393d8..dbf69624dc1e 100644 --- a/sc/source/filter/inc/xeroot.hxx +++ b/sc/source/filter/inc/xeroot.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xeroot.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,6 +75,7 @@ class XclExpSst; class XclExpPalette; class XclExpFontBuffer; class XclExpNumFmtBuffer; +class XclExpXFBuffer; class XclExpTabIdBuffer; class XclExpLinkManager; @@ -85,6 +86,7 @@ struct XclExpRootData : public XclRootData typedef ::std::auto_ptr< XclExpPalette > XclExpPalettePtr; typedef ::std::auto_ptr< XclExpFontBuffer > XclExpFontBufferPtr; typedef ::std::auto_ptr< XclExpNumFmtBuffer > XclExpNumFmtBufferPtr; + typedef ::std::auto_ptr< XclExpXFBuffer > XclExpXFBufferPtr; typedef ::std::auto_ptr< XclExpTabIdBuffer > XclExpTabIdBufferPtr; typedef ::std::auto_ptr< XclExpLinkManager > XclExpLinkManagerPtr; @@ -93,6 +95,7 @@ struct XclExpRootData : public XclRootData XclExpPalettePtr mpPalette; /// The color buffer. XclExpFontBufferPtr mpFontBuffer; /// All fonts in the file. XclExpNumFmtBufferPtr mpNumFmtBuffer; /// All number formats in the file. + XclExpXFBufferPtr mpXFBuffer; /// All XF records in the file. XclExpTabIdBufferPtr mpTabIdBuffer; /// Calc->Excel sheet index conversion. XclExpLinkManagerPtr mpLinkManager; /// Manager for internal/external links. @@ -121,6 +124,8 @@ public: XclExpRoot& operator=( const XclExpRoot& rRoot ); + /** Returns this root instance - for code readability in derived classes. */ + inline const XclExpRoot& GetRoot() const { return *this; } /** Returns true, if URLs should be stored relative to the document location. */ inline bool IsRelUrl() const { return mrExpData.mbRelUrl; } @@ -133,6 +138,8 @@ public: XclExpFontBuffer& GetFontBuffer() const; /** Returns the number format buffer. */ XclExpNumFmtBuffer& GetNumFmtBuffer() const; + /** Returns the cell formatting attributes buffer. */ + XclExpXFBuffer& GetXFBuffer() const; /** Returns the buffer for Calc->Excel sheet index conversion. */ XclExpTabIdBuffer& GetTabIdBuffer() const; diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx index f876dd9e8481..14de4e71e5e8 100644 --- a/sc/source/filter/inc/xestream.hxx +++ b/sc/source/filter/inc/xestream.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xestream.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx index e9e56e37e0c5..9eb2f0330549 100644 --- a/sc/source/filter/inc/xestyle.hxx +++ b/sc/source/filter/inc/xestyle.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xestyle.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:37:56 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,6 +74,9 @@ #ifndef _SVX_SVXENUM_HXX #include <svx/svxenum.hxx> #endif +#ifndef _ZFORLIST_HXX +#include <svtools/zforlist.hxx> +#endif #ifndef INCLUDED_SVTOOLS_NFKEYTAB_HXX #include <svtools/nfkeytab.hxx> #endif @@ -112,8 +115,14 @@ enum XclColorType // ---------------------------------------------------------------------------- /** Stores all used colors in the document. - @descr Supports color reduction to the maximum count of the current BIFF version. */ -class XclExpPalette : public XclExpRecord, public XclDefaultPalette + @descr Supports color reduction to the maximum count of the current BIFF version. + An instance of this class collects all colors in the conversion phase of the export, + using the InsertColor() function. It returns a unique identidier for each passed color. + After the entire document is converted, the palette will be reduced to the number of + colors supported by the current BIFF version, using the function ReduceColors(). + Then, in the streaming phase, the functions GetColorIndex() and GetMixedColors() + return the real Excel palette index for all color identifiers. */ +class XclExpPalette : public XclExpRecord, public XclDefaultPalette, protected XclExpRoot { private: /** Represents an entry in a color list. @@ -126,16 +135,16 @@ private: private: Color maColor; /// The color value of this palette entry. - sal_uInt32 mnCID; /// Unique color ID (CID) for color reduction. + sal_uInt32 mnColorId; /// Unique color ID for color reduction. sal_uInt32 mnWeight; /// Weighting for color reduction. public: - explicit XclListColor( const Color& rColor, sal_uInt32 nCID ); + explicit XclListColor( const Color& rColor, sal_uInt32 nColorId ); /** Returns the RGB color value of the color. */ inline const Color& GetColor() const { return maColor; } /** Returns the unique ID of the color. */ - inline sal_uInt32 GetCID() const { return mnCID; } + inline sal_uInt32 GetColorId() const { return mnColorId; } /** Returns the current weighting of the color. */ inline sal_uInt32 GetWeighting() const { return mnWeight; } /** Returns true, if this color value is greater than rColor (simple arithmetic comparison). */ @@ -151,11 +160,11 @@ private: void Merge( const XclListColor& rColor ); }; - /** Data for each inserted original color, represented by a CID (color ID). */ - struct XclCIDData + /** Data for each inserted original color, represented by a color ID. */ + struct XclColorIdData { - Color maColor; /// The original inserted color. - sal_uInt32 mnIndex; /// Maps current CID to color list or export color vector. + Color maColor; /// The original inserted color. + sal_uInt32 mnIndex; /// Maps current color ID to color list or export color vector. /** Sets the contents of this struct. */ inline void Set( const Color& rColor, sal_uInt32 nIndex ) { maColor = rColor; mnIndex = nIndex; } }; @@ -163,27 +172,27 @@ private: /** A color that will be written to the Excel file. */ struct XclPaletteColor { - Color maColor; /// Resulting color to export. - bool mbDefault; /// true = Entry is a default color. + Color maColor; /// Resulting color to export. + bool mbDefault; /// true = Entry is a default color. /** Sets a new color. @param bDefault true = Color is a color from default palette. */ inline void SetColor( const Color& rColor, bool bDefault = false ) { maColor = rColor; mbDefault = bDefault; } }; typedef ScfDelList< XclListColor > XclListColorList; - typedef ::std::vector< XclCIDData > XclCIDDataVec; + typedef ::std::vector< XclColorIdData > XclColorIdDataVec; typedef ::std::vector< XclPaletteColor > XclPaletteColorVec; - XclListColorList maColorList; /// Working color list. - XclCIDDataVec maCIDDataVec; /// Data of all CIDs. - XclPaletteColorVec maPalette; /// Contains resulting colors to export. - sal_uInt32 mnLastIx; /// Last insertion index for search opt. + XclListColorList maColorList; /// Working color list. + XclColorIdDataVec maColorIdDataVec; /// Data of all CIDs. + XclPaletteColorVec maPalette; /// Contains resulting colors to export. + sal_uInt32 mnLastIx; /// Last insertion index for search opt. public: explicit XclExpPalette( const XclExpRoot& rRoot ); - /** Activates the default colors for the passed BIFF version. */ - void SetBiff( XclBiff eBiff ); + /** Activates the default colors for the current BIFF version. */ + void OnChangeBiff(); /** Inserts the color into the list and updates weighting. @param nAutoDefault The Excel palette index for automatic color. @@ -196,19 +205,19 @@ public: /** Reduces the color list to the maximum count of the current BIFF version. */ void ReduceColors(); - /** Returns the Excel palette index of the color with passed color ID (CID). */ - sal_uInt16 GetColorIndex( sal_uInt32 nCID ) const; + /** Returns the Excel palette index of the color with passed color ID. */ + sal_uInt16 GetColorIndex( sal_uInt32 nColorId ) const; /** Returns the Excel palette index of the passed color (searches for nearest color). @param nAutoDefault The Excel palette index for automatic color. */ sal_uInt16 GetColorIndex( const Color& rColor, sal_uInt16 nAutoDefault = 0 ) const; - /** Returns a foreground and background color for the two passed CIDs. + /** Returns a foreground and background color for the two passed color IDs. @descr If rnXclPattern contains a solid pattern, this function tries to find - the two best fitting colors and a mix pattern (25%, 50% or 75%) for nCIDForegr. + the two best fitting colors and a mix pattern (25%, 50% or 75%) for nForeColorId. This will result in a better approximation to the passed foreground color. */ void GetMixedColors( - sal_uInt16& rnXclForeIx, sal_uInt16& rnXclBackIx, sal_uInt16& rnXclPattern, - sal_uInt32 nCIDForegr, sal_uInt32 nCIDBackgr ) const; + sal_uInt16& rnXclForeIx, sal_uInt16& rnXclBackIx, sal_uInt8& rnXclPattern, + sal_uInt32 nForeColorId, sal_uInt32 nBackColorId ) const; /** Returns the RGB color data for a (non-zero-based) Excel palette entry. @param nDefault Is returned, if nothing else could be found. */ @@ -218,8 +227,8 @@ public: inline Color GetColor( sal_uInt16 nXclIndex, ColorData nDefault = COL_AUTO ) const; private: - /** Returns the original inserted color represented by nCID. */ - const Color& GetOriginalColor( sal_uInt32 nCID ) const; + /** Returns the original inserted color represented by the color ID nColorId. */ + const Color& GetOriginalColor( sal_uInt32 nColorId ) const; /** Returns the ordered insertion index for rColor in rnIndex. @param rbIsEqual Returns true, if the color already exists. */ @@ -271,7 +280,7 @@ class XclExpFont : public XclExpRecord, protected XclExpRoot { private: XclFontData maData; /// All font attributes. - sal_uInt32 mnCID; /// Unique color ID for text color. + sal_uInt32 mnColorId; /// Unique color ID for text color. sal_uInt32 mnHash; /// Hash value for fast comparison. bool mbHasColor; /// false = Font does not use a color (i.e. chart). @@ -285,7 +294,7 @@ public: inline void SetFamily( FontFamily eFamily ) { maData.mnFamily = GetXclFamily( eFamily ); } inline void SetCharSet( rtl_TextEncoding eCharSet ) { maData.mnCharSet = GetXclCharSet( eCharSet ); } void SetColor( const Color& rColor ); - void SetCID( sal_uInt32 nCID ); + void SetColorId( sal_uInt32 nColorId ); void SetHeight( sal_Int32 nTwips ); inline void SetWeight( FontWeight eWeight ) { maData.mnWeight = GetXclWeight( eWeight ); } inline void SetUnderline( FontUnderline eUnderl ) { maData.meUnderline = GetXclUnderline( eUnderl ); } @@ -308,7 +317,7 @@ public: /** Returns true, if this font contains a specific color (if SetColor was called before). */ inline bool HasColor() const { return mbHasColor; } /** Returns the unique color ID of the font color from palette. */ - inline sal_uInt32 GetCID() const { return mnCID; } + inline sal_uInt32 GetColorId() const { return mnColorId; } /** Converts a font family to Excel font family. */ static sal_uInt8 GetXclFamily( FontFamily eFamily ); @@ -335,14 +344,17 @@ class ScPatternAttr; class XclExpFontBuffer : public XclExpRecordBase, protected XclExpRoot { private: - XclExpRecordList< XclExpFont > maFontList; /// List of all FONT records. - sal_uInt32 mnMaxCount; /// Maximum possible count of fonts. + typedef XclExpRecordList< XclExpFont > XclExpFontList; + + XclExpFontList maFontList; /// List of all FONT records. + XclFontData maAppFont; /// Application font (for column width). + sal_uInt32 mnXclMaxCount; /// Maximum number of fonts. public: explicit XclExpFontBuffer( const XclExpRoot& rRoot ); - /** Activates the default colors for the passed BIFF version. */ - void SetBiff( XclBiff eBiff ); + /** Finds the maximum number of fonts for the current BIFF version. */ + void OnChangeBiff(); /** Returns the specified font from font list. */ inline const XclExpFont* GetFont( sal_uInt32 nIndex ) const @@ -368,7 +380,7 @@ private: /** Initializes the default fonts for the current BIFF version. */ void InitDefaultFonts(); /** Converts a list index into Excel font index. */ - sal_uInt16 GetXclIndex( sal_uInt32 nIndex ); + sal_uInt16 GetXclIndex( sal_uInt32 nIndex ) const; /** Tries to find the passed font and returns the current list index. */ sal_uInt32 Find( const XclExpFont& rFont ); }; @@ -402,6 +414,7 @@ private: SvNumberFormatterPtr mpFormatter; /// Special number formatter for conversion. NfKeywordTablePtr mpKeywordTable; /// Replacement table. XclExpNumFmtVec maFormatMap; /// Maps core formats to Excel indexes. + sal_uInt32 mnStdFmt; /// Key for standard number format. sal_uInt16 mnXclOffset; /// Offset to first user defined format. public: @@ -409,13 +422,16 @@ public: virtual ~XclExpNumFmtBuffer(); - /** Sets internal data for the passed BIFF version. */ - void SetBiff( XclBiff eBiff ); + /** Sets internal data for the current BIFF version. */ + void OnChangeBiff(); + + /** Returns the core index of the current standard number format. */ + inline sal_uInt32 GetStandardFormat() const { return mnStdFmt; } /** Inserts a number format into the format buffer. @param nFormatIx The core index of the number format. @return The resulting Excel format index. */ - sal_uInt16 Insert( sal_uInt32 nFormatIx ); + sal_uInt16 Insert( sal_uInt32 nScFormatIx ); /** Writes all FORMAT records contained in this buffer. */ virtual void Save( XclExpStream& rStrm ); @@ -432,6 +448,206 @@ private: // XF, STYLE record - Cell formatting ========================================= +/** Contains color and line style for each cell border line. */ +struct XclExpXFBorder +{ + sal_uInt32 mnLeftColorId; /// Color ID for left line. + sal_uInt32 mnRightColorId; /// Color ID for right line. + sal_uInt32 mnTopColorId; /// Color ID for top line. + sal_uInt32 mnBottomColorId; /// Color ID for bottom line. + sal_uInt8 mnLeftLine; /// Style of left line. + sal_uInt8 mnRightLine; /// Style of right line. + sal_uInt8 mnTopLine; /// Style of top line. + sal_uInt8 mnBottomLine; /// Style of bottom line. + + explicit XclExpXFBorder(); +}; + + +// ---------------------------------------------------------------------------- + +/** Contains background colors and pattern. */ +struct XclExpXFArea +{ + sal_uInt32 mnForeColorId; /// Foreground color ID. + sal_uInt32 mnBackColorId; /// Background color ID. + sal_uInt8 mnPattern; /// Fill pattern. + + explicit XclExpXFArea(); +}; + + +// ---------------------------------------------------------------------------- + +class SfxStyleSheetBase; +class SvxBoxItem; +class SvxBorderLine; + +/** Represents an XF record which contains all formatting data of a cell or cell style. */ +class XclExpXF : public XclExpRecord +{ +private: + typedef ::std::auto_ptr< ScPatternAttr > ScPatternAttrPtr; + + ScPatternAttrPtr mpOwnPattern; /// An own item set (used for cell styles). + const ScPatternAttr* mpPattern; /// Pointer to Calc item set (we do not own it). + + XclExpXFBorder maBorder; /// Border line style. + XclExpXFArea maArea; /// Background area style. + XclHorAlign meHorAlign; /// Horizontal alignment. + XclVerAlign meVerAlign; /// Vertical alignment. + XclTextOrient meOrient; /// Text orientation. + XclTextDirection meTextDir; /// CTL text direction. + + sal_uInt16 mnParent; /// Index to parent style XF. + sal_uInt16 mnFont; /// Excel font index. + sal_uInt16 mnNumFmt; /// Excel number format index. + sal_uInt8 mnIndent; /// Text indent. + sal_uInt8 mnRotation; /// Rotation angle. + + bool mbCellXF; /// true = cell XF, false = style XF. + bool mbLocked; /// true = cell is locked. + bool mbHidden; /// true = formulas are hidden. + bool mbWrapped; /// true = wrap text on cell border. + bool mbProtUsed; /// true = locked/hidden flags used. + bool mbFontUsed; /// true = font index used. + bool mbFmtUsed; /// true = number format used. + bool mbAlignUsed; /// true = alignment used. + bool mbBorderUsed; /// true = border data used. + bool mbAreaUsed; /// true = area data used. + +public: + /** Constructs a cell XF record from the passed Calc item set. + @param nForcedNumFmt If not set to NUMBERFORMAT_ENTRY_NOT_FOUND, it will overwrite + the number format of the passed item set. + @param bForcedWrap true = set text wrap flag unconditionally. */ + explicit XclExpXF( + const XclExpRoot& rRoot, + const ScPatternAttr* pPattern, + sal_uInt32 nForcedNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND, + bool bForceWrapped = false ); + /** Constructs a style XF record from the passed cell style sheet. */ + explicit XclExpXF( const XclExpRoot& rRoot, SfxStyleSheetBase& rStyleSheet ); + + /** Returns true, if the passed cell formatting is represented by this XF record. + @descr Searches for cell XFs only. */ + bool Equals( + const ScPatternAttr* pPattern, + sal_uInt32 nForcedNumFmt, + bool bForceWrapped ) const; + + /** Sets the border line styles from the item set into the passed struct. */ + static void GetBorder( + XclExpXFBorder& rBorder, + XclExpPalette& rPalette, + const ScPatternAttr& rPattern ); + + /** Sets the area styles from the brush item into the passed struct. */ + static void GetArea( + XclExpXFArea& rArea, + XclExpPalette& rPalette, + const ScPatternAttr& rPattern ); + +private: + /** Fills all members from the passed item set. */ + void Init( + const XclExpRoot& rRoot, + const ScPatternAttr* pPattern, + sal_uInt32 nForcedNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND, + bool bForceWrapped = false ); + + /** Returns the bits specifying the used attributes. + @descr In cell XFs a set bit means a used attribute, in style XF a cleared + bit means a used attribute. This method regards the cell/style state. + @return The mask based on bit 0 (not yet bit-shifted as needed for export). */ + sal_uInt8 GetUsedAttribMask() const; + + void WriteBody5( XclExpStream& rStrm ); + void WriteBody8( XclExpStream& rStrm ); + + /** Writes the contents of the XF record. */ + virtual void WriteBody( XclExpStream& rStrm ); + + /** Reads the passed border line struct and converts to Excel line style and color. */ + static void GetBorderLine( + sal_uInt8& rnXclLine, sal_uInt32& rnColorId, + XclExpPalette& rPalette, const SvxBorderLine* pLine ); +}; + + +// ---------------------------------------------------------------------------- + +/** Represents a STYLE record containing the name of a user-defined cell style. */ +class XclExpStyle : public XclExpRecord +{ +private: + String maName; /// Name of the cell style. + sal_uInt16 mnXFIndex; /// Index to XF record with style formatting. + +public: + explicit XclExpStyle( const String& rName, sal_uInt16 nXFIndex ); + +private: + /** Writes the contents of the STYLE record. */ + virtual void WriteBody( XclExpStream& rStrm ); +}; + + +// ---------------------------------------------------------------------------- + +/** Stores all XF records (cell formats) in the document. */ +class XclExpXFBuffer : public XclExpRecordBase, protected XclExpRoot +{ +private: + typedef XclExpRecordList< XclExpXF > XclExpXFList; + typedef XclExpRecordList< XclExpStyle > XclExpStyleList; + + XclExpXFList maXFList; /// List of all XF records. + XclExpStyleList maStyleList; /// List of all STYLE records. + sal_uInt32 mnXclMaxCount; /// Maximum number of XF records. + sal_uInt16 mnXclOffset; /// Offset to first user defined XF. + +public: + explicit XclExpXFBuffer( const XclExpRoot& rRoot ); + + /** Inserts all user-defined styles into the XF record list. */ + void InsertUserStyles(); + + /** Finds or creates a cell XF record for the passed item set. + @param bForceWrapped true = cell contains hard newlines. + In this case the text wrap flag must be set in the XF record. + @return The resulting Excel XF record index. */ + sal_uInt16 Insert( const ScPatternAttr* pPattern, bool bForceWrapped = false ); + /** Finds or creates a cell XF record for the passed item set, with custom number format. + @param nForcedNumFmt The number format to be exported, i.e. formula result type. + This format will always overwrite the cell's number format. + @return The resulting Excel XF record index. */ + sal_uInt16 Insert( const ScPatternAttr* pPattern, sal_uInt32 nForcedNumFmt ); + /** Inserts the passed cell style. Creates a style XF record and a STYLE record. + @return The resulting Excel XF record index. */ + sal_uInt16 InsertStyle( SfxStyleSheetBase& rStyleSheet ); + + /** Writes all XF records contained in this buffer. */ + virtual void Save( XclExpStream& rStrm ); + +private: + /** Converts a list index into Excel XF index. */ + sal_uInt16 GetXclIndex( sal_uInt32 nIndex ) const; + + /** Tries to find the XF record containing the passed format or inserts a new record. + @return The Excel XF index. */ + sal_uInt16 InsertCellXF( + const ScPatternAttr* pPattern, + sal_uInt32 nForcedNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND, + bool bForceWrapped = false ); + + void WriteDefaultXFs5( XclExpStream& rStrm ); + void WriteDefaultXFs8( XclExpStream& rStrm ); + + void WriteDefaultStyles5( XclExpStream& rStrm ); +}; + + // ============================================================================ #endif diff --git a/sc/source/filter/inc/xicontent.hxx b/sc/source/filter/inc/xicontent.hxx index 0a0f449d5a37..c8b611391865 100644 --- a/sc/source/filter/inc/xicontent.hxx +++ b/sc/source/filter/inc/xicontent.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xicontent.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:14 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -185,7 +185,7 @@ class XclImpValidation : ScfNoInstance { public: /** Reads a DVAL record and sets marks the dropdown arrow control to be ignored. */ - static void ReadDval( XclImpStream& rStrm, XclImpRoot& rRoot ); + static void ReadDval( XclImpStream& rStrm ); /** Reads a DV record and inserts validation data into the document. */ static void ReadDv( XclImpStream& rStrm, ExcelToSc& rFmlaConv ); }; diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx index 56cb73fc453c..182dfb995f1d 100644 --- a/sc/source/filter/inc/xihelper.hxx +++ b/sc/source/filter/inc/xihelper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xihelper.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:14 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -168,8 +168,10 @@ struct XclFontData; &N page count &D current date &T current time - &F file name without path (converted to full file name) &A table name + &F file name without path (see also &Z&F) + &Z file path without file name (converted to full file name, see also &Z&F) + &Z&F file path and name &U underlining on/off &E double underlining on/off &S strikeout characters on/off @@ -179,7 +181,6 @@ struct XclFontData; &fontheight set font height in points ('fontheight' is a decimal value) Known but unsupported control sequences: - &Z file path without file name &G picture */ class XclImpHFConverter : protected XclImpRoot, ScfNoCopy diff --git a/sc/source/filter/inc/xilink.hxx b/sc/source/filter/inc/xilink.hxx index b04a4567f01a..e0561886b91a 100644 --- a/sc/source/filter/inc/xilink.hxx +++ b/sc/source/filter/inc/xilink.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xilink.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:15 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -128,6 +128,7 @@ class XclImpExtName { private: String maName; /// The name of the external name. + String maAddInName; /// The converted Calc add-in function name. sal_uInt32 mnStorageId; /// Storage ID for OLE object storages. XclImpExtNameType meType; /// Type of the external name. @@ -137,6 +138,7 @@ public: inline XclImpExtNameType GetType() const { return meType; } inline const String& GetName() const { return maName; } + inline const String& GetAddInName() const { return maAddInName; } inline sal_uInt32 GetStorageId() const { return mnStorageId; } }; @@ -210,6 +212,7 @@ private: String maUrl; /// URL of the external document. sal_uInt16 mnCurrExcTab; /// Current Excel sheet index of external cells. bool mbSelf; /// true = internal 3D references. + bool mbAddIn; /// true = Add-in function names. public: /** Reads the SUPBOOK record from stream. */ @@ -229,6 +232,8 @@ public: /** Returns true, if this SUPBOOK contains internal 3D references. */ inline bool IsSelf() const { return mbSelf; } + /** Returns true, if this SUPBOOK contains add-in function names. */ + inline bool IsAddIn() const { return mbAddIn; } /** Returns the URL of the external document. */ inline const String& GetUrl() const { return maUrl; } diff --git a/sc/source/filter/inc/xiroot.hxx b/sc/source/filter/inc/xiroot.hxx index a9df4df6d331..223703778a30 100644 --- a/sc/source/filter/inc/xiroot.hxx +++ b/sc/source/filter/inc/xiroot.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xiroot.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:16 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,7 @@ class XclImpXFBuffer; class XclImpXFIndexBuffer; class XclImpTabIdBuffer; class XclImpLinkManager; +class XclImpObjectManager; class XclImpWebQueryBuffer; /** Stores global buffers and data needed for Excel import filter. */ @@ -92,6 +93,7 @@ struct XclImpRootData : public XclRootData typedef ::std::auto_ptr< XclImpXFIndexBuffer > XclImpXFIndexBufferPtr; typedef ::std::auto_ptr< XclImpTabIdBuffer > XclImpTabIdBufferPtr; typedef ::std::auto_ptr< XclImpLinkManager > XclImpLinkManagerPtr; + typedef ::std::auto_ptr< XclImpObjectManager > XclImpObjectManagerPtr; typedef ::std::auto_ptr< XclImpWebQueryBuffer > XclImpWebQueryBufferPtr; XclImpSstPtr mpSst; /// The shared string table. @@ -105,11 +107,9 @@ struct XclImpRootData : public XclRootData XclImpTabIdBufferPtr mpTabIdBuffer; /// Sheet creation order list. XclImpLinkManagerPtr mpLinkManager; /// Manager for internal/external links. + XclImpObjectManagerPtr mpObjManager; /// All drawing objects. XclImpWebQueryBufferPtr mpWebQBuffer; /// All web queries. - ScfUInt32Vec maIgnoreObj; /// ID's of objects to ignore. - bool mbIgnoreObjSorted; /// Vector of ignored objects sorted? - explicit XclImpRootData( XclBiff eBiff, ScDocument& rDocument, @@ -132,6 +132,9 @@ public: XclImpRoot& operator=( const XclImpRoot& rRoot ); + /** Returns this root instance - for code readability in derived classes. */ + inline const XclImpRoot& GetRoot() const { return *this; } + /** Returns the shared string table. */ XclImpSst& GetSst() const; @@ -151,6 +154,8 @@ public: /** Returns the link manager. */ XclImpLinkManager& GetLinkManager() const; + /** Returns the drawing object manager. */ + XclImpObjectManager& GetObjectManager() const; /** Returns the web query buffer. */ XclImpWebQueryBuffer& GetWebQueryBuffer() const; @@ -164,11 +169,6 @@ public: @descr See XclRoot::CheckCellRangeList for details. */ void CheckCellRangeList( ScRangeList& rRanges ) const; - /** Sets the object with ID nObjId to be ignored on import. */ - void SetIgnoreObject( sal_uInt32 nObjId ); - /** Returns true, if the object with ID nObjId will be ignored. */ - bool IsIgnoreObject( sal_uInt32 nObjId ) const; - protected: explicit XclImpRoot( XclImpRootData& rImpRootData ); diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx index f969713536f8..aa3396555860 100644 --- a/sc/source/filter/inc/xistream.hxx +++ b/sc/source/filter/inc/xistream.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xistream.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:16 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,9 @@ Input stream class for Excel import // Decryption ================================================================= +#define SC_XCL_USEDECR 0 + +#if SC_XCL_USEDECR /** Base class for BIFF stream decryption. */ class XclImpDecrypter : ScfNoCopy { @@ -146,6 +149,7 @@ public: @return Count of bytes really read. */ virtual sal_uInt32 ReadDecrypt( SvStream& rStrm, void* pData, sal_uInt32 nBytes ); }; +#endif // ============================================================================ @@ -231,14 +235,18 @@ class XclImpRoot; class XclImpStream { private: +#if SC_XCL_USEDECR typedef ::std::auto_ptr< XclImpDecrypter > XclImpDecrypterPtr; +#endif typedef ScfDelStack< XclImpStreamPos > XclImpStreamPosStack; private: SvStream& mrStrm; /// Reference to the system input stream. const XclImpRoot& mrRoot; /// Filter root data. +#if SC_XCL_USEDECR XclImpDecrypterPtr mpDecrypter; /// Provides methods to decrypt data. +#endif XclImpStreamPos maFirstRec; /// Start position of current record. XclImpStreamPosStack maPosStack; /// Stack for record positions. @@ -260,7 +268,9 @@ private: sal_uInt32 mnRecLeft; /// Count of bytes left in current record. bool mbCont; /// Automatic CONTINUE lookup on/off. +#if SC_XCL_USEDECR bool mbUseDecr; /// Usage of decryption. +#endif bool mbValidRec; /// Read state: false = no record available. bool mbValid; /// Read state: false = record overread. bool mbWarnings; /// Enable/disable assertions. @@ -296,11 +306,13 @@ public: @param bWarnMode false = no overread assertions. */ inline void SetWarningMode( bool bWarnMode ) { mbWarnings = bWarnMode; } +#if SC_XCL_USEDECR /** Enables decryption of record contents for the rest of the stream. @descr Stream takes ownership of the decrypter object. */ void EnableDecryption( XclImpDecrypter* pDecrypter ); /** Switches usage of current decryption algorithm on/off. */ void UseDecryption( bool bUse ); +#endif /** Pushes current position on user position stack. @descr This stack is emptied at every start of a new record. */ @@ -452,8 +464,10 @@ public: inline sal_uInt32 GetStreamSize() const { return mnStreamSize; } private: +#if SC_XCL_USEDECR /** Initializes the key/stream offset of the decrypter. */ inline void SetDecrypterOffset( sal_uInt16 nRecSize ); +#endif /** Reads and decrypts a sal_Int8 value. */ void ReadAtom( sal_Int8& rnValue ); @@ -605,11 +619,13 @@ inline void XclImpStream::IgnoreByteString( bool b16BitLen ) // ---------------------------------------------------------------------------- +#if SC_XCL_USEDECR inline void XclImpStream::SetDecrypterOffset( sal_uInt16 nRecSize ) { if( mpDecrypter.get() ) mpDecrypter->SetOffset( nRecSize ); } +#endif // ============================================================================ diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index c5a82429e1f5..ad80a1ac0ff1 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xistyle.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:17 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,7 +99,7 @@ and a container for XF indexes for every used cell in a sheet. /** Stores the default colors for the current BIFF version and the contents of a PALETTE record. */ -class XclImpPalette : public XclDefaultPalette +class XclImpPalette : public XclDefaultPalette, protected XclImpRoot { private: typedef ::std::vector< ColorData > ColorDataVec; @@ -109,6 +109,9 @@ private: public: explicit XclImpPalette( const XclImpRoot& rRoot ); + /** Activates the default colors for the current BIFF version. */ + void OnChangeBiff(); + /** Returns the RGB color data for a (non-zero-based) Excel palette entry. @descr First looks for a color read from file, then looks for a default color. @param nDefault Is returned, if nothing else could be found. */ @@ -164,13 +167,12 @@ public: inline const XclFontData& GetFontData() const { return maData; } /** Returns true, if the font contains superscript or subscript. */ inline bool HasEscapement() const { return maData.meEscapem != xlEscNone; } + /** Returns the width of the '0' character on current printer (twips). */ + long GetCharWidth() const; /** Reads a FONT record for all BIFF versions. */ void ReadFont( XclImpStream& rStrm ); - /** Calculates a column scaling factor using the current printer settings. */ - double CalcColumnScale() const; - /** Fills all font properties to the item set. @param rItemSet The destination item set. @param eMode The type of which IDs. */ @@ -217,13 +219,16 @@ class XclImpFontBuffer : protected XclImpRoot, ScfNoCopy { private: ScfDelList< XclImpFont > maFontList; /// List of all FONT records in the Excel file. + XclFontData maAppFont; /// Application font (for column width). public: - inline explicit XclImpFontBuffer( const XclImpRoot& rRoot ) : XclImpRoot( rRoot ) {} + explicit XclImpFontBuffer( const XclImpRoot& rRoot ); /** Returns the object that stores all contents of a FONT record. */ inline const XclImpFont* GetFont( sal_uInt16 nFontIndex ) const { return maFontList.GetObject( nFontIndex ); } + /** Returns the application font data of this file, needed i.e. for column width. */ + inline const XclFontData& GetAppFontData() const { return maAppFont; } /** Reads a FONT record. */ void ReadFont( XclImpStream& rStrm ); @@ -246,7 +251,7 @@ class XclImpNumFmtBuffer : protected XclImpRoot, ScfNoCopy { private: ScfUInt32Vec maKeyVec; /// Array of SvNumberFomatter format keys. - sal_uInt32 mnDefault; /// Key for default format. + sal_uInt32 mnStdFmt; /// Key for standard number format. public: explicit XclImpNumFmtBuffer( const XclImpRoot& rRoot ); @@ -269,40 +274,66 @@ private: // XF, STYLE record - Cell formatting ========================================= -struct XclImpXFBorder; -struct XclImpXFArea; +/** Contains color and line style for each cell border line. */ +struct XclImpXFBorder +{ + sal_uInt16 mnLeftColor; /// Index to color for left line. + sal_uInt16 mnRightColor; /// Index to color for right line. + sal_uInt16 mnTopColor; /// Index to color for top line. + sal_uInt16 mnBottomColor; /// Index to color for bottom line. + sal_uInt8 mnLeftLine; /// Style of left line. + sal_uInt8 mnRightLine; /// Style of right line. + sal_uInt8 mnTopLine; /// Style of top line. + sal_uInt8 mnBottomLine; /// Style of bottom line. +}; + + +// ---------------------------------------------------------------------------- + +/** Contains background colors and pattern. */ +struct XclImpXFArea +{ + sal_uInt16 mnForeColor; /// Index to foreground color. + sal_uInt16 mnBackColor; /// Index to background color. + sal_uInt8 mnPattern; /// Fill pattern. +}; + + +// ---------------------------------------------------------------------------- + class SvxBorderLine; -/** Contains all data of a XF record and an ScPatternAttr (SetItem). */ +/** Contains all data of a XF record and a Calc item set. */ class XclImpXF : protected XclImpRoot, ScfNoCopy { private: typedef ::std::auto_ptr< ScPatternAttr > ScPatternAttrPtr; - typedef ::std::auto_ptr< XclImpXFBorder > XclImpXFBorderPtr; - typedef ::std::auto_ptr< XclImpXFArea > XclImpXFAreaPtr; - ScPatternAttrPtr mpPattern; /// Calc SetItem. - XclImpXFBorderPtr mpBorder; /// Border line style. - XclImpXFAreaPtr mpArea; /// Background area style. + mutable ScPatternAttrPtr mpPattern; /// Calc item set. + XclImpXFBorder maBorder; /// Border line style. + XclImpXFArea maArea; /// Background area style. XclHorAlign meHorAlign; /// Horizontal alignment. XclVerAlign meVerAlign; /// Vertical alignment. - XclTextWrap meWrap; /// Automatic line break. XclTextOrient meOrient; /// Text orientation. XclTextDirection meTextDir; /// CTL text direction. - sal_uInt8 mnRotation; /// Rotation angle. - sal_uInt32 mnValFormat; /// Id for value format. - sal_uInt16 mnIndent; /// Text indent. - sal_uInt16 mnFont; /// Index to font record. sal_uInt16 mnParent; /// Index to parent style XF. + sal_uInt32 mnNumFmt; /// Id for value format. + sal_uInt16 mnFont; /// Index to font record. + sal_uInt16 mnIndent; /// Text indent. + sal_uInt8 mnRotation; /// Rotation angle. - bool mbCellXF; /// true = cell XF, sal_False = style XF. + bool mbCellXF; /// true = cell XF, false = style XF. bool mbLocked; /// true = cell is locked. bool mbHidden; /// true = formulas are hidden. - bool mbFontValid; /// mnFont != parent->mnFont? - bool mbFmtValid; /// mnValFormat != parent->mnValFormat? - bool mbProtValid; /// mbLocked != parent->mbLocked or mbHidden != parent->mbHidden? + bool mbWrapped; /// true = automatic line break. + bool mbProtUsed; /// true = locked/hidden flags used. + bool mbFontUsed; /// true = font index used. + bool mbFmtUsed; /// true = number format used. + bool mbAlignUsed; /// true = alignment used. + bool mbBorderUsed; /// true = border data used. + bool mbAreaUsed; /// true = area data used. public: explicit XclImpXF( const XclImpRoot& rRoot ); @@ -311,9 +342,9 @@ public: /** Reads an XF record. */ void ReadXF( XclImpStream& rStrm ); - /** Creates a Calc SetItem containing an item set with all cell properties. - @return A read-only reference to the SetItem stored internally. */ - const ScPatternAttr& GetPattern(); + /** Creates a Calc item set containing an item set with all cell properties. + @return A read-only reference to the item set stored internally. */ + const ScPatternAttr& GetPattern() const; inline bool IsCellXF() const { return mbCellXF; } inline bool IsStyleXF() const { return !IsCellXF(); } @@ -322,34 +353,27 @@ public: inline XclVerAlign GetVerAlign() const { return meVerAlign; } inline sal_uInt16 GetFont() const { return mnFont; } - /** Inserts Excel border line styles into the item set. */ + /** Inserts the border line styles into the item set. */ static void SetBorder( - SfxItemSet& rItemSet, const XclImpPalette& rPalette, - sal_uInt8 nXclLeftLine, sal_uInt16 nXclLeftColor, - sal_uInt8 nXclRightLine, sal_uInt16 nXclRightColor, - sal_uInt8 nXclTopLine, sal_uInt16 nXclTopColor, - sal_uInt8 nXclBottomLine, sal_uInt16 nXclBottomColor ); + SfxItemSet& rItemSet, + const XclImpPalette& rPalette, + const XclImpXFBorder& rBorder ); - /** Inserts an Excel area style into the item set. */ + /** Inserts the area style into the item set. */ static void SetArea( - SfxItemSet& rItemSet, const XclImpPalette& rPalette, - sal_uInt8 nXclPattern, - sal_uInt16 nXclForeColor, sal_uInt16 nXclBackColor ); + SfxItemSet& rItemSet, + const XclImpPalette& rPalette, + const XclImpXFArea& rArea ); private: - /** Creates and returns the border data struct. */ - XclImpXFBorder& GetBorder(); - /** Creates and returns the area data struct. */ - XclImpXFArea& GetArea(); - void ReadXF2( XclImpStream& rStrm ); void ReadXF3( XclImpStream& rStrm ); void ReadXF4( XclImpStream& rStrm ); void ReadXF5( XclImpStream& rStrm ); void ReadXF8( XclImpStream& rStrm ); - /** Creates a new border line item. */ - static SvxBorderLine* CreateBorderItem( + /** Creates a new border line struct from passed line style. */ + static SvxBorderLine* CreateBorderLine( const XclImpPalette& rPalette, sal_uInt8 nXclLine, sal_uInt16 nXclColor ); }; @@ -363,7 +387,7 @@ class XclImpXFBuffer : protected XclImpRoot, ScfNoCopy { private: ScfDelList< XclImpXF > maXFList; /// List of contents of all XF record. - ScPatternAttr maDefPattern; /// This SetItem is used if no other could be found or created. + ScPatternAttr maDefPattern; /// Used if no styles could be found or created. public: explicit XclImpXFBuffer( const XclImpRoot& rRoot ); @@ -373,9 +397,9 @@ public: /** Reads a STYLE record. */ void ReadStyle( XclImpStream& rStrm ); - /** Creates a SetItem with all properties stored in the XF record. - @return A read-only reference to the SetItem stored internally. */ - const ScPatternAttr& GetPattern( sal_uInt32 nXFIndex ); + /** Creates a item set with all properties stored in the XF record. + @return A read-only reference to the item set stored internally. */ + const ScPatternAttr& GetPattern( sal_uInt32 nXFIndex ) const; /** Returns the object that stores all contents of an XF record. */ inline const XclImpXF* GetXF( sal_uInt32 nXFIndex ) const diff --git a/sc/source/filter/inc/xlconst.hxx b/sc/source/filter/inc/xlconst.hxx index 3106b6858bd3..b09227458898 100644 --- a/sc/source/filter/inc/xlconst.hxx +++ b/sc/source/filter/inc/xlconst.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xlconst.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -145,15 +145,25 @@ const sal_Int32 EXC_POINTS_PER_INCH = 72; const sal_Int32 EXC_TWIPS_PER_INCH = EXC_POINTS_PER_INCH * 20; +// Line styles ---------------------------------------------------------------- + +const sal_uInt8 EXC_LINE_NONE = 0x00; +const sal_uInt8 EXC_LINE_THIN = 0x01; +const sal_uInt8 EXC_LINE_MEDIUM = 0x02; +const sal_uInt8 EXC_LINE_THICK = 0x05; +const sal_uInt8 EXC_LINE_DOUBLE = 0x06; +const sal_uInt8 EXC_LINE_HAIR = 0x07; + + // Background patterns -------------------------------------------------------- -const sal_uInt16 EXC_PATT_NONE = 0x0000; -const sal_uInt16 EXC_PATT_SOLID = 0x0001; -const sal_uInt16 EXC_PATT_50_PERC = 0x0002; -const sal_uInt16 EXC_PATT_75_PERC = 0x0003; -const sal_uInt16 EXC_PATT_25_PERC = 0x0004; -const sal_uInt16 EXC_PATT_12_5_PERC = 0x0011; -const sal_uInt16 EXC_PATT_6_25_PERC = 0x0012; +const sal_uInt8 EXC_PATT_NONE = 0x00; +const sal_uInt8 EXC_PATT_SOLID = 0x01; +const sal_uInt8 EXC_PATT_50_PERC = 0x02; +const sal_uInt8 EXC_PATT_75_PERC = 0x03; +const sal_uInt8 EXC_PATT_25_PERC = 0x04; +const sal_uInt8 EXC_PATT_12_5_PERC = 0x11; +const sal_uInt8 EXC_PATT_6_25_PERC = 0x12; // Miscellaneous --------------------------------------------------------------- @@ -164,6 +174,11 @@ const sal_Unicode EXC_NEWLINE = EXC_NEWLINE_CHAR; // Records (ordered by lowest record ID) ====================================== +// (0x0007, 0x0207) STRING ---------------------------------------------------- + +const sal_uInt16 EXC_ID_STRING = 0x0207; + + // (0x0014, 0x0015) HEADER, FOOTER -------------------------------------------- const sal_uInt16 EXC_ID_HEADER = 0x0014; @@ -211,6 +226,12 @@ const sal_uInt16 EXC_ID_VERTPAGEBREAKS = 0x001A; const sal_uInt16 EXC_ID_HORPAGEBREAKS = 0x001B; +// (0x001C) NOTE -------------------------------------------------------------- + +const sal_uInt16 EXC_ID_NOTE = 0x001C; +const sal_uInt16 EXC_NOTE_VISIBLE = 0x0002; + + // (0x001E, 0x041E) FORMAT ---------------------------------------------------- const sal_uInt16 EXC_ID_FORMAT = 0x041E; @@ -300,26 +321,43 @@ const sal_uInt8 EXC_FONTCSET_SYMBOL = 0x02; const sal_uInt16 EXC_FONT_AUTOCOLOR = 0x7FFF; -// (0x0043, 0x00E0) XF -------------------------------------------------------- +// (0x0043, 0x0243, 0x0443, 0x00E0) XF ---------------------------------------- + +const sal_uInt16 EXC_ID2_XF = 0x0043; +const sal_uInt16 EXC_ID3_XF = 0x0243; +const sal_uInt16 EXC_ID4_XF = 0x0443; +const sal_uInt16 EXC_ID_XF = 0x00E0; + +const sal_uInt16 EXC_XF_OFFSET = 21; /// Index to first user defined record. +const sal_uInt32 EXC_XF_MAXCOUNT = 4029; /// Maximum number of user defined records. +const sal_uInt16 EXC_XF_DEFAULTSTYLE = 0; /// Excel index to cefault style XF. +const sal_uInt16 EXC_XF_DEFAULTCELL = 15; /// Excel index to cefault cell XF. const sal_uInt16 EXC_XF_LOCKED = 0x0001; const sal_uInt16 EXC_XF_HIDDEN = 0x0002; const sal_uInt16 EXC_XF_STYLE = 0x0004; +const sal_uInt16 EXC_XF_STYLEPARENT = 0x0FFF; /// Syles don't have a parent. +const sal_uInt16 EXC_XF_WRAPPED = 0x0008; /// Automatic line break. -const sal_uInt16 EXC_XF_DIFF_VALFMT = 0x0400; -const sal_uInt16 EXC_XF_DIFF_FONT = 0x0800; -const sal_uInt16 EXC_XF_DIFF_ALIGN = 0x1000; -const sal_uInt16 EXC_XF_DIFF_BORDER = 0x2000; -const sal_uInt16 EXC_XF_DIFF_AREA = 0x4000; -const sal_uInt16 EXC_XF_DIFF_PROT = 0x8000; +const sal_uInt8 EXC_XF_DIFF_VALFMT = 0x01; +const sal_uInt8 EXC_XF_DIFF_FONT = 0x02; +const sal_uInt8 EXC_XF_DIFF_ALIGN = 0x04; +const sal_uInt8 EXC_XF_DIFF_BORDER = 0x08; +const sal_uInt8 EXC_XF_DIFF_AREA = 0x10; +const sal_uInt8 EXC_XF_DIFF_PROT = 0x20; const sal_uInt8 EXC_XF2_VALFMT_MASK = 0x3F; const sal_uInt8 EXC_XF2_LOCKED = 0x40; const sal_uInt8 EXC_XF2_HIDDEN = 0x80; +const sal_uInt8 EXC_XF2_LEFTLINE = 0x08; +const sal_uInt8 EXC_XF2_RIGHTLINE = 0x10; +const sal_uInt8 EXC_XF2_TOPLINE = 0x20; +const sal_uInt8 EXC_XF2_BOTTOMLINE = 0x40; const sal_uInt8 EXC_XF2_BACKGROUND = 0x80; const sal_uInt16 EXC_XF8_SHRINKTOFIT = 0x0010; const sal_uInt16 EXC_XF8_MERGE = 0x0020; +const sal_uInt8 EXC_XF8_STACKED = 0xFF; /// Special rotation angle. // (0x0059, 0x005A) XCT, CRN -------------------------------------------------- @@ -364,12 +402,6 @@ const sal_uInt16 EXC_COLOR_BIFF2_BLACK = 0; const sal_uInt16 EXC_COLOR_BIFF2_WHITE = 1; -// (0x0093) STYLE ------------------------------------------------------------- - -const sal_uInt16 EXC_STYLE_BUILTIN = 0x8000; -const sal_uInt16 EXC_STYLE_MASK = 0x0FFF; - - // (0x00E9) BITMAP ------------------------------------------------------------ const sal_uInt16 EXC_ID_BITMAP = 0x00E9; @@ -459,6 +491,13 @@ const sal_uInt32 EXC_HLINK_FRAME = 0x00000080; /// Target frame. const sal_uInt32 EXC_HLINK_UNC = 0x00000100; /// UNC path. +// (0x0293) STYLE ------------------------------------------------------------- + +const sal_uInt16 EXC_ID_STYLE = 0x0293; +const sal_uInt16 EXC_STYLE_BUILTIN = 0x8000; +const sal_uInt16 EXC_STYLE_MASK = 0x0FFF; + + // web queries ================================================================ #define EXC_WEBQRY_FILTER "calc_HTML_WebQuery" diff --git a/sc/source/filter/inc/xlocx.hxx b/sc/source/filter/inc/xlocx.hxx new file mode 100644 index 000000000000..9c26776c03ae --- /dev/null +++ b/sc/source/filter/inc/xlocx.hxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * $RCSfile: xlocx.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: hr $ $Date: 2003-03-26 18:05:13 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +// ============================================================================ + +#ifndef SC_XLOCX_HXX +#define SC_XLOCX_HXX + +#ifndef _MSOCXIMEX_HXX +#include <svx/msocximex.hxx> +#endif + +#ifndef SC_XLROOT_HXX +#include "xlroot.hxx" +#endif + +const int EXC_INCL_EXP_OCX = 1; /// 1 = Compile with OCX export. + +// OCX controls =============================================================== + +/** Converter base class for import and export of OXC controls. + @descr The purpose of this class is to manage all the draw pages occuring in a + spreadsheet document. Derived classes implement import or export of the controls. */ +class XclOcxConverter : protected SvxMSConvertOCXControls, public XclRoot +{ +protected: + typedef ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > XFormComponentRef; + typedef ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > XShapeRef; + typedef ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > XDrawPageRef; + +private: + sal_uInt16 mnCurrTab; /// Stores sheet index of an object for GetDrawPage(). + sal_uInt16 mnCachedTab; /// Sheet index of cached draw page. + +protected: + explicit XclOcxConverter( const XclRoot& rRoot ); + virtual ~XclOcxConverter(); + + /** Sets the sheet index of the currently processed object. GetDrawPage() needs this. */ + void SetCurrTab( sal_uInt16 nTab ); + +private: + /** Returns the current draw page. */ + virtual const XDrawPageRef& GetDrawPage(); +}; + + +// ---------------------------------------------------------------------------- + +class XclImpEscherOle; + +/** Converter for import of OXC controls. */ +class XclImpOcxConverter : public XclOcxConverter +{ +private: + SvStorageStreamRef mxStrm; /// The 'Ctls' strem. + +public: + explicit XclImpOcxConverter( const XclRoot& rRoot ); + + /** Reads the form control data of the passed control object and creates it in the document. */ + void ReadControl( XclImpEscherOle& rObj ); + +private: + /** Inserts the passed control rxFComp into the document. */ + virtual sal_Bool InsertControl( + const XFormComponentRef& rxFComp, + const ::com::sun::star::awt::Size& rSize, + XShapeRef* pxShape, + BOOL bFloatingCtrl ); +}; + + +// ---------------------------------------------------------------------------- + +#if EXC_INCL_EXP_OCX + +class SdrObject; +class XclExpObjControl; + +/** Converter for export of OXC controls. */ +class XclExpOcxConverter : public XclOcxConverter +{ +private: + SvStorageStreamRef mxStrm; /// The 'Ctls' stream. + +public: + explicit XclExpOcxConverter( const XclRoot& rRoot ); + + /** Creates an OBJ record for the passed form control object. + @descr Writes the form control data to the 'Ctls' stream. */ + XclExpObjControl* CreateObjRec( const XShapeRef& rxShape ); +}; + +#endif + +// ============================================================================ + +#endif + diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx index c2d067759f03..8133821cee92 100644 --- a/sc/source/filter/inc/xlroot.hxx +++ b/sc/source/filter/inc/xlroot.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xlroot.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:18 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,6 +95,7 @@ struct XclRootData LanguageType meLang; /// Document language. ScAddress maScMaxPos; /// Highest Calc cell position. ScAddress maXclMaxPos; /// Highest Excel cell position. + long mnCharWidth; /// Width of '0' in default font (twips). sal_uInt16 mnScTab; /// Current Calc sheet index. bool mbTruncated; /// Flag for the table truncated warning box. @@ -104,6 +105,10 @@ struct XclRootData ::std::auto_ptr< RootData > mpRDP;//! +#ifdef DBG_UTIL + sal_Int32 mnObjCnt; /// Object counter for mem leak tests. +#endif + explicit XclRootData( XclBiff eBiff, ScDocument& rDocument, @@ -120,8 +125,10 @@ class ScModelObj; class SfxPrinter; class SvNumberFormatter; class ScRangeName; +class SvStorage; -/** Access to global data from other classes. */ +/** Access to global data for a filter object (imported or exported document) + from other classes. */ class XclRoot { private: @@ -135,6 +142,8 @@ public: RootData* mpRD;//! + /** Returns this root instance - for code readability in derived classes. */ + inline const XclRoot& GetRoot() const { return *this; } /** Returns the current BIFF version of the importer/exporter. */ inline XclBiff GetBiff() const { return mrData.meBiff; } /** Returns the document language. */ @@ -150,9 +159,13 @@ public: inline const String& GetBasePath() const { return mrData.maBasePath; } /** Returns the character set to import/export byte strings. */ inline CharSet GetCharSet() const { return mrData.meCharSet; } + /** Returns the width of the '0' character (default font) for the current printer (twips). */ + inline long GetCharWidth() const { return mrData.mnCharWidth; } /** Returns the destination document (import) or source document (export). */ inline ScDocument& GetDoc() const { return mrData.mrDoc; } + /** Returns pointer to the destination document (import) or source document (export). */ + inline ScDocument* GetDocPtr() const { return &mrData.mrDoc; } /** Returns the object shell of the Calc document. May be NULL (i.e. import from clipboard). */ SfxObjectShell* GetDocShell() const; /** Returns the object model of the Calc document. */ @@ -164,6 +177,10 @@ public: /** Returns the defined names container of the Calc document. */ ScRangeName& GetNamedRanges() const; + /** Returns the OLE2 root storage of the imported/exported file. + @return Pointer to root storage or 0, if the file is a simple stream. */ + SvStorage* GetRootStorage() const; + /** Returns the edit engine for import/export of rich strings etc. */ ScEditEngineDefaulter& GetEditEngine() const; /** Returns the edit engine for import/export of headers/footers. */ @@ -186,6 +203,8 @@ protected: inline void SetLanguage( LanguageType eLang ) { mrData.meLang = eLang; } /** Sets the character set to import/export byte strings. */ inline void SetCharSet( CharSet eCharSet ) { mrData.meCharSet = eCharSet; } + /** Sets the width of the '0' character (default font) for the current printer (twips). */ + inline void SetCharWidth( long nCharWidth ) { mrData.mnCharWidth = nCharWidth; } /** Increases the current Calc sheet index by 1. */ inline void IncScTab() { ++mrData.mnScTab; } diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx index c974559c4cc7..7cfccacfc9e2 100644 --- a/sc/source/filter/inc/xlstyle.hxx +++ b/sc/source/filter/inc/xlstyle.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xlstyle.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: dr $ $Date: 2002-11-21 12:11:18 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,7 +72,7 @@ // Color data ================================================================= /** Stores all default colors for a specific BIFF version. */ -class XclDefaultPalette : ScfNoCopy +class XclDefaultPalette { private: const ColorData* mpColorTable; /// The table with RGB values. @@ -83,7 +83,7 @@ public: explicit XclDefaultPalette( XclBiff eBiff = xlBiffUnknown ); /** Activates the default colors for the passed BIFF version. */ - void SetBiff( XclBiff eBiff ); + void SetDefaultColors( XclBiff eBiff ); /** Returns the color count in the current palette. */ inline sal_uInt32 GetColorCount() const { return mnTableSize; } @@ -110,7 +110,7 @@ inline Color XclDefaultPalette::GetDefColor( sal_uInt16 nXclIndex, ColorData nDe } -// Font Data ================================================================== +// Font data ================================================================== /** Text underline style. */ enum XclUnderline @@ -172,7 +172,7 @@ enum XclHorAlign xlHAlignFill = 0x04, xlHAlignJustify = 0x05, xlHAlignCenterAcrSel = 0x06, - xlHAlignParent = 0xFF + xlHAlignDistrib = 0x07 }; /** Vertical alignment of cell contents. */ @@ -182,8 +182,7 @@ enum XclVerAlign xlVAlignCenter = 0x01, xlVAlignBottom = 0x02, xlVAlignJustify = 0x03, - xlVAlignDistrib = 0x04, - xlVAlignParent = 0xFF + xlVAlignDistrib = 0x04 }; /** Text orientation. */ @@ -193,16 +192,7 @@ enum XclTextOrient xlTextOrientTopBottom = 0x01, xlTextOrient90ccw = 0x02, xlTextOrient90cw = 0x03, - xlTextOrientRot = 0x04, - xlTextOrientParent = 0xFF -}; - -/** Text wrap (automatic line break). */ -enum XclTextWrap -{ - xlTextWrapNo = 0x00, - xlTextWrapYes = 0x01, - xlTextWrapParent = 0xFF + xlTextOrientRot = 0x04 }; /** CTL text direction. */ @@ -210,8 +200,7 @@ enum XclTextDirection { xlTextDirContext = 0x00, xlTextDirLTR = 0x01, - xlTextDirRTL = 0x02, - xlTextDirParent = 0xFF + xlTextDirRTL = 0x02 }; diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx index 195e11382a71..8027132e6fcc 100644 --- a/sc/source/filter/inc/xltools.hxx +++ b/sc/source/filter/inc/xltools.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xltools.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2002-12-06 16:41:09 $ + * last change: $Author: hr $ $Date: 2003-03-26 18:05:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,7 +81,7 @@ /** An enumeration for all Excel file format types (BIFF types). */ enum XclBiff { - xlBiff2, /// MS Excel 2.1 + xlBiff2 = 0, /// MS Excel 2.1 xlBiff3, /// MS Excel 3.x xlBiff4, /// MS Excel 4.x xlBiff5, /// MS Excel 5.x @@ -117,14 +117,12 @@ enum XclBoolError class XclImpStream; class XclExpStream; -/** This struct stores a GUID (class ID) and supports reading, writing and - comparison. */ +/** This struct stores a GUID (class ID) and supports reading, writing and comparison. */ struct XclGuid { - sal_uInt8 mpData[ 16 ]; + sal_uInt8 mpData[ 16 ]; /// Stores GUID always in little endian. explicit XclGuid(); - XclGuid( const XclGuid& rSrc ); explicit XclGuid( sal_uInt32 nData1, sal_uInt16 nData2, sal_uInt16 nData3, @@ -132,8 +130,6 @@ struct XclGuid sal_uInt8 nData43, sal_uInt8 nData44, sal_uInt8 nData45, sal_uInt8 nData46, sal_uInt8 nData47, sal_uInt8 nData48 ); - - XclGuid& operator=( const XclGuid& rSrc ); }; bool operator==( const XclGuid& rCmp1, const XclGuid& rCmp2 ); @@ -172,9 +168,9 @@ public: static bool GetRKFromDouble( sal_Int32& rnRKValue, double fValue ); /** Calculates an angle (in 1/100 of degrees) from an Excel angle value. */ - static sal_Int32 GetScRotation( sal_uInt16 nExcRot ); + static sal_Int32 GetScRotation( sal_uInt16 nXclRot ); /** Calculates the Excel angle value from an angle in 1/100 of degrees. */ - static sal_uInt16 GetExcRotation( sal_Int32 nScRot ); + static sal_uInt8 GetXclRotation( sal_Int32 nScRot ); /** Gets a translated error code or Boolean value from Excel error codes. @param rfDblValue Returns 0.0 for error codes or the value of a Boolean (0.0 or 1.0). @@ -192,6 +188,13 @@ public: /** Returns the length in inches calculated from a length in twips. */ static double GetInchFromTwips( sal_uInt16 nTwips ); + /** Returns the Calc column width (twips) for the passed Excel width. + @param nScCharWidth Width of the '0' character in Calc (twips). */ + static sal_uInt16 GetScColumnWidth( sal_uInt16 nXclWidth, long nScCharWidth ); + /** Returns the Excel column width for the passed Calc width (twips). + @param nScCharWidth Width of the '0' character in Calc (twips). */ + static sal_uInt16 GetXclColumnWidth( sal_uInt16 nScWidth, long nScCharWidth ); + // built-in names ------------------------------------------------------------- /** Returns an Excel built-in name used in NAME records. */ |