VCOM:VectorWorks:ISDK::GetActiveDocument

From Vectorworks Developer
Jump to navigation Jump to search

.SDK|SDK ..SDK:Types|SDK Types ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

Description

namespace VectorWorks

Member of VCOM:VectorWorks:ISDK

Returns the path of the active VectorWorks document.

virtual bool VCOM_CALLTYPE GetActiveDocument(
IFileIdentifier** ppOutFileID,
bool& outSaved) = 0;

Parameters

ppOutFileID IFileIdentifier** Output parameter. Returns the file to the saved document, or if it is not yet saved, it returns the file name only!
outSaved bool& Output parameter. Return 'true' if the file document is already saved; 'false' if the document is modified and needs to be saved.

Return Value

The return value is false if there is no open document.

Remarks

ppOutFileID will contain the path to the correct file if the document is already saved (outSaved is true).

If the file is not saved ppOutFileID contains the name of the document. The file path is to application user folder but this file does not exist.

Example

IFileIdentifierPtr	pFile;

bool	bSaved	= false;
if ( gSDK->GetActiveDocument( & pFile, bSaved ) ) {
  if ( bSaved ) {
    // file is saved, so we get the full path to it
    TXString	fullPath;
    pFile->GetFileFullPath( fullPath );
  }
  else {
    // the file is not saved, so we get the name only
    TXString	name;
    pFile->GetFileName( name );
  }
}

Note! It is not very good to use full paths since this will give you OS dependant code.

Version

Availability: from Vectorworks 2009