[Libreoffice-commits] .: sfx2/inc sfx2/source svx/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed May 25 12:51:57 PDT 2011


 sfx2/inc/sfx2/lnkbase.hxx      |    9 +++++++--
 sfx2/source/appl/lnkbase2.cxx  |    8 +++++---
 svx/source/svdraw/svdograf.cxx |   10 ++++++----
 svx/source/svdraw/svdoole2.cxx |   10 ++++++----
 svx/source/svdraw/svdotxln.cxx |   10 ++++++----
 5 files changed, 30 insertions(+), 17 deletions(-)

New commits:
commit 7b7809f8968b1dcf99182ed792b969b741674dd7
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed May 25 14:48:41 2011 -0400

    Change the signature of DataChanged in the base class.
    
    This change allows the caller to see if DataChanged operation was
    successful or not.

diff --git a/sfx2/inc/sfx2/lnkbase.hxx b/sfx2/inc/sfx2/lnkbase.hxx
index ddb946a..3a4667a 100644
--- a/sfx2/inc/sfx2/lnkbase.hxx
+++ b/sfx2/inc/sfx2/lnkbase.hxx
@@ -133,8 +133,13 @@ public:
     void    		SetLinkSourceName( const String & rName );
     String		 	GetLinkSourceName() const;
 
-    virtual void 	DataChanged( const String & rMimeType,
-                                const ::com::sun::star::uno::Any & rValue );
+    enum UpdateResult {
+        SUCCESS = 0,
+        ERROR_GENERAL = 1
+    };
+
+    virtual UpdateResult DataChanged(
+        const String & rMimeType, const ::com::sun::star::uno::Any & rValue );
 
     void			SetUpdateMode( sal_uInt16 );
     sal_uInt16 			GetUpdateMode() const;
diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx
index 694917e..76e617a 100644
--- a/sfx2/source/appl/lnkbase2.cxx
+++ b/sfx2/source/appl/lnkbase2.cxx
@@ -330,12 +330,13 @@ sal_Bool SvBaseLink::Update()
 
             if( xObj->GetData( aData, sMimeType ) )
             {
-                DataChanged( sMimeType, aData );
+                UpdateResult eRes = DataChanged(sMimeType, aData);
+                bool bSuccess = eRes == SUCCESS;
                 //for manual Updates there is no need to hold the ServerObject
                 if( OBJECT_CLIENT_DDE == nObjType &&
                     LINKUPDATE_ONCALL == GetUpdateMode() && xObj.Is() )
                     xObj->RemoveAllDataAdvise( this );
-                return sal_True;
+                return bSuccess;
             }
             if( xObj.Is() )
             {
@@ -439,7 +440,7 @@ void SvBaseLink::Disconnect()
     }
 }
 
-void SvBaseLink::DataChanged( const String &, const ::com::sun::star::uno::Any & )
+SvBaseLink::UpdateResult SvBaseLink::DataChanged( const String &, const ::com::sun::star::uno::Any & )
 {
     switch( nObjType )
     {
@@ -448,6 +449,7 @@ void SvBaseLink::DataChanged( const String &, const ::com::sun::star::uno::Any &
             pImplData->DDEType.pItem->Notify();
         break;
     }
+    return SUCCESS;
 }
 
 void SvBaseLink::Edit( Window* pParent, const Link& rEndEditHdl )
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 7261fd7..4c675f8 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -131,8 +131,9 @@ public:
     virtual				~SdrGraphicLink();
 
     virtual void		Closed();
-    virtual void		DataChanged( const String& rMimeType,
-                                const ::com::sun::star::uno::Any & rValue );
+
+    virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+        const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
     void				DataChanged( const Graphic& rGraphic );
 
     sal_Bool				Connect() { return 0 != GetRealObject(); }
@@ -242,8 +243,8 @@ void SdrGraphicLink::RemoveGraphicUpdater()
 
 // -----------------------------------------------------------------------------
 
-void SdrGraphicLink::DataChanged( const String& rMimeType,
-                                const ::com::sun::star::uno::Any & rValue )
+::sfx2::SvBaseLink::UpdateResult SdrGraphicLink::DataChanged(
+    const String& rMimeType, const ::com::sun::star::uno::Any & rValue )
 {
     SdrModel*       pModel      = pGrafObj ? pGrafObj->GetModel() : 0;
     sfx2::LinkManager* pLinkManager= pModel  ? pModel->GetLinkManager() : 0;
@@ -264,6 +265,7 @@ void SdrGraphicLink::DataChanged( const String& rMimeType,
             pGrafObj->BroadcastObjectChange();
         }
     }
+    return SUCCESS;
 }
 
 // -----------------------------------------------------------------------------
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 36f9a36..bd10258 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -612,8 +612,8 @@ public:
     virtual				~SdrEmbedObjectLink();
 
     virtual void		Closed();
-    virtual void		DataChanged( const String& rMimeType,
-                                const ::com::sun::star::uno::Any & rValue );
+    virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+        const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
 
     sal_Bool			Connect() { return GetRealObject() != NULL; }
 };
@@ -635,8 +635,8 @@ SdrEmbedObjectLink::~SdrEmbedObjectLink()
 
 // -----------------------------------------------------------------------------
 
-void SdrEmbedObjectLink::DataChanged( const String& /*rMimeType*/,
-                                const ::com::sun::star::uno::Any & /*rValue*/ )
+::sfx2::SvBaseLink::UpdateResult SdrEmbedObjectLink::DataChanged(
+    const String& /*rMimeType*/, const ::com::sun::star::uno::Any & /*rValue*/ )
 {
     if ( !pObj->UpdateLinkURL_Impl() )
     {
@@ -666,6 +666,8 @@ void SdrEmbedObjectLink::DataChanged( const String& /*rMimeType*/,
 
     pObj->GetNewReplacement();
     pObj->SetChanged();
+
+    return SUCCESS;
 }
 
 // -----------------------------------------------------------------------------
diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx
index b3ceec9..295dc48 100644
--- a/svx/source/svdraw/svdotxln.cxx
+++ b/svx/source/svdraw/svdotxln.cxx
@@ -75,8 +75,8 @@ public:
     virtual ~ImpSdrObjTextLink();
 
     virtual void Closed();
-    virtual void DataChanged( const String& rMimeType,
-                                const ::com::sun::star::uno::Any & rValue );
+    virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+        const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
 
     sal_Bool Connect() { return 0 != SvBaseLink::GetRealObject(); }
 };
@@ -98,8 +98,8 @@ void ImpSdrObjTextLink::Closed()
 }
 
 
-void ImpSdrObjTextLink::DataChanged( const String& /*rMimeType*/,
-                                const ::com::sun::star::uno::Any & /*rValue */)
+::sfx2::SvBaseLink::UpdateResult ImpSdrObjTextLink::DataChanged(
+    const String& /*rMimeType*/, const ::com::sun::star::uno::Any & /*rValue */)
 {
     bool bForceReload = false;
     SdrModel* pModel = pSdrObj ? pSdrObj->GetModel() : 0;
@@ -125,6 +125,8 @@ void ImpSdrObjTextLink::DataChanged( const String& /*rMimeType*/,
     }
     if (pSdrObj )
         pSdrObj->ReloadLinkedText( bForceReload );
+
+    return SUCCESS;
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////


More information about the Libreoffice-commits mailing list