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 <map>
17 #include <string>
18 
19 namespace lyx {
20 
21 class Buffer;
22 
23 
24 enum CiteEngineType {
25 	ENGINE_TYPE_AUTHORYEAR = 1,
26 	ENGINE_TYPE_NUMERICAL = 2,
27 	ENGINE_TYPE_DEFAULT = 3,
28 };
29 
30 
31 class CitationStyle
32 {
33 public:
34 	///
CitationStyle()35 	CitationStyle() : name("cite"), cmd("cite"), forceUpperCase(false),
36 		hasStarredVersion(false), hasQualifiedList(false),
37 		textAfter(false), textBefore(false) {}
38 
39 	/// the LyX name
40 	std::string name;
41 	/// the LaTeX command (might differ from the LyX name)
42 	std::string cmd;
43 	/// Optional alternative description what the starred version does (for the GUI)
44 	std::string stardesc;
45 	/// Optional tooltip for the starred version
46 	std::string startooltip;
47 	/// upper casing author prefixes (van -> Van)
48 	bool forceUpperCase;
49 	/// starred version (full author list by default)
50 	bool hasStarredVersion;
51 	/// allows for qualified citation lists (a Biblatex feature)
52 	bool hasQualifiedList;
53 	/// supports text after the citation
54 	bool textAfter;
55 	/// supports text before the citation
56 	bool textBefore;
57 };
58 
59 
60 /**
61  * Class for storing information about a given citation item in a given context.
62  * This is used in the label and menu string generation process.
63  */
64 class CiteItem
65 {
66 public:
67 	/// The context this citation is displayed
68 	enum CiteContext{
69 		Everywhere,
70 		Dialog,
71 		Export
72 	};
73 	///
CiteItem()74 	CiteItem() : forceUpperCase(false), Starred(false), isQualified(false),
75 		context(CiteItem::Everywhere), textAfter(docstring()),
76 		textBefore(docstring()), max_size(128), max_key_size(128),
77 		richtext(false) {}
78 	/// requests upper casing author prefixes (van -> Van)
79 	bool forceUpperCase;
80 	/// is starred version (full author list by default)
81 	bool Starred;
82 	/// is a real qualified list
83 	bool isQualified;
84 	/// where this to be displayed?
85 	CiteItem::CiteContext context;
86 	/// text after the citation
87 	docstring textAfter;
88 	/// text before the citation
89 	docstring textBefore;
90 	/// Qualified lists's pre texts
91 	std::map<docstring, docstring> pretexts;
92 	///
getPretexts()93 	std::map<docstring, docstring> getPretexts() const { return pretexts; }
94 	/// Qualified lists's post texts
95 	std::map<docstring, docstring> posttexts;
96 	///
getPosttexts()97 	std::map<docstring, docstring> 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
110