xref: /trunk/main/sw/source/core/txtnode/swfntcch.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 #include <viewsh.hxx>
33 #include "swfntcch.hxx"
34 #include "fmtcol.hxx"
35 #include "swfont.hxx"
36 
37 // aus atrstck.cxx
38 extern const sal_uInt8 StackPos[];
39 
40 // globale Variablen, werden in SwFntCch.Hxx bekanntgegeben
41 // Der FontCache wird in TxtInit.Cxx _TXTINIT erzeugt und in _TXTEXIT geloescht
42 SwFontCache *pSwFontCache = NULL;
43 
44 /*************************************************************************
45 |*
46 |*	SwFontObj::SwFontObj(), ~SwFontObj()
47 |*
48 |*	Ersterstellung		AMA 25. Jun. 95
49 |*	Letzte Aenderung	AMA 25. Jun. 95
50 |*
51 |*************************************************************************/
52 
53 SwFontObj::SwFontObj( const void *pOwn, ViewShell *pSh ) :
54     SwCacheObj( (void*)pOwn ),
55     aSwFont( &((SwTxtFmtColl *)pOwn)->GetAttrSet(), pSh ? pSh->getIDocumentSettingAccess() : 0 )
56 {
57 	aSwFont.GoMagic( pSh, aSwFont.GetActual() );
58     const SwAttrSet& rAttrSet = ((SwTxtFmtColl *)pOwn)->GetAttrSet();
59     for (sal_uInt16 i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++)
60         pDefaultArray[ StackPos[ i ] ] = &rAttrSet.Get( i, sal_True );
61 }
62 
63 SwFontObj::~SwFontObj()
64 {
65 }
66 
67 /*************************************************************************
68 |*
69 |*	SwFontAccess::SwFontAccess()
70 |*
71 |*	Ersterstellung		AMA 25. Jun. 95
72 |*	Letzte Aenderung	AMA 25. Jun. 95
73 |*
74 |*************************************************************************/
75 
76 SwFontAccess::SwFontAccess( const void *pOwn, ViewShell *pSh ) :
77     SwCacheAccess( *pSwFontCache, pOwn,
78             ((SwTxtFmtColl*)pOwn)->IsInSwFntCache() ),
79 	pShell( pSh )
80 {
81 }
82 
83 SwFontObj *SwFontAccess::Get( )
84 {
85 	return (SwFontObj *) SwCacheAccess::Get( );
86 }
87 
88 SwCacheObj *SwFontAccess::NewObj( )
89 {
90 	((SwTxtFmtColl*)pOwner)->SetInSwFntCache( sal_True );
91 	return new SwFontObj( pOwner, pShell );
92 }
93 
94 
95