xref: /AOO41X/main/sw/source/core/text/txtcache.hxx (revision 1d2dbeb0b7301723c6d13094e87a8714ef81a328)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _TXTCACHE_HXX
24 #define _TXTCACHE_HXX
25 
26 #include <sal/types.h>
27 #include <tools/mempool.hxx>
28 #include "swcache.hxx"
29 
30 class SwParaPortion;
31 class SwTxtFrm;
32 
33 class SwTxtLine : public SwCacheObj
34 {
35     SwParaPortion *pLine;
36 
37 public:
38     DECL_FIXEDMEMPOOL_NEWDEL(SwTxtLine)
39 
40     SwTxtLine( SwTxtFrm *pFrm, SwParaPortion *pNew = 0 );
41     virtual ~SwTxtLine();
42 
GetPara()43     inline       SwParaPortion *GetPara()       { return pLine; }
GetPara() const44     inline const SwParaPortion *GetPara() const { return pLine; }
45 
SetPara(SwParaPortion * pNew)46     inline void SetPara( SwParaPortion *pNew ) { pLine = pNew; }
47 };
48 
49 
50 class SwTxtLineAccess : public SwCacheAccess
51 {
52 
53 protected:
54     virtual SwCacheObj *NewObj();
55 
56 public:
57     SwTxtLineAccess( const SwTxtFrm *pOwner );
58 
59     SwParaPortion *GetPara();
60 
61     inline SwTxtLine &GetTxtLine();
62 
63     virtual sal_Bool IsAvailable() const;
64 };
65 
66 
GetTxtLine()67 inline SwTxtLine &SwTxtLineAccess::GetTxtLine()
68 {
69     return *((SwTxtLine*)Get());
70 }
71 
72 #endif
73