2 * \file ControlEmbeddedFiles.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "ControlEmbeddedFiles.h"
17 #include "FuncRequest.h"
23 #include "frontend_helpers.h"
24 #include "frontends/LyXView.h"
26 #include "support/FileFilterList.h"
27 #include "support/convert.h"
33 using support::FileFilterList;
37 ControlEmbeddedFiles::ControlEmbeddedFiles(Dialog & parent)
38 : Dialog::Controller(parent)
42 EmbeddedFiles & ControlEmbeddedFiles::embeddedFiles()
44 return kernel().buffer().embeddedFiles();
48 bool ControlEmbeddedFiles::initialiseParams(string const &)
54 void ControlEmbeddedFiles::updateEmbeddedFiles()
56 // copy buffer embeddedFiles to a local copy
57 kernel().buffer().embeddedFiles().update();
61 void ControlEmbeddedFiles::dispatchParams()
63 // lyx view will only be updated if we do something to the main window. :-)
64 kernel().dispatch(FuncRequest(LFUN_MESSAGE, message_));
68 void ControlEmbeddedFiles::goTo(EmbeddedFile const & item)
70 int id = item.parID();
72 string const tmp = convert<string>(item.parID());
73 kernel().lyxview().dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));
78 void ControlEmbeddedFiles::view(EmbeddedFile const & item)
80 formats.view(kernel().buffer(), item, formats.getFormatFromFile(item));
84 docstring const ControlEmbeddedFiles::browseFile()
86 std::pair<docstring, docstring> dir1(_("Documents|#o#O"),
87 lyx::from_utf8(lyxrc.document_path));
88 FileFilterList const filter(_("All file (*.*)"));
89 return browseRelFile(docstring(), lyx::from_utf8(kernel().bufferFilepath()),
90 _("Select a file to embed"),
95 bool ControlEmbeddedFiles::extract(EmbeddedFile const & item)
97 return item.extract(&kernel().buffer());
101 } // namespace frontend