1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_WW8_PIECE_TABLE_HXX
21 #define INCLUDED_WW8_PIECE_TABLE_HXX
23 #include <sal/types.h>
24 #include <doctok/WW8Document.hxx>
26 #include <boost/shared_ptr.hpp>
29 namespace writerfilter
{
32 using namespace ::std
;
39 The piece table of a Word document.
41 The piece table associates character positions (CP) and File
42 character positions (FC). In a FC based view the piece table
43 defines intervals of FCs that contain consecutive text.
45 CPs and FCs can be complex, i.e. the associated text is stored in
46 bytes. Otherwise the text encoding is UTF-16.
51 virtual ~WW8PieceTable() {}
53 Shared pointer to piece table
55 typedef boost::shared_ptr
<WW8PieceTable
> Pointer_t
;
60 @param aCpIn CP to convert
62 @return FC associated with CP
64 virtual Fc
cp2fc(const Cp
& aCpIn
) const = 0;
69 @param aFcIn FC to convert
71 @return CP associated with FC
73 virtual Cp
fc2cp(const Fc
& aFcIn
) const = 0;
76 Check if CP is complex.
78 @param aCp CP to check
79 @retval true CP is complex
82 virtual bool isComplex(const Cp
& aCp
) const = 0;
85 Check if FC is complex.
87 @param aFc FC to check
88 @retval true FC is complex
91 virtual bool isComplex(const Fc
& aFc
) const = 0;
94 Return number of entries.
96 virtual sal_uInt32
getCount() const = 0;
101 virtual Cp
getFirstCp() const = 0;
106 virtual Fc
getFirstFc() const = 0;
111 virtual Cp
getLastCp() const = 0;
116 virtual Fc
getLastFc() const = 0;
121 @param nIndex index of CP to return
123 virtual Cp
getCp(sal_uInt32 nIndex
) const = 0;
128 @param nIndex index of FC to return
130 virtual Fc
getFc(sal_uInt32 nIndex
) const = 0;
133 Create CpAndFc from Cp.
137 @return CpAndFc containing rCp and corresponding Fc
139 virtual CpAndFc
createCpAndFc(const Cp
& rCp
, PropertyType eType
) const = 0;
142 Create CpAndFc from Fc.
146 @return CpAndFc containing rFc and corresponding Cp
148 virtual CpAndFc
createCpAndFc(const Fc
& rFc
, PropertyType eType
) const = 0;
153 @param o stream to dump to
155 virtual void dump(ostream
& o
) const = 0;
161 @param o stream to dump to
162 @param rPieceTable piece table to dump
164 ostream
& operator << (ostream
& o
, const WW8PieceTable
& rPieceTable
);
167 #endif // INCLUDED_WW8_PIECE_TABLE_HXX
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */