Kaydet (Commit) 38720707 authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: remove unused WW8ResourceModelImpl

Change-Id: Ib95e4d543b8ee78127847ea0ed2409cb343b1463
üst 592719cd
...@@ -123,7 +123,6 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\ ...@@ -123,7 +123,6 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\
writerfilter/source/dmapper/ThemeTable \ writerfilter/source/dmapper/ThemeTable \
writerfilter/source/dmapper/WrapPolygonHandler \ writerfilter/source/dmapper/WrapPolygonHandler \
writerfilter/source/doctok/WW8CpAndFc \ writerfilter/source/doctok/WW8CpAndFc \
writerfilter/source/doctok/WW8ResourceModelImpl \
writerfilter/source/doctok/WW8StructBase \ writerfilter/source/doctok/WW8StructBase \
writerfilter/source/filter/ImportFilter \ writerfilter/source/filter/ImportFilter \
writerfilter/source/filter/RtfFilter \ writerfilter/source/filter/RtfFilter \
......
...@@ -225,197 +225,6 @@ public: ...@@ -225,197 +225,6 @@ public:
virtual void insert(const WW8PropertySet::Pointer_t pSet) = 0; virtual void insert(const WW8PropertySet::Pointer_t pSet) = 0;
}; };
enum PropertyType {
/** Auxiliary type for character positions defined in piece table */
PROP_DOC,
/** properties are section properies */
PROP_SEC,
/** properties are paragraph properties */
PROP_PAP,
/** properties are character properties */
PROP_CHP,
/** a footnote reference */
PROP_FOOTNOTE,
/** an endnote reference */
PROP_ENDNOTE,
/** an annotaion reference */
PROP_ANNOTATION,
/** the start of a bookmark */
PROP_BOOKMARKSTART,
/** the end of a bookmark */
PROP_BOOKMARKEND,
/** a field character (start, separator or end) */
PROP_FLD,
/** a shape character */
PROP_SHP,
/** a break character */
PROP_BRK
};
/**
An iterator for traversal of the character positions of a Word
document.
The use of the iterator is analogous to WW8PropertySetIterator.
*/
class WW8DocumentIterator
{
public:
typedef boost::shared_ptr<WW8DocumentIterator> Pointer_t;
virtual ~WW8DocumentIterator();
/**
Advance iterator to next character position of the document.
*/
virtual WW8DocumentIterator & operator++() = 0;
/**
Recedes iterator to previous character postion of the document.
*/
virtual WW8DocumentIterator & operator--() = 0;
/**
Returns properties set at the character position the iterator
points to.
@return pointer to set of properties
*/
virtual writerfilter::Reference<Properties>::Pointer_t getProperties()
const = 0;
virtual writerfilter::Reference<Stream>::Pointer_t getSubDocument()
const = 0;
/**
Returns text run at the character position the iterator points
to.
*/
virtual WW8Stream::Sequence getText() = 0;
/**
Return pointer to the shape at character position the iterator
is pointing to.
*/
virtual writerfilter::Reference<Properties>::Pointer_t getShape() const = 0;
/**
Checks if the characters of the entity the iterator points to
are complex.
Complex characters in a Word document are byte size
characters. Non-complex characters are word size characters.
@retval true The characters are complex.
@retval false The characters are non-complex.
*/
virtual bool isComplex() const = 0;
/**
Returns the property type of the entity the iterator points to.
*/
virtual PropertyType getPropertyType() const = 0;
/**
Checks is the iterator is equal to another one.
@param rIt iterator to check against
@retval true the iterators are equal
@retval false else
*/
virtual bool equal(const WW8DocumentIterator & rIt) const = 0;
/**
Returns string representation of the iterator.
*/
virtual string toString() const = 0;
/**
Dumps the iterator to an output stream.
@param o the output stream to dump the iterator to
*/
virtual void dump(ostream & o) const = 0;
};
/**
Checks if two document iterators are equal.
@param rA first iterator
@param rB second iterator
@retval true the document iterators are equal
@retval false else
*/
bool operator == (const WW8DocumentIterator & rA,
const WW8DocumentIterator & rB);
class SubDocumentId
{
public:
enum eType { FOOTNOTES, HEADERS, FOOTERS };
private:
eType mnType;
sal_uInt8 mnIndex;
public:
SubDocumentId(eType nType, sal_uInt8 nIndex)
: mnType(nType), mnIndex(nIndex)
{
}
eType getType() const { return mnType; }
sal_uInt8 getIndex() const { return mnIndex; }
};
/**
A Word 8 document.
*/
class WW8Document :
public writerfilter::Reference<Stream>
{
public:
typedef boost::shared_ptr<WW8Document> Pointer_t;
virtual ~WW8Document();
/**
Get a subdocument.
A subdocument can be
- a header
- a footer
- a footnode
@param nId identifier of the subdocumen
*/
virtual Pointer_t getSubDocument(SubDocumentId nId) = 0;
/**
Returns iterator to beginning of document.
*/
virtual WW8DocumentIterator::Pointer_t begin() = 0;
/**
Returns iterator to end of document.
*/
virtual WW8DocumentIterator::Pointer_t end() = 0;
};
}} }}
#endif // INCLUDED_WW8_DOCUMENT_HXX #endif // INCLUDED_WW8_DOCUMENT_HXX
......
/* -*- 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 .
*/
#include "WW8ResourceModelImpl.hxx"
#include <doctok/resources.hxx>
#include <resourcemodel/TableManager.hxx>
#include <rtl/string.hxx>
#include <resourcemodel/QNameToString.hxx>
namespace writerfilter {
namespace doctok
{
using namespace ::std;
// ------- WW8TableDataHandler ---------
typedef WW8PropertySet::Pointer_t TablePropsPointer_t;
class WW8TableDataHandler : public TableDataHandler<string,
TablePropsPointer_t>
{
public:
virtual ~WW8TableDataHandler() {}
typedef boost::shared_ptr<WW8TableDataHandler> Pointer_t;
virtual void startTable(unsigned int nRows, unsigned int nDepth,
TablePropsPointer_t pProps);
virtual void endTable(unsigned int nestedTableLevel);
virtual void startRow(unsigned int nCols,
TablePropsPointer_t pProps);
virtual void endRow();
virtual void startCell(const string & start, TablePropsPointer_t pProps);
virtual void endCell(const string & end);
};
void WW8TableDataHandler::startTable(unsigned int /*nRows*/, unsigned int /*nDepth*/,
TablePropsPointer_t /*pProps*/)
{
}
void WW8TableDataHandler::endTable(unsigned int /*nestedTableLevel*/)
{
}
void WW8TableDataHandler::startRow
(unsigned int /*nCols*/, TablePropsPointer_t /*pProps*/)
{
}
void WW8TableDataHandler::endRow()
{
}
void WW8TableDataHandler::startCell(const string & /*start*/,
TablePropsPointer_t /*pProps*/)
{
}
void WW8TableDataHandler::endCell(const string & /*end*/)
{
}
//-------- WW8TableReference -----------------------------------
void WW8TableReference::resolve(Table & /*rHandler*/)
{
}
string WW8TableReference::getType() const
{
return "WW8TableReference";
}
void WW8PropertiesReference::resolve(Properties & rHandler)
{
if (mpPropSet != 0)
{
if (mpPropSet->isPap())
{
WW8IntValue aValue(mpPropSet->get_istd());
rHandler.attribute(NS_rtf::LN_ISTD, aValue);
}
WW8PropertySetIterator::Pointer_t pIt = mpPropSet->begin();
WW8PropertySetIterator::Pointer_t pItEnd = mpPropSet->end();
try
{
while (! pIt->equal(*pItEnd))
{
WW8Sprm aSprm(pIt->get());
rHandler.sprm(aSprm);
++(*pIt);
}
}
catch (ExceptionOutOfBounds)
{
}
}
}
string WW8PropertiesReference::getType() const
{
return "WW8PropertiesReference";
}
WW8BinaryObjReference::WW8BinaryObjReference
(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount)
: WW8StructBase(pParent, nOffset, nCount)
{
}
WW8BinaryObjReference::WW8BinaryObjReference
(WW8StructBase * pParent)
: WW8StructBase(pParent, 0x0, pParent->getCount())
{
}
writerfilter::Reference<BinaryObj>::Pointer_t
WW8BinaryObjReference::getBinary()
{
return writerfilter::Reference<BinaryObj>::Pointer_t
(new WW8BinaryObjReference(*this));
}
void WW8BinaryObjReference::resolve(BinaryObj & rHandler)
{
writerfilter::Reference<Properties>::Pointer_t pRef =
writerfilter::Reference<Properties>::Pointer_t();
if (getCount() > 0)
rHandler.data(get(0), getCount(), pRef);
}
string WW8BinaryObjReference::getType() const
{
return "WW8BinaryObjReference";
}
sal_uInt32 WW8Sprm::getId() const
{
sal_uInt32 nResult = 0;
if (mpProperty.get() != NULL)
nResult = mpProperty->getId();
else if (mpBinary.get() != NULL)
nResult = NS_rtf::LN_blob;
return nResult;
}
string WW8Sprm::toString() const
{
string sResult = "";
if (mpProperty.get() != NULL)
sResult = mpProperty->toString();
return sResult;
}
Value::Pointer_t WW8Sprm::getValue()
{
Value::Pointer_t pResult;
if (mpProperty.get() != NULL)
pResult = Value::Pointer_t(createValue(mpProperty->getParam()));
return pResult;
}
writerfilter::Reference<BinaryObj>::Pointer_t WW8Sprm::getBinary()
{
writerfilter::Reference<BinaryObj>::Pointer_t pResult;
return pResult;
}
writerfilter::Reference<Stream>::Pointer_t WW8Sprm::getStream()
{
return writerfilter::Reference<Stream>::Pointer_t();
}
writerfilter::Reference<Properties>::Pointer_t WW8Sprm::getProps()
{
writerfilter::Reference<Properties>::Pointer_t pResult;
return pResult;
}
Sprm::Kind WW8Sprm::getKind()
{
return SprmKind(getId());
}
string WW8Sprm::getName() const
{
return (*SprmIdToString::Instance())(getId());
}
int WW8Value::getInt() const
{
return 0;
}
uno::Any WW8Value::getAny() const
{
return uno::Any();
}
OUString WW8Value::getString() const
{
return OUString();
}
string WW8Value::toString() const
{
return string();
}
writerfilter::Reference<Properties>::Pointer_t WW8Value::getProperties()
{
return writerfilter::Reference<Properties>::Pointer_t();
}
writerfilter::Reference<Stream>::Pointer_t WW8Value::getStream()
{
return writerfilter::Reference<Stream>::Pointer_t();
}
writerfilter::Reference<BinaryObj>::Pointer_t WW8Value::getBinary()
{
return writerfilter::Reference<BinaryObj>::Pointer_t();
}
int WW8IntValue::getInt() const
{
return mValue;
}
OUString WW8IntValue::getString() const
{
return OUString::number(mValue);
}
uno::Any WW8IntValue::getAny() const
{
uno::Any aResult;
aResult <<= static_cast<sal_uInt32>(mValue);
return aResult;
}
string WW8IntValue::toString() const
{
char sBuffer[255];
snprintf(sBuffer, sizeof(sBuffer), "%x", mValue);
return string(sBuffer);
}
WW8Value::Pointer_t createValue(int value)
{
return WW8Value::Pointer_t(new WW8IntValue(value));
}
SAL_WNODEPRECATED_DECLARATIONS_PUSH
WW8Value::Pointer_t createValue(WW8Value::Pointer_t value)
{
return value;
}
SAL_WNODEPRECATED_DECLARATIONS_POP
int WW8StringValue::getInt() const
{
return 0;
}
OUString WW8StringValue::getString() const
{
return mString;
}
uno::Any WW8StringValue::getAny() const
{
uno::Any aResult;
aResult <<= mString;
return aResult;
}
string WW8StringValue::toString() const
{
string result;
sal_uInt32 nCount = mString.getLength();
for (sal_uInt32 n = 0; n < nCount; ++n)
{
if (mString[n] <= 0xff && isprint(mString[n]))
{
sal_Unicode nC = mString[n];
if (nC < 256)
result += sal::static_int_cast<char>(nC);
else
result += ".";
}
else
{
char sBuffer[64];
snprintf(sBuffer, sizeof(sBuffer), "\\u%04x", mString[n]);
result += sBuffer;
}
}
return result;
}
WW8Value::Pointer_t createValue(const OUString & rStr)
{
return WW8Value::Pointer_t(new WW8StringValue(rStr));
}
writerfilter::Reference<Properties>::Pointer_t
WW8PropertiesValue::getProperties()
{
return mRef;
}
string WW8PropertiesValue::toString() const
{
return "properties";
}
writerfilter::Reference<Stream>::Pointer_t WW8StreamValue::getStream()
{
return mRef;
}
string WW8StreamValue::toString() const
{
return "stream";
}
writerfilter::Reference<BinaryObj>::Pointer_t WW8BinaryObjValue::getBinary()
{
return mRef;
}
string WW8BinaryObjValue::toString() const
{
return "binaryObj";
}
WW8Value::Pointer_t createValue
(writerfilter::Reference<Properties>::Pointer_t rRef)
{
return WW8Value::Pointer_t(new WW8PropertiesValue(rRef));
}
WW8Value::Pointer_t createValue(writerfilter::Reference<Stream>::Pointer_t rRef)
{
return WW8Value::Pointer_t(new WW8StreamValue(rRef));
}
WW8Value::Pointer_t createValue
(writerfilter::Reference<BinaryObj>::Pointer_t rRef)
{
return WW8Value::Pointer_t(new WW8BinaryObjValue(rRef));
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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_WW8_RESOURCE_MODEL_IMPL_HXX
#define INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
#include <doctok/WW8Document.hxx>
#include <resourcemodel/WW8ResourceModel.hxx>
#include "WW8StructBase.hxx"
#include <resourcemodel/OutputWithDepth.hxx>
#include <map>
namespace writerfilter {
namespace doctok
{
using namespace ::std;
class WW8PropertiesReference : public writerfilter::Reference<Properties>
{
WW8PropertySet::Pointer_t mpPropSet;
public:
WW8PropertiesReference(WW8PropertySet::Pointer_t pPropSet)
: mpPropSet(pPropSet)
{
}
virtual ~WW8PropertiesReference()
{
}
virtual void resolve(Properties & rHandler);
virtual string getType() const;
};
class WW8TableReference : public writerfilter::Reference<Table>
{
public:
WW8TableReference()
{
}
virtual ~WW8TableReference()
{
}
virtual void resolve(Table & rHandler);
virtual string getType() const;
};
class WW8BinaryObjReference : public writerfilter::Reference<BinaryObj>,
public WW8StructBase
{
public:
typedef boost::shared_ptr<WW8BinaryObjReference> Pointer_t;
WW8BinaryObjReference(WW8Stream & rStream, sal_uInt32 nOffset,
sal_uInt32 nCount);
WW8BinaryObjReference(WW8StructBase & rParent, sal_uInt32 nOffset,
sal_uInt32 nCount);
WW8BinaryObjReference(WW8StructBase * pParent, sal_uInt32 nOffset,
sal_uInt32 nCount);
WW8BinaryObjReference(WW8StructBase * pParent);
WW8BinaryObjReference()
: WW8StructBase(WW8StructBase::Sequence())
{
}
~WW8BinaryObjReference()
{
}
virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
virtual void resolve(BinaryObj & rHandler);
virtual string getType() const;
virtual WW8BinaryObjReference * clone() { return new WW8BinaryObjReference(*this); }
};
class WW8Sprm : public Sprm
{
WW8Property::Pointer_t mpProperty;
WW8BinaryObjReference::Pointer_t mpBinary;
public:
WW8Sprm(WW8Property::Pointer_t pProperty)
: mpProperty(pProperty)
{
}
WW8Sprm(WW8BinaryObjReference::Pointer_t pBinary)
: mpBinary(pBinary)
{
}
WW8Sprm()
{
}
WW8Sprm(const WW8Sprm & rSprm)
: Sprm(rSprm), mpProperty(rSprm.mpProperty), mpBinary(rSprm.mpBinary)
{
}
virtual ~WW8Sprm()
{
}
virtual Value::Pointer_t getValue();
virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
virtual writerfilter::Reference<Stream>::Pointer_t getStream();
virtual writerfilter::Reference<Properties>::Pointer_t getProps();
virtual Kind getKind();
virtual sal_uInt32 getId() const;
virtual string toString() const;
virtual string getName() const;
virtual WW8Sprm * clone() const { return new WW8Sprm(*this); }
};
class WW8Value : public Value
{
public:
WW8Value() {}
virtual ~WW8Value() {}
virtual string toString() const;
virtual int getInt() const;
virtual OUString getString() const;
virtual uno::Any getAny() const;
virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
virtual writerfilter::Reference<Stream>::Pointer_t getStream();
virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
virtual WW8Value * clone() const = 0;
};
class WW8IntValue : public WW8Value
{
int mValue;
public:
WW8IntValue(int value) : mValue(value) {}
virtual ~WW8IntValue() {}
virtual int getInt() const;
virtual OUString getString() const;
virtual uno::Any getAny() const;
virtual string toString() const;
virtual WW8Value * clone() const { return new WW8IntValue(*this); }
};
/**
Creates value from an integer.
@param value integer to create value from.
*/
WW8Value::Pointer_t createValue(int value);
ostream & operator << (ostream & o, const WW8Value & rValue);
class WW8StringValue : public WW8Value
{
OUString mString;
public:
WW8StringValue(OUString string_) : mString(string_) {}
virtual ~WW8StringValue() {}
virtual int getInt() const;
virtual OUString getString() const;
virtual uno::Any getAny() const;
virtual string toString() const;
virtual WW8Value * clone() const { return new WW8StringValue(*this); }
};
/**
Creates value from a string.
@param rStr string to create value from.
*/
WW8Value::Pointer_t createValue(const OUString & rStr);
class WW8PropertiesValue : public WW8Value
{
mutable writerfilter::Reference<Properties>::Pointer_t mRef;
public:
WW8PropertiesValue(writerfilter::Reference<Properties>::Pointer_t rRef)
: mRef(rRef)
{
}
virtual ~WW8PropertiesValue()
{
}
virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
virtual string toString() const;
virtual WW8Value * clone() const { return new WW8PropertiesValue(mRef); }
};
class WW8StreamValue : public WW8Value
{
mutable writerfilter::Reference<Stream>::Pointer_t mRef;
public:
WW8StreamValue(writerfilter::Reference<Stream>::Pointer_t rRef)
: mRef(rRef)
{
}
virtual ~WW8StreamValue()
{
}
virtual writerfilter::Reference<Stream>::Pointer_t getStream();
virtual string toString() const;
virtual WW8Value * clone() const { return new WW8StreamValue(mRef); }
};
/**
Creates value from a properties reference.
@param rRef reference to create value from.
*/
WW8Value::Pointer_t createValue(writerfilter::Reference<Properties>::Pointer_t rRef);
/**
Creates value from another value.
@param value the value to copy
*/
WW8Value::Pointer_t createValue(WW8Value::Pointer_t value);
/**
Creates value from a stream reference.
@param rRef reference to the stream
*/
WW8Value::Pointer_t createValue(writerfilter::Reference<Stream>::Pointer_t rRef);
class WW8BinaryObjValue : public WW8Value
{
mutable writerfilter::Reference<BinaryObj>::Pointer_t mRef;
public:
WW8BinaryObjValue(writerfilter::Reference<BinaryObj>::Pointer_t rRef)
: mRef(rRef)
{
}
virtual ~WW8BinaryObjValue()
{
}
virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
virtual string toString() const;
virtual WW8Value * clone() const { return new WW8BinaryObjValue(mRef); }
};
/**
Creates value from a binary object reference.
@param rRef reference to the stream
*/
WW8Value::Pointer_t createValue(writerfilter::Reference<BinaryObj>::Pointer_t rRef);
Sprm::Kind SprmKind(sal_uInt32 sprmCode);
}}
#endif // INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include &lt;doctok/resourceids.hxx&gt; #include &lt;doctok/resourceids.hxx&gt;
#include &lt;doctok/WW8StructBase.hxx&gt; #include &lt;doctok/WW8StructBase.hxx&gt;
#include &lt;doctok/WW8ResourceModelImpl.hxx&gt;
namespace writerfilter { namespace writerfilter {
namespace doctok { namespace doctok {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment