1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INCLUDED_WW8_CLX_HXX
29 #define INCLUDED_WW8_CLX_HXX
30 
31 #include <resources.hxx>
32 
33 #ifndef INCLUDED_WW8_OUTPUT_WITH_DEPTH_HXX
34 #include <WW8OutputWithDepth.hxx>
35 #endif
36 
37 namespace writerfilter {
38 namespace doctok
39 {
40 
41 /**
42    Piece table as stored in a Word file.
43 
44    It contains character positions (CPs) and file character positions
45    (FCs). Each CP is correlated to one FC.
46  */
47 class WW8Clx : public WW8StructBase
48 {
49     /// Pointer to the file information block.
50     WW8Fib::Pointer_t pFib;
51 
52     /// Offset where FCs begin
53     sal_uInt32 nOffsetPieceTable;
54 
55 public:
56     /// Pointer to Clx.
57     typedef boost::shared_ptr<WW8Clx> Pointer_t;
58 
59     WW8Clx(WW8Stream & rStream,
60            sal_uInt32 nOffset, sal_uInt32 nCount);
61 
62     virtual void dump(OutputWithDepth<string> & o) const;
63 
64     /**
65        Return the number of pieces.
66     */
67     sal_uInt32 getPieceCount() const;
68 
69     /**
70        Return a certain character position.
71 
72        @param nIndex     index of the character position
73      */
74     sal_uInt32 getCp(sal_uInt32 nIndex) const;
75 
76     /**
77        Return a certain file character position.
78 
79        @param nIndex     index of the file character position
80      */
81     sal_uInt32 getFc(sal_uInt32 nIndex) const;
82 
83     /**
84        Return if a certain FC is complex.
85 
86        @nIndex           index of the FC
87      */
88     sal_Bool isComplexFc(sal_uInt32 nIndex) const;
89 
90 };
91 }}
92 
93 #endif
94