sw/source/core/layout/atrfrm.cxx |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 7e1d81cc9c8677a19f1f5f1adabbe23794828a3a
Author: Niklas Johansson <sleeping.pil...@gmail.com>
Date:   Wed Apr 8 01:33:09 2015 +0200

    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 <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 7f47dd7..dda591b 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#
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to