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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 5 08:57:02 PDT 2012


 sc/inc/conditio.hxx               |    4 
 sc/source/core/data/conditio.cxx  |   34 +++-
 sc/source/filter/xml/xmlimprt.cxx |    2 
 sc/source/filter/xml/xmlimprt.hxx |    1 
 sc/source/filter/xml/xmlstyli.cxx |  259 ++++++++++++++++----------------------
 sc/source/filter/xml/xmlstyli.hxx |   32 +---
 6 files changed, 151 insertions(+), 181 deletions(-)

New commits:
commit bedbb471c3f49e0860dd63b17c1faeee837096ae
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Sep 3 19:30:26 2012 +0200

    better import of conditional format from old ODF structure
    
    The old ODF storage is style based and so the sam cond format can be
    divided up into several single stlyes which resulted in several new
    style cond formats.
    
    Now we check for old stlye cond formats if there is a equal cond format
    and in this case just extend the area. This should make it easier to
    transform old documents into the new range based cond formats.
    
    Change-Id: I51a5148922e19e6860de9915abfc59d49b18d96e

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 9890758..b4f686e 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -111,6 +111,8 @@ public:
 
     virtual void SetParent( ScConditionalFormat* pNew ) = 0;
 
+    bool operator==( const ScFormatEntry& ) const;
+
 #if DUMP_FORMAT_INFO
     virtual void dumpInfo() const = 0;
 #endif
@@ -282,6 +284,8 @@ public:
     void            AddEntry( ScFormatEntry* pNew );
     void            AddRange( const ScRangeList& rRanges );
     const ScRangeList&  GetRange() const  { return maRanges; }
+    // don't use the same name as for the const version
+    ScRangeList& GetRangeList() { return maRanges; }
 
     bool IsEmpty() const         { return maEntries.empty(); }
     size_t size() const           { return maEntries.size(); }
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 17483c3..5a0c483 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -54,6 +54,27 @@ ScFormatEntry::ScFormatEntry(ScDocument* pDoc):
 {
 }
 
+bool ScFormatEntry::operator==( const ScFormatEntry& r ) const
+{
+    if(GetType() != r.GetType())
+        return false;
+
+    switch(GetType())
+    {
+        case condformat::CONDITION:
+            return static_cast<const ScCondFormatEntry&>(*this) == static_cast<const ScCondFormatEntry&>(r);
+            break;
+        default:
+            // TODO: implement also this case
+            // actually return false for these cases is not that bad
+            // as soon as databar and color scale are tested we need
+            // to think about the range
+            return false;
+    }
+
+    return true;
+}
+
 bool lcl_HasRelRef( ScDocument* pDoc, ScTokenArray* pFormula, sal_uInt16 nRecursion = 0 )
 {
     if (pFormula)
@@ -1286,8 +1307,6 @@ int ScCondFormatEntry::operator== ( const ScCondFormatEntry& r ) const
 {
     return ScConditionEntry::operator==( r ) &&
             aStyleName == r.aStyleName;
-
-    //  Range wird nicht verglichen
 }
 
 ScCondFormatEntry::~ScCondFormatEntry()
@@ -1353,13 +1372,14 @@ bool ScConditionalFormat::EqualEntries( const ScConditionalFormat& r ) const
 
     //! auf gleiche Eintraege in anderer Reihenfolge testen ???
 
-    /*
-    for (sal_uInt16 i=0; i<nEntryCount; i++)
-        if ( ! (*ppEntries[i] == *r.ppEntries[i]) )
+    for (sal_uInt16 i=0; i<size(); i++)
+        if ( ! (maEntries == r.maEntries ) )
             return false;
-    */
 
-    return maRanges == r.maRanges;
+    // right now don't check for same range
+    // we only use this method to merge same conditional formats from
+    // old ODF data structure
+    return true;
 }
 
 void ScConditionalFormat::AddRange( const ScRangeList& rRanges )
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 495e7d7..0de87a2 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -2684,11 +2684,13 @@ void ScXMLImport::SetStyleToRanges()
             if (pStyle)
             {
                 pStyle->FillPropertySet(xProperties);
+                // here needs to be the cond format import method
                 sal_Int32 nNumberFormat(pStyle->GetNumberFormat());
                 SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
 
                 // store first cell of first range for each style, once per sheet
                 uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses());
+                pStyle->ApplyCondFormat(aAddresses);
                 if ( aAddresses.getLength() > 0 )
                 {
                     const table::CellRangeAddress& rRange = aAddresses[0];
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index f3706d9..d9d86fc 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -852,6 +852,7 @@ class ScXMLImport: public SvXMLImport
     com::sun::star::uno::Reference <com::sun::star::util::XNumberFormats> xNumberFormats;
     com::sun::star::uno::Reference <com::sun::star::util::XNumberFormatTypes> xNumberFormatTypes;
 
+    ScRangeList maSheetRanges;
     com::sun::star::uno::Reference <com::sun::star::sheet::XSheetCellRangeContainer> xSheetCellRanges;
 
     rtl::OUString           sEmpty;
diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx
index 1ef7cda..5776d72 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -52,6 +52,15 @@
 #include "docuno.hxx"
 #include "unonames.hxx"
 #include "document.hxx"
+#include "conditio.hxx"
+#include "svl/intitem.hxx"
+#include "rangelst.hxx"
+#include "rangeutl.hxx"
+#include "docfunc.hxx"
+#include "markdata.hxx"
+#include "docpool.hxx"
+#include "scitems.hxx"
+#include "patattr.hxx"
 
 #define XML_LINE_LEFT 0
 #define XML_LINE_RIGHT 1
@@ -279,9 +288,12 @@ void ScXMLRowImportPropertyMapper::finished(::std::vector< XMLPropertyState >& r
 
 class ScXMLMapContext : public SvXMLImportContext
 {
-    rtl::OUString sApplyStyle;
-    rtl::OUString sCondition;
-    rtl::OUString sBaseCell;
+    rtl::OUString msApplyStyle;
+    rtl::OUString msCondition;
+    rtl::OUString msBaseCell;
+
+    const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
+    ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
 public:
 
     ScXMLMapContext(
@@ -290,9 +302,7 @@ public:
             const uno::Reference< xml::sax::XAttributeList > & xAttrList );
     virtual ~ScXMLMapContext();
 
-    const rtl::OUString& GetApplyStyle() const { return sApplyStyle; }
-    const rtl::OUString& GetCondition() const { return sCondition; }
-    const rtl::OUString& GetBaseCell() const { return sBaseCell; }
+    ScCondFormatEntry* CreateConditionEntry();
 };
 
 ScXMLMapContext::ScXMLMapContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
@@ -311,134 +321,48 @@ ScXMLMapContext::ScXMLMapContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
         if( XML_NAMESPACE_STYLE == nPrefix )
         {
             if( IsXMLToken(aLocalName, XML_CONDITION ) )
-                sCondition = rValue;
+                msCondition = rValue;
             else if( IsXMLToken(aLocalName, XML_APPLY_STYLE_NAME ) )
-                sApplyStyle = GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TABLE_CELL, rValue);
+                msApplyStyle = GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TABLE_CELL, rValue);
             else if ( IsXMLToken(aLocalName, XML_BASE_CELL_ADDRESS ) )
-                sBaseCell = rValue;
+                msBaseCell = rValue;
         }
     }
 }
 
-ScXMLMapContext::~ScXMLMapContext()
-{
-}
-
-namespace {
-
-template< typename Type >
-inline void lclAppendProperty( uno::Sequence< beans::PropertyValue >& rProps, const OUString& rPropName, const Type& rValue )
-{
-    sal_Int32 nLength = rProps.getLength();
-    rProps.realloc( nLength + 1 );
-    rProps[ nLength ].Name = rPropName;
-    rProps[ nLength ].Value <<= rValue;
-}
-
-} // namespace
-
-void XMLTableStyleContext::SetOperator( uno::Sequence< beans::PropertyValue >& rProps, sheet::ConditionOperator eOp ) const
-{
-    lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_OPERATOR ) ), eOp );
-}
-
-void XMLTableStyleContext::SetBaseCellAddress( uno::Sequence< beans::PropertyValue >& rProps, const OUString& rBaseCell ) const
+ScCondFormatEntry* ScXMLMapContext::CreateConditionEntry()
 {
-    /*  Source position must be set as string, because it may refer
-        to a sheet that hasn't been loaded yet. */
-    lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SOURCESTR ) ), rBaseCell );
-}
+    OUString aCondition, aConditionNmsp;
+    FormulaGrammar::Grammar eGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
+    GetScImport().ExtractFormulaNamespaceGrammar( aCondition, aConditionNmsp, eGrammar, msCondition );
+    bool bHasNmsp = aCondition.getLength() < msCondition.getLength();
 
-void XMLTableStyleContext::SetStyle( uno::Sequence<beans::PropertyValue>& rProps, const OUString& rApplyStyle ) const
-{
-    lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_STYLENAME ) ), rApplyStyle );
-}
+    // parse a condition from the attribute string
+    ScXMLConditionParseResult aParseResult;
+    ScXMLConditionHelper::parseCondition( aParseResult, aCondition, 0 );
 
-void XMLTableStyleContext::SetFormula( uno::Sequence< beans::PropertyValue >& rProps,
-        sal_Int32 nFormulaIdx, const OUString& rFormula, const OUString& rFormulaNmsp,
-        FormulaGrammar::Grammar eGrammar, bool bHasNmsp ) const
-{
-    OUString aFormula, aFormulaNmsp;
-    FormulaGrammar::Grammar eNewGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
-    if( bHasNmsp )
-    {
-        // the entire attribute contains a namespace: internal namespace not allowed
-        aFormula = rFormula;
-        aFormulaNmsp = rFormulaNmsp;
-        eNewGrammar = eGrammar;
-    }
-    else
+    if( !bHasNmsp )
     {
         // the attribute does not contain a namespace: try to find a namespace of an external grammar
-        GetScImport().ExtractFormulaNamespaceGrammar( aFormula, aFormulaNmsp, eNewGrammar, rFormula, true );
+        FormulaGrammar::Grammar eNewGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
+        GetScImport().ExtractFormulaNamespaceGrammar( aCondition, aConditionNmsp, eNewGrammar, aCondition, true );
         if( eNewGrammar != FormulaGrammar::GRAM_EXTERNAL )
-            eNewGrammar = eGrammar;
+            eGrammar = eNewGrammar;
     }
 
-    // add formula, formula namespace, and grammar with appropriate property names
-    sal_Int32 nGrammar = static_cast< sal_Int32 >( eNewGrammar );
-    switch( nFormulaIdx )
-    {
-        case 1:
-            lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULA1 ) ), aFormula );
-            lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULANMSP1 ) ), aFormulaNmsp );
-            lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_GRAMMAR1 ) ), nGrammar );
-        break;
-        case 2:
-            lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULA2 ) ), aFormula );
-            lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_FORMULANMSP2 ) ), aFormulaNmsp );
-            lclAppendProperty( rProps, OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_GRAMMAR2 ) ), nGrammar );
-        break;
-        default:
-            OSL_FAIL( "XMLTableStyleContext::SetFormula - invalid formula index" );
-    }
+    ScConditionMode eMode = ScConditionEntry::GetModeFromApi(aParseResult.meOperator);
+    rtl::OUString aExpr1, aExpr2, aNmsp1, aNmsp2;
+    ScDocument* pDoc = GetScImport().GetDocument();
+
+    ScCondFormatEntry* pEntry =  new ScCondFormatEntry(eMode, aParseResult.maOperand1, aParseResult.maOperand2, pDoc, ScAddress(), msApplyStyle,
+                                                    aNmsp1, aNmsp2, eGrammar, eGrammar);
+
+    pEntry->SetSrcString(msBaseCell);
+    return pEntry;
 }
 
-void XMLTableStyleContext::GetConditionalFormat(uno::Any& aAny,
-        const rtl::OUString& sTempCondition,
-        const rtl::OUString& sApplyStyle, const rtl::OUString& sBaseCell) const
+ScXMLMapContext::~ScXMLMapContext()
 {
-    if (!sTempCondition.isEmpty() && !sApplyStyle.isEmpty())
-    {
-        uno::Reference<sheet::XSheetConditionalEntries> xConditionalEntries(aAny, uno::UNO_QUERY);
-        if (xConditionalEntries.is())
-        {
-            uno::Sequence<beans::PropertyValue> aProps;
-            if (!sBaseCell.isEmpty())
-                SetBaseCellAddress(aProps, sBaseCell);
-            SetStyle(aProps, sApplyStyle);
-
-            // extract leading namespace from condition string
-            OUString aCondition, aConditionNmsp;
-            FormulaGrammar::Grammar eGrammar = FormulaGrammar::GRAM_UNSPECIFIED;
-            GetScImport().ExtractFormulaNamespaceGrammar( aCondition, aConditionNmsp, eGrammar, sTempCondition );
-            bool bHasNmsp = aCondition.getLength() < sTempCondition.getLength();
-
-            // parse a condition from the attribute string
-            ScXMLConditionParseResult aParseResult;
-            ScXMLConditionHelper::parseCondition( aParseResult, aCondition, 0 );
-
-            /*  Check the result. A valid value in aParseResult.meToken implies
-                that the other members of aParseResult are filled with valid
-                data for that token. */
-            switch( aParseResult.meToken )
-            {
-                case XML_COND_CELLCONTENT:      // condition is 'cell-content()<operator><expression>'
-                case XML_COND_ISTRUEFORMULA:    // condition is 'is-true-formula(<expression>)'
-                case XML_COND_ISBETWEEN:        // condition is 'cell-content-is-between(<expression1>,<expression2>)'
-                case XML_COND_ISNOTBETWEEN:     // condition is 'cell-content-is-not-between(<expression1>,<expression2>)'
-                    SetOperator( aProps, aParseResult.meOperator );
-                    SetFormula( aProps, 1, aParseResult.maOperand1, aConditionNmsp, eGrammar, bHasNmsp );
-                    SetFormula( aProps, 2, aParseResult.maOperand2, aConditionNmsp, eGrammar, bHasNmsp );
-                break;
-
-                default:;   // unacceptable or unknown condition
-            }
-
-            xConditionalEntries->addNew( aProps );
-            aAny <<= xConditionalEntries;
-        }
-    }
 }
 
 void XMLTableStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
@@ -454,13 +378,6 @@ void XMLTableStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
         XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
 }
 
-struct ScXMLMapContent
-{
-    rtl::OUString sCondition;
-    rtl::OUString sApplyStyle;
-    rtl::OUString sBaseCell;
-};
-
 TYPEINIT1( XMLTableStyleContext, XMLPropStyleContext );
 
 XMLTableStyleContext::XMLTableStyleContext( ScXMLImport& rImport,
@@ -469,12 +386,11 @@ XMLTableStyleContext::XMLTableStyleContext( ScXMLImport& rImport,
         SvXMLStylesContext& rStyles, sal_uInt16 nFamily, bool bDefaultStyle ) :
     XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle ),
     sDataStyleName(),
-    sNumberFormat(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberFormat"))),
     pStyles(&rStyles),
     nNumberFormat(-1),
     nLastSheet(-1),
-    bConditionalFormatCreated(false),
-    bParentSet(false)
+    bParentSet(false),
+    mpCondFormat(NULL)
 {
 }
 
@@ -492,13 +408,11 @@ SvXMLImportContext *XMLTableStyleContext::CreateChildContext(
     if( (XML_NAMESPACE_STYLE == nPrefix) &&
         IsXMLToken(rLocalName, XML_MAP ) )
     {
-        pContext = new ScXMLMapContext(GetImport(), nPrefix, rLocalName, xAttrList);
-
-        ScXMLMapContent aMap;
-        aMap.sCondition = ((ScXMLMapContext*)pContext)->GetCondition();
-        aMap.sApplyStyle = ((ScXMLMapContext*)pContext)->GetApplyStyle();
-        aMap.sBaseCell = ((ScXMLMapContext*)pContext)->GetBaseCell();
-        aMaps.push_back(aMap);
+        if(!mpCondFormat)
+            mpCondFormat = new ScConditionalFormat( 0, GetScImport().GetDocument() );
+        ScXMLMapContext* pMapContext = new ScXMLMapContext(GetImport(), nPrefix, rLocalName, xAttrList);
+        pContext = pContext;
+        mpCondFormat->AddEntry(pMapContext->CreateConditionEntry());
     }
     if (!pContext)
         pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
@@ -506,6 +420,68 @@ SvXMLImportContext *XMLTableStyleContext::CreateChildContext(
     return pContext;
 }
 
+void XMLTableStyleContext::ApplyCondFormat( uno::Sequence<table::CellRangeAddress> xCellRanges )
+{
+    if(!mpCondFormat)
+        return;
+
+    ScRangeList rRange;
+    sal_Int32 nRanges = xCellRanges.getLength();
+    for(sal_Int32 i = 0; i < nRanges; ++i)
+    {
+        table::CellRangeAddress aAddress = xCellRanges[i];
+        ScRange aRange( aAddress.StartColumn, aAddress.StartRow, aAddress.Sheet, aAddress.EndColumn, aAddress.EndRow, aAddress.Sheet );
+        rRange.Join( aRange, false );
+    }
+
+    ScDocument* pDoc = GetScImport().GetDocument();
+    SCTAB nTab = GetScImport().GetTables().GetCurrentSheet();
+    ScConditionalFormatList* pFormatList = pDoc->GetCondFormList(nTab);
+    for(ScConditionalFormatList::iterator itr = pFormatList->begin(), itrEnd = pFormatList->end();
+                    itr != itrEnd; ++itr)
+    {
+        if(itr->EqualEntries(*mpCondFormat))
+        {
+            // we don't need the new cond format entry now
+            // the found one is the same and we just need to add the range to it
+            delete mpCondFormat;
+            mpCondFormat = NULL;
+
+            ScRangeList& rRangeList = itr->GetRangeList();
+            sal_uInt32 nCondId = itr->GetKey();
+            size_t n = rRange.size();
+            for(size_t i = 0; i < n; ++i)
+            {
+                const ScRange* pRange = rRange[i];
+                rRangeList.Join(*pRange);
+            }
+
+            ScPatternAttr aPattern( pDoc->GetPool() );
+            aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nCondId ) );
+            ScMarkData aMarkData;
+            aMarkData.MarkFromRangeList(rRange, true);
+            pDoc->ApplySelectionPattern( aPattern , aMarkData);
+
+            break;
+        }
+    }
+
+    if(mpCondFormat)
+    {
+        sal_uLong nIndex = pDoc->AddCondFormat(mpCondFormat, nTab );
+        mpCondFormat->SetKey(nIndex);
+        mpCondFormat->AddRange(rRange);
+
+        ScPatternAttr aPattern( pDoc->GetPool() );
+        aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nIndex ) );
+        ScMarkData aMarkData;
+        aMarkData.MarkFromRangeList(rRange, true);
+        pDoc->ApplySelectionPattern( aPattern , aMarkData);
+    }
+
+
+}
+
 void XMLTableStyleContext::FillPropertySet(
     const uno::Reference< XPropertySet > & rPropSet )
 {
@@ -521,21 +497,6 @@ void XMLTableStyleContext::FillPropertySet(
             sal_Int32 nNumFmt = GetNumberFormat();
             if (nNumFmt >= 0)
                 AddProperty(CTF_SC_NUMBERFORMAT, uno::makeAny(nNumFmt));
-            if (!GetScImport().HasNewCondFormatData() && !bConditionalFormatCreated && (!aMaps.empty()))
-            {
-                aConditionalFormat = rPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CONDXML)));
-                std::vector<ScXMLMapContent>::iterator aItr(aMaps.begin());
-                std::vector<ScXMLMapContent>::iterator aEndItr(aMaps.end());
-                while(aItr != aEndItr)
-                {
-                    //rPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CONDITIONALFORMAT)),
-                    GetConditionalFormat(aConditionalFormat, aItr->sCondition, aItr->sApplyStyle, aItr->sBaseCell);
-
-                    ++aItr;
-                }
-                AddProperty(CTF_SC_IMPORT_MAP, aConditionalFormat);
-                bConditionalFormatCreated = true;
-            }
         }
         else if (GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE)
         {
diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx
index d6f57df..edc5794 100644
--- a/sc/source/filter/xml/xmlstyli.hxx
+++ b/sc/source/filter/xml/xmlstyli.hxx
@@ -42,6 +42,8 @@
 #include <com/sun/star/sheet/ConditionOperator.hpp>
 #include "xmlimprt.hxx"
 
+class ScConditionalFormat;
+
 class ScXMLCellImportPropertyMapper : public SvXMLImportPropertyMapper
 {
 protected:
@@ -89,44 +91,20 @@ public:
     virtual void finished(
             ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const;
 };
-struct ScXMLMapContent;
 
 class XMLTableStyleContext : public XMLPropStyleContext
 {
     ::rtl::OUString             sDataStyleName;
     rtl::OUString               sPageStyle;
-    const rtl::OUString         sNumberFormat;
     SvXMLStylesContext*         pStyles;
-    std::vector<ScXMLMapContent>    aMaps;
-    com::sun::star::uno::Any    aConditionalFormat;
     sal_Int32                   nNumberFormat;
     SCTAB                       nLastSheet;
-    bool                        bConditionalFormatCreated;
     bool                        bParentSet;
+    ScConditionalFormat*        mpCondFormat;
 
     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
 
-    void SetOperator(
-            ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps,
-            ::com::sun::star::sheet::ConditionOperator eOp ) const;
-
-    void SetBaseCellAddress(
-            ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps,
-            const ::rtl::OUString& rBaseCell ) const;
-
-    void SetStyle(
-            ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps,
-            const ::rtl::OUString& rApplyStyle ) const;
-
-    void SetFormula(
-        ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps,
-        sal_Int32 nFormulaIdx, const ::rtl::OUString& rFormula,
-        const ::rtl::OUString& rFormulaNmsp, ::formula::FormulaGrammar::Grammar eGrammar, bool bHasNmsp ) const;
-
-    void GetConditionalFormat(
-        ::com::sun::star::uno::Any& aAny, const rtl::OUString& sCondition,
-        const rtl::OUString& sApplyStyle, const rtl::OUString& sBaseCell) const;
 protected:
 
     virtual void SetAttribute( sal_uInt16 nPrefixKey,
@@ -161,8 +139,12 @@ public:
     SCTAB GetLastSheet() const       { return nLastSheet; }
     void SetLastSheet(SCTAB nNew)    { nLastSheet = nNew; }
 
+    void ApplyCondFormat( com::sun::star::uno::Sequence<com::sun::star::table::CellRangeAddress> xCellRanges );
+
 private:
     using XMLPropStyleContext::SetStyle;
+
+    ScConditionalFormat* CreateCondFormat();
 };
 
 class XMLTableStylesContext : public SvXMLStylesContext


More information about the Libreoffice-commits mailing list