Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

ScribusDoc Class Reference

the Document Class More...

#include <scribusdoc.h>

Inheritance diagram for ScribusDoc:

Inheritance graph
[legend]
Collaboration diagram for ScribusDoc:

Collaboration graph
[legend]

List of all members.

Public Types

enum  AlignTo {
  alignFirst, alignLast, alignPage, alignMargins,
  alignGuide, alignSelection
}
 Some internal align tools. More...

Public Slots

void itemSelection_ToggleLock ()
void itemSelection_ToggleSizeLock ()
void itemSelection_ToggleImageShown ()
void itemSelection_TogglePrintEnabled ()
void itemSelection_ChangePreviewResolution (int id)
void itemSelection_ClearItem (Selection *customSelection=0)
void itemSelection_DeleteItem (Selection *customSelection=0, bool forceDeletion=false)
 Delete the items in the current selection. When force is true, we do not warn the user and make SE happy too. Force is used from.
void itemSelection_SetItemFillTransparency (double t)
void itemSelection_SetItemLineTransparency (double t)
void itemSelection_SetItemFillBlend (int t)
void itemSelection_SetItemLineBlend (int t)
void itemSelection_SetLineGradient (VGradient &newGradient, Selection *customSelection=0)
void itemSelection_SetFillGradient (VGradient &newGradient, Selection *customSelection=0)
void itemSelection_SetOverprint (bool overprint, Selection *customSelection=0)
void itemSelection_ApplyImageEffects (ScImageEffectList &newEffectList, Selection *customSelection=0)
void itemSelection_FlipH ()
void itemSelection_FlipV ()
void itemSelection_DoHyphenate ()
void itemSelection_DoDeHyphenate ()
void itemSelection_SendToLayer (int layerNumber)
void itemSelection_SetImageOffset (double x, double y, Selection *customSelection=0)
void itemSelection_SetImageScale (double x, double y, Selection *customSelection=0)
void itemSelection_SetImageScaleAndOffset (double ox, double oy, double sx, double sy, Selection *customSelection=0)
void itemSelection_AlignLeftOut (AlignTo currAlignTo, double guidePosition)
void itemSelection_AlignRightOut (AlignTo currAlignTo, double guidePosition)
void itemSelection_AlignBottomIn (AlignTo currAlignTo, double guidePosition)
void itemSelection_AlignRightIn (AlignTo currAlignTo, double guidePosition)
void itemSelection_AlignBottomOut (AlignTo currAlignTo, double guidePosition)
void itemSelection_AlignCenterHor (AlignTo currAlignTo, double guidePosition)
void itemSelection_AlignLeftIn (AlignTo currAlignTo, double guidePosition)
void itemSelection_AlignCenterVer (AlignTo currAlignTo, double guidePosition)
void itemSelection_AlignTopOut (AlignTo currAlignTo, double guidePosition)
void itemSelection_AlignTopIn (AlignTo currAlignTo, double guidePosition)
void itemSelection_DistributeDistH (bool usingDistance=false, double distance=0.0)
void itemSelection_DistributeAcrossPage (bool useMargins=false)
void itemSelection_DistributeRight ()
void itemSelection_DistributeBottom ()
void itemSelection_DistributeCenterH ()
void itemSelection_DistributeDistV (bool usingDistance=false, double distance=0.0)
void itemSelection_DistributeDownPage (bool useMargins=false)
void itemSelection_DistributeLeft ()
void itemSelection_DistributeCenterV ()
void itemSelection_DistributeTop ()
void itemSelection_MultipleDuplicate (ItemMultipleDuplicateData &)
void itemSelection_UniteItems (Selection *customSelection=0)
void itemSelection_SplitItems (Selection *customSelection=0)
void itemSelection_adjustFrametoImageSize (Selection *customSelection=0)
void itemSelection_ApplyArrowHead (int startArrowID=-1, int endArrowID=-1, Selection *customSelection=0)
 startArrowID or endArrowID of -1 mean not applying a selection at this point.
void ItemPen (QString farbe)
void ItemPenShade (int sha)
void ItemBrush (QString farbe)
void ItemBrushShade (int sha)
void ItemGradFill (int typ)
void ItemPatternFill (QString pattern)
void ItemPatternProps (double scaleX, double scaleY, double offsetX, double offsetY, double rotation)
void updatePic ()
void updatePict (QString name)
void removePict (QString name)

Signals

void docChanged ()
 Let the document tell whatever is listening that it has changed.
void updateContents ()
void updateContents (const QRect &r)
void refreshItem (PageItem *)
void canvasAdjusted (double width, double height, double dX, double dY)
void firstSelectedItemType (int)
void setApplicationMode (int)
void signalRebuildOutLinePalette ()
 A signal for when the outline palette needs to rebuild itself Emit when:
  • An item is created or deleted
  • An item changes page
  • An page is created or deleted
  • Some items are grouped or a group is ungrouped This also applies to Master Pages.

void widthAndHeight (double, double)
 Temporary signal for SizeItem.

Public Member Functions

 ScribusDoc ()
 ScribusDoc (const QString &docName, int unitIndex, const PageSize &pagesize, const MarginStruct &margins, const DocPagesSetup &pagesSetup)
 ~ScribusDoc ()
void init ()
void setup (const int, const int, const int, const int, const int, const QString &, const QString &)
void setLoading (const bool)
bool isLoading () const
void setModified (const bool)
bool isModified () const
void setPage (double b, double h, double t, double l, double r, double bo, double sp, double ab, bool atf, int fp)
void resetPage (double t, double l, double r, double bo, int fp)
ScribusViewview () const
 Return the view associated with the document.
ScribusMainWindowscMW () const
void setGUI (bool hasgui, ScribusMainWindow *mw, ScribusView *view)
const ScGuardedPtr< ScribusDoc > & guardedPtr () const
 Return the guarded object associated with the document.
UpdateManagerupdateManager ()
MassObservable< PageItem * > * itemsChanged ()
MassObservable< Page * > * pagesChanged ()
MassObservable< QRectF > * regionsChanged ()
void invalidateRegion (QRectF region)
PageaddPage (const int pageNumber, const QString &masterPageName=QString::null, const bool addAutoFrame=false)
void deletePage (const int)
PageaddMasterPage (const int, const QString &)
 Add a master page with this function, do not use addPage.
void deleteMasterPage (const int)
void rebuildMasterNames (void)
 Rebuild master name list.
void replaceMasterPage (const QString &oldMasterPage)
 Replace a master page by default one.
bool renameMasterPage (const QString &oldPageName, const QString &newPageName)
 Rename a master page.
void createDefaultMasterPages ()
 Create the default master pages based on the layout selected by the user, ie, Normal, Normal Left, etc.
void createNewDocPages (int pageCount)
 Create the requested pages in a new document, run after createDefaultMasterPages().
int addAutomaticTextFrame (const int pageNumber)
 Add the automatic text frame to the page.
void setLocationBasedPageLRMargins (uint pageIndex)
void movePage (const int from, const int to, const int ziel, const int art)
 Move page(s) within the document.
void copyPage (int pageNumberToCopy, int existingPage, int whereToInsert, int copyCount)
 Copy a page (pageNumberToCopy) copyCount times, whereToInsert(before or after) the existingPage or at the end.
int addLayer (const QString &layerName=QString::null, const bool activate=false)
 Add a layer to the current document.
void copyLayer (int layerNumberToCopy, int whereToInsert)
 Copies a layer from the current document.
bool deleteLayer (const int layerNumber, const bool deleteItems)
 Delete a layer from the current document.
int activeLayer ()
 Return the number of the current layer.
const QString & activeLayerName ()
 Return the name of the current layer.
bool setActiveLayer (const int layerToActivate)
 Set the active layer via the layer number.
bool setActiveLayer (const QString &layerNameToActivate)
 Set the active layer via the layer name.
bool setLayerPrintable (const int layerNumber, const bool isPrintable)
 Set the layer printable via the layer number.
bool layerPrintable (const int layerNumber)
 Is the layer printable.
bool setLayerVisible (const int layerNumber, const bool isViewable)
 Set the layer visible via the layer number.
bool layerVisible (const int layerNumber)
 Is the layer visible.
bool setLayerLocked (const int layerNumber, const bool isLocked)
 Set the layer locked via the layer number.
bool layerLocked (const int layerNumber)
 Is the layer locked.
bool setLayerFlow (const int layerNumber, const bool flow)
 Set the layer flow via the layer number.
bool layerFlow (const int layerNumber)
 does text flow around objects on this layer
bool setLayerTransparency (const int layerNumber, double trans)
 Set the layer transparency via the layer number.
double layerTransparency (const int layerNumber)
 returns the layer transparency
bool setLayerBlendMode (const int layerNumber, int blend)
 Set the layer layerBlendMode via the layer number.
int layerBlendMode (const int layerNumber)
 returns the layer BlendMode
int layerLevelFromNumber (const int layerNumber)
 Return the level of the requested layer.
bool setLayerMarker (const int layerNumber, QColor color)
 Set the layer marker color.
QColor layerMarker (const int layerNumber)
 returns the layer marker color
bool setLayerOutline (const int layerNumber, const bool outline)
 Set the layer outline mode via the layer number.
bool layerOutline (const int layerNumber)
 is this layer in outline mode
int layerNumberFromLevel (const int layerLevel)
 Return the number of the layer at a certain level.
int layerCount () const
 Return the layer count.
bool lowerLayer (const int layerNumber)
 Lower a layer.
bool lowerLayerByLevel (const int layerLevel)
 Lower a layer using the level.
bool raiseLayer (const int layerNumber)
 Raise a layer.
bool raiseLayerByLevel (const int layerLevel)
 Raise a layer using the level.
QString layerName (const int layerNumber) const
 Return the layer name.
bool changeLayerName (const int layerNumber, const QString &newName)
 Change the name of a layer.
bool layerContainsItems (const int layerNumber)
 Does the layer have items on it?
bool renumberLayer (const int layerNumber, const int newLayerNumber)
 Renumber a layer. Used in particular for reinsertion for undo/redo.
void orderedLayerList (QStringList *list)
 Return a list of the layers in their order.
bool deleteTaggedItems ()
void getUsedProfiles (ProfilesL &usedProfiles)
 Builds a qmap of the icc profiles used within the document.
bool OpenCMSProfiles (ProfilesL InPo, ProfilesL InPoCMYK, ProfilesL MoPo, ProfilesL PrPo)
void CloseCMSProfiles ()
void SetDefaultCMSParams ()
void enableCMS (bool enable)
 Switch Colormanagement on or of.
const ParagraphStyleparagraphStyle (QString name)
const StyleSet< ParagraphStyle > & paragraphStyles ()
bool isDefaultStyle (const ParagraphStyle &p) const
bool isDefaultStyle (const CharStyle &c) const
void getNamedResources (ResourceCollection &lists) const
void replaceNamedResources (ResourceCollection &newNames)
void redefineStyles (const StyleSet< ParagraphStyle > &newStyles, bool removeUnused=false)
void replaceStyles (const QMap< QString, QString > &newNameForOld)
 Remove any reference to old styles and replace with new name. This needs to be called when a style was removed. New name may be "".
void loadStylesFromFile (QString fileName, StyleSet< ParagraphStyle > *tempStyles=NULL, StyleSet< CharStyle > *tempCharStyles=NULL, QMap< QString, multiLine > *tempLineStyles=NULL)
const CharStylecharStyle (QString name)
const StyleSet< CharStyle > & charStyles ()
void redefineCharStyles (const StyleSet< CharStyle > &newStyles, bool removeUnused=false)
void replaceCharStyles (const QMap< QString, QString > &newNameForOld)
 Remove any reference to old styles and replace with new name. This needs to be called when a style was removed. New name may be "".
void lockGuides (bool isLocked)
 Should guides be locked or not.
void restore (UndoState *state, bool isUndo)
 Method used when an undo/redo is requested.
void setName (const QString &name)
 Sets the name of the document.
QStringList getItemAttributeNames ()
 Returns a stringlist of the item attributes within the document.
bool AddFont (QString name, int fsize=10)
void getUsedFonts (QMap< QString, QMap< uint, FPointArray > > &Really)
 Returns a qmap of the fonts and their glyphs used within the document.
void checkItemForFonts (PageItem *it, QMap< QString, QMap< uint, FPointArray > > &Really, uint lc)
void replaceLineStyleColors (const QMap< QString, QString > &colorMap)
 Replace line style colors.
void getUsedColors (ColorList &colorsToUse, bool spot=false)
 Builds a qmap of the colours used within the document.
bool lineStylesUseColor (const QString &colorName)
 Return if a specific color is used by line styles.
bool addPattern (QString &name, ScPattern &pattern)
 Set the patterns for a document.
void setPatterns (QMap< QString, ScPattern > &patterns)
QStringList getUsedPatterns ()
 Builds a QStringList of the patterns used within the document.
QStringList getUsedPatternsSelection ()
QStringList getUsedPatternsHelper (QString pattern, QStringList &results)
void reorganiseFonts ()
 TODO: Reorganise the fonts.. how? Moved from scribus.cpp.
void setUnitIndex (const int)
 Set and get the document's unit index.
int unitIndex () const
double unitRatio () const
bool applyMasterPage (const QString &pageName, const int pageNumber)
 Apply a master page.
void restoreMasterPageApplying (SimpleState *state, bool isUndo)
 Undo function for applying a master page.
void restorePageCopy (SimpleState *state, bool isUndo)
bool save (const QString &fileName, QString *savedFile=NULL)
 Save function.
bool changePageMargins (const double initialTop, const double initialBottom, const double initialLeft, const double initialRight, const double initialHeight, const double initialWidth, const double Height, const double width, const int orientation, const QString &pageSize, const int pageNumber=-1, const int pageType=0)
 Set the page margins. Current code uses current page only, also provide a (currently, TODO) option for this.
void recalculateColors ()
 Recalculate the colors after CMS settings change. Update the items in the doc accordingly.
void setScTextDefaultsFromDoc (ScText *)
 Sets up the ScText defaults from the document.
bool copyPageToMasterPage (const int, const int, const int, const QString &, bool)
 Copies a normal page to be a master pages.
int itemAdd (const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const double x, const double y, const double b, const double h, const double w, const QString &fill, const QString &outline, const bool itemFinalised)
 Paste an item to the document. The bulk of a paste item process runs here for want of a better place, but its a better place than the view where it used to be. TODO Once the pageitem restructure is done, this is probably unnecessary but it removes the unnecessary part from the view for now which is overloaded with non ScrollView code.
int itemAddArea (const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const double x, const double y, const double w, const QString &fill, const QString &outline, const bool itemFinalised)
int itemAddUserFrame (InsertAFrameData &iafData)
 Allow the user to create a frame easily with some simple placement and sizing options.
bool itemAddCommit (const int itemNumber)
 Commit item creation when a user has click-drag created an item Only called from ScribusView. Note the undo target is the page, so the undo code remains their for now.
void itemAddDetails (const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const int itemNumber)
 Finalise item creation. Simply split off code from itemAdd Only to be called from itemAdd().
uint getItemNrfromUniqueID (uint unique)
void updateFrameItems ()
 Run this common frame item update code.
void renumberItemsInListOrder ()
 Renumbers the items into the order they are stored in in the lists. Utility function used in various places, basically handles keeping items numbered in the way they are layered. When layer is a property and not a fuction of storage, this should be removed. Depends on the Items pointer pointing to the correct item list (doc, master, etc).
void rebuildItemLists ()
 Rebuild item lists taking into account layer order. Utility function used in various places, basically handles keeping items numbered in the way they are layered. When layer is a property and not a fuction of storage, this should be removed.
bool usesAutomaticTextFrames () const
 Doc uses automatic text frames?
void setUsesAutomaticTextFrames (const bool)
bool LoadPict (QString fn, int ItNr, bool reload=false, bool showMsg=false)
 Load images into an image frame, moved from the view.
bool loadPict (QString fn, PageItem *pageItem, bool reload=false, bool showMsg=false)
void RecalcPictures (ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia=0)
 Handle image with color profiles.
void canvasMinMax (FPoint &, FPoint &)
 Find the minX,MinY and maxX,maxY for the canvas required for the doc.
int OnPage (double x2, double y2)
int OnPage (PageItem *currItem)
void GroupOnPage (PageItem *currItem)
void reformPages (bool moveObjects=true)
double getXOffsetForPage (const int)
 Return the x or y offset for a page on the canvas.
double getYOffsetForPage (const int)
void getBleeds (int pageNumber, double *bleedTop, double *bleedBottom, double *bleedLeft, double *bleedRight)
void getBleeds (Page *page, double *bleedTop, double *bleedBottom, double *bleedLeft, double *bleedRight)
PageItemconvertItemTo (PageItem *currItem, PageItem::ItemType newType, PageItem *secondaryItem=NULL)
 Item type conversion functions.
int currentPageNumber ()
 The page number of the current page.
bool itemNameExists (const QString itemName)
 Return true iff the passed name is not used by any existing PageItem in the same document as this PageItem.
void setMasterPageMode (bool)
 Set the doc into Master page mode Do we need to return if the move to master page mode was successful?
bool masterPageMode () const
void addSection (const int number=0, const QString &name=QString::null, const uint fromindex=0, const uint toindex=0, const DocumentSectionType type=Type_1_2_3, const uint sectionstartindex=0, const bool reversed=false, const bool active=true)
 Add a section to the document sections list Set number to -1 to add in the default section if the map is empty.
bool deleteSection (const uint)
 Delete a section from the document sections list.
const QString getSectionPageNumberForPageIndex (const uint) const
 Gets the page number to be printed based on the section it is in. Returns QString::null on failure to find the pageIndex.
int getSectionKeyForPageIndex (const uint pageIndex) const
 Gets the key of the sections map based on the section the page index is in. Returns -1 on failure to find the pageIndex.
void updateSectionPageNumbersToPages ()
void addPageToSection (const uint otherPageIndex, const uint location, const uint count=1)
void removePageFromSection (const uint pageIndex)
void setFirstSectionFromFirstPageNumber ()
void updateAllItemQColors ()
 Update the fill and line QColors for all items in the doc.
void buildAlignItemList (Selection *customSelection=0)
bool startAlign ()
void endAlign ()
void insertColor (QString nam, double c, double m, double y, double k)
 Insert a color into the documents color list.
QMap< QString, double > & constants ()
PageLocation locationOfPage (int pageIndex) const
 Get the location of the page on the canvas, ie, left, middle, or right Does not give information about middle left, etc.
bool sendItemSelectionToBack ()
bool bringItemSelectionToFront ()
void itemSelection_GroupObjects (bool changeLock, bool lock, Selection *customSelection=0)
void itemSelection_UnGroupObjects (Selection *customSelection=0)
void itemSelection_convertItemsTo (const PageItem::ItemType newType, Selection *customSelection=0)
void itemSelection_ApplyParagraphStyle (const ParagraphStyle &newstyle, Selection *customSelection=0)
void itemSelection_SetParagraphStyle (const ParagraphStyle &newstyle, Selection *customSelection=0)
void itemSelection_ApplyCharStyle (const CharStyle &newstyle, Selection *customSelection=0)
void itemSelection_SetCharStyle (const CharStyle &newstyle, Selection *customSelection=0)
void itemSelection_EraseParagraphStyle (Selection *customSelection=0)
void itemSelection_EraseCharStyle (Selection *customSelection=0)
void itemSelection_SetNamedParagraphStyle (const QString &name, Selection *customSelection=0)
void itemSelection_SetNamedCharStyle (const QString &name, Selection *customSelection=0)
void itemSelection_SetNamedLineStyle (const QString &name, Selection *customSelection=0)
void ChLineWidth (double w)
void ChLineArt (Qt::PenStyle w)
void ChLineJoin (Qt::PenJoinStyle w)
void ChLineEnd (Qt::PenCapStyle w)
void itemSelection_SetAlignment (int w, Selection *customSelection=0)
void itemSelection_SetLineSpacing (double w, Selection *customSelection=0)
void itemSelection_SetLineSpacingMode (int w, Selection *customSelection=0)
void itemSelection_SetFont (QString fon, Selection *customSelection=0)
void itemSelection_SetFillColor (QString farbe, Selection *customSelection=0)
void itemSelection_SetFillShade (int sha, Selection *customSelection=0)
void itemSelection_SetStrokeColor (QString farbe, Selection *customSelection=0)
void itemSelection_SetStrokeShade (int sha, Selection *customSelection=0)
void itemSelection_SetScaleV (int, Selection *customSelection=0)
void itemSelection_SetScaleH (int, Selection *customSelection=0)
void itemSelection_SetBaselineOffset (int, Selection *customSelection=0)
void itemSelection_SetOutlineWidth (int, Selection *customSelection=0)
void itemSelection_SetShadowOffsets (int shx, int shy, Selection *customSelection=0)
void itemSelection_SetUnderline (int pos, int wid, Selection *customSelection=0)
void itemSelection_SetStrikethru (int pos, int wid, Selection *customSelection=0)
void itemSelection_SetEffects (int s, Selection *customSelection=0)
void itemSelection_SetOpticalMargins (int i, Selection *customSelection=0)
void itemSelection_SetTracking (int us, Selection *customSelection=0)
void itemSelection_SetFontSize (int size, Selection *customSelection=0)
void MirrorPolyH (PageItem *currItem)
void MirrorPolyV (PageItem *currItem)
void setRedrawBounding (PageItem *currItem)
void adjustCanvas (FPoint minPos, FPoint maxPos, bool absolute=false)
void recalcPicturesRes (bool applyNewRes=false)
void connectDocSignals ()
void removeLayer (int l, bool dl=false)
void changed ()
 We call changed() whenever the document needs to know it has been changed. If the document is the primary document in a main window, it will signal to enable/disable certain operations.
PagecurrentPage ()
 Get pointer to the current page.
void setCurrentPage (Page *newPage)
 Set new current page.
bool hasGUI () const
QPoint ApplyGrid (const QPoint &in)
 Apply grid to a QPoint, from ScribusView.
FPoint ApplyGridF (const FPoint &in)
 Apply grid to an FPoint, from ScribusView.
bool hasTOCSetup ()
 Does this doc have any TOC setups and potentially a TOC to generate.
void getClosestGuides (double xin, double yin, double *xout, double *yout, int *GxM, int *GyM)
 Get the closest guide to the given point.
void SnapToGuides (PageItem *currItem)
 Snap an item to the guides.
bool ApplyGuides (double *x, double *y)
bool MoveItem (double newX, double newY, PageItem *ite, bool fromMP=false)
void RotateItem (double win, int ite)
void RotateItem (double win, PageItem *currItem)
void MoveRotated (PageItem *currItem, FPoint npv, bool fromMP=false)
bool SizeItem (double newX, double newY, int ite, bool fromMP=false, bool DoUpdateClip=true, bool redraw=true)
bool SizeItem (double newX, double newY, PageItem *pi, bool fromMP=false, bool DoUpdateClip=true, bool redraw=true)
bool MoveSizeItem (FPoint newX, FPoint newY, int ite, bool fromMP=false, bool constrainRotation=false)
void AdjustItemSize (PageItem *currItem)
void moveGroup (double x, double y, bool fromMP=false, Selection *customSelection=0)
void rotateGroup (double angle, FPoint RCenter)
void scaleGroup (double scx, double scy, bool scaleText=true, Selection *customSelection=0)

Public Attributes

bool is12doc
int NrItems
int First
int Last
int viewCount
int viewID
bool SnapGuides
bo