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: WW8BinTableImpl.hxx,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 #ifndef INCLUDED_WW8_BIN_TABLE_IMPL_HXX
32 #define INCLUDED_WW8_BIN_TABLE_IMPL_HXX
35 #include <WW8BinTable.hxx>
40 namespace writerfilter
{
43 using namespace ::std
;
51 sal_uInt32 mnPageNumber
;
54 /// Pointer to a page number
55 typedef boost::shared_ptr
<PageNumber
> Pointer_t
;
57 /// get size of a page number
58 static size_t getSize() { return 4; }
60 PageNumber(WW8StructBase::Sequence
& rSeq
, sal_uInt32 nOffset
,
61 sal_uInt32
/*nCount*/)
62 : mnPageNumber(getU32(rSeq
, nOffset
))
66 /// Return the page number
67 sal_uInt32
get() const { return mnPageNumber
; }
69 virtual void dump(OutputWithDepth
<string
> & out
) const;
73 Implementation class for a binary table
75 class WW8BinTableImpl
: public WW8BinTable
77 /// PLCF containing the numbers of the FKPs of the binary table
78 PLCF
<PageNumber
> mData
;
79 mutable hash_map
<Fc
, sal_uInt32
, FcHash
> mPageMap
;
82 WW8BinTableImpl(WW8Stream
& rStream
, sal_uInt32 nOffset
,
84 : mData(rStream
, nOffset
, nCount
)
89 virtual sal_uInt32
getEntryCount() const
90 { return mData
.getEntryCount(); }
91 virtual Fc
getFc(sal_uInt32 nIndex
) const
92 { return mData
.getFc(nIndex
); }
93 virtual sal_uInt32
getPageNumber(sal_uInt32 nIndex
) const
94 { return mData
.getEntry(nIndex
)->get(); }
95 virtual sal_uInt32
getPageNumber(const Fc
& rFc
) const;
96 virtual string
toString() const;
101 #endif // INCLUDED_WW8_BIN_TABLE_IMPL_HXX