LibreOffice Module sw (master)
1
sw
source
core
inc
laycache.hxx
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
* This file is part of the LibreOffice project.
4
*
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/.
8
*
9
* This file incorporates work covered by the following license notice:
10
*
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 .
18
*/
19
20
#ifndef INCLUDED_SW_SOURCE_CORE_INC_LAYCACHE_HXX
21
#define INCLUDED_SW_SOURCE_CORE_INC_LAYCACHE_HXX
22
23
#include <
sal/types.h
>
24
#include <memory>
25
26
class
SwDoc
;
27
class
SwLayCacheImpl
;
28
class
SvStream
;
29
30
/*
31
* This class allows to save layout information in the file and it contains
32
* this information after loading of a file.
33
* Call Write(..) with a stream and the document to save and the page break
34
* information of the document will be written.
35
* Call Read(..) with a stream and the member pLayCacheImpl will
36
* read the information from the stream and store it in an internal structure.
37
* There's a simple locking mechanism at these classes,
38
* if somebody reads the information, he increments the lock count by 1,
39
* during the Read(..) function the lock count will set to $8000.
40
*/
41
class
SwLayoutCache
42
{
43
std::unique_ptr<SwLayCacheImpl>
m_pImpl
;
44
sal_uInt16
m_nLockCount
;
45
46
public
:
47
SwLayoutCache
();
48
~SwLayoutCache
();
49
50
void
Read
(
SvStream
&rStream );
51
static
void
Write
(
SvStream
&rStream,
const
SwDoc
& rDoc );
52
53
void
ClearImpl
();
54
bool
IsLocked
()
const
{
return
m_nLockCount
> 0; }
55
sal_uInt16&
GetLockCount
() {
return
m_nLockCount
; }
56
SwLayCacheImpl
*
LockImpl
()
57
{
if
(
m_nLockCount
& 0x8000 )
return
nullptr
;
58
if
(
m_pImpl
)
59
++
m_nLockCount
;
60
return
m_pImpl
.get(); }
61
void
UnlockImpl
() { --
m_nLockCount
; }
62
63
#ifdef DBG_UTIL
64
bool
CompareLayout
(
const
SwDoc
& rDoc )
const
;
65
#endif
66
};
67
#endif
68
69
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvStream
SwDoc
Definition:
doc.hxx:197
SwLayCacheImpl
Definition:
layhelp.hxx:57
SwLayoutCache
Definition:
laycache.hxx:42
SwLayoutCache::ClearImpl
void ClearImpl()
Definition:
laycache.cxx:440
SwLayoutCache::~SwLayoutCache
~SwLayoutCache()
Definition:
laycache.cxx:448
SwLayoutCache::m_pImpl
std::unique_ptr< SwLayCacheImpl > m_pImpl
Definition:
laycache.hxx:43
SwLayoutCache::UnlockImpl
void UnlockImpl()
Definition:
laycache.hxx:61
SwLayoutCache::GetLockCount
sal_uInt16 & GetLockCount()
Definition:
laycache.hxx:55
SwLayoutCache::m_nLockCount
sal_uInt16 m_nLockCount
Definition:
laycache.hxx:44
SwLayoutCache::LockImpl
SwLayCacheImpl * LockImpl()
Definition:
laycache.hxx:56
SwLayoutCache::Read
void Read(SvStream &rStream)
Definition:
laycache.cxx:68
SwLayoutCache::Write
static void Write(SvStream &rStream, const SwDoc &rDoc)
writes the index (more precise: the difference between the index and the first index of the document ...
Definition:
laycache.cxx:163
SwLayoutCache::SwLayoutCache
SwLayoutCache()
Definition:
laycache.cxx:55
SwLayoutCache::IsLocked
bool IsLocked() const
Definition:
laycache.hxx:54
SwLayoutCache::CompareLayout
bool CompareLayout(const SwDoc &rDoc) const
Definition:
laycache.cxx:325
types.h
Generated on Sun Jul 30 2023 04:28:37 for LibreOffice Module sw (master) by
1.9.3