Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Document Class Reference

A document is a component that interacts with a valid model instance and has many extra features like saving, loading, cutting no implemented within the scope of a model. More...

#include <vcf/ApplicationKit/Document.h>

Inheritance diagram for VCF::Document:

VCF::Component VCF::ObjectWithCallbacks VCF::Object List of all members.

Public Types

enum  DocumentEvents { deSaved = Model::MODEL_LAST_EVENT + 100, deOpened }

Public Member Functions

DocumentChanged Document ()
 the document's constructor
virtual ~Document ()
virtual void empty ()
 empties the model
void addView (View *view)
void updateAllViews ()
void modelChanged (ModelEvent *e)
bool isModified ()
 tells is the document has been modified since the last time it has been saved
void setModified (bool val)
 sets the modification flag for the document.
virtual String getTitle () const
 gets the basename associated to the document in the file system.
virtual void setTitle (const String &name)
 sets the basename to be associated to the document.
String getFileName ()
 gets the full filename associated to the document in the file system.
void setFileName (const String &fileName)
 sets the full filename associated to the document in the file system.
WindowgetWindow ()
 gets the window associated to the document.
void setWindow (Window *val)
 sets the window to be associated to the document.
ModelgetModel ()
void setModel (Model *val)
virtual void initNew ()
 callback function called by the document manager framework as soon as a new document has been successfully created.
virtual bool saveAsType (const String &fileName, const String &fileType)
 saves the document as a specified type of file with a name that could be different than the current name for the document.
virtual bool saveAsType (const MIMEType &fileType, OutputStream &stream)
 saves the document as a specified type of file.
virtual bool openFromType (const String &fileName, const MIMEType &fileType)
 this actually opens/loads the file associated to the document.
virtual bool openFromType (const MIMEType &fileType, InputStream &stream)
 opens the document from an input stream.
bool getKeepsBackUpFile ()
 tells if we keep a backup copy of the file when saving the document.
void setKeepsBackUpFile (const bool &val)
 sets the flag stating that we want to keep a backup copy of the file when saving the document.
virtual bool canCutFromDocument ()
 tells if we can perform a cut operation on the document.
virtual bool canCopyFromDocument ()
 tells if we can perform a copy operation on the document.
virtual bool canPasteToDocument ()
 tells if we can perform a paste operation on the document.
virtual DataObjectcut ()
 performs a cut operation on the document and returns the cut object.
virtual DataObjectcopy ()
 performs a copy operation on the document and returns the copied object.
virtual bool paste (DataObject *data)
 performs a past operation on the document.
Enumerator< MIMEType > * getSupportedClipboardFormats ()
 gets the enumerator of the clip formats supported by the document.
void addSupportedClipboardFormat (const MIMEType &type)
 adds a clip format to the list of supported formats.

Public Attributes

VCF::Delegate DocumentDelegate

Protected Member Functions

void internalModelChanged (Event *)

Protected Attributes

WindowdocWindow_
FilePath fileName_
bool modified_
bool keepBackUpFile_
Array< MIMETypeclipFormats_

Detailed Description

A document is a component that interacts with a valid model instance and has many extra features like saving, loading, cutting no implemented within the scope of a model.


Member Enumeration Documentation

enum VCF::Document::DocumentEvents
 

Enumerator:
deSaved 
deOpened 


Constructor & Destructor Documentation

DocumentChanged VCF::Document::Document  ) 
 

the document's constructor

virtual VCF::Document::~Document  )  [virtual]
 


Member Function Documentation

void VCF::Document::addSupportedClipboardFormat const MIMEType type  )  [inline]
 

adds a clip format to the list of supported formats.

Parameters:
String,the string identifying the clip format to be added.

void VCF::Document::addView View view  ) 
 

virtual bool VCF::Document::canCopyFromDocument  )  [inline, virtual]
 

tells if we can perform a copy operation on the document.

By default a document has not thisoperation enabled.

Returns:
bool returns true if it does, false if it doesn't

virtual bool VCF::Document::canCutFromDocument  )  [inline, virtual]
 

tells if we can perform a cut operation on the document.

By default a document has not thisoperation enabled.

Returns:
bool returns true if it does, false if it doesn't

virtual bool VCF::Document::canPasteToDocument  )  [virtual]
 

tells if we can perform a paste operation on the document.

By default a document has not thisoperation enabled.

Returns:
bool returns true if it does, false if it doesn't

virtual DataObject* VCF::Document::copy  )  [virtual]
 

performs a copy operation on the document and returns the copied object.

Returns:
DataObject*, a pointer to the data that has been copied.

virtual DataObject* VCF::Document::cut  )  [inline, virtual]
 

performs a cut operation on the document and returns the cut object.

Returns:
DataObject*, a pointer to the data that has been cut.

virtual void VCF::Document::empty  )  [virtual]
 

empties the model

String VCF::Document::getFileName  )  [inline]
 

gets the full filename associated to the document in the file system.

Returns:
String, the filename.

bool VCF::Document::getKeepsBackUpFile  )  [inline]
 

tells if we keep a backup copy of the file when saving the document.

Returns:
bool, true if we keep a backup copy of the document.

Model* VCF::Document::getModel  ) 
 

Enumerator<MIMEType>* VCF::Document::getSupportedClipboardFormats  )  [inline]
 

gets the enumerator of the clip formats supported by the document.

This document will be able to cut & paste data from the clipboard of the OS only for these specified formats.

Returns:
Enumerator<String>*, the enumerator.

virtual String VCF::Document::getTitle  )  const [inline, virtual]
 

gets the basename associated to the document in the file system.

This is the name of the file without its path component

Returns:
String, the filename.

Window* VCF::Document::getWindow  )  [inline]
 

gets the window associated to the document.

Returns:
Window*, the pointer to the associated window.

virtual void VCF::Document::initNew  )  [inline, virtual]
 

callback function called by the document manager framework as soon as a new document has been successfully created.

Override this to initializations specific of your document.

void VCF::Document::internalModelChanged Event  )  [inline, protected]
 

bool VCF::Document::isModified  )  [inline]
 

tells is the document has been modified since the last time it has been saved

Returns:
bool returns true if it has been modified

void VCF::Document::modelChanged ModelEvent e  ) 
 

virtual bool VCF::Document::openFromType const MIMEType fileType,
InputStream stream
[virtual]
 

opens the document from an input stream.

The type of file has to be specified too, because this tells how to treat the stream.

Parameters:
const String& fileType, the type of file to be open as.
const InputStream& stream, the input stream.
Returns:
bool, true if the file has been succesfully opened.

virtual bool VCF::Document::openFromType const String fileName,
const MIMEType fileType
[virtual]
 

this actually opens/loads the file associated to the document.

It calls a custom function specific to the document that appropriately opens and manages the file.

Parameters:
const String& fileName, the filename to open.
const String& fileType, the type of file to be open as.
Returns:
bool, true if the file has been succesfully opened.
fire event:: ModelChanged.
event type: Document::deOpened.

virtual bool VCF::Document::paste DataObject data  )  [inline, virtual]
 

performs a past operation on the document.

Parameters:
DataObject*,a pointer to the data to paste.
Returns:
bool, true if the operation has been performed successfully.

virtual bool VCF::Document::saveAsType const MIMEType fileType,
OutputStream stream
[virtual]
 

saves the document as a specified type of file.

The output stream is also specified.

Parameters:
const String& fileType, the type of file to be saved as.
OutputStream& stream, the output stream to be saved into.
Returns:
bool, true if the file has been succesfully saved.

virtual bool VCF::Document::saveAsType const String fileName,
const String fileType
[virtual]
 

saves the document as a specified type of file with a name that could be different than the current name for the document.

We may need to save the document as a different type without renaming this document, so it is let to the user to call setFileName() first if he needs.

Parameters:
const String& fileName, the filename to be saved as.
const String& fileType, the type of file to be saved as.
Returns:
bool, true if the file has been succesfully saved.

void VCF::Document::setFileName const String fileName  )  [inline]
 

sets the full filename associated to the document in the file system.

Parameters:
const String&, the filename.

void VCF::Document::setKeepsBackUpFile const bool &  val  )  [inline]
 

sets the flag stating that we want to keep a backup copy of the file when saving the document.

Parameters:
bool,true if we want to keep a backup copy of the document.

void VCF::Document::setModel Model val  ) 
 

void VCF::Document::setModified bool  val  )  [inline]
 

sets the modification flag for the document.

Parameters:
bool true, to set the document as modified.

virtual void VCF::Document::setTitle const String name  )  [inline, virtual]
 

sets the basename to be associated to the document.

This is the name of the file without its path component. The full filename, which is accordingly updated, keeps the same path component of the previous filename.

Parameters:
String,the filename.

void VCF::Document::setWindow Window val  )  [inline]
 

sets the window to be associated to the document.

Parameters:
Window*,the pointer to window to be associated.

void VCF::Document::updateAllViews  ) 
 


Member Data Documentation

Array<MIMEType> VCF::Document::clipFormats_ [protected]
 

VCF::Delegate VCF::Document::DocumentDelegate
 

Window* VCF::Document::docWindow_ [protected]
 

FilePath VCF::Document::fileName_ [protected]
 

bool VCF::Document::keepBackUpFile_ [protected]
 

bool VCF::Document::modified_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information