merge the formfield patch from ooo-build
[ooovba.git] / writerfilter / source / doctok / Dff.hxx
blob02a2ebb56075dc89d4b616d3a6245de0917f278a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Dff.hxx,v $
11 * $Revision: 1.8 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef INCLUDED_DFF_HXX
33 #define INCLUDED_DFF_HXX
35 #include <vector>
36 #include <WW8StructBase.hxx>
37 #include <WW8ResourceModelImpl.hxx>
39 namespace writerfilter {
40 namespace doctok
42 using std::vector;
44 class DffBlock;
46 class DffRecord : public WW8StructBase, public writerfilter::Reference<Properties>,
47 public Sprm
49 bool bInitialized;
50 public:
51 typedef boost::shared_ptr<DffRecord> Pointer_t;
53 protected:
54 typedef vector<Pointer_t> Records_t;
55 Records_t mRecords;
57 void initChildren();
59 public:
61 DffRecord(WW8Stream & rStream, sal_uInt32 nOffset, sal_uInt32 nCount);
62 DffRecord(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount);
63 virtual ~DffRecord() {}
65 bool isContainer() const;
66 sal_uInt32 calcSize() const;
68 sal_uInt32 getVersion() const;
69 sal_uInt32 getInstance() const;
70 sal_uInt32 getRecordType() const;
72 virtual DffRecord * clone() const { return new DffRecord(*this); }
74 virtual void resolveLocal(Properties & rHandler);
75 virtual void resolveChildren(Properties & rHandler);
77 Records_t findRecords(sal_uInt32 nType, bool bRecursive = true,
78 bool bAny = false);
80 void findRecords
81 (sal_uInt32 nType, Records_t & rRecords,
82 bool bRecursive = true, bool bAny = false);
84 Records_t::iterator begin();
85 Records_t::iterator end();
87 sal_uInt32 getShapeType();
88 sal_uInt32 getShapeId();
89 sal_uInt32 getShapeBid();
91 /* Properties methods */
92 virtual void resolve(Properties & rHandler);
93 virtual string getType() const;
95 /* Sprm methods */
96 virtual sal_uInt32 getId() const { return getRecordType(); }
97 virtual Value::Pointer_t getValue();
98 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
99 virtual writerfilter::Reference<Stream>::Pointer_t getStream();
100 virtual writerfilter::Reference<Properties>::Pointer_t getProps();
102 virtual string toString() const;
103 virtual string getName() const;
105 virtual Kind getKind();
107 friend class DffBlock;
110 typedef vector<DffRecord::Pointer_t> Records_t;
112 class DffBlock : public WW8StructBase,
113 public writerfilter::Reference<Properties>
115 bool bInitialized;
116 sal_uInt32 mnPadding;
118 Records_t mRecords;
120 protected:
121 void initChildren();
123 public:
124 typedef boost::shared_ptr<DffBlock> Pointer_t;
126 DffBlock(WW8Stream & rStream, sal_uInt32 nOffset, sal_uInt32 nCount, sal_uInt32 nPadding);
127 DffBlock(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount, sal_uInt32 nPadding);
128 DffBlock(const DffBlock & rSrc);
129 virtual ~DffBlock() {}
131 Records_t findRecords(sal_uInt32 nType, bool bRecursive = true,
132 bool bAny = false);
134 void findRecords(sal_uInt32 nType, Records_t & rRecords,
135 bool bRecursive = true, bool bAny = false);
137 DffRecord::Pointer_t getShape(sal_uInt32 nSpid);
138 DffRecord::Pointer_t getBlip(sal_uInt32 nBlip);
140 Records_t::iterator begin();
141 Records_t::iterator end();
143 /* Properties methods */
144 virtual void resolve(Properties & rHandler);
145 virtual string getType() const;
148 DffRecord *
149 createDffRecord(WW8StructBase * pParent, sal_uInt32 nOffset,
150 sal_uInt32 * nSize = NULL);
151 DffRecord *
152 createDffRecord(WW8Stream & rStream, sal_uInt32 nOffset,
153 sal_uInt32 * nSize = NULL);
157 #endif