chart2/source/view/axes/VCartesianAxis.cxx |   16 +++++-----------
 chart2/source/view/charttypes/BarChart.cxx |   16 +++++-----------
 2 files changed, 10 insertions(+), 22 deletions(-)

New commits:
commit 3311d213dd6163154f962b0616567e5a78f2c0b6
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Jan 3 14:24:14 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jan 3 16:48:54 2022 +0100

    use more SvxShape in chart2
    
    Change-Id: If39b252369d4e5b0add99b7357c5af5b50391818
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127892
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/view/axes/VCartesianAxis.cxx 
b/chart2/source/view/axes/VCartesianAxis.cxx
index 758369fc15de..120513ee9831 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -175,8 +175,8 @@ static void lcl_getRotatedPolygon( B2DPolygon &aPoly, const 
::basegfx::B2DRectan
     aPoly.transform( aMatrix );
 }
 
-static bool doesOverlap( const Reference< drawing::XShape >& xShape1
-                , const Reference< drawing::XShape >& xShape2
+static bool doesOverlap( const rtl::Reference<SvxShapeText>& xShape1
+                , const rtl::Reference<SvxShapeText>& xShape2
                 , double fRotationAngleDegree )
 {
     if( !xShape1.is() || !xShape2.is() )
@@ -343,12 +343,11 @@ static void lcl_shiftLabels( TickIter& rIter, const 
B2DVector& rStaggerDistance
 {
     if(rStaggerDistance.getLength()==0.0)
         return;
-    Reference< drawing::XShape >  xShape2DText;
     for( TickInfo* pTickInfo = rIter.firstInfo()
         ; pTickInfo
         ; pTickInfo = rIter.nextInfo() )
     {
-        xShape2DText = pTickInfo->xTextShape;
+        const rtl::Reference<SvxShapeText>& xShape2DText = 
pTickInfo->xTextShape;
         if( xShape2DText.is() )
         {
             awt::Point aPos  = xShape2DText->getPosition();
@@ -359,17 +358,12 @@ static void lcl_shiftLabels( TickIter& rIter, const 
B2DVector& rStaggerDistance
     }
 }
 
-static bool lcl_hasWordBreak( const Reference<drawing::XShape>& xShape )
+static bool lcl_hasWordBreak( const rtl::Reference<SvxShapeText>& xShape )
 {
     if (!xShape.is())
         return false;
 
-    SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>(xShape);
-    SvxShapeText* pShapeText = dynamic_cast<SvxShapeText*>(pShape);
-    if (!pShapeText)
-        return false;
-
-    SvxTextEditSource* pTextEditSource = 
dynamic_cast<SvxTextEditSource*>(pShapeText->GetEditSource());
+    SvxTextEditSource* pTextEditSource = 
dynamic_cast<SvxTextEditSource*>(xShape->GetEditSource());
     if (!pTextEditSource)
         return false;
 
diff --git a/chart2/source/view/charttypes/BarChart.cxx 
b/chart2/source/view/charttypes/BarChart.cxx
index a106e95a2823..314149f21bcf 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -441,11 +441,6 @@ void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis()
     }
 }
 
-static E3dScene* lcl_getE3dScene(uno::Reference<uno::XInterface> const & 
xInterface)
-{
-    return 
dynamic_cast<E3dScene*>(SdrObject::getSdrObjectFromXShape(xInterface));
-}
-
 void BarChart::createShapes()
 {
     if( m_aZSlots.empty() ) //no series
@@ -476,15 +471,15 @@ void BarChart::createShapes()
     bool bDrawConnectionLinesInited = false;
     bool bOnlyConnectionLinesForThisPoint = false;
 
-    std::unordered_set<uno::Reference<drawing::XShape>> aShapeSet;
+    std::unordered_set<rtl::Reference<SvxShape>> aShapeSet;
 
     const comphelper::ScopeGuard aGuard([aShapeSet]() {
 
         std::unordered_set<E3dScene*> aSceneSet;
 
-        for (uno::Reference<drawing::XShape> const & rShape : aShapeSet)
+        for (rtl::Reference<SvxShape> const & rShape : aShapeSet)
         {
-            E3dScene* pScene = lcl_getE3dScene(rShape);
+            E3dScene* pScene = dynamic_cast<E3dScene*>(rShape->GetSdrObject());
             if(nullptr != pScene)
             {
                 aSceneSet.insert(pScene->getRootE3dSceneFromE3dObject());
@@ -626,10 +621,9 @@ void BarChart::createShapes()
                     }
 
                     rtl::Reference<SvxShapeGroupAnyD> 
xSeriesGroupShape_Shapes(getSeriesGroupShape(pSeries.get(), xSeriesTarget));
-                    uno::Reference<drawing::XShape>  
xSeriesGroupShape(static_cast<cppu::OWeakObject*>(xSeriesGroupShape_Shapes.get()),
 uno::UNO_QUERY);
                     // Suspend setting rects dirty for the duration of this 
call
-                    aShapeSet.insert(xSeriesGroupShape);
-                    E3dScene* pScene = lcl_getE3dScene(xSeriesGroupShape);
+                    aShapeSet.insert(xSeriesGroupShape_Shapes);
+                    E3dScene* pScene = 
dynamic_cast<E3dScene*>(xSeriesGroupShape_Shapes->GetSdrObject());
                     if (pScene)
                         pScene->SuspendReportingDirtyRects();
 

Reply via email to