1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WW8PropertySetImpl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_WW8_PROPERTY_SET_IMPL_HXX
32 #define INCLUDED_WW8_PROEPRTY_SET_IMPL_HXX
34 #include <resourcemodel/WW8ResourceModel.hxx>
35 #include <doctok/WW8Document.hxx>
36 #include <WW8StructBase.hxx>
37 #include <WW8OutputWithDepth.hxx>
41 namespace writerfilter
{
45 class WW8PropertyImpl
: public WW8Property
, public WW8StructBase
47 sal_uInt8
get_ispmd() const
48 { return sal::static_int_cast
<sal_uInt8
>(getId() & 0xff); }
49 bool get_fSpec() const { return (getId() & 0x100) != 0; }
50 sal_uInt8
get_sgc() const
51 { return sal::static_int_cast
<sal_uInt8
>((getId() >> 10) & 0x7); }
52 sal_uInt8
get_spra() const
53 { return sal::static_int_cast
<sal_uInt8
>((getId() >> 13) & 0x7); }
56 WW8PropertyImpl(WW8Stream
& rStream
, sal_uInt32 nOffset
, sal_uInt32 nCount
);
57 WW8PropertyImpl(const WW8StructBase
& rBase
, sal_uInt32 nOffset
,
60 WW8PropertyImpl(WW8StructBase
* pBase
, sal_uInt32 nOffset
,
63 virtual ~WW8PropertyImpl();
65 sal_uInt32
getId() const { return getU16(0); }
66 sal_uInt32
getParam() const;
67 WW8Stream::Sequence
getParams() const;
69 sal_uInt32
getByteLength() const;
70 sal_uInt32
getParamOffset() const;
72 virtual void dump(OutputWithDepth
<string
> & o
) const;
73 string
toString() const;
76 class WW8PropertySetImpl
: public WW8PropertySet
, public WW8StructBase
,
77 public ::writerfilter::Reference
<Properties
>
82 typedef boost::shared_ptr
<WW8PropertySet
> Pointer_t
;
84 WW8PropertySetImpl(WW8Stream
& rStream
, sal_uInt32 nOffset
,
85 sal_uInt32 nCount
, bool bPap
= false);
87 WW8PropertySetImpl(const WW8StructBase
& rBase
, sal_uInt32 nOffset
,
88 sal_uInt32 nCount
, bool bPap
= false);
90 virtual ~WW8PropertySetImpl();
92 virtual WW8PropertySetIterator::Pointer_t
begin();
93 virtual WW8PropertySetIterator::Pointer_t
end();
95 virtual void dump(OutputWithDepth
<string
> & o
) const;
96 virtual void dots(ostream
& o
);
98 virtual string
getType() const;
100 virtual WW8Property::Pointer_t
getAttribute(sal_uInt32 nOffset
) const;
102 virtual bool isPap() const;
103 virtual sal_uInt32
get_istd() const;
105 virtual void insert(const WW8PropertySet::Pointer_t
/*pSet*/) {}
107 virtual void resolve(Properties
& rHandler
);
110 Get and distribute information from sprm that is used
111 internally by the document.
113 @param rSprm sprm to process
115 virtual void resolveLocal(Sprm
& rSprm
);
118 class WW8PropertySetIteratorImpl
: public WW8PropertySetIterator
120 WW8PropertySetImpl
* mpAttrSet
;
124 WW8PropertySetIteratorImpl(WW8PropertySetImpl
* pAttrSet
,
126 : mpAttrSet(pAttrSet
), mnOffset(nOffset
)
130 virtual ~WW8PropertySetIteratorImpl();
132 virtual WW8PropertySetIterator
& operator++();
134 virtual WW8Property::Pointer_t
get() const;
136 virtual bool equal(const WW8PropertySetIterator
& rIt
) const;
138 virtual string
toString() const;
141 ::writerfilter::Reference
<Properties
>::Pointer_t createSprmProps
142 (WW8PropertyImpl
& rProp
);
143 ::writerfilter::Reference
<BinaryObj
>::Pointer_t createSprmBinary
144 (WW8PropertyImpl
& rProp
);
147 #endif // INCLUDED_WW8_PROPERTY_SET_IMPL_HXX