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