diff --git a/include/wx/html/helpctrl.h b/include/wx/html/helpctrl.h
index b1808aa4bd..f168680ad5 100644
--- a/include/wx/html/helpctrl.h
+++ b/include/wx/html/helpctrl.h
@@ -83,6 +83,10 @@ class WXDLLEXPORT wxHtmlHelpController : public wxHelpControllerBase // wxEvtHan
virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
wxPoint *pos = NULL,
bool *newFrameEachTime = NULL);
+
+ // Sets the specified book or all books to have the given base path
+ virtual void SetBookBasePath(const wxString& basePath, int which = -1);
+
virtual bool Quit() ;
virtual void OnQuit() {};
diff --git a/include/wx/html/helpdata.h b/include/wx/html/helpdata.h
index e5b96e3965..2f6b2b534e 100644
--- a/include/wx/html/helpdata.h
+++ b/include/wx/html/helpdata.h
@@ -54,6 +54,10 @@ class WXDLLEXPORT wxHtmlBookRecord : public wxObject
int GetContentsStart() const { return m_ContentsStart; }
int GetContentsEnd() const { return m_ContentsEnd; }
+ void SetTitle(const wxString& title) { m_Title = title; }
+ void SetBasePath(const wxString& path) { m_BasePath = path; }
+ void SetStart(const wxString& start) { m_Start = start; }
+
protected:
wxString m_BasePath;
wxString m_Title;
diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp
index 31a5df2dd6..3924519147 100644
--- a/src/html/helpctrl.cpp
+++ b/src/html/helpctrl.cpp
@@ -248,5 +248,20 @@ bool wxHtmlHelpController::Quit()
return TRUE;
}
+// Sets the specified book or all books to have the given base path
+void wxHtmlHelpController::SetBookBasePath(const wxString& basePath, int which)
+{
+ size_t i;
+ for (i = 0; i < m_helpData.GetBookRecArray().Count(); i++ )
+ {
+ if (i == (size_t) which || which == -1)
+ {
+ wxHtmlBookRecord& book = m_helpData.GetBookRecArray()[i];
+ book.SetBasePath(basePath);
+ }
+ if (i == (size_t) which)
+ return;
+ }
+}
#endif
diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp
index c0e111ba76..1cea81737b 100644
--- a/src/html/helpdata.cpp
+++ b/src/html/helpdata.cpp
@@ -91,11 +91,12 @@ class HP_TagHandler : public wxHtmlTagHandler
wxHtmlContentsItem *m_Items;
int m_ItemsCnt;
wxHtmlBookRecord *m_Book;
+ bool m_firstTime; // For checking if we're adding sections at level zero, so we 'delete' the first one
public:
HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler()
{ m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString;
- m_Level = 0; m_ID = -1; }
+ m_Level = 0; m_ID = -1; m_firstTime = TRUE; }
wxString GetSupportedTags() { return wxT("UL,OBJECT,PARAM"); }
bool HandleTag(const wxHtmlTag& tag);
void WriteOut(wxHtmlContentsItem*& array, int& size);
@@ -117,10 +118,10 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
m_Name = m_Page = wxEmptyString;
ParseInner(tag);
- if (!m_Page.IsEmpty())
- /* should be 'if (tag.GetParam("TYPE") == "text/sitemap")'
- but this works fine. Valid HHW's file may contain only two
- object tags:
+ if (tag.GetParam("TYPE") == "text/sitemap")
+
+ // if (!m_Page.IsEmpty())
+ /* Valid HHW's file may contain only two object tags: