[Libreoffice-commits] core.git: Branch 'private/moggi/conditional-format-api' - 8 commits - offapi/com sc/inc sc/qa sc/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Thu Mar 26 20:15:17 PDT 2015


 offapi/com/sun/star/sheet/ConditionFormatOperator.idl |   10 
 sc/inc/conditio.hxx                                   |    2 
 sc/qa/extras/new_cond_format.cxx                      |    2 
 sc/source/core/data/conditio.cxx                      |   14 +
 sc/source/ui/inc/condformatuno.hxx                    |   46 +--
 sc/source/ui/unoobj/condformatuno.cxx                 |  244 +++++++++++++++---
 6 files changed, 255 insertions(+), 63 deletions(-)

New commits:
commit 8602dbb69bb256abb4edb97402715341022eadc7
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Fri Mar 27 04:13:52 2015 +0100

    implement one more method
    
    Change-Id: Ie18be81fa664df88af605674968e302c59f7dc98

diff --git a/sc/source/ui/inc/condformatuno.hxx b/sc/source/ui/inc/condformatuno.hxx
index df5e358..04acec2 100644
--- a/sc/source/ui/inc/condformatuno.hxx
+++ b/sc/source/ui/inc/condformatuno.hxx
@@ -93,6 +93,7 @@ public:
     virtual ~ScCondFormatObj();
 
     static ScCondFormatObj* getImplementation( uno::Reference<sheet::XConditionalFormat> XCondFormat);
+    ScDocShell* getDocShell();
 
     // XConditionalFormat
     virtual SAL_CALL void addEntry(const uno::Reference<sheet::XConditionEntry>& xEntry)
@@ -176,7 +177,7 @@ class ScConditionEntryObj : public cppu::WeakImplHelper2<com::sun::star::beans::
 {
 public:
 
-    ScConditionEntryObj();
+    ScConditionEntryObj(rtl::Reference<ScCondFormatObj> xParent);
     virtual ~ScConditionEntryObj();
 
     static ScConditionEntryObj* getImplementation(uno::Reference<sheet::XConditionEntry> xCondition);
@@ -238,7 +239,7 @@ class ScColorScaleFormatObj : public cppu::WeakImplHelper1<com::sun::star::beans
 {
 public:
 
-    ScColorScaleFormatObj();
+    ScColorScaleFormatObj(rtl::Reference<ScCondFormatObj> xParent);
     virtual ~ScColorScaleFormatObj();
 
     static ScColorScaleFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet);
@@ -295,7 +296,7 @@ private:
 class ScDataBarFormatObj : public cppu::WeakImplHelper1<com::sun::star::beans::XPropertySet>
 {
 public:
-    ScDataBarFormatObj();
+    ScDataBarFormatObj(rtl::Reference<ScCondFormatObj> xParent);
     virtual ~ScDataBarFormatObj();
 
     static ScDataBarFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet);
@@ -352,7 +353,7 @@ private:
 class ScIconSetFormatObj : public cppu::WeakImplHelper1<com::sun::star::beans::XPropertySet>
 {
 public:
-    ScIconSetFormatObj();
+    ScIconSetFormatObj(rtl::Reference<ScCondFormatObj> xParent);
     virtual ~ScIconSetFormatObj();
 
     static ScIconSetFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet);
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index fcf32b5..aee40f7 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -295,6 +295,35 @@ ScConditionalFormatList* ScCondFormatsObj::getCoreObject()
     return pList;
 }
 
+namespace {
+
+uno::Reference<beans::XPropertySet> createConditionEntry(const ScFormatEntry* pEntry,
+        rtl::Reference<ScCondFormatObj> xParent)
+{
+    switch (pEntry->GetType())
+    {
+        case condformat::CONDITION:
+            return new ScConditionEntryObj(xParent);
+        break;
+        case condformat::COLORSCALE:
+            return new ScColorScaleFormatObj(xParent);
+        break;
+        case condformat::DATABAR:
+            return new ScDataBarFormatObj(xParent);
+        break;
+        case condformat::ICONSET:
+            return new ScIconSetFormatObj(xParent);
+        break;
+        case condformat::DATE:
+        break;
+        default:
+        break;
+    }
+    return uno::Reference<beans::XPropertySet>();
+}
+
+}
+
 ScCondFormatObj::ScCondFormatObj(ScDocShell* pDocShell, rtl::Reference<ScCondFormatsObj> xCondFormats,
         sal_Int32 nKey):
     mxCondFormatList(xCondFormats),
@@ -318,6 +347,11 @@ ScConditionalFormat* ScCondFormatObj::getCoreObject()
     return pFormat;
 }
 
+ScDocShell* ScCondFormatObj::getDocShell()
+{
+    return mpDocShell;
+}
+
 void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& /*xEntry*/)
     throw(uno::RuntimeException, std::exception)
 {
@@ -356,10 +390,18 @@ sal_Int32 ScCondFormatObj::getCount()
     return pFormat->size();
 }
 
-uno::Any ScCondFormatObj::getByIndex(sal_Int32 /*nIndex*/)
+uno::Any ScCondFormatObj::getByIndex(sal_Int32 nIndex)
     throw(uno::RuntimeException, std::exception)
 {
+    SolarMutexGuard aGuard;
+    if (getCoreObject()->size() >= size_t(nIndex))
+        throw lang::IllegalArgumentException();
+
+    const ScFormatEntry* pEntry = getCoreObject()->GetEntry(nIndex);
+    uno::Reference<beans::XPropertySet> xCondEntry =
+        createConditionEntry(pEntry, this);
     uno::Any aAny;
+    aAny <<= xCondEntry;
     return aAny;
 }
 
@@ -477,7 +519,9 @@ void SAL_CALL ScCondFormatObj::removeVetoableChangeListener( const OUString&,
     SAL_WARN("sc", "not implemented");
 }
 
-ScConditionEntryObj::ScConditionEntryObj():
+ScConditionEntryObj::ScConditionEntryObj(rtl::Reference<ScCondFormatObj> xParent):
+    mpDocShell(xParent->getDocShell()),
+    mxParent(xParent),
     maPropSet(getConditionEntryrPropSet())
 {
 }
@@ -653,7 +697,9 @@ void SAL_CALL ScConditionEntryObj::removeVetoableChangeListener( const OUString&
     SAL_WARN("sc", "not implemented");
 }
 
-ScColorScaleFormatObj::ScColorScaleFormatObj():
+ScColorScaleFormatObj::ScColorScaleFormatObj(rtl::Reference<ScCondFormatObj> xParent):
+    mpDocShell(xParent->getDocShell()),
+    mxParent(xParent),
     maPropSet(getColorScalePropSet())
 {
 }
@@ -753,7 +799,9 @@ void SAL_CALL ScColorScaleFormatObj::removeVetoableChangeListener( const OUStrin
     SAL_WARN("sc", "not implemented");
 }
 
-ScDataBarFormatObj::ScDataBarFormatObj():
+ScDataBarFormatObj::ScDataBarFormatObj(rtl::Reference<ScCondFormatObj> xParent):
+    mpDocShell(xParent->getDocShell()),
+    mxParent(xParent),
     maPropSet(getDataBarPropSet())
 {
 }
@@ -980,7 +1028,9 @@ void SAL_CALL ScDataBarFormatObj::removeVetoableChangeListener( const OUString&,
     SAL_WARN("sc", "not implemented");
 }
 
-ScIconSetFormatObj::ScIconSetFormatObj():
+ScIconSetFormatObj::ScIconSetFormatObj(rtl::Reference<ScCondFormatObj> xParent):
+    mpDocShell(xParent->getDocShell()),
+    mxParent(xParent),
     maPropSet(getIconSetPropSet())
 {
 }
commit 74ad2acbfa7e632ed08e9924ccd7821df9932083
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Fri Mar 27 04:12:53 2015 +0100

    fix return type
    
    Change-Id: I581a8a0c7348a9752611b378e883ef20172d16e0

diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index e648edc..0bd96d4 100644
--- a/sc/qa/extras/new_cond_format.cxx
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -163,7 +163,7 @@ void ScConditionalFormatTest::testCondFormatXIndex()
     CPPUNIT_ASSERT(xCondFormat.is());
 
     uno::Type aType = xCondFormat->getElementType();
-    CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.sheet.XConditionEntry"), aType.getTypeName());
+    CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.beans.XPropertySet"), aType.getTypeName());
 
     CPPUNIT_ASSERT(xCondFormat->hasElements());
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xCondFormat->getCount());
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index a21fc7e..fcf32b5 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -336,7 +336,7 @@ void ScCondFormatObj::removeByIndex(const sal_Int32 nIndex)
 uno::Type ScCondFormatObj::getElementType()
     throw(uno::RuntimeException, std::exception)
 {
-    return cppu::UnoType<sheet::XConditionEntry>::get();
+    return cppu::UnoType<beans::XPropertySet>::get();
 }
 
 sal_Bool ScCondFormatObj::hasElements()
commit f8d9364c502f591607535c46dd257e6107ba6a2a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Fri Mar 27 04:11:53 2015 +0100

    implement one more method
    
    Change-Id: I3483b2004c0afb8bea651d9eec35d1cbf9aff2a1

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 425e09e..fc039c0 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -392,6 +392,7 @@ public:
     ScConditionalFormat* Clone(ScDocument* pNewDoc = NULL) const;
 
     void            AddEntry( ScFormatEntry* pNew );
+    void RemoveEntry(size_t nIndex);
     void            SetRange( const ScRangeList& rRanges );
     const ScRangeList&  GetRange() const  { return maRanges; }
     // don't use the same name as for the const version
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 6c51556..0475db8 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1853,6 +1853,15 @@ void ScConditionalFormat::AddEntry( ScFormatEntry* pNew )
     pNew->SetParent(this);
 }
 
+void ScConditionalFormat::RemoveEntry(size_t n)
+{
+    if (n < maEntries.size())
+    {
+        maEntries.erase(maEntries.begin() + n);
+        DoRepaint(NULL);
+    }
+}
+
 bool ScConditionalFormat::IsEmpty() const
 {
     return maEntries.empty();
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index 9a3876b..a21fc7e 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -323,9 +323,14 @@ void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& /*x
 {
 }
 
-void ScCondFormatObj::removeByIndex(const sal_Int32 /*nIndex*/)
+void ScCondFormatObj::removeByIndex(const sal_Int32 nIndex)
     throw(uno::RuntimeException, std::exception)
 {
+    SolarMutexGuard aGuard;
+    if (getCoreObject()->size() >= size_t(nIndex))
+        throw lang::IllegalArgumentException();
+
+    getCoreObject()->RemoveEntry(nIndex);
 }
 
 uno::Type ScCondFormatObj::getElementType()
commit 84e24b835e4caa796953883da20aa28827d33536
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Fri Mar 27 03:24:35 2015 +0100

    implement some more properties for databars
    
    Change-Id: Ib6c7f4f316ff49d433c8810ef9a7bbfe64c0576d

diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index 9aad855..9a3876b 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -788,6 +788,19 @@ void SAL_CALL ScDataBarFormatObj::setPropertyValue(
     {
         case AxisPosition:
         {
+            sal_Int32 nVal;
+            if (aValue >>= nVal)
+            {
+                for (size_t i = 0; i < SAL_N_ELEMENTS(aDataBarAxisMap); ++i)
+                {
+                    if (aDataBarAxisMap[i].nApiPos == nVal)
+                    {
+                        getCoreObject()->GetDataBarData()->meAxisPosition =
+                            aDataBarAxisMap[i].ePos;
+                        break;
+                    }
+                }
+            }
         }
         break;
         case UseGradient:
@@ -1038,6 +1051,10 @@ void SAL_CALL ScIconSetFormatObj::setPropertyValue(
             getCoreObject()->GetIconSetData()->eIconSetType = eType;
         }
         break;
+        case IconSetEntries:
+        break;
+        default:
+        break;
     }
 }
 
commit fba45c6abfdc1cc910a4175bfe12e59ab1baf200
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 26 23:16:27 2015 +0100

    fix getPropertyValue/setPropertyValue for ScCondFormatEntry UNO object
    
    Change-Id: Id1a3cc62288c6c618c8b86caaa69a96eb541d06f

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 57dd2d9..425e09e 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -209,6 +209,7 @@ public:
     bool IsCellValid( ScRefCellValue& rCell, const ScAddress& rPos ) const;
 
     ScConditionMode GetOperation() const        { return eOp; }
+    void SetOperation(ScConditionMode eMode);
     bool            IsIgnoreBlank() const       { return ( nOptions & SC_COND_NOBLANKS ) == 0; }
     void            SetIgnoreBlank(bool bSet);
     ScAddress       GetSrcPos() const           { return aSrcPos; }
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 6967a33..6c51556 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -322,6 +322,11 @@ ScConditionEntry::~ScConditionEntry()
     delete pFormula2;
 }
 
+void ScConditionEntry::SetOperation(ScConditionMode eMode)
+{
+    eOp = eMode;
+}
+
 void ScConditionEntry::Compile( const OUString& rExpr1, const OUString& rExpr2,
         const OUString& rExprNmsp1, const OUString& rExprNmsp2,
         FormulaGrammar::Grammar eGrammar1, FormulaGrammar::Grammar eGrammar2, bool bTextToReal )
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index 81e32f7..9aad855 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -14,6 +14,8 @@
 #include "colorscale.hxx"
 #include "docsh.hxx"
 #include "miscuno.hxx"
+#include "compiler.hxx"
+#include "tokenarray.hxx"
 
 #include "cellsuno.hxx"
 #include "convuno.hxx"
@@ -72,11 +74,35 @@ struct ConditionEntryApiMap
     sal_Int32 nApiMode;
 };
 
-/*
 ConditionEntryApiMap aConditionEntryMap[] =
 {
+    {SC_COND_EQUAL, sheet::ConditionFormatOperator::EQUAL},
+    {SC_COND_LESS, sheet::ConditionFormatOperator::LESS},
+    {SC_COND_GREATER, sheet::ConditionFormatOperator::GREATER},
+    {SC_COND_EQLESS, sheet::ConditionFormatOperator::LESS_EQUAL},
+    {SC_COND_EQGREATER, sheet::ConditionFormatOperator::GREATER_EQUAL},
+    {SC_COND_NOTEQUAL, sheet::ConditionFormatOperator::NOT_EQUAL},
+    {SC_COND_BETWEEN, sheet::ConditionFormatOperator::BETWEEN},
+    {SC_COND_NOTBETWEEN, sheet::ConditionFormatOperator::NOT_BETWEEN},
+    {SC_COND_DUPLICATE, sheet::ConditionFormatOperator::DUPLICATE},
+    {SC_COND_NOTDUPLICATE, sheet::ConditionFormatOperator::UNIQUE},
+    {SC_COND_DIRECT, sheet::ConditionFormatOperator::EXPRESSION},
+    {SC_COND_TOP10, sheet::ConditionFormatOperator::TOP_N_ELEMENTS},
+    {SC_COND_BOTTOM10, sheet::ConditionFormatOperator::BOTTOM_N_ELEMENTS},
+    {SC_COND_TOP_PERCENT, sheet::ConditionFormatOperator::TOP_N_PERCENT},
+    {SC_COND_BOTTOM_PERCENT, sheet::ConditionFormatOperator::BOTTOM_N_PERCENT},
+    {SC_COND_ABOVE_AVERAGE, sheet::ConditionFormatOperator::ABOVE_AVERAGE},
+    {SC_COND_BELOW_AVERAGE, sheet::ConditionFormatOperator::BELOW_AVERAGE},
+    {SC_COND_ABOVE_EQUAL_AVERAGE, sheet::ConditionFormatOperator::ABOVE_EQUAL_AVERAGE},
+    {SC_COND_BELOW_EQUAL_AVERAGE, sheet::ConditionFormatOperator::BELOW_EQUAL_AVERAGE},
+    {SC_COND_ERROR, sheet::ConditionFormatOperator::ERROR},
+    {SC_COND_NOERROR, sheet::ConditionFormatOperator::NO_ERROR},
+    {SC_COND_BEGINS_WITH, sheet::ConditionFormatOperator::BEGINS_WITH},
+    {SC_COND_ENDS_WITH, sheet::ConditionFormatOperator::ENDS_WITH},
+    {SC_COND_CONTAINS_TEXT, sheet::ConditionFormatOperator::CONTAINS},
+    {SC_COND_NOT_CONTAINS_TEXT, sheet::ConditionFormatOperator::NOT_CONTAINS},
+    {SC_COND_NONE, sheet::ConditionFormatOperator::EQUAL},
 };
-*/
 
 enum ColorScaleProperties
 {
@@ -475,7 +501,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScConditionEntryObj::getPropert
 }
 
 void SAL_CALL ScConditionEntryObj::setPropertyValue(
-                        const OUString& aPropertyName, const uno::Any& /*aValue*/ )
+                        const OUString& aPropertyName, const uno::Any& aValue )
                 throw(beans::UnknownPropertyException, beans::PropertyVetoException,
                         lang::IllegalArgumentException, lang::WrappedTargetException,
                         uno::RuntimeException, std::exception)
@@ -490,12 +516,49 @@ void SAL_CALL ScConditionEntryObj::setPropertyValue(
     switch(pEntry->nWID)
     {
         case StyleName:
+        {
+            OUString aStyleName;
+            if ((aValue >>= aStyleName) && !aStyleName.isEmpty())
+                getCoreObject()->UpdateStyleName(aStyleName);
+        }
         break;
         case Formula1:
+        {
+            OUString aFormula;
+            if ((aValue >>= aFormula) && !aFormula.isEmpty())
+            {
+                ScCompiler aComp(&mpDocShell->GetDocument(), getCoreObject()->GetSrcPos());
+                boost::scoped_ptr<ScTokenArray> pArr(aComp.CompileString(aFormula));
+                getCoreObject()->SetFormula1(*pArr);
+            }
+        }
         break;
         case Formula2:
+        {
+            OUString aFormula;
+            if ((aValue >>= aFormula) && !aFormula.isEmpty())
+            {
+                ScCompiler aComp(&mpDocShell->GetDocument(), getCoreObject()->GetSrcPos());
+                boost::scoped_ptr<ScTokenArray> pArr(aComp.CompileString(aFormula));
+                getCoreObject()->SetFormula2(*pArr);
+            }
+        }
         break;
         case Operator:
+        {
+            sal_Int32 nVal;
+            if (aValue >>= nVal)
+            {
+                for (size_t i = 0; i < SAL_N_ELEMENTS(aConditionEntryMap); ++i)
+                {
+                    if (aConditionEntryMap[i].nApiMode == nVal)
+                    {
+                        getCoreObject()->SetOperation(aConditionEntryMap[i].eMode);
+                        break;
+                    }
+                }
+            }
+        }
         break;
         default:
             SAL_WARN("sc", "unsupported property");
@@ -517,25 +580,34 @@ uno::Any SAL_CALL ScConditionEntryObj::getPropertyValue( const OUString& aProper
     switch(pEntry->nWID)
     {
         case StyleName:
-            aAny <<= pFormat->GetStyle();
+            aAny <<= getCoreObject()->GetStyle();
         break;
         case Formula1:
         {
-            ScAddress aCursor = pFormat->GetSrcPos();
-            OUString aFormula = pFormat->GetExpression(aCursor, 0);
+            ScAddress aCursor = getCoreObject()->GetSrcPos();
+            OUString aFormula = getCoreObject()->GetExpression(aCursor, 0);
             aAny <<= aFormula;
         }
         break;
         case Formula2:
         {
-            ScAddress aCursor = pFormat->GetSrcPos();
-            OUString aFormula = pFormat->GetExpression(aCursor, 1);
+            ScAddress aCursor = getCoreObject()->GetSrcPos();
+            OUString aFormula = getCoreObject()->GetExpression(aCursor, 1);
             aAny <<= aFormula;
         }
         break;
         case Operator:
         {
+            ScConditionMode eMode = getCoreObject()->GetOperation();
+            for (size_t i = 0; i < SAL_N_ELEMENTS(aConditionEntryMap); ++i)
+            {
+                if (aConditionEntryMap[i].eMode == eMode)
+                {
+                    aAny <<= aConditionEntryMap[i].nApiMode;
+                    break;
 
+                }
+            }
         }
         break;
         default:
commit 81d271f5b5ff17b8f8ec60ae3923c3b91ce39803
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 26 23:14:29 2015 +0100

    more work for fixing lifecycle
    
    Change-Id: Ieba2eef93777f616bda6a46fe206b773c09ab2a0

diff --git a/sc/source/ui/inc/condformatuno.hxx b/sc/source/ui/inc/condformatuno.hxx
index 8aa4dee..df5e358 100644
--- a/sc/source/ui/inc/condformatuno.hxx
+++ b/sc/source/ui/inc/condformatuno.hxx
@@ -32,7 +32,7 @@ class ScConditionalFormatList;
 class ScConditionalFormat;
 class ScIconSetFormat;
 class ScDataBarFormat;
-class ScColorScale;
+class ScColorScaleFormat;
 class ScCondFormatEntry;
 
 using namespace com::sun::star;
@@ -181,6 +181,8 @@ public:
 
     static ScConditionEntryObj* getImplementation(uno::Reference<sheet::XConditionEntry> xCondition);
 
+    ScCondFormatEntry* getCoreObject();
+
     // XConditionEntry
     virtual SAL_CALL sal_Int32 getType()
         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -227,8 +229,9 @@ public:
                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 private:
+    ScDocShell* mpDocShell;
+    rtl::Reference<ScCondFormatObj> mxParent;
     SfxItemPropertySet maPropSet;
-    ScCondFormatEntry* pFormat;
 };
 
 class ScColorScaleFormatObj : public cppu::WeakImplHelper1<com::sun::star::beans::XPropertySet>
@@ -240,6 +243,8 @@ public:
 
     static ScColorScaleFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet);
 
+    ScColorScaleFormat* getCoreObject();
+
                             // XPropertySet
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
                             SAL_CALL getPropertySetInfo()
@@ -282,7 +287,8 @@ public:
                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 private:
-    ScColorScale* pColorScale;
+    ScDocShell* mpDocShell;
+    rtl::Reference<ScCondFormatObj> mxParent;
     SfxItemPropertySet maPropSet;
 };
 
@@ -294,6 +300,8 @@ public:
 
     static ScDataBarFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet);
 
+    ScDataBarFormat* getCoreObject();
+
                             // XPropertySet
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
                             SAL_CALL getPropertySetInfo()
@@ -336,7 +344,8 @@ public:
                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 private:
-    ScDataBarFormat* mpDataBar;
+    ScDocShell* mpDocShell;
+    rtl::Reference<ScCondFormatObj> mxParent;
     SfxItemPropertySet maPropSet;
 };
 
@@ -348,6 +357,8 @@ public:
 
     static ScIconSetFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet);
 
+    ScIconSetFormat* getCoreObject();
+
                             // XPropertySet
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
                             SAL_CALL getPropertySetInfo()
@@ -390,8 +401,8 @@ public:
                                     ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 private:
-
-    ScIconSetFormat* mpIconSet;
+    ScDocShell* mpDocShell;
+    rtl::Reference<ScCondFormatObj> mxParent;
     SfxItemPropertySet maPropSet;
 };
 
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index 7113129..81e32f7 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -455,6 +455,11 @@ ScConditionEntryObj::~ScConditionEntryObj()
 {
 }
 
+ScCondFormatEntry* ScConditionEntryObj::getCoreObject()
+{
+    return NULL;
+}
+
 sal_Int32 ScConditionEntryObj::getType()
     throw(uno::RuntimeException, std::exception)
 {
@@ -580,6 +585,11 @@ ScColorScaleFormatObj::~ScColorScaleFormatObj()
 {
 }
 
+ScColorScaleFormat* ScColorScaleFormatObj::getCoreObject()
+{
+    return NULL;
+}
+
 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScColorScaleFormatObj::getPropertySetInfo()
     throw(uno::RuntimeException, std::exception)
 {
@@ -675,6 +685,11 @@ ScDataBarFormatObj::~ScDataBarFormatObj()
 {
 }
 
+ScDataBarFormat* ScDataBarFormatObj::getCoreObject()
+{
+    return NULL;
+}
+
 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDataBarFormatObj::getPropertySetInfo()
     throw(uno::RuntimeException, std::exception)
 {
@@ -708,7 +723,7 @@ void SAL_CALL ScDataBarFormatObj::setPropertyValue(
             bool bUseGradient = true;
             if (aValue >>= bUseGradient)
             {
-                mpDataBar->GetDataBarData()->mbGradient = bUseGradient;
+                getCoreObject()->GetDataBarData()->mbGradient = bUseGradient;
             }
         }
         break;
@@ -717,10 +732,10 @@ void SAL_CALL ScDataBarFormatObj::setPropertyValue(
             bool bUseNegativeColor = false;
             if (aValue >>= bUseNegativeColor)
             {
-                mpDataBar->GetDataBarData()->mbNeg = bUseNegativeColor;
-                if (bUseNegativeColor && !mpDataBar->GetDataBarData()->mpNegativeColor)
+                getCoreObject()->GetDataBarData()->mbNeg = bUseNegativeColor;
+                if (bUseNegativeColor && !getCoreObject()->GetDataBarData()->mpNegativeColor)
                 {
-                    mpDataBar->GetDataBarData()->mpNegativeColor.reset(new Color(COL_AUTO));
+                    getCoreObject()->GetDataBarData()->mpNegativeColor.reset(new Color(COL_AUTO));
                 }
             }
         }
@@ -730,7 +745,7 @@ void SAL_CALL ScDataBarFormatObj::setPropertyValue(
             bool bShowValue = true;
             if (aValue >>= bShowValue)
             {
-                mpDataBar->GetDataBarData()->mbOnlyBar = !bShowValue;
+                getCoreObject()->GetDataBarData()->mbOnlyBar = !bShowValue;
             }
         }
         break;
@@ -739,7 +754,7 @@ void SAL_CALL ScDataBarFormatObj::setPropertyValue(
             sal_Int32 nColor = COL_AUTO;
             if (aValue >>= nColor)
             {
-                mpDataBar->GetDataBarData()->maPositiveColor.SetColor(nColor);
+                getCoreObject()->GetDataBarData()->maPositiveColor.SetColor(nColor);
             }
         }
         break;
@@ -748,16 +763,16 @@ void SAL_CALL ScDataBarFormatObj::setPropertyValue(
             sal_Int32 nAxisColor = COL_AUTO;
             if (aValue >>= nAxisColor)
             {
-                mpDataBar->GetDataBarData()->maAxisColor.SetColor(nAxisColor);
+                getCoreObject()->GetDataBarData()->maAxisColor.SetColor(nAxisColor);
             }
         }
         break;
         case NegativeColor:
         {
             sal_Int32 nNegativeColor = COL_AUTO;
-            if ((aValue >>= nNegativeColor) && mpDataBar->GetDataBarData()->mbNeg)
+            if ((aValue >>= nNegativeColor) && getCoreObject()->GetDataBarData()->mbNeg)
             {
-                mpDataBar->GetDataBarData()->mpNegativeColor->SetColor(nNegativeColor);
+                getCoreObject()->GetDataBarData()->mpNegativeColor->SetColor(nNegativeColor);
             }
             else
                 throw lang::IllegalArgumentException();
@@ -786,7 +801,7 @@ uno::Any SAL_CALL ScDataBarFormatObj::getPropertyValue( const OUString& aPropert
     {
         case AxisPosition:
         {
-            databar::ScAxisPosition ePos = mpDataBar->GetDataBarData()->meAxisPosition;
+            databar::ScAxisPosition ePos = getCoreObject()->GetDataBarData()->meAxisPosition;
             sal_Int32 nApiPos = sheet::DataBarAxis::AXIS_NONE;
             for (size_t i = 0; i < SAL_N_ELEMENTS(aDataBarAxisMap); ++i)
             {
@@ -801,36 +816,36 @@ uno::Any SAL_CALL ScDataBarFormatObj::getPropertyValue( const OUString& aPropert
         break;
         case UseGradient:
         {
-           aAny <<= mpDataBar->GetDataBarData()->mbGradient;
+           aAny <<= getCoreObject()->GetDataBarData()->mbGradient;
         }
         break;
         case UseNegativeColor:
         {
-           aAny <<= mpDataBar->GetDataBarData()->mbNeg;
+           aAny <<= getCoreObject()->GetDataBarData()->mbNeg;
         }
         break;
         case DataBar_ShowValue:
         {
-            aAny <<= !mpDataBar->GetDataBarData()->mbOnlyBar;
+            aAny <<= !getCoreObject()->GetDataBarData()->mbOnlyBar;
         }
         break;
         case DataBar_Color:
         {
-            sal_Int32 nColor = mpDataBar->GetDataBarData()->maPositiveColor.GetColor();
+            sal_Int32 nColor = getCoreObject()->GetDataBarData()->maPositiveColor.GetColor();
             aAny <<= nColor;
         }
         break;
         case AxisColor:
         {
-            sal_Int32 nAxisColor = mpDataBar->GetDataBarData()->maAxisColor.GetColor();
+            sal_Int32 nAxisColor = getCoreObject()->GetDataBarData()->maAxisColor.GetColor();
             aAny <<= nAxisColor;
         }
         break;
         case NegativeColor:
         {
-            if (mpDataBar->GetDataBarData()->mbNeg && mpDataBar->GetDataBarData()->mpNegativeColor)
+            if (getCoreObject()->GetDataBarData()->mbNeg && getCoreObject()->GetDataBarData()->mpNegativeColor)
             {
-                sal_Int32 nNegativeColor = mpDataBar->GetDataBarData() ->mpNegativeColor->GetColor();
+                sal_Int32 nNegativeColor = getCoreObject()->GetDataBarData()->mpNegativeColor->GetColor();
                 aAny <<= nNegativeColor;
             }
         }
@@ -884,6 +899,11 @@ ScIconSetFormatObj::~ScIconSetFormatObj()
 {
 }
 
+ScIconSetFormat* ScIconSetFormatObj::getCoreObject()
+{
+    return NULL;
+}
+
 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScIconSetFormatObj::getPropertySetInfo()
     throw(uno::RuntimeException, std::exception)
 {
@@ -912,14 +932,14 @@ void SAL_CALL ScIconSetFormatObj::setPropertyValue(
         {
             bool bShowValue = true;
             aValue >>= bShowValue;
-            mpIconSet->GetIconSetData()->mbShowValue = bShowValue;
+            getCoreObject()->GetIconSetData()->mbShowValue = bShowValue;
         }
         break;
         case Reverse:
         {
             bool bReverse = false;
             aValue >>= bReverse;
-            mpIconSet->GetIconSetData()->mbReverse = bReverse;
+            getCoreObject()->GetIconSetData()->mbReverse = bReverse;
         }
         break;
         case Icons:
@@ -943,7 +963,7 @@ void SAL_CALL ScIconSetFormatObj::setPropertyValue(
                 throw lang::IllegalArgumentException();
             }
 
-            mpIconSet->GetIconSetData()->eIconSetType = eType;
+            getCoreObject()->GetIconSetData()->eIconSetType = eType;
         }
         break;
     }
@@ -965,14 +985,14 @@ uno::Any SAL_CALL ScIconSetFormatObj::getPropertyValue( const OUString& aPropert
     switch(pEntry->nWID)
     {
         case ShowValue:
-            aAny <<= mpIconSet->GetIconSetData()->mbShowValue;
+            aAny <<= getCoreObject()->GetIconSetData()->mbShowValue;
         break;
         case Reverse:
-            aAny <<= mpIconSet->GetIconSetData()->mbReverse;
+            aAny <<= getCoreObject()->GetIconSetData()->mbReverse;
         break;
         case Icons:
         {
-            ScIconSetType eType = mpIconSet->GetIconSetData()->eIconSetType;
+            ScIconSetType eType = getCoreObject()->GetIconSetData()->eIconSetType;
             for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetApiMap); ++i)
             {
                 if (aIconSetApiMap[i].eType == eType)
@@ -985,8 +1005,8 @@ uno::Any SAL_CALL ScIconSetFormatObj::getPropertyValue( const OUString& aPropert
         break;
         case IconSetEntries:
         {
-            uno::Sequence< sheet::XIconSetEntry > aEntries(mpIconSet->size());
-            for (auto it = mpIconSet->begin(), itEnd = mpIconSet->end(); it != itEnd; ++it)
+            uno::Sequence< sheet::XIconSetEntry > aEntries(getCoreObject()->size());
+            for (auto it = getCoreObject()->begin(), itEnd = getCoreObject()->end(); it != itEnd; ++it)
             {
                 //aEntries.operator[] = ;
             }
commit 5566544693d0194f04d26216a590377fca676767
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 26 23:12:10 2015 +0100

    add missing enum values
    
    Change-Id: I3234fb21e3f62068e39b6667e9c77e857536ade4

diff --git a/offapi/com/sun/star/sheet/ConditionFormatOperator.idl b/offapi/com/sun/star/sheet/ConditionFormatOperator.idl
index 187fde36..68ac0e2 100644
--- a/offapi/com/sun/star/sheet/ConditionFormatOperator.idl
+++ b/offapi/com/sun/star/sheet/ConditionFormatOperator.idl
@@ -54,11 +54,15 @@ constants ConditionFormatOperator
 
     const long NO_ERROR = 19;
 
-    const long CONTAINS = 20;
+    const long BEGINS_WITH = 20;
 
-    const long NOT_CONTAINS = 21;
+    const long ENDS_WITH = 21;
 
-    const long EXPRESSION = 22;
+    const long CONTAINS = 22;
+
+    const long NOT_CONTAINS = 23;
+
+    const long EXPRESSION = 24;
 };
 
 
commit 84bdefb2c3fe40e730d52419718cbd28c2371425
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue Mar 17 08:34:05 2015 +0100

    let all new conditional formatting objects use WeakImplHelper
    
    Change-Id: I3b7bfb0104fb4b41c2c84d00723934faa8de5be9

diff --git a/sc/source/ui/inc/condformatuno.hxx b/sc/source/ui/inc/condformatuno.hxx
index ec9218c..8aa4dee 100644
--- a/sc/source/ui/inc/condformatuno.hxx
+++ b/sc/source/ui/inc/condformatuno.hxx
@@ -171,9 +171,8 @@ private:
     sal_Int32 mnKey;
 };
 
-class ScConditionEntryObj : public com::sun::star::beans::XPropertySet,
-                            public com::sun::star::sheet::XConditionEntry,
-                         public cppu::OWeakObject
+class ScConditionEntryObj : public cppu::WeakImplHelper2<com::sun::star::beans::XPropertySet,
+                                com::sun::star::sheet::XConditionEntry>
 {
 public:
 
@@ -232,8 +231,7 @@ private:
     ScCondFormatEntry* pFormat;
 };
 
-class ScColorScaleFormatObj : public com::sun::star::beans::XPropertySet,
-                         public cppu::OWeakObject
+class ScColorScaleFormatObj : public cppu::WeakImplHelper1<com::sun::star::beans::XPropertySet>
 {
 public:
 
@@ -288,8 +286,7 @@ private:
     SfxItemPropertySet maPropSet;
 };
 
-class ScDataBarFormatObj : public com::sun::star::beans::XPropertySet,
-                         public cppu::OWeakObject
+class ScDataBarFormatObj : public cppu::WeakImplHelper1<com::sun::star::beans::XPropertySet>
 {
 public:
     ScDataBarFormatObj();
@@ -343,8 +340,7 @@ private:
     SfxItemPropertySet maPropSet;
 };
 
-class ScIconSetFormatObj : public com::sun::star::beans::XPropertySet,
-                         public cppu::OWeakObject
+class ScIconSetFormatObj : public cppu::WeakImplHelper1<com::sun::star::beans::XPropertySet>
 {
 public:
     ScIconSetFormatObj();


More information about the Libreoffice-commits mailing list