sc/source/filter/excel/xicontent.cxx | 35 +++++++++++++++++++++++++++++++++-- sc/source/filter/excel/xistream.cxx | 24 ------------------------ sc/source/filter/excel/xistyle.cxx | 30 ++++++++++++++++++++++++++++++ sc/source/filter/inc/xistyle.hxx | 28 ++++++---------------------- sc/source/filter/inc/xlcontent.hxx | 4 ++++ sc/source/filter/inc/xlstyle.hxx | 18 ------------------ 6 files changed, 73 insertions(+), 66 deletions(-)
New commits: commit 570200983a0eded4a4d3bfcefc6a4cfa3d388f1d Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Apr 6 16:25:25 2014 +0200 import dxf protection record from xls, related fdo#76209 Change-Id: Ic8b4cd30b383763b034942d5a80914340d416c28 diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 4016929..8e45697 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -614,6 +614,15 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) aArea.FillToItemSet( rStyleItemSet, rPalette ); } + if( get_flag( nFlags, EXC_CF_BLOCK_PROTECTION ) ) + { + sal_uInt16 nCellProt; + rStrm >> nCellProt; + XclImpCellProt aCellProt; + aCellProt.FillFromXF3(nCellProt); + aCellProt.FillToItemSet( rStyleItemSet ); + } + // *** formulas *** const ScAddress& rPos = maRanges.front()->aStart; // assured above that maRanges is not empty diff --git a/sc/source/filter/inc/xlcontent.hxx b/sc/source/filter/inc/xlcontent.hxx index 3e0fefc..2dfe066 100644 --- a/sc/source/filter/inc/xlcontent.hxx +++ b/sc/source/filter/inc/xlcontent.hxx @@ -85,6 +85,7 @@ const sal_uInt32 EXC_CF_BLOCK_FONT = 0x04000000; /// Font block prese const sal_uInt32 EXC_CF_BLOCK_ALIGNMENT = 0x08000000; /// Alignment block present? const sal_uInt32 EXC_CF_BLOCK_BORDER = 0x10000000; /// Border block present? const sal_uInt32 EXC_CF_BLOCK_AREA = 0x20000000; /// Pattern block present? +const sal_uInt32 EXC_CF_BLOCK_PROTECTION = 0x20000000; /// Protection block present? const sal_uInt32 EXC_CF_IFMT_USER = 0x1; /// NumberFormat String or Id? const sal_uInt32 EXC_CF_FONT_STYLE = 0x00000002; /// Font posture or weight modified? commit ac6773e1e3e1382990c0f1942001b8b07cdc4682 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Apr 6 14:49:33 2014 +0200 import dxf number format record, related fdo#76209 Thanks to Morten Welinder for pointing to the missing pieces. Change-Id: I5eb447161ac5d79257a64acaa01e56374ba81587 diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 5c04f8a..4016929 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -514,9 +514,9 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) sal_uInt8 nType(0), nOperator(0); sal_uInt16 nFmlaSize1(0), nFmlaSize2(0); sal_uInt32 nFlags(0); + sal_uInt16 nFlagsExtended(0); - rStrm >> nType >> nOperator >> nFmlaSize1 >> nFmlaSize2 >> nFlags; - rStrm.Ignore( 2 ); + rStrm >> nType >> nOperator >> nFmlaSize1 >> nFmlaSize2 >> nFlags >> nFlagsExtended; // *** mode and comparison operator *** @@ -557,6 +557,16 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) const XclImpPalette& rPalette = GetPalette(); + // number format + + if( get_flag( nFlags, EXC_CF_BLOCK_NUMFMT ) ) + { + XclImpNumFmtBuffer& rNumFmtBuffer = GetRoot().GetNumFmtBuffer(); + bool bIFmt = get_flag( nFlags, EXC_CF_IFMT_USER ); + sal_uInt16 nFormat = rNumFmtBuffer.ReadCFFormat( rStrm, bIFmt ); + rNumFmtBuffer.FillToItemSet( rStyleItemSet, nFormat ); + } + // *** font block *** if( ::get_flag( nFlags, EXC_CF_BLOCK_FONT ) ) diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 4ed6ca4..55549cb 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -650,6 +650,25 @@ void XclImpNumFmtBuffer::ReadFormat( XclImpStream& rStrm ) } } +sal_uInt16 XclImpNumFmtBuffer::ReadCFFormat( XclImpStream& rStrm, bool bIFmt ) +{ + // internal number format ? + if(bIFmt) + { + rStrm.Ignore(1); + sal_uInt8 nIndex; + rStrm >> nIndex; + return nIndex; + } + else + { + OUString aFormat = rStrm.ReadUniString(); + InsertFormat( mnNextXclIdx, aFormat ); + ++mnNextXclIdx; + return mnNextXclIdx - 1; + } +} + void XclImpNumFmtBuffer::CreateScFormats() { OSL_ENSURE( maIndexMap.empty(), "XclImpNumFmtBuffer::CreateScFormats - already created" ); diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index 9271d5f..015263d 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -216,6 +216,10 @@ public: /** Reads a FORMAT record. */ void ReadFormat( XclImpStream& rStrm ); + + /** Read NumFmt from conditional format record */ + sal_uInt16 ReadCFFormat( XclImpStream& rStrm, bool bIFmt ); + /** Creates the number formats in the Calc document. */ void CreateScFormats(); diff --git a/sc/source/filter/inc/xlcontent.hxx b/sc/source/filter/inc/xlcontent.hxx index 416923f..3e0fefc 100644 --- a/sc/source/filter/inc/xlcontent.hxx +++ b/sc/source/filter/inc/xlcontent.hxx @@ -80,10 +80,12 @@ const sal_uInt32 EXC_CF_AREA_FGCOLOR = 0x00020000; /// Foreground color const sal_uInt32 EXC_CF_AREA_BGCOLOR = 0x00040000; /// Background color modified? const sal_uInt32 EXC_CF_AREA_ALL = 0x00070000; /// Any area attribute modified? const sal_uInt32 EXC_CF_ALLDEFAULT = 0x003FFFFF; /// Default flags. +const sal_uInt32 EXC_CF_BLOCK_NUMFMT = 0x02000000; /// Font block present? const sal_uInt32 EXC_CF_BLOCK_FONT = 0x04000000; /// Font block present? const sal_uInt32 EXC_CF_BLOCK_ALIGNMENT = 0x08000000; /// Alignment block present? const sal_uInt32 EXC_CF_BLOCK_BORDER = 0x10000000; /// Border block present? const sal_uInt32 EXC_CF_BLOCK_AREA = 0x20000000; /// Pattern block present? +const sal_uInt32 EXC_CF_IFMT_USER = 0x1; /// NumberFormat String or Id? const sal_uInt32 EXC_CF_FONT_STYLE = 0x00000002; /// Font posture or weight modified? const sal_uInt32 EXC_CF_FONT_STRIKEOUT = 0x00000080; /// Font cancellation modified? commit 7cc6de1cc2cfb466131072c2a1cd99c4a6279ebc Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Apr 6 14:42:08 2014 +0200 remove whitespace Change-Id: Id8014a1165876e903a7a4311af43d4a946703f11 diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index d31268c..448f7cf 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include <comphelper/docpasswordhelper.hxx> #include <comphelper/sequenceashashmap.hxx> #include <osl/thread.h> @@ -27,13 +26,9 @@ #include <vector> - using namespace ::com::sun::star; - // Decryption - - XclImpDecrypter::XclImpDecrypter() : mnError( EXC_ENCR_ERROR_UNSUPP_CRYPT ), mnOldPos( STREAM_SEEK_TO_END ), @@ -106,8 +101,6 @@ sal_uInt16 XclImpDecrypter::Read( SvStream& rStrm, void* pData, sal_uInt16 nByte return nRet; } - - XclImpBiff5Decrypter::XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash ) : mnKey( nKey ), mnHash( nHash ) @@ -197,8 +190,6 @@ sal_uInt16 XclImpBiff5Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal return nRet; } - - XclImpBiff8Decrypter::XclImpBiff8Decrypter( sal_uInt8 pnSalt[ 16 ], sal_uInt8 pnVerifier[ 16 ], sal_uInt8 pnVerifierHash[ 16 ] ) : maSalt( pnSalt, pnSalt + 16 ), @@ -321,10 +312,7 @@ sal_uInt16 XclImpBiff8Decrypter::GetOffset( sal_Size nStrmPos ) const return static_cast< sal_uInt16 >( nStrmPos % EXC_ENCR_BLOCKSIZE ); } - // Stream - - XclImpStreamPos::XclImpStreamPos() : mnPos( STREAM_SEEK_TO_BEGIN ), mnNextPos( STREAM_SEEK_TO_BEGIN ), @@ -364,8 +352,6 @@ void XclImpStreamPos::Get( rbValid = mbValid; } - - XclBiff XclImpStream::DetectBiffVersion( SvStream& rStrm ) { XclBiff eBiff = EXC_BIFF_UNKNOWN; @@ -512,8 +498,6 @@ void XclImpStream::EnableDecryption( bool bEnable ) mbUseDecr = bEnable && HasValidDecrypter(); } - - void XclImpStream::PushPosition() { maPosStack.push_back( XclImpStreamPos() ); @@ -604,8 +588,6 @@ sal_uInt16 XclImpStream::PeekRecId( sal_Size nPos ) return nRecId; } - - XclImpStream& XclImpStream::operator>>( sal_Int8& rnValue ) { if( EnsureRawReadSize( 1 ) ) @@ -872,8 +854,6 @@ void XclImpStream::Ignore( sal_Size nBytes ) } } - - sal_Size XclImpStream::ReadUniStringExtHeader( bool& rb16Bit, bool& rbRich, bool& rbFareast, sal_uInt16& rnFormatRuns, sal_uInt32& rnExtInf, sal_uInt8 nFlags ) @@ -895,8 +875,6 @@ sal_Size XclImpStream::ReadUniStringExtHeader( bool& rb16Bit, sal_uInt8 nFlags ) return ReadUniStringExtHeader( rb16Bit, bRich, bFareast, nCrun, nExtInf, nFlags ); } - - OUString XclImpStream::ReadRawUniString( sal_uInt16 nChars, bool b16Bit ) { OUString aRet; @@ -1008,8 +986,6 @@ void XclImpStream::IgnoreUniString( sal_uInt16 nChars ) IgnoreUniString( nChars, ReaduInt8() ); } - - OUString XclImpStream::ReadRawByteString( sal_uInt16 nChars ) { sal_Char* pcBuffer = new sal_Char[ nChars + 1 ]; commit 74116032d3ebab422ba8508f42198d101822024f Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Apr 6 14:38:55 2014 +0200 import alignment dxf record, related fdo#76209 Thanks to Morten Welinder for pointing to the missing piece. Change-Id: Ib527eb4f7d90fa1abc13446ac61631cf1a6a6e67 diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index bb5ec44..5c04f8a 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -566,6 +566,18 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) aFont.FillToItemSet( rStyleItemSet, EXC_FONTITEM_CELL ); } + // alignment + if( get_flag( nFlags, EXC_CF_BLOCK_ALIGNMENT ) ) + { + XclImpCellAlign aAlign; + sal_uInt16 nAlign(0); + sal_uInt16 nAlignMisc(0); + rStrm >> nAlign >> nAlignMisc; + aAlign.FillFromCF( nAlign, nAlignMisc ); + aAlign.FillToItemSet( rStyleItemSet, NULL ); + rStrm.Ignore(4); + } + // *** border block *** if( ::get_flag( nFlags, EXC_CF_BLOCK_BORDER ) ) diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 132a0d3..4ed6ca4 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -758,6 +758,17 @@ void XclImpCellAlign::FillFromXF8( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib ) mnTextDir = ::extract_value< sal_uInt8 >( nMiscAttrib, 6, 2 ); // new in BIFF8 } +void XclImpCellAlign::FillFromCF( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib ) +{ + mnHorAlign = extract_value< sal_uInt8 >( nAlign, 0, 3 ); + mbLineBreak = get_flag< sal_uInt8 >( nAlign, EXC_XF_LINEBREAK ); + mnVerAlign = ::extract_value< sal_uInt8 >( nAlign, 4, 3 ); + mnRotation = ::extract_value< sal_uInt8 >( nAlign, 8, 8 ); + mnIndent = ::extract_value< sal_uInt8 >( nMiscAttrib, 0, 4 ); + mbShrink = ::get_flag( nMiscAttrib, EXC_XF8_SHRINK ); + mnTextDir = ::extract_value< sal_uInt8 >( nMiscAttrib, 6, 2 ); +} + void XclImpCellAlign::FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFont, bool bSkipPoolDefs ) const { // horizontal alignment diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index 205d7f3..9271d5f 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -274,6 +274,8 @@ struct XclImpCellAlign : public XclCellAlign void FillFromXF5( sal_uInt16 nAlign ); /** Fills this struct with BIFF8 XF record data. */ void FillFromXF8( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib ); + /** Fills this struct with CF record data. */ + void FillFromCF( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib ); /** Inserts items representing this alignment style into the item set. @param bSkipPoolDefs true = Do not put items equal to pool default; false = Put all items. */ diff --git a/sc/source/filter/inc/xlcontent.hxx b/sc/source/filter/inc/xlcontent.hxx index 9d00dcb..416923f 100644 --- a/sc/source/filter/inc/xlcontent.hxx +++ b/sc/source/filter/inc/xlcontent.hxx @@ -81,6 +81,7 @@ const sal_uInt32 EXC_CF_AREA_BGCOLOR = 0x00040000; /// Background color const sal_uInt32 EXC_CF_AREA_ALL = 0x00070000; /// Any area attribute modified? const sal_uInt32 EXC_CF_ALLDEFAULT = 0x003FFFFF; /// Default flags. const sal_uInt32 EXC_CF_BLOCK_FONT = 0x04000000; /// Font block present? +const sal_uInt32 EXC_CF_BLOCK_ALIGNMENT = 0x08000000; /// Alignment block present? const sal_uInt32 EXC_CF_BLOCK_BORDER = 0x10000000; /// Border block present? const sal_uInt32 EXC_CF_BLOCK_AREA = 0x20000000; /// Pattern block present? commit 29eaf927d7ddede41889b70c25a991382bd5c05a Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Apr 6 14:34:59 2014 +0200 remove whitespace Change-Id: I9b8302b3a032c48ffacea94280db9e8466cc003c diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index 6a9fb37..205d7f3 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -158,8 +158,6 @@ private: bool mbShadowUsed; /// true = Shadowed used. }; - - /** Stores the data of all fonts occurred in an Excel file. */ class XclImpFontBuffer : protected XclImpRoot, private boost::noncopyable { @@ -262,8 +260,6 @@ struct XclImpCellProt : public XclCellProt void FillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const; }; - - /** Extends the XclCellAlign struct for import. @descr Provides functions to fill from Excel record data and to fill to item sets. */ struct XclImpCellAlign : public XclCellAlign @@ -284,8 +280,6 @@ struct XclImpCellAlign : public XclCellAlign void FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFont, bool bSkipPoolDefs = false ) const; }; - - /** Extends the XclCellBorder struct for import. @descr Provides functions to fill from Excel record data and to fill to item sets. */ struct XclImpCellBorder : public XclCellBorder @@ -324,8 +318,6 @@ struct XclImpCellBorder : public XclCellBorder bool bSkipPoolDefs = false ) const; }; - - /** Extends the XclCellArea struct for import. @descr Provides functions to fill from Excel record data and to fill to item sets. */ struct XclImpCellArea : public XclCellArea @@ -359,8 +351,6 @@ struct XclImpCellArea : public XclCellArea bool bSkipPoolDefs = false ) const; }; - - /** Represents an XF record index with additional information. */ class XclImpXFIndex { @@ -382,8 +372,6 @@ inline bool operator==( const XclImpXFIndex& rLeft, const XclImpXFIndex& rRight inline bool operator!=( const XclImpXFIndex& rLeft, const XclImpXFIndex& rRight ) { return !(rLeft == rRight); } - - /** Contains all data of a XF record and a Calc item set. */ class XclImpXF : public XclXFBase, protected XclImpRoot, private boost::noncopyable { @@ -447,8 +435,6 @@ private: sal_uInt16 mnXclFont; /// Index to font record. }; - - /** Contains all data of a cell style associated with an XF record. */ class XclImpStyle : protected XclImpRoot { @@ -483,8 +469,6 @@ private: ScStyleSheet* mpStyleSheet; /// Calc cell style sheet. }; - - /** Contains all XF records occurred in the file. @descr This class is able to read XF records (BIFF2 - BIFF8) and STYLE records (BIFF8). */ class XclImpXFBuffer : protected XclImpRoot, private boost::noncopyable @@ -571,8 +555,6 @@ inline bool XclImpXFRange::Contains( SCROW nScRow ) const return (mnScRow1 <= nScRow) && (nScRow <= mnScRow2); } - - /** Contains the XF indexes for every used cell in a column. */ class XclImpXFRangeColumn : private boost::noncopyable { @@ -611,8 +593,6 @@ private: IndexList maIndexList; /// The list of XF index range. }; - - /** Contains the XF indexes for every used cell in a single sheet. */ class XclImpXFRangeBuffer : protected XclImpRoot, private boost::noncopyable { @@ -677,8 +657,6 @@ private: ScRangeList maMergeList; /// List of merged cell ranges. }; - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx index 76caec7..e5acee9 100644 --- a/sc/source/filter/inc/xlstyle.hxx +++ b/sc/source/filter/inc/xlstyle.hxx @@ -247,8 +247,6 @@ const sal_uInt8 EXC_STYLEEXT_BUILTIN = 0x01; const sal_uInt8 EXC_STYLEEXT_HIDDEN = 0x02; const sal_uInt8 EXC_STYLEEXT_CUSTOM = 0x04; -// Structs and classes ======================================================== - // Color data ================================================================= /** Stores all default colors for a specific BIFF version. */ @@ -391,8 +389,6 @@ struct XclFontData bool operator==( const XclFontData& rLeft, const XclFontData& rRight ); - - /** Enumerates different types of Which-IDs for font items. */ enum XclFontItemType { @@ -409,8 +405,6 @@ enum XclFontPropSetType EXC_FONTPROPSET_CONTROL /// Text formatting in form controls. }; - - /** Helper class for usage of property sets. */ class XclFontPropSetHelper { @@ -454,8 +448,6 @@ struct XclNumFmt LanguageType meLanguage; /// Language type to be set with the number format. }; - - class XclNumFmtBuffer { public: @@ -498,8 +490,6 @@ struct XclCellProt bool operator==( const XclCellProt& rLeft, const XclCellProt& rRight ); - - /** Contains all cell alignment attributes. */ struct XclCellAlign { @@ -535,8 +525,6 @@ struct XclCellAlign bool operator==( const XclCellAlign& rLeft, const XclCellAlign& rRight ); - - /** Contains color and line style for each cell border line. */ struct XclCellBorder { @@ -558,8 +546,6 @@ struct XclCellBorder bool operator==( const XclCellBorder& rLeft, const XclCellBorder& rRight ); - - /** Contains background colors and pattern for a cell. */ struct XclCellArea { @@ -575,8 +561,6 @@ struct XclCellArea bool operator==( const XclCellArea& rLeft, const XclCellArea& rRight ); - - /** Contains base members for XF record import/export. @descr In detail this class stores the XF type (cell/style), the index to the parent style XF and all "attribute used" flags, which reflect the state of @@ -612,8 +596,6 @@ protected: bool mbAreaUsed; /// true = area data used. }; - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits