diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-05-01 21:43:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-02 12:15:35 +0200 |
commit | 7a1f2f0b9906228ce970d48fef29dd25cd4cc55b (patch) | |
tree | 6e253b962e05261a3ac8e43090587bc1826b5de1 /svx/source/table/cell.cxx | |
parent | 41e3d2c936f008d010a64c00904539eed2392551 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/table/cell.cxx')
-rw-r--r-- | svx/source/table/cell.cxx | 69 |
1 files changed, 9 insertions, 60 deletions
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 <libxml/xmlwriter.h> #include <sdr/properties/textproperties.hxx> +#include <sdr/properties/cellproperties.hxx> #include <editeng/outlobj.hxx> #include <editeng/writingmodeitem.hxx> #include <svx/svdotable.hxx> @@ -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<BaseProperties> 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<BaseProperties> 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<sdr::properties::CellProperties const *>(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 ); } |