~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to filters/libmsooxml/MsooXmlRelationshipsReader.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
using namespace MSOOXML;
36
36
 
37
37
MsooXmlRelationshipsReaderContext::MsooXmlRelationshipsReaderContext(
38
 
    const QString& _path, const QString& _file, QMap<QString, QString>& _rels)
 
38
    const QString& _path, const QString& _file, QMap<QString, QString>& _rels,
 
39
    QMap<QString, QString>& _targetsForTypes)
39
40
        : path(_path), file(_file)
40
 
        , rels(&_rels)
 
41
        , rels(&_rels), targetsForTypes(&_targetsForTypes)
41
42
{
42
43
}
43
44
 
130
131
    while (!atEnd()) {
131
132
        readNext();
132
133
        kDebug() << *this;
 
134
        BREAK_IF_END_OF(CURRENT_EL);
133
135
        if (isStartElement()) {
134
136
            TRY_READ_IF(Relationship)
135
137
            ELSE_WRONG_FORMAT
136
138
        }
137
 
        BREAK_IF_END_OF(CURRENT_EL);
138
139
    }
139
140
    READ_EPILOGUE
140
141
}
153
154
    READ_PROLOGUE
154
155
    const QXmlStreamAttributes attrs(attributes());
155
156
    READ_ATTR_WITHOUT_NS(Id)
156
 
//unused:    READ_ATTR_WITHOUT_NS(Type)
 
157
    READ_ATTR_WITHOUT_NS(Type)
157
158
    READ_ATTR_WITHOUT_NS(Target)
158
159
    QString fixedPath(m_context->path);
159
160
    while (Target.startsWith("../")) {
160
 
//        kDebug() << "- Target:" << Target << "fixedPath:" << fixedPath;
 
161
        //kDebug() << "- Target:" << Target << "fixedPath:" << fixedPath;
161
162
        Target = Target.mid(3);
162
163
        fixedPath.truncate(fixedPath.lastIndexOf('/'));
163
 
//        kDebug() << "= Target:" << Target << "fixedPath:" << fixedPath;
 
164
        //kDebug() << "= Target:" << Target << "fixedPath:" << fixedPath;
164
165
    }
165
 
    /*    kDebug() << "adding rel:";
166
 
        kDebug() << d->pathAndFile + Id;
167
 
        kDebug() << fixedPath + '/' + Target;*/
 
166
    //kDebug() << "adding rel:";
 
167
    //kDebug() << d->pathAndFile + Id;
 
168
    //kDebug() << fixedPath + '/' + Target;
168
169
 
169
170
    m_context->rels->insert(d->pathAndFile + Id, fixedPath + '/' + Target);
 
171
    //kDebug() << "added target" << Target << "for type" << Type << "path=" << fixedPath << "key=" << targetKey(m_context->path + '/' + m_context->file, Type);
 
172
    m_context->targetsForTypes->insert(targetKey(m_context->path + '/' + m_context->file, Type), fixedPath + '/' + Target);
170
173
 
171
174
    while (!atEnd()) {
172
175
        readNext();