LibreOffice Module sw (master) 1
swfntcch.cxx
Go to the documentation of this file.
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 <sal/config.h>
21
22#include <shellio.hxx>
23#include <viewsh.hxx>
24#include <swfntcch.hxx>
25#include <fmtcol.hxx>
26#include <fntcache.hxx>
27#include <swfont.hxx>
28
29// from atrstck.cxx
30extern const sal_uInt8 StackPos[];
31
32// FontCache is created in txtinit.cxx TextInit_ and deleted in TextFinit
34
35SwFontObj::SwFontObj( const void *pOwn, SwViewShell *pSh ) :
36 SwCacheObj( pOwn ),
37 m_aSwFont( &static_cast<SwTextFormatColl const *>(pOwn)->GetAttrSet(), pSh ? &pSh->getIDocumentSettingAccess() : nullptr )
38{
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 );
43}
44
46{
47}
48
49SwFontAccess::SwFontAccess( const void *pOwn, SwViewShell *pSh ) :
51 static_cast<const SwTextFormatColl*>(pOwn)->IsInSwFntCache() ),
52 m_pShell( pSh )
53{
54}
55
57{
58 return static_cast<SwFontObj *>( SwCacheAccess::Get( ) );
59}
60
62{
63 const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(m_pOwner))->SetInSwFntCache();
64 return new SwFontObj( m_pOwner, m_pShell );
65}
66
67SAL_DLLPUBLIC_EXPORT void FlushFontCache()
68{
69 if (pSwFontCache)
71 if (pFntCache)
73}
74
75/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
Access class for the Cache.
Definition: swcache.hxx:198
const void * m_pOwner
Definition: swcache.hxx:205
SwCacheObj * Get(bool isDuplicateOwnerAllowed)
Definition: swcache.hxx:259
The Cache object base class Users of the Cache must derive a class from the SwCacheObj and store thei...
Definition: swcache.hxx:137
void Flush()
Definition: swcache.cxx:148
void Flush()
Definition: fntcache.cxx:75
virtual SwCacheObj * NewObj() override
Can be use in NewObj.
Definition: swfntcch.cxx:61
SwViewShell * m_pShell
Definition: swfntcch.hxx:65
SwFontAccess(const void *pOwner, SwViewShell *pSh)
Definition: swfntcch.cxx:49
SwFontObj * Get()
Definition: swfntcch.cxx:56
SwFontObj(const void *pOwner, SwViewShell *pSh)
Definition: swfntcch.cxx:35
const SfxPoolItem * m_pDefaultArray[NUM_DEFAULT_VALUES]
Definition: swfntcch.hxx:51
virtual ~SwFontObj() override
Definition: swfntcch.cxx:45
SwFont m_aSwFont
Definition: swfntcch.hxx:50
SwFontScript GetActual() const
Definition: swfont.hxx:184
void AllocFontCacheId(SwViewShell const *pSh, SwFontScript nWhich)
Definition: swfont.cxx:864
Represents the style of a paragraph.
Definition: fmtcol.hxx:59
void SetInSwFntCache()
Definition: fmtcol.hxx:153
SwFntCache * pFntCache
Definition: fntcache.cxx:65
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
Shell * m_pShell
int i
SAL_DLLPUBLIC_EXPORT void FlushFontCache()
Definition: swfntcch.cxx:67
const sal_uInt8 StackPos[]
Attribute to Stack Mapping.
Definition: atrstck.cxx:68
SwFontCache * pSwFontCache
Definition: swfntcch.cxx:33
unsigned char sal_uInt8