From 7a1f2f0b9906228ce970d48fef29dd25cd4cc55b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 1 May 2023 21:43:32 +0200 Subject: use more specific class in sdr::table::Cell mpProperties always points at a CellProperties object. Change-Id: Ie78d015a23b48c5b40cbf3564974870e49a0b2af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151239 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svx/source/table/cell.cxx | 69 +++++++---------------------------------------- 1 file changed, 9 insertions(+), 60 deletions(-) (limited to 'svx/source/table/cell.cxx') diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index d1dbd0f8088f..432084a40b83 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -108,22 +109,8 @@ static const SvxItemPropertySet* ImplGetSvxCellPropertySet() return &aSvxCellPropertySet; } -namespace -{ - -class CellTextProvider : public svx::ITextProvider +namespace sdr::properties { -public: - explicit CellTextProvider(sdr::table::CellRef xCell); - virtual ~CellTextProvider(); - -private: - virtual sal_Int32 getTextCount() const override; - virtual SdrText* getText(sal_Int32 nIndex) const override; - -private: - const sdr::table::CellRef m_xCell; -}; CellTextProvider::CellTextProvider(sdr::table::CellRef xCell) : m_xCell(std::move(xCell)) @@ -146,40 +133,6 @@ SdrText* CellTextProvider::getText(sal_Int32 nIndex) const return m_xCell.get(); } -} - -namespace sdr::properties -{ - class CellProperties : public TextProperties - { - protected: - // create a new itemset - SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; - - const svx::ITextProvider& getTextProvider() const override; - - public: - // basic constructor - CellProperties(SdrObject& rObj, sdr::table::Cell* pCell ); - - // constructor for copying, but using new object - CellProperties(const CellProperties& rProps, SdrObject& rObj, sdr::table::Cell* pCell); - - // Clone() operator, normally just calls the local copy constructor - std::unique_ptr Clone(SdrObject& rObj) const override; - - void ForceDefaultAttributes() override; - - void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; - - void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; - - sdr::table::CellRef mxCell; - - private: - const CellTextProvider maTextProvider; - }; - // create a new itemset SfxItemSet CellProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { @@ -216,6 +169,10 @@ namespace sdr::properties { } + CellProperties::~CellProperties() + { + } + std::unique_ptr CellProperties::Clone(SdrObject& rObj) const { OSL_FAIL("CellProperties::Clone(), does not work yet!"); @@ -826,19 +783,11 @@ void Cell::AddUndo() } } - -sdr::properties::TextProperties* Cell::CloneProperties( sdr::properties::TextProperties const * pProperties, SdrObject& rNewObj, Cell& rNewCell ) +sdr::properties::CellProperties* Cell::CloneProperties( SdrObject& rNewObj, Cell& rNewCell ) { - if( pProperties ) - return new sdr::properties::CellProperties( *static_cast(pProperties), rNewObj, &rNewCell ); - else + if (!mpProperties) return nullptr; -} - - -sdr::properties::TextProperties* Cell::CloneProperties( SdrObject& rNewObj, Cell& rNewCell ) -{ - return CloneProperties(mpProperties.get(),rNewObj,rNewCell); + return new sdr::properties::CellProperties( *mpProperties, rNewObj, &rNewCell ); } -- cgit