Ejemplo n.º 1
0
FB2_END_KEYHASH

FbHandlerXML * FbDataReaderEPUB::RootHandler::NewNode(const wxString &name, const FbStringHash &atts)
{
	switch (toKeyword(name)) {
		case Metadata: return new MetaHandler(m_reader, name);
		default: return NULL;
	}
}
Ejemplo n.º 2
0
FbHandlerXML * FbImportReaderFB2::AuthorHandler::NewNode(const wxString &name, const FbStringHash &atts)
{
	switch (toKeyword(name)) {
		case Last   : return new TextHandler(name, m_author->last);
		case First  : return new TextHandler(name, m_author->first);
		case Middle : return new TextHandler(name, m_author->middle);
		default     : return NULL;
	}
	return FbHandlerXML::NewNode(name, atts);
}
Ejemplo n.º 3
0
FbHandlerXML * FbDataReaderEPUB::MetaHandler::NewNode(const wxString &name, const FbStringHash &atts)
{
	switch (toKeyword(name)) {
		case Metadata : return new MetaHandler( m_reader, name );
		case Title    : return new TextHandler( name, m_reader.m_title );
		case Descr    : return new TextHandler( name, m_reader.m_dscr  );
		case Lang     : return new TextHandler( name, m_reader.m_lang  );
		case Author   : return IsAut(atts) ? new AuthorHandler(m_reader, name) : NULL;
		default: return NULL;
	}
}
Ejemplo n.º 4
0
FB2_END_KEYHASH

FbHandlerXML * FbImportReaderFB2::TitleHandler::NewNode(const wxString &name, const FbStringHash &atts)
{
	switch (toKeyword(name)) {
		case Author   : return new AuthorHandler(m_reader, name);
		case Title    : return new TextHandler(name, m_reader.m_title);
		case Annot    : return new AnnotHandler(m_reader, name);
		case Sequence : return new SeqnHandler(m_reader, name, atts);
		case Genre    : return new GenrHandler(m_reader, name);
		case Lang     : return new TextHandler(name, m_reader.m_lang);
		default       : return NULL;
	}
}
Ejemplo n.º 5
0
FbXmlHandler::NodeHandler * FbReadHandler::RootHandler::NewTag(const QString &name, const QXmlAttributes &atts)
{
    switch (toKeyword(name)) {
        case Binary: return new BinaryHandler(m_owner, name, atts);
        case Style: return new StyleHandler(m_owner, name, m_style);
        default: ;
    }

    if (m_head) {
        writeHeader();
        m_head = false;
    }

    return new TextHandler(m_owner, name, atts, "fb:" + name);
}
Ejemplo n.º 6
0
bool FbScheme::canEdit() const
{
    if (type() == "sequenceType") return true;
    FbScheme scheme = typeScheme();
    FbScheme child = scheme.firstChildElement();
    while (!child.isNull()) {
        switch (toKeyword(child.tagName())) {
            case XsElement:
                return false;
            case XsChoice:
            case XsComplexType:
            case XsSequence:
                if (!child.canEdit()) return false;
            default: ;
        }
        child = child.nextSiblingElement();
    }
    return true;
}
Ejemplo n.º 7
0
void FbReadHandler::TextHandler::Init(const QString &name, const QXmlAttributes &atts)
{
    Keyword key = toKeyword(name);
    writer().writeStartElement(m_tag);
    int count = atts.count();
    for (int i = 0; i < count; i++) {
        QString name = atts.qName(i);
        switch (key) {
            case Anchor: { if (atts.localName(i) == "href") name = "href"; break; }
            case Image:  { if (atts.localName(i) == "href") name = "src"; break; }
            default: ;
        }
        writer().writeAttribute(name, atts.value(i));
    }
    if (name == "empty-line") {
        writer().writeEmptyElement("br");
        m_empty = false;
    }
}
Ejemplo n.º 8
0
FbScheme FbScheme::item(const QString &name) const
{
    FbScheme child = firstChildElement();
    while (!child.isNull()) {
        switch (toKeyword(child.tagName())) {
            case XsElement: {
                    if (child.attribute("name") == name) return child;
                } break;
            case XsChoice:
            case XsComplexType:
            case XsSequence: {
                    FbScheme result = child.item(name);
                    if (!result.isNull()) return result;
                } break;
            default: ;
        }
        child = child.nextSiblingElement();
    }
    return FbScheme();
}
Ejemplo n.º 9
0
FbXmlHandler::NodeHandler * FbReadHandler::TextHandler::NewTag(const QString &name, const QXmlAttributes &atts)
{
    m_empty = false;
    QString tag;
    switch (toKeyword(name)) {
        case Origin : tag = name;   break;
        case Anchor : tag = "a";    break;
        case Image  : tag = "img";  break;
        case Parag  : tag = "p";    break;
        case Strong : tag = "b";    break;
        case Emphas : tag = "i";    break;
        case Strike : tag = "s";    break;
        case Code   : tag = "tt";   break;
        case Sub    : tag = "sub";  break;
        case Sup    : tag = "sup";  break;
        case Style  : tag = "span"; break;
        default     : tag = "fb:" + name;
    }
    return new TextHandler(this, name, atts, tag);
}
Ejemplo n.º 10
0
FB2_END_KEYHASH

void FbScheme::items(QStringList &list) const
{
    FbScheme child = typeScheme().firstChildElement();
    while (!child.isNull()) {
        switch (toKeyword(child.tagName())) {
            case XsElement: {
                    QString name = child.attribute("name");
                    if (!list.contains(name)) list << name;
                } break;
            case XsChoice:
            case XsComplexType:
            case XsSequence: {
                    child.items(list);
                } break;
            default: ;
        }
        child = child.nextSiblingElement();
    }
}