1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _PPTATOM_HXX_ 25 #define _PPTATOM_HXX_ 26 27 #include <svx/msdffdef.hxx> 28 #include <filter/msfilter/msdffimp.hxx> 29 30 class SvStream; 31 32 namespace ppt 33 { 34 35 class Atom 36 { 37 public: 38 ~Atom(); 39 40 /** imports this atom and its child atoms */ 41 static Atom* import( const DffRecordHeader& rRootRecordHeader, SvStream& rStCtrl ); 42 43 inline const DffRecordHeader& getHeader() const; 44 45 /** returns true if at least one atim with the given nRecType is found */ 46 inline bool hasChildAtom( sal_uInt16 nRecType ) const; 47 48 /** returns the first child atom with nRecType or NULL */ 49 inline const Atom* findFirstChildAtom( sal_uInt16 nRecType ) const; 50 51 /** returns the next child atom after pLast with nRecType or NULL */ 52 const Atom* findNextChildAtom( sal_uInt16 nRecType, const Atom* pLast ) const; 53 54 /** returns the first child atom or NULL */ 55 inline const Atom* findFirstChildAtom() const; 56 57 /** returns the next child atom after pLast or NULL */ 58 inline const Atom* findNextChildAtom( const Atom* pLast ) const; 59 60 /** returns true if this atom is a container */ 61 inline bool isContainer() const; 62 63 /** seeks to the contents of this atom */ 64 inline bool seekToContent() const; 65 66 /** returns the record type */ 67 inline sal_uInt16 getType() const; 68 69 /** returns the record instance */ 70 inline sal_uInt16 getInstance() const; 71 72 /** returns the record length */ 73 inline sal_uInt32 getLength() const; 74 75 private: 76 Atom( const DffRecordHeader& rRecordHeader, SvStream& rStCtrl ); 77 78 SvStream& mrStream; 79 DffRecordHeader maRecordHeader; 80 Atom* mpFirstChild; 81 Atom* mpNextAtom; 82 }; 83 hasChildAtom(sal_uInt16 nRecType) const84inline bool Atom::hasChildAtom( sal_uInt16 nRecType ) const 85 { 86 return findFirstChildAtom( nRecType ) != NULL; 87 } 88 findFirstChildAtom(sal_uInt16 nRecType) const89inline const Atom* Atom::findFirstChildAtom( sal_uInt16 nRecType ) const 90 { 91 return findNextChildAtom( nRecType, NULL ); 92 } 93 getHeader() const94inline const DffRecordHeader& Atom::getHeader() const 95 { 96 return maRecordHeader; 97 } 98 findFirstChildAtom() const99inline const Atom* Atom::findFirstChildAtom() const 100 { 101 return mpFirstChild; 102 } 103 findNextChildAtom(const Atom * pLast) const104inline const Atom* Atom::findNextChildAtom( const Atom* pLast ) const 105 { 106 return pLast ? pLast->mpNextAtom : pLast; 107 } 108 isContainer() const109inline bool Atom::isContainer() const 110 { 111 return (bool)maRecordHeader.IsContainer(); 112 } 113 seekToContent() const114inline bool Atom::seekToContent() const 115 { 116 maRecordHeader.SeekToContent( mrStream ); 117 return mrStream.GetError() == 0; 118 } 119 getType() const120inline sal_uInt16 Atom::getType() const 121 { 122 return maRecordHeader.nRecType; 123 } 124 getInstance() const125inline sal_uInt16 Atom::getInstance() const 126 { 127 return maRecordHeader.nRecInstance; 128 } 129 getLength() const130inline sal_uInt32 Atom::getLength() const 131 { 132 return maRecordHeader.nRecLen; 133 } 134 135 } // namespace ppt 136 137 #endif 138