1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_WW8_BIN_TABLE_IMPL_HXX
21 #define INCLUDED_WW8_BIN_TABLE_IMPL_HXX
24 #include <WW8BinTable.hxx>
27 #include <boost/unordered_map.hpp>
29 namespace writerfilter
{
32 using namespace ::std
;
40 sal_uInt32 mnPageNumber
;
43 /// Pointer to a page number
44 typedef boost::shared_ptr
<PageNumber
> Pointer_t
;
46 /// get size of a page number
47 static size_t getSize() { return 4; }
49 PageNumber(WW8StructBase::Sequence
& rSeq
, sal_uInt32 nOffset
,
50 sal_uInt32
/*nCount*/)
51 : mnPageNumber(getU32(rSeq
, nOffset
))
59 /// Return the page number
60 sal_uInt32
get() const { return mnPageNumber
; }
62 virtual void dump(OutputWithDepth
<string
> & out
) const;
66 Implementation class for a binary table
68 class WW8BinTableImpl
: public WW8BinTable
70 /// PLCF containing the numbers of the FKPs of the binary table
71 PLCF
<PageNumber
> mData
;
72 mutable boost::unordered_map
<Fc
, sal_uInt32
, FcHash
> mPageMap
;
75 WW8BinTableImpl(WW8Stream
& rStream
, sal_uInt32 nOffset
,
77 : mData(rStream
, nOffset
, nCount
)
82 virtual sal_uInt32
getEntryCount() const
83 { return mData
.getEntryCount(); }
84 virtual Fc
getFc(sal_uInt32 nIndex
) const
85 { return mData
.getFc(nIndex
); }
86 virtual sal_uInt32
getPageNumber(sal_uInt32 nIndex
) const
87 { return mData
.getEntry(nIndex
)->get(); }
88 virtual sal_uInt32
getPageNumber(const Fc
& rFc
) const;
89 virtual string
toString() const;
94 #endif // INCLUDED_WW8_BIN_TABLE_IMPL_HXX
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */