sc/inc/colorscale.hxx | 8 +++ sc/inc/conditio.hxx | 14 +++++ sc/qa/unit/subsequent_filters-test.cxx | 1 sc/source/core/data/colorscale.cxx | 50 ++++++++++++++++++++ sc/source/core/data/conditio.cxx | 11 ++++ sc/source/filter/excel/xecontent.cxx | 81 ++++++++++++++++++++++++--------- sc/source/filter/inc/xecontent.hxx | 40 +++++++++------- sc/source/filter/inc/xerecord.hxx | 2 8 files changed, 167 insertions(+), 40 deletions(-)
New commits: commit 8a26dd3ccec190b9149b9bc64bc08fe503927c1d Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Tue Aug 14 01:19:00 2012 +0200 remove two obviously wrong comments Change-Id: I8b5929b2ae022c40397f70abf863e3aae63d1d54 diff --git a/sc/source/filter/inc/xerecord.hxx b/sc/source/filter/inc/xerecord.hxx index 4bfa6db..db04749 100644 --- a/sc/source/filter/inc/xerecord.hxx +++ b/sc/source/filter/inc/xerecord.hxx @@ -336,9 +336,7 @@ class XclExpRecordList : public XclExpRecordBase public: typedef boost::shared_ptr< RecType > RecordRefType; - /** Returns pointer to an existing record or 0 on error. */ inline bool IsEmpty() const { return maRecs.empty(); } - /** Returns pointer to an existing record or 0 on error. */ inline size_t GetSize() const { return maRecs.size(); } /** Returns true, if the passed index points to an exiting record. */ commit 533a8a9efe99391b1258ea7d1481f2d07d3ae14c Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Tue Aug 14 01:14:45 2012 +0200 remove some auto_ptr from xecontent Change-Id: Idef77ba4ce419aec26476ed027ac1a3c3fc41eef diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index d7461cf..fbbfe75 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -677,9 +677,7 @@ XclExpCFImpl::XclExpCFImpl( const XclExpRoot& rRoot, const ScCondFormatEntry& rF XclExpFormulaCompiler& rFmlaComp = GetFormulaCompiler(); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr< ScTokenArray > xScTokArr( mrFormatEntry.CreateTokenArry( 0 ) ); - SAL_WNODEPRECATED_DECLARATIONS_POP + boost::scoped_ptr< ScTokenArray > xScTokArr( mrFormatEntry.CreateTokenArry( 0 ) ); mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_CONDFMT, *xScTokArr ); if( bFmla2 ) @@ -1284,9 +1282,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : // formulas XclExpFormulaCompiler& rFmlaComp = GetFormulaCompiler(); - SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr< ScTokenArray > xScTokArr; - SAL_WNODEPRECATED_DECLARATIONS_POP + boost::scoped_ptr< ScTokenArray > xScTokArr; // first formula xScTokArr.reset( pValData->CreateTokenArry( 0 ) ); diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx index 498bd10..953a347 100644 --- a/sc/source/filter/inc/xecontent.hxx +++ b/sc/source/filter/inc/xecontent.hxx @@ -72,9 +72,7 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ); private: - SAL_WNODEPRECATED_DECLARATIONS_PUSH - typedef ::std::auto_ptr< XclExpSstImpl > XclExpSstImplPtr; - SAL_WNODEPRECATED_DECLARATIONS_POP + typedef boost::scoped_ptr< XclExpSstImpl > XclExpSstImplPtr; XclExpSstImplPtr mxImpl; }; @@ -131,10 +129,8 @@ private: virtual void WriteBody( XclExpStream& rStrm ); private: - SAL_WNODEPRECATED_DECLARATIONS_PUSH - typedef ::std::auto_ptr< String > StringPtr; - typedef ::std::auto_ptr< SvStream > SvStreamPtr; - SAL_WNODEPRECATED_DECLARATIONS_POP + typedef boost::scoped_ptr< String > StringPtr; + typedef boost::scoped_ptr< SvStream > SvStreamPtr; ScAddress maScPos; /// Position of the hyperlink. StringPtr mxRepr; /// Cell representation text. @@ -190,9 +186,7 @@ private: virtual void WriteBody( XclExpStream& rStrm ); private: - SAL_WNODEPRECATED_DECLARATIONS_PUSH - typedef ::std::auto_ptr< XclExpCFImpl > XclExpCFImplPtr; - SAL_WNODEPRECATED_DECLARATIONS_POP + typedef boost::scoped_ptr< XclExpCFImpl > XclExpCFImplPtr; XclExpCFImplPtr mxImpl; }; commit 1885266f274575327cdeee9852945a3e91f32f15 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Tue Aug 14 01:24:33 2012 +0200 implement dumper for new cond format test Change-Id: I2a7f0cf20fa54cbcafcb30d8b8834fd1adf3821d diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 8e79385..942f604 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -223,6 +223,10 @@ public: const_iterator end() const; size_t size() const; + +#if DUMP_FORMAT_INFO + virtual void dumpInfo() const; +#endif }; class SC_DLLPUBLIC ScDataBarFormat : public ScColorFormat @@ -243,6 +247,10 @@ public: const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); virtual condformat::ScFormatEntryType GetType() const; + +#if DUMP_FORMAT_INFO + virtual void dumpInfo() const; +#endif private: double getMin(double nMin, double nMax) const; double getMax(double nMin, double nMax) const; diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index d25a39f..4967e82 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -48,6 +48,8 @@ class ScTokenArray; // nOptions Flags #define SC_COND_NOBLANKS 1 +#define DUMP_FORMAT_INFO 1 + // ordering of ScConditionMode and ScQueryOp is equal, // to facilitate the merging of both in the future @@ -108,6 +110,10 @@ public: virtual ScFormatEntry* Clone( ScDocument* pDoc = NULL ) const = 0; virtual void SetParent( ScConditionalFormat* pNew ) = 0; + +#if DUMP_FORMAT_INFO + virtual void dumpInfo() const = 0; +#endif protected: ScDocument* mpDoc; @@ -204,6 +210,10 @@ public: static ScConditionMode GetModeFromApi(sal_Int32 nOperator); +#if DUMP_FORMAT_INFO + virtual void dumpInfo() const {} +#endif + protected: virtual void DataChanged( const ScRange* pModified ) const; ScDocument* GetDocument() const { return mpDoc; } @@ -303,6 +313,10 @@ public: bool MarkUsedExternalReferences() const; +#if DUMP_FORMAT_INFO + void dumpInfo() const; +#endif + // sorted (via PTRARR) by Index // operator== only for sorting bool operator ==( const ScConditionalFormat& r ) const { return nKey == r.nKey; } diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 32cfb76..8d6a804 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1264,6 +1264,7 @@ void ScFiltersTest::testColorScale() ScConditionalFormatList* pCondFormatList = pDoc->GetCondFormList(0); const ScConditionalFormat* pFormat = pCondFormatList->GetFormat(nIndex); CPPUNIT_ASSERT(pFormat); + pFormat->dumpInfo(); pPattern = pDoc->GetPattern(1,5,0); nIndex = static_cast<const SfxUInt32Item&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetValue(); diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index dda1b63..ae592f4 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -30,6 +30,9 @@ #include "document.hxx" #include "cell.hxx" #include "fillinfo.hxx" +#if DUMP_FORMAT_INFO +#include <iostream> +#endif ScColorScaleEntry::ScColorScaleEntry(): mnVal(0), @@ -487,6 +490,30 @@ Color* ScColorScaleFormat::GetColor( const ScAddress& rAddr ) const return new Color(aColor); } +#if DUMP_FORMAT_INFO +void ScColorScaleFormat::dumpInfo() const +{ + std::cout << "Color Scale" << std::endl; + const ScRangeList& rRange = GetRange(); + size_t n = rRange.size(); + for(size_t i = 0; i < n; ++i) + { + const ScRange* pRange = rRange[i]; + SCTAB nTab = pRange->aStart.Tab(); + for( SCCOL nCol = pRange->aStart.Col(), nEndCol = pRange->aEnd.Col(); nCol <= nEndCol; ++nCol) + { + for( SCROW nRow = pRange->aStart.Row(), nEndRow = pRange->aEnd.Row(); nRow <= nEndRow; ++nRow) + { + boost::scoped_ptr<Color> pColor( GetColor(ScAddress(nCol, nRow, nTab)) ); + std::cout << nCol << "," << nRow << "," << nTab << ","; + std::cout << ((int)pColor->GetRed()) << "," << ((int)pColor->GetGreen()) << "," << ((int)pColor->GetBlue()); + std::cout << std::endl; + } + } + } +} +#endif + void ScColorScaleFormat::UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab) { SCTAB nThisTab = GetRange().front()->aStart.Tab(); @@ -826,4 +853,27 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const return pInfo; } +#if DUMP_FORMAT_INFO +void ScDataBarFormat::dumpInfo() const +{ + const ScRangeList& rRange = GetRange(); + size_t n = rRange.size(); + for(size_t i = 0; i < n; ++i) + { + const ScRange* pRange = rRange[i]; + SCTAB nTab = pRange->aStart.Tab(); + for( SCCOL nCol = pRange->aStart.Col(), nEndCol = pRange->aEnd.Col(); nCol <= nEndCol; ++nCol) + { + for( SCROW nRow = pRange->aStart.Row(), nEndRow = pRange->aEnd.Row(); nRow <= nEndRow; ++nRow) + { + boost::scoped_ptr<ScDataBarInfo> pInfo( GetDataBarInfo(ScAddress(nCol, nRow, nTab)) ); + std::cout << nCol << "," << nRow << "," << nTab << "," << pInfo->mnZero << ","; + std::cout << pInfo->mnLength << "," << pInfo->mbGradient << "," << pInfo->mbShowValue << std::endl; + std::cout << std::endl; + } + } + } +} +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 3d3611b..1438a78 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1425,6 +1425,17 @@ ScCondFormatData ScConditionalFormat::GetData( ScBaseCell* pCell, const ScAddres return aData; } + +#if DUMP_FORMAT_INFO +void ScConditionalFormat::dumpInfo() const +{ + for(CondFormatContainer::const_iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr) + { + itr->dumpInfo(); + } +} +#endif + void ScConditionalFormat::DoRepaint( const ScRange* pModified ) { if(pModified) commit 65457cbaf0acbfb1925c21f2d03ffec8e20e84bd Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Tue Aug 14 01:23:56 2012 +0200 implement color scale and data bar export to xlsx Only 2007 versions of DataBars supported yet Change-Id: Id1d10aae2bb5221246740defa3d4a97a1cd7c908 diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 0c28a59..d7461cf 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -908,6 +908,12 @@ rtl::OString getColorScaleType( const ScColorScaleEntry& rEntry ) return "percent"; case COLORSCALE_FORMULA: return "formula"; + case COLORSCALE_AUTOMIN: + return "min"; + case COLORSCALE_AUTOMAX: + return "max"; + case COLORSCALE_PERCENTILE: + return "percentile"; default: break; } @@ -940,10 +946,10 @@ void XclExpCfvo::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->endElement( XML_cfvo ); } -XclExpColScaleCol::XclExpColScaleCol( const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry ): +XclExpColScaleCol::XclExpColScaleCol( const XclExpRoot& rRoot, const Color& rColor ): XclExpRecord(), XclExpRoot( rRoot ), - mrEntry( rEntry ) + mrColor( rColor ) { } @@ -956,11 +962,12 @@ void XclExpColScaleCol::SaveXml( XclExpXmlStream& rStrm ) sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); rWorksheet->startElement( XML_color, - XML_rgb, XclXmlUtils::ToOString( mrEntry.GetColor() ).getStr(), + XML_rgb, XclXmlUtils::ToOString( mrColor ).getStr(), FSEND ); rWorksheet->endElement( XML_color ); } + // ---------------------------------------------------------------------------- XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat& rCondFormat ) : @@ -977,6 +984,10 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat { if(pFormatEntry->GetType() == condformat::CONDITION) maCFList.AppendNewRecord( new XclExpCF( GetRoot(), static_cast<const ScCondFormatEntry&>(*pFormatEntry), nIndex ) ); + else if(pFormatEntry->GetType() == condformat::COLORSCALE) + maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), nIndex ) ); + else if(pFormatEntry->GetType() == condformat::DATABAR) + maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), static_cast<const ScDataBarFormat&>(*pFormatEntry), nIndex ) ); } aScRanges.Format( msSeqRef, SCA_VALID, NULL, formula::FormulaGrammar::CONV_XL_A1 ); } @@ -1030,10 +1041,11 @@ void XclExpCondfmt::SaveXml( XclExpXmlStream& rStrm ) // ---------------------------------------------------------------------------- -XclExpColorScale::XclExpColorScale( const XclExpRoot& rRoot, const ScColorScaleFormat& rFormat ): +XclExpColorScale::XclExpColorScale( const XclExpRoot& rRoot, const ScColorScaleFormat& rFormat, sal_Int32 nPriority ): XclExpRecord(), XclExpRoot( rRoot ), - mrFormat( rFormat ) + mrFormat( rFormat ), + mnPriority( nPriority ) { const ScRange* pRange = rFormat.GetRange().front(); ScAddress aAddr = pRange->aStart; @@ -1044,23 +1056,18 @@ XclExpColorScale::XclExpColorScale( const XclExpRoot& rRoot, const ScColorScaleF XclExpCfvoList::RecordRefType xCfvo( new XclExpCfvo( GetRoot(), *itr, aAddr ) ); maCfvoList.AppendRecord( xCfvo ); - XclExpColScaleColList::RecordRefType xClo( new XclExpColScaleCol( GetRoot(), *itr ) ); + XclExpColScaleColList::RecordRefType xClo( new XclExpColScaleCol( GetRoot(), itr->GetColor() ) ); maColList.AppendRecord( xClo ); } } void XclExpColorScale::SaveXml( XclExpXmlStream& rStrm ) { - const ScRangeList& rRanges = mrFormat.GetRange(); - sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); - rWorksheet->startElement( XML_conditionalFormatting, - XML_sqref, XclXmlUtils::ToOString(rRanges).getStr(), - FSEND ); rWorksheet->startElement( XML_cfRule, XML_type, "colorScale", - XML_priority, "1", + XML_priority, OString::valueOf( mnPriority + 1 ).getStr(), FSEND ); rWorksheet->startElement( XML_colorScale, FSEND ); @@ -1073,7 +1080,44 @@ void XclExpColorScale::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->endElement( XML_cfRule ); // OOXTODO: XML_extLst - rWorksheet->endElement( XML_conditionalFormatting ); +} + +XclExpDataBar::XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, sal_Int32 nPriority ): + XclExpRecord(), + XclExpRoot( rRoot ), + mrFormat( rFormat ), + mnPriority( nPriority ) +{ + const ScRange* pRange = rFormat.GetRange().front(); + ScAddress aAddr = pRange->aStart; + // exact position is not important, we allow only absolute refs + mpCfvoLowerLimit.reset( new XclExpCfvo( GetRoot(), *mrFormat.GetDataBarData()->mpLowerLimit.get(), aAddr ) ); + mpCfvoUpperLimit.reset( new XclExpCfvo( GetRoot(), *mrFormat.GetDataBarData()->mpUpperLimit.get(), aAddr ) ); + + mpCol.reset( new XclExpColScaleCol( GetRoot(), mrFormat.GetDataBarData()->maPositiveColor ) ); +} + +void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm ) +{ + sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); + + rWorksheet->startElement( XML_cfRule, + XML_type, "dataBar", + XML_priority, OString::valueOf( mnPriority + 1 ).getStr(), + FSEND ); + + rWorksheet->startElement( XML_dataBar, FSEND ); + + mpCfvoLowerLimit->SaveXml(rStrm); + mpCfvoUpperLimit->SaveXml(rStrm); + mpCol->SaveXml(rStrm); + + rWorksheet->endElement( XML_dataBar ); + + rWorksheet->endElement( XML_cfRule ); + + // OOXTODO: XML_extLst + } // ---------------------------------------------------------------------------- @@ -1100,10 +1144,7 @@ void XclExpCondFormatBuffer::Save( XclExpStream& rStrm ) void XclExpCondFormatBuffer::SaveXml( XclExpXmlStream& rStrm ) { - maCondfmtList.SaveXml( rStrm ); - maColorScaleList.SaveXml( rStrm ); - } // Validation ================================================================= diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx index cf246e7..498bd10 100644 --- a/sc/source/filter/inc/xecontent.hxx +++ b/sc/source/filter/inc/xecontent.hxx @@ -211,12 +211,12 @@ private: class XclExpColScaleCol : public XclExpRecord, protected XclExpRoot { public: - explicit XclExpColScaleCol( const XclExpRoot& rRoot, const ScColorScaleEntry& rFormatEntry); + explicit XclExpColScaleCol( const XclExpRoot& rRoot, const Color& rColor); virtual ~XclExpColScaleCol(); virtual void SaveXml( XclExpXmlStream& rStrm ); private: - const ScColorScaleEntry& mrEntry; + const Color& mrColor; }; // ---------------------------------------------------------------------------- @@ -243,7 +243,7 @@ private: virtual void WriteBody( XclExpStream& rStrm ); private: - typedef XclExpRecordList< XclExpCF > XclExpCFList; + typedef XclExpRecordList< XclExpRecord > XclExpCFList; XclExpCFList maCFList; /// List of CF records. XclRangeList maXclRanges; /// Cell ranges for this conditional format. @@ -253,7 +253,7 @@ private: class XclExpColorScale: public XclExpRecord, protected XclExpRoot { public: - explicit XclExpColorScale( const XclExpRoot& rRoot, const ScColorScaleFormat& rFormat ); + explicit XclExpColorScale( const XclExpRoot& rRoot, const ScColorScaleFormat& rFormat, sal_Int32 nPriority ); virtual void SaveXml( XclExpXmlStream& rStrm ); private: @@ -263,6 +263,22 @@ private: XclExpCfvoList maCfvoList; XclExpColScaleColList maColList; const ScColorScaleFormat& mrFormat; + sal_Int32 mnPriority; +}; + +class XclExpDataBar : public XclExpRecord, protected XclExpRoot +{ +public: + explicit XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, sal_Int32 nPriority ); + + virtual void SaveXml( XclExpXmlStream& rStrm ); +private: + boost::scoped_ptr<XclExpCfvo> mpCfvoLowerLimit; + boost::scoped_ptr<XclExpCfvo> mpCfvoUpperLimit; + boost::scoped_ptr<XclExpColScaleCol> mpCol; + + const ScDataBarFormat& mrFormat; + sal_Int32 mnPriority; }; // ---------------------------------------------------------------------------- @@ -280,9 +296,7 @@ public: private: typedef XclExpRecordList< XclExpCondfmt > XclExpCondfmtList; - typedef XclExpRecordList< XclExpColorScale > XclExpColorScaleList; XclExpCondfmtList maCondfmtList; /// List of CONDFMT records. - XclExpColorScaleList maColorScaleList; // Color scale entries }; // Data Validation ============================================================ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits