]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCitation.C
Controller-view split of Graphics and Index popups.
[lyx.git] / src / frontends / controllers / ControlCitation.C
1 /* This file is part of
2  * ====================================================== 
3  *
4  *           LyX, The Document Processor
5  *
6  *           Copyright 2001 The LyX Team.
7  *
8  * ======================================================
9  *
10  * \file ControlCitation.C
11  * \author Angus Leeming <a.leeming@ic.ac.uk>
12  */
13
14 #include <algorithm>
15
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20 #include <config.h>
21
22 #include "ControlCitation.h"
23 #include "buffer.h"
24 #include "Dialogs.h"
25 #include "LyXView.h"
26
27 using std::pair;
28 using std::vector;
29 using SigC::slot;
30
31 ControlCitation::ControlCitation(LyXView & lv, Dialogs & d)
32         : ControlCommand(lv, d, LFUN_CITATION_INSERT)
33 {
34         // These are permanent connections so we won't bother
35         // storing a copy because we won't be disconnecting.
36         d_.showCitation.connect(slot(this, &ControlCitation::showInset));
37         d_.createCitation.connect(slot(this, &ControlCitation::createInset));
38 }
39
40
41 void ControlCitation::clearDaughterParams()
42 {
43         bibkeysInfo_.clear();
44 }
45
46
47 void ControlCitation::setDaughterParams()
48 {
49         vector<pair<string,string> > blist = lv_.buffer()->getBibkeyList();
50
51         typedef std::map<string, string>::value_type InfoMapValue;
52
53         for (vector<pair<string,string> >::size_type i=0; i<blist.size(); ++i) {
54                 bibkeysInfo_.insert(InfoMapValue(blist[i].first,
55                                                  blist[i].second));
56         }
57 }
58
59
60 biblio::InfoMap const & ControlCitation::bibkeysInfo() const
61 {
62         Assert(!bibkeysInfo_.empty());
63         return bibkeysInfo_;
64 }