コード例 #1
0
ファイル: fileexporterpdf.cpp プロジェクト: KDE/kbibtex
bool FileExporterPDF::save(QIODevice *iodevice, const File *bibtexfile, QStringList *errorLog)
{
    if (!iodevice->isWritable() && !iodevice->open(QIODevice::WriteOnly)) {
        qCWarning(LOG_KBIBTEX_IO) << "Output device not writable";
        return false;
    }

    bool result = false;
    m_embeddedFileList.clear();
    if (m_fileEmbedding & EmbedBibTeXFile)
        m_embeddedFileList.append(QString(QStringLiteral("%1|%2|%3")).arg(QStringLiteral("BibTeX source"), m_fileStem + KBibTeX::extensionBibTeX, m_fileBasename + KBibTeX::extensionBibTeX));
    if (m_fileEmbedding & EmbedReferences)
        fillEmbeddedFileList(bibtexfile);

    QFile output(m_fileStem + KBibTeX::extensionBibTeX);
    if (output.open(QIODevice::WriteOnly)) {
        FileExporterBibTeX *bibtexExporter = new FileExporterBibTeX();
        bibtexExporter->setEncoding(QStringLiteral("latex"));
        result = bibtexExporter->save(&output, bibtexfile, errorLog);
        output.close();
        delete bibtexExporter;
    }

    if (result)
        result = generatePDF(iodevice, errorLog);

    if (errorLog != NULL)
        qCDebug(LOG_KBIBTEX_IO) << "errorLog" << errorLog->join(QStringLiteral(";"));

    iodevice->close();
    return result;
}
コード例 #2
0
    bool FileExporterPDF::save( QIODevice* iodevice, const Element* element, QStringList *errorLog )
    {
        bool result = FALSE;
        m_embeddedFileList.clear();
        if ( m_embedFiles )
            fillEmbeddedFileList( element );

        QFile bibtexFile( bibTeXFilename );
        if ( bibtexFile.open( IO_WriteOnly ) )
        {
            FileExporter * bibtexExporter = new FileExporterBibTeX();
            result = bibtexExporter->save( &bibtexFile, element, errorLog );
            bibtexFile.close();
            delete bibtexExporter;
        }

        if ( result )
            result = generatePDF( iodevice, errorLog );

        return result;
    }
コード例 #3
0
    bool FileExporterPDF::save( QIODevice* iodevice, const File* bibtexfile, QStringList *errorLog )
    {
        bool result = FALSE;
        m_embeddedFileList.clear();
        if ( m_embedFiles )
        {
            m_embeddedFileList.append( QString( "%1|%2" ).arg( "BibTeX source" ).arg( bibTeXFilename ) );
            fillEmbeddedFileList( bibtexfile );
        }

        QFile bibtexFile( bibTeXFilename );
        if ( bibtexFile.open( IO_WriteOnly ) )
        {
            FileExporter * bibtexExporter = new FileExporterBibTeX();
            result = bibtexExporter->save( &bibtexFile, bibtexfile, errorLog );
            bibtexFile.close();
            delete bibtexExporter;
        }

        if ( result )
            result = generatePDF( iodevice, errorLog );

        return result;
    }
コード例 #4
0
 void FileExporterPDF::fillEmbeddedFileList( const File* bibtexfile )
 {
     for ( BibTeX::File::ElementList::ConstIterator it = bibtexfile->constBegin(); it != bibtexfile->constEnd(); ++it )
         fillEmbeddedFileList( *it );
 }
コード例 #5
0
ファイル: fileexporterpdf.cpp プロジェクト: KDE/kbibtex
void FileExporterPDF::fillEmbeddedFileList(const File *bibtexfile)
{
    for (File::ConstIterator it = bibtexfile->constBegin(); it != bibtexfile->constEnd(); ++it)
        fillEmbeddedFileList(*it, bibtexfile);
}