Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Functions
cmddoc.h File Reference
#include "cmdvar.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 PyDoc_STRVAR (scribus_newdocument__doc__, QT_TR_NOOP("newDocument(size, margins, orientation, firstPageNumber,\n\ unit, pagesType, firstPageOrder, numPages) -> bool\n\ \n\ Creates a new document and returns true if successful. The parameters have the\n\ following meaning:\n\ \n\ size = A tuple (width, height) describing the size of the document. You can\n\ use predefined constants named PAPER_<paper_type> e.g. PAPER_A4 etc.\n\ \n\ margins = A tuple (left, right, top, bottom) describing the document\n\ margins\n\ \n\ orientation = the page orientation - constants PORTRAIT, LANDSCAPE\n\ \n\ firstPageNumer = is the number of the first page in the document used for\n\ pagenumbering. While you'll usually want 1, it's useful to have higher\n\ numbers if you're creating a document in several parts.\n\ \n\ unit: this value sets the measurement units used by the document. Use a\n\ predefined constant for this, one of: UNIT_INCHES, UNIT_MILLIMETERS,\n\ UNIT_PICAS, UNIT_POINTS.\n\ \n\ pagesType = One of the predefined constants PAGE_n. PAGE_1 is single page,\n\ PAGE_2 is for double sided documents, PAGE_3 is for 3 pages fold and\n\ PAGE_4 is 4-fold.\n\ \n\ firstPageOrder = What is position of first page in the document.\n\ Indexed from 0 (0 = first).\n\ \n\ numPage = Number of pages to be created.\n\ \n\ The values for width, height and the margins are expressed in the given unit\n\ for the document. PAPER_* constants are expressed in points. If your document\n\ is not in points, make sure to account for this.\n\ \n\ example: newDocument(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 7, UNIT_POINTS,\n\ PAGE_4, 3, 1)\n\ \n\ May raise ScribusError if is firstPageOrder bigger than allowed by pagesType.\n\ "))
 Document related Commands.
PyObject * scribus_newdocument (PyObject *, PyObject *args)
 Creates a new document e.g.
 PyDoc_STRVAR (scribus_newdoc__doc__, QT_TR_NOOP("newDoc(size, margins, orientation, firstPageNumber,\n\ unit, facingPages, firstSideLeft) -> bool\n\ \n\ WARNING: Obsolete procedure! Use newDocument instead.\n\ \n\ Creates a new document and returns true if successful. The parameters have the\n\ following meaning:\n\ \n\ size = A tuple (width, height) describing the size of the document. You can\n\ use predefined constants named PAPER_<paper_type> e.g. PAPER_A4 etc.\n\ \n\ margins = A tuple (left, right, top, bottom) describing the document\n\ margins\n\ \n\ orientation = the page orientation - constants PORTRAIT, LANDSCAPE\n\ \n\ firstPageNumer = is the number of the first page in the document used for\n\ pagenumbering. While you'll usually want 1, it's useful to have higher\n\ numbers if you're creating a document in several parts.\n\ \n\ unit: this value sets the measurement units used by the document. Use a\n\ predefined constant for this, one of: UNIT_INCHES, UNIT_MILLIMETERS,\n\ UNIT_PICAS, UNIT_POINTS.\n\ \n\ facingPages = FACINGPAGES, NOFACINGPAGES\n\ \n\ firstSideLeft = FIRSTPAGELEFT, FIRSTPAGERIGHT\n\ \n\ The values for width, height and the margins are expressed in the given unit\n\ for the document. PAPER_* constants are expressed in points. If your document\n\ is not in points, make sure to account for this.\n\ \n\ example: newDoc(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 1, UNIT_POINTS,\n\ FACINGPAGES, FIRSTPAGERIGHT)\n\ "))
 docstring
PyObject * scribus_newdoc (PyObject *, PyObject *args)
 Creates a new document e.g.
 PyDoc_STRVAR (scribus_closedoc__doc__, QT_TR_NOOP("closeDoc()\n\ \n\ Closes the current document without prompting to save.\n\ \n\ May throw NoDocOpenError if there is no document to close\n\ "))
 docstring
PyObject * scribus_closedoc (PyObject *)
 Closes active doc.
 PyDoc_STRVAR (scribus_havedoc__doc__, QT_TR_NOOP("haveDoc() -> bool\n\ \n\ Returns true if there is a document open.\n\ "))
 docstring
PyObject * scribus_havedoc (PyObject *)
 Checks if is a document opened.
 PyDoc_STRVAR (scribus_opendoc__doc__, QT_TR_NOOP("openDoc(\"name\")\n\ \n\ Opens the document \"name\".\n\ \n\ May raise ScribusError if the document could not be opened.\n\ "))
 docstring
PyObject * scribus_opendoc (PyObject *, PyObject *args)
 Opens a document with given name.
 PyDoc_STRVAR (scribus_savedoc__doc__, QT_TR_NOOP("saveDoc()\n\ \n\ Saves the current document with its current name, returns true if successful.\n\ If the document has not already been saved, this may bring up an interactive\n\ save file dialog.\n\ \n\ If the save fails, there is currently no way to tell.\n\ "))
 docstring
PyObject * scribus_savedoc (PyObject *)
 PyDoc_STRVAR (scribus_savedocas__doc__, QT_TR_NOOP("saveDocAs(\"name\")\n\ \n\ Saves the current document under the new name \"name\" (which may be a full or\n\ relative path).\n\ \n\ May raise ScribusError if the save fails.\n\ "))
 docstring
PyObject * scribus_savedocas (PyObject *, PyObject *args)
 Saves active document with given name.
 PyDoc_STRVAR (scribus_setinfo__doc__, QT_TR_NOOP("setInfo(\"author\", \"info\", \"description\") -> bool\n\ \n\ Sets the document information. \"Author\", \"Info\", \"Description\" are\n\ strings.\n\ "))
 docstring
PyObject * scribus_setinfo (PyObject *, PyObject *args)
 Sets document infos - author, title and description.
 PyDoc_STRVAR (scribus_setmargins__doc__, QT_TR_NOOP("setMargins(lr, rr, tr, br)\n\ \n\ Sets the margins of the document, Left(lr), Right(rr), Top(tr) and Bottom(br)\n\ margins are given in the measurement units of the document - see UNIT_<type>\n\ constants.\n\ "))
 docstring
PyObject * scribus_setmargins (PyObject *, PyObject *args)
 Sets document margins - left, right, top and bottom.
 PyDoc_STRVAR (scribus_setunit__doc__, QT_TR_NOOP("setUnit(type)\n\ \n\ Changes the measurement unit of the document. Possible values for \"unit\" are\n\ defined as constants UNIT_<type>.\n\ \n\ May raise ValueError if an invalid unit is passed.\n\ "))
 docstring
PyObject * scribus_setunit (PyObject *, PyObject *args)
 Changes unit scale.
 PyDoc_STRVAR (scribus_getunit__doc__, QT_TR_NOOP("getUnit() -> integer (Scribus unit constant)\n\ \n\ Returns the measurement units of the document. The returned value will be one\n\ of the UNIT_* constants:\n\ UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS.\n\ "))
 docstring
PyObject * scribus_getunit (PyObject *)
 Returns actual unit scale.
 PyDoc_STRVAR (scribus_loadstylesfromfile__doc__, QT_TR_NOOP("loadStylesFromFile(\"filename\")\n\ \n\ Loads paragraph styles from the Scribus document at \"filename\" into the\n\ current document.\n\ "))
 docstring
PyObject * scribus_loadstylesfromfile (PyObject *, PyObject *args)
 Loads styles from another .sla file (craig r.)
 PyDoc_STRVAR (scribus_setdoctype__doc__, QT_TR_NOOP("setDocType(facingPages, firstPageLeft)\n\ \n\ Sets the document type. To get facing pages set the first parameter to\n\ FACINGPAGES, to switch facingPages off use NOFACINGPAGES instead. If you want\n\ to be the first page a left side set the second parameter to FIRSTPAGELEFT, for\n\ a right page use FIRSTPAGERIGHT.\n\ "))
 docstring
PyObject * scribus_setdoctype (PyObject *, PyObject *args)
 PyDoc_STRVAR (scribus_closemasterpage__doc__, QT_TR_NOOP("closeMasterPage()\n\ \n\ Closes the currently active master page, if any, and returns editing\n\ to normal. Begin editing with editMasterPage().\n\ "))
PyObject * scribus_closemasterpage (PyObject *self)
 PyDoc_STRVAR (scribus_masterpagenames__doc__, QT_TR_NOOP("masterPageNames()\n\ \n\ Returns a list of the names of all master pages in the document.\n\ "))
PyObject * scribus_masterpagenames (PyObject *self)
 PyDoc_STRVAR (scribus_editmasterpage__doc__, QT_TR_NOOP("editMasterPage(pageName)\n\ \n\ Enables master page editing and opens the named master page\n\ for editing. Finish editing with closeMasterPage().\n\ "))
PyObject * scribus_editmasterpage (PyObject *self, PyObject *args)
 PyDoc_STRVAR (scribus_createmasterpage__doc__, QT_TR_NOOP("createMasterPage(pageName)\n\ \n\ Creates a new master page named pageName and opens it for\n\ editing.\n\ "))
PyObject * scribus_createmasterpage (PyObject *self, PyObject *args)
 PyDoc_STRVAR (scribus_deletemasterpage__doc__, QT_TR_NOOP("deleteMasterPage(pageName)\n\ \n\ Delete the named master page.\n\ "))
PyObject * scribus_deletemasterpage (PyObject *self, PyObject *args)

Function Documentation

PyDoc_STRVAR ( scribus_newdocument__doc__  ,
QT_TR_NOOP("newDocument(size, margins, orientation, firstPageNumber,\n\ unit, pagesType, firstPageOrder, numPages) -> bool\n\\n\Creates a new document and returns true if successful. The parameters have the\n\following meaning:\n\\n\size = A tuple (width, height) describing the size of the document. You can\n\use predefined constants named PAPER_<paper_type> e.g. PAPER_A4 etc.\n\\n\margins = A tuple (left, right, top, bottom) describing the document\n\margins\n\\n\orientation = the page orientation - constants PORTRAIT, LANDSCAPE\n\\n\firstPageNumer = is the number of the first page in the document used for\n\pagenumbering. While you'll usually want 1, it's useful to have higher\n\numbers if you're creating a document in several parts.\n\\n\unit: this value sets the measurement units used by the document. Use a\n\predefined constant for this, one of: UNIT_INCHES, UNIT_MILLIMETERS,\n\UNIT_PICAS, UNIT_POINTS.\n\\n\pagesType = One of the predefined constants PAGE_n. PAGE_1 is single page,\n\PAGE_2 is for double sided documents, PAGE_3 is for 3 pages fold and\n\PAGE_4 is 4-fold.\n\\n\firstPageOrder = What is position of first page in the document.\n\Indexed from 0 (0 = first).\n\\n\numPage = Number of pages to be created.\n\\n\The values for width, height and the margins are expressed in the given unit\n\for the document. PAPER_* constants are expressed in points. If your document\n\is not in points, make sure to account for this.\n\\n\example: newDocument(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 7, UNIT_POINTS,\n\PAGE_4, 3, 1)\n\\n\May raise ScribusError if is firstPageOrder bigger than allowed by pagesType.\n\")   
)

Document related Commands.

PyDoc_STRVAR ( scribus_newdoc__doc__  ,
QT_TR_NOOP("newDoc(size, margins, orientation, firstPageNumber,\n\ unit, facingPages, firstSideLeft) -> bool\n\\n\WARNING: Obsolete procedure! Use newDocument instead.\n\\n\Creates a new document and returns true if successful. The parameters have the\n\following meaning:\n\\n\ size = A tuple (width, height) describing the size of the document. You can\n\ use predefined constants named PAPER_<paper_type> e.g. PAPER_A4 etc.\n\\n\ margins = A tuple (left, right, top, bottom) describing the document\n\ margins\n\\n\ orientation = the page orientation - constants PORTRAIT, LANDSCAPE\n\\n\ firstPageNumer = is the number of the first page in the document used for\n\ pagenumbering. While you'll usually want 1, it's useful to have higher\n\ numbers if you're creating a document in several parts.\n\\n\ unit: this value sets the measurement units used by the document. Use a\n\ predefined constant for this, one of: UNIT_INCHES, UNIT_MILLIMETERS,\n\ UNIT_PICAS, UNIT_POINTS.\n\\n\ facingPages = FACINGPAGES, NOFACINGPAGES\n\\n\ firstSideLeft = FIRSTPAGELEFT, FIRSTPAGERIGHT\n\\n\The values for width, height and the margins are expressed in the given unit\n\for the document. PAPER_* constants are expressed in points. If your document\n\is not in points, make sure to account for this.\n\\n\example: newDoc(PAPER_A4, (10, 10, 20, 20), LANDSCAPE, 1, UNIT_POINTS,\n\ FACINGPAGES, FIRSTPAGERIGHT)\n\")   
)

docstring

PyDoc_STRVAR ( scribus_closedoc__doc__  ,
QT_TR_NOOP("closeDoc()\n\\n\Closes the current document without prompting to save.\n\\n\May throw NoDocOpenError if there is no document to close\n\")   
)

docstring

PyDoc_STRVAR ( scribus_havedoc__doc__  ,
QT_TR_NOOP("haveDoc() -> bool\n\\n\Returns true if there is a document open.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_opendoc__doc__  ,
QT_TR_NOOP("openDoc(\"name\")\n\\n\Opens the document \"name\".\n\\n\May raise ScribusError if the document could not be opened.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_savedoc__doc__  ,
QT_TR_NOOP("saveDoc()\n\\n\Saves the current document with its current name, returns true if successful.\n\If the document has not already been saved, this may bring up an interactive\n\save file dialog.\n\\n\If the save fails, there is currently no way to tell.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_savedocas__doc__  ,
QT_TR_NOOP("saveDocAs(\"name\")\n\\n\Saves the current document under the new name \"name\" (which may be a full or\n\relative path).\n\\n\May raise ScribusError if the save fails.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_setinfo__doc__  ,
QT_TR_NOOP("setInfo(\"author\", \"info\", \"description\") -> bool\n\\n\Sets the document information. \"Author\", \"Info\", \"Description\" are\n\strings.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_setmargins__doc__  ,
QT_TR_NOOP("setMargins(lr, rr, tr, br)\n\\n\Sets the margins of the document, Left(lr), Right(rr), Top(tr) and Bottom(br)\n\margins are given in the measurement units of the document - see UNIT_<type>\n\constants.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_setunit__doc__  ,
QT_TR_NOOP("setUnit(type)\n\\n\Changes the measurement unit of the document. Possible values for \"unit\" are\n\defined as constants UNIT_<type>.\n\\n\May raise ValueError if an invalid unit is passed.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_getunit__doc__  ,
QT_TR_NOOP("getUnit() -> integer (Scribus unit constant)\n\\n\Returns the measurement units of the document. The returned value will be one\n\of the UNIT_* constants:\n\UNIT_INCHES, UNIT_MILLIMETERS, UNIT_PICAS, UNIT_POINTS.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_loadstylesfromfile__doc__  ,
QT_TR_NOOP("loadStylesFromFile(\"filename\")\n\\n\Loads paragraph styles from the Scribus document at \"filename\" into the\n\current document.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_setdoctype__doc__  ,
QT_TR_NOOP("setDocType(facingPages, firstPageLeft)\n\\n\Sets the document type. To get facing pages set the first parameter to\n\FACINGPAGES, to switch facingPages off use NOFACINGPAGES instead. If you want\n\to be the first page a left side set the second parameter to FIRSTPAGELEFT, for\n\a right page use FIRSTPAGERIGHT.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_closemasterpage__doc__  ,
QT_TR_NOOP("closeMasterPage()\n\\n\Closes the currently active master page, if any, and returns editing\n\to normal. Begin editing with editMasterPage().\n\")   
)
PyDoc_STRVAR ( scribus_masterpagenames__doc__  ,
QT_TR_NOOP("masterPageNames()\n\\n\Returns a list of the names of all master pages in the document.\n\")   
)
PyDoc_STRVAR ( scribus_editmasterpage__doc__  ,
QT_TR_NOOP("editMasterPage(pageName)\n\\n\Enables master page editing and opens the named master page\n\for editing. Finish editing with closeMasterPage().\n\")   
)
PyDoc_STRVAR ( scribus_createmasterpage__doc__  ,
QT_TR_NOOP("createMasterPage(pageName)\n\\n\Creates a new master page named pageName and opens it for\n\editing.\n\")   
)
PyDoc_STRVAR ( scribus_deletemasterpage__doc__  ,
QT_TR_NOOP("deleteMasterPage(pageName)\n\\n\Delete the named master page.\n\")   
)
PyObject* scribus_closedoc ( PyObject *  )

Closes active doc.

No params

Definition at line 129 of file cmddoc.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       ScCore->primaryMainWindow()->doc->setModified(false);
       bool ret = ScCore->primaryMainWindow()->slotFileClose();
       qApp->processEvents();
       return PyInt_FromLong(static_cast<long>(ret));
}

Here is the call graph for this function:

PyObject* scribus_closemasterpage ( PyObject *  self)

Definition at line 265 of file cmddoc.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       ScCore->primaryMainWindow()->view->hideMasterPage();
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_createmasterpage ( PyObject *  self,
PyObject *  args 
)

Definition at line 311 of file cmddoc.cpp.

{
       char* name = 0;
       if (!PyArg_ParseTuple(args, "es", const_cast<char*>("utf-8"), &name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       const QString masterPageName(name);
       if (ScCore->primaryMainWindow()->doc->MasterNames.contains(masterPageName))
       {
              PyErr_SetString(PyExc_ValueError, "Master page already exists");
              return NULL;
       }
       ScCore->primaryMainWindow()->doc->addMasterPage(ScCore->primaryMainWindow()->doc->MasterPages.count(), masterPageName);
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_deletemasterpage ( PyObject *  self,
PyObject *  args 
)

Definition at line 330 of file cmddoc.cpp.

{
       char* name = 0;
       if (!PyArg_ParseTuple(args, "es", const_cast<char*>("utf-8"), &name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       const QString masterPageName(name);
       if (!ScCore->primaryMainWindow()->doc->MasterNames.contains(masterPageName))
       {
              PyErr_SetString(PyExc_ValueError, "Master page does not exist");
              return NULL;
       }
       if (masterPageName == "Normal")
       {
              PyErr_SetString(PyExc_ValueError, "Can not delete the Normal master page");
              return NULL;
       }
       bool oldMode = ScCore->primaryMainWindow()->doc->masterPageMode();
       ScCore->primaryMainWindow()->doc->setMasterPageMode(true);
       ScCore->primaryMainWindow()->DeletePage2(ScCore->primaryMainWindow()->doc->MasterNames[masterPageName]);
       ScCore->primaryMainWindow()->doc->setMasterPageMode(oldMode);
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_editmasterpage ( PyObject *  self,
PyObject *  args 
)

Definition at line 290 of file cmddoc.cpp.

{
       char* name = 0;
       if (!PyArg_ParseTuple(args, "es", const_cast<char*>("utf-8"), &name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       const QString masterPageName(name);
       const QMap<QString,int>& masterNames(ScCore->primaryMainWindow()->doc->MasterNames);
       const QMap<QString,int>::const_iterator it(masterNames.find(masterPageName));
       if ( it == masterNames.constEnd() )
       {
              PyErr_SetString(PyExc_ValueError, "Master page not found");
              return NULL;
       }
       ScCore->primaryMainWindow()->view->showMasterPage(*it);
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_getunit ( PyObject *  )

Returns actual unit scale.

Definition at line 226 of file cmddoc.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->doc->unitIndex()));
}

Here is the call graph for this function:

PyObject* scribus_havedoc ( PyObject *  )

Checks if is a document opened.

Definition at line 139 of file cmddoc.cpp.

{
       return PyInt_FromLong(static_cast<long>(ScCore->primaryMainWindow()->HaveDoc));
}

Here is the call graph for this function:

PyObject* scribus_loadstylesfromfile ( PyObject *  ,
PyObject *  args 
)

Loads styles from another .sla file (craig r.)

Definition at line 233 of file cmddoc.cpp.

{
       char *fileName;
       if (!PyArg_ParseTuple(args, "es", "utf-8", &fileName))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       ScCore->primaryMainWindow()->doc->loadStylesFromFile(QString::fromUtf8(fileName));
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_masterpagenames ( PyObject *  self)

Definition at line 275 of file cmddoc.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       PyObject* names = PyList_New(ScCore->primaryMainWindow()->doc->MasterPages.count());
       QMap<QString,int>::const_iterator it(ScCore->primaryMainWindow()->doc->MasterNames.constBegin());
       QMap<QString,int>::const_iterator itEnd(ScCore->primaryMainWindow()->doc->MasterNames.constEnd());
       int n = 0;
       for ( ; it != itEnd; ++it )
       {
              PyList_SET_ITEM(names, n++, PyString_FromString(it.key().utf8().data()) );
       }
       return names;
}

Here is the call graph for this function:

PyObject* scribus_newdoc ( PyObject *  ,
PyObject *  args 
)

Creates a new document e.g.

(Paper_A4, Margins, 1, 1, 1, NoFacingPages, FirstPageLeft) first 2 args are lists (tuples)

Todo:
Obsolete! In the case of no facing pages use only firstpageleft scripter is not new-page-size ready. What is it: don't allow to use wrong FSL constant in the case of onesided document.

Definition at line 74 of file cmddoc.cpp.

{
       qDebug("WARNING: newDoc() procedure is obsolete, it will be removed in a forthcoming release. Use newDocument() instead.");
       double b, h, lr, tpr, btr, rr, ebr;
       int unit, ds, fsl, fNr, ori;
       PyObject *p, *m;
       if ((!PyArg_ParseTuple(args, "OOiiiii", &p, &m, &ori, &fNr, &unit, &ds, &fsl)) ||
               (!PyArg_ParseTuple(p, "dd", &b, &h)) ||
               (!PyArg_ParseTuple(m, "dddd", &lr, &rr, &tpr, &btr)))
              return NULL;
       b = value2pts(b, unit);
       h = value2pts(h, unit);
       if (ori == 1)
       {
              ebr = b;
              b = h;
              h = ebr;
       }
       if (ds!=1 && fsl>0)
              fsl = 0;
       // end of hack
       tpr = value2pts(tpr, unit);
       lr = value2pts(lr, unit);
       rr = value2pts(rr, unit);
       btr = value2pts(btr, unit);
       bool ret = ScCore->primaryMainWindow()->doFileNew(b, h, tpr, lr, rr, btr, 0, 1, false, ds, unit, fsl, ori, fNr, "Custom", true);
       //     qApp->processEvents();
       return PyInt_FromLong(static_cast<long>(ret));
}

Here is the call graph for this function:

PyObject* scribus_newdocument ( PyObject *  ,
PyObject *  args 
)

Creates a new document e.g.

(Paper_A4, Margins, 1, 1, 1, NoFacingPages, FirstPageLeft) first 2 args are lists (tuples)

Definition at line 16 of file cmddoc.cpp.

{
       double topMargin, bottomMargin, leftMargin, rightMargin;
       double pageWidth, pageHeight;
       int orientation, firstPageNr, unit, pagesType, facingPages, firstPageOrder, numPages;

       PyObject *p, *m;

       if ((!PyArg_ParseTuple(args, "OOiiiiii", &p, &m, &orientation,
                                                                             &firstPageNr, &unit,
                                                                             &pagesType,
                                                                             &firstPageOrder,
                                                                             &numPages)) ||
                                          (!PyArg_ParseTuple(p, "dd", &pageWidth, &pageHeight)) ||
                                          (!PyArg_ParseTuple(m, "dddd", &leftMargin, &rightMargin,
                                                                                    &topMargin, &bottomMargin)))
              return NULL;
       if (numPages <= 0)
              numPages = 1;
       if (pagesType == 0)
       {
              facingPages = 0;
              firstPageOrder = 0;
       }
       else
              facingPages = 1;
       // checking the bounds
       if (pagesType < firstPageOrder)
       {
              PyErr_SetString(ScribusException, QObject::tr("firstPageOrder is bigger than allowed.","python error"));
              return NULL;
       }

       pageWidth = value2pts(pageWidth, unit);
       pageHeight = value2pts(pageHeight, unit);
       if (orientation == 1)
       {
              double x = pageWidth;
              pageWidth = pageHeight;
              pageHeight = x;
       }
       leftMargin = value2pts(leftMargin, unit);
       rightMargin = value2pts(rightMargin, unit);
       topMargin = value2pts(topMargin, unit);
       bottomMargin = value2pts(bottomMargin, unit);

       bool ret = ScCore->primaryMainWindow()->doFileNew(pageWidth, pageHeight,
                                                        topMargin, leftMargin, rightMargin, bottomMargin,
                                                        // autoframes. It's disabled in python
                                                        // columnDistance, numberCols, autoframes,
                                                        0, 1, false,
                                                        pagesType, unit, firstPageOrder,
                                                        orientation, firstPageNr, "Custom", true, numPages);
       ScCore->primaryMainWindow()->doc->pageSets[pagesType].FirstPage = firstPageOrder;

       return PyInt_FromLong(static_cast<long>(ret));
}

Here is the call graph for this function:

PyObject* scribus_opendoc ( PyObject *  ,
PyObject *  args 
)

Opens a document with given name.

Definition at line 144 of file cmddoc.cpp.

{
       char *Name;
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       bool ret = ScCore->primaryMainWindow()->loadDoc(QString::fromUtf8(Name));
       if (!ret)
       {
              PyErr_SetString(ScribusException, QObject::tr("Failed to open document.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_True); // compatibility: return true, not none, on success
//     return Py_True;
       Py_RETURN_TRUE;
}

Here is the call graph for this function:

PyObject* scribus_savedoc ( PyObject *  )

Definition at line 160 of file cmddoc.cpp.

{
       if(!checkHaveDocument())
              return NULL;
       ScCore->primaryMainWindow()->slotFileSave();
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_savedocas ( PyObject *  ,
PyObject *  args 
)

Saves active document with given name.

Definition at line 170 of file cmddoc.cpp.

{
       char *Name;
       if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       bool ret = ScCore->primaryMainWindow()->DoFileSave(QString::fromUtf8(Name));
       if (!ret)
       {
              PyErr_SetString(ScribusException, QObject::tr("Failed to save document.","python error"));
              return NULL;
       }
//     Py_INCREF(Py_True); // compatibility: return true, not none, on success
//     return Py_True;
       Py_RETURN_TRUE;
}

Here is the call graph for this function:

PyObject* scribus_setdoctype ( PyObject *  ,
PyObject *  args 
)

Definition at line 246 of file cmddoc.cpp.

{
       int fp, fsl;
       if (!PyArg_ParseTuple(args, "ii", &fp, &fsl))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if (ScCore->primaryMainWindow()->doc->currentPageLayout == fp)
              ScCore->primaryMainWindow()->doc->pageSets[ScCore->primaryMainWindow()->doc->currentPageLayout].FirstPage = fsl;
       ScCore->primaryMainWindow()->view->reformPages();
       ScCore->primaryMainWindow()->view->GotoPage(ScCore->primaryMainWindow()->doc->currentPageNumber()); // is this needed?
       ScCore->primaryMainWindow()->view->DrawNew();   // is this needed?
       //CB TODO ScCore->primaryMainWindow()->pagePalette->RebuildPage(); // is this needed?
       ScCore->primaryMainWindow()->slotDocCh();
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_setinfo ( PyObject *  ,
PyObject *  args 
)

Sets document infos - author, title and description.

Definition at line 188 of file cmddoc.cpp.

{
       char *Author;
       char *Title;
       char *Desc;
       // z means string, but None becomes a NULL value. QString()
       // will correctly handle NULL.
       if (!PyArg_ParseTuple(args, "zzz", &Author, &Title, &Desc))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       ScCore->primaryMainWindow()->doc->documentInfo.setAuthor(QString::fromUtf8(Author));
       ScCore->primaryMainWindow()->doc->documentInfo.setTitle(QString::fromUtf8(Title));
       ScCore->primaryMainWindow()->doc->documentInfo.setComments(QString::fromUtf8(Desc));
       ScCore->primaryMainWindow()->slotDocCh();
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_setmargins ( PyObject *  ,
PyObject *  args 
)

Sets document margins - left, right, top and bottom.

Definition at line 108 of file cmddoc.cpp.

{
       double lr, tpr, btr, rr;
       if (!PyArg_ParseTuple(args, "dddd", &lr, &rr, &tpr, &btr))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       tpr = ValueToPoint(tpr);
       lr = ValueToPoint(lr);
       rr = ValueToPoint(rr);
       btr = ValueToPoint(btr);
       ScCore->primaryMainWindow()->doc->resetPage(tpr, lr, rr, btr, ScCore->primaryMainWindow()->doc->currentPageLayout);
       ScCore->primaryMainWindow()->view->reformPages();
       ScCore->primaryMainWindow()->doc->setModified(true);
       ScCore->primaryMainWindow()->view->GotoPage(ScCore->primaryMainWindow()->doc->currentPageNumber());
       ScCore->primaryMainWindow()->view->DrawNew();
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_setunit ( PyObject *  ,
PyObject *  args 
)

Changes unit scale.

Definition at line 208 of file cmddoc.cpp.

{
       int e;
       if (!PyArg_ParseTuple(args, "i", &e))
              return NULL;
       if(!checkHaveDocument())
              return NULL;
       if ((e < 0) || (e > 3))
       {
              PyErr_SetString(PyExc_ValueError, QObject::tr("Unit out of range. Use one of the scribus.UNIT_* constants.","python error"));
              return NULL;
       }
       ScCore->primaryMainWindow()->slotChangeUnit(e);
//     Py_INCREF(Py_None);
//     return Py_None;
       Py_RETURN_NONE;
}

Here is the call graph for this function: