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

writerfilter: remove unused WW8StructBase

Change-Id: I23c20ebf77666a64e3b65ce69ada1c1e1cfa5c21
üst b5eb2ce5
......@@ -123,7 +123,6 @@ $(eval $(call gb_Library_add_exception_objects,writerfilter,\
writerfilter/source/dmapper/ThemeTable \
writerfilter/source/dmapper/WrapPolygonHandler \
writerfilter/source/doctok/WW8CpAndFc \
writerfilter/source/doctok/WW8StructBase \
writerfilter/source/filter/ImportFilter \
writerfilter/source/filter/RtfFilter \
writerfilter/source/filter/WriterFilter \
......
......@@ -94,137 +94,6 @@ public:
//virtual bool put(sal_uInt32 nOffset, const Sequence & rSeq) = 0;
};
/**
A property.
*/
class WW8Property
{
public:
/**
Ponter to a property.
*/
typedef boost::shared_ptr<WW8Property> Pointer_t;
virtual ~WW8Property();
virtual sal_uInt32 getId() const = 0;
virtual sal_uInt32 getParam() const = 0;
virtual WW8Stream::Sequence getParams() const = 0;
virtual string toString() const = 0;
/**
Dumps this object to an output.
*/
virtual void dump(OutputWithDepth<string> & o) const = 0;
};
/**
An iterator for traversal of a set of properties.
Sample code for use of iterator:
\code
Return_t function(WW8PropertySet::tPointer pSet)
{
do_something;
WW8PropertySetIterator::tPointer pIt = pSet->begin();
WW8PropertySetIterator::tPointer pItEnd = pSet->end();
while ((*pIt) != (*pItEnd))
{
do_something();
++(*pIt);
}
do_something;
}
\endcode
*/
class WW8PropertySetIterator
{
public:
typedef boost::shared_ptr<WW8PropertySetIterator> Pointer_t;
virtual ~WW8PropertySetIterator();
/**
Advance iterator to the next property.
*/
virtual WW8PropertySetIterator & operator++() = 0;
/**
Returns a pointer to the property the iterator references.
*/
virtual WW8Property::Pointer_t get() const = 0;
/**
Checks if the iterator is equal to another one.
*/
virtual bool equal(const WW8PropertySetIterator & rIt) const = 0;
/**
Returns string representation of iterator.
*/
virtual string toString() const = 0;
};
/**
Checks if two property set iterators are not equal.
*/
bool operator != (const WW8PropertySetIterator & rA,
const WW8PropertySetIterator & rB);
/**
A set of properties.
*/
class WW8PropertySet
{
public:
typedef boost::shared_ptr<WW8PropertySet> Pointer_t;
virtual ~WW8PropertySet();
/**
Returns iterator to the start of the set.
*/
virtual WW8PropertySetIterator::Pointer_t begin() = 0;
/**
Returns iterator to the end of the set.
*/
virtual WW8PropertySetIterator::Pointer_t end() = 0;
/**
Dumps property set to output stream.
@param o output stream to dump property set to
*/
virtual void dump(OutputWithDepth<string> & o) const = 0;
/**
Iterate through property set and for each element dump a dot
output stream.
@param o output stream to dump dots to
*/
virtual void dots(ostream & o) = 0;
virtual bool isPap() const = 0;
virtual sal_uInt32 get_istd() const = 0;
/**
Insert another property set into this property set.
@param pSet the set to insert
*/
virtual void insert(const WW8PropertySet::Pointer_t pSet) = 0;
};
}}
#endif // INCLUDED_WW8_DOCUMENT_HXX
......
......@@ -21,7 +21,6 @@
#define INCLUDED_WW8_FKP_HXX
#include <WW8CpAndFc.hxx>
#include "WW8StructBase.hxx"
namespace writerfilter {
namespace doctok
......
/* -*- 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 "WW8StructBase.hxx"
namespace writerfilter {
namespace doctok {
using namespace ::com::sun::star;
WW8StructBase::WW8StructBase(const WW8StructBase & rParent,
sal_uInt32 nOffset, sal_uInt32 nCount)
: mSequence(rParent.mSequence, nOffset, nCount), mpParent(0)
{
if (nOffset + nCount > rParent.getCount())
{
throw ExceptionOutOfBounds("WW8StructBase");
}
}
WW8StructBase & WW8StructBase::Assign(const WW8StructBase & rSrc)
{
mSequence = rSrc.mSequence;
return *this;
}
sal_uInt8 WW8StructBase::getU8(sal_uInt32 nOffset) const
{
return doctok::getU8(mSequence, nOffset);
}
sal_uInt16 WW8StructBase::getU16(sal_uInt32 nOffset) const
{
return doctok::getU16(mSequence, nOffset);
}
sal_uInt32 WW8StructBase::getU32(sal_uInt32 nOffset) const
{
return doctok::getU32(mSequence, nOffset);
}
sal_uInt8 getU8(const WW8StructBase::Sequence & rSeq,
sal_uInt32 nOffset)
{
return rSeq[nOffset];
}
sal_uInt16 getU16(const WW8StructBase::Sequence & rSeq,
sal_uInt32 nOffset)
{
return getU8(rSeq, nOffset) | (getU8(rSeq, nOffset + 1) << 8);
}
sal_uInt32 getU32(const WW8StructBase::Sequence & rSeq,
sal_uInt32 nOffset)
{
sal_uInt32 nResult = getU8(rSeq, nOffset);
nResult |= (getU8(rSeq, nOffset + 1) << 8);
nResult |= (getU8(rSeq, nOffset + 2) << 16);
nResult |= (getU8(rSeq, nOffset + 3) << 24);
return nResult;
}
OUString WW8StructBase::getString(sal_uInt32 nOffset, sal_uInt32 nCount)
const
{
OUString aResult;
if (nOffset < getCount())
{
sal_uInt32 nCount1 = nCount;
if (nOffset + nCount * 2 > getCount())
{
nCount1 = (getCount() - nOffset) / 2;
}
if (nCount1 > 0)
{
Sequence aSeq(mSequence, nOffset, nCount1 * 2);
rtl_uString * pNew = 0;
rtl_uString_newFromStr_WithLength
(&pNew, reinterpret_cast<const sal_Unicode *>(&aSeq[0]),
nCount1);
aResult = OUString(pNew);
}
}
return aResult;
}
WW8StructBase *
WW8StructBase::getRemainder(sal_uInt32 nOffset) const
{
WW8StructBase * pResult = NULL;
sal_uInt32 nCount = getCount();
if (nCount > nOffset)
{
pResult = new WW8StructBase(*this, nOffset, nCount - nOffset);
}
return pResult;
}
OUString WW8StructBase::getString(sal_uInt32 nOffset) const
{
sal_uInt32 nCount = getU16(nOffset);
return getString(nOffset + 2, nCount);
}
WW8StructBaseTmpOffset::WW8StructBaseTmpOffset
(WW8StructBase * pStructBase)
: mnOffset(0), mpStructBase(pStructBase)
{
}
sal_uInt32 WW8StructBaseTmpOffset::set(sal_uInt32 nOffset)
{
if (nOffset >= mpStructBase->getCount())
throw ExceptionOutOfBounds("WW8StructBaseTmpOffset::set");
mnOffset = nOffset;
return mnOffset;
}
sal_uInt32 WW8StructBaseTmpOffset::get() const
{
return mnOffset;
}
sal_uInt32 WW8StructBaseTmpOffset::inc(sal_uInt32 nOffset)
{
if (mpStructBase->getCount() - mnOffset < nOffset)
throw ExceptionOutOfBounds("WW8StructBaseTmpOffset::inc");
mnOffset += nOffset;
return mnOffset;
}
WW8StructBaseTmpOffset::operator sal_uInt32() const
{
return mnOffset;
}
}}
/* 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_STRUCT_BASE_HXX
#define INCLUDED_WW8_STRUCT_BASE_HXX
#include <boost/shared_ptr.hpp>
#include <doctok/WW8Document.hxx>
#include <resourcemodel/OutputWithDepth.hxx>
namespace writerfilter {
namespace doctok {
/**
Part of a stream.
A part can have a parent, meaning its sequence of data is a
subsequence of its parent's sequence of data.
*/
class WW8StructBase
{
public:
typedef SubSequence<sal_uInt8> Sequence;
typedef boost::shared_ptr<WW8StructBase> Pointer_t;
protected:
/**
Stream this part was created from.
*/
::com::sun::star::uno::Reference<com::sun::star::io::
XInputStream> mrStream;
/**
The data.
*/
mutable Sequence mSequence;
/**
This part's parent.
*/
WW8StructBase * mpParent;
/**
This part's offset in parent.
*/
sal_uInt32 mnOffsetInParent;
public:
WW8StructBase(sal_Int32 nLength)
: mSequence(nLength), mpParent(NULL)
{
}
/**
Creates a part from a steam.
@param rStream the stream
@param nOffset offset in @a rStream to start at
@param nCount count of bytes in the new part
*/
WW8StructBase(WW8Stream & rStream,
sal_Int32 nOffset, sal_Int32 nCount)
: mSequence(rStream.get(nOffset, nCount)), mpParent(0)
{
}
/**
Creates a part from a sequence.
@param rSequence the sequence
@param nOffset offset in @a rSequence to start at
@param nCount count of bytes in the new part
*/
WW8StructBase(const Sequence & rSequence, sal_uInt32 nOffset = 0,
sal_uInt32 nCount = 0)
: mSequence(rSequence, nOffset, nCount), mpParent(0)
{
}
/**
Creates a part from a parent part.
@param pParent the parent
@param nOffset offset in @a pParent to start at
@param nCount count of bytes in the new part
*/
WW8StructBase(const WW8StructBase & rParent,
sal_uInt32 nOffset, sal_uInt32 nCount);
/**
Creates a part from a parent part.
@param pParent the parent
@param nOffset offset in @a pParent to start at
@param nCount count of bytes in the new part
*/
WW8StructBase(WW8StructBase * pParent,
sal_uInt32 nOffset, sal_uInt32 nCount)
: mSequence(pParent->mSequence, nOffset, nCount), mpParent(pParent),
mnOffsetInParent(nOffset)
{
if (nOffset + nCount > pParent->mSequence.getCount())
throw ExceptionOutOfBounds("WW8StructBase");
}
virtual ~WW8StructBase()
{
}
/**
Assign a part to this part.
After assignment this part has the same content as the assigned
part.
@param rSrc part to assign
@return this part after assignment
*/
virtual WW8StructBase & Assign(const WW8StructBase & rSrc);
/**
Return count of bytes in this part.
*/
sal_uInt32 getCount() const { return mSequence.getCount(); }
/**
Return unsigned byte value at an offset.
@param offset offset to get value from
*/
sal_uInt8 getU8(sal_uInt32 nOffset) const;
/**
Return unsigned 16-bit value at an offset.
@param offset offset to get value from
*/
sal_uInt16 getU16(sal_uInt32 nOffset) const;
/**
Return unsigned 32-bit value at an offset.
@param offset offset to get value from
*/
sal_uInt32 getU32(sal_uInt32 nOffset) const;
/**
Return signed 8-bit value at an offset.
@param offset offset to get value from
*/
sal_Int8 getS8(sal_uInt32 nOffset) const
{ return (sal_Int8) getU8(nOffset); }
/**
Return signed 16-bit value at an offset.
@param offset offset to get value from
*/
sal_Int16 getS16(sal_uInt32 nOffset) const
{return (sal_Int16) getU16(nOffset); }
/**
Return signed 32-bit value at an offset.
@param offset offset to get value from
*/
sal_Int32 getS32(sal_uInt32 nOffset) const
{ return (sal_Int32) getU32(nOffset); }
/**
Returns byte at an index.
@param nIndex index in this part of the byte to return
*/
const sal_uInt8 * get(sal_uInt32 nIndex) const
{ return &((mSequence.getSequence())[nIndex + mSequence.getOffset()]); }
/**
Returns two byte character string starting at an offset.
The string has to be Pascal like, e.g. the first word contains
the lengthof the string in characters and is followed by the
string's characters.
@param nOffset offset the string starts at
@return the string
*/
OUString getString(sal_uInt32 nOffset) const;
/**
Returns binary object for remainder of this WW8StructBase
@param nOffset offset where remainder starts
*/
WW8StructBase * getRemainder(sal_uInt32 nOffset) const;
/**
Returns two byte character string starting at an offset with a
given length.
@param nOffset offset the string starts at
@param nLength number of characters in the string
*/
OUString getString(sal_uInt32 nOffset, sal_uInt32) const;
/**
Dump the part.
@param o stream to dump to
*/
virtual void dump(OutputWithDepth<string> & o) const { mSequence.dump(o); }
};
class WW8StructBaseTmpOffset
{
sal_uInt32 mnOffset;
WW8StructBase * mpStructBase;
public:
WW8StructBaseTmpOffset(WW8StructBase * pStructBase);
sal_uInt32 set(sal_uInt32 nOffset);
sal_uInt32 get() const;
sal_uInt32 inc(sal_uInt32 nOffset);
operator sal_uInt32 () const;
};
/**
Return unsigned byte from a sequence.
@param rSeq sequence to get value from
@param nOffset offset in sequence to get value from
*/
sal_uInt8 getU8(const WW8StructBase::Sequence & rSeq, sal_uInt32 nOffset);
/**
Return unsigned 16-bit value from a sequence.
@param rSeq sequence to get value from
@param nOffset offset in sequence to get value from
*/
sal_uInt16 getU16(const WW8StructBase::Sequence & rSeq, sal_uInt32 nOffset);
/**
Return unsigned 32-bit value from a sequence.
@param rSeq sequence to get value from
@param nOffset offset in sequence to get value from
*/
sal_uInt32 getU32(const WW8StructBase::Sequence & rSeq, sal_uInt32 nOffset);
}}
#endif // INCLUDED_WW8_STRUCT_BASE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -51,7 +51,6 @@
#include &lt;resourcemodel/OutputWithDepth.hxx&gt;
#include &lt;doctok/resourceids.hxx&gt;
#include &lt;doctok/WW8StructBase.hxx&gt;
namespace writerfilter {
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