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_CLX_HXX
25 #define INCLUDED_WW8_CLX_HXX
26 
27 #include <resources.hxx>
28 
29 #ifndef INCLUDED_WW8_OUTPUT_WITH_DEPTH_HXX
30 #include <WW8OutputWithDepth.hxx>
31 #endif
32 
33 namespace writerfilter {
34 namespace doctok
35 {
36 
37 /**
38    Piece table as stored in a Word file.
39 
40    It contains character positions (CPs) and file character positions
41    (FCs). Each CP is correlated to one FC.
42  */
43 class WW8Clx : public WW8StructBase
44 {
45     /// Pointer to the file information block.
46     WW8Fib::Pointer_t pFib;
47 
48     /// Offset where FCs begin
49     sal_uInt32 nOffsetPieceTable;
50 
51 public:
52     /// Pointer to Clx.
53     typedef boost::shared_ptr<WW8Clx> Pointer_t;
54 
55     WW8Clx(WW8Stream & rStream,
56            sal_uInt32 nOffset, sal_uInt32 nCount);
57 
58     virtual void dump(OutputWithDepth<string> & o) const;
59 
60     /**
61        Return the number of pieces.
62     */
63     sal_uInt32 getPieceCount() const;
64 
65     /**
66        Return a certain character position.
67 
68        @param nIndex     index of the character position
69      */
70     sal_uInt32 getCp(sal_uInt32 nIndex) const;
71 
72     /**
73        Return a certain file character position.
74 
75        @param nIndex     index of the file character position
76      */
77     sal_uInt32 getFc(sal_uInt32 nIndex) const;
78 
79     /**
80        Return if a certain FC is complex.
81 
82        @nIndex           index of the FC
83      */
84     sal_Bool isComplexFc(sal_uInt32 nIndex) const;
85 
86 };
87 }}
88 
89 #endif
90