[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - reportdesign/inc reportdesign/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jul 30 15:52:35 UTC 2018


 reportdesign/inc/RptObject.hxx             |    2 
 reportdesign/source/core/sdr/RptObject.cxx |   97 ++++++++++++++---------------
 2 files changed, 50 insertions(+), 49 deletions(-)

New commits:
commit 90c11ceeb32e8c2fd59028befd726e807a8188cf
Author:     Armin Le Grand <Armin.Le.Grand at cib.de>
AuthorDate: Wed Jul 25 14:10:08 2018 +0200
Commit:     Armin Le Grand <Armin.Le.Grand at cib.de>
CommitDate: Mon Jul 30 17:52:22 2018 +0200

    tdf#118730 Correct ReportDesigner Object creation
    
    This is a follow up problem to removing the old stuff
    that first a SdrPage* at the SdrObjects was set *without*
    the SdrObject being inserted to any SdrObjList. It works
    no longer - the SdrPage which you can get now is the one
    the SdrObject *is* inserted at.
    Solution is to move that stuff - plus other initializations
    which were done in OUnoObject::EndCreate before - to where
    it belongs. This gets rid of OUnoObject::EndCreate
    completely.
    It makes OUnoObject::impl_setReportComponent_nothrow no
    longer needed due to being used only in one place. All
    initializations move to OUnoObject::CreateMediator which
    anyways needs to be done when a OUnoObject got created.
    
    Change-Id: I86f968dc6e867c5752d3c8cee1b3b2af57e467c8
    Reviewed-on: https://gerrit.libreoffice.org/57976
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>
    (cherry picked from commit 96b338e62c422ccd23cd33b3f87a463730221514)
    Reviewed-on: https://gerrit.libreoffice.org/58321

diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx
index b078e1f7d143..3a4c6cbe35de 100644
--- a/reportdesign/inc/RptObject.hxx
+++ b/reportdesign/inc/RptObject.hxx
@@ -246,7 +246,6 @@ protected:
     virtual void NbcMove( const Size& rSize ) override;
     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
     virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
-    virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
 
     virtual SdrPage* GetImplPage() const override;
 
@@ -272,7 +271,6 @@ public:
 
 private:
     virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& rxUnoShape ) override;
-    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 85a50a242c58..47191497712b 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -640,18 +640,6 @@ void OUnoObject::impl_initializeModel_nothrow()
     }
 }
 
-void OUnoObject::impl_setReportComponent_nothrow()
-{
-    if ( m_xReportComponent.is() )
-        return;
-
-    OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
-    OXUndoEnvironment::OUndoEnvLock aLock( rRptModel.GetUndoEnv() );
-    m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
-
-    impl_initializeModel_nothrow();
-}
-
 sal_uInt16 OUnoObject::GetObjIdentifier() const
 {
     return m_nObjectType;
@@ -743,37 +731,6 @@ void OUnoObject::NbcSetLogicRect(const tools::Rectangle& rRect)
     OObjectBase::StartListening();
 }
 
-
-bool OUnoObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
-{
-    bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
-    if ( bResult )
-    {
-        impl_setReportComponent_nothrow();
-        // set labels
-        if ( m_xReportComponent.is() )
-        {
-            try
-            {
-                if ( supportsService( SERVICE_FIXEDTEXT ) )
-                {
-                    m_xReportComponent->setPropertyValue( PROPERTY_LABEL, uno::makeAny(GetDefaultName(this)) );
-                }
-            }
-            catch(const uno::Exception&)
-            {
-                DBG_UNHANDLED_EXCEPTION("reportdesign");
-            }
-
-            impl_initializeModel_nothrow();
-        }
-        // set geometry properties
-        SetPropsFromRect(GetLogicRect());
-    }
-
-    return bResult;
-}
-
 OUString OUnoObject::GetDefaultName(const OUnoObject* _pObj)
 {
     OUString aDefaultName = "HERE WE HAVE TO INSERT OUR NAME!";
@@ -857,11 +814,57 @@ void OUnoObject::CreateMediator(bool _bReverse)
 {
     if ( !m_xMediator.is() )
     {
-        impl_setReportComponent_nothrow();
+        // tdf#118730 Directly do thinigs formerly done in
+        // OUnoObject::impl_setReportComponent_nothrow here
+        if(!m_xReportComponent.is())
+        {
+            OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+            OXUndoEnvironment::OUndoEnvLock aLock( rRptModel.GetUndoEnv() );
+            m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
+
+            impl_initializeModel_nothrow();
+        }
+
+        // tdf#118730 Directly do thinigs formerly done in
+        // OUnoObject::EndCreate here
+        if(m_xReportComponent.is())
+        {
+            // set labels
+            if ( m_xReportComponent.is() )
+            {
+                try
+                {
+                    if ( supportsService( SERVICE_FIXEDTEXT ) )
+                    {
+                        m_xReportComponent->setPropertyValue( PROPERTY_LABEL, uno::makeAny(GetDefaultName(this)) );
+                    }
+                }
+                catch(const uno::Exception&)
+                {
+                    DBG_UNHANDLED_EXCEPTION("reportdesign");
+                }
+
+                impl_initializeModel_nothrow();
+            }
+        }
+
+        // tdf#118730 set geometry properties
+        SetPropsFromRect(GetLogicRect());
+
+        if(!m_xMediator.is() && m_xReportComponent.is())
+        {
+            Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
+
+            if(xControlModel.is())
+            {
+                m_xMediator = new OPropertyMediator(
+                    m_xReportComponent.get(),
+                    xControlModel,
+                    getPropertyNameMap(GetObjIdentifier()),
+                    _bReverse);
+            }
+        }
 
-        Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
-        if ( !m_xMediator.is() && m_xReportComponent.is() && xControlModel.is() )
-            m_xMediator = new OPropertyMediator(m_xReportComponent.get(),xControlModel,getPropertyNameMap(GetObjIdentifier()),_bReverse);
         OObjectBase::StartListening();
     }
 }


More information about the Libreoffice-commits mailing list