Exemplo n.º 1
0
void KHTMLReader::parseNode(DOM::Node node)
{

    // check if this is a text node.
    DOM::Text t = node;
    if (!t.isNull()) {
        _writer->addText(state()->paragraph, t.data().string(), 1, state()->in_pre_mode);
        return; // no children anymore...
    }

    // is this really needed ? it can't do harm anyway.
    state()->format = _writer->currentFormat(state()->paragraph, true);
    state()->layout = _writer->currentLayout(state()->paragraph);
    pushNewState();

    DOM::Element e = node;

    bool go_recursive = true;

    if (!e.isNull()) {
        // get the CSS information
        parseStyle(e);
        // get the tag information
        go_recursive = parseTag(e);
    }
    if (go_recursive) {
        for (DOM::Node q = node.firstChild(); !q.isNull(); q = q.nextSibling()) {
            parseNode(q);
        }
    }
    popState();


}
Exemplo n.º 2
0
void DOMTreeView::initializeOptionsFromCData(const DOM::CharacterData &cdata)
{
  contentEditor->setText(cdata.data().string());

  DOM::Text text = cdata;
  contentEditor->setEnabled(!text.isNull());

  nodeInfoStack->raiseWidget(CDataPanel);
}
Exemplo n.º 3
0
void DOMTreeView::initializeDOMInfoFromCData(const DOM::CharacterData &cdata)
{
  contentEditor->setText(cdata.data().string());

  DOM::Text text = cdata;
  contentEditor->setEnabled(!text.isNull());

  nodeInfoStack->setCurrentIndex(CDataPanel);
}
Exemplo n.º 4
0
void KHTMLReader::parse_head(DOM::Element e)
{
    for (DOM::Element items = e.firstChild();!items.isNull();items = items.nextSibling()) {
        if (items.tagName().string().lower() == "title") {
            DOM::Text t = items.firstChild();
            if (!t.isNull()) {
                _writer->createDocInfo("HTML import filter", t.data().string());
            }
        }
    }
}
Exemplo n.º 5
0
bool KHTMLReader::parse_a(DOM::Element e)
{
    QString url = e.getAttribute("href").string();
    if (!url.isEmpty()) {
        QString linkName;
        DOM::Text t = e.firstChild();
        if (t.isNull()) {
            /* Link without text -> just drop it*/
            return false; /* stop parsing recursively */
        }
        linkName = t.data().string().simplified();
        t.setData(DOM::DOMString("#")); // replace with '#'
        _writer->createLink(state()->paragraph, linkName, url);
    }
    return true; /* stop parsing recursively */
}