[Libreoffice-commits] .: oox/inc oox/source

Muthu Subramanian sumuthu at kemper.freedesktop.org
Tue Feb 15 06:58:40 PST 2011


 oox/inc/oox/xls/condformatbuffer.hxx |    5 +---
 oox/source/xls/condformatbuffer.cxx  |   37 +++++++++++++++++++----------------
 oox/source/xls/worksheethelper.cxx   |    9 +++-----
 3 files changed, 27 insertions(+), 24 deletions(-)

New commits:
commit 19ebd0a0e33e4788cfde1b1768c24819f92b964c
Author: Muthu Subramanian K <sumuthu at novell.com>
Date:   Tue Feb 15 20:15:51 2011 +0530

    XLSX import of duplicate-conditional formatting.

diff --git a/oox/inc/oox/xls/condformatbuffer.hxx b/oox/inc/oox/xls/condformatbuffer.hxx
index 76d9d45..c86dfaa 100644
--- a/oox/inc/oox/xls/condformatbuffer.hxx
+++ b/oox/inc/oox/xls/condformatbuffer.hxx
@@ -29,7 +29,7 @@
 #ifndef OOX_XLS_CONDFORMATBUFFER_HXX
 #define OOX_XLS_CONDFORMATBUFFER_HXX
 
-#include <com/sun/star/sheet/ConditionOperator.hpp>
+#include <com/sun/star/sheet/ConditionOperator2.hpp>
 #include "oox/helper/containerhelper.hxx"
 #include "oox/xls/formulaparser.hxx"
 #include "oox/xls/worksheethelper.hxx"
@@ -176,8 +176,7 @@ public:
     void                finalizeImport();
 
     /** Converts an OOXML condition operator token to the API constant. */
-    static ::com::sun::star::sheet::ConditionOperator
-                        convertToApiOperator( sal_Int32 nToken );
+    static sal_Int32    convertToApiOperator( sal_Int32 nToken );
 
 private:
     CondFormatRef       createCondFormat();
diff --git a/oox/source/xls/condformatbuffer.cxx b/oox/source/xls/condformatbuffer.cxx
index 5b78b49..284609d 100644
--- a/oox/source/xls/condformatbuffer.cxx
+++ b/oox/source/xls/condformatbuffer.cxx
@@ -34,7 +34,7 @@
 #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/ConditionOperator2.hpp>
 #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheets.hpp>
@@ -64,7 +64,6 @@ 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;
@@ -445,7 +444,7 @@ void CondFormatRule::importCfRule( BiffInputStream& rStrm, sal_Int32 nPriority )
 
 void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >& rxEntries )
 {
-    ConditionOperator eOperator = ::com::sun::star::sheet::ConditionOperator_NONE;
+    sal_Int32 eOperator = ::com::sun::star::sheet::ConditionOperator2::NONE;
 
     /*  Replacement formula for unsupported rule types (text comparison rules,
         time period rules, cell type rules). The replacement formulas below may
@@ -471,8 +470,12 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >
         case XML_cellIs:
             eOperator = CondFormatBuffer::convertToApiOperator( maModel.mnOperator );
         break;
+        case XML_duplicateValues:
+            eOperator = CondFormatBuffer::convertToApiOperator( XML_duplicateValues );
+            aReplaceFormula = CREATE_OUSTRING( " " );
+        break;
         case XML_expression:
-            eOperator = ::com::sun::star::sheet::ConditionOperator_FORMULA;
+            eOperator = ::com::sun::star::sheet::ConditionOperator2::FORMULA;
         break;
         case XML_containsText:
             OSL_ENSURE( maModel.mnOperator == XML_containsText, "CondFormatRule::finalizeImport - unexpected operator" );
@@ -603,10 +606,11 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >
         // set the replacement formula
         maModel.maFormulas.clear();
         appendFormula( aReplaceFormula );
-        eOperator = ::com::sun::star::sheet::ConditionOperator_FORMULA;
+        if( eOperator != ::com::sun::star::sheet::ConditionOperator2::DUPLICATE )
+            eOperator = ::com::sun::star::sheet::ConditionOperator2::FORMULA;
     }
 
-    if( rxEntries.is() && (eOperator != ::com::sun::star::sheet::ConditionOperator_NONE) && !maModel.maFormulas.empty() )
+    if( rxEntries.is() && (eOperator != ::com::sun::star::sheet::ConditionOperator2::NONE) && !maModel.maFormulas.empty() )
     {
         ::std::vector< PropertyValue > aProps;
         // create condition properties
@@ -755,21 +759,22 @@ void CondFormatBuffer::finalizeImport()
     maCondFormats.forEachMem( &CondFormat::finalizeImport );
 }
 
-ConditionOperator CondFormatBuffer::convertToApiOperator( sal_Int32 nToken )
+sal_Int32 CondFormatBuffer::convertToApiOperator( sal_Int32 nToken )
 {
     using namespace ::com::sun::star::sheet;
     switch( nToken )
     {
-        case XML_between:               return ConditionOperator_BETWEEN;
-        case XML_equal:                 return ConditionOperator_EQUAL;
-        case XML_greaterThan:           return ConditionOperator_GREATER;
-        case XML_greaterThanOrEqual:    return ConditionOperator_GREATER_EQUAL;
-        case XML_lessThan:              return ConditionOperator_LESS;
-        case XML_lessThanOrEqual:       return ConditionOperator_LESS_EQUAL;
-        case XML_notBetween:            return ConditionOperator_NOT_BETWEEN;
-        case XML_notEqual:              return ConditionOperator_NOT_EQUAL;
+        case XML_between:               return ConditionOperator2::BETWEEN;
+        case XML_equal:                 return ConditionOperator2::EQUAL;
+        case XML_greaterThan:           return ConditionOperator2::GREATER;
+        case XML_greaterThanOrEqual:    return ConditionOperator2::GREATER_EQUAL;
+        case XML_lessThan:              return ConditionOperator2::LESS;
+        case XML_lessThanOrEqual:       return ConditionOperator2::LESS_EQUAL;
+        case XML_notBetween:            return ConditionOperator2::NOT_BETWEEN;
+        case XML_notEqual:              return ConditionOperator2::NOT_EQUAL;
+        case XML_duplicateValues:       return ConditionOperator2::DUPLICATE;
     }
-    return ConditionOperator_NONE;
+    return ConditionOperator2::NONE;
 }
 
 // private --------------------------------------------------------------------
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index 0790b0b..02264af 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -40,7 +40,7 @@
 #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-#include <com/sun/star/sheet/XSheetCondition.hpp>
+#include <com/sun/star/sheet/XSheetCondition2.hpp>
 #include <com/sun/star/sheet/XCellAddressable.hpp>
 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
 #include <com/sun/star/sheet/XFormulaTokens.hpp>
@@ -84,7 +84,6 @@ using ::com::sun::star::drawing::XDrawPage;
 using ::com::sun::star::drawing::XDrawPageSupplier;
 using ::com::sun::star::lang::Locale;
 using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::sheet::ConditionOperator;
 using ::com::sun::star::sheet::ValidationType;
 using ::com::sun::star::sheet::ValidationAlertStyle;
 using ::com::sun::star::sheet::XCellAddressable;
@@ -95,7 +94,7 @@ using ::com::sun::star::sheet::XMultiFormulaTokens;
 using ::com::sun::star::sheet::XMultipleOperation;
 using ::com::sun::star::sheet::XSheetCellRangeContainer;
 using ::com::sun::star::sheet::XSheetCellRanges;
-using ::com::sun::star::sheet::XSheetCondition;
+using ::com::sun::star::sheet::XSheetCondition2;
 using ::com::sun::star::sheet::XSheetOutline;
 using ::com::sun::star::sheet::XSpreadsheet;
 using ::com::sun::star::table::BorderLine;
@@ -1483,8 +1482,8 @@ void WorksheetData::finalizeValidationRanges() const
             try
             {
                 // condition operator
-                Reference< XSheetCondition > xSheetCond( xValidation, UNO_QUERY_THROW );
-                xSheetCond->setOperator( CondFormatBuffer::convertToApiOperator( aIt->mnOperator ) );
+                Reference< XSheetCondition2 > xSheetCond( xValidation, UNO_QUERY_THROW );
+                xSheetCond->setConditionOperator( CondFormatBuffer::convertToApiOperator( aIt->mnOperator ) );
 
                 // condition formulas
                 Reference< XMultiFormulaTokens > xTokens( xValidation, UNO_QUERY_THROW );


More information about the Libreoffice-commits mailing list