LibreOffice Module sw (master) 1
styles.cxx
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
20#include <wwstyles.hxx>
21
22#include <osl/diagnose.h>
23
24namespace
25{
26 const char **GetStiNames() noexcept
27 {
28 static const char *stiName[] =
29 {
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 "TOC 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 "FollowedHyperlink",
117 "Strong",
118 "Emphasis",
119 "Document Map",
120 "Plain Text"
121 };
122
123 OSL_ENSURE( SAL_N_ELEMENTS(stiName) == ww::stiMax, "WrongSizeOfArray" );
124
125 return stiName;
126 }
127}
128
129namespace ww
130{
131 const char* GetEnglishNameFromSti(sti eSti) noexcept
132 {
133 if (eSti >= stiMax)
134 return nullptr;
135 else
136 return GetStiNames()[eSti];
137 }
138
139 bool StandardStiIsCharStyle(sti eSti) noexcept
140 {
141 switch (eSti)
142 {
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;
152 }
153 }
154
156 {
157 if (stc == 0)
158 return stiNormal;
159 else if (stc < 222)
160 return stiUser;
161 else
162 {
163 static const sti aMapping[] =
164 {
171 };
172 return aMapping[stc-222];
173 }
174 }
175}
176
177/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SAL_N_ELEMENTS(arr)
@HTML
const char * GetEnglishNameFromSti(sti eSti) noexcept
Find the WinWord english name from a sti index.
Definition: styles.cxx:131
sti
Definition: wwstyles.hxx:28
@ stiToc6
Definition: wwstyles.hxx:57
@ stiLev7
Definition: wwstyles.hxx:36
@ stiNormal
Definition: wwstyles.hxx:29
@ stiAtnText
Definition: wwstyles.hxx:65
@ stiLev4
Definition: wwstyles.hxx:33
@ stiIndex1
Definition: wwstyles.hxx:41
@ stiLev2
Definition: wwstyles.hxx:31
@ stiUser
Definition: wwstyles.hxx:132
@ stiNormIndent
Definition: wwstyles.hxx:63
@ stiMax
Definition: wwstyles.hxx:131
@ stiLev3
Definition: wwstyles.hxx:32
@ stiNormalChar
Definition: wwstyles.hxx:100
@ stiIndex2
Definition: wwstyles.hxx:42
@ stiIndexHeading
Definition: wwstyles.hxx:68
@ stiToc7
Definition: wwstyles.hxx:58
@ stiLev9
Definition: wwstyles.hxx:38
@ stiFootnoteText
Definition: wwstyles.hxx:64
@ stiToc8
Definition: wwstyles.hxx:59
@ stiIndex7
Definition: wwstyles.hxx:47
@ stiIndex6
Definition: wwstyles.hxx:46
@ stiEdnRef
Definition: wwstyles.hxx:77
@ stiLev5
Definition: wwstyles.hxx:34
@ stiIndex3
Definition: wwstyles.hxx:43
@ stiHeader
Definition: wwstyles.hxx:66
@ stiFooter
Definition: wwstyles.hxx:67
@ stiToc1
Definition: wwstyles.hxx:52
@ stiLnn
Definition: wwstyles.hxx:75
@ stiToc5
Definition: wwstyles.hxx:56
@ stiToc3
Definition: wwstyles.hxx:54
@ stiToc2
Definition: wwstyles.hxx:53
@ stiLev6
Definition: wwstyles.hxx:35
@ stiLev8
Definition: wwstyles.hxx:37
@ stiLev1
Definition: wwstyles.hxx:30
@ stiIndex5
Definition: wwstyles.hxx:45
@ stiToc4
Definition: wwstyles.hxx:55
@ stiPgn
Definition: wwstyles.hxx:76
@ stiIndex4
Definition: wwstyles.hxx:44
@ stiFootnoteRef
Definition: wwstyles.hxx:73
@ stiAtnRef
Definition: wwstyles.hxx:74
@ stiNil
Definition: wwstyles.hxx:133
bool StandardStiIsCharStyle(sti eSti) noexcept
Determine if the WinWord sti is standard Character Style.
Definition: styles.cxx:139
sti GetCanonicalStiFromStc(sal_uInt8 stc) noexcept
Find the WinWord sti index of an old <= Word2 stc (style code)
Definition: styles.cxx:155
unsigned char sal_uInt8