Branch data 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 _PPTATOM_HXX_
21 : : #define _PPTATOM_HXX_
22 : :
23 : : #include <svx/msdffdef.hxx>
24 : : #include <filter/msfilter/msdffimp.hxx>
25 : :
26 : : class SvStream;
27 : :
28 : : namespace ppt
29 : : {
30 : :
31 : : class Atom
32 : : {
33 : : public:
34 : : ~Atom();
35 : :
36 : : /** imports this atom and its child atoms */
37 : : static Atom* import( const DffRecordHeader& rRootRecordHeader, SvStream& rStCtrl );
38 : :
39 : : inline const DffRecordHeader& getHeader() const;
40 : :
41 : : /** @return true if at least one atim with the given nRecType is found */
42 : : inline bool hasChildAtom( sal_uInt16 nRecType ) const;
43 : :
44 : : /** @return the first child atom with nRecType or NULL */
45 : : inline const Atom* findFirstChildAtom( sal_uInt16 nRecType ) const;
46 : :
47 : : /** @return the next child atom after pLast with nRecType or NULL */
48 : : const Atom* findNextChildAtom( sal_uInt16 nRecType, const Atom* pLast ) const;
49 : :
50 : : /** @return the first child atom or NULL */
51 : : inline const Atom* findFirstChildAtom() const;
52 : :
53 : : /** @return the next child atom after pLast or NULL */
54 : : inline const Atom* findNextChildAtom( const Atom* pLast ) const;
55 : :
56 : : /** @return true if this atom is a container */
57 : : inline bool isContainer() const;
58 : :
59 : : /** seeks to the contents of this atom */
60 : : inline bool seekToContent() const;
61 : :
62 : : /** @return the record type */
63 : : inline sal_uInt16 getType() const;
64 : :
65 : : /** @return the record instance */
66 : : inline sal_uInt16 getInstance() const;
67 : :
68 : : /** @return the record length */
69 : : inline sal_uInt32 getLength() const;
70 : :
71 : : private:
72 : : Atom( const DffRecordHeader& rRecordHeader, SvStream& rStCtrl );
73 : :
74 : : SvStream& mrStream;
75 : : DffRecordHeader maRecordHeader;
76 : : Atom* mpFirstChild;
77 : : Atom* mpNextAtom;
78 : : };
79 : :
80 : 0 : inline bool Atom::hasChildAtom( sal_uInt16 nRecType ) const
81 : : {
82 : 0 : return findFirstChildAtom( nRecType ) != NULL;
83 : : }
84 : :
85 : 0 : inline const Atom* Atom::findFirstChildAtom( sal_uInt16 nRecType ) const
86 : : {
87 : 0 : return findNextChildAtom( nRecType, NULL );
88 : : }
89 : :
90 : : inline const DffRecordHeader& Atom::getHeader() const
91 : : {
92 : : return maRecordHeader;
93 : : }
94 : :
95 : 0 : inline const Atom* Atom::findFirstChildAtom() const
96 : : {
97 : 0 : return mpFirstChild;
98 : : }
99 : :
100 : 0 : inline const Atom* Atom::findNextChildAtom( const Atom* pLast ) const
101 : : {
102 [ # # ]: 0 : return pLast ? pLast->mpNextAtom : pLast;
103 : : }
104 : :
105 : 0 : inline bool Atom::isContainer() const
106 : : {
107 : 0 : return (bool)maRecordHeader.IsContainer();
108 : : }
109 : :
110 : 0 : inline bool Atom::seekToContent() const
111 : : {
112 : 0 : maRecordHeader.SeekToContent( mrStream );
113 : 0 : return mrStream.GetError() == 0;
114 : : }
115 : :
116 : 0 : inline sal_uInt16 Atom::getType() const
117 : : {
118 : 0 : return maRecordHeader.nRecType;
119 : : }
120 : :
121 : 0 : inline sal_uInt16 Atom::getInstance() const
122 : : {
123 : 0 : return maRecordHeader.nRecInstance;
124 : : }
125 : :
126 : 0 : inline sal_uInt32 Atom::getLength() const
127 : : {
128 : 0 : return maRecordHeader.nRecLen;
129 : : }
130 : :
131 : : } // namespace ppt
132 : :
133 : : #endif
134 : :
135 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|