kword/plugins/scripting

Scripting::Module Class Reference

The Module class enables access to the KWord functionality from within the scripting backends. More...

#include <Module.h>

Inheritance diagram for Scripting::Module:

List of all members.

Public Slots

QObjectaddCharacterStyle (const QString &name)
QObjectaddFrameSet (const QString &framesetname)
QObjectaddParagraphStyle (const QString &name)
QObjectaddTextFrameSet (const QString &framesetname)
QObjectcharacterStyle (const QString &name)
QObjectdefaultParagraphStyle ()
QObjectevenPagesFooterFrameSet ()
QObjectevenPagesHeaderFrameSet ()
QObjectframe (int frameNr)
int frameCount ()
QObjectframeSet (int frameSetNr)
QObjectframeSetByName (const QString &name)
int frameSetCount ()
QObjectinsertPage (int afterPageNum)
QObjectmainFrameSet ()
QObjectoddPagesFooterFrameSet ()
QObjectoddPagesHeaderFrameSet ()
QObjectotherFrameSet ()
QObjectpage (int pageNumber)
int pageCount ()
QObjectparagraphStyle (const QString &name)
void removePage (int pageNumber)
QStringList shapeKeys ()
QObjectstandardPageLayout ()
QObjecttool ()

Public Member Functions

 Module (QObject *parent=0)
virtual ~Module ()
virtual KoDocument * doc ()
QObjectfindFrameSet (KWord::TextFrameSetType type)
KWDocument * kwDoc ()

Detailed Description

The Module class enables access to the KWord functionality from within the scripting backends.

It will be shown as 'KWord' entity in scripting code.

KWord provides as top-level containers the FrameSet objects. Each such frameset is then able to contain multiple Frame objects. The frameset also allows to access the TextDocument object to deals with the actual content within a text document.

Python example to set the content of the main text document;

 import KWord
 doc = KWord.mainFrameSet().document()
 doc.setHtml("<b>Hello World</b>")

Python example to append content to the main text document and set the page header and footer;

 import KWord
 doc = KWord.mainFrameSet().document()
 doc.lastCursor().insertHtml("Even more <b>Hello World</b>")
 KWord.firstPageHeaderFrameSet().document().setText("Header")
 KWord.firstPageFooterFrameSet().document().setText("Footer")

Python example that prints the documents Url and some other meta information;

 import KWord
 print KWord.document().url()
 print KWord.document().documentInfoTitle()
 print KWord.document().documentInfoAuthorName()

Definition at line 70 of file Module.h.


Constructor & Destructor Documentation

Module::Module ( QObject parent = 0  )  [explicit]

Definition at line 54 of file Module.cpp.

Module::~Module (  )  [virtual]

Definition at line 61 of file Module.cpp.


Member Function Documentation

QObject * Module::addCharacterStyle ( const QString name  )  [slot]

Add and return a new CharacterStyle object.

Definition at line 233 of file Module.cpp.

QObject * Module::addFrameSet ( const QString framesetname  )  [slot]

Add and return a new FrameSet object.

Definition at line 153 of file Module.cpp.

QObject * Module::addParagraphStyle ( const QString name  )  [slot]

Add and return a new ParagraphStyle object.

Definition at line 215 of file Module.cpp.

QObject * Module::addTextFrameSet ( const QString framesetname  )  [slot]

Add and return a new FrameSet object for text handled with TextDocument .

Definition at line 130 of file Module.cpp.

QObject * Module::characterStyle ( const QString name  )  [slot]

Return the CharacterStyle with the defined user-visible-name name .

Definition at line 225 of file Module.cpp.

QObject * Module::defaultParagraphStyle (  )  [slot]

Return the default paragraph ParagraphStyle that will always be present in each document.

Definition at line 199 of file Module.cpp.

KoDocument * Module::doc (  )  [virtual]

Definition at line 77 of file Module.cpp.

QObject* Scripting::Module::evenPagesFooterFrameSet (  )  [inline, slot]

Return the FrameSet that holds the footers for the even pages.

Definition at line 134 of file Module.h.

QObject* Scripting::Module::evenPagesHeaderFrameSet (  )  [inline, slot]

Return the FrameSet that holds the headers for the even pages.

Definition at line 126 of file Module.h.

QObject * Module::findFrameSet ( KWord::TextFrameSetType  type  ) 

Definition at line 183 of file Module.cpp.

QObject * Module::frame ( int  frameNr  )  [slot]

Return a the Frame object identified by the index frameNr.

Definition at line 169 of file Module.cpp.

int Module::frameCount (  )  [slot]

Return the amount of frames this document holds.

Definition at line 161 of file Module.cpp.

QObject * Module::frameSet ( int  frameSetNr  )  [slot]

Return the FrameSet object identified by the index frameSetNr.

Definition at line 118 of file Module.cpp.

QObject * Module::frameSetByName ( const QString name  )  [slot]

Return the FrameSet object which has the name name .

Definition at line 124 of file Module.cpp.

int Module::frameSetCount (  )  [slot]

Return the amount of framesets this document holds.

Definition at line 113 of file Module.cpp.

QObject * Module::insertPage ( int  afterPageNum  )  [slot]

Insert a new page and returns the new Page object.

The new page is inserted after the page which has the pagenumber afterPageNum . If afterPageNum is 0, the new page is inserted before page 1. In all cases, the new page will have the number afterPageNum+1. To append a new page use insertPage( pageCount() ).

Definition at line 93 of file Module.cpp.

KWDocument * Module::kwDoc (  ) 

Definition at line 66 of file Module.cpp.

QObject* Scripting::Module::mainFrameSet (  )  [inline, slot]

Return the FrameSet that holds all the frames for the main text area.

Definition at line 139 of file Module.h.

QObject* Scripting::Module::oddPagesFooterFrameSet (  )  [inline, slot]

Return the FrameSet that holds the footers for the odd pages.

Definition at line 130 of file Module.h.

QObject* Scripting::Module::oddPagesHeaderFrameSet (  )  [inline, slot]

Return the FrameSet that holds the headers for the odd pages.

Definition at line 122 of file Module.h.

QObject* Scripting::Module::otherFrameSet (  )  [inline, slot]

Return any other FrameSet not managed by the auto-frame layout.

Definition at line 144 of file Module.h.

QObject * Module::page ( int  pageNumber  )  [slot]

Return the Page of the specific page number.

Python example that iterates over all pages;

 import KWord
 for i in range( KWord.pageCount() ):
     page = KWord.page(i)
     print "width=%s height=%s" % (page.width(),page.height())

Definition at line 87 of file Module.cpp.

int Module::pageCount (  )  [slot]

Return total number of pages the document has.

Definition at line 82 of file Module.cpp.

QObject * Module::paragraphStyle ( const QString name  )  [slot]

Return the ParagraphStyle with the defined user-visible-name name .

Definition at line 207 of file Module.cpp.

void Module::removePage ( int  pageNumber  )  [slot]

Remove the page with the pagenumber pageNumber .

Definition at line 99 of file Module.cpp.

QStringList Module::shapeKeys (  )  [slot]

Return a list of shapeId names.

Such a shapeId name could then be used for example with the addFrame() method to create a new frame.

Definition at line 105 of file Module.cpp.

QObject * Module::standardPageLayout (  )  [slot]

Return the standard page layout.

Definition at line 194 of file Module.cpp.

QObject * Module::tool (  )  [slot]

Return a Tool object that provides access to functionality like handling for example current/active selections.

Definition at line 243 of file Module.cpp.


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