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: laycache.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 ************************************************************************/
33 #include <tools/solar.h>
39 /*************************************************************************
42 * This class allows to save layout information in the file and it contains
43 * this information after loading of a file.
44 * Call Write(..) with a stream and the document to save and the page break
45 * information of the document will be written.
46 * Call Read(..) with a stream and the member pLayCacheImpl will
47 * read the information from the stream and store it in an internal structur.
48 * There's a simple locking mechanism at these classes,
49 * if somebody reads the information, he increments the lock count by 1,
50 * during the Read(..) function the lock count will set to $8000.
52 **************************************************************************/
56 SwLayCacheImpl
*pImpl
;
59 SwLayoutCache() : pImpl( NULL
), nLockCount( 0 ) {}
62 void Read( SvStream
&rStream
);
63 void Write( SvStream
&rStream
, const SwDoc
& rDoc
);
66 sal_Bool
IsLocked() const { return nLockCount
> 0; }
67 USHORT
& GetLockCount() { return nLockCount
; }
68 SwLayCacheImpl
*LockImpl()
69 { if( nLockCount
& 0x8000 ) return NULL
;
73 void UnlockImpl() { --nLockCount
; }
76 sal_Bool
CompareLayout( const SwDoc
& rDoc
) const;