Line data Source code
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 : #include <viewsh.hxx>
21 : #include "swfntcch.hxx"
22 : #include "fmtcol.hxx"
23 : #include "swfont.hxx"
24 :
25 : // aus atrstck.cxx
26 : extern const sal_uInt8 StackPos[];
27 :
28 : // globale Variablen, werden in SwFntCch.Hxx bekanntgegeben
29 : // Der FontCache wird in TxtInit.Cxx _TXTINIT erzeugt und in _TXTEXIT geloescht
30 : SwFontCache *pSwFontCache = NULL;
31 :
32 : /*************************************************************************
33 : |*
34 : |* SwFontObj::SwFontObj(), ~SwFontObj()
35 : |*
36 : |*************************************************************************/
37 :
38 0 : SwFontObj::SwFontObj( const void *pOwn, SwViewShell *pSh ) :
39 : SwCacheObj( (void*)pOwn ),
40 0 : aSwFont( &((SwTxtFmtColl *)pOwn)->GetAttrSet(), pSh ? pSh->getIDocumentSettingAccess() : 0 )
41 : {
42 0 : aSwFont.GoMagic( pSh, aSwFont.GetActual() );
43 0 : const SwAttrSet& rAttrSet = ((SwTxtFmtColl *)pOwn)->GetAttrSet();
44 0 : for (sal_uInt16 i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++)
45 0 : pDefaultArray[ StackPos[ i ] ] = &rAttrSet.Get( i, true );
46 0 : }
47 :
48 0 : SwFontObj::~SwFontObj()
49 : {
50 0 : }
51 :
52 : /*************************************************************************
53 : |*
54 : |* SwFontAccess::SwFontAccess()
55 : |*
56 : |*************************************************************************/
57 :
58 0 : SwFontAccess::SwFontAccess( const void *pOwn, SwViewShell *pSh ) :
59 : SwCacheAccess( *pSwFontCache, pOwn,
60 0 : ((SwTxtFmtColl*)pOwn)->IsInSwFntCache() ),
61 0 : pShell( pSh )
62 : {
63 0 : }
64 :
65 0 : SwFontObj *SwFontAccess::Get( )
66 : {
67 0 : return (SwFontObj *) SwCacheAccess::Get( );
68 : }
69 :
70 0 : SwCacheObj *SwFontAccess::NewObj( )
71 : {
72 0 : ((SwTxtFmtColl*)pOwner)->SetInSwFntCache( sal_True );
73 0 : return new SwFontObj( pOwner, pShell );
74 : }
75 :
76 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|