From 7e1bb64f1417e05ad29d20c6be212de68ce4a769 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 4 Dec 2015 13:27:18 +0200 Subject: loplugin:mergeclasses OOXMLPropertyImpl into OOXMLProperty Change-Id: I1447cfc76c529332450c90a21b6525d3103fe852 --- writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 8 +-- .../source/ooxml/OOXMLFastContextHandler.cxx | 63 +++++++++------------- writerfilter/source/ooxml/OOXMLPropertySet.cxx | 26 ++++----- writerfilter/source/ooxml/OOXMLPropertySet.hxx | 40 ++++---------- 4 files changed, 51 insertions(+), 86 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index 7846e1c310f3..5844c7599071 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -353,8 +353,8 @@ OOXMLPropertySet * OOXMLDocumentImpl::getPicturePropSet OOXMLValue::Pointer_t pPayloadValue(new OOXMLBinaryValue(pPicture)); OOXMLProperty::Pointer_t pPayloadProperty - (new OOXMLPropertyImpl(NS_ooxml::LN_payload, pPayloadValue, - OOXMLPropertyImpl::ATTRIBUTE)); + (new OOXMLProperty(NS_ooxml::LN_payload, pPayloadValue, + OOXMLProperty::ATTRIBUTE)); OOXMLPropertySet::Pointer_t pBlipSet(new OOXMLPropertySet); @@ -363,8 +363,8 @@ OOXMLPropertySet * OOXMLDocumentImpl::getPicturePropSet OOXMLValue::Pointer_t pBlipValue(new OOXMLPropertySetValue(pBlipSet)); OOXMLProperty::Pointer_t pBlipProperty - (new OOXMLPropertyImpl(NS_ooxml::LN_blip, pBlipValue, - OOXMLPropertyImpl::ATTRIBUTE)); + (new OOXMLProperty(NS_ooxml::LN_blip, pBlipValue, + OOXMLProperty::ATTRIBUTE)); OOXMLPropertySet * pProps = new OOXMLPropertySet; diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index cdf21d491e47..3f5e40422289 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -335,13 +335,13 @@ void OOXMLFastContextHandler::sendTableDepth() const { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth); OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_tblDepth, pVal, OOXMLPropertyImpl::SPRM)); + (new OOXMLProperty(NS_ooxml::LN_tblDepth, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(1); OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_inTbl, pVal, OOXMLPropertyImpl::SPRM)); + (new OOXMLProperty(NS_ooxml::LN_inTbl, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } @@ -420,7 +420,7 @@ void OOXMLFastContextHandler::startSdt() { OOXMLPropertySet * pProps = new OOXMLPropertySet; OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(1); - OOXMLProperty::Pointer_t pProp(new OOXMLPropertyImpl(NS_ooxml::LN_CT_SdtBlock_sdtContent, pVal, OOXMLPropertyImpl::ATTRIBUTE)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(NS_ooxml::LN_CT_SdtBlock_sdtContent, pVal, OOXMLProperty::ATTRIBUTE)); pProps->add(pProp); mpStream->props(writerfilter::Reference::Pointer_t(pProps)); } @@ -429,7 +429,7 @@ void OOXMLFastContextHandler::endSdt() { OOXMLPropertySet * pProps = new OOXMLPropertySet; OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(1); - OOXMLProperty::Pointer_t pProp(new OOXMLPropertyImpl(NS_ooxml::LN_CT_SdtBlock_sdtEndContent, pVal, OOXMLPropertyImpl::ATTRIBUTE)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(NS_ooxml::LN_CT_SdtBlock_sdtEndContent, pVal, OOXMLProperty::ATTRIBUTE)); pProps->add(pProp); mpStream->props(writerfilter::Reference::Pointer_t(pProps)); } @@ -656,8 +656,7 @@ void OOXMLFastContextHandler::propagateCharacterPropertiesAsSet(const Id & rId) OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet())); OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySet); - OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(rId, pValue, OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(rId, pValue, OOXMLProperty::SPRM)); pPropertySet->add(pProp); mpParserState->setCharacterProperties(pPropertySet); @@ -706,8 +705,7 @@ void OOXMLFastContextHandler::sendPropertiesWithId(const Id & rId) OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet())); OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySet); - OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(rId, pValue, OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(rId, pValue, OOXMLProperty::SPRM)); pPropertySet->add(pProp); mpStream->props(pPropertySet); @@ -834,9 +832,7 @@ void OOXMLFastContextHandler::sendPropertyToParent() if (pProps.get() != nullptr) { - OOXMLProperty::Pointer_t - pProp(new OOXMLPropertyImpl(mId, getValue(), - OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(mId, getValue(), OOXMLProperty::SPRM)); pProps->add(pProp); } } @@ -857,8 +853,7 @@ void OOXMLFastContextHandler::sendPropertiesToParent() OOXMLValue::Pointer_t pValue (new OOXMLPropertySetValue(getPropertySet())); - OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(getId(), pValue, OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(getId(), pValue, OOXMLProperty::SPRM)); pParentProps->add(pProp); @@ -889,8 +884,7 @@ void OOXMLFastContextHandlerStream::newProperty(const Id & rId, { if (rId != 0x0) { - OOXMLPropertyImpl::Pointer_t pProperty - (new OOXMLPropertyImpl(rId, pVal, OOXMLPropertyImpl::ATTRIBUTE)); + OOXMLProperty::Pointer_t pProperty(new OOXMLProperty(rId, pVal, OOXMLProperty::ATTRIBUTE)); mpPropertySetAttrs->add(pProperty); } @@ -964,8 +958,7 @@ void OOXMLFastContextHandlerProperties::newProperty { if (rId != 0x0) { - OOXMLPropertyImpl::Pointer_t pProperty - (new OOXMLPropertyImpl(rId, pVal, OOXMLPropertyImpl::ATTRIBUTE)); + OOXMLProperty::Pointer_t pProperty(new OOXMLProperty(rId, pVal, OOXMLProperty::ATTRIBUTE)); mpPropertySet->add(pProperty); } @@ -1303,20 +1296,17 @@ void OOXMLFastContextHandlerTextTableCell::endCell() OOXMLPropertySet * pProps = new OOXMLPropertySet; { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth); - OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_tblDepth, pVal, OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(NS_ooxml::LN_tblDepth, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(1); - OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_inTbl, pVal, OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(NS_ooxml::LN_inTbl, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } { OOXMLValue::Pointer_t pVal = OOXMLBooleanValue::Create(mnTableDepth > 0); - OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_tblCell, pVal, OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(NS_ooxml::LN_tblCell, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } @@ -1351,20 +1341,17 @@ void OOXMLFastContextHandlerTextTableRow::endRow() OOXMLPropertySet * pProps = new OOXMLPropertySet; { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth); - OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_tblDepth, pVal, OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(NS_ooxml::LN_tblDepth, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(1); - OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_inTbl, pVal, OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(NS_ooxml::LN_inTbl, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(1); - OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_tblRow, pVal, OOXMLPropertyImpl::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(NS_ooxml::LN_tblRow, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } @@ -1398,19 +1385,19 @@ void OOXMLFastContextHandlerTextTableRow::handleGridBefore( OOXMLValue::Pointer_ { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth); OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_tblDepth, pVal, OOXMLPropertyImpl::SPRM)); + (new OOXMLProperty(NS_ooxml::LN_tblDepth, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(1); OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_inTbl, pVal, OOXMLPropertyImpl::SPRM)); + (new OOXMLProperty(NS_ooxml::LN_inTbl, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } { OOXMLValue::Pointer_t pVal = OOXMLBooleanValue::Create(mnTableDepth > 0); OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_tblCell, pVal, OOXMLPropertyImpl::SPRM)); + (new OOXMLProperty(NS_ooxml::LN_tblCell, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } @@ -1426,7 +1413,7 @@ void OOXMLFastContextHandlerTextTableRow::handleGridBefore( OOXMLValue::Pointer_ pBorderProps->add( fakeNoBorder( borders[ j ] )); OOXMLValue::Pointer_t pValue( new OOXMLPropertySetValue( pBorderProps )); OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_CT_TcPrBase_tcBorders, pValue, OOXMLPropertyImpl::SPRM)); + (new OOXMLProperty(NS_ooxml::LN_CT_TcPrBase_tcBorders, pValue, OOXMLProperty::SPRM)); pCellProps->add(pProp); mpParserState->setCellProperties(pCellProps); } @@ -1442,11 +1429,11 @@ OOXMLProperty::Pointer_t OOXMLFastContextHandlerTextTableRow::fakeNoBorder( Id i OOXMLPropertySet::Pointer_t pProps( new OOXMLPropertySet ); OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(0); OOXMLProperty::Pointer_t pPropVal - (new OOXMLPropertyImpl(NS_ooxml::LN_CT_Border_val, pVal, OOXMLPropertyImpl::ATTRIBUTE)); + (new OOXMLProperty(NS_ooxml::LN_CT_Border_val, pVal, OOXMLProperty::ATTRIBUTE)); pProps->add(pPropVal); OOXMLValue::Pointer_t pValue( new OOXMLPropertySetValue( pProps )); OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(id, pValue, OOXMLPropertyImpl::SPRM)); + (new OOXMLProperty(id, pValue, OOXMLProperty::SPRM)); return pProp; } @@ -1477,7 +1464,7 @@ void OOXMLFastContextHandlerTextTable::lcl_startFastElement { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth); OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_tblStart, pVal, OOXMLPropertyImpl::SPRM)); + (new OOXMLProperty(NS_ooxml::LN_tblStart, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } mpParserState->setCharacterProperties(pProps); @@ -1495,7 +1482,7 @@ void OOXMLFastContextHandlerTextTable::lcl_endFastElement { OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth); OOXMLProperty::Pointer_t pProp - (new OOXMLPropertyImpl(NS_ooxml::LN_tblEnd, pVal, OOXMLPropertyImpl::SPRM)); + (new OOXMLProperty(NS_ooxml::LN_tblEnd, pVal, OOXMLProperty::SPRM)); pProps->add(pProp); } mpParserState->setCharacterProperties(pProps); @@ -2036,7 +2023,7 @@ void OOXMLFastContextHandlerMath::process() { OOXMLPropertySet * pProps = new OOXMLPropertySet; OOXMLValue::Pointer_t pVal( new OOXMLStarMathValue( ref )); - OOXMLProperty::Pointer_t pProp( new OOXMLPropertyImpl( NS_ooxml::LN_starmath, pVal, OOXMLPropertyImpl::ATTRIBUTE )); + OOXMLProperty::Pointer_t pProp( new OOXMLProperty( NS_ooxml::LN_starmath, pVal, OOXMLProperty::ATTRIBUTE )); pProps->add( pProp ); mpStream->props( writerfilter::Reference< Properties >::Pointer_t( pProps )); } diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx b/writerfilter/source/ooxml/OOXMLPropertySet.cxx index d783d09de248..9ca93cddd1fd 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx +++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx @@ -30,31 +30,27 @@ namespace ooxml using namespace ::std; using namespace com::sun::star; -OOXMLProperty::~OOXMLProperty() -{ -} - -OOXMLPropertyImpl::OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue, - OOXMLPropertyImpl::Type_t eType) +OOXMLProperty::OOXMLProperty(Id id, OOXMLValue::Pointer_t pValue, + OOXMLProperty::Type_t eType) : mId(id), mpValue(pValue), meType(eType) { } -OOXMLPropertyImpl::OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm) -: OOXMLProperty(), mId(rSprm.mId), mpValue(rSprm.mpValue), meType(rSprm.meType) +OOXMLProperty::OOXMLProperty(const OOXMLProperty & rSprm) +: mId(rSprm.mId), mpValue(rSprm.mpValue), meType(rSprm.meType) { } -OOXMLPropertyImpl::~OOXMLPropertyImpl() +OOXMLProperty::~OOXMLProperty() { } -sal_uInt32 OOXMLPropertyImpl::getId() const +sal_uInt32 OOXMLProperty::getId() const { return mId; } -Value::Pointer_t OOXMLPropertyImpl::getValue() +Value::Pointer_t OOXMLProperty::getValue() { Value::Pointer_t pResult; @@ -66,7 +62,7 @@ Value::Pointer_t OOXMLPropertyImpl::getValue() return pResult; } -writerfilter::Reference::Pointer_t OOXMLPropertyImpl::getProps() +writerfilter::Reference::Pointer_t OOXMLProperty::getProps() { writerfilter::Reference::Pointer_t pResult; @@ -77,7 +73,7 @@ writerfilter::Reference::Pointer_t OOXMLPropertyImpl::getProps() } #ifdef DEBUG_WRITERFILTER -string OOXMLPropertyImpl::getName() const +string OOXMLProperty::getName() const { string sResult; @@ -99,7 +95,7 @@ string OOXMLPropertyImpl::getName() const #endif #ifdef DEBUG_WRITERFILTER -string OOXMLPropertyImpl::toString() const +string OOXMLProperty::toString() const { string sResult = "("; @@ -115,7 +111,7 @@ string OOXMLPropertyImpl::toString() const } #endif -void OOXMLPropertyImpl::resolve(writerfilter::Properties & rProperties) +void OOXMLProperty::resolve(writerfilter::Properties & rProperties) { writerfilter::Properties * pProperties = nullptr; pProperties = &rProperties; diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.hxx b/writerfilter/source/ooxml/OOXMLPropertySet.hxx index 3d4467d2f31f..aa528a7a9590 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySet.hxx +++ b/writerfilter/source/ooxml/OOXMLPropertySet.hxx @@ -28,23 +28,6 @@ namespace writerfilter { namespace ooxml { -class OOXMLProperty : public Sprm -{ -public: - typedef std::shared_ptr Pointer_t; - - virtual ~OOXMLProperty(); - - virtual sal_uInt32 getId() const override = 0; - virtual Value::Pointer_t getValue() override = 0; - virtual writerfilter::Reference::Pointer_t getProps() override = 0; -#ifdef DEBUG_WRITERFILTER - virtual std::string getName() const override = 0; - virtual std::string toString() const override = 0; -#endif - virtual void resolve(Properties & rProperties) = 0; -}; - class OOXMLValue : public Value { public: @@ -64,9 +47,10 @@ public: virtual OOXMLValue * clone() const; }; -class OOXMLPropertyImpl : public OOXMLProperty +class OOXMLProperty : public Sprm { public: + typedef std::shared_ptr Pointer_t; enum Type_t { SPRM, ATTRIBUTE }; private: Id mId; @@ -74,20 +58,18 @@ private: Type_t meType; public: - typedef std::shared_ptr Pointer_t; - - OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue, Type_t eType); - OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm); - virtual ~OOXMLPropertyImpl(); + OOXMLProperty(Id id, OOXMLValue::Pointer_t pValue, Type_t eType); + OOXMLProperty(const OOXMLProperty & rSprm); + virtual ~OOXMLProperty(); - virtual sal_uInt32 getId() const override; - virtual Value::Pointer_t getValue() override; - virtual writerfilter::Reference::Pointer_t getProps() override; + sal_uInt32 getId() const; + Value::Pointer_t getValue(); + writerfilter::Reference::Pointer_t getProps(); #ifdef DEBUG_WRITERFILTER - virtual std::string getName() const override; - virtual std::string toString() const override; + std::string getName() const; + std::string toString() const; #endif - virtual void resolve(Properties & rProperties) override; + void resolve(Properties & rProperties); }; class OOXMLBinaryValue : public OOXMLValue -- cgit