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 .
21 #include "../inc/wwstyles.hxx"
23 #include <functional> //std::unary_function
24 #include <algorithm> //std::find_if
25 #include <tools/string.hxx> //do we have to...
27 #include "staticassert.hxx" //StaticAssert
31 class SameName
: public std::unary_function
<const sal_Char
*, bool>
36 explicit SameName(const String
&rName
) : mrName(rName
) {}
37 bool operator() (const sal_Char
*pEntry
) const
38 { return mrName
.EqualsAscii(pEntry
); }
41 const sal_Char
**GetStiNames() throw()
43 static const sal_Char
*stiName
[] =
84 "Annotation Reference",
89 "Table of Authorities",
110 "Default Paragraph Font",
122 "Body Text First Indent",
123 "Body Text First Indent 2",
127 "Body Text Indent 2",
128 "Body Text Indent 3",
131 "Followed Hyperlink",
138 OSL_ENSURE( (sizeof (stiName
) / sizeof (stiName
[0])) == ww::stiMax
, "WrongSizeOfArray" );
146 const sal_Char
* GetEnglishNameFromSti(sti eSti
) throw()
151 return GetStiNames()[eSti
];
154 bool StandardStiIsCharStyle(sti eSti
) throw()
170 sti
GetCanonicalStiFromStc(sal_uInt8 stc
) throw()
178 static sti aMapping
[] =
180 stiNil
, stiAtnRef
, stiAtnText
, stiToc8
, stiToc7
, stiToc6
,
181 stiToc5
, stiToc4
, stiToc3
, stiToc2
, stiToc1
, stiIndex7
,
182 stiIndex6
, stiIndex5
, stiIndex4
, stiIndex3
, stiIndex2
,
183 stiIndex1
, stiLnn
, stiIndexHeading
, stiFooter
, stiHeader
,
184 stiFtnRef
, stiFtnText
, stiLev9
, stiLev8
, stiLev7
, stiLev6
,
185 stiLev5
, stiLev4
, stiLev3
, stiLev2
, stiLev1
, stiNormIndent
187 return aMapping
[stc
-222];
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */