summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2023-03-17 15:07:42 -0400
committerHenry Castro <hcastro@collabora.com>2023-05-17 15:18:59 +0200
commitcb58d4c19873e755c17927e82d31e28faa4fa432 (patch)
treee22c4c1f329a494d7a25d87d038335b93590ee06 /sc
parentfc157beedabfd08c0991bdd1633be0b9b7a9ff49 (diff)
sc: filter: oox: update databar format before clone
The ScDataBarFormatData should update from import (finalizeImport) before cloning, otherwise it loose data. Signed-off-by: Henry Castro <hcastro@collabora.com> Change-Id: I4af8b79e93eed8091bf01244bacac1d12e591c45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149068 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/inc/condformatbuffer.hxx2
-rw-r--r--sc/source/filter/oox/condformatbuffer.cxx12
2 files changed, 14 insertions, 0 deletions
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index cdc8d4727baf..d5d5ebac2ab5 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -271,6 +271,7 @@ public:
void importAxisColor( const AttributeList& rAttribs );
void importCfvo( const AttributeList& rAttribs );
ExCfRuleModel& getModel() { return maModel; }
+ const ScDataBarFormatData* GetDataBarData() { return mpTarget; }
};
class ExtCfCondFormat
@@ -311,6 +312,7 @@ public:
void finalizeImport();
private:
CondFormatRef createCondFormat();
+ void updateImport(const ScDataBarFormatData* pTarget);
private:
typedef RefVector< CondFormat > CondFormatVec;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 5e3e0d4a18b5..2960610f34dd 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1197,6 +1197,16 @@ public:
}
+void CondFormatBuffer::updateImport(const ScDataBarFormatData* pTarget)
+{
+ for ( const auto& rRule : maCfRules )
+ {
+ if ( rRule && rRule->GetDataBarData() == pTarget )
+ rRule->finalizeImport();
+ }
+}
+
+
void CondFormatBuffer::finalizeImport()
{
std::unordered_set<size_t> aDoneExtCFs;
@@ -1224,6 +1234,8 @@ void CondFormatBuffer::finalizeImport()
for (const auto& rxEntry : rEntries)
{
CondFormatRuleRef xRule = rCondFormat.createRule();
+ if (ScDataBarFormat *pData = dynamic_cast<ScDataBarFormat*>(rxEntry.get()))
+ updateImport(pData->GetDataBarData());
ScFormatEntry* pNewEntry = rxEntry->Clone(pDoc);
sal_Int32 nPriority = rPriorities[nEntryIdx];
if (nPriority == -1)