Exemplo n.º 1
0
        // Call ParseInner() preserving background colour and mode after any
        // changes done by it.
        void CallParseInnerWithBg(const wxHtmlTag& tag, const wxColour& colBg)
        {
            const wxColour oldbackclr = m_WParser->GetActualBackgroundColor();
            const int oldbackmode = m_WParser->GetActualBackgroundMode();
            if ( colBg.IsOk() )
            {
                m_WParser->SetActualBackgroundColor(colBg);
                m_WParser->SetActualBackgroundMode(wxBRUSHSTYLE_SOLID);
                m_WParser->GetContainer()->InsertCell(
                        new wxHtmlColourCell(colBg, wxHTML_CLR_BACKGROUND)
                    );
            }

            ParseInner(tag);

            if ( oldbackmode != m_WParser->GetActualBackgroundMode() ||
                    oldbackclr != m_WParser->GetActualBackgroundColor() )
            {
               m_WParser->SetActualBackgroundMode(oldbackmode);
               m_WParser->SetActualBackgroundColor(oldbackclr);
               m_WParser->GetContainer()->InsertCell(
                      new wxHtmlColourCell(oldbackclr,
                                        oldbackmode == wxBRUSHSTYLE_TRANSPARENT
                                            ? wxHTML_CLR_TRANSPARENT_BACKGROUND
                                            : wxHTML_CLR_BACKGROUND)
                );
            }
        }
Exemplo n.º 2
0
bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
{
    if (tag.GetName() == wxT("UL"))
    {
        wxHtmlHelpDataItem *oldparent = m_parentItem;
        m_level++;
        m_parentItem = (m_count > 0) ? &(*m_data)[m_data->size()-1] : NULL;
        ParseInner(tag);
        m_level--;
        m_parentItem = oldparent;
        return true;
    }
    else if (tag.GetName() == wxT("OBJECT"))
    {
        m_name = m_page = wxEmptyString;
        ParseInner(tag);

#if 0
         if (!page.IsEmpty())
        /* Valid HHW's file may contain only two object tags:

           <OBJECT type="text/site properties">
               <param name="ImageType" value="Folder">
           </OBJECT>

           or

           <OBJECT type="text/sitemap">
               <param name="Name" value="main page">
               <param name="Local" value="another.htm">
           </OBJECT>

           We're interested in the latter. !page.IsEmpty() is valid
           condition because text/site properties does not contain Local param
        */
#endif
        if (tag.GetParam(wxT("TYPE")) == wxT("text/sitemap"))
        {
            wxHtmlHelpDataItem *item = new wxHtmlHelpDataItem();
            item->parent = m_parentItem;
            item->level = m_level;
            item->id = m_id;
            item->page = m_page;
            item->name = m_name;

            item->book = m_book;
            m_data->Add(item);
            m_count++;
        }

        return true;
    }
    else
    { // "PARAM"
        if (m_name.empty() && tag.GetParam(wxT("NAME")) == wxT("Name"))
            m_name = tag.GetParam(wxT("VALUE"));
        if (tag.GetParam(wxT("NAME")) == wxT("Local"))
            m_page = tag.GetParam(wxT("VALUE"));
        if (tag.GetParam(wxT("NAME")) == wxT("ID"))
            tag.GetParamAsInt(wxT("VALUE"), &m_id);
        return false;
    }
}