Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions | Public Attributes | Private Member Functions
ExportBitmap Class Reference

Handles export. More...

#include <export.h>

List of all members.

Public Member Functions

 ExportBitmap ()
 Initializing the default export variables and attributes.
 ~ExportBitmap ()
 nothing doing destructor.
bool exportCurrent (ScribusDoc *doc)
 Exports only the actual page.
bool exportInterval (ScribusDoc *doc, std::vector< int > &pageNs)
 Exports chosen interval of the pages.

Public Attributes

QString bitmapType
 Type of the exported image.
int pageDPI
 Dpi of the exported image.
double enlargement
 Enlargement of the exported image...
int quality
 Quality of the image <0; 100>
QString exportDir
 A place for stored images.
bool overwrite
 Overwrite the existing files?

Private Member Functions

QString getFileName (ScribusDoc *doc, uint pageNr)
 create specified filename "docfilename-005.ext"
bool exportPage (ScribusDoc *doc, uint pageNr, bool single)
 export one specified page

Detailed Description

Handles export.

Definition at line 43 of file export.h.


Constructor & Destructor Documentation

Initializing the default export variables and attributes.

Definition at line 142 of file export.cpp.

{
       pageDPI = 72;
       quality = 100;
       enlargement = 100.0;
       exportDir = QDir::currentDirPath();
       bitmapType = QString("PNG");
       overwrite = false;
}

nothing doing destructor.

Definition at line 157 of file export.cpp.

{
}

Member Function Documentation

bool ExportBitmap::exportCurrent ( ScribusDoc *  doc)

Exports only the actual page.

Return values:
booltrue on success

Definition at line 197 of file export.cpp.

{
       return exportPage(doc, doc->currentPageNumber(), true);
}

Here is the call graph for this function:

bool ExportBitmap::exportInterval ( ScribusDoc *  doc,
std::vector< int > &  pageNs 
)

Exports chosen interval of the pages.

Parameters:
pageNsinterval of the page numbers
Return values:
trueon success

Definition at line 202 of file export.cpp.

{
       doc->scMW()->mainWindowProgressBar->setTotalSteps(pageNs.size());
       for (uint a = 0; a < pageNs.size(); ++a)
       {
              doc->scMW()->mainWindowProgressBar->setProgress(a);
              if (!exportPage(doc, pageNs[a]-1, false))
                     return false;
       }
       return true;
}

Here is the call graph for this function:

bool ExportBitmap::exportPage ( ScribusDoc *  doc,
uint  pageNr,
bool  single = true 
) [private]

export one specified page

Parameters:
pageNrnumber of the page
singlebool TRUE if only the one page is exported
Return values:
booltrue on success

Definition at line 161 of file export.cpp.

{
       uint over = 0;
       QString fileName(getFileName(doc, pageNr));

       if (!doc->Pages->at(pageNr))
              return false;
       Page* page = doc->Pages->at(pageNr);

       /* a little magic here - I need to compute the "maxGr" value...
       * We need to know the right size of the page for landscape,
       * portrait and user defined sizes.
       */
       double pixmapSize = (page->height() > page->width()) ? page->height() : page->width();
       QImage im(doc->view()->PageToPixmap(pageNr, qRound(pixmapSize * enlargement * (pageDPI / 72.0) / 100.0), false));
       int dpm = qRound(100.0 / 2.54 * pageDPI);
       im.setDotsPerMeterY(dpm);
       im.setDotsPerMeterX(dpm);
       if (QFile::exists(fileName) && !overwrite)
       {
              QString fn = QDir::convertSeparators(fileName);
              QApplication::restoreOverrideCursor();
              over = ScMessageBox::question(doc->scMW(), tr("File exists. Overwrite?"),
                            fn +"\n"+ tr("exists already. Overwrite?"),
                            CommonStrings::trYes, CommonStrings::trNo,
                            // hack for multiple overwritting (petr) 
                            (single==true) ? QString::null : tr("All"), 0, 0);
              QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
              if (over == 0)
                     return im.save(fileName, bitmapType, quality);
              if (over == 2)
                     overwrite = true;
       }
       return im.save(fileName, bitmapType, quality);
}

Here is the call graph for this function:

Here is the caller graph for this function:

QString ExportBitmap::getFileName ( ScribusDoc *  doc,
uint  pageNr 
) [private]

create specified filename "docfilename-005.ext"

Definition at line 152 of file export.cpp.

{
       return QDir::cleanDirPath(QDir::convertSeparators(exportDir + "/" + getFileNameByPage(doc, pageNr, bitmapType.lower())));
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Type of the exported image.

Definition at line 53 of file export.h.

Enlargement of the exported image...

2x 3x etc.

Definition at line 57 of file export.h.

A place for stored images.

Definition at line 61 of file export.h.

Overwrite the existing files?

Definition at line 63 of file export.h.

Dpi of the exported image.

Definition at line 55 of file export.h.

Quality of the image <0; 100>

Definition at line 59 of file export.h.


The documentation for this class was generated from the following files: