1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WW8Sttbf.cxx,v $
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 <WW8Sttbf.hxx>
33 namespace writerfilter
{
37 WW8Sttbf::WW8Sttbf(WW8Stream
& rStream
, sal_uInt32 nOffset
, sal_uInt32 nCount
)
38 : WW8StructBase(rStream
, nOffset
, nCount
)
40 sal_uInt32 nComplexOffset
= 0;
41 if (getU16(0) == 0xffff)
47 mnCount
= getU16(nComplexOffset
);
48 mnExtraDataCount
= getU16(nComplexOffset
+ 2);
50 nOffset
= (mbComplex
? 2 : 0) + 4;
52 for (sal_uInt32 n
= 0; n
< mnCount
; ++n
)
54 mEntryOffsets
.push_back(nOffset
);
56 sal_uInt32 nStringLength
= getU16(nOffset
);
58 nOffset
+= 2 + nStringLength
* (mbComplex
? 2 : 1);
60 mExtraOffsets
.push_back(nOffset
);
62 nOffset
+= mnExtraDataCount
;
66 sal_uInt32
WW8Sttbf::getEntryOffset(sal_uInt32 nPos
) const
68 return mEntryOffsets
[nPos
];
71 sal_uInt32
WW8Sttbf::getExtraOffset(sal_uInt32 nPos
) const
73 return mExtraOffsets
[nPos
];
76 sal_uInt32
WW8Sttbf::getEntryCount() const
81 rtl::OUString
WW8Sttbf::getEntry(sal_uInt32 nPos
) const
83 return getString(getEntryOffset(nPos
));
86 WW8StructBase::Pointer_t
WW8Sttbf::getExtraData(sal_uInt32 nPos
)
88 return WW8StructBase::Pointer_t
89 (new WW8StructBase(*this, getExtraOffset(nPos
), mnExtraDataCount
));