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_WW8_ANALYZER_HXX 25cdf0e10cSrcweir #define INCLUDED_WW8_ANALYZER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <resourcemodel/WW8ResourceModel.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <hash_set> 30cdf0e10cSrcweir #include <map> 31cdf0e10cSrcweir 32cdf0e10cSrcweir namespace writerfilter 33cdf0e10cSrcweir { 34cdf0e10cSrcweir using namespace std; 35cdf0e10cSrcweir 36cdf0e10cSrcweir struct eqSalUInt32 37cdf0e10cSrcweir { 38cdf0e10cSrcweir bool operator () (sal_uInt32 n1, sal_uInt32 n2) const; 39cdf0e10cSrcweir }; 40cdf0e10cSrcweir 41cdf0e10cSrcweir class WW8Analyzer : public Properties, public Table, 42cdf0e10cSrcweir public BinaryObj, public Stream 43cdf0e10cSrcweir { 44cdf0e10cSrcweir typedef map<sal_uInt32, sal_uInt32> SprmMap; 45cdf0e10cSrcweir 46cdf0e10cSrcweir typedef hash_set<sal_uInt32, hash<sal_uInt32>, eqSalUInt32> IdSet; 47cdf0e10cSrcweir typedef map<Id, sal_uInt32> AttributeMap; 48cdf0e10cSrcweir 49cdf0e10cSrcweir mutable SprmMap mSprmMap; 50cdf0e10cSrcweir IdSet mSprmIdSet; 51cdf0e10cSrcweir mutable AttributeMap mAttributeMap; 52cdf0e10cSrcweir IdSet mAttributeIdSet; 53cdf0e10cSrcweir 54cdf0e10cSrcweir public: 55cdf0e10cSrcweir WW8Analyzer(); 56cdf0e10cSrcweir virtual ~WW8Analyzer(); 57cdf0e10cSrcweir 58cdf0e10cSrcweir // Properties 59cdf0e10cSrcweir 60cdf0e10cSrcweir virtual void attribute(Id Name, Value & val); 61cdf0e10cSrcweir virtual void sprm(Sprm & sprm); 62cdf0e10cSrcweir 63cdf0e10cSrcweir // Table 64cdf0e10cSrcweir 65cdf0e10cSrcweir virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref); 66cdf0e10cSrcweir 67cdf0e10cSrcweir // BinaryObj 68cdf0e10cSrcweir 69cdf0e10cSrcweir virtual void data(const sal_uInt8* buf, size_t len, 70cdf0e10cSrcweir writerfilter::Reference<Properties>::Pointer_t ref); 71cdf0e10cSrcweir 72cdf0e10cSrcweir // Stream 73cdf0e10cSrcweir 74cdf0e10cSrcweir virtual void startSectionGroup(); 75cdf0e10cSrcweir virtual void endSectionGroup(); 76cdf0e10cSrcweir virtual void startParagraphGroup(); 77cdf0e10cSrcweir virtual void endParagraphGroup(); 78cdf0e10cSrcweir virtual void startCharacterGroup(); 79cdf0e10cSrcweir virtual void endCharacterGroup(); 80cdf0e10cSrcweir virtual void text(const sal_uInt8 * data, size_t len); 81cdf0e10cSrcweir virtual void utext(const sal_uInt8 * data, size_t len); 82cdf0e10cSrcweir virtual void props(writerfilter::Reference<Properties>::Pointer_t ref); 83cdf0e10cSrcweir virtual void table(Id name, 84cdf0e10cSrcweir writerfilter::Reference<Table>::Pointer_t ref); 85cdf0e10cSrcweir virtual void substream(Id name, 86cdf0e10cSrcweir writerfilter::Reference<Stream>::Pointer_t ref); 87cdf0e10cSrcweir virtual void info(const string & info); 88cdf0e10cSrcweir virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); 89cdf0e10cSrcweir virtual void endShape( ); 90cdf0e10cSrcweir 91cdf0e10cSrcweir void dumpStats(ostream & o) const; 92cdf0e10cSrcweir }; 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir #endif // INCLUDED_WW8_ANALYZER_HXX 96