]> git.lyx.org Git - lyx.git/blob - src/Citation.h
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / Citation.h
1 // -*- C++ -*-
2 /**
3  * \file Citation.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Herbert Voß
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef CITATION_H
13 #define CITATION_H
14
15 #include "support/docstring.h"
16 #include <string>
17 #include <vector>
18
19 namespace lyx {
20
21
22 enum CiteEngineType {
23         ENGINE_TYPE_AUTHORYEAR = 1,
24         ENGINE_TYPE_NUMERICAL = 2,
25         ENGINE_TYPE_DEFAULT = 3,
26 };
27
28
29 class CitationStyle
30 {
31 public:
32         ///
33         CitationStyle() : name("cite"), cmd("cite"), forceUpperCase(false),
34                 hasStarredVersion(false), hasQualifiedList(false),
35                 textAfter(false), textBefore(false) {}
36
37         /// the LyX name
38         std::string name;
39         /// the LaTeX command (might differ from the LyX name)
40         std::string cmd;
41         /// Optional alternative description what the starred version does (for the GUI)
42         std::string stardesc;
43         /// Optional tooltip for the starred version
44         std::string startooltip;
45         /// upper casing author prefixes (van -> Van)
46         bool forceUpperCase;
47         /// starred version (full author list by default)
48         bool hasStarredVersion;
49         /// allows for qualified citation lists (a Biblatex feature)
50         bool hasQualifiedList;
51         /// supports text after the citation
52         bool textAfter;
53         /// supports text before the citation
54         bool textBefore;
55 };
56
57
58 /**
59  * Class for storing information about a given citation item in a given context.
60  * This is used in the label and menu string generation process.
61  */
62 class CiteItem
63 {
64 public:
65         /// The context this citation is displayed
66         enum CiteContext{
67                 Everywhere,
68                 Dialog,
69                 Export
70         };
71         ///
72         CiteItem() : forceUpperCase(false), Starred(false), isQualified(false),
73                 context(CiteItem::Everywhere), textAfter(docstring()),
74                 textBefore(docstring()), max_size(128), max_key_size(128),
75                 richtext(false) {}
76         /// requests upper casing author prefixes (van -> Van)
77         bool forceUpperCase;
78         /// is starred version (full author list by default)
79         bool Starred;
80         /// is a real qualified list
81         bool isQualified;
82         /// where this to be displayed?
83         CiteItem::CiteContext context;
84         /// text after the citation
85         docstring textAfter;
86         /// text before the citation
87         docstring textBefore;
88         ///
89         typedef std::vector<std::pair<docstring, docstring>> QualifiedList;
90         /// Qualified lists's pre texts
91         QualifiedList pretexts;
92         ///
93         QualifiedList getPretexts() const { return pretexts; }
94         /// Qualified lists's post texts
95         QualifiedList posttexts;
96         ///
97         QualifiedList getPosttexts() const { return posttexts; }
98         /// the maximum display size as a label
99         size_t max_size;
100         /// the maximum size of the processed keys
101         /// (limited for performance reasons)
102         size_t max_key_size;
103         /// output richtext information?
104         bool richtext;
105 };
106
107 } // namespace lyx
108
109 #endif