xref: /trunk/main/writerfilter/source/doctok/Dff.hxx (revision b8a377c6)
1*b8a377c6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b8a377c6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b8a377c6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b8a377c6SAndrew Rist  * distributed with this work for additional information
6*b8a377c6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b8a377c6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b8a377c6SAndrew Rist  * "License"); you may not use this file except in compliance
9*b8a377c6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b8a377c6SAndrew Rist  *
11*b8a377c6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b8a377c6SAndrew Rist  *
13*b8a377c6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b8a377c6SAndrew Rist  * software distributed under the License is distributed on an
15*b8a377c6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b8a377c6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b8a377c6SAndrew Rist  * specific language governing permissions and limitations
18*b8a377c6SAndrew Rist  * under the License.
19*b8a377c6SAndrew Rist  *
20*b8a377c6SAndrew Rist  *************************************************************/
21*b8a377c6SAndrew Rist 
22*b8a377c6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_DFF_HXX
25cdf0e10cSrcweir #define INCLUDED_DFF_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vector>
28cdf0e10cSrcweir #include <WW8StructBase.hxx>
29cdf0e10cSrcweir #include <WW8ResourceModelImpl.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir namespace writerfilter {
32cdf0e10cSrcweir namespace doctok
33cdf0e10cSrcweir {
34cdf0e10cSrcweir using std::vector;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class DffBlock;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class DffRecord : public WW8StructBase, public writerfilter::Reference<Properties>,
39cdf0e10cSrcweir                   public Sprm
40cdf0e10cSrcweir {
41cdf0e10cSrcweir     bool bInitialized;
42cdf0e10cSrcweir public:
43cdf0e10cSrcweir     typedef boost::shared_ptr<DffRecord> Pointer_t;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir protected:
46cdf0e10cSrcweir     typedef vector<Pointer_t> Records_t;
47cdf0e10cSrcweir     Records_t mRecords;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     void initChildren();
50cdf0e10cSrcweir 
51cdf0e10cSrcweir public:
52cdf0e10cSrcweir 
53cdf0e10cSrcweir     DffRecord(WW8Stream & rStream, sal_uInt32 nOffset, sal_uInt32 nCount);
54cdf0e10cSrcweir     DffRecord(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount);
~DffRecord()55cdf0e10cSrcweir     virtual ~DffRecord() {}
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     bool isContainer() const;
58cdf0e10cSrcweir     sal_uInt32 calcSize() const;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     sal_uInt32 getVersion() const;
61cdf0e10cSrcweir     sal_uInt32 getInstance() const;
62cdf0e10cSrcweir     sal_uInt32 getRecordType() const;
63cdf0e10cSrcweir 
clone() const64cdf0e10cSrcweir     virtual DffRecord * clone() const { return new DffRecord(*this); }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     virtual void resolveLocal(Properties & rHandler);
67cdf0e10cSrcweir     virtual void resolveChildren(Properties & rHandler);
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     Records_t findRecords(sal_uInt32 nType, bool bRecursive = true,
70cdf0e10cSrcweir                           bool bAny = false);
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     void findRecords
73cdf0e10cSrcweir     (sal_uInt32 nType, Records_t & rRecords,
74cdf0e10cSrcweir      bool bRecursive = true, bool bAny = false);
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     Records_t::iterator begin();
77cdf0e10cSrcweir     Records_t::iterator end();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     sal_uInt32 getShapeType();
80cdf0e10cSrcweir     sal_uInt32 getShapeId();
81cdf0e10cSrcweir     sal_uInt32 getShapeBid();
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     /* Properties methods */
84cdf0e10cSrcweir     virtual void resolve(Properties & rHandler);
85cdf0e10cSrcweir     virtual string getType() const;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     /* Sprm methods */
getId() const88cdf0e10cSrcweir     virtual sal_uInt32 getId() const { return getRecordType(); }
89cdf0e10cSrcweir     virtual Value::Pointer_t getValue();
90cdf0e10cSrcweir     virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
91cdf0e10cSrcweir     virtual writerfilter::Reference<Stream>::Pointer_t getStream();
92cdf0e10cSrcweir     virtual writerfilter::Reference<Properties>::Pointer_t getProps();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     virtual string toString() const;
95cdf0e10cSrcweir     virtual string getName() const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual Kind getKind();
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     friend class DffBlock;
100cdf0e10cSrcweir };
101cdf0e10cSrcweir 
102cdf0e10cSrcweir typedef vector<DffRecord::Pointer_t> Records_t;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir class DffBlock : public WW8StructBase,
105cdf0e10cSrcweir                  public writerfilter::Reference<Properties>
106cdf0e10cSrcweir {
107cdf0e10cSrcweir     bool bInitialized;
108cdf0e10cSrcweir     sal_uInt32 mnPadding;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     Records_t mRecords;
111cdf0e10cSrcweir 
112cdf0e10cSrcweir protected:
113cdf0e10cSrcweir     void initChildren();
114cdf0e10cSrcweir 
115cdf0e10cSrcweir public:
116cdf0e10cSrcweir     typedef boost::shared_ptr<DffBlock> Pointer_t;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     DffBlock(WW8Stream & rStream, sal_uInt32 nOffset, sal_uInt32 nCount, sal_uInt32 nPadding);
119cdf0e10cSrcweir     DffBlock(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount, sal_uInt32 nPadding);
120cdf0e10cSrcweir     DffBlock(const DffBlock & rSrc);
~DffBlock()121cdf0e10cSrcweir     virtual ~DffBlock() {}
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     Records_t findRecords(sal_uInt32 nType, bool bRecursive = true,
124cdf0e10cSrcweir                           bool bAny = false);
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     void findRecords(sal_uInt32 nType, Records_t & rRecords,
127cdf0e10cSrcweir                      bool bRecursive = true, bool bAny = false);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     DffRecord::Pointer_t getShape(sal_uInt32 nSpid);
130cdf0e10cSrcweir     DffRecord::Pointer_t getBlip(sal_uInt32 nBlip);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     Records_t::iterator begin();
133cdf0e10cSrcweir     Records_t::iterator end();
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     /* Properties methods */
136cdf0e10cSrcweir     virtual void resolve(Properties & rHandler);
137cdf0e10cSrcweir     virtual string getType() const;
138cdf0e10cSrcweir };
139cdf0e10cSrcweir 
140cdf0e10cSrcweir DffRecord *
141cdf0e10cSrcweir createDffRecord(WW8StructBase * pParent, sal_uInt32 nOffset,
142cdf0e10cSrcweir                 sal_uInt32 * nSize = NULL);
143cdf0e10cSrcweir DffRecord *
144cdf0e10cSrcweir createDffRecord(WW8Stream & rStream, sal_uInt32 nOffset,
145cdf0e10cSrcweir                 sal_uInt32 * nSize = NULL);
146cdf0e10cSrcweir 
147cdf0e10cSrcweir }}
148cdf0e10cSrcweir 
149cdf0e10cSrcweir #endif
150