chart2/source/inc/chartview/DrawModelWrapper.hxx |    6 ++---
 chart2/source/view/axes/VCartesianAxis.cxx       |   18 ++++++----------
 chart2/source/view/inc/LabelPositionHelper.hxx   |    2 -
 chart2/source/view/main/DrawModelWrapper.cxx     |   25 ++++-------------------
 chart2/source/view/main/LabelPositionHelper.cxx  |    2 -
 chart2/source/view/main/VLegend.cxx              |    4 +--
 6 files changed, 19 insertions(+), 38 deletions(-)

New commits:
commit 8f0ce842dffe229d31bd9841ac6e999da1ae976d
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Jan 3 14:01:48 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jan 3 14:57:57 2022 +0100

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

diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx 
b/chart2/source/inc/chartview/DrawModelWrapper.hxx
index fcf684eedfa4..acd829394c26 100644
--- a/chart2/source/inc/chartview/DrawModelWrapper.hxx
+++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx
@@ -20,6 +20,7 @@
 
 #include <svx/svdmodel.hxx>
 #include <svx/unopage.hxx>
+#include <svx/unoshape.hxx>
 #include <chartview/chartviewdllapi.hxx>
 
 namespace com::sun::star::lang { class XMultiServiceFactory; }
@@ -55,7 +56,7 @@ public:
     // the extra page is not visible, but contains some extras like the 
symbols for data points
     const rtl::Reference<SvxDrawPage> & getHiddenDrawPage();
 
-    static css::uno::Reference< css::drawing::XShapes >
+    static rtl::Reference<SvxShapeGroupAnyD>
          getChartRootShape( const rtl::Reference<SvxDrawPage>& xPage );
 
     SAL_DLLPRIVATE void lockControllers();
@@ -82,8 +83,7 @@ public:
     SdrObject* getNamedSdrObject( const OUString& rName );
     static SdrObject* getNamedSdrObject( const OUString& rName, SdrObjList 
const * pObjList );
 
-    static bool removeShape( const css::uno::Reference< css::drawing::XShape 
>& xShape );
-    static bool removeShape( SvxShape& rShape );
+    static bool removeShape( const rtl::Reference<SvxShape>& xShape );
 
     void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx 
b/chart2/source/view/axes/VCartesianAxis.cxx
index be2b09a53cd2..758369fc15de 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -1762,7 +1762,7 @@ void VCartesianAxis::updatePositions()
     {
         for (auto const& tickInfo : tickInfos)
         {
-            Reference< drawing::XShape > xShape2DText(tickInfo.xTextShape);
+            const rtl::Reference<SvxShapeText> & 
xShape2DText(tickInfo.xTextShape);
             if( xShape2DText.is() )
             {
                 B2DVector aTextToTickDistance( 
pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties, true ) );
@@ -1787,17 +1787,13 @@ void VCartesianAxis::updatePositions()
                 uno::Any aATransformation = 
ShapeFactory::makeTransformation(aAnchorScreenPosition2D, fRotationAnglePi);
 
                 //set new position
-                uno::Reference< beans::XPropertySet > xProp( xShape2DText, 
uno::UNO_QUERY );
-                if( xProp.is() )
+                try
                 {
-                    try
-                    {
-                        xProp->setPropertyValue( "Transformation", 
aATransformation );
-                    }
-                    catch( const uno::Exception& )
-                    {
-                        TOOLS_WARN_EXCEPTION("chart2", "" );
-                    }
+                    xShape2DText->SvxShape::setPropertyValue( 
"Transformation", aATransformation );
+                }
+                catch( const uno::Exception& )
+                {
+                    TOOLS_WARN_EXCEPTION("chart2", "" );
                 }
 
                 //correctPositionForRotation
diff --git a/chart2/source/view/inc/LabelPositionHelper.hxx 
b/chart2/source/view/inc/LabelPositionHelper.hxx
index ee1c7c8f0105..63125d621731 100644
--- a/chart2/source/view/inc/LabelPositionHelper.hxx
+++ b/chart2/source/view/inc/LabelPositionHelper.hxx
@@ -50,7 +50,7 @@ public:
                     , const css::uno::Reference< css::beans::XPropertySet >& 
xAxisModelProps
                     , const css::awt::Size& rNewReferenceSize );
 
-    static void correctPositionForRotation( const css::uno::Reference< 
css::drawing::XShape >& xShape2DText
+    static void correctPositionForRotation( const 
rtl::Reference<SvxShapeText>& xShape2DText
                     , LabelAlignment eLabelAlignment, const double 
fRotationAngle, bool bRotateAroundCenter );
 
 protected:
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx 
b/chart2/source/view/main/DrawModelWrapper.cxx
index 5bc5c9e87e13..f5d7e7e5ba81 100644
--- a/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -191,7 +191,7 @@ const rtl::Reference<SvxDrawPage> & 
DrawModelWrapper::getHiddenDrawPage()
 void DrawModelWrapper::clearMainDrawPage()
 {
     //uno::Reference<drawing::XShapes> xChartRoot( m_xMainDrawPage, 
uno::UNO_QUERY );
-    uno::Reference<drawing::XShapes> xChartRoot( 
ShapeFactory::getChartRootShape( m_xMainDrawPage ) );
+    rtl::Reference<SvxShapeGroupAnyD> xChartRoot( 
ShapeFactory::getChartRootShape( m_xMainDrawPage ) );
     if( xChartRoot.is() )
     {
         sal_Int32 nSubCount = xChartRoot->getCount();
@@ -204,7 +204,7 @@ void DrawModelWrapper::clearMainDrawPage()
     }
 }
 
-uno::Reference< drawing::XShapes > DrawModelWrapper::getChartRootShape( const 
rtl::Reference<SvxDrawPage>& xDrawPage )
+rtl::Reference<SvxShapeGroupAnyD> DrawModelWrapper::getChartRootShape( const 
rtl::Reference<SvxDrawPage>& xDrawPage )
 {
     return ShapeFactory::getChartRootShape( xDrawPage );
 }
@@ -287,27 +287,12 @@ SdrObject* DrawModelWrapper::getNamedSdrObject( const 
OUString& rObjectCID, SdrO
     return nullptr;
 }
 
-bool DrawModelWrapper::removeShape( const uno::Reference< drawing::XShape >& 
xShape )
+bool DrawModelWrapper::removeShape( const rtl::Reference<SvxShape>& xShape )
 {
-    uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
-    if( xChild.is() )
-    {
-        uno::Reference<drawing::XShapes> xShapes( xChild->getParent(), 
uno::UNO_QUERY );
-        if( xShapes.is() )
-        {
-            xShapes->remove(xShape);
-            return true;
-        }
-    }
-    return false;
-}
-
-bool DrawModelWrapper::removeShape( SvxShape& rShape )
-{
-    uno::Reference<drawing::XShapes> xShapes( rShape.getParent(), 
uno::UNO_QUERY );
+    uno::Reference<drawing::XShapes> xShapes( xShape->getParent(), 
uno::UNO_QUERY );
     if( xShapes.is() )
     {
-        xShapes->remove(&rShape);
+        xShapes->remove(xShape);
         return true;
     }
     return false;
diff --git a/chart2/source/view/main/LabelPositionHelper.cxx 
b/chart2/source/view/main/LabelPositionHelper.cxx
index a632947758c9..ec169ce4f4cc 100644
--- a/chart2/source/view/main/LabelPositionHelper.cxx
+++ b/chart2/source/view/main/LabelPositionHelper.cxx
@@ -412,7 +412,7 @@ void lcl_correctRotation_Right_Bottom( double& 
rfXCorrection, double& rfYCorrect
 
 }//end anonymous namespace
 
-void LabelPositionHelper::correctPositionForRotation( const uno::Reference< 
drawing::XShape >& xShape2DText
+void LabelPositionHelper::correctPositionForRotation( const 
rtl::Reference<SvxShapeText>& xShape2DText
                      , LabelAlignment eLabelAlignment, const double 
fRotationAngle, bool bRotateAroundCenter )
 {
     if( !xShape2DText.is() )
diff --git a/chart2/source/view/main/VLegend.cxx 
b/chart2/source/view/main/VLegend.cxx
index 4b81cbdbd30b..6acfbb14d4ce 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -407,7 +407,7 @@ awt::Size lcl_placeLegendEntries(
                     }
                     if( nEntry < nNumberOfEntries && ( nEntry != 0 || 
nNumberOfColumns != 1 ) )
                     {
-                        DrawModelWrapper::removeShape( *rEntries[ nEntry 
].xSymbol );
+                        DrawModelWrapper::removeShape( rEntries[ nEntry 
].xSymbol );
                         rEntries.pop_back();
                         nNumberOfEntries--;
                     }
@@ -441,7 +441,7 @@ awt::Size lcl_placeLegendEntries(
                         }
                         if (aTextShapes.size() == 0)
                         {
-                            
DrawModelWrapper::removeShape(*rEntries[0].xSymbol);
+                            DrawModelWrapper::removeShape(rEntries[0].xSymbol);
                             rEntries.pop_back();
                             nNumberOfEntries--;
                             aRowHeights.pop_back();

Reply via email to