1
///////////////////////////////////////////////////////////////////////////////
3
// Purpose: wxSTEditorExporter
4
// Author: John Labenski, mostly others see src for copyright
7
// Copyright: (c) John Labenski, Neil Hodgson & others see steexprt.cpp
8
// Licence: wxWidgets licence
9
///////////////////////////////////////////////////////////////////////////////
14
#include <wx/stedit/stedefs.h>
16
//-----------------------------------------------------------------------------
17
// wxSTEditorExporter - simple class to export the contents of a
18
// wxSTEditor to a file or create a html string representation for use
19
// in wxHtmlEasyPrinting.
21
// Create this on demand, there is no use keeping it around.
22
//-----------------------------------------------------------------------------
33
class WXDLLIMPEXP_STEDIT wxSTEditorExporter
36
wxSTEditorExporter(wxSTEditor* editor);
38
// these are taken from SciTE src/Exporters.cxx
39
bool SaveToRTF(const wxFileName&, int start = 0, int end = -1);
40
bool SaveToHTMLCSS(const wxFileName&);
41
bool SaveToPDF(const wxFileName&);
42
bool SaveToTEX(const wxFileName&);
43
bool SaveToXML(const wxFileName&);
45
// Get a HTML representation of the text, w/ styles
46
// code originally from wxHatch by Chris Elliott
47
wxString RenderAsHTML();
48
bool SaveToHTML(const wxFileName&);
50
// Export to the file_format (enum STE_Export_Type) to the given fileName
51
// if !overwrite_prompt don't ask to overwrite
52
// if !msg_on_error don't show an error message on failure (write error)
53
bool ExportToFile(int file_format, const wxFileName&,
54
bool overwrite_prompt, bool msg_on_error);
56
static wxString GetExtension(int file_format); // see enum STE_Export_Type
57
static wxString GetWildcards(int file_format); // see enum STE_Export_Type
59
// -----------------------------------------------------------------------
62
// maps the stc style # to the appropriate ste style using the langs
63
// returns STE_STYLE_DEFAULT if the style isn't set
64
int SciToSTEStyle(int sci_style) const;
68
wxSTEditorPrefs m_stePrefs;
69
wxSTEditorStyles m_steStyles;
70
wxSTEditorLangs m_steLangs;
73
//-----------------------------------------------------------------------------
74
// wxSTEditorExportDialog - Choose format and filename to export text
76
// This does not save the file, see wxSTEditor::ShowExportDialog
77
//-----------------------------------------------------------------------------
79
class WXDLLIMPEXP_STEDIT wxSTEditorExportDialog : public wxDialog
82
wxSTEditorExportDialog(wxWindow* parent,
83
long style = wxDEFAULT_DIALOG_STYLE_RESIZE);
85
wxFileName GetFileName() const;
86
void SetFileName(const wxFileName&);
88
int GetFileFormat() const; // see enum STE_Export_Type
89
void SetFileFormat(int file_format);
91
// -----------------------------------------------------------------------
94
void OnChoice(wxCommandEvent& event);
95
void OnButton(wxCommandEvent& event);
97
wxFileName FileNameExtChange(const wxFileName&, int file_format) const;
99
wxChoice *m_fileFormatChoice;
100
wxComboBox *m_fileNameCombo;
102
static wxArrayString sm_fileNames; // remember previous settings
103
static int sm_file_format;
107
DECLARE_EVENT_TABLE()
108
DECLARE_ABSTRACT_CLASS(wxSTEditorExportDialog);
111
#endif // _STEEXPORT_H_