GNU Aspell integration: spelling/style now separate

This commit is contained in:
Gerald Schmidt 2008-01-21 23:05:47 +00:00
parent f3655748bb
commit 4bef2eea7e
4 changed files with 207 additions and 96 deletions

View File

@ -21,6 +21,7 @@
#include "readfile.h" #include "readfile.h"
HouseStyle::HouseStyle ( HouseStyle::HouseStyle (
int typeParameter,
const std::string& bufferParameter, const std::string& bufferParameter,
const std::string& ruleDirectoryParameter, const std::string& ruleDirectoryParameter,
const std::string& ruleFileParameter, const std::string& ruleFileParameter,
@ -28,6 +29,7 @@ HouseStyle::HouseStyle (
const std::string& filterFileParameter, const std::string& filterFileParameter,
const std::string& pathSeparatorParameter, const std::string& pathSeparatorParameter,
int contextRangeParameter ) : int contextRangeParameter ) :
type ( typeParameter ),
buffer ( bufferParameter ), buffer ( bufferParameter ),
ruleDirectory ( ruleDirectoryParameter ), ruleDirectory ( ruleDirectoryParameter ),
ruleFile ( ruleFileParameter ), ruleFile ( ruleFileParameter ),
@ -48,7 +50,7 @@ void HouseStyle::collectFilter (
std::set<std::string>& excludeSet, std::set<std::string>& excludeSet,
int *filterCount ) int *filterCount )
{ {
if ( fileName == "(No filter)" ) if ( type == HS_TYPE_SPELL || fileName == "(No filter)" )
return; return;
string filePath, buffer; string filePath, buffer;
@ -112,6 +114,9 @@ void HouseStyle::collectRules ( string& fileName,
std::set<string>& excludeSet, std::set<string>& excludeSet,
int *ruleCount ) int *ruleCount )
{ {
if (type == HS_TYPE_SPELL)
return;
std::string filePath, buffer; std::string filePath, buffer;
filePath = ruleDirectory + pathSeparator + fileName; filePath = ruleDirectory + pathSeparator + fileName;
if ( !ReadFile::run ( filePath, buffer ) ) if ( !ReadFile::run ( filePath, buffer ) )
@ -159,7 +164,7 @@ void HouseStyle::collectRules ( string& fileName,
bool HouseStyle::createReport() bool HouseStyle::createReport()
{ {
if ( !updateRules() ) if ( type == HS_TYPE_STYLE && !updateRules() )
{ {
error = "no rules found"; error = "no rules found";
return false; return false;
@ -178,19 +183,22 @@ bool HouseStyle::createReport()
int ruleVectorsize, nodeVectorSize; int ruleVectorsize, nodeVectorSize;
/*
boost::shared_ptr<Rule> rule(new Rule(
"_",
false));
*/
std::vector<ContextMatch> contextVector; std::vector<ContextMatch> contextVector;
std::vector<ContextMatch>::iterator matchIterator; std::vector<ContextMatch>::iterator matchIterator;
ruleVectorsize = ruleVector->size(); ruleVectorsize = ruleVector->size();
nodeVectorSize = nodeVector.size(); nodeVectorSize = nodeVector.size();
Spellcheck spellcheck ( dictionary, passiveDictionary ); WrapAspell *spellcheck = NULL;
try {
if (type == HS_TYPE_SPELL)
spellcheck = new WrapAspell( ruleFile );
}
catch (...)
{
error = "Cannot initialise spellcheck";
return false;
}
std::string nodeBuffer; std::string nodeBuffer;
unsigned elementCount; unsigned elementCount;
@ -202,58 +210,84 @@ bool HouseStyle::createReport()
if ( !nodeBuffer.size() ) if ( !nodeBuffer.size() )
continue; continue;
// try spelling first
if ( type == HS_TYPE_SPELL && spellcheck )
{
spellcheck->checkString (
nodeBuffer,
contextVector,
contextRange );
for ( matchIterator = contextVector.begin();
matchIterator != contextVector.end();
matchIterator++ )
{
matchIterator->report = "Not in dictionary";
matchIterator->elementCount = elementCount;
matchVector.push_back ( *matchIterator );
}
contextVector.clear();
continue; // bail out before we reach style loop
}
// otherwise, proceed with style check
for ( int i = 0; i < ruleVectorsize; i++ ) for ( int i = 0; i < ruleVectorsize; i++ )
{ {
//rule = ruleVector->at(i); if ( type == HS_TYPE_STYLE )
boost::shared_ptr<Rule> rule ( ruleVector->at ( i ) );
if ( rule->matchPatternGlobal (
nodeBuffer,
contextVector,
elementCount,
contextRange ) )
{ {
std::string report = rule->getReport(); boost::shared_ptr<Rule> rule ( ruleVector->at ( i ) );
if ( rule->matchPatternGlobal (
nodeBuffer,
contextVector,
elementCount,
contextRange ) )
{
std::string report = rule->getReport();
for ( matchIterator = contextVector.begin();
matchIterator != contextVector.end();
matchIterator++ )
{
if ( rule->getAdjustCaseAttribute() )
CaseHandler::adjustCase (
matchIterator->replace,
matchIterator->match );
// tentative?
matchIterator->tentative =
( rule->getTentativeAttribute() ) ? true : false;
matchIterator->report = report;
matchVector.push_back ( *matchIterator );
}
contextVector.clear();
}
}
/*
// check spelling
else // if ( !dictionary->empty() )
{
spellcheck->checkString (
nodeBuffer,
contextVector,
contextRange );
for ( matchIterator = contextVector.begin(); for ( matchIterator = contextVector.begin();
matchIterator != contextVector.end(); matchIterator != contextVector.end();
matchIterator++ ) matchIterator++ )
{ {
if ( rule->getAdjustCaseAttribute() ) matchIterator->report = "Not in dictionary";
CaseHandler::adjustCase ( matchIterator->elementCount = elementCount;
matchIterator->replace,
matchIterator->match );
// tentative?
matchIterator->tentative =
( rule->getTentativeAttribute() ) ? true : false;
matchIterator->report = report;
matchVector.push_back ( *matchIterator ); matchVector.push_back ( *matchIterator );
} }
contextVector.clear(); contextVector.clear();
} }
} */
// check spelling
if ( !dictionary->empty() )
{
spellcheck.checkString (
nodeBuffer,
contextVector,
contextRange );
for ( matchIterator = contextVector.begin();
matchIterator != contextVector.end();
matchIterator++ )
{
matchIterator->report = "Not in dictionary";
matchIterator->elementCount = elementCount;
matchVector.push_back ( *matchIterator );
}
contextVector.clear();
} }
} }
delete spellcheck; // ok if NULL
return true; return true;
} }

View File

@ -31,13 +31,20 @@
#include "xmlrulereader.h" #include "xmlrulereader.h"
#include "housestylereader.h" #include "housestylereader.h"
#include "xmlfilterreader.h" #include "xmlfilterreader.h"
#include "spellcheck.h" //#include "spellcheck.h"
#include "wrapaspell.h"
#include "casehandler.h" #include "casehandler.h"
enum {
HS_TYPE_SPELL = 0,
HS_TYPE_STYLE
};
class HouseStyle class HouseStyle
{ {
public: public:
HouseStyle ( HouseStyle (
int type,
const std::string& bufferParameter, const std::string& bufferParameter,
const std::string& ruleDirectoryParameter, const std::string& ruleDirectoryParameter,
const std::string& ruleFileParameter, const std::string& ruleFileParameter,
@ -50,6 +57,7 @@ class HouseStyle
std::string getLastError(); std::string getLastError();
std::vector<ContextMatch> getMatchVector(); std::vector<ContextMatch> getMatchVector();
private: private:
int type;
std::string std::string
buffer, buffer,
ruleDirectory, ruleDirectory,

View File

@ -18,10 +18,15 @@
*/ */
#include <wx/intl.h> #include <wx/intl.h>
#include "aspell.h"
#include "styledialog.h" #include "styledialog.h"
#include "nocasecompare.h" #include "nocasecompare.h"
#define ngettext wxGetTranslation #define ngettext wxGetTranslation
#ifdef __WXMSW__
#include "aspellpaths.h"
#endif
BEGIN_EVENT_TABLE ( StyleDialog, wxDialog ) BEGIN_EVENT_TABLE ( StyleDialog, wxDialog )
EVT_BUTTON ( ID_STYLE_REPORT, StyleDialog::OnReport ) EVT_BUTTON ( ID_STYLE_REPORT, StyleDialog::OnReport )
EVT_BUTTON ( ID_STYLE_IGNORE_ALL, StyleDialog::OnStyleIgnoreAll ) EVT_BUTTON ( ID_STYLE_IGNORE_ALL, StyleDialog::OnStyleIgnoreAll )
@ -52,13 +57,14 @@ StyleDialog::StyleDialog (
const wxString& browserParameter, const wxString& browserParameter,
const wxString& ruleSetPresetParameter, const wxString& ruleSetPresetParameter,
const wxString& filterPresetParameter, const wxString& filterPresetParameter,
int typeParameter,
bool readOnlyParameter, bool readOnlyParameter,
wxPoint position, wxPoint position,
wxSize size ) wxSize size )
: wxDialog ( : wxDialog (
parent, parent,
wxID_ANY, wxID_ANY,
wxString ( _ ( "Spelling and Style" ) ), wxString ( ( typeParameter == ID_TYPE_STYLE) ? _ ( "Style" ) : _ ( "Spelling" ) ),
position, position,
size, size,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX ), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX ),
@ -69,11 +75,11 @@ StyleDialog::StyleDialog (
browser ( browserParameter ), browser ( browserParameter ),
ruleSetPreset ( ruleSetPresetParameter ), ruleSetPreset ( ruleSetPresetParameter ),
filterPreset ( filterPresetParameter ), filterPreset ( filterPresetParameter ),
type(typeParameter),
readOnly ( readOnlyParameter ) readOnly ( readOnlyParameter )
{ {
SetIcon ( icon ); SetIcon ( icon );
wxSize buttonSize ( 100, wxDefaultCoord );
// top box // top box
ruleSetCombo = new wxComboBox ( ruleSetCombo = new wxComboBox (
@ -83,18 +89,25 @@ StyleDialog::StyleDialog (
wxDefaultPosition, wxDefaultPosition,
wxSize ( 200, -1 ) wxSize ( 200, -1 )
); );
filterCombo = new wxComboBox (
this, int width, height;
ID_STYLE_COMBO_FILTER, ruleSetCombo->GetSize ( &width, &height );
_T ( "" ), wxSize buttonSize ( 100, height );
wxDefaultPosition,
wxSize ( 200, -1 )
); filterCombo = new wxComboBox (
this,
ID_STYLE_COMBO_FILTER,
_T ( "" ),
wxDefaultPosition,
wxSize ( 200, -1 ) );
if (type != ID_TYPE_STYLE)
filterCombo->Show ( false );
wxButton *createReportButton = new wxButton ( wxButton *createReportButton = new wxButton (
this, this,
ID_STYLE_REPORT, ID_STYLE_REPORT,
_ ( "&Report" ), _ ( "&Check" ),
wxDefaultPosition, wxDefaultPosition,
buttonSize, buttonSize,
0 ); 0 );
@ -114,9 +127,10 @@ StyleDialog::StyleDialog (
int widthUnit = 35; int widthUnit = 35;
myTable->InsertColumn ( 0, _ ( "No." ), wxLIST_FORMAT_LEFT, widthUnit * 1 ); myTable->InsertColumn ( 0, _ ( "No." ), wxLIST_FORMAT_LEFT, widthUnit * 1 );
myTable->InsertColumn ( 1, _ ( "Context" ), wxLIST_FORMAT_RIGHT, widthUnit * 3 ); myTable->InsertColumn ( 1, _ ( "Context" ), wxLIST_FORMAT_RIGHT, widthUnit * 3 );
myTable->InsertColumn ( 2, _ ( "Match" ), wxLIST_FORMAT_CENTER, widthUnit * 3 ); myTable->InsertColumn ( 2, _ ( "Error" ), wxLIST_FORMAT_CENTER, widthUnit * 3 );
myTable->InsertColumn ( 3, _ ( "Context" ), wxLIST_FORMAT_LEFT, widthUnit * 3 ); myTable->InsertColumn ( 3, _ ( "Context" ), wxLIST_FORMAT_LEFT, widthUnit * 3 );
myTable->InsertColumn ( 4, _ ( "Suggestion" ), wxLIST_FORMAT_LEFT, widthUnit * 3 ); myTable->InsertColumn ( 4, _ ( "Suggestion" ), wxLIST_FORMAT_LEFT, widthUnit * 3 );
myTable->InsertColumn ( 5, _ ( "Rule" ), wxLIST_FORMAT_LEFT, widthUnit * 3 ); myTable->InsertColumn ( 5, _ ( "Rule" ), wxLIST_FORMAT_LEFT, widthUnit * 3 );
myTable->InsertColumn ( 6, _ ( "Action" ), wxLIST_FORMAT_LEFT, widthUnit * 3 ); myTable->InsertColumn ( 6, _ ( "Action" ), wxLIST_FORMAT_LEFT, widthUnit * 3 );
table = myTable; table = myTable;
@ -126,9 +140,9 @@ StyleDialog::StyleDialog (
new wxButton ( new wxButton (
this, this,
ID_STYLE_EDIT, ID_STYLE_EDIT,
_ ( "&Edit" ), _ ( "&Apply changes" ),
wxDefaultPosition, wxDefaultPosition,
buttonSize, wxSize ( -1, buttonSize.GetHeight() ),
0 ); 0 );
wxButton *webReportButton = wxButton *webReportButton =
new wxButton ( new wxButton (
@ -136,7 +150,7 @@ StyleDialog::StyleDialog (
ID_STYLE_WEB_REPORT, ID_STYLE_WEB_REPORT,
_ ( "&Printable report" ), _ ( "&Printable report" ),
wxDefaultPosition, wxDefaultPosition,
buttonSize, wxSize ( -1, buttonSize.GetHeight() ),
0 ); 0 );
wxButton *webSummaryButton = wxButton *webSummaryButton =
new wxButton ( new wxButton (
@ -144,15 +158,15 @@ StyleDialog::StyleDialog (
ID_STYLE_WEB_SUMMARY, ID_STYLE_WEB_SUMMARY,
_ ( "Pr&intable summary" ), _ ( "Pr&intable summary" ),
wxDefaultPosition, wxDefaultPosition,
buttonSize, wxSize ( -1, buttonSize.GetHeight() ),
0 ); 0 );
wxButton *selectAllButton = wxButton *selectAllButton =
new wxButton ( new wxButton (
this, this,
ID_STYLE_CHANGE_ALL, ID_STYLE_CHANGE_ALL,
_ ( "&Change all" ), _ ( "&Select all" ),
wxDefaultPosition, wxDefaultPosition,
buttonSize, wxSize ( -1, buttonSize.GetHeight() ),
0 ); 0 );
wxButton *deselectAllButton = wxButton *deselectAllButton =
new wxButton ( new wxButton (
@ -160,15 +174,15 @@ StyleDialog::StyleDialog (
ID_STYLE_IGNORE_ALL, ID_STYLE_IGNORE_ALL,
_ ( "I&gnore all" ), _ ( "I&gnore all" ),
wxDefaultPosition, wxDefaultPosition,
buttonSize, wxSize ( -1, buttonSize.GetHeight() ),
0 ); 0 );
wxButton *cancelButton = wxButton *cancelButton =
new wxButton ( new wxButton (
this, this,
wxID_CANCEL, wxID_CANCEL,
_ ( "C&ancel" ), _ ( "Ca&ncel" ),
wxDefaultPosition, wxDefaultPosition,
buttonSize, wxSize ( -1, buttonSize.GetHeight() ),
0 ); 0 );
wxBoxSizer *reportButtonSizer = new wxBoxSizer ( wxHORIZONTAL ); wxBoxSizer *reportButtonSizer = new wxBoxSizer ( wxHORIZONTAL );
@ -190,7 +204,72 @@ StyleDialog::StyleDialog (
reportTopSizer->Add ( status, 0 ); reportTopSizer->Add ( status, 0 );
this->SetSizer ( reportTopSizer ); this->SetSizer ( reportTopSizer );
createReportButton->SetFocus();
if ( readOnly )
filterCombo->Enable ( false );
// keyboard shortcuts
wxAcceleratorEntry entries[7];
entries[0].Set ( wxACCEL_ALT, ( int ) 'C', ID_STYLE_REPORT );
entries[1].Set ( wxACCEL_ALT, ( int ) 'A', ID_STYLE_EDIT );
entries[2].Set ( wxACCEL_ALT, ( int ) 'W', ID_STYLE_WEB_REPORT );
entries[3].Set ( wxACCEL_ALT, ( int ) 'B', ID_STYLE_WEB_SUMMARY );
entries[4].Set ( wxACCEL_ALT, ( int ) 'S', ID_STYLE_CHANGE_ALL );
entries[5].Set ( wxACCEL_ALT, ( int ) 'I', ID_STYLE_IGNORE_ALL );
entries[6].Set ( wxACCEL_ALT, ( int ) 'N', wxID_CANCEL );
wxAcceleratorTable accel ( 7, entries );
this->SetAcceleratorTable ( accel );
// update combo lists // update combo lists
// special case spellcheck
if (type == ID_TYPE_SPELL)
{
AspellConfig *config;
AspellDictInfoList *dlist;
AspellDictInfoEnumeration *dels;
const AspellDictInfo *entry;
config = new_aspell_config();
#ifdef __WXMSW__
aspell_config_replace ( config, "data-dir", ASPELL_DATA_PATH );
aspell_config_replace ( config, "dict-dir", ASPELL_DICT_PATH );
#endif
dlist = get_aspell_dict_info_list( config );
delete_aspell_config ( config );
dels = aspell_dict_info_list_elements ( dlist );
bool anyFound = false;
while ( ( entry = aspell_dict_info_enumeration_next ( dels ) ) != 0 )
{
anyFound = true;
std::string stdEntry = entry->name;
wxString entry = wxString ( stdEntry.c_str(), wxConvUTF8, stdEntry.size() );
ruleSetCombo->Append ( entry );
}
if ( anyFound )
{
if ( ruleSetPreset.empty() )
ruleSetPreset = _ ( "en_US" );
ruleSetCombo->SetValue ( ruleSetPreset );
}
else
{
ruleSetCombo->Append ( _ ( "(No dictionaries found)" ) );
ruleSetCombo->Select ( 0 );
createReportButton->Enable ( false );
}
return;
}
// all other branches
if ( wxFileName::DirExists ( ruleSetDirectory ) ) if ( wxFileName::DirExists ( ruleSetDirectory ) )
{ {
wxString ruleMask, ruleFile; wxString ruleMask, ruleFile;
@ -210,6 +289,8 @@ StyleDialog::StyleDialog (
ruleSetCombo->Append ( wxFileNameFromPath ( ruleFile ) ); ruleSetCombo->Append ( wxFileNameFromPath ( ruleFile ) );
} }
} }
if ( ruleSetPreset.empty() )
ruleSetPreset = _ ( "Default" );
ruleSetCombo->SetValue ( ruleSetPreset ); ruleSetCombo->SetValue ( ruleSetPreset );
} }
else else
@ -246,23 +327,6 @@ StyleDialog::StyleDialog (
filterCombo->Append ( _ ( "(No filters found)" ) ); filterCombo->Append ( _ ( "(No filters found)" ) );
filterCombo->Select ( 0 ); filterCombo->Select ( 0 );
} }
createReportButton->SetFocus();
if ( readOnly )
filterCombo->Enable ( false );
// keyboard shortcuts
wxAcceleratorEntry entries[7];
entries[0].Set ( wxACCEL_ALT, ( int ) 'R', ID_STYLE_REPORT );
entries[1].Set ( wxACCEL_ALT, ( int ) 'E', ID_STYLE_EDIT );
entries[2].Set ( wxACCEL_ALT, ( int ) 'W', ID_STYLE_WEB_REPORT );
entries[3].Set ( wxACCEL_ALT, ( int ) 'B', ID_STYLE_WEB_SUMMARY );
entries[4].Set ( wxACCEL_ALT, ( int ) 'C', ID_STYLE_CHANGE_ALL );
entries[5].Set ( wxACCEL_ALT, ( int ) 'I', ID_STYLE_IGNORE_ALL );
entries[6].Set ( wxACCEL_ALT, ( int ) 'A', wxID_CANCEL );
wxAcceleratorTable accel ( 7, entries );
this->SetAcceleratorTable ( accel );
} }
StyleDialog::~StyleDialog() StyleDialog::~StyleDialog()
@ -332,7 +396,7 @@ void StyleDialog::OnReport ( wxCommandEvent& event )
{ {
table->DeleteAllItems(); table->DeleteAllItems();
matchVector.clear(); matchVector.clear();
status->SetStatusText ( _ ( "Creating report..." ) ); status->SetStatusText ( _ ( "Checking document..." ) );
// update presets // update presets
ruleSetPreset = ruleSetCombo->GetValue(); ruleSetPreset = ruleSetCombo->GetValue();
@ -357,6 +421,7 @@ void StyleDialog::OnReport ( wxCommandEvent& event )
pathSeparatorUtf8 = separator.mb_str ( wxConvUTF8 ); pathSeparatorUtf8 = separator.mb_str ( wxConvUTF8 );
std::auto_ptr<HouseStyle> hs ( new HouseStyle ( std::auto_ptr<HouseStyle> hs ( new HouseStyle (
(type == ID_TYPE_SPELL) ? HS_TYPE_SPELL : HS_TYPE_STYLE,
bufferUtf8, bufferUtf8,
ruleSetDirectoryUtf8, ruleSetDirectoryUtf8,
ruleSetUtf8, ruleSetUtf8,
@ -365,12 +430,12 @@ void StyleDialog::OnReport ( wxCommandEvent& event )
pathSeparatorUtf8, pathSeparatorUtf8,
5 ) ); 5 ) );
status->SetStatusText ( _ ( "Creating report..." ) ); status->SetStatusText ( _ ( "Checking document..." ) );
if ( !hs->createReport() ) if ( !hs->createReport() )
{ {
std::string lastError = hs->getLastError(); std::string lastError = hs->getLastError();
wxString error = wxString ( lastError.c_str(), wxConvUTF8, lastError.size() ); wxString error = wxString ( lastError.c_str(), wxConvUTF8, lastError.size() );
status->SetStatusText ( _ ( "Cannot create report: " ) + error ); status->SetStatusText ( _ ( "Cannot check document: " ) + error );
return; return;
} }
matchVector = hs->getMatchVector(); matchVector = hs->getMatchVector();
@ -403,7 +468,7 @@ void StyleDialog::OnReport ( wxCommandEvent& event )
++i; ++i;
} }
wxString message; wxString message;
message.Printf ( ngettext ( L"%i match", L"%i matches", i ), i ); message.Printf ( ngettext ( L"%i error", L"%i errors", i ), i );
status->SetStatusText ( message ); status->SetStatusText ( message );
if ( i ) if ( i )
table->SetFocus(); table->SetFocus();
@ -438,7 +503,7 @@ void StyleDialog::OnStyleEdit ( wxCommandEvent& event )
} }
bufferUtf8 = hsw.getOutput(); bufferUtf8 = hsw.getOutput();
wxCommandEvent e; wxCommandEvent e;
EndModal ( wxID_OK );//OnOK(e); EndModal ( wxID_OK );
} }
std::string StyleDialog::getEditedString() std::string StyleDialog::getEditedString()
@ -547,7 +612,7 @@ void StyleDialog::OnStyleWebSummary ( wxCommandEvent& event )
ofs << "</h2>"; ofs << "</h2>";
WrapExpat we; WrapExpat we;
ofs << "<table><tr><th>Match</th><th>Frequency</th></tr>"; ofs << "<table><tr><th>Term</th><th>Frequency</th></tr>";
std::map<std::string, int>::iterator mapIterator; std::map<std::string, int>::iterator mapIterator;
int matchTotal = 0; int matchTotal = 0;
@ -567,7 +632,7 @@ void StyleDialog::OnStyleWebSummary ( wxCommandEvent& event )
} }
ofs << "<tr><th>Total</th><th>"; ofs << "<tr><th>Total</th><th>";
ofs << matchTotal; ofs << matchTotal;
ofs << "</th></tr></table>"; ofs << "</th></tr></table></body>";
ofs << XHTML_END; ofs << XHTML_END;
ofs.close(); ofs.close();

View File

@ -20,8 +20,8 @@
#ifndef STYLEDIALOG_H #ifndef STYLEDIALOG_H
#define STYLEDIALOG_H #define STYLEDIALOG_H
#define XHTML_START "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>XML Copy Editor report</title><meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\"/><style type=\"text/css\"><!-- body, h1, h2, h3, h4, th, td { font-family: \"Arial\", \"Helvetica\", sans-serif; } table { border-collapse: collapse; } th { text-align: left; font-size: smaller; padding-left: 5px; padding-right: 5px; } td { border-width: 1px; border-style: solid; border-color: gray; font-size: smaller; padding-left: 5px; padding-right: 5px; } --></style></head><body>" #define XHTML_START "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>XML Copy Editor report</title><meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\"/><style type=\"text/css\"><!-- body, h1, h2, h3, h4, th, td { font-family: \"Arial\", \"Helvetica\", sans-serif; } table { border-collapse: collapse; } th { text-align: left; font-size: smaller; padding-left: 5px; padding-right: 5px; } td { border-width: 1px; border-style: solid; border-color: gray; font-size: smaller; padding-left: 5px; padding-right: 5px; } --></style></head>"
#define XHTML_END "</body></html>" #define XHTML_END "</html>"
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
@ -50,6 +50,8 @@ enum
ID_STYLE_WEB_SUMMARY, ID_STYLE_WEB_SUMMARY,
ID_STYLE_IGNORE_ALL, ID_STYLE_IGNORE_ALL,
ID_STYLE_CHANGE_ALL, ID_STYLE_CHANGE_ALL,
ID_TYPE_SPELL,
ID_TYPE_STYLE
}; };
struct SortData struct SortData
@ -71,6 +73,7 @@ class StyleDialog : public wxDialog
const wxString& browserParameter, const wxString& browserParameter,
const wxString& ruleSetPresetParameter, const wxString& ruleSetPresetParameter,
const wxString& filterPresetParameter, const wxString& filterPresetParameter,
int type = ID_TYPE_STYLE,
bool readOnlyParameter = false, bool readOnlyParameter = false,
wxPoint position = wxDefaultPosition, wxPoint position = wxDefaultPosition,
wxSize size = wxSize ( 720, 540 ) ); wxSize size = wxSize ( 720, 540 ) );
@ -117,6 +120,7 @@ class StyleDialog : public wxDialog
wxString fileName, ruleSetDirectory, filterDirectory, browser; wxString fileName, ruleSetDirectory, filterDirectory, browser;
wxString ruleSetPreset, filterPreset; wxString ruleSetPreset, filterPreset;
vector<ContextMatch> matchVector; vector<ContextMatch> matchVector;
int type;
bool readOnly; bool readOnly;
bool isIgnore ( int item ); bool isIgnore ( int item );
void setIgnore ( int item, bool ignore ); void setIgnore ( int item, bool ignore );