use more concrete UNO types in chart2

Change-Id: Id2d58ad76b6e8ff569bd7b65f86a7fdd0152f3d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173324
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-09-13 11:16:12 +02:00
parent 366dec115e
commit 451a66438a
10 changed files with 54 additions and 46 deletions

View file

@ -27,7 +27,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <rtl/ref.hxx>
#include <memory>
namespace com::sun::star::chart2 { class XAxis; }
@ -35,6 +35,8 @@ namespace com::sun::star::chart2 { class XAxis; }
namespace chart::wrapper
{
class Chart2ModelContact;
class TitleWrapper;
class GridWrapper;
class AxisWrapper : public ::cppu::ImplInheritanceHelper<
WrappedPropertySet
@ -113,9 +115,9 @@ private: //member
tAxisType m_eType;
css::uno::Reference< css::beans::XPropertySet > m_xAxisTitle;
css::uno::Reference< css::beans::XPropertySet > m_xMajorGrid;
css::uno::Reference< css::beans::XPropertySet > m_xMinorGrid;
rtl::Reference< TitleWrapper > m_xAxisTitle;
rtl::Reference< GridWrapper > m_xMajorGrid;
rtl::Reference< GridWrapper > m_xMinorGrid;
};
} // namespace chart::wrapper

View file

@ -858,7 +858,11 @@ void SAL_CALL ChartDocumentWrapper::dispose()
try
{
Reference< lang::XComponent > xFormerDelegator( m_xDelegator, uno::UNO_QUERY );
DisposeHelper::DisposeAndClear( m_xTitle );
if (m_xTitle)
{
m_xTitle->dispose();
m_xTitle.clear();
}
DisposeHelper::DisposeAndClear( m_xSubTitle );
DisposeHelper::DisposeAndClear( m_xLegend );
DisposeHelper::DisposeAndClear( m_xChartData );
@ -1344,11 +1348,11 @@ uno::Any SAL_CALL ChartDocumentWrapper::queryAggregation( const uno::Type& rType
// ____ ::utl::OEventListenerAdapter ____
void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource )
{
if( rSource.Source == m_xTitle )
if( rSource.Source == cppu::getXWeak(m_xTitle.get()) )
m_xTitle.clear();
else if( rSource.Source == m_xSubTitle )
else if( rSource.Source == cppu::getXWeak(m_xSubTitle.get()) )
m_xSubTitle.clear();
else if( rSource.Source == m_xLegend )
else if( rSource.Source == cppu::getXWeak(m_xLegend.get()) )
m_xLegend.clear();
else if( rSource.Source == m_xChartData )
m_xChartData.clear();

View file

@ -887,7 +887,7 @@ Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis()
{
if( ! m_xZAxis.is())
m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
return Reference< beans::XPropertySet >( m_xZAxis, uno::UNO_QUERY );
return m_xZAxis;
}
// ____ XTwoAxisXSupplier ____
@ -895,7 +895,7 @@ Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis()
{
if( ! m_xSecondXAxis.is())
m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
return Reference< beans::XPropertySet >( m_xSecondXAxis, uno::UNO_QUERY );
return m_xSecondXAxis;
}
// ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
@ -912,7 +912,7 @@ Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis()
{
if( ! m_xXAxis.is())
m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
return Reference< beans::XPropertySet >( m_xXAxis, uno::UNO_QUERY );
return m_xXAxis;
}
Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid()
@ -938,7 +938,7 @@ Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis()
{
if( ! m_xSecondYAxis.is())
m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
return Reference< beans::XPropertySet >( m_xSecondYAxis, uno::UNO_QUERY );
return m_xSecondYAxis;
}
// ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
@ -955,7 +955,7 @@ Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis()
{
if( ! m_xYAxis.is())
m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
return Reference< beans::XPropertySet >( m_xYAxis, uno::UNO_QUERY );
return m_xYAxis;
}
Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid()

View file

@ -43,7 +43,10 @@ namespace chart { class Diagram; }
namespace chart::wrapper
{
class AxisWrapper;
class WallFloorWrapper;
class MinMaxLineWrapper;
class UpDownBarWrapper;
class Chart2ModelContact;
class DiagramWrapper : public cppu::ImplInheritanceHelper<
@ -191,28 +194,16 @@ private:
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer;
css::uno::Reference<
css::chart::XAxis > m_xXAxis;
css::uno::Reference<
css::chart::XAxis > m_xYAxis;
css::uno::Reference<
css::chart::XAxis > m_xZAxis;
css::uno::Reference<
css::chart::XAxis > m_xSecondXAxis;
css::uno::Reference<
css::chart::XAxis > m_xSecondYAxis;
css::uno::Reference<
css::beans::XPropertySet > m_xWall;
css::uno::Reference<
css::beans::XPropertySet > m_xFloor;
css::uno::Reference<
css::beans::XPropertySet > m_xMinMaxLineWrapper;
css::uno::Reference<
css::beans::XPropertySet > m_xUpBarWrapper;
css::uno::Reference<
css::beans::XPropertySet > m_xDownBarWrapper;
rtl::Reference< AxisWrapper > m_xXAxis;
rtl::Reference< AxisWrapper > m_xYAxis;
rtl::Reference< AxisWrapper > m_xZAxis;
rtl::Reference< AxisWrapper > m_xSecondXAxis;
rtl::Reference< AxisWrapper > m_xSecondYAxis;
rtl::Reference< WallFloorWrapper > m_xWall;
rtl::Reference< WallFloorWrapper > m_xFloor;
rtl::Reference< MinMaxLineWrapper > m_xMinMaxLineWrapper;
rtl::Reference< UpDownBarWrapper > m_xUpBarWrapper;
rtl::Reference< UpDownBarWrapper > m_xDownBarWrapper;
};
} // namespace chart::wrapper

View file

@ -58,7 +58,6 @@ public:
virtual css::uno::Any getReferenceSize() override;
virtual css::awt::Size getCurrentSizeForReference() override;
private:
// ____ XShape ____
virtual css::awt::Point SAL_CALL getPosition() override;
virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
@ -95,6 +94,7 @@ private:
virtual const css::uno::Sequence< css::beans::Property >& getPropertySequence() override;
virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties() override;
private:
css::uno::Reference< css::chart2::XTitle > getTitleObject();
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;

View file

@ -36,8 +36,9 @@ namespace chart { class ChartView; }
namespace chart::wrapper
{
class DiagramWrapper;
class LegendWrapper;
class TitleWrapper;
class Chart2ModelContact;
class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper
@ -152,9 +153,9 @@ private: //member
css::uno::Reference< css::uno::XInterface > m_xDelegator;
css::uno::Reference< css::drawing::XShape > m_xTitle;
css::uno::Reference< css::drawing::XShape > m_xSubTitle;
css::uno::Reference< css::drawing::XShape > m_xLegend;
rtl::Reference< TitleWrapper > m_xTitle;
rtl::Reference< TitleWrapper > m_xSubTitle;
rtl::Reference< LegendWrapper > m_xLegend;
css::uno::Reference< css::chart::XChartData > m_xChartData;
rtl::Reference< DiagramWrapper > m_xDiagram;
css::uno::Reference< css::beans::XPropertySet > m_xArea;

View file

@ -438,9 +438,10 @@ void VDiagram::createShapes_3d()
rtl::Reference<SvxShapeGroupAnyD> xOuterGroup_Shapes = m_xOuterGroupShape;
//create additional group to manipulate the aspect ratio of the whole diagram:
xOuterGroup_Shapes = ShapeFactory::createGroup3D( xOuterGroup_Shapes );
rtl::Reference<Svx3DSceneObject> xAdditionalGroup = ShapeFactory::createGroup3D( xOuterGroup_Shapes );
xOuterGroup_Shapes = xAdditionalGroup;
m_xAspectRatio3D = xOuterGroup_Shapes;
m_xAspectRatio3D = xAdditionalGroup;
bool bAddFloorAndWall = m_xDiagram->isSupportingFloorAndWall();

View file

@ -97,7 +97,7 @@ private: //members
rtl::Reference< ::chart::Diagram > m_xDiagram;
css::drawing::Direction3D m_aPreferredAspectRatio;
css::uno::Reference< css::beans::XPropertySet > m_xAspectRatio3D;
rtl::Reference< Svx3DSceneObject > m_xAspectRatio3D;
double m_fXAnglePi;
double m_fYAnglePi;

View file

@ -23,6 +23,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <comphelper/comphelperdllapi.h>
#include <rtl/ref.hxx>
namespace com::sun::star::awt {
struct FontDescriptor;
@ -49,6 +50,15 @@ namespace comphelper
_rxComp = nullptr;
}
}
template <class TYPE>
void disposeComponent(rtl::Reference<TYPE>& _rxComp)
{
if (_rxComp.is())
{
_rxComp->dispose();
_rxComp = nullptr;
}
}
/** get a css::awt::FontDescriptor that is fully initialized with

View file

@ -665,11 +665,10 @@ class UNLESS_MERGELIBS(SAL_DLLPUBLIC_RTTI) Svx3DSceneObject final : public SvxSh
private:
rtl::Reference< SvxDrawPage > mxPage;
protected:
public:
using SvxShape::setPropertyValue;
using SvxShape::getPropertyValue;
public:
UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Svx3DSceneObject(SdrObject* pObj, SvxDrawPage* pDrawPage);
// override these for special property handling in subcasses. Return true if property is handled
virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue ) override;