Updated core
[LibreOffice.git] / writerfilter / source / doctok / WW8Clx.cxx
blobbea2d554d869957f0da13a4e1a3031f3261c9880
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 #include <com/sun/star/io/XSeekable.hpp>
21 #include <WW8Clx.hxx>
22 #include <doctok/resources.hxx>
24 namespace writerfilter {
25 namespace doctok
27 WW8Clx::WW8Clx(WW8Stream & rStream,
28 sal_uInt32 nOffset, sal_uInt32 nCount)
29 : WW8StructBase(rStream, nOffset, nCount), nOffsetPieceTable(0)
31 while (getU8(nOffsetPieceTable) != 2)
33 nOffsetPieceTable += getU16(nOffsetPieceTable + 1) + 3;
37 sal_uInt32 WW8Clx::getPieceCount() const
39 return (getU32(nOffsetPieceTable + 1) - 4) / 12;
42 sal_uInt32 WW8Clx::getCp(sal_uInt32 nIndex) const
44 return getU32(nOffsetPieceTable + 5 + nIndex * 4);
47 sal_uInt32 WW8Clx::getFc(sal_uInt32 nIndex) const
49 sal_uInt32 nResult = getU32(nOffsetPieceTable + 5 +
50 (getPieceCount() + 1) * 4 +
51 nIndex * 8 + 2);
53 if (nResult & 0x40000000)
54 nResult = (nResult & ~0x40000000) / 2;
56 return nResult;
59 sal_Bool WW8Clx::isComplexFc(sal_uInt32 nIndex) const
61 sal_Bool bResult = sal_False;
62 sal_uInt32 nTmp = getU32(nOffsetPieceTable + 5 +
63 (getPieceCount() + 1) * 4 +
64 nIndex * 8 + 2);
65 if (nTmp & 0x40000000)
66 bResult = sal_True;
68 return bResult;
71 void WW8Clx::dump(OutputWithDepth<string> & o) const
73 WW8StructBase::dump(o);
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */