1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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 // tdf#161509: The case of the names must match Word-generated document's w:latentStyles
31 static const char *stiName
[] =
33 "Normal", // stiNormal
34 "heading 1", // stiLev1
35 "heading 2", // stiLev2
36 "heading 3", // stiLev3
37 "heading 4", // stiLev4
38 "heading 5", // stiLev5
39 "heading 6", // stiLev6
40 "heading 7", // stiLev7
41 "heading 8", // stiLev8
42 "heading 9", // stiLev9
43 "index 1", // stiIndex1
44 "index 2", // stiIndex2
45 "index 3", // stiIndex3
46 "index 4", // stiIndex4
47 "index 5", // stiIndex5
48 "index 6", // stiIndex6
49 "index 7", // stiIndex7
50 "index 8", // stiIndex8
51 "index 9", // stiIndex9
61 "Normal Indent", // stiNormIndent
62 "footnote text", // stiFootnoteText
63 "annotation text", // stiAtnText
64 "header", // stiHeader
65 "footer", // stiFooter
66 "index heading", // stiIndexHeading
67 "caption", // stiCaption
68 "table of figures", // stiToCaption
69 "envelope address", // stiEnvAddr
70 "envelope return", // stiEnvRet
71 "footnote reference", // stiFootnoteRef
72 "annotation reference", // stiAtnRef
73 "line number", // stiLnn
74 "page number", // stiPgn
75 "endnote reference", // stiEdnRef
76 "endnote text", // stiEdnText
77 "table of authorities", // stiToa
79 "TOC Heading", // stiToaHeading - tdf143726
81 "List Bullet", // stiListBullet
82 "List Number", // stiListNumber
87 "List Bullet 2", // stiListBullet2
88 "List Bullet 3", // stiListBullet3
89 "List Bullet 4", // stiListBullet4
90 "List Bullet 5", // stiListBullet5
91 "List Number 2", // stiListNumber2
92 "List Number 3", // stiListNumber3
93 "List Number 4", // stiListNumber4
94 "List Number 5", // stiListNumber5
96 "Closing", // stiClosing
97 "Signature", // stiSignature
98 "Default Paragraph Font", // stiNormalChar
99 "Body Text", // stiBodyText
100 "Body Text Indent", // stiBodyTextInd1
101 "List Continue", // stiListCont
102 "List Continue 2", // stiListCont2
103 "List Continue 3", // stiListCont3
104 "List Continue 4", // stiListCont4
105 "List Continue 5", // stiListCont5
106 "Message Header", // stiMsgHeader
107 "Subtitle", // stiSubtitle
108 "Salutation", // stiSalutation
110 "Body Text First Indent", // stiBodyText1I
111 "Body Text First Indent 2", // stiBodyText1I2
112 "Note Heading", // stiNoteHeading
113 "Body Text 2", // stiBodyText2
114 "Body Text 3", // stiBodyText3
115 "Body Text Indent 2", // stiBodyTextInd2
116 "Body Text Indent 3", // stiBodyTextInd3
117 "Block Text", // stiBlockQuote
118 "Hyperlink", // stiHyperlink
119 "FollowedHyperlink", // stiHyperlinkFollowed
120 "Strong", // stiStrong
121 "Emphasis", // stiEmphasis
122 "Document Map", // stiNavPane
123 "Plain Text", // stiPlainText
126 static_assert(SAL_N_ELEMENTS(stiName
) == ww::stiMax
, "WrongSizeOfArray");
134 const char* GetEnglishNameFromSti(sti eSti
) noexcept
139 return GetStiNames()[eSti
];
142 bool StandardStiIsCharStyle(sti eSti
) noexcept
158 sti
GetCanonicalStiFromStc(sal_uInt8 stc
) noexcept
166 static const sti aMapping
[] =
168 stiNil
, stiAtnRef
, stiAtnText
, stiToc8
, stiToc7
, stiToc6
,
169 stiToc5
, stiToc4
, stiToc3
, stiToc2
, stiToc1
, stiIndex7
,
170 stiIndex6
, stiIndex5
, stiIndex4
, stiIndex3
, stiIndex2
,
171 stiIndex1
, stiLnn
, stiIndexHeading
, stiFooter
, stiHeader
,
172 stiFootnoteRef
, stiFootnoteText
, stiLev9
, stiLev8
, stiLev7
, stiLev6
,
173 stiLev5
, stiLev4
, stiLev3
, stiLev2
, stiLev1
, stiNormIndent
175 return aMapping
[stc
-222];
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */