Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Functions
svgimport.cpp File Reference
#include "svgimport.h"
#include "cmdvar.h"
#include "cmdutil.h"
#include "../formatidlist.h"
#include "loadsaveplugin.h"
#include "scribuscore.h"
#include "selection.h"
#include <qstring.h>

Go to the source code of this file.

Functions

PyObject * scribus_placesvg (PyObject *, PyObject *args)
 Places an SVG file.
PyObject * scribus_placeeps (PyObject *, PyObject *args)
 Places an EPS file.
PyObject * scribus_placesxd (PyObject *, PyObject *args)
 Places an SXD file.
PyObject * scribus_placeodg (PyObject *, PyObject *args)
 Places an ODG file.
void svgimportdocwarnings ()
 HACK: this removes "warning: 'blah' defined but not used" compiler warnings with header files structure untouched (docstrings are kept near declarations) PV.

Function Documentation

PyObject* scribus_placeeps ( PyObject *  ,
PyObject *  args 
)

Places an EPS file.

Definition at line 50 of file svgimport.cpp.

{
       char *Image;
       double x = 0.0;
       double y = 0.0;
       if (!PyArg_ParseTuple(args, "es|dd", "utf-8", &Image, &x, &y))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       const FileFormat * fmt = LoadSavePlugin::getFormatById(FORMATID_PSIMPORT);
       if( fmt )
       {
              fmt->loadFile(QString::fromUtf8(Image), LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
              if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
              {
                     double x2, y2, w, h;
                     ScCore->primaryMainWindow()->doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
                     ScCore->primaryMainWindow()->view->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
              }
       }
       else
       {
              PyErr_SetString(PyExc_Exception, "EPS Import plugin not available");
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_placeodg ( PyObject *  ,
PyObject *  args 
)

Places an ODG file.

Definition at line 110 of file svgimport.cpp.

{
       char *Image;
       double x = 0.0;
       double y = 0.0;
       if (!PyArg_ParseTuple(args, "es|dd", "utf-8", &Image, &x, &y))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       const FileFormat * fmt = LoadSavePlugin::getFormatById(FORMATID_ODGIMPORT);
       if( fmt )
       {
              fmt->loadFile(QString::fromUtf8(Image), LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
              if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
              {
                     double x2, y2, w, h;
                     ScCore->primaryMainWindow()->doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
                     ScCore->primaryMainWindow()->view->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
              }
       }
       else
       {
              PyErr_SetString(PyExc_Exception, "OpenOffice Import plugin not available");
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_placesvg ( PyObject *  ,
PyObject *  args 
)

Places an SVG file.

Definition at line 20 of file svgimport.cpp.

{
       char *Image;
       double x = 0.0;
       double y = 0.0;
       if (!PyArg_ParseTuple(args, "es|dd", "utf-8", &Image, &x, &y))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       const FileFormat * fmt = LoadSavePlugin::getFormatById(FORMATID_SVGIMPORT);
       if( fmt )
       {
              fmt->loadFile(QString::fromUtf8(Image), LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
              if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
              {
                     double x2, y2, w, h;
                     ScCore->primaryMainWindow()->doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
                     ScCore->primaryMainWindow()->view->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
              }
       }
       else
       {
              PyErr_SetString(PyExc_Exception, "SVG Import plugin not available");
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_placesxd ( PyObject *  ,
PyObject *  args 
)

Places an SXD file.

Definition at line 80 of file svgimport.cpp.

{
       char *Image;
       double x = 0.0;
       double y = 0.0;
       if (!PyArg_ParseTuple(args, "es|dd", "utf-8", &Image, &x, &y))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       const FileFormat * fmt = LoadSavePlugin::getFormatById(FORMATID_SXDIMPORT);
       if( fmt )
       {
              fmt->loadFile(QString::fromUtf8(Image), LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
              if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
              {
                     double x2, y2, w, h;
                     ScCore->primaryMainWindow()->doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
                     ScCore->primaryMainWindow()->view->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
              }
       }
       else
       {
              PyErr_SetString(PyExc_Exception, "OpenOffice Import plugin not available");
              return NULL;
       }
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

HACK: this removes "warning: 'blah' defined but not used" compiler warnings with header files structure untouched (docstrings are kept near declarations) PV.

Definition at line 143 of file svgimport.cpp.

{
    QStringList s;
    s << scribus_placesvg__doc__ << scribus_placeeps__doc__ << scribus_placesxd__doc__ << scribus_placeodg__doc__;
}