1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CHART_CHARACTERPROPERTIES_HXX
24 #define CHART_CHARACTERPROPERTIES_HXX
25 
26 #include "PropertyHelper.hxx"
27 #include "FastPropertyIdRanges.hxx"
28 #include "charttoolsdllapi.hxx"
29 #include <com/sun/star/beans/Property.hpp>
30 #include <com/sun/star/beans/XMultiPropertySet.hpp>
31 #include <com/sun/star/awt/FontDescriptor.hpp>
32 
33 #include <vector>
34 
35 namespace chart
36 {
37 
38 // implements services
39 //   com.sun.star.style.CharacterProperties
40 //   com.sun.star.style.CharacterPropertiesAsian
41 //   com.sun.star.style.CharacterPropertiesComplex
42 class OOO_DLLPUBLIC_CHARTTOOLS CharacterProperties
43 {
44 public:
45     // FastProperty Ids for properties
46     enum
47     {
48         // com.sun.star.style.CharacterProperties
49         PROP_CHAR_FONT_NAME = FAST_PROPERTY_ID_START_CHAR_PROP, // ?
50         PROP_CHAR_FONT_STYLE_NAME,
51         PROP_CHAR_FONT_FAMILY,
52         PROP_CHAR_FONT_CHAR_SET,
53         PROP_CHAR_FONT_PITCH,
54         PROP_CHAR_COLOR,
55 //         PROP_CHAR_BACKGROUND_COLOR,
56 //--         PROP_CHAR_BACKGROUND_TRANSPARENCY, alpah channnel in COLOR
57         PROP_CHAR_ESCAPEMENT,
58         PROP_CHAR_CHAR_HEIGHT,
59         PROP_CHAR_UNDERLINE,
60         PROP_CHAR_UNDERLINE_COLOR,
61         PROP_CHAR_UNDERLINE_HAS_COLOR,
62         PROP_CHAR_OVERLINE,
63         PROP_CHAR_OVERLINE_COLOR,
64         PROP_CHAR_OVERLINE_HAS_COLOR,
65         PROP_CHAR_WEIGHT,
66         PROP_CHAR_POSTURE,
67         PROP_CHAR_AUTO_KERNING,
68         PROP_CHAR_KERNING,
69 //         PROP_CHAR_CASE_MAPPING,
70 //         PROP_CHAR_ROTATION,
71 //--         PROP_CHAR_ROTATION_IS_FIT_TO_LINE,
72 //        PROP_CHAR_SCALE_WIDTH,
73         PROP_CHAR_ESCAPEMENT_HEIGHT,
74 
75 //         PROP_CHAR_CROSSED_OUT,
76         PROP_CHAR_STRIKE_OUT,
77         PROP_CHAR_WORD_MODE,
78 //         PROP_CHAR_FLASH,
79         PROP_CHAR_LOCALE,
80 //--         PROP_CHAR_KEEP_TOGETHER,
81 //--         PROP_CHAR_NO_LINE_BREAK,
82         PROP_CHAR_SHADOWED,
83         PROP_CHAR_CONTOURED,
84         PROP_CHAR_RELIEF,
85 //--         PROP_CHAR_COMBINE_IS_ON,
86 //--         PROP_CHAR_COMBINE_PREFIX,
87 //--         PROP_CHAR_COMBINE_SUFFIX,
88 
89         PROP_CHAR_EMPHASIS,
90 //         PROP_CHAR_RUBY_TEXT,
91 //         PROP_CHAR_RUBY_ADJUST,
92 //         PROP_CHAR_RUBY_STYLE_NAME,
93 //         PROP_CHAR_RUBY_IS_ABOVE,
94 //         PROP_CHAR_INHIBIT_HYPHENATION,
95 
96         // Asian (com.sun.star.style.CharacterPropertiesAsian)
97         PROP_CHAR_ASIAN_FONT_NAME,
98         PROP_CHAR_ASIAN_FONT_STYLE_NAME,
99         PROP_CHAR_ASIAN_FONT_FAMILY,
100         PROP_CHAR_ASIAN_CHAR_SET,
101         PROP_CHAR_ASIAN_FONT_PITCH,
102         PROP_CHAR_ASIAN_CHAR_HEIGHT,
103         PROP_CHAR_ASIAN_WEIGHT,
104         PROP_CHAR_ASIAN_POSTURE,
105         PROP_CHAR_ASIAN_LOCALE,
106 //--         PROP_CHAR_ASIAN_USE_SCRIPT_TYPE_DISTANCE,
107 //--         PROP_CHAR_ASIAN_USE_FORBIDDEN_RULES,
108 //--         PROP_CHAR_ASIAN_HANGING_PUNCTUATION_ALLOWED,
109 
110         // Complex Text Layout (com.sun.star.style.CharacterPropertiesComplex)
111         PROP_CHAR_COMPLEX_FONT_NAME,
112         PROP_CHAR_COMPLEX_FONT_STYLE_NAME,
113         PROP_CHAR_COMPLEX_FONT_FAMILY,
114         PROP_CHAR_COMPLEX_CHAR_SET,
115         PROP_CHAR_COMPLEX_FONT_PITCH,
116         PROP_CHAR_COMPLEX_CHAR_HEIGHT,
117         PROP_CHAR_COMPLEX_WEIGHT,
118         PROP_CHAR_COMPLEX_POSTURE,
119         PROP_CHAR_COMPLEX_LOCALE,
120         PROP_PARA_IS_CHARACTER_DISTANCE,
121 
122         PROP_WRITING_MODE,
123 
124         // don't use
125         FAST_PROPERTY_ID_END_CHAR_PROP
126     };
127 
128     static void AddPropertiesToVector(
129         ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
130 
131     static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
132 
133     static bool IsCharacterPropertyHandle( sal_Int32 nHandle );
134 
135     static ::com::sun::star::awt::FontDescriptor createFontDescriptorFromPropertySet(
136         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > & xMultiPropSet );
137 
138 private:
139     // not implemented
140     CharacterProperties();
141 };
142 
143 } //  namespace chart
144 
145 // CHART_CHARACTERPROPERTIES_HXX
146 #endif
147