[Libreoffice-commits] core.git: 9 commits - sc/inc sc/qa sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Fri May 15 22:27:30 PDT 2015
sc/inc/colorscale.hxx | 5
sc/qa/unit/data/xlsx/complex_icon_set.xlsx |binary
sc/qa/unit/subsequent_filters-test.cxx | 66 ++++++++++
sc/source/core/data/colorscale.cxx | 22 +++
sc/source/filter/excel/xecontent.cxx | 138 +++++++++++++++-------
sc/source/filter/excel/xeextlst.cxx | 177 +++++++++++++++++++++++++++--
sc/source/filter/inc/condformatbuffer.hxx | 33 ++++-
sc/source/filter/inc/xecontent.hxx | 4
sc/source/filter/inc/xeextlst.hxx | 44 ++++++-
sc/source/filter/oox/condformatbuffer.cxx | 88 ++++++++++++--
sc/source/filter/oox/extlstcontext.cxx | 55 ++-------
sc/source/ui/src/condformatdlg.src | 3
12 files changed, 511 insertions(+), 124 deletions(-)
New commits:
commit aa7471be23d1a361ec4130262f4c08a7b539d8e1
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 16 07:25:45 2015 +0200
add tests for custom iconSets
mainly import from OOXML and selection of correct icon
Change-Id: Id1e0800d887189ac37ae124e25add7b67ceb5305
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index dab0033..249c04c 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -51,6 +51,7 @@
#include "attrib.hxx"
#include "dpshttab.hxx"
#include "tabvwsh.hxx"
+#include "fillinfo.hxx"
#include <scopetools.hxx>
#include <columnspanset.hxx>
#include <tokenstringcontext.hxx>
@@ -2422,6 +2423,26 @@ void testComplexIconSetsXLSX_Impl(ScDocument& rDoc, SCCOL nCol, ScIconSetType eT
CPPUNIT_ASSERT_EQUAL(eType, pIconSet->GetIconSetData()->eIconSetType);
}
+void testCustomIconSetsXLSX_Impl(ScDocument& rDoc, SCCOL nCol, SCROW nRow, ScIconSetType eType, sal_Int32 nIndex)
+{
+ ScConditionalFormat* pFormat = rDoc.GetCondFormat(nCol, 1, 1);
+ CPPUNIT_ASSERT(pFormat);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), pFormat->size());
+ const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+ CPPUNIT_ASSERT(pEntry);
+ CPPUNIT_ASSERT_EQUAL(condformat::ICONSET, pEntry->GetType());
+ const ScIconSetFormat* pIconSet = static_cast<const ScIconSetFormat*>(pEntry);
+ ScIconSetInfo* pInfo = pIconSet->GetIconSetInfo(ScAddress(nCol, nRow, 1));
+ if (nIndex == -1)
+ CPPUNIT_ASSERT(!pInfo);
+ else
+ {
+ CPPUNIT_ASSERT(pInfo);
+ CPPUNIT_ASSERT_EQUAL(nIndex, pInfo->nIconIndex);
+ CPPUNIT_ASSERT_EQUAL(eType, pInfo->eIconSetType);
+ }
+}
+
}
void ScFiltersTest::testComplexIconSetsXLSX()
@@ -2435,6 +2456,17 @@ void ScFiltersTest::testComplexIconSetsXLSX()
testComplexIconSetsXLSX_Impl(rDoc, 1, IconSet_3Triangles);
testComplexIconSetsXLSX_Impl(rDoc, 3, IconSet_3Stars);
testComplexIconSetsXLSX_Impl(rDoc, 5, IconSet_5Boxes);
+
+ CPPUNIT_ASSERT_EQUAL(size_t(2), rDoc.GetCondFormList(1)->size());
+ testCustomIconSetsXLSX_Impl(rDoc, 1, 1, IconSet_3ArrowsGray, 0);
+ testCustomIconSetsXLSX_Impl(rDoc, 1, 2, IconSet_3ArrowsGray, -1);
+ testCustomIconSetsXLSX_Impl(rDoc, 1, 3, IconSet_3Arrows, 1);
+ testCustomIconSetsXLSX_Impl(rDoc, 1, 4, IconSet_3ArrowsGray, -1);
+ testCustomIconSetsXLSX_Impl(rDoc, 1, 5, IconSet_3Arrows, 2);
+
+ testCustomIconSetsXLSX_Impl(rDoc, 3, 1, IconSet_4RedToBlack, 3);
+ testCustomIconSetsXLSX_Impl(rDoc, 3, 2, IconSet_3TrafficLights1, 1);
+ testCustomIconSetsXLSX_Impl(rDoc, 3, 3, IconSet_3Arrows, 2);
}
void ScFiltersTest::testLiteralInFormulaXLS()
commit 883c81033fea0d9adb5c31b345908859b9f18db9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 16 07:02:02 2015 +0200
add test for new icon sets during XLSX import
Change-Id: I923aff04f8349aa25b49fd2eba6c29bfd579b4a7
diff --git a/sc/qa/unit/data/xlsx/complex_icon_set.xlsx b/sc/qa/unit/data/xlsx/complex_icon_set.xlsx
new file mode 100644
index 0000000..32f1e52
Binary files /dev/null and b/sc/qa/unit/data/xlsx/complex_icon_set.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 849ac9f..dab0033 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -136,6 +136,7 @@ public:
void testNewCondFormatXLSX();
void testCondFormatThemeColorXLSX();
void testCondFormatThemeColor2XLSX(); // negative bar color and axis color
+ void testComplexIconSetsXLSX();
void testLiteralInFormulaXLS();
@@ -244,6 +245,7 @@ public:
CPPUNIT_TEST(testNewCondFormatXLSX);
CPPUNIT_TEST(testCondFormatThemeColorXLSX);
CPPUNIT_TEST(testCondFormatThemeColor2XLSX);
+ CPPUNIT_TEST(testComplexIconSetsXLSX);
CPPUNIT_TEST(testLiteralInFormulaXLS);
CPPUNIT_TEST(testNumberFormatHTML);
@@ -2406,6 +2408,35 @@ void ScFiltersTest::testCondFormatThemeColor2XLSX()
CPPUNIT_ASSERT_EQUAL(Color(197, 90, 17), pDataBarFormatData->maAxisColor);
}
+namespace {
+
+void testComplexIconSetsXLSX_Impl(ScDocument& rDoc, SCCOL nCol, ScIconSetType eType)
+{
+ ScConditionalFormat* pFormat = rDoc.GetCondFormat(nCol, 1, 0);
+ CPPUNIT_ASSERT(pFormat);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), pFormat->size());
+ const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+ CPPUNIT_ASSERT(pEntry);
+ CPPUNIT_ASSERT_EQUAL(condformat::ICONSET, pEntry->GetType());
+ const ScIconSetFormat* pIconSet = static_cast<const ScIconSetFormat*>(pEntry);
+ CPPUNIT_ASSERT_EQUAL(eType, pIconSet->GetIconSetData()->eIconSetType);
+}
+
+}
+
+void ScFiltersTest::testComplexIconSetsXLSX()
+{
+ ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc( "complex_icon_set.", XLSX );
+
+ CPPUNIT_ASSERT_MESSAGE("Failed to load complex_icon_set.xlsx", xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT_EQUAL(size_t(3), rDoc.GetCondFormList(0)->size());
+ testComplexIconSetsXLSX_Impl(rDoc, 1, IconSet_3Triangles);
+ testComplexIconSetsXLSX_Impl(rDoc, 3, IconSet_3Stars);
+ testComplexIconSetsXLSX_Impl(rDoc, 5, IconSet_5Boxes);
+}
+
void ScFiltersTest::testLiteralInFormulaXLS()
{
ScDocShellRef xDocSh = loadDoc("shared-string/literal-in-formula.", XLS);
commit c02f3174f7e5e6ed32379d727d4a362420a01d56
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 16 06:56:26 2015 +0200
getCurrentSheetIndex should not be used anymore
getCurrentSheetIndex contains a race condition in the threaded OOXML
import
Change-Id: I0e26198d4053beb6484e835ea0d5530bec402c2b
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 67809e2..7371f99 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -83,7 +83,7 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
assert(rFormat.GetType() == condformat::ICONSET);
ScIconSetFormat& rIconSet = static_cast<ScIconSetFormat&>(rFormat);
ScDocument* pDoc = &getScDocument();
- SCTAB nTab = getCurrentSheetIndex();
+ SCTAB nTab = getSheetIndex();
ScAddress aPos(0, 0, nTab);
mpCurrentRule->SetData(&rIconSet, pDoc, aPos);
delete mpCurrentRule;
@@ -156,7 +156,7 @@ void ExtConditionalFormattingContext::onEndElement()
if (!bSuccess || aRange.empty())
break;
- SCTAB nTab = getCurrentSheetIndex();
+ SCTAB nTab = getSheetIndex();
for (size_t i = 0; i < aRange.size(); ++i)
{
aRange[i]->aStart.SetTab(nTab);
commit f8b94e51c672eaa55bceaee2ceca72d8399b434b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 16 06:30:51 2015 +0200
fix sheet into which we insert extLst cond formats
Change-Id: Idbf9772bbb2c034a6c016492ab31b87e248f7b47
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index b54930e..927513c 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1144,10 +1144,10 @@ void CondFormatBuffer::finalizeImport()
for (auto itr = maExtCondFormats.begin(); itr != maExtCondFormats.end(); ++itr)
{
- SCTAB nTab = this->getCurrentSheetIndex();
ScDocument* pDoc = &getScDocument();
const ScRangeList& rRange = itr->getRange();
+ SCTAB nTab = rRange.front()->aStart.Tab();
ScConditionalFormat* pFormat = findFormatByRange(rRange, pDoc, nTab);
if (!pFormat)
{
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 92d7f03..67809e2 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -156,6 +156,13 @@ void ExtConditionalFormattingContext::onEndElement()
if (!bSuccess || aRange.empty())
break;
+ SCTAB nTab = getCurrentSheetIndex();
+ for (size_t i = 0; i < aRange.size(); ++i)
+ {
+ aRange[i]->aStart.SetTab(nTab);
+ aRange[i]->aEnd.SetTab(nTab);
+ }
+
boost::ptr_vector<ExtCfCondFormat>& rExtFormats = getCondFormats().importExtCondFormat();
rExtFormats.push_back(new ExtCfCondFormat(aRange, maEntries));
}
commit e9a206c8d7533ba8ccf8ad5f4e3e76557850459e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 16 06:30:18 2015 +0200
improve asserts to catch more errors
Change-Id: I9cd3c093af8f9f71c133ad89c45f2f9d46d64c01
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 1ec7460..849ac9f 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2367,7 +2367,10 @@ void ScFiltersTest::testCondFormatThemeColorXLSX()
CPPUNIT_ASSERT(pDataBarFormatData->mpNegativeColor.get());
CPPUNIT_ASSERT_EQUAL(Color(COL_LIGHTRED), *pDataBarFormatData->mpNegativeColor.get());
+ CPPUNIT_ASSERT_EQUAL(size_t(1), rDoc.GetCondFormList(1)->size());
pFormat = rDoc.GetCondFormat(0, 0, 1);
+ CPPUNIT_ASSERT(pFormat);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), pFormat->size());
pEntry = pFormat->GetEntry(0);
CPPUNIT_ASSERT(pEntry);
CPPUNIT_ASSERT_EQUAL(pEntry->GetType(), condformat::COLORSCALE);
commit 087932a9a41098a127e4a9668a77072b49f19909
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 16 05:02:29 2015 +0200
fix import for extlst entries
Change-Id: I49e95149f8a705905c0a56f2bc29aa02cfbb7a91
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index b08b815..d1b22e6 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -23,13 +23,18 @@
#include "formulaparser.hxx"
#include "worksheethelper.hxx"
#include <tools/color.hxx>
+#include "rangelst.hxx"
+
#include <memory>
+#include <boost/ptr_container/ptr_vector.hpp>
+
class ScColorScaleFormat;
class ScDataBarFormat;
struct ScDataBarFormatData;
class ScConditionalFormat;
class ScIconSetFormat;
+class ScFormatEntry;
struct ScIconSetFormatData;
namespace oox {
@@ -261,6 +266,20 @@ public:
ExCfRuleModel& getModel() { return maModel; }
};
+class ExtCfCondFormat
+{
+public:
+ ExtCfCondFormat(const ScRangeList& aRange, boost::ptr_vector<ScFormatEntry>& rEntries);
+ ~ExtCfCondFormat();
+
+ const ScRangeList& getRange();
+ const boost::ptr_vector<ScFormatEntry>& getEntries();
+
+private:
+ boost::ptr_vector<ScFormatEntry> maEntries;
+ ScRangeList maRange;
+};
+
typedef std::shared_ptr< CondFormat > CondFormatRef;
typedef std::shared_ptr< ExtCfDataBarRule > ExtCfDataBarRuleRef;
@@ -274,6 +293,7 @@ public:
/** Imports settings from the CONDFORMATTING record. */
CondFormatRef importCondFormatting( SequenceInputStream& rStrm );
ExtCfDataBarRuleRef createExtCfDataBarRule(ScDataBarFormatData* pTarget);
+ boost::ptr_vector<ExtCfCondFormat>& importExtCondFormat();
/** Converts an OOXML condition operator token to the API constant. */
static sal_Int32 convertToApiOperator( sal_Int32 nToken );
@@ -287,6 +307,7 @@ private:
typedef RefVector< ExtCfDataBarRule > ExtCfDataBarRuleVec;
CondFormatVec maCondFormats; /// All conditional formatting in a sheet.
ExtCfDataBarRuleVec maCfRules; /// All external conditional formatting rules in a sheet.
+ boost::ptr_vector<ExtCfCondFormat> maExtCondFormats;
};
} // namespace xls
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 8a95d2d..b54930e 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1107,6 +1107,24 @@ CondFormatRef CondFormatBuffer::importConditionalFormatting( const AttributeList
return xCondFmt;
}
+namespace {
+
+ScConditionalFormat* findFormatByRange(const ScRangeList& rRange, ScDocument* pDoc, SCTAB nTab)
+{
+ ScConditionalFormatList* pList = pDoc->GetCondFormList(nTab);
+ for (auto itr = pList->begin(); itr != pList->end(); ++itr)
+ {
+ if (itr->GetRange() == rRange)
+ {
+ return &(*itr);
+ }
+ }
+
+ return NULL;
+}
+
+}
+
void CondFormatBuffer::finalizeImport()
{
CondFormatVec::iterator it = maCondFormats.begin();
@@ -1123,6 +1141,29 @@ void CondFormatBuffer::finalizeImport()
if ( (*ext_it).get() )
(*ext_it).get()->finalizeImport();
}
+
+ for (auto itr = maExtCondFormats.begin(); itr != maExtCondFormats.end(); ++itr)
+ {
+ SCTAB nTab = this->getCurrentSheetIndex();
+ ScDocument* pDoc = &getScDocument();
+
+ const ScRangeList& rRange = itr->getRange();
+ ScConditionalFormat* pFormat = findFormatByRange(rRange, pDoc, nTab);
+ if (!pFormat)
+ {
+ // create new conditional format and insert it
+ pFormat = new ScConditionalFormat(0, pDoc);
+ pFormat->SetRange(rRange);
+ sal_uLong nKey = pDoc->AddCondFormat(pFormat, nTab);
+ pDoc->AddCondFormatData(rRange, nTab, nKey);
+ }
+
+ const boost::ptr_vector<ScFormatEntry>& rEntries = itr->getEntries();
+ for (auto i = rEntries.begin(); i != rEntries.end(); ++i)
+ {
+ pFormat->AddEntry(i->Clone(pDoc));
+ }
+ }
}
CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm )
@@ -1139,6 +1180,11 @@ ExtCfDataBarRuleRef CondFormatBuffer::createExtCfDataBarRule(ScDataBarFormatData
return extRule;
}
+boost::ptr_vector<ExtCfCondFormat>& CondFormatBuffer::importExtCondFormat()
+{
+ return maExtCondFormats;
+}
+
sal_Int32 CondFormatBuffer::convertToApiOperator( sal_Int32 nToken )
{
switch( nToken )
@@ -1281,6 +1327,26 @@ void ExtCfDataBarRule::importCfvo( const AttributeList& rAttribs )
maModel.maColorScaleType = rAttribs.getString( XML_type, OUString() );
}
+ExtCfCondFormat::ExtCfCondFormat(const ScRangeList& rRange, boost::ptr_vector<ScFormatEntry>& rEntries):
+ maRange(rRange)
+{
+ maEntries.transfer(maEntries.begin(), rEntries.begin(), rEntries.end(), rEntries);
+}
+
+ExtCfCondFormat::~ExtCfCondFormat()
+{
+}
+
+const ScRangeList& ExtCfCondFormat::getRange()
+{
+ return maRange;
+}
+
+const boost::ptr_vector<ScFormatEntry>& ExtCfCondFormat::getEntries()
+{
+ return maEntries;
+}
+
} // namespace xls
} // namespace oox
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 2be338d..92d7f03 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -128,24 +128,6 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
return NULL;
}
-namespace {
-
-ScConditionalFormat* findFormatByRange(const ScRangeList& rRange, ScDocument* pDoc, SCTAB nTab)
-{
- ScConditionalFormatList* pList = pDoc->GetCondFormList(nTab);
- for (auto itr = pList->begin(); itr != pList->end(); ++itr)
- {
- if (itr->GetRange() == rRange)
- {
- return &(*itr);
- }
- }
-
- return NULL;
-}
-
-}
-
void ExtConditionalFormattingContext::onStartElement(const AttributeList& /*rAttribs*/)
{
switch (getCurrentElement())
@@ -168,32 +150,14 @@ void ExtConditionalFormattingContext::onEndElement()
{
case XM_TOKEN(sqref):
{
- if (maEntries.empty())
- break;
-
- ScDocument* pDoc = &getScDocument();
- assert(pDoc);
- SCTAB nTab = getCurrentSheetIndex();
ScRangeList aRange;
+ ScDocument* pDoc = &getScDocument();
bool bSuccess = ScRangeStringConverter::GetRangeListFromString(aRange, aChars, pDoc, formula::FormulaGrammar::CONV_XL_OOX);
- if (!bSuccess)
+ if (!bSuccess || aRange.empty())
break;
- ScConditionalFormat* pFormat = findFormatByRange(aRange, pDoc, nTab);
- if (!pFormat)
- {
- // create new conditional format and insert it
- pFormat = new ScConditionalFormat(1, pDoc);
- pFormat->SetRange(aRange);
- sal_uLong nKey = pDoc->AddCondFormat(pFormat, nTab);
- pDoc->AddCondFormatData(aRange, nTab, nKey);
- }
-
- for (auto itr = maEntries.begin(), itrEnd = maEntries.end();
- itr != itrEnd; ++itr)
- {
- pFormat->AddEntry(itr->Clone(pDoc));
- }
+ boost::ptr_vector<ExtCfCondFormat>& rExtFormats = getCondFormats().importExtCondFormat();
+ rExtFormats.push_back(new ExtCfCondFormat(aRange, maEntries));
}
break;
case XLS14_TOKEN(cfRule):
commit fe59e8efbc82c98f7676f78d2be5fb601f281dc0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 16 01:02:17 2015 +0200
rename class
Change-Id: I09ad268ff848d684022dbb696501afe8332f3771
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index 5b41742..b08b815 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -237,7 +237,7 @@ struct ExCfRuleModel
OUString maColorScaleType;
};
-class ExtCfRule : public WorksheetHelper
+class ExtCfDataBarRule : public WorksheetHelper
{
enum RuleType
{
@@ -252,7 +252,7 @@ class ExtCfRule : public WorksheetHelper
ScDataBarFormatData* mpTarget;
public:
- ExtCfRule(ScDataBarFormatData* pTarget, WorksheetHelper& rParent);
+ ExtCfDataBarRule(ScDataBarFormatData* pTarget, WorksheetHelper& rParent);
void finalizeImport();
void importDataBar( const AttributeList& rAttribs );
void importNegativeFillColor( const AttributeList& rAttribs );
@@ -262,7 +262,7 @@ public:
};
typedef std::shared_ptr< CondFormat > CondFormatRef;
-typedef std::shared_ptr< ExtCfRule > ExtCfRuleRef;
+typedef std::shared_ptr< ExtCfDataBarRule > ExtCfDataBarRuleRef;
class CondFormatBuffer : public WorksheetHelper
{
@@ -273,7 +273,7 @@ public:
CondFormatRef importConditionalFormatting( const AttributeList& rAttribs );
/** Imports settings from the CONDFORMATTING record. */
CondFormatRef importCondFormatting( SequenceInputStream& rStrm );
- ExtCfRuleRef createExtCfRule(ScDataBarFormatData* pTarget);
+ ExtCfDataBarRuleRef createExtCfDataBarRule(ScDataBarFormatData* pTarget);
/** Converts an OOXML condition operator token to the API constant. */
static sal_Int32 convertToApiOperator( sal_Int32 nToken );
@@ -284,9 +284,9 @@ private:
private:
typedef RefVector< CondFormat > CondFormatVec;
- typedef RefVector< ExtCfRule > ExtCfRuleVec;
+ typedef RefVector< ExtCfDataBarRule > ExtCfDataBarRuleVec;
CondFormatVec maCondFormats; /// All conditional formatting in a sheet.
- ExtCfRuleVec maCfRules; /// All external conditional formatting rules in a sheet.
+ ExtCfDataBarRuleVec maCfRules; /// All external conditional formatting rules in a sheet.
};
} // namespace xls
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 2917e08..8a95d2d 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1116,8 +1116,8 @@ void CondFormatBuffer::finalizeImport()
if ( (*it).get() )
(*it).get()->finalizeImport();
}
- ExtCfRuleVec::iterator ext_it = maCfRules.begin();
- ExtCfRuleVec::iterator ext_end = maCfRules.end();
+ ExtCfDataBarRuleVec::iterator ext_it = maCfRules.begin();
+ ExtCfDataBarRuleVec::iterator ext_end = maCfRules.end();
for ( ; ext_it != ext_end; ++ext_it )
{
if ( (*ext_it).get() )
@@ -1132,9 +1132,9 @@ CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm
return xCondFmt;
}
-ExtCfRuleRef CondFormatBuffer::createExtCfRule(ScDataBarFormatData* pTarget)
+ExtCfDataBarRuleRef CondFormatBuffer::createExtCfDataBarRule(ScDataBarFormatData* pTarget)
{
- ExtCfRuleRef extRule( new ExtCfRule( pTarget, *this ) );
+ ExtCfDataBarRuleRef extRule( new ExtCfDataBarRule( pTarget, *this ) );
maCfRules.push_back( extRule );
return extRule;
}
@@ -1183,14 +1183,14 @@ CondFormatRef CondFormatBuffer::createCondFormat()
return xCondFmt;
}
-ExtCfRule::ExtCfRule(ScDataBarFormatData* pTarget, WorksheetHelper& rParent):
+ExtCfDataBarRule::ExtCfDataBarRule(ScDataBarFormatData* pTarget, WorksheetHelper& rParent):
WorksheetHelper(rParent),
- mnRuleType( ExtCfRule::UNKNOWN ),
+ mnRuleType( ExtCfDataBarRule::UNKNOWN ),
mpTarget(pTarget)
{
}
-void ExtCfRule::finalizeImport()
+void ExtCfDataBarRule::finalizeImport()
{
switch ( mnRuleType )
{
@@ -1250,14 +1250,14 @@ void ExtCfRule::finalizeImport()
}
}
-void ExtCfRule::importDataBar( const AttributeList& rAttribs )
+void ExtCfDataBarRule::importDataBar( const AttributeList& rAttribs )
{
mnRuleType = DATABAR;
maModel.mbGradient = rAttribs.getBool( XML_gradient, true );
maModel.maAxisPosition = rAttribs.getString( XML_axisPosition, "automatic" );
}
-void ExtCfRule::importNegativeFillColor( const AttributeList& rAttribs )
+void ExtCfDataBarRule::importNegativeFillColor( const AttributeList& rAttribs )
{
mnRuleType = NEGATIVEFILLCOLOR;
ThemeBuffer& rThemeBuffer = getTheme();
@@ -1266,7 +1266,7 @@ void ExtCfRule::importNegativeFillColor( const AttributeList& rAttribs )
maModel.mnNegativeColor = aColor;
}
-void ExtCfRule::importAxisColor( const AttributeList& rAttribs )
+void ExtCfDataBarRule::importAxisColor( const AttributeList& rAttribs )
{
mnRuleType = AXISCOLOR;
ThemeBuffer& rThemeBuffer = getTheme();
@@ -1275,7 +1275,7 @@ void ExtCfRule::importAxisColor( const AttributeList& rAttribs )
maModel.mnAxisColor = aColor;
}
-void ExtCfRule::importCfvo( const AttributeList& rAttribs )
+void ExtCfDataBarRule::importCfvo( const AttributeList& rAttribs )
{
mnRuleType = CFVO;
maModel.maColorScaleType = rAttribs.getString( XML_type, OUString() );
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index 3d431cd..2be338d 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -40,25 +40,25 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs )
{
case XLS14_TOKEN( dataBar ):
{
- ExtCfRuleRef xRule = getCondFormats().createExtCfRule(mpTarget);
+ ExtCfDataBarRuleRef xRule = getCondFormats().createExtCfDataBarRule(mpTarget);
xRule->importDataBar( rAttribs );
break;
}
case XLS14_TOKEN( negativeFillColor ):
{
- ExtCfRuleRef xRule = getCondFormats().createExtCfRule(mpTarget);
+ ExtCfDataBarRuleRef xRule = getCondFormats().createExtCfDataBarRule(mpTarget);
xRule->importNegativeFillColor( rAttribs );
break;
}
case XLS14_TOKEN( axisColor ):
{
- ExtCfRuleRef xRule = getCondFormats().createExtCfRule(mpTarget);
+ ExtCfDataBarRuleRef xRule = getCondFormats().createExtCfDataBarRule(mpTarget);
xRule->importAxisColor( rAttribs );
break;
}
case XLS14_TOKEN( cfvo ):
{
- ExtCfRuleRef xRule = getCondFormats().createExtCfRule(mpTarget);
+ ExtCfDataBarRuleRef xRule = getCondFormats().createExtCfDataBarRule(mpTarget);
xRule->importCfvo( rAttribs );
xRule->getModel().mbIsLower = mbFirstEntry;
mbFirstEntry = false;
commit 37d6f7a18453658147dd1c32a90915c6a603a857
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 16 00:25:51 2015 +0200
export iconSet to extLst
Change-Id: I7606c5cb6321cfec9b36332dcd76fbad81d269d6
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 2913107..ca05734 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1125,6 +1125,40 @@ void XclExpColScaleCol::SaveXml( XclExpXmlStream& rStrm )
rWorksheet->endElement( XML_color );
}
+namespace {
+
+OString createHexStringFromDigit(sal_uInt8 nDigit)
+{
+ OString aString = OString::number( nDigit, 16 );
+ if(aString.getLength() == 1)
+ aString = aString + OString::number(0);
+ return aString;
+}
+
+OString createGuidStringFromInt(sal_uInt8 nGuid[16])
+{
+ OStringBuffer aBuffer;
+ aBuffer.append('{');
+ for(size_t i = 0; i < 16; ++i)
+ {
+ aBuffer.append(createHexStringFromDigit(nGuid[i]));
+ if(i == 3|| i == 5 || i == 7 || i == 9 )
+ aBuffer.append('-');
+ }
+ aBuffer.append('}');
+ OString aString = aBuffer.makeStringAndClear();
+ return aString.toAsciiUpperCase();
+}
+
+OString generateGUIDString()
+{
+ sal_uInt8 nGuid[16];
+ rtl_createUuid(nGuid, NULL, true);
+ return createGuidStringFromInt(nGuid);
+}
+
+}
+
XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat& rCondFormat, XclExtLstRef xExtLst, sal_Int32& rIndex ) :
XclExpRecord( EXC_ID_CONDFMT ),
XclExpRoot( rRoot )
@@ -1133,6 +1167,7 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat
GetAddressConverter().ConvertRangeList( maXclRanges, aScRanges, true );
if( !maXclRanges.empty() )
{
+ std::vector<XclExpExtCondFormatData> aExtEntries;
for( size_t nIndex = 0, nCount = rCondFormat.size(); nIndex < nCount; ++nIndex )
if( const ScFormatEntry* pFormatEntry = rCondFormat.GetEntry( nIndex ) )
{
@@ -1141,13 +1176,65 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat
else if(pFormatEntry->GetType() == condformat::COLORSCALE)
maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), ++rIndex ) );
else if(pFormatEntry->GetType() == condformat::DATABAR)
- maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), static_cast<const ScDataBarFormat&>(*pFormatEntry), ++rIndex, xExtLst ) );
+ {
+ const ScDataBarFormat& rFormat = static_cast<const ScDataBarFormat&>(*pFormatEntry);
+ XclExpExtCondFormatData aExtEntry;
+ aExtEntry.nPriority = -1;
+ aExtEntry.aGUID = generateGUIDString();
+ aExtEntry.pEntry = &rFormat;
+ aExtEntries.push_back(aExtEntry);
+
+ maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), rFormat, ++rIndex, aExtEntry.aGUID));
+ }
else if(pFormatEntry->GetType() == condformat::ICONSET)
- maCFList.AppendNewRecord( new XclExpIconSet( GetRoot(), static_cast<const ScIconSetFormat&>(*pFormatEntry), ++rIndex ) );
+ {
+ // don't export iconSet entries that are not in OOXML
+ const ScIconSetFormat& rIconSet = static_cast<const ScIconSetFormat&>(*pFormatEntry);
+ bool bNeedsExt = false;
+ switch (rIconSet.GetIconSetData()->eIconSetType)
+ {
+ case IconSet_3Smilies:
+ case IconSet_3ColorSmilies:
+ case IconSet_3Stars:
+ case IconSet_3Triangles:
+ case IconSet_5Boxes:
+ {
+ bNeedsExt = true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ bNeedsExt |= rIconSet.GetIconSetData()->mbCustom;
+
+ if (bNeedsExt)
+ {
+ XclExpExtCondFormatData aExtEntry;
+ aExtEntry.nPriority = ++rIndex;
+ aExtEntry.aGUID = generateGUIDString();
+ aExtEntry.pEntry = &rIconSet;
+ aExtEntries.push_back(aExtEntry);
+ }
+ else
+ maCFList.AppendNewRecord( new XclExpIconSet( GetRoot(), rIconSet, ++rIndex ) );
+ }
else if(pFormatEntry->GetType() == condformat::DATE)
maCFList.AppendNewRecord( new XclExpDateFormat( GetRoot(), static_cast<const ScCondDateFormatEntry&>(*pFormatEntry), ++rIndex ) );
}
aScRanges.Format( msSeqRef, SCA_VALID, NULL, formula::FormulaGrammar::CONV_XL_A1 );
+
+ if(!aExtEntries.empty() && xExtLst.get())
+ {
+ XclExpExtRef pParent = xExtLst->GetItem( XclExpExtDataBarType );
+ if( !pParent.get() )
+ {
+ xExtLst->AddRecord( XclExpExtRef(new XclExpExtCondFormat( *xExtLst.get() )) );
+ pParent = xExtLst->GetItem( XclExpExtDataBarType );
+ }
+ static_cast<XclExpExtCondFormat*>(xExtLst->GetItem( XclExpExtDataBarType ).get())->AddRecord(
+ XclExpExtConditionalFormattingRef(new XclExpExtConditionalFormatting( *pParent, aExtEntries, aScRanges)));
+ }
}
}
@@ -1234,38 +1321,12 @@ void XclExpColorScale::SaveXml( XclExpXmlStream& rStrm )
rWorksheet->endElement( XML_cfRule );
}
-namespace {
-
-OString createHexStringFromDigit(sal_uInt8 nDigit)
-{
- OString aString = OString::number( nDigit, 16 );
- if(aString.getLength() == 1)
- aString = aString + OString::number(0);
- return aString;
-}
-
-OString createGuidStringFromInt(sal_uInt8 nGuid[16])
-{
- OStringBuffer aBuffer;
- aBuffer.append('{');
- for(size_t i = 0; i < 16; ++i)
- {
- aBuffer.append(createHexStringFromDigit(nGuid[i]));
- if(i == 3|| i == 5 || i == 7 || i == 9 )
- aBuffer.append('-');
- }
- aBuffer.append('}');
- OString aString = aBuffer.makeStringAndClear();
- return aString.toAsciiUpperCase();
-}
-
-}
-
-XclExpDataBar::XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, sal_Int32 nPriority, XclExtLstRef xExtLst ):
+XclExpDataBar::XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, sal_Int32 nPriority, const OString& rGUID):
XclExpRecord(),
XclExpRoot( rRoot ),
mrFormat( rFormat ),
- mnPriority( nPriority )
+ mnPriority( nPriority ),
+ maGUID(rGUID)
{
const ScRange* pRange = rFormat.GetRange().front();
ScAddress aAddr = pRange->aStart;
@@ -1274,19 +1335,6 @@ XclExpDataBar::XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rF
mpCfvoUpperLimit.reset( new XclExpCfvo( GetRoot(), *mrFormat.GetDataBarData()->mpUpperLimit.get(), aAddr, false ) );
mpCol.reset( new XclExpColScaleCol( GetRoot(), mrFormat.GetDataBarData()->maPositiveColor ) );
- if(xExtLst.get())
- {
- XclExpExtRef pParent = xExtLst->GetItem( XclExpExtDataBarType );
- if( !pParent.get() )
- {
- xExtLst->AddRecord( XclExpExtRef(new XclExpExtCondFormat( *xExtLst.get() )) );
- pParent = xExtLst->GetItem( XclExpExtDataBarType );
- }
- sal_uInt8 nGuid[16];
- rtl_createUuid(nGuid, NULL, true);
- maGuid = createGuidStringFromInt(nGuid);
- static_cast<XclExpExtCondFormat*>(xExtLst->GetItem( XclExpExtDataBarType ).get())->AddRecord( XclExpExtConditionalFormattingRef(new XclExpExtConditionalFormatting( *pParent, rFormat, aAddr, maGuid) ));
- }
}
void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm )
@@ -1318,7 +1366,7 @@ void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm )
FSEND );
rWorksheet->startElementNS( XML_x14, XML_id, FSEND );
- rWorksheet->write( maGuid.getStr() );
+ rWorksheet->write( maGUID.getStr() );
rWorksheet->endElementNS( XML_x14, XML_id );
rWorksheet->endElement( XML_ext );
diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx
index 885e1fd..c90b57f 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -17,6 +17,22 @@
using namespace ::oox;
+namespace {
+
+const char* getIconSetName( ScIconSetType eType )
+{
+ ScIconSetMap* pMap = ScIconSetFormat::getIconSetMap();
+ for(; pMap->pName; ++pMap)
+ {
+ if(pMap->eType == eType)
+ return pMap->pName;
+ }
+
+ return "";
+}
+
+}
+
XclExpExt::XclExpExt( const XclExpRoot& rRoot ):
XclExpRoot(rRoot)
{
@@ -51,6 +67,29 @@ void XclExpExtAxisColor::SaveXml( XclExpXmlStream& rStrm )
FSEND );
}
+XclExpExtIcon::XclExpExtIcon(const XclExpRoot& rRoot, const std::pair<ScIconSetType, sal_Int32>& rCustomEntry):
+ XclExpRoot(rRoot),
+ nIndex(rCustomEntry.second)
+{
+ pIconSetName = getIconSetName(rCustomEntry.first);
+}
+
+void XclExpExtIcon::SaveXml(XclExpXmlStream& rStrm)
+{
+ sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+
+ if (nIndex == -1)
+ {
+ nIndex = 0;
+ pIconSetName = "NoIcons";
+ }
+
+ rWorksheet->singleElementNS(XML_x14, XML_cfIcon,
+ XML_iconSet, pIconSetName,
+ XML_iconId, OString::number(nIndex).getStr(),
+ FSEND);
+}
+
XclExpExtCfvo::XclExpExtCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rSrcPos, bool bFirst ):
XclExpRoot(rRoot),
meType(rEntry.GetType()),
@@ -103,10 +142,21 @@ const char* getColorScaleType( ScColorScaleEntryType eType, bool bFirst )
void XclExpExtCfvo::SaveXml( XclExpXmlStream& rStrm )
{
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
- rWorksheet->singleElementNS( XML_x14, XML_cfvo,
+ rWorksheet->startElementNS( XML_x14, XML_cfvo,
XML_type, getColorScaleType(meType, mbFirst),
- XML_value, maValue.getStr(),
FSEND );
+
+ if (meType == COLORSCALE_FORMULA ||
+ meType == COLORSCALE_PERCENT ||
+ meType == COLORSCALE_PERCENTILE ||
+ meType == COLORSCALE_VALUE)
+ {
+ rWorksheet->startElementNS(XML_xm, XML_f, FSEND);
+ rWorksheet->writeEscaped(maValue.getStr());
+ rWorksheet->endElementNS(XML_xm, XML_f);
+ }
+
+ rWorksheet->endElementNS(XML_x14, XML_cfvo);
}
XclExpExtDataBar::XclExpExtDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, const ScAddress& rPos ):
@@ -163,32 +213,135 @@ void XclExpExtDataBar::SaveXml( XclExpXmlStream& rStrm )
rWorksheet->endElementNS( XML_x14, XML_dataBar );
}
-XclExpExtCfRule::XclExpExtCfRule( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, const ScAddress& rPos, const OString& rId ):
+XclExpExtIconSet::XclExpExtIconSet(const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, const ScAddress& rPos):
+ XclExpRoot(rRoot)
+{
+ const ScIconSetFormatData& rData = *rFormat.GetIconSetData();
+ for (auto itr = rData.maEntries.begin(); itr != rData.maEntries.end(); ++itr)
+ {
+ maCfvos.AppendNewRecord(new XclExpExtCfvo(*this, *itr, rPos, false));
+ }
+ mbCustom = rData.mbCustom;
+ mbReverse = rData.mbReverse;
+ mbShowValue = rData.mbShowValue;
+ mpIconSetName = getIconSetName(rData.eIconSetType);
+
+ if (mbCustom)
+ {
+ for (auto itr = rData.maCustomVector.begin(); itr != rData.maCustomVector.end(); ++itr)
+ {
+ maCustom.AppendNewRecord(new XclExpExtIcon(*this, *itr));
+ }
+ }
+}
+
+void XclExpExtIconSet::SaveXml(XclExpXmlStream& rStrm)
+{
+ sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+
+ rWorksheet->startElementNS(XML_x14, XML_iconSet,
+ XML_iconSet, mpIconSetName,
+ XML_custom, mbCustom ? XclXmlUtils::ToPsz10(mbCustom) : NULL,
+ XML_reverse, XclXmlUtils::ToPsz10(mbReverse),
+ XML_showValue, XclXmlUtils::ToPsz10(mbShowValue),
+ FSEND);
+
+ maCfvos.SaveXml(rStrm);
+
+ if (mbCustom)
+ {
+ maCustom.SaveXml(rStrm);
+ }
+
+ rWorksheet->endElementNS(XML_x14, XML_iconSet);
+}
+
+XclExpExtCfRule::XclExpExtCfRule( const XclExpRoot& rRoot, const ScFormatEntry& rFormat, const ScAddress& rPos, const OString& rId, sal_Int32 nPriority ):
XclExpRoot(rRoot),
- maId(rId)
+ maId(rId),
+ mnPriority(nPriority)
{
- maDataBar.reset( new XclExpExtDataBar( *this, rFormat, rPos ) );
+ switch (rFormat.GetType())
+ {
+ case condformat::DATABAR:
+ {
+ const ScDataBarFormat& rDataBar = static_cast<const ScDataBarFormat&>(rFormat);
+ mxEntry.reset( new XclExpExtDataBar( *this, rDataBar, rPos ) );
+ pType = "dataBar";
+ }
+ break;
+ case condformat::ICONSET:
+ {
+ const ScIconSetFormat& rIconSet = static_cast<const ScIconSetFormat&>(rFormat);
+ mxEntry.reset(new XclExpExtIconSet(*this, rIconSet, rPos));
+ pType = "iconSet";
+ }
+ default:
+ break;
+ }
}
void XclExpExtCfRule::SaveXml( XclExpXmlStream& rStrm )
{
+ if (!mxEntry)
+ return;
+
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElementNS( XML_x14, XML_cfRule,
- XML_type, "dataBar",
+ XML_type, pType,
+ XML_priority, mnPriority == -1 ? NULL : OString::number(mnPriority).getStr(),
XML_id, maId.getStr(),
FSEND );
- maDataBar->SaveXml( rStrm );
+ mxEntry->SaveXml( rStrm );
rWorksheet->endElementNS( XML_x14, XML_cfRule );
}
-XclExpExtConditionalFormatting::XclExpExtConditionalFormatting( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, const ScAddress& rPos, const OString& rId ):
- XclExpRoot(rRoot)
+XclExpExtConditionalFormatting::XclExpExtConditionalFormatting( const XclExpRoot& rRoot,
+ std::vector<XclExpExtCondFormatData>& rData, const ScRangeList& rRange):
+ XclExpRoot(rRoot),
+ maRange(rRange)
{
- maCfRule.reset( new XclExpExtCfRule( *this, rFormat, rPos, rId ) );
- maRange = rFormat.GetRange();
+ ScAddress aAddr = maRange.front()->aStart;
+ for (auto itr = rData.begin(), itrEnd = rData.end(); itr != itrEnd; ++itr)
+ {
+ const ScFormatEntry* pEntry = itr->pEntry;
+ switch (pEntry->GetType())
+ {
+ case condformat::ICONSET:
+ {
+ const ScIconSetFormat& rIconSet = static_cast<const ScIconSetFormat&>(*pEntry);
+ bool bNeedsExt = false;
+ switch (rIconSet.GetIconSetData()->eIconSetType)
+ {
+ case IconSet_3Triangles:
+ case IconSet_3Smilies:
+ case IconSet_3ColorSmilies:
+ case IconSet_5Boxes:
+ bNeedsExt = true;
+ break;
+ default:
+ break;
+ }
+
+ if (rIconSet.GetIconSetData()->mbCustom)
+ bNeedsExt = true;
+
+ if (bNeedsExt)
+ {
+ maCfRules.AppendNewRecord(new XclExpExtCfRule(*this, *pEntry, aAddr, itr->aGUID, itr->nPriority));
+ }
+ }
+ break;
+ case condformat::DATABAR:
+ maCfRules.AppendNewRecord(new XclExpExtCfRule( *this, *pEntry, aAddr, itr->aGUID, itr->nPriority));
+ break;
+ default:
+ break;
+ }
+ }
}
void XclExpExtConditionalFormatting::SaveXml( XclExpXmlStream& rStrm )
@@ -198,7 +351,7 @@ void XclExpExtConditionalFormatting::SaveXml( XclExpXmlStream& rStrm )
FSNS( XML_xmlns, XML_xm ), "http://schemas.microsoft.com/office/excel/2006/main",
FSEND );
- maCfRule->SaveXml( rStrm );
+ maCfRules.SaveXml( rStrm );
rWorksheet->startElementNS( XML_xm, XML_sqref, FSEND );
rWorksheet->write(XclXmlUtils::ToOString(maRange).getStr());
diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx
index 07334c2..d986d75 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -269,7 +269,7 @@ private:
class XclExpDataBar : public XclExpRecord, protected XclExpRoot
{
public:
- explicit XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, sal_Int32 nPriority, XclExtLstRef xExtLst );
+ explicit XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, sal_Int32 nPriority, const OString& rGUID);
virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
private:
@@ -279,7 +279,7 @@ private:
const ScDataBarFormat& mrFormat;
sal_Int32 mnPriority;
- OString maGuid;
+ OString maGUID;
};
class XclExpIconSet : public XclExpRecord, protected XclExpRoot
diff --git a/sc/source/filter/inc/xeextlst.hxx b/sc/source/filter/inc/xeextlst.hxx
index e92afd5..f148f83 100644
--- a/sc/source/filter/inc/xeextlst.hxx
+++ b/sc/source/filter/inc/xeextlst.hxx
@@ -22,6 +22,14 @@ enum XclExpExtType
XclExpExtDataBarType
};
+struct XclExpExtCondFormatData
+{
+ // -1 means don't write priority
+ sal_Int32 nPriority;
+ OString aGUID;
+ const ScFormatEntry* pEntry;
+};
+
/**
* Base class for ext entries. Extend this class to provide the needed functionality
*
@@ -69,6 +77,17 @@ private:
Color maAxisColor;
};
+class XclExpExtIcon : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+ explicit XclExpExtIcon( const XclExpRoot& rRoot, const std::pair<ScIconSetType, sal_Int32>& rCustomEntry);
+ virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
+
+private:
+ const char* pIconSetName;
+ sal_Int32 nIndex;
+};
+
class XclExpExtDataBar : public XclExpRecordBase, protected XclExpRoot
{
public:
@@ -88,17 +107,34 @@ private:
};
+class XclExpExtIconSet : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+ explicit XclExpExtIconSet(const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, const ScAddress& rPos);
+ virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
+
+private:
+ XclExpRecordList<XclExpExtCfvo> maCfvos;
+ XclExpRecordList<XclExpExtIcon> maCustom;
+ bool mbCustom;
+ bool mbReverse;
+ bool mbShowValue;
+ const char* mpIconSetName;
+};
+
typedef std::shared_ptr<XclExpExtDataBar> XclExpExtDataBarRef;
class XclExpExtCfRule : public XclExpRecordBase, protected XclExpRoot
{
public:
- XclExpExtCfRule( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, const ScAddress& rPos, const OString& rId );
+ XclExpExtCfRule( const XclExpRoot& rRoot, const ScFormatEntry& rFormat, const ScAddress& rPos, const OString& rId, sal_Int32 nPriority );
virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
private:
- XclExpExtDataBarRef maDataBar;
+ XclExpRecordRef mxEntry;
OString maId;
+ const char* pType;
+ sal_Int32 mnPriority;
};
typedef std::shared_ptr<XclExpExt> XclExpExtRef;
@@ -107,11 +143,11 @@ typedef std::shared_ptr<XclExpExtCfRule> XclExpExtCfRuleRef;
class XclExpExtConditionalFormatting : public XclExpRecordBase, protected XclExpRoot
{
public:
- explicit XclExpExtConditionalFormatting( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, const ScAddress& rPos, const OString& rId );
+ explicit XclExpExtConditionalFormatting( const XclExpRoot& rRoot, std::vector<XclExpExtCondFormatData>& rData, const ScRangeList& rRange);
virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
private:
- XclExpExtCfRuleRef maCfRule;
+ XclExpRecordList<XclExpExtCfRule> maCfRules;
ScRangeList maRange;
};
commit 4eb19ec569579137de9d835fe584e47b871c4e8c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri May 15 15:17:41 2015 +0200
add missing OOXML icon sets, tdf#69095
Change-Id: Ia4f9e62bb2b2bd143785642fcfacbc58cfaf1926
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index dd28d47..6a2115f 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -192,6 +192,8 @@ enum ScIconSetType
IconSet_3Symbols,
IconSet_3Symbols2,
IconSet_3Smilies,
+ IconSet_3Stars,
+ IconSet_3Triangles,
IconSet_3ColorSmilies,
IconSet_4Arrows,
IconSet_4ArrowsGray,
@@ -201,7 +203,8 @@ enum ScIconSetType
IconSet_5Arrows,
IconSet_5ArrowsGray,
IconSet_5Ratings,
- IconSet_5Quarters
+ IconSet_5Quarters,
+ IconSet_5Boxes
};
struct ScIconSetMap {
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index cefb5cc..176b1c8 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -1231,6 +1231,8 @@ ScIconSetMap aIconSetMap[] = {
{ "3Symbols2", IconSet_3Symbols2, 3 },
{ "3Smilies", IconSet_3Smilies, 3 },
{ "3ColorSmilies", IconSet_3ColorSmilies, 3 },
+ { "3Stars", IconSet_3Stars, 3 },
+ { "3Triangles", IconSet_3Triangles, 3 },
{ "4Arrows", IconSet_4Arrows, 4 },
{ "4ArrowsGray", IconSet_4ArrowsGray, 4 },
{ "4RedToBlack", IconSet_4RedToBlack, 4 },
@@ -1240,6 +1242,7 @@ ScIconSetMap aIconSetMap[] = {
{ "5ArrowsGray", IconSet_5ArrowsGray, 5 },
{ "5Rating", IconSet_5Ratings, 5 },
{ "5Quarters", IconSet_5Quarters, 5 },
+ { "5Boxes", IconSet_5Boxes, 5 },
{ NULL, IconSet_3Arrows, 0 }
};
@@ -1286,6 +1289,14 @@ const sal_Int32 a3ColorSmilies[] = {
BMP_ICON_SET_POSITIVE_GREEN_SMILIE, BMP_ICON_SET_NEUTRAL_YELLOW_SMILIE, BMP_ICON_SET_NEGATIVE_RED_SMILIE
};
+const sal_Int32 a3Stars[] = {
+ BMP_ICON_SET_STARS_EMPTY, BMP_ICON_SET_STARS_HALF, BMP_ICON_SET_STARS_FULL
+};
+
+const sal_Int32 a3Triangles[] = {
+ BMP_ICON_SET_TRIANGLES_DOWN, BMP_ICON_SET_TRIANGLES_SAME, BMP_ICON_SET_TRIANGLES_UP
+};
+
const sal_Int32 a4Arrows[] = {
BMP_ICON_SET_COLORARROWS_DOWN, BMP_ICON_SET_COLORARROWS_SLIGHTLY_DOWN, BMP_ICON_SET_COLORARROWS_SLIGHTLY_UP, BMP_ICON_SET_COLORARROWS_UP
};
@@ -1314,6 +1325,12 @@ const sal_Int32 a5Quarters[] = {
BMP_ICON_SET_PIES_THREE_QUARTER, BMP_ICON_SET_PIES_FULL,
};
+const sal_Int32 a5Boxes[] = {
+ BMP_ICON_SET_SQUARES_EMPTY, BMP_ICON_SET_SQUARES_ONE_QUARTER,
+ BMP_ICON_SET_SQUARES_HALF, BMP_ICON_SET_SQUARES_THREE_QUARTER,
+ BMP_ICON_SET_SQUARES_FULL
+};
+
const sal_Int32 a3Symbols1[] = {
BMP_ICON_SET_SYMBOLS1_CROSS, BMP_ICON_SET_SYMBOLS1_EXCLAMATION_MARK, BMP_ICON_SET_SYMBOLS1_CHECK
};
@@ -1353,6 +1370,8 @@ static const ScIconSetBitmapMap aBitmapMap[] = {
{ IconSet_3TrafficLights2, a3TrafficLights2 },
{ IconSet_3Smilies, a3Smilies },
{ IconSet_3ColorSmilies, a3ColorSmilies },
+ { IconSet_3Triangles, a3Triangles },
+ { IconSet_3Stars, a3Stars },
{ IconSet_4Arrows, a4Arrows },
{ IconSet_4ArrowsGray, a4ArrowsGray },
{ IconSet_4Rating, a4Ratings },
@@ -1361,7 +1380,8 @@ static const ScIconSetBitmapMap aBitmapMap[] = {
{ IconSet_5Arrows, a5Arrows },
{ IconSet_5ArrowsGray, a5ArrowsGray },
{ IconSet_5Quarters, a5Quarters },
- { IconSet_5Ratings, a5Ratings }
+ { IconSet_5Ratings, a5Ratings },
+ { IconSet_5Boxes, a5Boxes }
};
}
diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src
index d086dca..4d2ca4c 100644
--- a/sc/source/ui/src/condformatdlg.src
+++ b/sc/source/ui/src/condformatdlg.src
@@ -286,6 +286,8 @@ Control RID_COND_ENTRY
"3 Symbols 1";
"3 Symbols 2";
"3 Smilies";
+ "3 Stars";
+ "3 Triangles";
"3 Colored Smilies";
"4 Arrows";
"4 Gray Arrows";
@@ -296,6 +298,7 @@ Control RID_COND_ENTRY
"5 Gray Arrows";
"5 Ratings";
"5 Quarters";
+ "5 Boxes";
};
};
};
More information about the Libreoffice-commits
mailing list