Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_DFF_HXX
21 : #define INCLUDED_DFF_HXX
22 :
23 : #include <vector>
24 : #include "WW8StructBase.hxx"
25 : #include "WW8ResourceModelImpl.hxx"
26 :
27 : namespace writerfilter {
28 : namespace doctok
29 : {
30 : using std::vector;
31 :
32 : class DffBlock;
33 :
34 0 : class DffRecord : public WW8StructBase, public writerfilter::Reference<Properties>,
35 : public Sprm
36 : {
37 : bool bInitialized;
38 : public:
39 : typedef boost::shared_ptr<DffRecord> Pointer_t;
40 :
41 : protected:
42 : typedef vector<Pointer_t> Records_t;
43 : Records_t mRecords;
44 :
45 : void initChildren();
46 :
47 : public:
48 :
49 : DffRecord(WW8Stream & rStream, sal_uInt32 nOffset, sal_uInt32 nCount);
50 : DffRecord(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount);
51 0 : virtual ~DffRecord() {}
52 :
53 : bool isContainer() const;
54 : sal_uInt32 calcSize() const;
55 :
56 : sal_uInt32 getVersion() const;
57 : sal_uInt32 getInstance() const;
58 : sal_uInt32 getRecordType() const;
59 :
60 0 : virtual DffRecord * clone() const { return new DffRecord(*this); }
61 :
62 : virtual void resolveLocal(Properties & rHandler);
63 : virtual void resolveChildren(Properties & rHandler);
64 :
65 : Records_t findRecords(sal_uInt32 nType, bool bRecursive = true,
66 : bool bAny = false);
67 :
68 : void findRecords
69 : (sal_uInt32 nType, Records_t & rRecords,
70 : bool bRecursive = true, bool bAny = false);
71 :
72 : Records_t::iterator begin();
73 : Records_t::iterator end();
74 :
75 : sal_uInt32 getShapeType();
76 : sal_uInt32 getShapeId();
77 : sal_uInt32 getShapeBid();
78 :
79 : /* Properties methods */
80 : virtual void resolve(Properties & rHandler);
81 : virtual string getType() const;
82 :
83 : /* Sprm methods */
84 0 : virtual sal_uInt32 getId() const { return getRecordType(); }
85 : virtual Value::Pointer_t getValue();
86 : virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
87 : virtual writerfilter::Reference<Stream>::Pointer_t getStream();
88 : virtual writerfilter::Reference<Properties>::Pointer_t getProps();
89 :
90 : virtual string toString() const;
91 : virtual string getName() const;
92 :
93 : virtual Kind getKind();
94 :
95 : friend class DffBlock;
96 : };
97 :
98 : typedef vector<DffRecord::Pointer_t> Records_t;
99 :
100 : class DffBlock : public WW8StructBase,
101 : public writerfilter::Reference<Properties>
102 : {
103 : bool bInitialized;
104 : sal_uInt32 mnPadding;
105 :
106 : Records_t mRecords;
107 :
108 : protected:
109 : void initChildren();
110 :
111 : public:
112 : typedef boost::shared_ptr<DffBlock> Pointer_t;
113 :
114 : DffBlock(WW8Stream & rStream, sal_uInt32 nOffset, sal_uInt32 nCount, sal_uInt32 nPadding);
115 : DffBlock(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount, sal_uInt32 nPadding);
116 : DffBlock(const DffBlock & rSrc);
117 0 : virtual ~DffBlock() {}
118 :
119 : Records_t findRecords(sal_uInt32 nType, bool bRecursive = true,
120 : bool bAny = false);
121 :
122 : void findRecords(sal_uInt32 nType, Records_t & rRecords,
123 : bool bRecursive = true, bool bAny = false);
124 :
125 : DffRecord::Pointer_t getShape(sal_uInt32 nSpid);
126 : DffRecord::Pointer_t getBlip(sal_uInt32 nBlip);
127 :
128 : Records_t::iterator begin();
129 : Records_t::iterator end();
130 :
131 : /* Properties methods */
132 : virtual void resolve(Properties & rHandler);
133 : virtual string getType() const;
134 : };
135 :
136 : DffRecord *
137 : createDffRecord(WW8StructBase * pParent, sal_uInt32 nOffset,
138 : sal_uInt32 * nSize = NULL);
139 : DffRecord *
140 : createDffRecord(WW8Stream & rStream, sal_uInt32 nOffset,
141 : sal_uInt32 * nSize = NULL);
142 :
143 : }}
144 :
145 : #endif
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|