diff options
author | Niklas Johansson <sleeping.pillow@gmail.com> | 2015-04-08 01:33:09 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-21 12:57:52 +0000 |
commit | 7e1d81cc9c8677a19f1f5f1adabbe23794828a3a (patch) | |
tree | 2edc8a2708b0142c6c83d37407353b2df7b4a260 | |
parent | 47f82250ac18c8553f95428fefdd472ba9fc72e8 (diff) |
tdf#39547 Image title/description is lost after changing anchor
This issue has been present for a long time, at least since 2010.
When the old frames are deleted the SdrObjPlusData that holds the
title and description is deleted as well never to be transferred
to the re-anchored object.
Some types of frames only have the msTitle and msDesc so let's
keep them updated and also use them to transfer the strings in
question to the new SdrObjPlusData object.
Change-Id: If9b00b70d2556bd32fa2b4f312db4ad09102d9ee
Reviewed-on: https://gerrit.libreoffice.org/15194
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 7f47dd7a3bf8..dda591bf212e 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -3029,6 +3029,8 @@ void SwFlyFrmFmt::MakeFrms() break; } pFrm->AppendFly( pFly ); + pFly->GetFmt()->SetObjTitle(GetObjTitle()); + pFly->GetFmt()->SetObjDescription(GetObjDescription()); SwPageFrm *pPage = pFly->FindPageFrm(); if( pPage ) ::RegistFlys( pPage, pFly ); @@ -3080,6 +3082,7 @@ void SwFlyFrmFmt::SetObjTitle( const OUString& rTitle, bool bBroadcast ) { SdrObject* pMasterObject = FindSdrObject(); OSL_ENSURE( pMasterObject, "<SwFlyFrmFmt::SetObjTitle(..)> - missing <SdrObject> instance" ); + msTitle = rTitle; if ( !pMasterObject ) { return; @@ -3104,16 +3107,19 @@ OUString SwFlyFrmFmt::GetObjTitle() const OSL_ENSURE( pMasterObject, "<SwFlyFrmFmt::GetObjTitle(..)> - missing <SdrObject> instance" ); if ( !pMasterObject ) { - return OUString(); + return msTitle; } - - return pMasterObject->GetTitle(); + if (!pMasterObject->GetTitle().isEmpty()) + return pMasterObject->GetTitle(); + else + return msTitle; } void SwFlyFrmFmt::SetObjDescription( const OUString& rDescription, bool bBroadcast ) { SdrObject* pMasterObject = FindSdrObject(); OSL_ENSURE( pMasterObject, "<SwFlyFrmFmt::SetDescription(..)> - missing <SdrObject> instance" ); + msDesc = rDescription; if ( !pMasterObject ) { return; @@ -3138,10 +3144,12 @@ OUString SwFlyFrmFmt::GetObjDescription() const OSL_ENSURE( pMasterObject, "<SwFlyFrmFmt::GetDescription(..)> - missing <SdrObject> instance" ); if ( !pMasterObject ) { - return OUString(); + return msDesc; } - - return pMasterObject->GetDescription(); + if (!pMasterObject->GetDescription().isEmpty()) + return pMasterObject->GetDescription(); + else + return msDesc; } /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657# |