Version 24.2.2.2, tag libreoffice-24.2.2.2
[LibreOffice.git] / xmloff / source / style / prstylecond.cxx
bloba7ab66f8352d85abddfa573addba7c33b81bbed0
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 <rtl/ustring.hxx>
21 #include <prstylecond.hxx>
22 #include <xmloff/xmltoken.hxx>
24 using namespace ::xmloff::token;
26 // note: keep this in sync with the list of conditions in sw/source/uibase/chrdlg/ccoll.cxx
28 namespace {
30 struct ConditionMap
32 char const* aInternal;
33 XMLTokenEnum nExternal;
34 int aValue;
39 const ConditionMap g_ConditionMap[] =
41 { "TableHeader", XML_TABLE_HEADER, -1 },
42 { "Table", XML_TABLE, -1 },
43 { "Frame", XML_TEXT_BOX, -1 }, // FIXME - Not in ODF spec
44 { "Section", XML_SECTION, -1 },
45 { "Footnote", XML_FOOTNOTE, -1 },
46 { "Endnote", XML_ENDNOTE, -1 },
47 { "Header", XML_HEADER, -1 },
48 { "Footer", XML_FOOTER, -1 },
49 { "OutlineLevel1", XML_OUTLINE_LEVEL, 1 },
50 { "OutlineLevel2", XML_OUTLINE_LEVEL, 2 },
51 { "OutlineLevel3", XML_OUTLINE_LEVEL, 3 },
52 { "OutlineLevel4", XML_OUTLINE_LEVEL, 4 },
53 { "OutlineLevel5", XML_OUTLINE_LEVEL, 5 },
54 { "OutlineLevel6", XML_OUTLINE_LEVEL, 6 },
55 { "OutlineLevel7", XML_OUTLINE_LEVEL, 7 },
56 { "OutlineLevel8", XML_OUTLINE_LEVEL, 8 },
57 { "OutlineLevel9", XML_OUTLINE_LEVEL, 9 },
58 { "OutlineLevel10", XML_OUTLINE_LEVEL, 10 },
59 { "NumberingLevel1", XML_LIST_LEVEL, 1 },
60 { "NumberingLevel2", XML_LIST_LEVEL, 2 },
61 { "NumberingLevel3", XML_LIST_LEVEL, 3 },
62 { "NumberingLevel4", XML_LIST_LEVEL, 4 },
63 { "NumberingLevel5", XML_LIST_LEVEL, 5 },
64 { "NumberingLevel6", XML_LIST_LEVEL, 6 },
65 { "NumberingLevel7", XML_LIST_LEVEL, 7 },
66 { "NumberingLevel8", XML_LIST_LEVEL, 8 },
67 { "NumberingLevel9", XML_LIST_LEVEL, 9 },
68 { "NumberingLevel10", XML_LIST_LEVEL, 10 }
71 OUString GetParaStyleCondExternal( std::u16string_view internal)
73 for (size_t i = 0; i < SAL_N_ELEMENTS(g_ConditionMap); ++i)
75 if (o3tl::equalsAscii(internal, g_ConditionMap[i].aInternal ))
77 OUString aResult = GetXMLToken( g_ConditionMap[i].nExternal ) +
78 "()";
79 if (g_ConditionMap[i].aValue != -1)
81 aResult += "=" +
82 OUString::number( g_ConditionMap[i].aValue );
84 return aResult;
87 assert(!"GetParaStyleCondExternal: model has unknown style condition");
88 return OUString();
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */