merge the formfield patch from ooo-build
[ooovba.git] / sd / source / filter / ppt / pptatom.hxx
blob81cb7870cbeb44598d71708a979b98001c116aa2
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: pptatom.hxx,v $
10 * $Revision: 1.5 $
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 _PPTATOM_HXX_
32 #define _PPTATOM_HXX_
34 #include <svx/msdffdef.hxx>
36 class SvStream;
38 namespace ppt
41 class Atom
43 public:
44 ~Atom();
46 /** imports this atom and its child atoms */
47 static Atom* import( const DffRecordHeader& rRootRecordHeader, SvStream& rStCtrl );
49 inline const DffRecordHeader& getHeader() const;
51 /** returns true if at least one atim with the given nRecType is found */
52 inline bool hasChildAtom( sal_uInt16 nRecType ) const;
54 /** returns true if at least one atim with the given nRecType and nRecInstnace is found */
55 inline bool hasChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const;
57 /** returns the first child atom with nRecType or NULL */
58 inline const Atom* findFirstChildAtom( sal_uInt16 nRecType ) const;
60 /** returns the next child atom after pLast with nRecType or NULL */
61 const Atom* findNextChildAtom( sal_uInt16 nRecType, const Atom* pLast ) const;
63 /** returns the first child atom with nRecType and nRecInstance or NULL */
64 inline const Atom* findFirstChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const;
66 /** returns the next child atom after pLast with nRecType and nRecInstance or NULL */
67 const Atom* findNextChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance, const Atom* pLast ) const;
69 /** returns the first child atom or NULL */
70 inline const Atom* findFirstChildAtom() const;
72 /** returns the next child atom after pLast or NULL */
73 inline const Atom* findNextChildAtom( const Atom* pLast ) const;
75 /** returns true if this atom is a container */
76 inline bool isContainer() const;
78 /** seeks to the contents of this atom */
79 inline bool seekToContent() const;
81 /** returns the record type */
82 inline sal_uInt16 getType() const;
84 /** returns the record instance */
85 inline sal_uInt16 getInstance() const;
87 /** returns the record length */
88 inline sal_uInt32 getLength() const;
90 private:
91 Atom( const DffRecordHeader& rRecordHeader, SvStream& rStCtrl );
93 SvStream& mrStream;
94 DffRecordHeader maRecordHeader;
95 Atom* mpFirstChild;
96 Atom* mpNextAtom;
99 inline bool Atom::hasChildAtom( sal_uInt16 nRecType ) const
101 return findFirstChildAtom( nRecType ) != NULL;
104 inline bool Atom::hasChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const
106 return findFirstChildAtom( nRecType, nRecInstance ) != NULL;
109 inline const Atom* Atom::findFirstChildAtom( sal_uInt16 nRecType ) const
111 return findNextChildAtom( nRecType, NULL );
114 inline const DffRecordHeader& Atom::getHeader() const
116 return maRecordHeader;
119 inline const Atom* Atom::findFirstChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const
121 return findNextChildAtom( nRecType, nRecInstance, NULL );
124 inline const Atom* Atom::findFirstChildAtom() const
126 return mpFirstChild;
129 inline const Atom* Atom::findNextChildAtom( const Atom* pLast ) const
131 return pLast ? pLast->mpNextAtom : pLast;
134 inline bool Atom::isContainer() const
136 return (bool)maRecordHeader.IsContainer();
139 inline bool Atom::seekToContent() const
141 maRecordHeader.SeekToContent( mrStream );
142 return mrStream.GetError() == 0;
145 inline sal_uInt16 Atom::getType() const
147 return maRecordHeader.nRecType;
150 inline sal_uInt16 Atom::getInstance() const
152 return maRecordHeader.nRecInstance;
155 inline sal_uInt32 Atom::getLength() const
157 return maRecordHeader.nRecLen;
160 } // namespace ppt
162 #endif