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 INCLUDED_WW8_PIECE_TABLE_IMPL_HXX
25 #define INCLUDED_WW8_PIECE_TABLE_IMPL_HXX
26 
27 #include <vector>
28 #include <WW8CpAndFc.hxx>
29 #ifndef INCLUDE_WW8_PIECE_TABLE_HXX
30 #include <WW8PieceTable.hxx>
31 #endif
32 
33 namespace writerfilter {
34 namespace doctok
35 {
36 using namespace ::std;
37 
38 class WW8PieceTableImpl : public WW8PieceTable
39 {
40     typedef std::vector<CpAndFc> tEntries;
41     tEntries mEntries;
42 
43     tEntries::const_iterator findCp(const Cp & rCp) const;
44     tEntries::const_iterator findFc(const Fc & rFc) const;
45 
46     mutable Cp2FcHashMap_t mCp2FcCache;
47 
48 public:
49     WW8PieceTableImpl(WW8Stream & rStream, sal_uInt32 nOffset,
50                       sal_uInt32 nCount);
51 
52     virtual Fc cp2fc(const Cp & aCpIn) const;
53     virtual Cp fc2cp(const Fc & aFcIn) const;
54     virtual bool isComplex(const Cp & aCp) const;
55     virtual bool isComplex(const Fc & aFc) const;
56 
57     virtual sal_uInt32 getCount() const;
58     virtual Cp getFirstCp() const;
59     virtual Fc getFirstFc() const;
60     virtual Cp getLastCp() const;
61     virtual Fc getLastFc() const;
62     virtual Cp getCp(sal_uInt32 nIndex) const;
63     virtual Fc getFc(sal_uInt32 nIndex) const;
64     virtual CpAndFc createCpAndFc(const Cp & rCp, PropertyType eType) const;
65     virtual CpAndFc createCpAndFc(const Fc & rFc, PropertyType eType) const;
66 
67     virtual void dump(ostream & o) const;
68 };
69 }}
70 
71 #endif // INCLUDED_WW8_PIECE_TABLE_IMPL_HXX
72