Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <com/sun/star/io/XSeekable.hpp>
21 : #include <WW8Clx.hxx>
22 : #include <doctok/resources.hxx>
23 :
24 : namespace writerfilter {
25 : namespace doctok
26 : {
27 0 : WW8Clx::WW8Clx(WW8Stream & rStream,
28 : sal_uInt32 nOffset, sal_uInt32 nCount)
29 0 : : WW8StructBase(rStream, nOffset, nCount), nOffsetPieceTable(0)
30 : {
31 0 : while (getU8(nOffsetPieceTable) != 2)
32 : {
33 0 : nOffsetPieceTable += getU16(nOffsetPieceTable + 1) + 3;
34 : }
35 0 : }
36 :
37 0 : sal_uInt32 WW8Clx::getPieceCount() const
38 : {
39 0 : return (getU32(nOffsetPieceTable + 1) - 4) / 12;
40 : }
41 :
42 0 : sal_uInt32 WW8Clx::getCp(sal_uInt32 nIndex) const
43 : {
44 0 : return getU32(nOffsetPieceTable + 5 + nIndex * 4);
45 : }
46 :
47 0 : sal_uInt32 WW8Clx::getFc(sal_uInt32 nIndex) const
48 : {
49 : sal_uInt32 nResult = getU32(nOffsetPieceTable + 5 +
50 0 : (getPieceCount() + 1) * 4 +
51 0 : nIndex * 8 + 2);
52 :
53 0 : if (nResult & 0x40000000)
54 0 : nResult = (nResult & ~0x40000000) / 2;
55 :
56 0 : return nResult;
57 : }
58 :
59 0 : sal_Bool WW8Clx::isComplexFc(sal_uInt32 nIndex) const
60 : {
61 0 : sal_Bool bResult = sal_False;
62 : sal_uInt32 nTmp = getU32(nOffsetPieceTable + 5 +
63 0 : (getPieceCount() + 1) * 4 +
64 0 : nIndex * 8 + 2);
65 0 : if (nTmp & 0x40000000)
66 0 : bResult = sal_True;
67 :
68 0 : return bResult;
69 : }
70 :
71 0 : void WW8Clx::dump(OutputWithDepth<string> & o) const
72 : {
73 0 : WW8StructBase::dump(o);
74 0 : }
75 :
76 15 : }}
77 :
78 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|