summaryrefslogtreecommitdiffstats
path: root/src/rtfstyle.h
blob: a946b372fc4997018144b691f2316b6c9a41055b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/******************************************************************************
 *
 * Copyright (C) 1997-2020 by Dimitri van Heesch.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby
 * granted. No representations are made about the suitability of this software
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
 *
 */

#ifndef RTFSTYLE_H
#define RTFSTYLE_H

#include <map>
#include <string>

#include "qcstring.h"

// used for table column width calculation
const int rtf_pageWidth = 8748;

extern QCString rtf_title;
extern QCString rtf_subject;
extern QCString rtf_comments;
extern QCString rtf_company;
extern QCString rtf_logoFilename;
extern QCString rtf_author;
extern QCString rtf_manager;
extern QCString rtf_documentType;
extern QCString rtf_documentId;
extern QCString rtf_keywords;

struct RTFListItemInfo
{
  bool isEnum;
  int number;
  char type;
};

const int rtf_maxIndentLevels = 13;

extern RTFListItemInfo rtf_listItemInfo[rtf_maxIndentLevels];

struct Rtf_Style_Default
{
  const char *name;
  const char *reference;
  const char *definition;
};

extern char rtf_Style_Reset[];
extern Rtf_Style_Default rtf_Style_Default[];

struct StyleData
{
  // elements of this type are stored in dictionary Rtf_Style
  //
  // to define a tag in the header reference + definition is required
  // to use a tag in the body of the document only reference is required

  public:
    StyleData() = default;
    StyleData(const std::string &reference, const std::string &definition);
    bool setStyle(const std::string &command, const std::string &styleName);
    const char *reference() const { return m_reference.c_str(); }
    const char *definition() const { return m_definition.c_str(); }
    uint index() const { return m_index; }

  private:
    uint m_index = 0; // index in style-sheet, i.e. number in s-clause
    std::string m_reference;    // everything required to apply the style
    std::string m_definition;   // additional tags like \snext and style name
};

using StyleDataMap = std::map<std::string,StyleData>;

extern StyleDataMap rtf_Style;

void loadExtensions(const QCString &name);
void loadStylesheet(const QCString &name, StyleDataMap& map);

#endif