Update ooo320-m1
[ooovba.git] / sw / source / core / txtnode / swfntcch.cxx
blobf00f8aac1fbe1b127e48bf7c83f6892dd8713337
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swfntcch.cxx,v $
10 * $Revision: 1.10 $
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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <viewsh.hxx>
36 #include "swfntcch.hxx"
37 #include "fmtcol.hxx"
38 #include "swfont.hxx"
40 // aus atrstck.cxx
41 extern const BYTE StackPos[];
43 // globale Variablen, werden in SwFntCch.Hxx bekanntgegeben
44 // Der FontCache wird in TxtInit.Cxx _TXTINIT erzeugt und in _TXTEXIT geloescht
45 SwFontCache *pSwFontCache = NULL;
47 /*************************************************************************
49 |* SwFontObj::SwFontObj(), ~SwFontObj()
51 |* Ersterstellung AMA 25. Jun. 95
52 |* Letzte Aenderung AMA 25. Jun. 95
54 |*************************************************************************/
56 SwFontObj::SwFontObj( const void *pOwn, ViewShell *pSh ) :
57 SwCacheObj( (void*)pOwn ),
58 aSwFont( &((SwTxtFmtColl *)pOwn)->GetAttrSet(), pSh ? pSh->getIDocumentSettingAccess() : 0 )
60 aSwFont.GoMagic( pSh, aSwFont.GetActual() );
61 const SwAttrSet& rAttrSet = ((SwTxtFmtColl *)pOwn)->GetAttrSet();
62 for (USHORT i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++)
63 pDefaultArray[ StackPos[ i ] ] = &rAttrSet.Get( i, TRUE );
66 SwFontObj::~SwFontObj()
70 /*************************************************************************
72 |* SwFontAccess::SwFontAccess()
74 |* Ersterstellung AMA 25. Jun. 95
75 |* Letzte Aenderung AMA 25. Jun. 95
77 |*************************************************************************/
79 SwFontAccess::SwFontAccess( const void *pOwn, ViewShell *pSh ) :
80 SwCacheAccess( *pSwFontCache, pOwn,
81 ((SwTxtFmtColl*)pOwn)->IsInSwFntCache() ),
82 pShell( pSh )
86 SwFontObj *SwFontAccess::Get( )
88 return (SwFontObj *) SwCacheAccess::Get( );
91 SwCacheObj *SwFontAccess::NewObj( )
93 ((SwTxtFmtColl*)pOwner)->SetInSwFntCache( TRUE );
94 return new SwFontObj( pOwner, pShell );