summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-05-31 12:34:35 +0200
committerMichael Stahl <mstahl@redhat.com>2013-05-31 12:40:08 +0200
commitf5e8f5b0b5410d29b5cb1fb6fbbd8bf3c48a0201 (patch)
treec4ede359411a12a090a3f798541fc3a4d4ad08c0 /sw
parentd0508f79c15a5d789f5e6af214d78ce89e05071d (diff)
sw: SwXFrame: fix gradient import problem:
BaseFrameProperties_Impl::FillBaseProperties: It may happen that checkForUniqueItem returns an item with a name that already exists, if the same gradient appears multiple times; don't crash with unhandled ElementExistException then. (can be reproduced with test3.docx from fdo#41466) (regression from 1a3c90a292c7fc9060604151de9dc51eecf5b6a7) Change-Id: Iace7af4c5679c1c7e978525fa31abf884038567c
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unoframe.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index d3d5ed5519d3..0273a1edbf4c 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -267,7 +267,10 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SwDoc* pDoc, SfxItemSet& rToSe
uno::Reference<frame::XModel> xModel(pDoc->GetDocShell()->GetModel());
uno::Reference<lang::XMultiServiceFactory> xServiceFact(xModel, uno::UNO_QUERY);
uno::Reference< container::XNameContainer > xGradients(xServiceFact->createInstance("com.sun.star.drawing.GradientTable"), uno::UNO_QUERY);
- xGradients->insertByName(pItem->GetName(), *pFillGradient);
+ if (!xGradients->hasByName(pItem->GetName()))
+ {
+ xGradients->insertByName(pItem->GetName(), *pFillGradient);
+ }
delete pItem;
}