basctl/source/dlged/dlgedobj.cxx |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 5e582b7755c9d1e7e358cf5734c8b93d5219622d
Author:     Armin Le Grand <armin.le.gr...@cib.de>
AuthorDate: Fri Oct 19 14:01:18 2018 +0200
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Tue Oct 23 23:06:23 2018 +0200

    tdf#120674 set DlgEdForm early in DlgEdObj::EndCreate
    
    Change-Id: I5ba0504265f5692614a8db0117883528bd4bfc0b
    Reviewed-on: https://gerrit.libreoffice.org/62000
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@cib.de>
    (cherry picked from commit 92b849b9297cbf78bddf5e48bdbd44303a7021db)
    Reviewed-on: https://gerrit.libreoffice.org/62224
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 8052f3cb159a..36e39f0d3b6a 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -946,6 +946,22 @@ bool DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd 
eCmd)
 {
     bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
 
+    // tdf#120674 after interactive creation, the SdrObject (this) has no 
SdrPage yet
+    // due to not being inserted. Usually this should be handled in a 
::handlePageChange
+    // implementation. For historical reasons, the SdrPage (which is the 
DlgEdPage) was
+    // already set. For now, get it from the SdrDragStat and use it to access 
and set
+    // the local pDlgEdForm
+    if(nullptr == pDlgEdForm && nullptr != rStat.GetPageView())
+    {
+        const DlgEdPage* pDlgEdPage(dynamic_cast<const 
DlgEdPage*>(rStat.GetPageView()->GetPage()));
+
+        if(nullptr != pDlgEdPage)
+        {
+            // set parent form
+            pDlgEdForm = pDlgEdPage->GetDlgEdForm();
+        }
+    }
+
     SetDefaults();
     StartListening();
 
@@ -954,9 +970,6 @@ bool DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd 
eCmd)
 
 void DlgEdObj::SetDefaults()
 {
-    // set parent form
-    pDlgEdForm = 
static_cast<DlgEdPage*>(getSdrPageFromSdrObject())->GetDlgEdForm();
-
     if ( pDlgEdForm )
     {
         // add child to parent form
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to