nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / filter / ww8 / styles.cxx
blob5da6157f732be9088bd48682c043dcc933b7e041
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <wwstyles.hxx>
22 #include <osl/diagnose.h>
24 namespace
26 const char **GetStiNames() throw()
28 static const char *stiName[] =
30 "Normal",
31 "Heading 1",
32 "Heading 2",
33 "Heading 3",
34 "Heading 4",
35 "Heading 5",
36 "Heading 6",
37 "Heading 7",
38 "Heading 8",
39 "Heading 9",
40 "Index 1",
41 "Index 2",
42 "Index 3",
43 "Index 4",
44 "Index 5",
45 "Index 6",
46 "Index 7",
47 "Index 8",
48 "Index 9",
49 "TOC 1",
50 "TOC 2",
51 "TOC 3",
52 "TOC 4",
53 "TOC 5",
54 "TOC 6",
55 "TOC 7",
56 "TOC 8",
57 "TOC 9",
58 "Normal Indent",
59 "Footnote Text",
60 "Annotation Text",
61 "Header",
62 "Footer",
63 "Index Heading",
64 "Caption",
65 "Table of Figures",
66 "Envelope Address",
67 "Envelope Return",
68 "Footnote Reference",
69 "Annotation Reference",
70 "Line Number",
71 "Page Number",
72 "Endnote Reference",
73 "Endnote Text",
74 "Table of Authorities",
75 "Macro Text",
76 "TOA Heading",
77 "List",
78 "List 2",
79 "List 3",
80 "List 4",
81 "List 5",
82 "List Bullet",
83 "List Bullet 2",
84 "List Bullet 3",
85 "List Bullet 4",
86 "List Bullet 5",
87 "List Number",
88 "List Number 2",
89 "List Number 3",
90 "List Number 4",
91 "List Number 5",
92 "Title",
93 "Closing",
94 "Signature",
95 "Default Paragraph Font",
96 "Body Text",
97 "Body Text Indent",
98 "List Continue",
99 "List Continue 2",
100 "List Continue 3",
101 "List Continue 4",
102 "List Continue 5",
103 "Message Header",
104 "Subtitle",
105 "Salutation",
106 "Date",
107 "Body Text First Indent",
108 "Body Text First Indent 2",
109 "Note Heading",
110 "Body Text 2",
111 "Body Text 3",
112 "Body Text Indent 2",
113 "Body Text Indent 3",
114 "Block Text",
115 "Hyperlink",
116 "Followed Hyperlink",
117 "Strong",
118 "Emphasis",
119 "Document Map",
120 "Plain Text"
123 OSL_ENSURE( SAL_N_ELEMENTS(stiName) == ww::stiMax, "WrongSizeOfArray" );
125 return stiName;
129 namespace ww
131 const char* GetEnglishNameFromSti(sti eSti) throw()
133 if (eSti >= stiMax)
134 return nullptr;
135 else
136 return GetStiNames()[eSti];
139 bool StandardStiIsCharStyle(sti eSti) throw()
141 switch (eSti)
143 case stiFootnoteRef:
144 case stiAtnRef:
145 case stiLnn:
146 case stiPgn:
147 case stiEdnRef:
148 case stiNormalChar:
149 return true;
150 default:
151 return false;
155 sti GetCanonicalStiFromStc(sal_uInt8 stc) throw()
157 if (stc == 0)
158 return stiNormal;
159 else if (stc < 222)
160 return stiUser;
161 else
163 static const sti aMapping[] =
165 stiNil, stiAtnRef, stiAtnText, stiToc8, stiToc7, stiToc6,
166 stiToc5, stiToc4, stiToc3, stiToc2, stiToc1, stiIndex7,
167 stiIndex6, stiIndex5, stiIndex4, stiIndex3, stiIndex2,
168 stiIndex1, stiLnn, stiIndexHeading, stiFooter, stiHeader,
169 stiFootnoteRef, stiFootnoteText, stiLev9, stiLev8, stiLev7, stiLev6,
170 stiLev5, stiLev4, stiLev3, stiLev2, stiLev1, stiNormIndent
172 return aMapping[stc-222];
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */