[Libreoffice-commits] core.git: Branch 'aoo/trunk' - svx/source sw/source

Armin Le Grand alg at apache.org
Tue Jun 18 07:07:32 PDT 2013


 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |   57 ++++++++++----------
 sw/source/core/draw/dcontact.cxx                    |   22 ++++++-
 2 files changed, 50 insertions(+), 29 deletions(-)

New commits:
commit 2c9c9923fdf042c41cebaf9a15def7caac86032d
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Jun 18 13:10:42 2013 +0000

    i121917 Corrected access to text object

diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index d093d0b..de12d70 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -156,6 +156,34 @@ void PosSizePropertyPanel::ShowMenu (void)
 
 
 
+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::NotifyItemUpdate(
     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::NotifyItemUpdate(
     }
 
     const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI());
+    const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
 
     switch (rMarkList.GetMarkCount())
     {
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index f55d031..32784e0 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2582,8 +2582,16 @@ basegfx::B2DPolyPolygon SwDrawVirtObj::TakeContour() const
 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 nHdlNum) const
 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;
 }


More information about the Libreoffice-commits mailing list