gui::PdfEditWindow Class Reference

Main window of application. More...

#include <pdfeditwindow.h>

List of all members.

Public Slots

void pageDeleteSelection ()
void setSelection (std::vector< boost::shared_ptr< PdfOperator > > vec)
void setSelection (std::vector< boost::shared_ptr< CAnnotation > > vec)
void changeRevision (int revision)
void receiveHelpText (const QString &message)

Signals

void itemDeleted (boost::shared_ptr< IProperty > it)
void selfDestruct ()
void documentChanged (boost::shared_ptr< pdfobjects::CPdf > newDocument)
void revisionChanged (int revision)

Public Member Functions

 PdfEditWindow (const QString &fName=QString::null, QWidget *parent=0, const char *name=0)
 ~PdfEditWindow ()
void addColorTool (ColorTool *tool)
void addEditTool (EditTool *tool)
void addNumberTool (NumberTool *tool)
void addSelectTool (SelectTool *tool)
bool modified ()
QString filename ()
void saveVisibility (QWidget *w, const QString &name)
void loadVisibility (QWidget *w, const QString &name)
void saveWindowState ()
void restoreWindowState ()
bool save (bool newRevision=false)
bool saveCopy (const QString &name)
bool closeFile (bool askSave, bool onlyAsk=false)
bool openFile (const QString &name, bool askPassword=true)
void exitApp ()
void closeWindow ()
int pageNumber ()
void bigPixmap ()
PageSpacegetPageSpace () const
void run (const QString &scriptName)
void runFile (const QString &scriptName)
void eval (const QString &code)
QStringList allUnits ()
QStringList allUnitIds ()
boost::shared_ptr
< pdfobjects::utils::ProgressObserver
getProgressObserver ()
QProgressBar * getProgressBar ()

Static Public Member Functions

static PdfEditWindowcreate (const QString &fName=QString::null)

Protected Slots

void pageChange (const QSPage &pg, int numberOfPage)
void treeClicked (int button, QListViewItem *item)
void menuActivated (int id)
void setObject ()

Protected Member Functions

virtual void closeEvent (QCloseEvent *e)

Private Slots

void unsetObjectIf (TreeItem *ipItem)
void unsetObjectIf (TreeItemAbstract *theItem)
void pagePopup (const QPoint &globalPos)
void settingUpdate (QString key)
void runScript (QString script)

Private Member Functions

void setTitle (int revision=0)
void addObjectDialogI (boost::shared_ptr< IProperty > ip)
void setFileName (const QString &name)
void destroyFile ()
void emptyFile ()

Private Attributes

boost::shared_ptr
< pdfobjects::utils::ProgressObserver
progressObserver
QProgressBar * progressBar
CommandWindowcmdLine
MultiTreeWindowtree
PropertyEditorprop
boost::shared_ptr< CPdfdocument
boost::shared_ptr< CPageselectedPage
int selectedPageNumber
boost::shared_ptr< IPropertyselectedProperty
boost::shared_ptr< PdfOperatorselectedOperator
TreeItemAbstractselectedTreeItem
QSplitter * spl
QSplitter * splCmd
QSplitter * splProp
QString fileName
QString baseName
MenumenuSystem
PageSpacepagespc
BaseGUIbase
StatusBarstatus

Friends

class BaseGUI

Detailed Description

Main window of application.

PdfEditWindow - class handling main application window


Constructor & Destructor Documentation

gui::PdfEditWindow::PdfEditWindow ( const QString &  fName = QString::null,
QWidget *  parent = 0,
const char *  name = 0 
)

constructor of PdfEditWindow, creates window and fills it with elements

Parameters:
parent parent widget containing this control
name name of widget (currently unused)
fName Name of file to open in this window. If empty or null, no file will be opened
gui::PdfEditWindow::~PdfEditWindow (  ) 

default destructor


Member Function Documentation

void gui::PdfEditWindow::addColorTool ( ColorTool tool  ) 

Add color selection tool to list of "known color selection tools"

Parameters:
tool Tool to add

References create().

Referenced by gui::ToolFactory::specialItem().

void gui::PdfEditWindow::addEditTool ( EditTool tool  ) 

Add line edit tool to list of "known line edit tools"

Parameters:
tool Tool to add

Referenced by gui::ToolFactory::specialItem().

void gui::PdfEditWindow::addNumberTool ( NumberTool tool  ) 

Add number edit tool to list of "known number edit tools"

Parameters:
tool Tool to add

References gui::BaseGUI::addColorTool(), and base.

Referenced by gui::ToolFactory::specialItem().

void gui::PdfEditWindow::addObjectDialogI ( boost::shared_ptr< IProperty ip  )  [private]

Show dialog for adding objects into given container.
Container must be Dict or Array, otherwise the dialog is not created. After creating, dialog is shown and usable and this function immediately returns.

Parameters:
ip Dict or Array into which objects will be added
void gui::PdfEditWindow::addSelectTool ( SelectTool tool  ) 

Add select text tool to list of "known select text tools"

Parameters:
tool Tool to add

References gui::BaseGUI::addEditTool(), and base.

Referenced by gui::ToolFactory::specialItem().

QStringList gui::PdfEditWindow::allUnitIds (  ) 

Return list of available length unit identifiers Identifiers are 1:1 with units returned by allUnits

Returns:
list of units
QStringList gui::PdfEditWindow::allUnits (  ) 

Return list of available length units

Returns:
list of units
void gui::PdfEditWindow::bigPixmap (  ) 

Load and apply current value of "Use big pixmap" setting

void gui::PdfEditWindow::changeRevision ( int  revision  )  [slot]

Change currently active revision in document

Parameters:
revision New revision
void gui::PdfEditWindow::closeEvent ( QCloseEvent *  e  )  [protected, virtual]

This is called on attempt to close window. If there is unsaved work, dialog asking to save it would appear, otherwise the windows is closed.

Parameters:
e Close event
bool gui::PdfEditWindow::closeFile ( bool  askSave,
bool  onlyAsk = false 
)

Closes file currently opened in editor.

Parameters:
askSave Ask about saving changes?
onlyAsk Only ask about closing/saving work, do not actually close file
Returns:
true if user accepted the close or saved the document before, false if user refuses the close

Referenced by create().

void gui::PdfEditWindow::closeWindow (  ) 

Close the window itself

PdfEditWindow * gui::PdfEditWindow::create ( const QString &  fName = QString::null  )  [static]

Creates new windows and displays it.

Parameters:
fName Name of file to open in new window. If no file specified, new window is initially empty
Returns:
Pointer to new window

References closeFile(), saveWindowState(), and gui::windowCount.

Referenced by addColorTool().

void gui::PdfEditWindow::destroyFile (  )  [private]

Closes file currently opened in editor, without opening new empty one

void gui::PdfEditWindow::documentChanged ( boost::shared_ptr< pdfobjects::CPdf newDocument  )  [signal]

Signal emitted when active document is changed Reference to newly opened document is sent. If document is closed without opening a new file, NULL is sent instead.

Parameters:
newDocument Pointer to new document
void gui::PdfEditWindow::emptyFile (  )  [private]

Opens new empty file in editor.

Referenced by pageDeleteSelection().

void gui::PdfEditWindow::eval ( const QString &  code  ) 

Run given script code

Parameters:
code Code to evaluate

References base, and gui::Base::run().

Referenced by runCmdScripts().

void gui::PdfEditWindow::exitApp (  ) 

application exit handler invoked when "Quit" is selected in menu/toolbar/etc ...

References debug::DBG_INFO, guiPrintDbg, q_App, and gui::windowCount.

QString gui::PdfEditWindow::filename (  ) 

Return name of file loaded in editor. Return empty string if the document have no name (if it is not loaded from disk and have not yet been saved)

Returns:
Filename
PageSpace * gui::PdfEditWindow::getPageSpace (  )  const

Return reference to pagespace (needed for example by ZoomTool)

Returns:
PageSpace inside this window

Referenced by gui::ToolFactory::specialItem().

QProgressBar * gui::PdfEditWindow::getProgressBar (  ) 

Returns common progress bar.

Note that this progress bar is shared and so user should keep in mind that someone is using same progress bar while he starts to use it.

Returns:
Qt progress bar instance.
boost::shared_ptr< pdfobjects::utils::ProgressObserver > gui::PdfEditWindow::getProgressObserver (  ) 

Returns progress observer. This progress observer holds qt progress bar (progressBar field) stored in status bar. It can be registered on ObserverHandler to display progress.

void gui::PdfEditWindow::itemDeleted ( boost::shared_ptr< IProperty it  )  [signal]

Signal emitted whenever any IProperty object is deleted

Parameters:
it Property that was deleted
void gui::PdfEditWindow::loadVisibility ( QWidget *  w,
const QString &  name 
)

Restore window visibility state from application settings

Parameters:
w Widget to restore
name Name of key in settings
void gui::PdfEditWindow::menuActivated ( int  id  )  [protected, slot]

Signal handler invoked on menu activation

Parameters:
id Menu ID of clicked item

References gui::BaseGUI::addNumberTool(), and base.

bool gui::PdfEditWindow::modified (  ) 

Check whether currently opened document was modified since it was opened or last saved

Returns:
true if document was modified, false if not
bool gui::PdfEditWindow::openFile ( const QString &  name,
bool  askPassword = true 
)

Open file in editor.

Parameters:
name Name of file to open
askPassword Ask user directly for password? If not, password have to be set other ways if necessary (via script for example)
Returns:
True if success, false if failure
void gui::PdfEditWindow::pageChange ( const QSPage pg,
int  numberOfPage 
) [protected, slot]

Slot called on changing the page in preview window

Parameters:
pg New page that was just changed to
numberOfPage Number of page
void gui::PdfEditWindow::pageDeleteSelection (  )  [slot]

Slot called when deleteSelection from pagespace is emitted. Script callback function is invoked.

References base, gui::BaseCore::call(), and emptyFile().

int gui::PdfEditWindow::pageNumber (  ) 

Return currently selected page number

Returns:
current page number

References gui::QSPage::get(), and selectedPage.

Referenced by gui::ToolFactory::specialItem().

void gui::PdfEditWindow::pagePopup ( const QPoint &  globalPos  )  [private, slot]

Slot called when right-clicked in current page

Parameters:
globalPos Position of mouse cursor
void gui::PdfEditWindow::receiveHelpText ( const QString &  message  )  [slot]

Signal called when receiving help message. Show it in statusbar

Parameters:
message Help message
void gui::PdfEditWindow::restoreWindowState (  ) 

Restores window state from application settings

void gui::PdfEditWindow::revisionChanged ( int  revision  )  [signal]

Signal emitted when user changes the current revision in any way (script, revision tool ...)

Parameters:
revision number of selected revision
void gui::PdfEditWindow::run ( const QString &  scriptName  ) 

Runs script from given file, looking in script path first

Parameters:
scriptName name of file with QT Script to run

Referenced by runCmdScripts().

void gui::PdfEditWindow::runFile ( const QString &  scriptName  ) 

Runs script from given file

Parameters:
scriptName name of file with QT Script to run

Referenced by runCmdScripts().

void gui::PdfEditWindow::runScript ( QString  script  )  [private, slot]

Runs given script code

Parameters:
script QT Script code to run

bool gui::PdfEditWindow::save ( bool  newRevision = false  ) 

Save currently edited document to disk If the document have no name (newly opened/generated document), it is solicited from used via dialog.

Parameters:
newRevision If true, create new revision while saving
Returns:
true if saved succesfully, false if failed to save because of any reason
bool gui::PdfEditWindow::saveCopy ( const QString &  name  ) 

Save currently edited document to disk, using provided filename

Parameters:
name New filename to save document under
Returns:
true if saved succesfully, false if failed to save because of any reason

References fileName.

void gui::PdfEditWindow::saveVisibility ( QWidget *  w,
const QString &  name 
)

Saves window visibility state to application settings

Parameters:
w Widget to save
name Name of key in settings
void gui::PdfEditWindow::saveWindowState (  ) 

Saves window state to application settings

Referenced by create().

void gui::PdfEditWindow::selfDestruct (  )  [signal]

Signal emitted when closing a file or editor window. All helper editor widgets opened from this window that are subclasses of SelfDestructiveWidget will close themselves

void gui::PdfEditWindow::setFileName ( const QString &  name  )  [private]

Assign given filename for document in editor. Also updates window title, etc ...

Parameters:
name New filename for document

References base, and gui::Base::setError().

void gui::PdfEditWindow::setObject (  )  [protected, slot]

Called upon selecting some item in treeview

void gui::PdfEditWindow::setSelection ( std::vector< boost::shared_ptr< CAnnotation > >  vec  )  [slot]

Slot called on selecting something from page -> display it in the tree

Parameters:
vec Vector with annotations
void gui::PdfEditWindow::setSelection ( std::vector< boost::shared_ptr< PdfOperator > >  vec  )  [slot]

Slot called on selecting something from page -> display it in the tree

Parameters:
vec Vector with operators

References base, gui::BaseCore::call(), prop, selectedProperty, and gui::PropertyEditor::setObject().

void gui::PdfEditWindow::settingUpdate ( QString  key  )  [private, slot]

Called when any settings are updated (in script, option editor, etc ...)

Parameters:
key Key of setting that was updated
void gui::PdfEditWindow::setTitle ( int  revision = 0  )  [private]

Set window title, according to stored baseName and active revision number, and also some other facts (if document is linearized, etc ...)

Parameters:
revision Revision number

References APP_NAME, baseName, and PDFEDIT_VERSION.

void gui::PdfEditWindow::treeClicked ( int  button,
QListViewItem *  item 
) [protected, slot]

Called when clicked anywhere in tree windows

Parameters:
button Button used to click (1=left, 2=right, 4=middle, 8=doubleclick with left)
item Item that was clicked on, if clicked outside item, NULL is sent
void gui::PdfEditWindow::unsetObjectIf ( TreeItemAbstract theItem  )  [private, slot]

Unset selected object if it is the one given in parameter (because it is about to be deleted)

Parameters:
theItem object to check (and possibly unselect)
void gui::PdfEditWindow::unsetObjectIf ( TreeItem ipItem  )  [private, slot]

Function called when deleting tree item of type TreeItem

Parameters:
ipItem object to check (and possibly unselect)

References debug::DBG_DBG, guiPrintDbg, prop, and gui::PropertyEditor::setObject().


Friends And Related Function Documentation

friend class BaseGUI [friend]

Base should be allowed to access everything in PdfEditWindow


Member Data Documentation

QString gui::PdfEditWindow::baseName [private]

Name of file loaded in editor without path

Referenced by setTitle().

Commandline window

Referenced by gui::BaseGUI::~BaseGUI().

boost::shared_ptr<CPdf> gui::PdfEditWindow::document [private]

Edited PDF document

QString gui::PdfEditWindow::fileName [private]

Name of file loaded in editor

Referenced by saveCopy().

Menus and toolbars

Page space - page view Widget

Referenced by gui::BaseGUI::~BaseGUI().

QProgressBar* gui::PdfEditWindow::progressBar [private]

Progressbar widget

Progress observer which holds progress bar. Value is initialized in constructor. Wrapped qt progress bar instance is allocated in constructor but deallocating by qt.

Property editor

Referenced by setSelection(), and unsetObjectIf().

boost::shared_ptr<PdfOperator> gui::PdfEditWindow::selectedOperator [private]

Currently selected PdfOperator (in editor)

boost::shared_ptr<CPage> gui::PdfEditWindow::selectedPage [private]

Currently selected page (for scripting)

Referenced by pageNumber().

Currently selected page number

boost::shared_ptr<IProperty> gui::PdfEditWindow::selectedProperty [private]

Currently selected IProperty (in editor)

Referenced by setSelection().

Currently selected tree item (for scripting)

QSplitter* gui::PdfEditWindow::spl [private]

Horizontal splitter between (Preview + Commandline) and (Treeview + Property editor)

QSplitter* gui::PdfEditWindow::splCmd [private]

Vertical splitter between command line and preview window

QSplitter* gui::PdfEditWindow::splProp [private]

Vertical splitter between treeview and property editor

Status bar on bottmo of application

Object treeview


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