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_FKP_IMPL_HXX
21 #define INCLUDED_WW8_FKP_IMPL_HXX
27 #include <resourcemodel/OutputWithDepth.hxx>
29 namespace writerfilter
{
33 Implementation class for formatted disk pages.
35 class WW8FKPImpl
: public WW8FKP
37 sal_uInt32 mnPageNumber
;
41 WW8FKPImpl(WW8Stream
& rStream
, sal_uInt32 nPageNumber
, bool bComplex
)
42 : WW8FKP(rStream
, nPageNumber
* 512), mnPageNumber(nPageNumber
),
47 virtual sal_uInt32
getPageNumber() const { return mnPageNumber
; }
49 virtual sal_uInt32
getEntryCount() const { return getU8(511); }
50 virtual sal_uInt32
getRgb() const { return 4 * (getEntryCount() + 1); }
51 virtual Fc
getFc(sal_uInt32 nIndex
) const
52 { return Fc(getU32(nIndex
* 4), mbComplex
); }
53 virtual Fc
getFirstFc() const { return getFc(0); }
54 virtual Fc
getLastFc() const { return getFc(getEntryCount()); }
56 virtual bool contains(const Fc
& rFc
) const
57 { return getFirstFc() <= rFc
&& rFc
< getLastFc(); }
59 virtual sal_uInt32
getIndex(const Fc
& rFc
) const;
61 friend bool operator < (const WW8FKPImpl
& rA
,
62 const WW8FKPImpl
& rB
);
66 Implementation class for formatted disk pages containing character
69 class WW8CHPFKPImpl
: public WW8FKPImpl
72 WW8CHPFKPImpl(WW8Stream
& rStream
, sal_uInt32 nPageNumber
,
74 : WW8FKPImpl(rStream
, nPageNumber
, bComplex
)
78 virtual writerfilter::Reference
<Properties
>::Pointer_t
79 getProperties(const Fc
& rFc
) const;
81 virtual void dump(OutputWithDepth
<string
> & o
) const;
85 Implementation class for formatted disk pages containing paragraph
88 class WW8PAPFKPImpl
: public WW8FKPImpl
91 WW8PAPFKPImpl(WW8Stream
& rStream
, sal_uInt32 nPageNumber
,
93 : WW8FKPImpl(rStream
, nPageNumber
, bComplex
)
97 virtual writerfilter::Reference
<Properties
>::Pointer_t
98 getProperties(const Fc
& rFc
) const;
100 virtual void dump(OutputWithDepth
<string
> & o
) const;
104 Tuple of page number and formattet disk page.
106 class PageNumberAndFKP
109 sal_uInt32 mnPageNumber
;
111 /// pointer to formatted disk page
112 WW8FKP::Pointer_t mpFKP
;
115 PageNumberAndFKP(sal_uInt32 nPageNumber
, WW8FKP::Pointer_t pFKP
)
116 : mnPageNumber(nPageNumber
), mpFKP(pFKP
)
123 sal_uInt32
getPageNumber() const { return mnPageNumber
; }
126 Return formatted disk page.
128 const WW8FKP::Pointer_t
getFKP() const { return mpFKP
; }
130 friend bool operator < (const PageNumberAndFKP
& rA
,
131 const PageNumberAndFKP
& rB
);
135 Cache for formatted disk pages.
137 class WW8FKPCacheImpl
: public WW8FKPCache
139 /// size of the cache
140 sal_uInt32 mnCacheSize
;
142 /// set of tuples of page number and FKP
143 typedef set
<PageNumberAndFKP
> PageNumbersAndFKPs
;
146 typedef deque
<sal_uInt32
> PageNumbers
;
148 PageNumbers mPageNumbers
;
149 PageNumbersAndFKPs mPageNumbersAndFKPs
;
152 WW8Stream::Pointer_t mpStream
;
153 virtual WW8FKP::Pointer_t
createFKP(sal_uInt32 nPageNumber
,
157 WW8FKPCacheImpl(WW8Stream::Pointer_t rpStream
, sal_uInt32 nCacheSize
)
158 : mnCacheSize(nCacheSize
), mpStream(rpStream
)
162 virtual ~WW8FKPCacheImpl()
166 WW8FKP::Pointer_t
get(sal_uInt32 nPageNumber
, bool bComplex
);
169 class WW8CHPFKPCacheImpl
: public WW8FKPCacheImpl
171 virtual WW8FKP::Pointer_t
createFKP(sal_uInt32 nPageNumber
,
175 WW8CHPFKPCacheImpl(WW8Stream::Pointer_t rpStream
,
176 sal_uInt32 nCacheSize
)
177 : WW8FKPCacheImpl(rpStream
, nCacheSize
)
181 virtual ~WW8CHPFKPCacheImpl()
186 class WW8PAPFKPCacheImpl
: public WW8FKPCacheImpl
188 virtual WW8FKP::Pointer_t
createFKP(sal_uInt32 nPageNumber
,
192 WW8PAPFKPCacheImpl(WW8Stream::Pointer_t rpStream
,
193 sal_uInt32 nCacheSize
)
194 : WW8FKPCacheImpl(rpStream
, nCacheSize
)
198 virtual ~WW8PAPFKPCacheImpl()
204 #endif // INCLUDED_WW8_FKP_IMPL_HXX
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */