summaryrefslogtreecommitdiff
path: root/xmloff/source/forms/controlpropertymap.cxx
blob: 1b1bdf71880b3ee6406b901fa4cbd9af830bb10b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*************************************************************************
 *
 *  $RCSfile: controlpropertymap.cxx,v $
 *
 *  $Revision: 1.10 $
 *
 *  last change: $Author: fs $ $Date: 2001-06-07 12:28:30 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc..
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef _XMLOFF_XMLNMSPE_HXX
#include "xmlnmspe.hxx"
#endif
#ifndef _XMLOFF_XMLKYWD_HXX
#include "xmlkywd.hxx"
#endif
#ifndef _XMLOFF_PROPMAPPINGTYPES_HXX
#include "maptype.hxx"
#endif
#ifndef _XMLOFF_XMLTYPES_HXX
#include "xmltypes.hxx"
#endif
#ifndef __SGI_STL_ALGORITHM
#include <algorithm>
#endif

#ifndef _XMLOFF_FORMS_STRINGS_HXX_
#include "strings.hxx"
#endif

//.........................................................................
namespace xmloff
{
//.........................................................................

    XMLPropertyMapEntry aControlStyleProperties[] =
    {
        { PROPERTY_BACKGROUNDCOLOR, XML_NAMESPACE_FO,       sXML_background_color,      XML_TYPE_COLOR, 0 },
        { PROPERTY_ALIGN,           XML_NAMESPACE_STYLE,    sXML_text_align,            XML_TYPE_TEXT_ALIGN, 0 },
        { PROPERTY_BORDER,          XML_NAMESPACE_FO,       sXML_border,                XML_TYPE_CONTROL_BORDER, 0 },
        { "FontCharWidth",          XML_NAMESPACE_STYLE,    sXML_font_char_width,       XML_TYPE_NUMBER16, 0 },
        { "FontCharset",            XML_NAMESPACE_STYLE,    sXML_font_charset,          XML_TYPE_TEXT_FONTENCODING, 0 },
        { "FontFamily",             XML_NAMESPACE_STYLE,    sXML_font_family_generic,   XML_TYPE_TEXT_FONTFAMILY, 0 },
        { "FontHeight",             XML_NAMESPACE_FO,       sXML_font_size,             XML_TYPE_CHAR_HEIGHT, 0 },
        { "FontKerning",            XML_NAMESPACE_STYLE,    sXML_letter_kerning,        XML_TYPE_BOOL, 0 },
        { "FontName",               XML_NAMESPACE_STYLE,    sXML_font_name,             XML_TYPE_STRING, 0 },
        { "FontOrientation",        XML_NAMESPACE_STYLE,    sXML_rotation_angle,        XML_TYPE_ROTATION_ANGLE, 0 },
        { "FontPitch",              XML_NAMESPACE_STYLE,    sXML_font_pitch,            XML_TYPE_TEXT_FONTPITCH, 0 },
        { "FontSlant",              XML_NAMESPACE_FO,       sXML_font_style,            XML_TYPE_TEXT_POSTURE, 0 },
        { "FontStrikeout",          XML_NAMESPACE_STYLE,    sXML_text_crossing_out,     XML_TYPE_TEXT_CROSSEDOUT, 0 },
        { "FontStyleName",          XML_NAMESPACE_STYLE,    sXML_font_style_name,       XML_TYPE_STRING, 0 },
        { "FontUnderline",          XML_NAMESPACE_STYLE,    sXML_text_underline,        XML_TYPE_TEXT_UNDERLINE, 0 },
        { "FontWeight",             XML_NAMESPACE_FO,       sXML_font_weight,           XML_TYPE_TEXT_WEIGHT, 0 },
        { "FontWidth",              XML_NAMESPACE_STYLE,    sXML_font_width,            XML_TYPE_FONT_WIDTH, 0 },
        { "FontWordLineMode",       XML_NAMESPACE_FO,       sXML_score_spaces,          XML_TYPE_NBOOL, 0 },
        { "TextColor",              XML_NAMESPACE_FO,       sXML_color,                 XML_TYPE_COLOR, 0 },
        { PROPERTY_FORMATKEY,       XML_NAMESPACE_STYLE,    sXML_data_style_name,       XML_TYPE_STRING, 0 },
        { "FontEmphasisMark",       XML_NAMESPACE_STYLE,    sXML_text_emphasize,        XML_TYPE_CONTROL_TEXT_EMPHASIZE, 0 },
        { "FontRelief",             XML_NAMESPACE_STYLE,    sXML_font_relief,           XML_TYPE_TEXT_FONT_RELIEF|MID_FLAG_MULTI_PROPERTY, 0 },
        { "TextLineColor",          XML_NAMESPACE_STYLE,    sXML_text_underline_color,  XML_TYPE_TEXT_UNDERLINE_COLOR|MID_FLAG_MULTI_PROPERTY, 0 },
        { 0, 0, 0, 0 }
    };

    //=====================================================================
    //---------------------------------------------------------------------
    struct XMLPropertyMapEntryLess
    {
        sal_Bool operator()(const XMLPropertyMapEntry& _rLeft, const XMLPropertyMapEntry& _rRight)
        {
            return strcmp(_rLeft.msApiName, _rRight.msApiName) < 0;
        }
    };

    //---------------------------------------------------------------------
    void implSortMap(XMLPropertyMapEntry* _pMap)
    {
        // determine the last element
        for (XMLPropertyMapEntry* pEnd = _pMap; pEnd->msApiName; ++pEnd)
            ;
        ::std::sort(_pMap, pEnd, XMLPropertyMapEntryLess());
    }

    //---------------------------------------------------------------------
    void initializePropertyMaps()
    {
        static sal_Bool bSorted = sal_False;
        if (!bSorted)
        {
            implSortMap(aControlStyleProperties);
            bSorted = sal_True;
        }
    }

//.........................................................................
}   // namespace xmloff
//.........................................................................

/*************************************************************************
 * history:
 *  $Log: not supported by cvs2svn $
 *  Revision 1.9  2001/05/28 15:01:19  fs
 *  #86712# added a format key property
 *
 *  Revision 1.8  2001/04/19 13:23:48  fs
 *  arggghhhh .... remove the (double) TextColor entry
 *
 *  Revision 1.7  2001/04/19 13:21:29  fs
 *  #85097# add TextColor to the styles map, so it won't be exported as ordinary property
 *
 *  Revision 1.6  2001/04/02 05:58:40  fs
 *  added TextColor to the property map
 *
 *  Revision 1.5  2001/02/01 17:41:18  mh
 *  chg: header
 *
 *  Revision 1.4  2001/01/18 13:51:30  fs
 *  the background-color is part of the fo (not style) namespace
 *
 *  Revision 1.3  2000/12/19 12:13:57  fs
 *  some changes ... now the exported styles are XSL conform
 *
 *  Revision 1.1  2000/12/18 15:15:32  fs
 *  initial checkin - property maps
 *
 *
 *  Revision 1.0 14.12.00 10:09:14  fs
 ************************************************************************/