From 5dc897e1c36d4162e9cdb9768284e5cec8daba57 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Thu, 29 Jul 2010 15:04:40 +0200 Subject: dr77: add import of tab color from BIFF8 in OOX filter --- oox/inc/oox/xls/worksheetsettings.hxx | 2 ++ oox/source/xls/chartsheetfragment.cxx | 1 + oox/source/xls/worksheetfragment.cxx | 1 + oox/source/xls/worksheetsettings.cxx | 35 ++++++++++++++++++++++------------- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/oox/inc/oox/xls/worksheetsettings.hxx b/oox/inc/oox/xls/worksheetsettings.hxx index 17e22dc5342c..990a463b3545 100644 --- a/oox/inc/oox/xls/worksheetsettings.hxx +++ b/oox/inc/oox/xls/worksheetsettings.hxx @@ -108,6 +108,8 @@ public: /** Imports phonetic settings from the PHONETICPR record. */ void importPhoneticPr( RecordInputStream& rStrm ); + /** Imports sheet properties from a SHEETEXT record. */ + void importSheetExt( BiffInputStream& rStrm ); /** Imports sheet properties from a SHEETPR record. */ void importSheetPr( BiffInputStream& rStrm ); /** Imports protection status from the PROTECT record. */ diff --git a/oox/source/xls/chartsheetfragment.cxx b/oox/source/xls/chartsheetfragment.cxx index 287518584cc3..fe1cdfa179bb 100644 --- a/oox/source/xls/chartsheetfragment.cxx +++ b/oox/source/xls/chartsheetfragment.cxx @@ -269,6 +269,7 @@ bool BiffChartsheetFragment::importFragment() case BIFF_ID_PICTURE: rPageSett.importPicture( mrStrm ); break; case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break; case BIFF_ID_SCL: rSheetViewSett.importScl( mrStrm ); break; + case BIFF_ID_SHEETEXT: rWorksheetSett.importSheetExt( mrStrm ); break; case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break; case BIFF3_ID_WINDOW2: rSheetViewSett.importWindow2( mrStrm ); break; } diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx index bee58fdbaff3..d75c92832994 100644 --- a/oox/source/xls/worksheetfragment.cxx +++ b/oox/source/xls/worksheetfragment.cxx @@ -898,6 +898,7 @@ bool BiffWorksheetFragment::importFragment() case BIFF_ID_SCENARIOS: importScenarios(); break; case BIFF_ID_SCENPROTECT: rWorksheetSett.importScenProtect( mrStrm ); break; case BIFF_ID_SCL: rSheetViewSett.importScl( mrStrm ); break; + case BIFF_ID_SHEETEXT: rWorksheetSett.importSheetExt( mrStrm ); break; case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( mrStrm ); break; case BIFF_ID_SHAREDFEATHEAD: importSharedFeatHead(); break; case BIFF_ID_STANDARDWIDTH: importStandardWidth(); break; diff --git a/oox/source/xls/worksheetsettings.cxx b/oox/source/xls/worksheetsettings.cxx index 0cc9d5f17780..712a57803349 100644 --- a/oox/source/xls/worksheetsettings.cxx +++ b/oox/source/xls/worksheetsettings.cxx @@ -26,23 +26,20 @@ ************************************************************************/ #include "oox/xls/worksheetsettings.hxx" +#include #include "oox/helper/attributelist.hxx" #include "oox/helper/recordinputstream.hxx" +#include "oox/core/filterbase.hxx" #include "oox/xls/biffinputstream.hxx" #include "oox/xls/pagesettings.hxx" #include "oox/xls/workbooksettings.hxx" -#include "oox/core/filterbase.hxx" #include "properties.hxx" -#include +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; using ::rtl::OUString; -using ::com::sun::star::beans::XPropertySet; -using ::com::sun::star::uno::Any; -using ::com::sun::star::uno::Exception; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::UNO_QUERY_THROW; -using ::com::sun::star::util::XProtectable; using ::oox::core::CodecHelper; namespace oox { @@ -55,12 +52,14 @@ namespace { const sal_uInt8 OOBIN_SHEETPR_FILTERMODE = 0x01; const sal_uInt8 OOBIN_SHEETPR_EVAL_CF = 0x02; +const sal_uInt32 BIFF_SHEETEXT_NOTABCOLOR = 0x7F; + const sal_uInt16 BIFF_SHEETPR_DIALOGSHEET = 0x0010; const sal_uInt16 BIFF_SHEETPR_APPLYSTYLES = 0x0020; const sal_uInt16 BIFF_SHEETPR_SYMBOLSBELOW = 0x0040; const sal_uInt16 BIFF_SHEETPR_SYMBOLSRIGHT = 0x0080; const sal_uInt16 BIFF_SHEETPR_FITTOPAGES = 0x0100; -const sal_uInt16 BIFF_SHEETPR_SKIPEXT = 0x0200; /// BIFF3-BIFF4 +const sal_uInt16 BIFF_SHEETPR_SKIPEXT = 0x0200; // BIFF3-BIFF4 const sal_uInt32 BIFF_SHEETPROT_OBJECTS = 0x00000001; const sal_uInt32 BIFF_SHEETPROT_SCENARIOS = 0x00000002; @@ -236,6 +235,16 @@ void WorksheetSettings::importPhoneticPr( RecordInputStream& rStrm ) maPhoneticSett.importPhoneticPr( rStrm ); } +void WorksheetSettings::importSheetExt( BiffInputStream& rStrm ) +{ + rStrm.skip( 16 ); + sal_uInt32 nFlags; + rStrm >> nFlags; + sal_uInt8 nColorIdx = extractValue< sal_uInt8 >( nFlags, 0, 7 ); + if( nColorIdx != BIFF_SHEETEXT_NOTABCOLOR ) + maSheetSettings.maTabColor.setPaletteClr( nColorIdx ); +} + void WorksheetSettings::importSheetPr( BiffInputStream& rStrm ) { sal_uInt16 nFlags; @@ -324,10 +333,11 @@ void WorksheetSettings::finalizeImport() PropertySet aPropSet( getSheet() ); aPropSet.setProperty( PROP_CodeName, maSheetSettings.maCodeName ); - if (!maSheetSettings.maTabColor.isAuto()) + // sheet tab color + if( !maSheetSettings.maTabColor.isAuto() ) { - sal_Int32 nColor = maSheetSettings.maTabColor.getColor(getBaseFilter().getGraphicHelper()); - aPropSet.setProperty(PROP_TabColor, nColor); + sal_Int32 nColor = maSheetSettings.maTabColor.getColor( getBaseFilter().getGraphicHelper() ); + aPropSet.setProperty( PROP_TabColor, nColor ); } } @@ -335,4 +345,3 @@ void WorksheetSettings::finalizeImport() } // namespace xls } // namespace oox - -- cgit