chart2/source/inc/ChartType.hxx                       |    8 ++++++++
 chart2/source/inc/ChartViewHelper.hxx                 |   14 ++++----------
 chart2/source/inc/OPropertySet.hxx                    |    6 +++---
 chart2/source/model/main/UndoManager.cxx              |   13 +++++++------
 chart2/source/model/main/UndoManager.hxx              |    3 ++-
 chart2/source/model/template/PieChartType.cxx         |   15 ++++-----------
 chart2/source/model/template/PieChartTypeTemplate.cxx |   17 ++++++++---------
 chart2/source/tools/ChartTypeHelper.cxx               |    4 ++--
 chart2/source/tools/ChartViewHelper.cxx               |   10 +++++-----
 chart2/source/view/charttypes/PieChart.cxx            |    4 ++--
 chart2/source/view/charttypes/VSeriesPlotter.cxx      |    3 ++-
 chart2/source/view/main/SeriesPlotterContainer.cxx    |    8 +++++---
 12 files changed, 52 insertions(+), 53 deletions(-)

New commits:
commit 6213787202570f783458a2d00351851ad46150d7
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Mar 29 10:06:21 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Mar 29 13:00:24 2023 +0000

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

diff --git a/chart2/source/inc/ChartViewHelper.hxx 
b/chart2/source/inc/ChartViewHelper.hxx
index 54d23e8107a0..06fef6a1ff9b 100644
--- a/chart2/source/inc/ChartViewHelper.hxx
+++ b/chart2/source/inc/ChartViewHelper.hxx
@@ -19,22 +19,16 @@
 #pragma once
 
 #include "charttoolsdllapi.hxx"
-
-namespace com::sun::star::uno
-{
-template <class interface_type> class Reference;
-}
-namespace com::sun::star::frame
-{
-class XModel;
-}
+#include <rtl/ref.hxx>
 
 namespace chart
 {
+class ChartModel;
+
 class OOO_DLLPUBLIC_CHARTTOOLS ChartViewHelper
 {
 public:
-    static void setViewToDirtyState(const 
css::uno::Reference<css::frame::XModel>& xChartModel);
+    static void setViewToDirtyState(const rtl::Reference<::chart::ChartModel>& 
xChartModel);
 };
 
 } //namespace chart
diff --git a/chart2/source/model/main/UndoManager.cxx 
b/chart2/source/model/main/UndoManager.cxx
index 63dacf48444c..a756e7440a75 100644
--- a/chart2/source/model/main/UndoManager.cxx
+++ b/chart2/source/model/main/UndoManager.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "UndoManager.hxx"
+#include <ChartModel.hxx>
 #include <ChartViewHelper.hxx>
 
 #include <com/sun/star/frame/XModel.hpp>
@@ -49,7 +50,7 @@ namespace chart
         class UndoManager_Impl : public ::framework::IUndoManagerImplementation
         {
         public:
-            UndoManager_Impl( UndoManager& i_antiImpl, ::cppu::OWeakObject& 
i_parent, ::osl::Mutex& i_mutex )
+            UndoManager_Impl( UndoManager& i_antiImpl, ::chart::ChartModel& 
i_parent, ::osl::Mutex& i_mutex )
                 :m_rAntiImpl( i_antiImpl )
                 ,m_rParent( i_parent )
                 ,m_rMutex( i_mutex )
@@ -70,7 +71,7 @@ namespace chart
             virtual Reference< XUndoManager >   getThis() override;
 
             // attribute access
-            ::cppu::OWeakObject&                getParent() { return 
m_rParent; }
+            ::chart::ChartModel&                getParent() { return 
m_rParent; }
             ::framework::UndoManagerHelper&     getUndoHelper() { return 
m_aUndoHelper; }
 
             // public interface
@@ -83,7 +84,7 @@ namespace chart
 
         private:
             UndoManager&                        m_rAntiImpl;
-            ::cppu::OWeakObject&                m_rParent;
+            ::chart::ChartModel&                m_rParent;
             ::osl::Mutex&                       m_rMutex;
             bool                                m_bDisposed;
 
@@ -172,7 +173,7 @@ namespace chart
 
     using impl::UndoManagerMethodGuard;
 
-    UndoManager::UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& 
i_mutex )
+    UndoManager::UndoManager( ::chart::ChartModel& i_parent, ::osl::Mutex& 
i_mutex )
         :m_pImpl( new impl::UndoManager_Impl( *this, i_parent, i_mutex ) )
     {
     }
@@ -225,7 +226,7 @@ namespace chart
         UndoManagerMethodGuard aGuard( *m_pImpl );
         m_pImpl->getUndoHelper().undo( aGuard );
 
-        ChartViewHelper::setViewToDirtyState( Reference< XModel >( 
getParent(), UNO_QUERY ) );
+        ChartViewHelper::setViewToDirtyState( &m_pImpl->getParent() );
     }
 
     void SAL_CALL UndoManager::redo(  )
@@ -233,7 +234,7 @@ namespace chart
         UndoManagerMethodGuard aGuard( *m_pImpl );
         m_pImpl->getUndoHelper().redo( aGuard );
 
-        ChartViewHelper::setViewToDirtyState( Reference< XModel >( 
getParent(), UNO_QUERY ) );
+        ChartViewHelper::setViewToDirtyState( &m_pImpl->getParent() );
     }
 
     sal_Bool SAL_CALL UndoManager::isUndoPossible(  )
diff --git a/chart2/source/model/main/UndoManager.hxx 
b/chart2/source/model/main/UndoManager.hxx
index 4d0a214e5a70..c20dcef6643d 100644
--- a/chart2/source/model/main/UndoManager.hxx
+++ b/chart2/source/model/main/UndoManager.hxx
@@ -28,6 +28,7 @@
 
 namespace chart
 {
+class ChartModel;
 
     namespace impl
     {
@@ -40,7 +41,7 @@ namespace chart
     class UndoManager : public impl::UndoManager_Base
     {
     public:
-        UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex );
+        UndoManager( ::chart::ChartModel& i_parent, ::osl::Mutex& i_mutex );
         virtual ~UndoManager();
 
         // XInterface
diff --git a/chart2/source/tools/ChartViewHelper.cxx 
b/chart2/source/tools/ChartViewHelper.cxx
index 67dc781892ad..183d28189531 100644
--- a/chart2/source/tools/ChartViewHelper.cxx
+++ b/chart2/source/tools/ChartViewHelper.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <ChartViewHelper.hxx>
+#include <ChartModel.hxx>
 #include <servicenames.hxx>
 
 #include <com/sun/star/frame/XModel.hpp>
@@ -30,18 +31,17 @@ namespace chart
 using namespace ::com::sun::star;
 using ::com::sun::star::uno::Reference;
 
-void ChartViewHelper::setViewToDirtyState(const uno::Reference<frame::XModel>& 
xChartModel)
+void ChartViewHelper::setViewToDirtyState(const 
rtl::Reference<::chart::ChartModel>& xChartModel)
 {
     try
     {
-        uno::Reference<lang::XMultiServiceFactory> xFact(xChartModel, 
uno::UNO_QUERY);
-        if (xFact.is())
+        if (xChartModel.is())
         {
             Reference<util::XModifyListener> xModifyListener(
-                xFact->createInstance(CHART_VIEW_SERVICE_NAME), 
uno::UNO_QUERY);
+                xChartModel->createInstance(CHART_VIEW_SERVICE_NAME), 
uno::UNO_QUERY);
             if (xModifyListener.is())
             {
-                lang::EventObject aEvent(xChartModel);
+                lang::EventObject 
aEvent(static_cast<cppu::OWeakObject*>(xChartModel.get()));
                 xModifyListener->modified(aEvent);
             }
         }
commit 23c2fb9dbfa5b3eca64ba8aef1a82f9c60d39397
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Mar 29 09:04:29 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Mar 29 13:00:17 2023 +0000

    use more get/setFastPropertyValue in pie charts
    
    Change-Id: I17bf8631b5934d6d112f17e4a05025802dcde2f3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149685
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/inc/ChartType.hxx b/chart2/source/inc/ChartType.hxx
index 5849f611a3c8..267d06f406de 100644
--- a/chart2/source/inc/ChartType.hxx
+++ b/chart2/source/inc/ChartType.hxx
@@ -38,6 +38,14 @@ class BaseCoordinateSystem;
 class DataSeries;
 class ModifyEventForwarder;
 
+enum
+{
+    PROP_PIECHARTTYPE_USE_RINGS,
+    PROP_PIECHARTTYPE_3DRELATIVEHEIGHT
+};
+
+
+
 namespace impl
 {
 typedef ::cppu::WeakImplHelper<
diff --git a/chart2/source/inc/OPropertySet.hxx 
b/chart2/source/inc/OPropertySet.hxx
index f851c8c365f1..d78312878798 100644
--- a/chart2/source/inc/OPropertySet.hxx
+++ b/chart2/source/inc/OPropertySet.hxx
@@ -138,15 +138,15 @@ protected:
         ( css::uno::Any& rValue,
           sal_Int32 nHandle ) const override;
 
-    /// make original interface function visible again
-    using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
-
     /** implement this method in derived classes to get called when properties
         change.
      */
     virtual void firePropertyChangeEvent();
 
 public:
+    /// make original interface function visible again
+    using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
+
     // Interfaces
 
     // ____ XInterface ____
diff --git a/chart2/source/model/template/PieChartType.cxx 
b/chart2/source/model/template/PieChartType.cxx
index fdbfc7cedb5e..dc45c24b1af4 100644
--- a/chart2/source/model/template/PieChartType.cxx
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -37,21 +37,14 @@ using ::com::sun::star::uno::Reference;
 namespace
 {
 
-enum
-{
-    PROP_PIECHARTTYPE_USE_RINGS,
-    PROP_PIECHARTTYPE_3DRELATIVEHEIGHT
-};
-
-
 ::chart::tPropertyValueMap& StaticPieChartTypeDefaults()
 {
     static ::chart::tPropertyValueMap aStaticDefaults =
         []()
         {
             ::chart::tPropertyValueMap aOutMap;
-            ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, 
PROP_PIECHARTTYPE_USE_RINGS, false );
-            ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( 
aOutMap, PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 );
+            ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, 
::chart::PROP_PIECHARTTYPE_USE_RINGS, false );
+            ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( 
aOutMap, ::chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 );
             return aOutMap;
         }();
     return aStaticDefaults;
@@ -64,12 +57,12 @@ enum
         {
             std::vector< css::beans::Property > aProperties {
                 { "UseRings",
-                  PROP_PIECHARTTYPE_USE_RINGS,
+                  ::chart::PROP_PIECHARTTYPE_USE_RINGS,
                   cppu::UnoType<bool>::get(),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT },
                 { "3DRelativeHeight",
-                  PROP_PIECHARTTYPE_3DRELATIVEHEIGHT,
+                  ::chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT,
                   cppu::UnoType<sal_Int32>::get(),
                   beans::PropertyAttribute::MAYBEVOID }
             };
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx 
b/chart2/source/model/template/PieChartTypeTemplate.cxx
index c14458870d58..021b3ab6c8f2 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -251,8 +251,8 @@ void PieChartTypeTemplate::createChartTypes(
     try
     {
         rtl::Reference< ChartType > xCT = new PieChartType();
-        xCT->setPropertyValue(
-            "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
+        xCT->setFastPropertyValue(
+            PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( 
PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings"
         rCoordSys[0]->setChartTypes( std::vector{xCT} );
 
         if( !aSeriesSeq.empty() )
@@ -348,10 +348,9 @@ bool PieChartTypeTemplate::matchesTemplate2(
     //check UseRings
     if( bResult )
     {
-        rtl::Reference< ChartType > xCTProp =
-            xDiagram->getChartTypeByIndex( 0 );
+        rtl::Reference< ChartType > xCTProp = xDiagram->getChartTypeByIndex( 0 
);
         bool bUseRings = false;
-        if( xCTProp->getPropertyValue( "UseRings") >>= bUseRings )
+        if( xCTProp->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= 
bUseRings ) // "UseRings"
         {
             bResult = ( bTemplateUsesRings == bUseRings );
         }
@@ -367,8 +366,8 @@ rtl::Reference< ChartType > 
PieChartTypeTemplate::getChartTypeForIndex( sal_Int3
     try
     {
         xResult = new PieChartType();
-        xResult->setPropertyValue(
-            "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
+        xResult->setFastPropertyValue(
+            PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( 
PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings"
     }
     catch( const uno::Exception & )
     {
@@ -387,8 +386,8 @@ rtl::Reference< ChartType > 
PieChartTypeTemplate::getChartTypeForNewSeries2(
     {
         xResult = new PieChartType();
         ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( 
aFormerlyUsedChartTypes, xResult );
-        xResult->setPropertyValue(
-            "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
+        xResult->setFastPropertyValue(
+            PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( 
PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings"
     }
     catch( const uno::Exception & )
     {
diff --git a/chart2/source/tools/ChartTypeHelper.cxx 
b/chart2/source/tools/ChartTypeHelper.cxx
index b393b344fb0d..15f00eac6fa9 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -252,7 +252,7 @@ uno::Sequence < sal_Int32 > 
ChartTypeHelper::getSupportedLabelPlacements( const
     if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
     {
         bool bDonut = false;
-        xChartType->getPropertyValue( "UseRings") >>= bDonut;
+        xChartType->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= 
bDonut; // "UseRings"
 
         if(!bDonut)
         {
@@ -593,7 +593,7 @@ sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries(
             if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
             {
                 bool bDonut = false;
-                if( (xChartType->getPropertyValue( "UseRings") >>= bDonut)
+                if( (xChartType->getFastPropertyValue( 
PROP_PIECHARTTYPE_USE_RINGS ) >>= bDonut) // "UseRings"
                     && !bDonut )
                 {
                     return nNumberOfSeries>0 ? 1 : 0;
diff --git a/chart2/source/view/charttypes/PieChart.cxx 
b/chart2/source/view/charttypes/PieChart.cxx
index d98fd62e771f..5e8cb88bc910 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -207,7 +207,7 @@ PieChart::PieChart( const rtl::Reference<ChartType>& 
xChartTypeModel
 
     try
     {
-        xChartTypeModel->getPropertyValue( "UseRings") >>= m_bUseRings;
+        xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_USE_RINGS) >>= 
m_bUseRings; //  "UseRings"
         if( m_bUseRings )
         {
             m_pPosHelper->m_fRadiusOffset = 1.0;
@@ -730,7 +730,7 @@ void PieChart::createShapes()
     {
         try
         {
-            uno::Any aAny = m_xChartTypeModel->getPropertyValue( 
"3DRelativeHeight" );
+            uno::Any aAny = m_xChartTypeModel->getFastPropertyValue( 
PROP_PIECHARTTYPE_3DRELATIVEHEIGHT ); // "3DRelativeHeight"
             aAny >>= n3DRelativeHeight;
         }
         catch (const uno::Exception&) { }
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 2b3cebbd59ce..35f13c7d3184 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2731,7 +2731,8 @@ std::vector< ViewLegendEntry > 
VSeriesPlotter::createLegendEntriesForSeries(
             if (bIsPie)
             {
                 bool bDonut = false;
-                if ((m_xChartTypeModel->getPropertyValue("UseRings") >>= 
bDonut) && bDonut)
+                // "UseRings"
+                if 
((m_xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_USE_RINGS) >>= 
bDonut) && bDonut)
                     bIsPie = false;
             }
         }
diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx 
b/chart2/source/view/main/SeriesPlotterContainer.cxx
index 30b2ba8edcb5..de8c2c78cd4f 100644
--- a/chart2/source/view/main/SeriesPlotterContainer.cxx
+++ b/chart2/source/view/main/SeriesPlotterContainer.cxx
@@ -212,11 +212,13 @@ void 
SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart
                 try
                 {
                     sal_Int32 n3DRelativeHeightOldValue(100);
-                    uno::Any aAny = 
xChartType->getPropertyValue("3DRelativeHeight");
+                    uno::Any aAny = xChartType->getFastPropertyValue(
+                        PROP_PIECHARTTYPE_3DRELATIVEHEIGHT); // 
"3DRelativeHeight"
                     aAny >>= n3DRelativeHeightOldValue;
                     if (n3DRelativeHeightOldValue != n3DRelativeHeight)
-                        xChartType->setPropertyValue("3DRelativeHeight",
-                                                     
uno::Any(n3DRelativeHeight));
+                        xChartType->setFastPropertyValue(
+                            PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, // 
"3DRelativeHeight"
+                            uno::Any(n3DRelativeHeight));
                 }
                 catch (const uno::Exception&)
                 {

Reply via email to