android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / txtnode / swfntcch.cxx
blob100a0e7a796511fada12431133cafa7e87fd5ec6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <shellio.hxx>
23 #include <viewsh.hxx>
24 #include <swfntcch.hxx>
25 #include <fmtcol.hxx>
26 #include <fntcache.hxx>
27 #include <swfont.hxx>
29 // from atrstck.cxx
30 extern const sal_uInt8 StackPos[];
32 // FontCache is created in txtinit.cxx TextInit_ and deleted in TextFinit
33 SwFontCache *pSwFontCache = nullptr;
35 SwFontObj::SwFontObj( const void *pOwn, SwViewShell *pSh ) :
36 SwCacheObj( pOwn ),
37 m_aSwFont( &static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet(), pSh ? &pSh->getIDocumentSettingAccess() : nullptr )
39 m_aSwFont.AllocFontCacheId( pSh, m_aSwFont.GetActual() );
40 const SwAttrSet& rAttrSet = static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet();
41 for (sal_uInt16 i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++)
42 m_pDefaultArray[ StackPos[ i ] ] = &rAttrSet.Get( i );
45 SwFontObj::~SwFontObj()
49 SwFontAccess::SwFontAccess( const void *pOwn, SwViewShell *pSh ) :
50 SwCacheAccess( *pSwFontCache, pOwn,
51 static_cast<const SwTextFormatColl*>(pOwn)->IsInSwFntCache() ),
52 m_pShell( pSh )
56 SwFontObj *SwFontAccess::Get( )
58 return static_cast<SwFontObj *>( SwCacheAccess::Get( ) );
61 SwCacheObj *SwFontAccess::NewObj( )
63 const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(m_pOwner))->SetInSwFntCache();
64 return new SwFontObj( m_pOwner, m_pShell );
67 SAL_DLLPUBLIC_EXPORT void FlushFontCache()
69 if (pSwFontCache)
70 pSwFontCache->Flush();
71 if (pFntCache)
72 pFntCache->Flush();
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */