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 8178 : SwFontObj::SwFontObj( const void *pOwn, SwViewShell *pSh ) :
33 : SwCacheObj( (void*)pOwn ),
34 8178 : aSwFont( &((SwTxtFmtColl *)pOwn)->GetAttrSet(), pSh ? pSh->getIDocumentSettingAccess() : 0 )
35 : {
36 8178 : aSwFont.GoMagic( pSh, aSwFont.GetActual() );
37 8178 : const SwAttrSet& rAttrSet = ((SwTxtFmtColl *)pOwn)->GetAttrSet();
38 376188 : for (sal_uInt16 i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++)
39 368010 : pDefaultArray[ StackPos[ i ] ] = &rAttrSet.Get( i, true );
40 8178 : }
41 :
42 16356 : SwFontObj::~SwFontObj()
43 : {
44 16356 : }
45 :
46 377158 : SwFontAccess::SwFontAccess( const void *pOwn, SwViewShell *pSh ) :
47 : SwCacheAccess( *pSwFontCache, pOwn,
48 377158 : ((SwTxtFmtColl*)pOwn)->IsInSwFntCache() ),
49 377158 : pShell( pSh )
50 : {
51 377158 : }
52 :
53 696138 : SwFontObj *SwFontAccess::Get( )
54 : {
55 696138 : return (SwFontObj *) SwCacheAccess::Get( );
56 : }
57 :
58 8178 : SwCacheObj *SwFontAccess::NewObj( )
59 : {
60 8178 : ((SwTxtFmtColl*)pOwner)->SetInSwFntCache( true );
61 8178 : return new SwFontObj( pOwner, pShell );
62 270 : }
63 :
64 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|