android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / filter / ww8 / styles.cxx
blob33d0ad3dec5f53477c6d1310aac18ab14035bb3f
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 // Keep in sync with StyleSheetTable::ConvertStyleName
27 const char **GetStiNames() noexcept
29 // Matches enum ww::sti in sw/source/filter/inc/wwstyles.hxx
30 static const char *stiName[] =
32 "Normal", // stiNormal
33 "Heading 1", // stiLev1
34 "Heading 2", // stiLev2
35 "Heading 3", // stiLev3
36 "Heading 4", // stiLev4
37 "Heading 5", // stiLev5
38 "Heading 6", // stiLev6
39 "Heading 7", // stiLev7
40 "Heading 8", // stiLev8
41 "Heading 9", // stiLev9
42 "Index 1", // stiIndex1
43 "Index 2", // stiIndex2
44 "Index 3", // stiIndex3
45 "Index 4", // stiIndex4
46 "Index 5", // stiIndex5
47 "Index 6", // stiIndex6
48 "Index 7", // stiIndex7
49 "Index 8", // stiIndex8
50 "Index 9", // stiIndex9
51 "TOC 1", // stiToc1
52 "TOC 2", // stiToc2
53 "TOC 3", // stiToc3
54 "TOC 4", // stiToc4
55 "TOC 5", // stiToc5
56 "TOC 6", // stiToc6
57 "TOC 7", // stiToc7
58 "TOC 8", // stiToc8
59 "TOC 9", // stiToc9
60 "Normal Indent", // stiNormIndent
61 "Footnote Text", // stiFootnoteText
62 "Annotation Text", // stiAtnText
63 "Header", // stiHeader
64 "Footer", // stiFooter
65 "Index Heading", // stiIndexHeading
66 "Caption", // stiCaption
67 "Table of Figures", // stiToCaption
68 "Envelope Address", // stiEnvAddr
69 "Envelope Return", // stiEnvRet
70 "Footnote Reference", // stiFootnoteRef
71 "Annotation Reference", // stiAtnRef
72 "Line Number", // stiLnn
73 "Page Number", // stiPgn
74 "Endnote Reference", // stiEdnRef
75 "Endnote Text", // stiEdnText
76 "Table of Authorities", // stiToa
77 "Macro Text", // stiMacro
78 "TOC Heading", // stiToaHeading - tdf143726
79 "List", // stiList
80 "List Bullet", // stiListBullet
81 "List Number", // stiListNumber
82 "List 2", // stiList2
83 "List 3", // stiList3
84 "List 4", // stiList4
85 "List 5", // stiList5
86 "List Bullet 2", // stiListBullet2
87 "List Bullet 3", // stiListBullet3
88 "List Bullet 4", // stiListBullet4
89 "List Bullet 5", // stiListBullet5
90 "List Number 2", // stiListNumber2
91 "List Number 3", // stiListNumber3
92 "List Number 4", // stiListNumber4
93 "List Number 5", // stiListNumber5
94 "Title", // stiTitle
95 "Closing", // stiClosing
96 "Signature", // stiSignature
97 "Default Paragraph Font", // stiNormalChar
98 "Body Text", // stiBodyText
99 "Body Text Indent", // stiBodyTextInd1
100 "List Continue", // stiListCont
101 "List Continue 2", // stiListCont2
102 "List Continue 3", // stiListCont3
103 "List Continue 4", // stiListCont4
104 "List Continue 5", // stiListCont5
105 "Message Header", // stiMsgHeader
106 "Subtitle", // stiSubtitle
107 "Salutation", // stiSalutation
108 "Date", // stiDate
109 "Body Text First Indent", // stiBodyText1I
110 "Body Text First Indent 2", // stiBodyText1I2
111 "Note Heading", // stiNoteHeading
112 "Body Text 2", // stiBodyText2
113 "Body Text 3", // stiBodyText3
114 "Body Text Indent 2", // stiBodyTextInd2
115 "Body Text Indent 3", // stiBodyTextInd3
116 "Block Text", // stiBlockQuote
117 "Hyperlink", // stiHyperlink
118 "FollowedHyperlink", // stiHyperlinkFollowed
119 "Strong", // stiStrong
120 "Emphasis", // stiEmphasis
121 "Document Map", // stiNavPane
122 "Plain Text", // stiPlainText
125 static_assert(SAL_N_ELEMENTS(stiName) == ww::stiMax, "WrongSizeOfArray");
127 return stiName;
131 namespace ww
133 const char* GetEnglishNameFromSti(sti eSti) noexcept
135 if (eSti >= stiMax)
136 return nullptr;
137 else
138 return GetStiNames()[eSti];
141 bool StandardStiIsCharStyle(sti eSti) noexcept
143 switch (eSti)
145 case stiFootnoteRef:
146 case stiAtnRef:
147 case stiLnn:
148 case stiPgn:
149 case stiEdnRef:
150 case stiNormalChar:
151 return true;
152 default:
153 return false;
157 sti GetCanonicalStiFromStc(sal_uInt8 stc) noexcept
159 if (stc == 0)
160 return stiNormal;
161 else if (stc < 222)
162 return stiUser;
163 else
165 static const sti aMapping[] =
167 stiNil, stiAtnRef, stiAtnText, stiToc8, stiToc7, stiToc6,
168 stiToc5, stiToc4, stiToc3, stiToc2, stiToc1, stiIndex7,
169 stiIndex6, stiIndex5, stiIndex4, stiIndex3, stiIndex2,
170 stiIndex1, stiLnn, stiIndexHeading, stiFooter, stiHeader,
171 stiFootnoteRef, stiFootnoteText, stiLev9, stiLev8, stiLev7, stiLev6,
172 stiLev5, stiLev4, stiLev3, stiLev2, stiLev1, stiNormIndent
174 return aMapping[stc-222];
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */