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 TextInit.Cxx _TXTINIT erzeugt und in _TXTEXIT geloescht
30 : SwFontCache *pSwFontCache = NULL;
31 :
32 4654 : SwFontObj::SwFontObj( const void *pOwn, SwViewShell *pSh ) :
33 : SwCacheObj( pOwn ),
34 4654 : aSwFont( &static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet(), pSh ? pSh->getIDocumentSettingAccess() : 0 )
35 : {
36 4654 : aSwFont.GoMagic( pSh, aSwFont.GetActual() );
37 4654 : const SwAttrSet& rAttrSet = static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet();
38 214084 : for (sal_uInt16 i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++)
39 209430 : pDefaultArray[ StackPos[ i ] ] = &rAttrSet.Get( i, true );
40 4654 : }
41 :
42 9308 : SwFontObj::~SwFontObj()
43 : {
44 9308 : }
45 :
46 216676 : SwFontAccess::SwFontAccess( const void *pOwn, SwViewShell *pSh ) :
47 : SwCacheAccess( *pSwFontCache, pOwn,
48 216676 : static_cast<const SwTextFormatColl*>(pOwn)->IsInSwFntCache() ),
49 216676 : pShell( pSh )
50 : {
51 216676 : }
52 :
53 401946 : SwFontObj *SwFontAccess::Get( )
54 : {
55 401946 : return static_cast<SwFontObj *>( SwCacheAccess::Get( ) );
56 : }
57 :
58 4654 : SwCacheObj *SwFontAccess::NewObj( )
59 : {
60 4654 : const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(pOwner))->SetInSwFntCache( true );
61 4654 : return new SwFontObj( pOwner, pShell );
62 177 : }
63 :
64 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|