[Libreoffice-commits] .: 2 commits - reportdesign/inc reportdesign/source tools/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Nov 25 12:17:45 PST 2011


 reportdesign/inc/RptObject.hxx             |    4 ++
 reportdesign/source/core/sdr/RptObject.cxx |   58 ++++++++++++++++++-----------
 tools/source/stream/strmunx.cxx            |    2 -
 tools/source/stream/strmwnt.cxx            |    6 +--
 4 files changed, 45 insertions(+), 25 deletions(-)

New commits:
commit 9eac8b2d2d5b77e1aa537a8e3756ffbbb10d7e0e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 25 20:16:36 2011 +0000

    Resolves: fdo#39950 fix dnd crash from default assignment operators

diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx
index 056a06c..4084a47 100644
--- a/reportdesign/inc/RptObject.hxx
+++ b/reportdesign/inc/RptObject.hxx
@@ -224,6 +224,8 @@ public:
     virtual OOle2Obj* Clone() const;
     virtual void initializeOle();
 
+    OOle2Obj& operator=(const OOle2Obj& rObj);
+
     void initializeChart( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& _xModel);
 };
 
@@ -275,6 +277,8 @@ public:
     virtual sal_uInt32 GetObjInventor() const;
     virtual OUnoObject* Clone() const;
 
+    OUnoObject& operator=(const OUnoObject& rObj);
+
 private:
     void    impl_setReportComponent_nothrow();
     void    impl_initializeModel_nothrow();
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 09bf340..b50945a 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -941,18 +941,24 @@ uno::Reference< uno::XInterface > OUnoObject::getUnoShape()
 {
     return OObjectBase::getUnoShapeOf( *this );
 }
-// -----------------------------------------------------------------------------
+
+OUnoObject& OUnoObject::operator=(const OUnoObject& rObj)
+{
+    if( this == &rObj )
+        return *this;
+    SdrUnoObj::operator=(rObj);
+
+    Reference<XPropertySet> xSource(const_cast<OUnoObject&>(rObj).getUnoShape(), uno::UNO_QUERY);
+    Reference<XPropertySet> xDest(getUnoShape(), uno::UNO_QUERY);
+    if ( xSource.is() && xDest.is() )
+        comphelper::copyProperties(xSource.get(), xDest.get());
+
+    return *this;
+}
+
 OUnoObject* OUnoObject::Clone() const
 {
-    OUnoObject* pClone = CloneHelper< OUnoObject >();
-    if ( pClone )
-    {
-        Reference<XPropertySet> xSource(const_cast<OUnoObject*>(this)->getUnoShape(),uno::UNO_QUERY);
-        Reference<XPropertySet> xDest(pClone->getUnoShape(),uno::UNO_QUERY);
-        if ( xSource.is() && xDest.is() )
-            comphelper::copyProperties(xSource.get(),xDest.get());
-    }
-    return pClone;
+    return CloneHelper< OUnoObject >();
 }
 //----------------------------------------------------------------------------
 // OOle2Obj
@@ -1154,22 +1160,32 @@ uno::Reference< chart2::data::XDatabaseDataProvider > lcl_getDataProvider(const
     }
     return xSource;
 }
-// -----------------------------------------------------------------------------
-// Clone() soll eine komplette Kopie des Objektes erzeugen.
-OOle2Obj* OOle2Obj::Clone() const
+
+OOle2Obj& OOle2Obj::operator=(const OOle2Obj& rObj)
 {
-    OOle2Obj* pObj = CloneHelper< OOle2Obj >();
-    OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
-    svt::EmbeddedObjectRef::TryRunningState( pObj->GetObjRef() );
-    pObj->impl_createDataProvider_nothrow(pRptModel->getReportDefinition().get());
+    if( this == &rObj )
+        return *this;
+    SdrOle2Obj::operator=(rObj);
 
-    uno::Reference< chart2::data::XDatabaseDataProvider > xSource( lcl_getDataProvider(GetObjRef()) );
-    uno::Reference< chart2::data::XDatabaseDataProvider > xDest( lcl_getDataProvider(pObj->GetObjRef()) );
+    OReportModel* pRptModel = static_cast<OReportModel*>(rObj.GetModel());
+    svt::EmbeddedObjectRef::TryRunningState( GetObjRef() );
+    impl_createDataProvider_nothrow(pRptModel->getReportDefinition().get());
+
+    uno::Reference< chart2::data::XDatabaseDataProvider > xSource( lcl_getDataProvider(rObj.GetObjRef()) );
+    uno::Reference< chart2::data::XDatabaseDataProvider > xDest( lcl_getDataProvider(GetObjRef()) );
     if ( xSource.is() && xDest.is() )
         comphelper::copyProperties(xSource.get(),xDest.get());
 
-    pObj->initializeChart(pRptModel->getReportDefinition().get());
-    return pObj;
+    initializeChart(pRptModel->getReportDefinition().get());
+
+    return *this;
+}
+
+// -----------------------------------------------------------------------------
+// Clone() soll eine komplette Kopie des Objektes erzeugen.
+OOle2Obj* OOle2Obj::Clone() const
+{
+    return CloneHelper< OOle2Obj >();
 }
 // -----------------------------------------------------------------------------
 void OOle2Obj::impl_createDataProvider_nothrow(const uno::Reference< frame::XModel>& _xModel)
commit cbb2b42f113e29609161d8bdbeb667a2164a4d1a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Nov 25 16:30:15 2011 +0000

    ByteString->rtl::OString

diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 2dfe2bb..ad245a7 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -503,7 +503,7 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes )
     {
 #if OSL_DEBUG_LEVEL > 1
         fprintf( stderr, "InternalLock on %s [ %ld ... %ld ] failed\n",
-                 ByteString(aFilename, osl_getThreadTextEncoding()).GetBuffer(), nByteOffset, nByteOffset+nBytes );
+                 rtl::OUStringToOStroug(aFilename, osl_getThreadTextEncoding()).getStr(), nByteOffset, nByteOffset+nBytes );
 #endif
         return sal_False;
     }
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index c9dae13..409504d 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -397,7 +397,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode )
     //    !!! DirEntry aDirEntry( rFilename );
     //    !!! aFilename = aDirEntry.GetFull();
     aFilename = aParsedFilename;
-    ByteString aFileNameA( aFilename, osl_getThreadTextEncoding());
+    rtl::OString aFileNameA(rtl::OUStringToOString(aFilename, osl_getThreadTextEncoding()));
 #ifndef BOOTSTRAP
     FSysRedirector::DoRedirect( aFilename );
 #endif
@@ -442,7 +442,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode )
     }
 
     pInstanceData->hFile = CreateFile(
-        aFileNameA.GetBuffer(),
+        aFileNameA.getStr(),
         nAccessMode,
         nShareMode,
         (LPSECURITY_ATTRIBUTES)NULL,
@@ -476,7 +476,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode )
             nOpenAction = OPEN_EXISTING;
             SetLastError( ERROR_SUCCESS );
             pInstanceData->hFile = CreateFile(
-                aFileNameA.GetBuffer(),
+                aFileNameA.getStr(),
                 GENERIC_READ,
                 nShareMode,
                 (LPSECURITY_ATTRIBUTES)NULL,


More information about the Libreoffice-commits mailing list