summaryrefslogtreecommitdiff
path: root/oox/source/xls
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-02-23 10:52:09 -0500
committerKohei Yoshida <kyoshida@novell.com>2010-02-23 10:52:09 -0500
commitde2b208848cd416a1b9a63f7cc662d653b06a04b (patch)
tree574e3e7830fcede487d126905f6d0694d509b500 /oox/source/xls
parent3293c8d09208b70a3abcfe475919c404c4ddbed1 (diff)
calctabcolor: Re-worked the xlsx import of tab colors, to treat them as sheet properties.
Diffstat (limited to 'oox/source/xls')
-rw-r--r--oox/source/xls/viewsettings.cxx9
-rw-r--r--oox/source/xls/worksheetfragment.cxx4
-rw-r--r--oox/source/xls/worksheethelper.cxx2
-rw-r--r--oox/source/xls/worksheetsettings.cxx21
4 files changed, 23 insertions, 13 deletions
diff --git a/oox/source/xls/viewsettings.cxx b/oox/source/xls/viewsettings.cxx
index 4eaa66824457..2d53541b404c 100644
--- a/oox/source/xls/viewsettings.cxx
+++ b/oox/source/xls/viewsettings.cxx
@@ -251,12 +251,6 @@ void SheetViewSettings::importSheetView( const AttributeList& rAttribs )
rModel.mbShowOutline = rAttribs.getBool( XML_showOutlineSymbols, true );
}
-void SheetViewSettings::importTabColor( const AttributeList& rAttribs )
-{
- SheetViewModel& rModel = maSheetViews.empty() ? *createSheetView() : *maSheetViews.back();
- rModel.maTabColor.importColor( rAttribs );
-}
-
void SheetViewSettings::importPane( const AttributeList& rAttribs )
{
OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importPane - missing sheet view model" );
@@ -597,9 +591,6 @@ void SheetViewSettings::finalizeImport()
aPropMap[ PROP_ShowZeroValues ] <<= xModel->mbShowZeros;
aPropMap[ PROP_IsOutlineSymbolsSet ] <<= xModel->mbShowOutline;
- if (!xModel->maTabColor.isAuto())
- aPropMap[ PROP_TabColor ] <<= static_cast< sal_Int32 >(xModel->maTabColor.getColor(getBaseFilter()));
-
// store sheet view settings in global view settings object
getViewSettings().setSheetViewSettings( getSheetIndex(), xModel, Any( aPropMap.makePropertyValueSequence() ) );
}
diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx
index fda62feb328c..37c1adf660f1 100644
--- a/oox/source/xls/worksheetfragment.cxx
+++ b/oox/source/xls/worksheetfragment.cxx
@@ -299,9 +299,7 @@ ContextHandlerRef OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, con
case XLS_TOKEN( sheetPr ):
switch( nElement )
{
-// TODO: Treat tab color as a sheet setting later.
-// case XLS_TOKEN( tabColor ): getWorksheetSettings().importTabColor( rAttribs ); break;
- case XLS_TOKEN( tabColor ): getSheetViewSettings().importTabColor( rAttribs ); break;
+ case XLS_TOKEN( tabColor ): getWorksheetSettings().importTabColor( rAttribs ); break;
case XLS_TOKEN( outlinePr ): getWorksheetSettings().importOutlinePr( rAttribs ); break;
case XLS_TOKEN( pageSetUpPr ): importPageSetUpPr( rAttribs ); break;
}
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index ab2d5c1b1946..68c9c52c83ab 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -1000,6 +1000,8 @@ void WorksheetData::finalizeWorksheetImport()
maCondFormats.finalizeImport();
maPageSett.finalizeImport();
maSheetViewSett.finalizeImport();
+ maSheetSett.finalizeImport();
+
lclUpdateProgressBar( mxFinalProgress, 0.5 );
convertColumns();
convertRows();
diff --git a/oox/source/xls/worksheetsettings.cxx b/oox/source/xls/worksheetsettings.cxx
index c05e471e6814..f9b50c8bc8f2 100644
--- a/oox/source/xls/worksheetsettings.cxx
+++ b/oox/source/xls/worksheetsettings.cxx
@@ -29,14 +29,18 @@
************************************************************************/
#include "oox/xls/worksheetsettings.hxx"
-#include <com/sun/star/util/XProtectable.hpp>
#include "oox/helper/attributelist.hxx"
#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/pagesettings.hxx"
#include "oox/xls/workbooksettings.hxx"
+#include <com/sun/star/util/XProtectable.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
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;
@@ -311,6 +315,21 @@ void WorksheetSettings::finalizeImport()
catch( Exception& )
{
}
+
+ if (!maSheetSettings.maTabColor.isAuto())
+ {
+ sal_Int32 nColor = maSheetSettings.maTabColor.getColor(getBaseFilter());
+ try
+ {
+ Reference< XPropertySet > xPropSet( getSheet(), UNO_QUERY_THROW );
+ Any any;
+ any <<= nColor;
+ xPropSet->setPropertyValue( CREATE_OUSTRING("TabColor"), any );
+ }
+ catch ( Exception& )
+ {
+ }
+ }
}
// ============================================================================