bump product version to 4.1.6.2
[LibreOffice.git] / writerfilter / source / doctok / WW8PieceTable.hxx
blobbc5c7c9b4b1d0d57f9ed4a65a42ee1a7271ed290
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
27 #include <iostream>
29 namespace writerfilter {
30 namespace doctok {
32 using namespace ::std;
34 struct Cp;
35 struct Fc;
36 class CpAndFc;
38 /**
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.
48 class WW8PieceTable
50 public:
51 virtual ~WW8PieceTable() {}
52 /**
53 Shared pointer to piece table
55 typedef boost::shared_ptr<WW8PieceTable> Pointer_t;
57 /**
58 Convert CP to FC.
60 @param aCpIn CP to convert
62 @return FC associated with CP
64 virtual Fc cp2fc(const Cp & aCpIn) const = 0;
66 /**
67 Convert FC to CP.
69 @param aFcIn FC to convert
71 @return CP associated with FC
73 virtual Cp fc2cp(const Fc & aFcIn) const = 0;
75 /**
76 Check if CP is complex.
78 @param aCp CP to check
79 @retval true CP is complex
80 @retval false else
82 virtual bool isComplex(const Cp & aCp) const = 0;
84 /**
85 Check if FC is complex.
87 @param aFc FC to check
88 @retval true FC is complex
89 @retval false else
91 virtual bool isComplex(const Fc & aFc) const = 0;
93 /**
94 Return number of entries.
96 virtual sal_uInt32 getCount() const = 0;
98 /**
99 Return first CP.
101 virtual Cp getFirstCp() const = 0;
104 Return first FC.
106 virtual Fc getFirstFc() const = 0;
109 Return last CP.
111 virtual Cp getLastCp() const = 0;
114 Return last FC.
116 virtual Fc getLastFc() const = 0;
119 Return CP at index.
121 @param nIndex index of CP to return
123 virtual Cp getCp(sal_uInt32 nIndex) const = 0;
126 Return FC at index.
128 @param nIndex index of FC to return
130 virtual Fc getFc(sal_uInt32 nIndex) const = 0;
133 Create CpAndFc from Cp.
135 @param rCp the 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.
144 @param rFc the Fc
146 @return CpAndFc containing rFc and corresponding Cp
148 virtual CpAndFc createCpAndFc(const Fc & rFc, PropertyType eType) const = 0;
151 Dump piece table.
153 @param o stream to dump to
155 virtual void dump(ostream & o) const = 0;
159 Dump piece table.
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: */