diff options
Diffstat (limited to 'oox/source/xls/condformatbuffer.cxx')
-rw-r--r-- | oox/source/xls/condformatbuffer.cxx | 283 |
1 files changed, 135 insertions, 148 deletions
diff --git a/oox/source/xls/condformatbuffer.cxx b/oox/source/xls/condformatbuffer.cxx index 317476f25635..51d9170e1794 100644 --- a/oox/source/xls/condformatbuffer.cxx +++ b/oox/source/xls/condformatbuffer.cxx @@ -26,109 +26,98 @@ ************************************************************************/ #include "oox/xls/condformatbuffer.hxx" -#include <rtl/ustrbuf.hxx> + #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/table/CellAddress.hpp> -#include <com/sun/star/table/CellRangeAddress.hpp> -#include <com/sun/star/table/XCellRange.hpp> #include <com/sun/star/sheet/ConditionOperator.hpp> +#include <com/sun/star/sheet/XSheetCellRanges.hpp> #include <com/sun/star/sheet/XSheetConditionalEntries.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheets.hpp> -#include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> -#include "properties.hxx" +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <rtl/ustrbuf.hxx> #include "oox/helper/attributelist.hxx" +#include "oox/helper/containerhelper.hxx" #include "oox/helper/propertyset.hxx" -#include "oox/helper/recordinputstream.hxx" #include "oox/xls/addressconverter.hxx" #include "oox/xls/biffinputstream.hxx" #include "oox/xls/stylesbuffer.hxx" -using ::rtl::OUString; -using ::rtl::OUStringBuffer; -using ::com::sun::star::uno::Any; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Exception; -using ::com::sun::star::uno::UNO_QUERY; -using ::com::sun::star::uno::UNO_QUERY_THROW; -using ::com::sun::star::beans::PropertyValue; -using ::com::sun::star::style::XStyleFamiliesSupplier; -using ::com::sun::star::container::XNameAccess; -using ::com::sun::star::container::XIndexAccess; -using ::com::sun::star::container::XNameContainer; -using ::com::sun::star::table::CellAddress; -using ::com::sun::star::table::CellRangeAddress; -using ::com::sun::star::sheet::ConditionOperator; -using ::com::sun::star::table::XCellRange; -using ::com::sun::star::sheet::XSheetCellRanges; -using ::com::sun::star::sheet::XSheetConditionalEntries; -using ::com::sun::star::sheet::XSpreadsheetDocument; -using ::com::sun::star::sheet::XSpreadsheets; -using ::com::sun::star::sheet::XSpreadsheet; -using ::com::sun::star::style::XStyle; - namespace oox { namespace xls { // ============================================================================ +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::sheet; +using namespace ::com::sun::star::style; +using namespace ::com::sun::star::table; +using namespace ::com::sun::star::uno; + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + +// ============================================================================ + namespace { -const sal_Int32 OOBIN_CFRULE_TYPE_CELLIS = 1; -const sal_Int32 OOBIN_CFRULE_TYPE_EXPRESSION = 2; -const sal_Int32 OOBIN_CFRULE_TYPE_COLORSCALE = 3; -const sal_Int32 OOBIN_CFRULE_TYPE_DATABAR = 4; -const sal_Int32 OOBIN_CFRULE_TYPE_TOPTEN = 5; -const sal_Int32 OOBIN_CFRULE_TYPE_ICONSET = 6; - -const sal_Int32 OOBIN_CFRULE_SUB_CELLIS = 0; -const sal_Int32 OOBIN_CFRULE_SUB_EXPRESSION = 1; -const sal_Int32 OOBIN_CFRULE_SUB_COLORSCALE = 2; -const sal_Int32 OOBIN_CFRULE_SUB_DATABAR = 3; -const sal_Int32 OOBIN_CFRULE_SUB_ICONSET = 4; -const sal_Int32 OOBIN_CFRULE_SUB_TOPTEN = 5; -const sal_Int32 OOBIN_CFRULE_SUB_UNIQUE = 7; -const sal_Int32 OOBIN_CFRULE_SUB_TEXT = 8; -const sal_Int32 OOBIN_CFRULE_SUB_BLANK = 9; -const sal_Int32 OOBIN_CFRULE_SUB_NOTBLANK = 10; -const sal_Int32 OOBIN_CFRULE_SUB_ERROR = 11; -const sal_Int32 OOBIN_CFRULE_SUB_NOTERROR = 12; -const sal_Int32 OOBIN_CFRULE_SUB_TODAY = 15; -const sal_Int32 OOBIN_CFRULE_SUB_TOMORROW = 16; -const sal_Int32 OOBIN_CFRULE_SUB_YESTERDAY = 17; -const sal_Int32 OOBIN_CFRULE_SUB_LAST7DAYS = 18; -const sal_Int32 OOBIN_CFRULE_SUB_LASTMONTH = 19; -const sal_Int32 OOBIN_CFRULE_SUB_NEXTMONTH = 20; -const sal_Int32 OOBIN_CFRULE_SUB_THISWEEK = 21; -const sal_Int32 OOBIN_CFRULE_SUB_NEXTWEEK = 22; -const sal_Int32 OOBIN_CFRULE_SUB_LASTWEEK = 23; -const sal_Int32 OOBIN_CFRULE_SUB_THISMONTH = 24; -const sal_Int32 OOBIN_CFRULE_SUB_ABOVEAVERAGE = 25; -const sal_Int32 OOBIN_CFRULE_SUB_BELOWAVERAGE = 26; -const sal_Int32 OOBIN_CFRULE_SUB_DUPLICATE = 27; -const sal_Int32 OOBIN_CFRULE_SUB_EQABOVEAVERAGE = 29; -const sal_Int32 OOBIN_CFRULE_SUB_EQBELOWAVERAGE = 30; - -const sal_Int32 OOBIN_CFRULE_TIMEOP_TODAY = 0; -const sal_Int32 OOBIN_CFRULE_TIMEOP_YESTERDAY = 1; -const sal_Int32 OOBIN_CFRULE_TIMEOP_LAST7DAYS = 2; -const sal_Int32 OOBIN_CFRULE_TIMEOP_THISWEEK = 3; -const sal_Int32 OOBIN_CFRULE_TIMEOP_LASTWEEK = 4; -const sal_Int32 OOBIN_CFRULE_TIMEOP_LASTMONTH = 5; -const sal_Int32 OOBIN_CFRULE_TIMEOP_TOMORROW = 6; -const sal_Int32 OOBIN_CFRULE_TIMEOP_NEXTWEEK = 7; -const sal_Int32 OOBIN_CFRULE_TIMEOP_NEXTMONTH = 8; -const sal_Int32 OOBIN_CFRULE_TIMEOP_THISMONTH = 9; - -const sal_uInt16 OOBIN_CFRULE_STOPIFTRUE = 0x0002; -const sal_uInt16 OOBIN_CFRULE_ABOVEAVERAGE = 0x0004; -const sal_uInt16 OOBIN_CFRULE_BOTTOM = 0x0008; -const sal_uInt16 OOBIN_CFRULE_PERCENT = 0x0010; +const sal_Int32 BIFF12_CFRULE_TYPE_CELLIS = 1; +const sal_Int32 BIFF12_CFRULE_TYPE_EXPRESSION = 2; +const sal_Int32 BIFF12_CFRULE_TYPE_COLORSCALE = 3; +const sal_Int32 BIFF12_CFRULE_TYPE_DATABAR = 4; +const sal_Int32 BIFF12_CFRULE_TYPE_TOPTEN = 5; +const sal_Int32 BIFF12_CFRULE_TYPE_ICONSET = 6; + +const sal_Int32 BIFF12_CFRULE_SUB_CELLIS = 0; +const sal_Int32 BIFF12_CFRULE_SUB_EXPRESSION = 1; +const sal_Int32 BIFF12_CFRULE_SUB_COLORSCALE = 2; +const sal_Int32 BIFF12_CFRULE_SUB_DATABAR = 3; +const sal_Int32 BIFF12_CFRULE_SUB_ICONSET = 4; +const sal_Int32 BIFF12_CFRULE_SUB_TOPTEN = 5; +const sal_Int32 BIFF12_CFRULE_SUB_UNIQUE = 7; +const sal_Int32 BIFF12_CFRULE_SUB_TEXT = 8; +const sal_Int32 BIFF12_CFRULE_SUB_BLANK = 9; +const sal_Int32 BIFF12_CFRULE_SUB_NOTBLANK = 10; +const sal_Int32 BIFF12_CFRULE_SUB_ERROR = 11; +const sal_Int32 BIFF12_CFRULE_SUB_NOTERROR = 12; +const sal_Int32 BIFF12_CFRULE_SUB_TODAY = 15; +const sal_Int32 BIFF12_CFRULE_SUB_TOMORROW = 16; +const sal_Int32 BIFF12_CFRULE_SUB_YESTERDAY = 17; +const sal_Int32 BIFF12_CFRULE_SUB_LAST7DAYS = 18; +const sal_Int32 BIFF12_CFRULE_SUB_LASTMONTH = 19; +const sal_Int32 BIFF12_CFRULE_SUB_NEXTMONTH = 20; +const sal_Int32 BIFF12_CFRULE_SUB_THISWEEK = 21; +const sal_Int32 BIFF12_CFRULE_SUB_NEXTWEEK = 22; +const sal_Int32 BIFF12_CFRULE_SUB_LASTWEEK = 23; +const sal_Int32 BIFF12_CFRULE_SUB_THISMONTH = 24; +const sal_Int32 BIFF12_CFRULE_SUB_ABOVEAVERAGE = 25; +const sal_Int32 BIFF12_CFRULE_SUB_BELOWAVERAGE = 26; +const sal_Int32 BIFF12_CFRULE_SUB_DUPLICATE = 27; +const sal_Int32 BIFF12_CFRULE_SUB_EQABOVEAVERAGE = 29; +const sal_Int32 BIFF12_CFRULE_SUB_EQBELOWAVERAGE = 30; + +const sal_Int32 BIFF12_CFRULE_TIMEOP_TODAY = 0; +const sal_Int32 BIFF12_CFRULE_TIMEOP_YESTERDAY = 1; +const sal_Int32 BIFF12_CFRULE_TIMEOP_LAST7DAYS = 2; +const sal_Int32 BIFF12_CFRULE_TIMEOP_THISWEEK = 3; +const sal_Int32 BIFF12_CFRULE_TIMEOP_LASTWEEK = 4; +const sal_Int32 BIFF12_CFRULE_TIMEOP_LASTMONTH = 5; +const sal_Int32 BIFF12_CFRULE_TIMEOP_TOMORROW = 6; +const sal_Int32 BIFF12_CFRULE_TIMEOP_NEXTWEEK = 7; +const sal_Int32 BIFF12_CFRULE_TIMEOP_NEXTMONTH = 8; +const sal_Int32 BIFF12_CFRULE_TIMEOP_THISMONTH = 9; + +const sal_uInt16 BIFF12_CFRULE_STOPIFTRUE = 0x0002; +const sal_uInt16 BIFF12_CFRULE_ABOVEAVERAGE = 0x0004; +const sal_uInt16 BIFF12_CFRULE_BOTTOM = 0x0008; +const sal_uInt16 BIFF12_CFRULE_PERCENT = 0x0010; // ---------------------------------------------------------------------------- @@ -160,7 +149,7 @@ CondFormatRuleModel::CondFormatRuleModel() : { } -void CondFormatRuleModel::setBinOperator( sal_Int32 nOperator ) +void CondFormatRuleModel::setBiffOperator( sal_Int32 nOperator ) { static const sal_Int32 spnOperators[] = { XML_TOKEN_INVALID, XML_between, XML_notBetween, XML_equal, XML_notEqual, @@ -168,7 +157,7 @@ void CondFormatRuleModel::setBinOperator( sal_Int32 nOperator ) mnOperator = STATIC_ARRAY_SELECT( spnOperators, nOperator, XML_TOKEN_INVALID ); } -void CondFormatRuleModel::setOobTextType( sal_Int32 nOperator ) +void CondFormatRuleModel::setBiff12TextType( sal_Int32 nOperator ) { // note: type XML_notContainsText vs. operator XML_notContains static const sal_Int32 spnTypes[] = { XML_containsText, XML_notContainsText, XML_beginsWith, XML_endsWith }; @@ -210,7 +199,7 @@ void CondFormatRule::appendFormula( const OUString& rFormula ) maModel.maFormulas.push_back( aContext ); } -void CondFormatRule::importCfRule( RecordInputStream& rStrm ) +void CondFormatRule::importCfRule( SequenceInputStream& rStrm ) { sal_Int32 nType, nSubType, nOperator, nFmla1Size, nFmla2Size, nFmla3Size; sal_uInt16 nFlags; @@ -251,129 +240,129 @@ void CondFormatRule::importCfRule( RecordInputStream& rStrm ) } // flags - maModel.mbStopIfTrue = getFlag( nFlags, OOBIN_CFRULE_STOPIFTRUE ); - maModel.mbBottom = getFlag( nFlags, OOBIN_CFRULE_BOTTOM ); - maModel.mbPercent = getFlag( nFlags, OOBIN_CFRULE_PERCENT ); - maModel.mbAboveAverage = getFlag( nFlags, OOBIN_CFRULE_ABOVEAVERAGE ); + maModel.mbStopIfTrue = getFlag( nFlags, BIFF12_CFRULE_STOPIFTRUE ); + maModel.mbBottom = getFlag( nFlags, BIFF12_CFRULE_BOTTOM ); + maModel.mbPercent = getFlag( nFlags, BIFF12_CFRULE_PERCENT ); + maModel.mbAboveAverage = getFlag( nFlags, BIFF12_CFRULE_ABOVEAVERAGE ); // no flag for equalAverage, must be determined from subtype below... // Convert the type/operator settings. This is a real mess... switch( nType ) { - case OOBIN_CFRULE_TYPE_CELLIS: - OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_CELLIS, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); + case BIFF12_CFRULE_TYPE_CELLIS: + OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_CELLIS, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); maModel.mnType = XML_cellIs; - maModel.setBinOperator( nOperator ); + maModel.setBiffOperator( nOperator ); OSL_ENSURE( maModel.mnOperator != XML_TOKEN_INVALID, "CondFormatRule::importCfRule - unknown operator" ); break; - case OOBIN_CFRULE_TYPE_EXPRESSION: + case BIFF12_CFRULE_TYPE_EXPRESSION: // here we have to look at the subtype to find the real type... switch( nSubType ) { - case OOBIN_CFRULE_SUB_EXPRESSION: + case BIFF12_CFRULE_SUB_EXPRESSION: OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_expression; break; - case OOBIN_CFRULE_SUB_UNIQUE: + case BIFF12_CFRULE_SUB_UNIQUE: OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_uniqueValues; break; - case OOBIN_CFRULE_SUB_TEXT: - maModel.setOobTextType( nOperator ); + case BIFF12_CFRULE_SUB_TEXT: + maModel.setBiff12TextType( nOperator ); OSL_ENSURE( maModel.mnType != XML_TOKEN_INVALID, "CondFormatRule::importCfRule - unexpected operator value" ); break; - case OOBIN_CFRULE_SUB_BLANK: + case BIFF12_CFRULE_SUB_BLANK: OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_containsBlanks; break; - case OOBIN_CFRULE_SUB_NOTBLANK: + case BIFF12_CFRULE_SUB_NOTBLANK: OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_notContainsBlanks; break; - case OOBIN_CFRULE_SUB_ERROR: + case BIFF12_CFRULE_SUB_ERROR: OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_containsErrors; break; - case OOBIN_CFRULE_SUB_NOTERROR: + case BIFF12_CFRULE_SUB_NOTERROR: OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_notContainsErrors; break; - case OOBIN_CFRULE_SUB_TODAY: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_TODAY, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_TODAY: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_TODAY, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_today; break; - case OOBIN_CFRULE_SUB_TOMORROW: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_TOMORROW, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_TOMORROW: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_TOMORROW, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_tomorrow; break; - case OOBIN_CFRULE_SUB_YESTERDAY: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_YESTERDAY, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_YESTERDAY: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_YESTERDAY, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_yesterday; break; - case OOBIN_CFRULE_SUB_LAST7DAYS: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_LAST7DAYS, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_LAST7DAYS: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_LAST7DAYS, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_last7Days; break; - case OOBIN_CFRULE_SUB_LASTMONTH: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_LASTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_LASTMONTH: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_LASTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_lastMonth; break; - case OOBIN_CFRULE_SUB_NEXTMONTH: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_NEXTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_NEXTMONTH: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_NEXTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_nextMonth; break; - case OOBIN_CFRULE_SUB_THISWEEK: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_THISWEEK, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_THISWEEK: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_THISWEEK, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_thisWeek; break; - case OOBIN_CFRULE_SUB_NEXTWEEK: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_NEXTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_NEXTWEEK: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_NEXTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_nextWeek; break; - case OOBIN_CFRULE_SUB_LASTWEEK: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_LASTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_LASTWEEK: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_LASTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_lastWeek; break; - case OOBIN_CFRULE_SUB_THISMONTH: - OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_THISMONTH, "CondFormatRule::importCfRule - unexpected time operator value" ); + case BIFF12_CFRULE_SUB_THISMONTH: + OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_THISMONTH, "CondFormatRule::importCfRule - unexpected time operator value" ); maModel.mnType = XML_timePeriod; maModel.mnTimePeriod = XML_thisMonth; break; - case OOBIN_CFRULE_SUB_ABOVEAVERAGE: + case BIFF12_CFRULE_SUB_ABOVEAVERAGE: OSL_ENSURE( maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" ); maModel.mnType = XML_aboveAverage; maModel.mnStdDev = nOperator; // operator field used for standard deviation maModel.mbAboveAverage = true; maModel.mbEqualAverage = false; // does not exist as real flag... break; - case OOBIN_CFRULE_SUB_BELOWAVERAGE: + case BIFF12_CFRULE_SUB_BELOWAVERAGE: OSL_ENSURE( !maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" ); maModel.mnType = XML_aboveAverage; maModel.mnStdDev = nOperator; // operator field used for standard deviation maModel.mbAboveAverage = false; maModel.mbEqualAverage = false; // does not exist as real flag... break; - case OOBIN_CFRULE_SUB_DUPLICATE: + case BIFF12_CFRULE_SUB_DUPLICATE: OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_duplicateValues; break; - case OOBIN_CFRULE_SUB_EQABOVEAVERAGE: + case BIFF12_CFRULE_SUB_EQABOVEAVERAGE: OSL_ENSURE( maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" ); maModel.mnType = XML_aboveAverage; maModel.mnStdDev = nOperator; // operator field used for standard deviation maModel.mbAboveAverage = true; maModel.mbEqualAverage = true; // does not exist as real flag... break; - case OOBIN_CFRULE_SUB_EQBELOWAVERAGE: + case BIFF12_CFRULE_SUB_EQBELOWAVERAGE: OSL_ENSURE( !maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" ); maModel.mnType = XML_aboveAverage; maModel.mnStdDev = nOperator; // operator field used for standard deviation @@ -382,23 +371,23 @@ void CondFormatRule::importCfRule( RecordInputStream& rStrm ) break; } break; - case OOBIN_CFRULE_TYPE_COLORSCALE: - OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_COLORSCALE, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); + case BIFF12_CFRULE_TYPE_COLORSCALE: + OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_COLORSCALE, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_colorScale; break; - case OOBIN_CFRULE_TYPE_DATABAR: - OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_DATABAR, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); + case BIFF12_CFRULE_TYPE_DATABAR: + OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_DATABAR, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_dataBar; break; - case OOBIN_CFRULE_TYPE_TOPTEN: - OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_TOPTEN, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); + case BIFF12_CFRULE_TYPE_TOPTEN: + OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_TOPTEN, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); maModel.mnType = XML_top10; maModel.mnRank = nOperator; // operator field used for rank value break; - case OOBIN_CFRULE_TYPE_ICONSET: - OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_ICONSET, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); + case BIFF12_CFRULE_TYPE_ICONSET: + OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_ICONSET, "CondFormatRule::importCfRule - rule type/subtype mismatch" ); OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" ); maModel.mnType = XML_iconSet; break; @@ -418,7 +407,7 @@ void CondFormatRule::importCfRule( BiffInputStream& rStrm, sal_Int32 nPriority ) static const sal_Int32 spnTypeIds[] = { XML_TOKEN_INVALID, XML_cellIs, XML_expression }; maModel.mnType = STATIC_ARRAY_SELECT( spnTypeIds, nType, XML_TOKEN_INVALID ); - maModel.setBinOperator( nOperator ); + maModel.setBiffOperator( nOperator ); maModel.mnPriority = nPriority; maModel.mbStopIfTrue = true; @@ -658,7 +647,7 @@ CondFormatRuleRef CondFormat::importCfRule( const AttributeList& rAttribs ) return xRule; } -void CondFormat::importCondFormatting( RecordInputStream& rStrm ) +void CondFormat::importCondFormatting( SequenceInputStream& rStrm ) { BinRangeList aRanges; rStrm.skip( 8 ); @@ -666,7 +655,7 @@ void CondFormat::importCondFormatting( RecordInputStream& rStrm ) getAddressConverter().convertToCellRangeList( maModel.maRanges, aRanges, getSheetIndex(), true ); } -void CondFormat::importCfRule( RecordInputStream& rStrm ) +void CondFormat::importCfRule( SequenceInputStream& rStrm ) { CondFormatRuleRef xRule = createRule(); xRule->importCfRule( rStrm ); @@ -694,18 +683,17 @@ void CondFormat::importCfHeader( BiffInputStream& rStrm ) void CondFormat::finalizeImport() { - Reference< XSheetCellRanges > xRanges = getCellRangeList( maModel.maRanges ); - if( xRanges.is() ) + try { + Reference< XSheetCellRanges > xRanges( getCellRangeList( maModel.maRanges ), UNO_SET_THROW ); PropertySet aPropSet( xRanges ); - Reference< XSheetConditionalEntries > xEntries; - aPropSet.getProperty( xEntries, PROP_ConditionalFormat ); - if( xEntries.is() ) - { - // maRules is sorted by rule priority - maRules.forEachMem( &CondFormatRule::finalizeImport, ::boost::cref( xEntries ) ); - aPropSet.setProperty( PROP_ConditionalFormat, xEntries ); - } + Reference< XSheetConditionalEntries > xEntries( aPropSet.getAnyProperty( PROP_ConditionalFormat ), UNO_QUERY_THROW ); + // maRules is sorted by rule priority + maRules.forEachMem( &CondFormatRule::finalizeImport, ::boost::cref( xEntries ) ); + aPropSet.setProperty( PROP_ConditionalFormat, xEntries ); + } + catch( Exception& ) + { } } @@ -737,7 +725,7 @@ CondFormatRef CondFormatBuffer::importConditionalFormatting( const AttributeList return xCondFmt; } -CondFormatRef CondFormatBuffer::importCondFormatting( RecordInputStream& rStrm ) +CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm ) { CondFormatRef xCondFmt = createCondFormat(); xCondFmt->importCondFormatting( rStrm ); @@ -784,4 +772,3 @@ CondFormatRef CondFormatBuffer::createCondFormat() } // namespace xls } // namespace oox - |