LibreOffice Module sw (master)  1
fields.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 "fields.hxx"
21 #include <osl/diagnose.h>
22 #include <stddef.h>
23 
24 namespace ww
25 {
26  const char *GetEnglishFieldName(eField eIndex) noexcept
27  {
28  //0 Signifies the field names I can't find.
29  // #i43956# - field <eFOOTREF> = 5 should be mapped to "REF"
30  // See [MS-DOC] 2.9.90 flt
31  // https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-doc/28a8d2c2-6107-409d-8f6a-e345ab6d4179
32  static const char *aFieldNames[] =
33  {
34  /* 0*/ nullptr,
35  /* 1*/ nullptr,
36  /* 2*/ nullptr,
37  /* 3*/ "REF",
38  /* 4*/ "XE",
39  /* 5*/ "REF",
40  /* 6*/ "SET",
41  /* 7*/ "IF",
42  /* 8*/ "INDEX",
43  /* 9*/ "TC",
44  /*10*/ "STYLEREF",
45  /*11*/ "RD",
46  /*12*/ "SEQ",
47  /*13*/ "TOC",
48  /*14*/ "INFO",
49  /*15*/ "TITLE",
50  /*16*/ "SUBJECT",
51  /*17*/ "AUTHOR",
52  /*18*/ "KEYWORDS",
53  /*19*/ "COMMENTS",
54  /*20*/ "LASTSAVEDBY",
55  /*21*/ "CREATEDATE",
56  /*22*/ "SAVEDATE",
57  /*23*/ "PRINTDATE",
58  /*24*/ "REVNUM",
59  /*25*/ "EDITTIME",
60  /*26*/ "NUMPAGES",
61  /*27*/ "NUMWORDS",
62  /*28*/ "NUMCHARS",
63  /*29*/ "FILENAME",
64  /*30*/ "TEMPLATE",
65  /*31*/ "DATE",
66  /*32*/ "TIME",
67  /*33*/ "PAGE",
68  /*34*/ "=",
69  /*35*/ "QUOTE",
70  /*36*/ nullptr,
71  /*37*/ "PAGEREF",
72  /*38*/ "ASK",
73  /*39*/ "FILLIN",
74  /*40*/ nullptr,
75  /*41*/ "NEXT",
76  /*42*/ "NEXTIF",
77  /*43*/ "SKIPIF",
78  /*44*/ "MERGEREC",
79  /*45*/ nullptr,
80  /*46*/ nullptr,
81  /*47*/ nullptr,
82  /*48*/ "PRINT",
83  /*49*/ "EQ",
84  /*50*/ "GOTOBUTTON",
85  /*51*/ "MACROBUTTON",
86  /*52*/ "AUTONUMOUT",
87  /*53*/ "AUTONUMLGL",
88  /*54*/ "AUTONUM",
89  /*55*/ nullptr,
90  /*56*/ "LINK",
91  /*57*/ "SYMBOL",
92  /*58*/ "EMBED",
93  /*59*/ "MERGEFIELD",
94  /*60*/ "USERNAME",
95  /*61*/ "USERINITIALS",
96  /*62*/ "USERADDRESS",
97  /*63*/ "BARCODE",
98  /*64*/ "DOCVARIABLE",
99  /*65*/ "SECTION",
100  /*66*/ "SECTIONPAGES",
101  /*67*/ "INCLUDEPICTURE",
102  /*68*/ "INCLUDETEXT",
103  /*69*/ "FILESIZE",
104  /*70*/ "FORMTEXT",
105  /*71*/ "FORMCHECKBOX",
106  /*72*/ "NOTEREF",
107  /*73*/ "TOA",
108  /*74*/ "TA",
109  /*75*/ "MERGESEQ",
110  /*76*/ nullptr,
111  /*77*/ "PRIVATE",
112  /*78*/ "DATABASE",
113  /*79*/ "AUTOTEXT",
114  /*80*/ "COMPARE",
115  /*81*/ nullptr,
116  /*82*/ nullptr,
117  /*83*/ "FORMDROPDOWN",
118  /*84*/ "ADVANCE",
119  /*85*/ "DOCPROPERTY",
120  /*86*/ nullptr,
121  /*87*/ "CONTROL",
122  /*88*/ "HYPERLINK",
123  /*89*/ "AUTOTEXTLIST",
124  /*90*/ "LISTNUM",
125  /*91*/ nullptr,
126  /*92*/ "BIDIOUTLINE",
127  /*93*/ "ADDRESSBLOCK",
128  /*94*/ "GREETINGLINE",
129  /*95*/ "SHAPE",
130  /*96*/ "BIBLIOGRAPHY",
131  /*97*/ "CITATION"
132  };
133 
134  size_t nIndex = static_cast<size_t>(eIndex);
135  if (nIndex >= SAL_N_ELEMENTS(aFieldNames))
136  eIndex = eNONE;
137  OSL_ENSURE(eIndex != eNONE, "Unknown WinWord Field");
138  return aFieldNames[eIndex];
139  }
140 }
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nIndex
#define SAL_N_ELEMENTS(arr)
const char * GetEnglishFieldName(eField eIndex) noexcept
Find the English Field Name from a winword index.
Definition: fields.cxx:26
const char *const aFieldNames[]
Definition: authfld.cxx:650