1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WW8PieceTable.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_WW8_PIECE_TABLE_HXX
32 #define INCLUDED_WW8_PIECE_TABLE_HXX
34 #include <sal/types.h>
35 #include <doctok/WW8Document.hxx>
37 #include <boost/shared_ptr.hpp>
40 namespace writerfilter
{
43 using namespace ::std
;
50 The piece table of a Word document.
52 The piece table associates character positions (CP) and File
53 character positions (FC). In a FC based view the piece table
54 defines intervals of FCs that contain consecutive text.
56 CPs and FCs can be complex, i.e. the associated text is stored in
57 bytes. Otherwise the text encoding is UTF-16.
62 virtual ~WW8PieceTable() {}
64 Shared pointer to piece table
66 typedef boost::shared_ptr
<WW8PieceTable
> Pointer_t
;
71 @param aCpIn CP to convert
73 @return FC associated with CP
75 virtual Fc
cp2fc(const Cp
& aCpIn
) const = 0;
80 @param aFcIn FC to convert
82 @return CP associated with FC
84 virtual Cp
fc2cp(const Fc
& aFcIn
) const = 0;
87 Check if CP is complex.
89 @param aCp CP to check
90 @retval true CP is complex
93 virtual bool isComplex(const Cp
& aCp
) const = 0;
96 Check if FC is complex.
98 @param aFc FC to check
99 @retval true FC is complex
102 virtual bool isComplex(const Fc
& aFc
) const = 0;
105 Return number of entries.
107 virtual sal_uInt32
getCount() const = 0;
112 virtual Cp
getFirstCp() const = 0;
117 virtual Fc
getFirstFc() const = 0;
122 virtual Cp
getLastCp() const = 0;
127 virtual Fc
getLastFc() const = 0;
132 @param nIndex index of CP to return
134 virtual Cp
getCp(sal_uInt32 nIndex
) const = 0;
139 @param nIndex index of FC to return
141 virtual Fc
getFc(sal_uInt32 nIndex
) const = 0;
144 Create CpAndFc from Cp.
148 @return CpAndFc containing rCp and corresponding Fc
150 virtual CpAndFc
createCpAndFc(const Cp
& rCp
, PropertyType eType
) const = 0;
153 Create CpAndFc from Fc.
157 @return CpAndFc containing rFc and corresponding Cp
159 virtual CpAndFc
createCpAndFc(const Fc
& rFc
, PropertyType eType
) const = 0;
164 @param o stream to dump to
166 virtual void dump(ostream
& o
) const = 0;
172 @param o stream to dump to
173 @param rPieceTable piece table to dump
175 ostream
& operator << (ostream
& o
, const WW8PieceTable
& rPieceTable
);
178 #endif // INCLUDED_WW8_PIECE_TABLE_HXX