summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuthu Subramanian K <sumuthu@novell.com>2011-02-15 20:10:10 +0530
committerMuthu Subramanian K <sumuthu@novell.com>2011-02-15 20:23:39 +0530
commitf833cc946d73631bb82a56e3eedf6a669dd1b797 (patch)
treeaf6034433ec36211fcf617bdbf42cf2d95487f08
parent8456140a92624f1ea51fe4672bf7bd3deb246aaa (diff)
XLSX import of duplicate-conditional formatting.
-rw-r--r--sc/inc/fmtuno.hxx15
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/unoobj/fmtuno.cxx118
3 files changed, 111 insertions, 24 deletions
diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx
index cded07b92349..82548d5c736a 100644
--- a/sc/inc/fmtuno.hxx
+++ b/sc/inc/fmtuno.hxx
@@ -36,6 +36,7 @@
#include <svl/itemprop.hxx>
#include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
#include <com/sun/star/sheet/XSheetCondition.hpp>
+#include <com/sun/star/sheet/XSheetCondition2.hpp>
#include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -48,7 +49,7 @@
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase5.hxx>
-
+#include <com/sun/star/sheet/ConditionOperator2.hpp>
class ScDocument;
class ScTableConditionalEntry;
@@ -153,7 +154,7 @@ public:
class ScTableConditionalEntry : public cppu::WeakImplHelper3<
- com::sun::star::sheet::XSheetCondition,
+ com::sun::star::sheet::XSheetCondition2,
com::sun::star::sheet::XSheetConditionalEntry,
com::sun::star::lang::XServiceInfo >
{
@@ -172,8 +173,12 @@ public:
// XSheetCondition
virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator()
throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getConditionOperator()
+ throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator nOperator )
throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator )
+ throw(::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getFormula1() throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setFormula1( const ::rtl::OUString& aFormula1 )
throw(::com::sun::star::uno::RuntimeException);
@@ -202,7 +207,7 @@ public:
class ScTableValidationObj : public cppu::WeakImplHelper5<
- com::sun::star::sheet::XSheetCondition,
+ com::sun::star::sheet::XSheetCondition2,
com::sun::star::sheet::XMultiFormulaTokens,
com::sun::star::beans::XPropertySet,
com::sun::star::lang::XUnoTunnel,
@@ -247,8 +252,12 @@ public:
// XSheetCondition
virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator()
throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getConditionOperator()
+ throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator nOperator )
throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator )
+ throw(::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getFormula1() throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setFormula1( const ::rtl::OUString& aFormula1 )
throw(::com::sun::star::uno::RuntimeException);
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 0eb6debc14f9..d30f22b456bf 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2305,6 +2305,8 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
ScConditionalFormat aNew( 0, pDoc ); // Index wird beim Einfuegen gesetzt
pFormat->FillFormat( aNew, pDoc, eGrammar );
+ ScRangeListRef pRanges = new ScRangeList( aRanges );
+ aNew.AddRangeInfo( pRanges );
ULONG nIndex = pDoc->AddCondFormat( aNew );
ScDocFunc aFunc(*pDocShell);
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index eaf0750d7c24..f2e27101a5e2 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -82,20 +82,66 @@ SC_SIMPLE_SERVICE_INFO( ScTableValidationObj, "ScTableValidationObj", "com.sun.s
//------------------------------------------------------------------------
+sal_Int32 lcl_ConditionModeToOperatorNew( ScConditionMode eMode )
+{
+ sal_Int32 eOper = sheet::ConditionOperator2::NONE;
+ switch (eMode)
+ {
+ case SC_COND_EQUAL: eOper = sheet::ConditionOperator2::EQUAL; break;
+ case SC_COND_LESS: eOper = sheet::ConditionOperator2::LESS; break;
+ case SC_COND_GREATER: eOper = sheet::ConditionOperator2::GREATER; break;
+ case SC_COND_EQLESS: eOper = sheet::ConditionOperator2::LESS_EQUAL; break;
+ case SC_COND_EQGREATER: eOper = sheet::ConditionOperator2::GREATER_EQUAL; break;
+ case SC_COND_NOTEQUAL: eOper = sheet::ConditionOperator2::NOT_EQUAL; break;
+ case SC_COND_BETWEEN: eOper = sheet::ConditionOperator2::BETWEEN; break;
+ case SC_COND_NOTBETWEEN: eOper = sheet::ConditionOperator2::NOT_BETWEEN; break;
+ case SC_COND_DIRECT: eOper = sheet::ConditionOperator2::FORMULA; break;
+ case SC_COND_DUPLICATE: eOper = sheet::ConditionOperator2::DUPLICATE; break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
+ return eOper;
+}
+
+ScConditionMode lcl_ConditionOperatorToModeNew( sal_Int32 eOper )
+{
+ ScConditionMode eMode = SC_COND_NONE;
+ switch (eOper)
+ {
+ case sheet::ConditionOperator2::EQUAL: eMode = SC_COND_EQUAL; break;
+ case sheet::ConditionOperator2::LESS: eMode = SC_COND_LESS; break;
+ case sheet::ConditionOperator2::GREATER: eMode = SC_COND_GREATER; break;
+ case sheet::ConditionOperator2::LESS_EQUAL: eMode = SC_COND_EQLESS; break;
+ case sheet::ConditionOperator2::GREATER_EQUAL: eMode = SC_COND_EQGREATER; break;
+ case sheet::ConditionOperator2::NOT_EQUAL: eMode = SC_COND_NOTEQUAL; break;
+ case sheet::ConditionOperator2::BETWEEN: eMode = SC_COND_BETWEEN; break;
+ case sheet::ConditionOperator2::NOT_BETWEEN: eMode = SC_COND_NOTBETWEEN; break;
+ case sheet::ConditionOperator2::FORMULA: eMode = SC_COND_DIRECT; break;
+ case sheet::ConditionOperator2::DUPLICATE: eMode = SC_COND_DUPLICATE; break;
+ default:
+ {
+ // added to avoid warnings
+ }
+ }
+ return eMode;
+}
+
sheet::ConditionOperator lcl_ConditionModeToOperator( ScConditionMode eMode )
{
sheet::ConditionOperator eOper = sheet::ConditionOperator_NONE;
switch (eMode)
{
- case SC_COND_EQUAL: eOper = sheet::ConditionOperator_EQUAL; break;
- case SC_COND_LESS: eOper = sheet::ConditionOperator_LESS; break;
- case SC_COND_GREATER: eOper = sheet::ConditionOperator_GREATER; break;
- case SC_COND_EQLESS: eOper = sheet::ConditionOperator_LESS_EQUAL; break;
- case SC_COND_EQGREATER: eOper = sheet::ConditionOperator_GREATER_EQUAL; break;
- case SC_COND_NOTEQUAL: eOper = sheet::ConditionOperator_NOT_EQUAL; break;
- case SC_COND_BETWEEN: eOper = sheet::ConditionOperator_BETWEEN; break;
- case SC_COND_NOTBETWEEN: eOper = sheet::ConditionOperator_NOT_BETWEEN; break;
- case SC_COND_DIRECT: eOper = sheet::ConditionOperator_FORMULA; break;
+ case SC_COND_EQUAL: eOper = sheet::ConditionOperator_EQUAL; break;
+ case SC_COND_LESS: eOper = sheet::ConditionOperator_LESS; break;
+ case SC_COND_GREATER: eOper = sheet::ConditionOperator_GREATER; break;
+ case SC_COND_EQLESS: eOper = sheet::ConditionOperator_LESS_EQUAL; break;
+ case SC_COND_EQGREATER: eOper = sheet::ConditionOperator_GREATER_EQUAL; break;
+ case SC_COND_NOTEQUAL: eOper = sheet::ConditionOperator_NOT_EQUAL; break;
+ case SC_COND_BETWEEN: eOper = sheet::ConditionOperator_BETWEEN; break;
+ case SC_COND_NOTBETWEEN: eOper = sheet::ConditionOperator_NOT_BETWEEN; break;
+ case SC_COND_DIRECT: eOper = sheet::ConditionOperator_FORMULA; break;
default:
{
// added to avoid warnings
@@ -109,15 +155,15 @@ ScConditionMode lcl_ConditionOperatorToMode( sheet::ConditionOperator eOper )
ScConditionMode eMode = SC_COND_NONE;
switch (eOper)
{
- case sheet::ConditionOperator_EQUAL: eMode = SC_COND_EQUAL; break;
- case sheet::ConditionOperator_LESS: eMode = SC_COND_LESS; break;
- case sheet::ConditionOperator_GREATER: eMode = SC_COND_GREATER; break;
- case sheet::ConditionOperator_LESS_EQUAL: eMode = SC_COND_EQLESS; break;
- case sheet::ConditionOperator_GREATER_EQUAL: eMode = SC_COND_EQGREATER; break;
- case sheet::ConditionOperator_NOT_EQUAL: eMode = SC_COND_NOTEQUAL; break;
- case sheet::ConditionOperator_BETWEEN: eMode = SC_COND_BETWEEN; break;
- case sheet::ConditionOperator_NOT_BETWEEN: eMode = SC_COND_NOTBETWEEN; break;
- case sheet::ConditionOperator_FORMULA: eMode = SC_COND_DIRECT; break;
+ case sheet::ConditionOperator_EQUAL: eMode = SC_COND_EQUAL; break;
+ case sheet::ConditionOperator_LESS: eMode = SC_COND_LESS; break;
+ case sheet::ConditionOperator_GREATER: eMode = SC_COND_GREATER; break;
+ case sheet::ConditionOperator_LESS_EQUAL: eMode = SC_COND_EQLESS; break;
+ case sheet::ConditionOperator_GREATER_EQUAL: eMode = SC_COND_EQGREATER; break;
+ case sheet::ConditionOperator_NOT_EQUAL: eMode = SC_COND_NOTEQUAL; break;
+ case sheet::ConditionOperator_BETWEEN: eMode = SC_COND_BETWEEN; break;
+ case sheet::ConditionOperator_NOT_BETWEEN: eMode = SC_COND_NOTBETWEEN; break;
+ case sheet::ConditionOperator_FORMULA: eMode = SC_COND_DIRECT; break;
default:
{
// added to avoid warnings
@@ -270,9 +316,8 @@ void SAL_CALL ScTableConditionalFormat::addNew(
if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_OPERATOR ) ) )
{
- sheet::ConditionOperator eOper = (sheet::ConditionOperator)
- ScUnoHelpFunctions::GetEnumFromAny( rProp.Value );
- aEntry.meMode = lcl_ConditionOperatorToMode( eOper );
+ sal_Int32 eOper = ScUnoHelpFunctions::GetEnumFromAny( rProp.Value );
+ aEntry.meMode = lcl_ConditionOperatorToModeNew( eOper );
}
else if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_FORMULA1 ) ) )
{
@@ -557,6 +602,22 @@ void SAL_CALL ScTableConditionalEntry::setOperator( sheet::ConditionOperator nOp
pParent->DataChanged();
}
+sal_Int32 SAL_CALL ScTableConditionalEntry::getConditionOperator()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ return lcl_ConditionModeToOperatorNew( aData.meMode );
+}
+
+void SAL_CALL ScTableConditionalEntry::setConditionOperator( sal_Int32 nOperator )
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ aData.meMode = lcl_ConditionOperatorToModeNew( nOperator );
+ if (pParent)
+ pParent->DataChanged();
+}
+
rtl::OUString SAL_CALL ScTableConditionalEntry::getFormula1() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
@@ -755,6 +816,21 @@ void SAL_CALL ScTableValidationObj::setOperator( sheet::ConditionOperator nOpera
DataChanged();
}
+sal_Int32 SAL_CALL ScTableValidationObj::getConditionOperator()
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ return lcl_ConditionModeToOperatorNew( (ScConditionMode)nMode );
+}
+
+void SAL_CALL ScTableValidationObj::setConditionOperator( sal_Int32 nOperator )
+ throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ nMode = sal::static_int_cast<USHORT>( lcl_ConditionOperatorToModeNew( nOperator ) );
+ DataChanged();
+}
+
rtl::OUString SAL_CALL ScTableValidationObj::getFormula1() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;