1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fontcfg.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <unotools/configitem.hxx>
34 #include <tools/string.hxx>
35 #include <i18npool/lang.h>
36 #include <tools/debug.hxx>
39 #define FONT_STANDARD 0
40 #define FONT_OUTLINE 1
42 #define FONT_CAPTION 3
44 #define FONT_STANDARD_CJK 5
45 #define FONT_OUTLINE_CJK 6
46 #define FONT_LIST_CJK 7
47 #define FONT_CAPTION_CJK 8
48 #define FONT_INDEX_CJK 9
49 #define FONT_STANDARD_CTL 10
50 #define FONT_OUTLINE_CTL 11
51 #define FONT_LIST_CTL 12
52 #define FONT_CAPTION_CTL 13
53 #define FONT_INDEX_CTL 14
54 #define DEF_FONT_COUNT 15
56 #define FONT_PER_GROUP 5
58 #define FONT_GROUP_DEFAULT 0
59 #define FONT_GROUP_CJK 1
60 #define FONT_GROUP_CTL 2
63 #define FONTSIZE_DEFAULT 240
64 #define FONTSIZE_CJK_DEFAULT 210
65 #define FONTSIZE_OUTLINE 280
68 class SW_DLLPUBLIC SwStdFontConfig
: public utl::ConfigItem
70 String sDefaultFonts
[DEF_FONT_COUNT
];
71 sal_Int32 nDefaultFontHeight
[DEF_FONT_COUNT
];
73 SW_DLLPRIVATE
com::sun::star::uno::Sequence
<rtl::OUString
> GetPropertyNames();
75 void ChangeString(USHORT nFontType
, const String
& rSet
)
77 if(sDefaultFonts
[nFontType
] != rSet
)
80 sDefaultFonts
[nFontType
] = rSet
;
84 void ChangeInt( USHORT nFontType
, sal_Int32 nHeight
);
90 virtual void Commit();
92 const String
& GetFontStandard(sal_uInt8 nFontGroup
) const {return sDefaultFonts
[FONT_STANDARD
+ FONT_PER_GROUP
* nFontGroup
];}
93 const String
& GetFontOutline(sal_uInt8 nFontGroup
) const {return sDefaultFonts
[FONT_OUTLINE
+ FONT_PER_GROUP
* nFontGroup
];}
94 const String
& GetFontList (sal_uInt8 nFontGroup
) const {return sDefaultFonts
[FONT_LIST
+ FONT_PER_GROUP
* nFontGroup
];}
95 const String
& GetFontCaption(sal_uInt8 nFontGroup
) const {return sDefaultFonts
[FONT_CAPTION
+ FONT_PER_GROUP
* nFontGroup
];}
96 const String
& GetFontIndex (sal_uInt8 nFontGroup
) const {return sDefaultFonts
[FONT_INDEX
+ FONT_PER_GROUP
* nFontGroup
];}
98 const String
& GetFontFor(USHORT nFontType
) const {return sDefaultFonts
[nFontType
];}
99 BOOL
IsFontDefault(USHORT nFontType
) const;
101 void SetFontStandard(const String
& rSet
, sal_uInt8 nFontGroup
)
102 {ChangeString(FONT_STANDARD
+ FONT_PER_GROUP
* nFontGroup
, rSet
);}
104 void SetFontOutline(const String
& rSet
, sal_uInt8 nFontGroup
)
105 { ChangeString(FONT_OUTLINE
+ FONT_PER_GROUP
* nFontGroup
, rSet
);}
106 void SetFontList (const String
& rSet
, sal_uInt8 nFontGroup
)
107 { ChangeString(FONT_LIST
+ FONT_PER_GROUP
* nFontGroup
, rSet
);}
108 void SetFontCaption(const String
& rSet
, sal_uInt8 nFontGroup
)
109 { ChangeString(FONT_CAPTION
+ FONT_PER_GROUP
* nFontGroup
, rSet
);}
110 void SetFontIndex (const String
& rSet
, sal_uInt8 nFontGroup
)
111 { ChangeString(FONT_INDEX
+ FONT_PER_GROUP
* nFontGroup
, rSet
);}
113 void SetFontHeight( sal_Int32 nHeight
, sal_uInt8 nFont
, sal_uInt8 nScriptType
)
114 { ChangeInt(nFont
+ FONT_PER_GROUP
* nScriptType
, nHeight
);}
116 sal_Int32
GetFontHeight( sal_uInt8 nFont
, sal_uInt8 nScriptType
, LanguageType eLang
);
118 static String
GetDefaultFor(USHORT nFontType
, LanguageType eLang
);
119 static sal_Int32
GetDefaultHeightFor(USHORT nFontType
, LanguageType eLang
);