diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-31 09:11:52 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-31 08:56:09 +0000 |
commit | 526ed1f7dbd9150734edcb03727d49e1b1306f56 (patch) | |
tree | e92571cc2d0d7cb9815be2574fa0f43e73aaf032 /writerfilter/source/dmapper/GraphicImport.cxx | |
parent | 9bfae70fcb91f15ecc0a58a0f5eb3e5f3c8d89d9 (diff) |
tdf#77349 RTF import: automatically generate names for images if needed
The DOC/ODT import can call SwDoc::SetAllUniqueFlyNames() at the end of
the process to assign unique names to fly frames which lack a name.
Add a similar (but much simpler) feature to the domain mapper to avoid
empty image names in the DOCX/RTF import result, so it's easier to click
on the items in Writer's navigator.
Change-Id: I432fc741f8d75d735e1dfe88daba50ba0797042d
Reviewed-on: https://gerrit.libreoffice.org/25705
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerfilter/source/dmapper/GraphicImport.cxx')
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 04849c1bbbc4..79b46c77c29c 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -388,11 +388,12 @@ public: { try { - if( !sName.isEmpty() ) - { - uno::Reference< container::XNamed > xNamed( xGraphicObjectProperties, uno::UNO_QUERY_THROW ); - xNamed->setName( sName ); - } + // Ask the graphic naming helper to find out the name for this + // object: It's around till the end of the import, so it remembers + // what's the first free name. + uno::Reference< container::XNamed > xNamed( xGraphicObjectProperties, uno::UNO_QUERY_THROW ); + xNamed->setName(rDomainMapper.GetGraphicNamingHelper().NameGraphic(sName)); + xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_DESCRIPTION ), uno::makeAny( sAlternativeText )); xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_TITLE ), |