You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/06/18 15:10:42 UTC

svn commit: r1494127 - in /openoffice/trunk/main: svx/source/sidebar/possize/PosSizePropertyPanel.cxx sw/source/core/draw/dcontact.cxx

Author: alg
Date: Tue Jun 18 13:10:42 2013
New Revision: 1494127

URL: http://svn.apache.org/r1494127
Log:
i121917 Corrected access to text object

Modified:
    openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
    openoffice/trunk/main/sw/source/core/draw/dcontact.cxx

Modified: openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx?rev=1494127&r1=1494126&r2=1494127&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx Tue Jun 18 13:10:42 2013
@@ -156,6 +156,34 @@ void PosSizePropertyPanel::ShowMenu (voi
 
 
 
+namespace
+{
+    bool hasText(const SdrView& rSdrView)
+    {
+        const SdrMarkList& rMarkList = rSdrView.GetMarkedObjectList();
+
+        if(1 == rMarkList.GetMarkCount())
+        {
+            const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+            const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier());
+
+            if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind))
+            {
+                const SdrTextObj* pSdrTextObj = dynamic_cast< const SdrTextObj* >(pObj);
+
+                if(pSdrTextObj && pSdrTextObj->HasText())
+                {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+} // end of anonymous namespace
+
+
+
 void PosSizePropertyPanel::Initialize()
 {
     mpFtPosX->SetBackground(Wallpaper());
@@ -228,18 +256,7 @@ void PosSizePropertyPanel::Initialize()
     if ( mpView != NULL )
     {
         maUIScale = mpView->GetModel()->GetUIScale();
-
-        const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
-        if(1 == rMarkList.GetMarkCount())
-        {
-            const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-            const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier());
-
-            if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText())
-            {
-                mbAdjustEnabled = true;
-            }
-        }
+        mbAdjustEnabled = hasText(*mpView);
     }
     
     mePoolUnit = maTransfWidthControl.GetCoreMetric();
@@ -705,20 +722,7 @@ void PosSizePropertyPanel::NotifyItemUpd
     if ( mpView == NULL )
         return;
 
-    const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
-
-    if(1 == rMarkList.GetMarkCount())
-    {
-        const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-        const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier());
-
-        if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText())
-            mbAdjustEnabled = true;
-        else
-            mbAdjustEnabled = false;
-    }
-    else
-        mbAdjustEnabled = false;
+    mbAdjustEnabled = hasText(*mpView);
 
     // Pool unit and dialog unit may have changed, make sure that we
     // have the current values.
@@ -942,6 +946,7 @@ void PosSizePropertyPanel::NotifyItemUpd
     }
 
     const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI());
+    const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
 
     switch (rMarkList.GetMarkCount())
     {

Modified: openoffice/trunk/main/sw/source/core/draw/dcontact.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/draw/dcontact.cxx?rev=1494127&r1=1494126&r2=1494127&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/draw/dcontact.cxx (original)
+++ openoffice/trunk/main/sw/source/core/draw/dcontact.cxx Tue Jun 18 13:10:42 2013
@@ -2582,8 +2582,16 @@ basegfx::B2DPolyPolygon SwDrawVirtObj::T
 SdrHdl* SwDrawVirtObj::GetHdl(sal_uInt32 nHdlNum) const
 {
 	SdrHdl* pHdl = rRefObj.GetHdl(nHdlNum);
-    Point aP(pHdl->GetPos() + GetOffset());
-	pHdl->SetPos(aP);
+
+    if(pHdl)
+    {
+        Point aP(pHdl->GetPos() + GetOffset());
+        pHdl->SetPos(aP);
+    }
+    else
+    {
+        OSL_ENSURE(false, "Got no SdrHdl(!)");
+    }
 
 	return pHdl;
 }
@@ -2591,7 +2599,15 @@ SdrHdl* SwDrawVirtObj::GetHdl(sal_uInt32
 SdrHdl* SwDrawVirtObj::GetPlusHdl(const SdrHdl& rHdl, sal_uInt16 nPlNum) const
 {
 	SdrHdl* pHdl = rRefObj.GetPlusHdl(rHdl, nPlNum);
-    pHdl->SetPos(pHdl->GetPos() + GetOffset());
+
+    if(pHdl)
+    {
+        pHdl->SetPos(pHdl->GetPos() + GetOffset());
+    }
+    else
+    {
+        OSL_ENSURE(false, "Got no SdrHdl(!)");
+    }
 
 	return pHdl;
 }