update dev300-m58
[ooovba.git] / writerfilter / source / doctok / WW8Clx.cxx
blobeac556d661e9f6c099a9289885693013856f7cb0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WW8Clx.cxx,v $
10 * $Revision: 1.5 $
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 #include <com/sun/star/io/XSeekable.hpp>
32 #include <WW8Clx.hxx>
33 #include <resources.hxx>
35 namespace writerfilter {
36 namespace doctok
38 WW8Clx::WW8Clx(WW8Stream & rStream,
39 sal_uInt32 nOffset, sal_uInt32 nCount)
40 : WW8StructBase(rStream, nOffset, nCount), nOffsetPieceTable(0)
42 while (getU8(nOffsetPieceTable) != 2)
44 nOffsetPieceTable += getU16(nOffsetPieceTable + 1) + 3;
48 sal_uInt32 WW8Clx::getPieceCount() const
50 return (getU32(nOffsetPieceTable + 1) - 4) / 12;
53 sal_uInt32 WW8Clx::getCp(sal_uInt32 nIndex) const
55 return getU32(nOffsetPieceTable + 5 + nIndex * 4);
58 sal_uInt32 WW8Clx::getFc(sal_uInt32 nIndex) const
60 sal_uInt32 nResult = getU32(nOffsetPieceTable + 5 +
61 (getPieceCount() + 1) * 4 +
62 nIndex * 8 + 2);
64 if (nResult & 0x40000000)
65 nResult = (nResult & ~0x40000000) / 2;
67 return nResult;
70 sal_Bool WW8Clx::isComplexFc(sal_uInt32 nIndex) const
72 sal_Bool bResult = sal_False;
73 sal_uInt32 nTmp = getU32(nOffsetPieceTable + 5 +
74 (getPieceCount() + 1) * 4 +
75 nIndex * 8 + 2);
76 if (nTmp & 0x40000000)
77 bResult = sal_True;
79 return bResult;
82 void WW8Clx::dump(OutputWithDepth<string> & o) const
84 WW8StructBase::dump(o);