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 model has many extra features like saving, loading, cutting and all that kind of stuff. More...

#include <vcf/ApplicationKit/Document.h>

Inheritance diagram for VCF::Document:

VCF::AbstractModel VCF::Model VCF::Component VCF::ObjectWithEvents VCF::Object List of all members.

Public Types

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

Public Member Functions

 Document ()
 the document's constructor
virtual void empty ()
 empties the model
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 getName ()
 gets the basename associated to the document in the file system.
virtual void setName (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.
virtual void initNew ()=0
 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 String &fileType, OutputStream &stream)
 saves the document as a specified type of file.
virtual bool openFromType (const String &fileName, const String &fileType)
 this actually opens/loads the file associated to the document.
virtual bool openFromType (const String &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< String > * getSupportedClipboardFormats ()
 gets the enumerator of the clip formats supported by the document.
void addSupportedClipboardFormat (const String &type)
 adds a clip format to the list of supported formats.

Protected Attributes

WindowdocWindow_
FilePath fileName_
bool modified_
bool keepBackUpFile_
std::vector< StringclipFormats_
EnumeratorContainer< std::vector<
String >, String
clipFormatContainer_

Detailed Description

A document is a model has many extra features like saving, loading, cutting and all that kind of stuff.


Member Enumeration Documentation

enum VCF::Document::DocumentEvents
 

Enumerator:
deSaved 
deOpened 


Constructor & Destructor Documentation

VCF::Document::Document  )  [inline]
 

the document's constructor


Member Function Documentation

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

adds a clip format to the list of supported formats.

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

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  )  [inline, 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  )  [inline, 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  )  [inline, virtual]
 

empties the model

Reimplemented from VCF::AbstractModel.

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.

virtual String VCF::Document::getName  )  [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.

Reimplemented from VCF::Component.

Enumerator<String>* 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.

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  )  [pure 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.

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

virtual bool VCF::Document::openFromType const String fileType,
InputStream stream
[inline, 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 String fileType
[inline, 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 String fileType,
OutputStream stream
[inline, 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
[inline, 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::setModified bool  val  )  [inline]
 

sets the modification flag for the document.

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

virtual void VCF::Document::setName 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.

Reimplemented from VCF::Component.

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.


Member Data Documentation

EnumeratorContainer<std::vector<String>,String> VCF::Document::clipFormatContainer_ [protected]
 

std::vector<String> VCF::Document::clipFormats_ [protected]
 

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