diff options
Diffstat (limited to 'xmloff/source/text/XMLTextFrameContext.cxx')
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 6e8fc2e2eff7..1adb2160275e 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -375,6 +375,7 @@ class XMLTextFrameContext_Impl : public SvXMLImportContext const ::rtl::OUString sTextBoxServiceName; const ::rtl::OUString sGraphicServiceName; + ::rtl::OUString m_sOrigName; ::rtl::OUString sName; ::rtl::OUString sStyleName; ::rtl::OUString sNextName; @@ -452,6 +453,8 @@ public: void SetDesc( const ::rtl::OUString& rDesc ); + void SetName(); + ::com::sun::star::text::TextContentAnchorType GetAnchorType() const { return eAnchorType; } const ::com::sun::star::uno::Reference < @@ -906,6 +909,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( sStyleName = rValue; break; case XML_TOK_TEXT_FRAME_NAME: + m_sOrigName = rValue; sName = rValue; break; case XML_TOK_TEXT_FRAME_FRAME_NAME: @@ -1293,6 +1297,19 @@ void XMLTextFrameContext_Impl::SetHyperlink( const OUString& rHRef, } } +void XMLTextFrameContext_Impl::SetName() +{ + Reference<XNamed> xNamed(xPropSet, UNO_QUERY); + if (xNamed.is()) + { + OUString const name(xNamed->getName()); + if (name != m_sOrigName) + { + xNamed->setName(m_sOrigName); + } + } +} + // Implement Title/Description Elements UI (#i73249#) void XMLTextFrameContext_Impl::SetTitle( const OUString& rTitle ) { @@ -1402,14 +1419,23 @@ XMLTextFrameContext::~XMLTextFrameContext() void XMLTextFrameContext::EndElement() { /// solve if multiple image child contexts were imported - solveMultipleImages(); + SvXMLImportContextRef const pMultiContext(solveMultipleImages()); - SvXMLImportContext *pContext = &m_xImplContext; + SvXMLImportContext const*const pContext = + (pMultiContext) ? &pMultiContext : &m_xImplContext; XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext ); + assert(!pMultiContext || pImpl); if( pImpl ) { pImpl->CreateIfNotThere(); + // fdo#68839: in case the surviving image was not the first one, + // it will have a counter added to its name - set the original name + if (pMultiContext) // do this only when necessary; esp. not for text + { // frames that may have entries in GetRenameMap()! + pImpl->SetName(); + } + if( !m_sTitle.isEmpty() ) { pImpl->SetTitle( m_sTitle ); |