LibreOffice Module sw (master) 1
fontcfg.hxx
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#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_FONTCFG_HXX
20#define INCLUDED_SW_SOURCE_UIBASE_INC_FONTCFG_HXX
21
22#include <rtl/ustring.hxx>
24#include <i18nlangtag/lang.h>
25#include <swdllapi.h>
26
27#define FONT_STANDARD 0
28#define FONT_OUTLINE 1
29#define FONT_LIST 2
30#define FONT_CAPTION 3
31#define FONT_INDEX 4
32#define FONT_STANDARD_CJK 5
33#define FONT_OUTLINE_CJK 6
34#define FONT_LIST_CJK 7
35#define FONT_CAPTION_CJK 8
36#define FONT_INDEX_CJK 9
37#define FONT_STANDARD_CTL 10
38#define FONT_OUTLINE_CTL 11
39#define FONT_LIST_CTL 12
40#define FONT_CAPTION_CTL 13
41#define FONT_INDEX_CTL 14
42#define DEF_FONT_COUNT 15
43
44#define FONT_PER_GROUP 5
45
46#define FONT_GROUP_DEFAULT 0
47#define FONT_GROUP_CJK 1
48#define FONT_GROUP_CTL 2
49
50//pt-size of fonts
51#define FONTSIZE_DEFAULT 240
52#define FONTSIZE_KOREAN_DEFAULT 200
53#define FONTSIZE_CJK_DEFAULT 210
54#define FONTSIZE_OUTLINE 280
55
57{
58 OUString m_sDefaultFonts[DEF_FONT_COUNT];
59 sal_Int32 m_nDefaultFontHeight[DEF_FONT_COUNT];
60
61 SAL_DLLPRIVATE static css::uno::Sequence<OUString> const & GetPropertyNames();
62
63 void ChangeString(sal_uInt16 nFontType, const OUString& rSet)
64 {
65 if(m_sDefaultFonts[nFontType] != rSet)
66 {
68 m_sDefaultFonts[nFontType] = rSet;
69 }
70 }
71
72 void ChangeInt( sal_uInt16 nFontType, sal_Int32 nHeight );
73
74 virtual void ImplCommit() override;
75
76public:
78 virtual ~SwStdFontConfig() override;
79
80 virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
81
82 const OUString& GetFontStandard(sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_STANDARD + FONT_PER_GROUP * nFontGroup];}
83 const OUString& GetFontOutline(sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_OUTLINE + FONT_PER_GROUP * nFontGroup];}
84 const OUString& GetFontList (sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_LIST + FONT_PER_GROUP * nFontGroup];}
85 const OUString& GetFontCaption(sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_CAPTION + FONT_PER_GROUP * nFontGroup];}
86 const OUString& GetFontIndex (sal_uInt8 nFontGroup) const {return m_sDefaultFonts[FONT_INDEX + FONT_PER_GROUP * nFontGroup];}
87
88 const OUString& GetFontFor(sal_uInt16 nFontType) const {return m_sDefaultFonts[nFontType];}
89 bool IsFontDefault(sal_uInt16 nFontType) const;
90
91 void SetFontStandard(const OUString& rSet, sal_uInt8 nFontGroup)
92 {ChangeString(FONT_STANDARD + FONT_PER_GROUP * nFontGroup, rSet);}
93
94 void SetFontOutline(const OUString& rSet, sal_uInt8 nFontGroup)
95 { ChangeString(FONT_OUTLINE + FONT_PER_GROUP * nFontGroup, rSet);}
96 void SetFontList (const OUString& rSet, sal_uInt8 nFontGroup)
97 { ChangeString(FONT_LIST + FONT_PER_GROUP * nFontGroup, rSet);}
98 void SetFontCaption(const OUString& rSet, sal_uInt8 nFontGroup)
99 { ChangeString(FONT_CAPTION + FONT_PER_GROUP * nFontGroup, rSet);}
100 void SetFontIndex (const OUString& rSet, sal_uInt8 nFontGroup)
101 { ChangeString(FONT_INDEX + FONT_PER_GROUP * nFontGroup, rSet);}
102
103 void SetFontHeight( sal_Int32 nHeight, sal_uInt8 nFont, sal_uInt8 nScriptType )
104 { ChangeInt(nFont + FONT_PER_GROUP * nScriptType, nHeight);}
105
106 sal_Int32 GetFontHeight( sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang );
107
108 static OUString GetDefaultFor(sal_uInt16 nFontType, LanguageType eLang);
109 static sal_Int32 GetDefaultHeightFor(sal_uInt16 nFontType, LanguageType eLang);
110};
111#endif
112
113/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & GetFontOutline(sal_uInt8 nFontGroup) const
Definition: fontcfg.hxx:83
void SetFontHeight(sal_Int32 nHeight, sal_uInt8 nFont, sal_uInt8 nScriptType)
Definition: fontcfg.hxx:103
const OUString & GetFontCaption(sal_uInt8 nFontGroup) const
Definition: fontcfg.hxx:85
void SetFontOutline(const OUString &rSet, sal_uInt8 nFontGroup)
Definition: fontcfg.hxx:94
const OUString & GetFontList(sal_uInt8 nFontGroup) const
Definition: fontcfg.hxx:84
void SetFontList(const OUString &rSet, sal_uInt8 nFontGroup)
Definition: fontcfg.hxx:96
void SetFontStandard(const OUString &rSet, sal_uInt8 nFontGroup)
Definition: fontcfg.hxx:91
void SetFontIndex(const OUString &rSet, sal_uInt8 nFontGroup)
Definition: fontcfg.hxx:100
const OUString & GetFontStandard(sal_uInt8 nFontGroup) const
Definition: fontcfg.hxx:82
const OUString & GetFontFor(sal_uInt16 nFontType) const
Definition: fontcfg.hxx:88
const OUString & GetFontIndex(sal_uInt8 nFontGroup) const
Definition: fontcfg.hxx:86
void ChangeString(sal_uInt16 nFontType, const OUString &rSet)
Definition: fontcfg.hxx:63
void SetFontCaption(const OUString &rSet, sal_uInt8 nFontGroup)
Definition: fontcfg.hxx:98
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames)=0
virtual void ImplCommit()=0
#define FONT_OUTLINE
Definition: fontcfg.hxx:28
#define FONT_LIST
Definition: fontcfg.hxx:29
#define FONT_CAPTION
Definition: fontcfg.hxx:30
#define FONT_INDEX
Definition: fontcfg.hxx:31
#define DEF_FONT_COUNT
Definition: fontcfg.hxx:42
#define FONT_STANDARD
Definition: fontcfg.hxx:27
#define FONT_PER_GROUP
Definition: fontcfg.hxx:44
size_t GetFontHeight()
static SfxItemSet & rSet
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
unsigned char sal_uInt8