1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-09 17:32:53 +00:00
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
|
* \file InsetInclude.h
|
2002-09-09 17:32:53 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2007-10-23 18:51:04 +00:00
|
|
|
|
* \author Richard Heck (conversion to InsetCommand)
|
2002-09-25 14:26:13 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-09 17:32:53 +00:00
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
|
#ifndef INSET_INCLUDE_H
|
|
|
|
|
#define INSET_INCLUDE_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-08-20 17:04:36 +00:00
|
|
|
|
#include "BiblioInfo.h"
|
2007-10-23 15:02:15 +00:00
|
|
|
|
#include "InsetCommand.h"
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "InsetCommandParams.h"
|
|
|
|
|
#include "RenderButton.h"
|
|
|
|
|
#include "MailInset.h"
|
2007-05-24 14:10:35 +00:00
|
|
|
|
#include "Counters.h"
|
2007-08-30 20:46:42 +00:00
|
|
|
|
#include "EmbeddedFiles.h"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
Rename files in src/support, step one.
src/support/package.h src/support/Package.h Package
src/support/package.C.in src/support/Package.C.in Package
src/support/path.h src/support/Path.h Path
src/support/fs_extras.h src/support/fs_extras.h NOCLASSES
src/support/RandomAccessList.h src/support/RandomAccessList.h RandomAccessList
src/support/lyxmanip.h src/support/lyxmanip.h NOCLASSES
src/support/rename.C src/support/rename.cpp NOCLASSES
src/support/abort.C src/support/abort.cpp NOCLASSES
src/support/lyxlib.h src/support/lyxlib.h NOCLASSES
src/support/ExceptionMessage.h src/support/ExceptionMessage.h ExceptionMessage
src/support/copy.C src/support/copy.cpp NOCLASSES
src/support/limited_stack.h src/support/limited_stack.h limited_stack
src/support/filefilterlist.C src/support/FileFilterList.cpp ['FileFilterList', 'Filter']
src/support/cow_ptr.h src/support/cow_ptr.h cow_ptr
src/support/os_unix.C src/support/os_unix.cpp NOCLASSES
src/support/socktools.h src/support/socktools.h NOCLASSES
src/support/forkedcontr.h src/support/ForkedcallsController.h ForkedcallsController
src/support/os.h src/support/os.h NOCLASSES
src/support/FileMonitor.h src/support/FileMonitor.h FileMonitor
src/support/copied_ptr.h src/support/copied_ptr.h copied_ptr
src/support/translator.h src/support/Translator.h Translator
src/support/filetools.C src/support/filetools.cpp NOCLASSES
src/support/unlink.C src/support/unlink.cpp NOCLASSES
src/support/os_win32.C src/support/os_win32.cpp GetFolderPath
src/support/lstrings.C src/support/lstrings.cpp NOCLASSES
src/support/qstring_helpers.C src/support/qstring_helpers.cpp NOCLASSES
src/support/getcwd.C src/support/getcwd.cpp NOCLASSES
src/support/systemcall.C src/support/Systemcall.cpp Systemcall
src/support/lyxalgo.h src/support/lyxalgo.h NOCLASSES
src/support/filefilterlist.h src/support/FileFilterList.h ['FileFilterList', 'Filter']
src/support/unicode.C src/support/unicode.cpp IconvProcessor
src/support/userinfo.C src/support/userinfo.cpp NOCLASSES
src/support/lyxtime.C src/support/lyxtime.cpp NOCLASSES
src/support/kill.C src/support/kill.cpp NOCLASSES
src/support/docstring.C src/support/docstring.cpp to_local8bit_failure
src/support/os_cygwin.C src/support/os_cygwin.cpp NOCLASSES
src/support/lyxsum.C src/support/lyxsum.cpp NOCLASSES
src/support/environment.C src/support/environment.cpp NOCLASSES
src/support/filetools.h src/support/filetools.h NOCLASSES
src/support/textutils.C src/support/textutils.cpp NOCLASSES
src/support/mkdir.C src/support/mkdir.cpp NOCLASSES
src/support/forkedcall.C src/support/Forkedcall.cpp ['ForkedProcess', 'Forkedcall']
src/support/tempname.C src/support/tempname.cpp NOCLASSES
src/support/os_win32.h src/support/os_win32.h GetFolderPath
src/support/types.h src/support/types.h NOCLASSES
src/support/lstrings.h src/support/lstrings.h NOCLASSES
src/support/forkedcallqueue.C src/support/ForkedCallQueue.cpp ForkedCallQueue
src/support/qstring_helpers.h src/support/qstring_helpers.h NOCLASSES
src/support/convert.C src/support/convert.cpp NOCLASSES
src/support/filename.C src/support/FileName.cpp ['FileName', 'DocFileName']
src/support/tests/convert.C src/support/tests/convert.cpp NOCLASSES
src/support/tests/filetools.C src/support/tests/filetools.cpp NOCLASSES
src/support/tests/lstrings.C src/support/tests/lstrings.cpp NOCLASSES
src/support/tests/boost.C src/support/tests/boost.cpp NOCLASSES
src/support/docstream.C src/support/docstream.cpp ['iconv_codecvt_facet_exception', 'idocfstream', 'odocfstream']
src/support/std_istream.h src/support/std_istream.h NOCLASSES
src/support/systemcall.h src/support/Systemcall.h Systemcall
src/support/chdir.C src/support/chdir.cpp NOCLASSES
src/support/std_ostream.h src/support/std_ostream.h NOCLASSES
src/support/unicode.h src/support/unicode.h IconvProcessor
src/support/path.C src/support/Path.cpp Path
src/support/fs_extras.C src/support/fs_extras.cpp NOCLASSES
src/support/userinfo.h src/support/userinfo.h NOCLASSES
src/support/lyxtime.h src/support/lyxtime.h NOCLASSES
src/support/docstring.h src/support/docstring.h to_local8bit_failure
src/support/debugstream.h src/support/debugstream.h basic_debugstream
src/support/environment.h src/support/environment.h NOCLASSES
src/support/textutils.h src/support/textutils.h NOCLASSES
src/support/forkedcall.h src/support/Forkedcall.h ['ForkedProcess', 'Forkedcall']
src/support/socktools.C src/support/socktools.cpp NOCLASSES
src/support/forkedcallqueue.h src/support/ForkedCallQueue.h ForkedCallQueue
src/support/forkedcontr.C src/support/ForkedcallsController.cpp ForkedcallsController
src/support/os.C src/support/os.cpp NOCLASSES
src/support/convert.h src/support/convert.h NOCLASSES
src/support/filename.h src/support/FileName.h ['FileName', 'DocFileName']
src/support/docstream.h src/support/docstream.h ['iconv_codecvt_facet_exception', 'idocfstream', 'odocfstream']
src/support/FileMonitor.C src/support/FileMonitor.cpp FileMonitor
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18024 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-26 05:12:52 +00:00
|
|
|
|
#include "support/FileName.h"
|
2006-12-01 20:09:08 +00:00
|
|
|
|
|
2002-08-01 17:28:59 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2003-06-12 08:52:36 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2000-07-27 08:55:59 +00:00
|
|
|
|
class Buffer;
|
2003-09-07 01:45:40 +00:00
|
|
|
|
class Dimension;
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class LaTeXFeatures;
|
2003-10-10 21:08:55 +00:00
|
|
|
|
class RenderMonitoredPreview;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
2002-09-09 17:32:53 +00:00
|
|
|
|
/// for including tex/lyx files
|
2007-10-23 15:02:15 +00:00
|
|
|
|
class InsetInclude : public InsetCommand {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
2001-03-14 10:57:39 +00:00
|
|
|
|
///
|
2003-09-19 10:16:33 +00:00
|
|
|
|
InsetInclude(InsetCommandParams const &);
|
2001-03-14 10:57:39 +00:00
|
|
|
|
|
2002-08-01 17:28:59 +00:00
|
|
|
|
/// Override these InsetButton methods if Previewing
|
2007-09-21 20:39:47 +00:00
|
|
|
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
2002-08-01 17:28:59 +00:00
|
|
|
|
///
|
2003-05-30 06:48:24 +00:00
|
|
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
2003-10-21 13:04:14 +00:00
|
|
|
|
///
|
2007-05-18 14:32:29 +00:00
|
|
|
|
virtual DisplayType display() const;
|
2003-05-26 09:13:55 +00:00
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetCode lyxCode() const { return INCLUDE_CODE; }
|
2003-09-18 20:18:39 +00:00
|
|
|
|
/** Fills \c list
|
|
|
|
|
* \param buffer the Buffer containing this inset.
|
|
|
|
|
* \param list the list of labels in the child buffer.
|
|
|
|
|
*/
|
|
|
|
|
void getLabelList(Buffer const & buffer,
|
2006-10-21 00:16:43 +00:00
|
|
|
|
std::vector<docstring> & list) const;
|
2003-09-18 20:18:39 +00:00
|
|
|
|
/** Fills \c keys
|
|
|
|
|
* \param buffer the Buffer containing this inset.
|
|
|
|
|
* \param keys the list of bibkeys in the child buffer.
|
2007-08-16 01:59:20 +00:00
|
|
|
|
* \param it not used here
|
2003-09-18 20:18:39 +00:00
|
|
|
|
*/
|
2007-08-16 01:59:20 +00:00
|
|
|
|
virtual void fillWithBibKeys(Buffer const & buffer,
|
2007-08-20 16:30:02 +00:00
|
|
|
|
BiblioInfo & keys, InsetIterator const & it) const;
|
2007-08-16 01:59:20 +00:00
|
|
|
|
|
2006-04-15 11:46:17 +00:00
|
|
|
|
/** Update the cache with all bibfiles in use of the child buffer
|
|
|
|
|
* (including bibfiles of grandchild documents).
|
2006-05-19 07:21:43 +00:00
|
|
|
|
* Does nothing if the child document is not loaded to prevent
|
|
|
|
|
* automatic loading of all child documents upon loading the master.
|
2006-04-15 11:46:17 +00:00
|
|
|
|
* \param buffer the Buffer containing this inset.
|
|
|
|
|
*/
|
|
|
|
|
void updateBibfilesCache(Buffer const & buffer);
|
|
|
|
|
/** Return the cache with all bibfiles in use of the child buffer
|
|
|
|
|
* (including bibfiles of grandchild documents).
|
2006-05-19 07:21:43 +00:00
|
|
|
|
* Return an empty vector if the child doc is not loaded.
|
2006-04-15 11:46:17 +00:00
|
|
|
|
* \param buffer the Buffer containing this inset.
|
|
|
|
|
*/
|
2006-12-01 20:09:08 +00:00
|
|
|
|
std::vector<support::FileName> const &
|
2007-10-23 15:02:15 +00:00
|
|
|
|
getBibfilesCache(Buffer const & buffer) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-09-19 10:16:33 +00:00
|
|
|
|
EDITABLE editable() const { return IS_EDITABLE; }
|
2001-07-20 14:18:48 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
int latex(Buffer const &, odocstream &,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
int plaintext(Buffer const &, odocstream &,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const &) const;
|
2000-12-28 16:22:28 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
int docbook(Buffer const &, odocstream &,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const &) const;
|
2000-07-01 12:54:45 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
void validate(LaTeXFeatures &) const;
|
2002-08-01 17:28:59 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void addPreview(graphics::PreviewLoader &) const;
|
2005-04-22 08:57:22 +00:00
|
|
|
|
///
|
2007-06-22 13:38:07 +00:00
|
|
|
|
void addToToc(TocList &, Buffer const &, ParConstIterator const &) const;
|
2006-11-13 16:53:49 +00:00
|
|
|
|
///
|
2007-08-15 12:15:16 +00:00
|
|
|
|
void updateLabels(Buffer const & buffer, ParIterator const &);
|
2007-08-30 20:46:42 +00:00
|
|
|
|
/// child document can be embedded
|
2007-09-09 07:07:13 +00:00
|
|
|
|
void registerEmbeddedFiles(Buffer const &, EmbeddedFiles &) const;
|
2007-10-25 04:13:56 +00:00
|
|
|
|
///
|
|
|
|
|
static CommandInfo const * findInfo(std::string const &);
|
|
|
|
|
///
|
|
|
|
|
static std::string defaultCommand() { return "include"; };
|
|
|
|
|
///
|
|
|
|
|
static bool isCompatibleCommand(std::string const & s);
|
2003-10-17 18:01:15 +00:00
|
|
|
|
protected:
|
2004-11-23 23:04:52 +00:00
|
|
|
|
InsetInclude(InsetInclude const &);
|
2003-10-17 18:01:15 +00:00
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
private:
|
2007-08-30 18:03:17 +00:00
|
|
|
|
virtual Inset * clone() const;
|
2004-11-23 23:04:52 +00:00
|
|
|
|
|
2003-10-10 21:08:55 +00:00
|
|
|
|
/** Slot receiving a signal that the external file has changed
|
|
|
|
|
* and the preview should be regenerated.
|
|
|
|
|
*/
|
|
|
|
|
void fileChanged() const;
|
|
|
|
|
|
2003-09-19 10:16:33 +00:00
|
|
|
|
/// set the parameters
|
|
|
|
|
void set(InsetCommandParams const & params, Buffer const &);
|
|
|
|
|
/// get the text displayed on the button
|
2006-10-21 00:16:43 +00:00
|
|
|
|
docstring const getScreenLabel(Buffer const &) const;
|
2002-03-21 17:09:55 +00:00
|
|
|
|
/// holds the entity name that defines the file location (SGML)
|
2006-10-21 19:40:29 +00:00
|
|
|
|
docstring const include_label;
|
2002-08-01 17:28:59 +00:00
|
|
|
|
|
|
|
|
|
/// The pointer never changes although *preview_'s contents may.
|
2003-10-10 21:08:55 +00:00
|
|
|
|
boost::scoped_ptr<RenderMonitoredPreview> const preview_;
|
2003-06-02 10:03:27 +00:00
|
|
|
|
|
|
|
|
|
/// cache
|
2003-06-12 08:52:36 +00:00
|
|
|
|
mutable bool set_label_;
|
2003-10-10 21:08:55 +00:00
|
|
|
|
mutable RenderButton button_;
|
2007-08-12 21:43:58 +00:00
|
|
|
|
mutable docstring listings_label_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2007-08-13 19:40:54 +00:00
|
|
|
|
/// return loaded Buffer or zero if the file loading did not proceed.
|
|
|
|
|
Buffer * loadIfNeeded(Buffer const & parent, InsetCommandParams const & params);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2002-09-09 17:32:53 +00:00
|
|
|
|
#endif // INSETINCLUDE_H
|