]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlCitation.C
Removed // -*- C++ -*- from all .C files!
[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 <config.h>
15 #include <algorithm>
16
17 #ifdef __GNUG__
18 #pragma implementation
19 #endif
20
21 #include "ViewBase.h"
22 #include "ButtonControllerBase.h"
23 #include "ControlCitation.h"
24 #include "buffer.h"
25 #include "Dialogs.h"
26 #include "LyXView.h"
27
28 using std::pair;
29 using std::vector;
30 using SigC::slot;
31
32 ControlCitation::ControlCitation(LyXView & lv, Dialogs & d)
33         : ControlCommand(lv, d, LFUN_CITATION_INSERT)
34 {
35         // These are permanent connections so we won't bother
36         // storing a copy because we won't be disconnecting.
37         d_.showCitation.connect(slot(this, &ControlCitation::showInset));
38         d_.createCitation.connect(slot(this, &ControlCitation::createInset));
39 }
40
41
42 void ControlCitation::clearDaughterParams()
43 {
44         bibkeysInfo_.clear();
45 }
46
47
48 void ControlCitation::setDaughterParams()
49 {
50         vector<pair<string,string> > blist = lv_.buffer()->getBibkeyList();
51
52         typedef std::map<string, string>::value_type InfoMapValue;
53
54         for (vector<pair<string,string> >::size_type i=0; i<blist.size(); ++i) {
55                 bibkeysInfo_.insert(InfoMapValue(blist[i].first,
56                                                  blist[i].second));
57         }
58 }
59
60
61 biblio::InfoMap const & ControlCitation::bibkeysInfo() const
62 {
63         return bibkeysInfo_;
64 }