diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-04-03 16:44:51 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-04-03 17:44:23 +0200 |
commit | 5b75b4e1ec77515db811be9d7895bb7bd9d23088 (patch) | |
tree | 870f5ca9e88c0bca45a5ef372ab0be765c2f5152 /sc/source/ui/unoobj/condformatuno.cxx | |
parent | eedf546acb878cb7c5856d33aad7496c1ad23269 (diff) |
first part for correct handling of new cond format entries
Change-Id: I82f66218bf02898e523e4f69fec9166aa00d0b83
Diffstat (limited to 'sc/source/ui/unoobj/condformatuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/condformatuno.cxx | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index 8efdc9475514..0acab072c91c 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -470,9 +470,43 @@ ScDocShell* ScCondFormatObj::getDocShell() return mpDocShell; } -void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& /*xEntry*/) +void ScCondFormatObj::createEntry(const sal_Int32 nType, const sal_Int32 nPos) throw(uno::RuntimeException, std::exception) { + SolarMutexGuard aGuard; + ScConditionalFormat* pFormat = getCoreObject(); + if (nPos > sal_Int32(pFormat->size())) + throw lang::IllegalArgumentException(); + + ScFormatEntry* pNewEntry = NULL; + ScDocument* pDoc = &mpDocShell->GetDocument(); + switch (nType) + { + case sheet::ConditionEntryType::CONDITION: + pNewEntry = new ScCondFormatEntry(SC_COND_EQUAL, "", "", + pDoc, pFormat->GetRange().GetTopLeftCorner(), ""); + break; + case sheet::ConditionEntryType::COLORSCALE: + pNewEntry = new ScColorScaleFormat(pDoc); + static_cast<ScColorScaleFormat*>(pNewEntry)->EnsureSize(); + break; + case sheet::ConditionEntryType::DATABAR: + pNewEntry = new ScDataBarFormat(pDoc); + static_cast<ScDataBarFormat*>(pNewEntry)->EnsureSize(); + break; + case sheet::ConditionEntryType::ICONSET: + pNewEntry = new ScIconSetFormat(pDoc); + static_cast<ScIconSetFormat*>(pNewEntry)->EnsureSize(); + break; + case sheet::ConditionEntryType::DATE: + pNewEntry = new ScCondDateFormatEntry(pDoc); + break; + default: + SAL_WARN("sc", "unknown conditional format type"); + throw lang::IllegalArgumentException(); + } + + pFormat->AddEntry(pNewEntry); } void ScCondFormatObj::removeByIndex(const sal_Int32 nIndex) |