loplugin:mergeclasses, merge OOXMLPropertyImpl into OOXMLProperty

Change-Id: I73eb7e664c0a53f135c06c3d8ea450bd9493c780
This commit is contained in:
Noel Grandin
2015-12-04 12:50:17 +02:00
parent 958b9a7fbd
commit 9f0f30fa35
11 changed files with 322 additions and 385 deletions

View File

@@ -395,7 +395,6 @@ merge writerfilter::dmapper::TableManager with writerfilter::dmapper::DomainMapp
merge writerfilter::ooxml::OOXMLDocument with writerfilter::ooxml::OOXMLDocumentImpl
merge writerfilter::ooxml::OOXMLFastContextHandlerLinear with writerfilter::ooxml::OOXMLFastContextHandlerMath
merge writerfilter::ooxml::OOXMLProperty with writerfilter::ooxml::OOXMLPropertyImpl
merge writerfilter::ooxml::OOXMLPropertySet with writerfilter::ooxml::OOXMLPropertySetImpl
merge writerfilter::ooxml::OOXMLStream with writerfilter::ooxml::OOXMLStreamImpl
merge writerfilter::rtftok::RTFDocument with writerfilter::rtftok::RTFDocumentImpl
merge ww8::WW8Struct with ww8::WW8Sttb

View File

@@ -10,7 +10,7 @@
from libreoffice.util import printing
class OOXMLPropertySetPrinter(object):
'''Prints writerfilter::ooxml::OOXMLPropertySetImpl'''
'''Prints writerfilter::ooxml::OOXMLPropertySet'''
def __init__(self, typename, value):
self.typename = typename
@@ -74,7 +74,7 @@ def build_pretty_printers():
printer = printing.Printer("libreoffice/writerfilter")
printer.add('writerfilter::ooxml::OOXMLPropertyImpl', OOXMLPropertyPrinter)
printer.add('writerfilter::ooxml::OOXMLPropertySetImpl', OOXMLPropertySetPrinter)
printer.add('writerfilter::ooxml::OOXMLPropertySet', OOXMLPropertySetPrinter)
printer.add('writerfilter::ooxml::OOXMLPropertySetValue', OOXMLPropertySetValuePrinter)
printer.add('writerfilter::ooxml::OOXMLStringValue', OOXMLStringValuePrinter)
printer.add('writerfilter::ooxml::OOXMLIntegerValue', OOXMLIntegerValuePrinter)

View File

@@ -123,7 +123,7 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\
writerfilter/source/ooxml/OOXMLFastContextHandler \
writerfilter/source/ooxml/OOXMLFastDocumentHandler \
writerfilter/source/ooxml/OOXMLParserState \
writerfilter/source/ooxml/OOXMLPropertySetImpl \
writerfilter/source/ooxml/OOXMLPropertySet \
writerfilter/source/ooxml/OOXMLStreamImpl \
writerfilter/source/ooxml/qnametostrcore \
))

View File

@@ -31,7 +31,7 @@
#include "OOXMLDocumentImpl.hxx"
#include "OOXMLBinaryObjectReference.hxx"
#include "OOXMLFastDocumentHandler.hxx"
#include "OOXMLPropertySetImpl.hxx"
#include "OOXMLPropertySet.hxx"
#include <tools/resmgr.hxx>
#include <vcl/svapp.hxx>
@@ -356,7 +356,7 @@ OOXMLPropertySet * OOXMLDocumentImpl::getPicturePropSet
(new OOXMLPropertyImpl(NS_ooxml::LN_payload, pPayloadValue,
OOXMLPropertyImpl::ATTRIBUTE));
OOXMLPropertySet::Pointer_t pBlipSet(new OOXMLPropertySetImpl());
OOXMLPropertySet::Pointer_t pBlipSet(new OOXMLPropertySet);
pBlipSet->add(pPayloadProperty);
@@ -366,7 +366,7 @@ OOXMLPropertySet * OOXMLDocumentImpl::getPicturePropSet
(new OOXMLPropertyImpl(NS_ooxml::LN_blip, pBlipValue,
OOXMLPropertyImpl::ATTRIBUTE));
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
OOXMLPropertySet * pProps = new OOXMLPropertySet;
pProps->add(pBlipProperty);

View File

@@ -331,7 +331,7 @@ void OOXMLFastContextHandler::sendTableDepth() const
{
if (mnTableDepth > 0)
{
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
OOXMLPropertySet * pProps = new OOXMLPropertySet;
{
OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth);
OOXMLProperty::Pointer_t pProp
@@ -418,7 +418,7 @@ void OOXMLFastContextHandler::endParagraphGroup()
void OOXMLFastContextHandler::startSdt()
{
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
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));
pProps->add(pProp);
@@ -427,7 +427,7 @@ void OOXMLFastContextHandler::startSdt()
void OOXMLFastContextHandler::endSdt()
{
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
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));
pProps->add(pProp);
@@ -654,7 +654,7 @@ void OOXMLFastContextHandler::propagateCharacterProperties()
void OOXMLFastContextHandler::propagateCharacterPropertiesAsSet(const Id & rId)
{
OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet()));
OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySetImpl());
OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySet);
OOXMLProperty::Pointer_t pProp
(new OOXMLPropertyImpl(rId, pValue, OOXMLPropertyImpl::SPRM));
@@ -698,13 +698,13 @@ void OOXMLFastContextHandler::sendTableProperties()
void OOXMLFastContextHandler::clearTableProps()
{
mpParserState->setTableProperties(OOXMLPropertySet::Pointer_t
(new OOXMLPropertySetImpl()));
(new OOXMLPropertySet));
}
void OOXMLFastContextHandler::sendPropertiesWithId(const Id & rId)
{
OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet()));
OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySetImpl());
OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySet);
OOXMLProperty::Pointer_t pProp
(new OOXMLPropertyImpl(rId, pValue, OOXMLPropertyImpl::SPRM));
@@ -715,7 +715,7 @@ void OOXMLFastContextHandler::sendPropertiesWithId(const Id & rId)
void OOXMLFastContextHandler::clearProps()
{
setPropertySet(OOXMLPropertySet::Pointer_t(new OOXMLPropertySetImpl()));
setPropertySet(OOXMLPropertySet::Pointer_t(new OOXMLPropertySet));
}
void OOXMLFastContextHandler::setDefaultBooleanValue()
@@ -876,7 +876,7 @@ void OOXMLFastContextHandler::sendPropertiesToParent()
OOXMLFastContextHandlerStream::OOXMLFastContextHandlerStream
(OOXMLFastContextHandler * pContext)
: OOXMLFastContextHandler(pContext),
mpPropertySetAttrs(new OOXMLPropertySetImpl())
mpPropertySetAttrs(new OOXMLPropertySet)
{
}
@@ -924,7 +924,7 @@ void OOXMLFastContextHandlerStream::handleHyperlink()
*/
OOXMLFastContextHandlerProperties::OOXMLFastContextHandlerProperties
(OOXMLFastContextHandler * pContext)
: OOXMLFastContextHandler(pContext), mpPropertySet(new OOXMLPropertySetImpl()),
: OOXMLFastContextHandler(pContext), mpPropertySet(new OOXMLPropertySet),
mbResolve(false)
{
if (pContext->getResource() == STREAM)
@@ -1300,7 +1300,7 @@ void OOXMLFastContextHandlerTextTableCell::endCell()
{
if (isForwardEvents())
{
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
OOXMLPropertySet * pProps = new OOXMLPropertySet;
{
OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth);
OOXMLProperty::Pointer_t pProp
@@ -1348,7 +1348,7 @@ void OOXMLFastContextHandlerTextTableRow::endRow()
if (isForwardEvents())
{
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
OOXMLPropertySet * pProps = new OOXMLPropertySet;
{
OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth);
OOXMLProperty::Pointer_t pProp
@@ -1394,7 +1394,7 @@ void OOXMLFastContextHandlerTextTableRow::handleGridBefore( OOXMLValue::Pointer_
if (isForwardEvents())
{
// This whole part is OOXMLFastContextHandlerTextTableCell::endCell() .
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
OOXMLPropertySet * pProps = new OOXMLPropertySet;
{
OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth);
OOXMLProperty::Pointer_t pProp
@@ -1417,9 +1417,9 @@ void OOXMLFastContextHandlerTextTableRow::handleGridBefore( OOXMLValue::Pointer_
mpStream->props(writerfilter::Reference<Properties>::Pointer_t(pProps));
// fake <w:tcBorders> with no border
OOXMLPropertySet::Pointer_t pCellProps( new OOXMLPropertySetImpl());
OOXMLPropertySet::Pointer_t pCellProps( new OOXMLPropertySet );
{
OOXMLPropertySet::Pointer_t pBorderProps( new OOXMLPropertySetImpl());
OOXMLPropertySet::Pointer_t pBorderProps( new OOXMLPropertySet );
static Id borders[] = { NS_ooxml::LN_CT_TcBorders_top, NS_ooxml::LN_CT_TcBorders_bottom,
NS_ooxml::LN_CT_TcBorders_start, NS_ooxml::LN_CT_TcBorders_end };
for( size_t j = 0; j < SAL_N_ELEMENTS( borders ); ++j )
@@ -1439,7 +1439,7 @@ void OOXMLFastContextHandlerTextTableRow::handleGridBefore( OOXMLValue::Pointer_
OOXMLProperty::Pointer_t OOXMLFastContextHandlerTextTableRow::fakeNoBorder( Id id )
{
OOXMLPropertySet::Pointer_t pProps( new OOXMLPropertySetImpl());
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));
@@ -1473,7 +1473,7 @@ void OOXMLFastContextHandlerTextTable::lcl_startFastElement
mpParserState->startTable();
mnTableDepth++;
std::shared_ptr<OOXMLPropertySet> pProps( new OOXMLPropertySetImpl );
std::shared_ptr<OOXMLPropertySet> pProps( new OOXMLPropertySet );
{
OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth);
OOXMLProperty::Pointer_t pProp
@@ -1491,7 +1491,7 @@ void OOXMLFastContextHandlerTextTable::lcl_endFastElement
{
endAction(Element);
std::shared_ptr<OOXMLPropertySet> pProps( new OOXMLPropertySetImpl );
std::shared_ptr<OOXMLPropertySet> pProps( new OOXMLPropertySet );
{
OOXMLValue::Pointer_t pVal = OOXMLIntegerValue::Create(mnTableDepth);
OOXMLProperty::Pointer_t pProp
@@ -2034,7 +2034,7 @@ void OOXMLFastContextHandlerMath::process()
import.readFormulaOoxml(buffer);
if (isForwardEvents())
{
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
OOXMLPropertySet * pProps = new OOXMLPropertySet;
OOXMLValue::Pointer_t pVal( new OOXMLStarMathValue( ref ));
OOXMLProperty::Pointer_t pProp( new OOXMLPropertyImpl( NS_ooxml::LN_starmath, pVal, OOXMLPropertyImpl::ATTRIBUTE ));
pProps->add( pProp );

View File

@@ -29,7 +29,7 @@
#include "cppuhelper/implbase.hxx"
#include "com/sun/star/xml/sax/XFastContextHandler.hpp"
#include "OOXMLParserState.hxx"
#include "OOXMLPropertySetImpl.hxx"
#include "OOXMLPropertySet.hxx"
#include "OOXMLDocumentImpl.hxx"
#include <oox/token/tokens.hxx>
#include <svtools/embedhlp.hxx>

View File

@@ -118,7 +118,7 @@ void OOXMLParserState::resolveCharacterProperties(Stream & rStream)
if (mpCharacterProps.get() != nullptr)
{
rStream.props(mpCharacterProps);
mpCharacterProps.reset(new OOXMLPropertySetImpl());
mpCharacterProps.reset(new OOXMLPropertySet);
}
}
@@ -165,7 +165,7 @@ void OOXMLParserState::resolveCellProperties(Stream & rStream)
if (rCellProps.get() != nullptr)
{
rStream.props(rCellProps);
rCellProps.reset(new OOXMLPropertySetImpl());
rCellProps.reset(new OOXMLPropertySet);
}
}
}
@@ -179,7 +179,7 @@ void OOXMLParserState::resolveRowProperties(Stream & rStream)
if (rRowProps.get() != nullptr)
{
rStream.props(rRowProps);
rRowProps.reset(new OOXMLPropertySetImpl());
rRowProps.reset(new OOXMLPropertySet);
}
}
}

View File

@@ -21,7 +21,7 @@
#include <stack>
#include "OOXMLDocumentImpl.hxx"
#include "OOXMLPropertySetImpl.hxx"
#include "OOXMLPropertySet.hxx"
namespace writerfilter {
namespace ooxml

View File

@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "OOXMLPropertySetImpl.hxx"
#include "OOXMLPropertySet.hxx"
#include <stdio.h>
#include <iostream>
#include <ooxml/QNameToString.hxx>
@@ -34,10 +34,6 @@ OOXMLProperty::~OOXMLProperty()
{
}
OOXMLPropertySet::~OOXMLPropertySet()
{
}
OOXMLPropertyImpl::OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue,
OOXMLPropertyImpl::Type_t eType)
: mId(id), mpValue(pValue), meType(eType)
@@ -347,7 +343,7 @@ OOXMLValue * OOXMLInputStreamValue::clone() const
struct OOXMLPropertySetImplCompare
*/
bool OOXMLPropertySetImplCompare::operator()(const OOXMLProperty::Pointer_t& x,
bool OOXMLPropertySetCompare::operator()(const OOXMLProperty::Pointer_t& x,
const OOXMLProperty::Pointer_t& y) const
{
bool bResult = false;
@@ -361,20 +357,19 @@ bool OOXMLPropertySetImplCompare::operator()(const OOXMLProperty::Pointer_t& x,
}
/**
class OOXMLPropertySetImpl
class OOXMLPropertySet
*/
OOXMLPropertySetImpl::OOXMLPropertySetImpl()
OOXMLPropertySet::OOXMLPropertySet()
{
static OString aName("OOXMLPropertySetImpl");
maType = aName;
maType = "OOXMLPropertySet";
}
OOXMLPropertySetImpl::~OOXMLPropertySetImpl()
OOXMLPropertySet::~OOXMLPropertySet()
{
}
void OOXMLPropertySetImpl::resolve(Properties & rHandler)
void OOXMLPropertySet::resolve(Properties & rHandler)
{
// The pProp->resolve(rHandler) call below can cause elements to
// be appended to mProperties. I don't think it can cause elements
@@ -389,29 +384,29 @@ void OOXMLPropertySetImpl::resolve(Properties & rHandler)
}
}
OOXMLPropertySetImpl::OOXMLProperties_t::iterator OOXMLPropertySetImpl::begin()
OOXMLPropertySet::OOXMLProperties_t::iterator OOXMLPropertySet::begin()
{
return mProperties.begin();
}
OOXMLPropertySetImpl::OOXMLProperties_t::iterator OOXMLPropertySetImpl::end()
OOXMLPropertySet::OOXMLProperties_t::iterator OOXMLPropertySet::end()
{
return mProperties.end();
}
OOXMLPropertySetImpl::OOXMLProperties_t::const_iterator
OOXMLPropertySetImpl::begin() const
OOXMLPropertySet::OOXMLProperties_t::const_iterator
OOXMLPropertySet::begin() const
{
return mProperties.begin();
}
OOXMLPropertySetImpl::OOXMLProperties_t::const_iterator
OOXMLPropertySetImpl::end() const
OOXMLPropertySet::OOXMLProperties_t::const_iterator
OOXMLPropertySet::end() const
{
return mProperties.end();
}
void OOXMLPropertySetImpl::add(OOXMLProperty::Pointer_t pProperty)
void OOXMLPropertySet::add(OOXMLProperty::Pointer_t pProperty)
{
if (pProperty.get() != nullptr && pProperty->getId() != 0x0)
{
@@ -419,12 +414,11 @@ void OOXMLPropertySetImpl::add(OOXMLProperty::Pointer_t pProperty)
}
}
void OOXMLPropertySetImpl::add(OOXMLPropertySet::Pointer_t pPropertySet)
void OOXMLPropertySet::add(OOXMLPropertySet::Pointer_t pPropertySet)
{
if (pPropertySet.get() != nullptr)
{
OOXMLPropertySetImpl * pSet =
dynamic_cast<OOXMLPropertySetImpl *>(pPropertySet.get());
OOXMLPropertySet * pSet = pPropertySet.get();
if (pSet != nullptr)
{
@@ -436,13 +430,13 @@ void OOXMLPropertySetImpl::add(OOXMLPropertySet::Pointer_t pPropertySet)
}
}
OOXMLPropertySet * OOXMLPropertySetImpl::clone() const
OOXMLPropertySet * OOXMLPropertySet::clone() const
{
return new OOXMLPropertySetImpl(*this);
return new OOXMLPropertySet(*this);
}
#ifdef DEBUG_WRITERFILTER
string OOXMLPropertySetImpl::toString()
string OOXMLPropertySet::toString()
{
string sResult = "[";
char sBuffer[256];

View File

@@ -19,8 +19,10 @@
#ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSET_HXX
#define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSET_HXX
#include <dmapper/resourcemodel.hxx>
#include <vector>
#include "OOXMLBinaryObjectReference.hxx"
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <dmapper/resourcemodel.hxx>
namespace writerfilter {
namespace ooxml
@@ -43,20 +45,147 @@ public:
virtual void resolve(Properties & rProperties) = 0;
};
class OOXMLValue : public Value
{
public:
typedef std::shared_ptr<OOXMLValue> Pointer_t;
OOXMLValue();
virtual ~OOXMLValue();
virtual int getInt() const override;
;
virtual OUString getString() const override;
virtual css::uno::Any getAny() const override;
virtual writerfilter::Reference<Properties>::Pointer_t getProperties() override;
virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary() override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const;
};
class OOXMLPropertyImpl : public OOXMLProperty
{
public:
enum Type_t { SPRM, ATTRIBUTE };
private:
Id mId;
mutable OOXMLValue::Pointer_t mpValue;
Type_t meType;
public:
typedef std::shared_ptr<OOXMLProperty> Pointer_t;
OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue, Type_t eType);
OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm);
virtual ~OOXMLPropertyImpl();
virtual sal_uInt32 getId() const override;
virtual Value::Pointer_t getValue() override;
virtual writerfilter::Reference<Properties>::Pointer_t getProps() override;
#ifdef DEBUG_WRITERFILTER
virtual std::string getName() const override;
virtual std::string toString() const override;
#endif
virtual void resolve(Properties & rProperties) override;
};
class OOXMLBinaryValue : public OOXMLValue
{
protected:
mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj;
public:
explicit OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t pBinaryObj);
virtual ~OOXMLBinaryValue();
virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary() override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLBooleanValue : public OOXMLValue
{
protected:
bool mbValue;
explicit OOXMLBooleanValue(bool bValue);
public:
static OOXMLValue::Pointer_t Create (bool bValue);
static OOXMLValue::Pointer_t Create (const char *pValue);
virtual ~OOXMLBooleanValue();
virtual int getInt() const override;
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLStringValue : public OOXMLValue
{
protected:
OUString mStr;
public:
explicit OOXMLStringValue(const OUString & rStr);
virtual ~OOXMLStringValue();
virtual css::uno::Any getAny() const override;
virtual OUString getString() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLInputStreamValue : public OOXMLValue
{
protected:
css::uno::Reference<css::io::XInputStream> mxInputStream;
public:
explicit OOXMLInputStreamValue(css::uno::Reference<css::io::XInputStream> xInputStream);
virtual ~OOXMLInputStreamValue();
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
struct OOXMLPropertySetCompare
{
bool operator()(const OOXMLProperty::Pointer_t& x,
const OOXMLProperty::Pointer_t& y) const;
};
class OOXMLPropertySet : public writerfilter::Reference<Properties>
{
public:
typedef std::vector<OOXMLProperty::Pointer_t> OOXMLProperties_t;
typedef std::shared_ptr<OOXMLPropertySet> Pointer_t;
private:
OOXMLProperties_t mProperties;
OString maType;
public:
OOXMLPropertySet();
virtual ~OOXMLPropertySet();
virtual void resolve(Properties & rHandler) override = 0;
virtual void add(OOXMLProperty::Pointer_t pProperty) = 0;
virtual void add(OOXMLPropertySet::Pointer_t pPropertySet) = 0;
virtual OOXMLPropertySet * clone() const = 0;
void resolve(Properties & rHandler);
void add(OOXMLProperty::Pointer_t pProperty);
void add(OOXMLPropertySet::Pointer_t pPropertySet);
OOXMLPropertySet * clone() const;
OOXMLProperties_t::iterator begin();
OOXMLProperties_t::iterator end();
OOXMLProperties_t::const_iterator begin() const;
OOXMLProperties_t::const_iterator end() const;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() = 0;
std::string toString();
#endif
};
@@ -77,6 +206,143 @@ private:
PropertySets_t mPropertySets;
};
class OOXMLPropertySetValue : public OOXMLValue
{
OOXMLPropertySet::Pointer_t mpPropertySet;
public:
explicit OOXMLPropertySetValue(OOXMLPropertySet::Pointer_t pPropertySet);
virtual ~OOXMLPropertySetValue();
virtual writerfilter::Reference<Properties>::Pointer_t getProperties() override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLIntegerValue : public OOXMLValue
{
protected:
sal_Int32 mnValue;
explicit OOXMLIntegerValue(sal_Int32 nValue);
public:
static OOXMLValue::Pointer_t Create (sal_Int32 nValue);
virtual ~OOXMLIntegerValue();
virtual int getInt() const override;
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLHexValue : public OOXMLValue
{
protected:
sal_uInt32 mnValue;
public:
explicit OOXMLHexValue(sal_uInt32 nValue);
explicit OOXMLHexValue(const char * pValue);
virtual ~OOXMLHexValue();
virtual int getInt() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
/// Handles OOXML's ST_UniversalMeasure value.
class OOXMLUniversalMeasureValue : public OOXMLValue
{
protected:
sal_uInt32 mnValue;
public:
explicit OOXMLUniversalMeasureValue(const char * pValue);
virtual ~OOXMLUniversalMeasureValue();
virtual int getInt() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue* clone() const override;
};
class OOXMLShapeValue : public OOXMLValue
{
protected:
css::uno::Reference<css::drawing::XShape> mrShape;
public:
explicit OOXMLShapeValue(css::uno::Reference<css::drawing::XShape> rShape);
virtual ~OOXMLShapeValue();
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLStarMathValue : public OOXMLValue
{
protected:
css::uno::Reference< css::embed::XEmbeddedObject > component;
public:
explicit OOXMLStarMathValue( css::uno::Reference< css::embed::XEmbeddedObject > component );
virtual ~OOXMLStarMathValue();
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLPropertySetEntryToString : public Properties
{
Id mnId;
OUString mStr;
public:
explicit OOXMLPropertySetEntryToString(Id nId);
virtual ~OOXMLPropertySetEntryToString();
virtual void sprm(Sprm & rSprm) override;
virtual void attribute(Id nId, Value & rValue) override;
const OUString & getString() const { return mStr;}
};
class OOXMLPropertySetEntryToInteger : public Properties
{
Id mnId;
int mnValue;
public:
explicit OOXMLPropertySetEntryToInteger(Id nId);
virtual ~OOXMLPropertySetEntryToInteger();
virtual void sprm(Sprm & rSprm) override;
virtual void attribute(Id nId, Value & rValue) override;
int getValue() const { return mnValue;}
};
class OOXMLPropertySetEntryToBool : public Properties
{
Id mnId;
bool mValue;
public:
explicit OOXMLPropertySetEntryToBool(Id nId);
virtual ~OOXMLPropertySetEntryToBool();
virtual void sprm(Sprm & rSprm) override;
virtual void attribute(Id nId, Value & rValue) override;
bool getValue() const { return mValue; }
};
}}
#endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSET_HXX

View File

@@ -1,322 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSETIMPL_HXX
#define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSETIMPL_HXX
#include <vector>
#include "OOXMLPropertySet.hxx"
#include "OOXMLBinaryObjectReference.hxx"
#include <com/sun/star/embed/XEmbeddedObject.hpp>
namespace com {
namespace sun {
namespace star {
namespace drawing {
class XShape;
}}}}
namespace writerfilter {
namespace ooxml
{
class OOXMLValue : public Value
{
public:
typedef std::shared_ptr<OOXMLValue> Pointer_t;
OOXMLValue();
virtual ~OOXMLValue();
virtual int getInt() const override;
;
virtual OUString getString() const override;
virtual css::uno::Any getAny() const override;
virtual writerfilter::Reference<Properties>::Pointer_t getProperties() override;
virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary() override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const;
};
class OOXMLPropertyImpl : public OOXMLProperty
{
public:
enum Type_t { SPRM, ATTRIBUTE };
private:
Id mId;
mutable OOXMLValue::Pointer_t mpValue;
Type_t meType;
public:
typedef std::shared_ptr<OOXMLProperty> Pointer_t;
OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue, Type_t eType);
OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm);
virtual ~OOXMLPropertyImpl();
virtual sal_uInt32 getId() const override;
virtual Value::Pointer_t getValue() override;
virtual writerfilter::Reference<Properties>::Pointer_t getProps() override;
#ifdef DEBUG_WRITERFILTER
virtual std::string getName() const override;
virtual std::string toString() const override;
#endif
virtual void resolve(Properties & rProperties) override;
};
class OOXMLBinaryValue : public OOXMLValue
{
protected:
mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj;
public:
explicit OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t pBinaryObj);
virtual ~OOXMLBinaryValue();
virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary() override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLBooleanValue : public OOXMLValue
{
protected:
bool mbValue;
explicit OOXMLBooleanValue(bool bValue);
public:
static OOXMLValue::Pointer_t Create (bool bValue);
static OOXMLValue::Pointer_t Create (const char *pValue);
virtual ~OOXMLBooleanValue();
virtual int getInt() const override;
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLStringValue : public OOXMLValue
{
protected:
OUString mStr;
public:
explicit OOXMLStringValue(const OUString & rStr);
virtual ~OOXMLStringValue();
virtual css::uno::Any getAny() const override;
virtual OUString getString() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLInputStreamValue : public OOXMLValue
{
protected:
css::uno::Reference<css::io::XInputStream> mxInputStream;
public:
explicit OOXMLInputStreamValue(css::uno::Reference<css::io::XInputStream> xInputStream);
virtual ~OOXMLInputStreamValue();
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
struct OOXMLPropertySetImplCompare
{
bool operator()(const OOXMLProperty::Pointer_t& x,
const OOXMLProperty::Pointer_t& y) const;
};
class OOXMLPropertySetImpl : public OOXMLPropertySet
{
public:
typedef std::vector<OOXMLProperty::Pointer_t> OOXMLProperties_t;
private:
OOXMLProperties_t mProperties;
OString maType;
public:
OOXMLPropertySetImpl();
virtual ~OOXMLPropertySetImpl();
virtual void resolve(Properties & rHandler) override;
virtual void add(OOXMLProperty::Pointer_t pProperty) override;
virtual void add(OOXMLPropertySet::Pointer_t pPropertySet) override;
virtual OOXMLPropertySet * clone() const override;
OOXMLProperties_t::iterator begin();
OOXMLProperties_t::iterator end();
OOXMLProperties_t::const_iterator begin() const;
OOXMLProperties_t::const_iterator end() const;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() override;
#endif
};
class OOXMLPropertySetValue : public OOXMLValue
{
OOXMLPropertySet::Pointer_t mpPropertySet;
public:
explicit OOXMLPropertySetValue(OOXMLPropertySet::Pointer_t pPropertySet);
virtual ~OOXMLPropertySetValue();
virtual writerfilter::Reference<Properties>::Pointer_t getProperties() override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLIntegerValue : public OOXMLValue
{
protected:
sal_Int32 mnValue;
explicit OOXMLIntegerValue(sal_Int32 nValue);
public:
static OOXMLValue::Pointer_t Create (sal_Int32 nValue);
virtual ~OOXMLIntegerValue();
virtual int getInt() const override;
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLHexValue : public OOXMLValue
{
protected:
sal_uInt32 mnValue;
public:
explicit OOXMLHexValue(sal_uInt32 nValue);
explicit OOXMLHexValue(const char * pValue);
virtual ~OOXMLHexValue();
virtual int getInt() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
/// Handles OOXML's ST_UniversalMeasure value.
class OOXMLUniversalMeasureValue : public OOXMLValue
{
protected:
sal_uInt32 mnValue;
public:
explicit OOXMLUniversalMeasureValue(const char * pValue);
virtual ~OOXMLUniversalMeasureValue();
virtual int getInt() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue* clone() const override;
};
class OOXMLShapeValue : public OOXMLValue
{
protected:
css::uno::Reference<css::drawing::XShape> mrShape;
public:
explicit OOXMLShapeValue(css::uno::Reference<css::drawing::XShape> rShape);
virtual ~OOXMLShapeValue();
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLStarMathValue : public OOXMLValue
{
protected:
css::uno::Reference< css::embed::XEmbeddedObject > component;
public:
explicit OOXMLStarMathValue( css::uno::Reference< css::embed::XEmbeddedObject > component );
virtual ~OOXMLStarMathValue();
virtual css::uno::Any getAny() const override;
#ifdef DEBUG_WRITERFILTER
virtual std::string toString() const override;
#endif
virtual OOXMLValue * clone() const override;
};
class OOXMLPropertySetEntryToString : public Properties
{
Id mnId;
OUString mStr;
public:
explicit OOXMLPropertySetEntryToString(Id nId);
virtual ~OOXMLPropertySetEntryToString();
virtual void sprm(Sprm & rSprm) override;
virtual void attribute(Id nId, Value & rValue) override;
const OUString & getString() const { return mStr;}
};
class OOXMLPropertySetEntryToInteger : public Properties
{
Id mnId;
int mnValue;
public:
explicit OOXMLPropertySetEntryToInteger(Id nId);
virtual ~OOXMLPropertySetEntryToInteger();
virtual void sprm(Sprm & rSprm) override;
virtual void attribute(Id nId, Value & rValue) override;
int getValue() const { return mnValue;}
};
class OOXMLPropertySetEntryToBool : public Properties
{
Id mnId;
bool mValue;
public:
explicit OOXMLPropertySetEntryToBool(Id nId);
virtual ~OOXMLPropertySetEntryToBool();
virtual void sprm(Sprm & rSprm) override;
virtual void attribute(Id nId, Value & rValue) override;
bool getValue() const { return mValue; }
};
} // namespace ooxml
} // namespace writerfilter
#endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSETIMPL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */