Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Types | Friends
AEDocumentClass Class Reference

#include <nsAEDocumentClass.h>

Inheritance diagram for AEDocumentClass:
Inheritance graph
[legend]
Collaboration diagram for AEDocumentClass:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void ProcessFormRelativePostition (const AEDesc *anchorToken, const AEDesc *keyData, DocumentReference *document)
void CloseWindowSaving (AEDesc *token, const AEDesc *saving, AEDesc *savingIn)
void DispatchEvent (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)

Static Public Member Functions

static pascal OSErr DocumentAccessor (DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *resultToken, long refCon)
static pascal OSErr PropertyAccessor (DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *resultToken, long refCon)
static long CountDocuments ()
static pascal OSErr ItemFromContainerAccessor (DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *resultToken, long refCon)

Protected Types

enum  { kAEExtract = 'Extr', kExtractKeyDestFolder = 'Fold', kAESendMessage = 'Post' }

Protected Member Functions

 AEDocumentClass ()
 ~AEDocumentClass ()
void GetDocumentFromApp (DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *resultToken)
virtual void GetItemFromContainer (DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *resultToken)
virtual void GetDataFromObject (const AEDesc *token, AEDesc *desiredTypes, AEDesc *data)
void GetDataFromList (AEDesc *srcList, AEDesc *desiredTypes, AEDesc *dstList)
virtual void SetDataForObject (const AEDesc *token, AEDesc *data)
void SetDataForList (const AEDesc *token, AEDesc *data)
virtual void CreateSelfSpecifier (const AEDesc *token, AEDesc *outSpecifier)
virtual Boolean CanSetProperty (DescType propertyCode)
virtual Boolean CanGetProperty (DescType propertyCode)
void SetDocumentProperties (DocumentReference document, AEDesc *propertyRecord)
DocumentReference GetDocumentReferenceFromToken (const AEDesc *token)
DocumentReference GetDocumentByName (ConstStr255Param docName)
DocumentReference GetDocumentByIndex (long index)
DocumentReference GetDocumentByID (long docID)
DocumentReference GetNextDocument (DocumentReference docRef)
DocumentReference GetPreviousDocument (DocumentReference docRef)
virtual void GetPropertyFromObject (DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *resultToken)
virtual void GetProperty (DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *resultToken)
virtual void CompareObjects (DescType comparisonOperator, const AEDesc *object, const AEDesc *descriptorOrObject, Boolean *result)
virtual void CountObjects (DescType desiredType, DescType containerClass, const AEDesc *container, long *result)
virtual void HandleClose (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleCount (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleSetData (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleGetData (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleDataSize (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleDelete (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleDuplicate (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleExists (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleMake (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleMove (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleOpen (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleReOpen (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleRun (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandlePrint (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleQuit (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleSave (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleExtract (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleSendMessage (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
void CreateSpecifier (const AEDesc *token, AEDesc *outSpecifier)
virtual void GetContainerSpecifier (const AEDesc *token, AEDesc *outContainerSpecifier)
void GetDataFromListOrObject (const AEDesc *tokenOrTokenList, AEDesc *desiredTypes, AEDesc *data)
void SetDataForListOrObject (const AEDesc *tokenOrTokenList, const AppleEvent *appleEvent, AppleEvent *reply)
void GetDataFromList (const AEDesc *srcList, AEDesc *desiredTypes, AEDesc *dstList)
void GetPropertyFromListOrObject (DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *resultToken)
void GetPropertyFromList (DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *resultToken)
virtual DescType GetKeyEventDataAs (DescType propertyCode)
DescType GetClass ()
virtual void MakeNewObject (const DescType insertionPosition, const AEDesc *token, const AEDesc *ptrToWithData, const AEDesc *ptrToWithProperties, AppleEvent *reply)

Protected Attributes

DescType mClass
DescType mContainerClass
OSLAccessorUPP mItemFromContainerAccessor

Private Types

typedef AEGenericClass Inherited

Friends

class AECoreClass

Detailed Description

Definition at line 49 of file nsAEDocumentClass.h.


Member Typedef Documentation

Definition at line 54 of file nsAEDocumentClass.h.


Member Enumeration Documentation

anonymous enum [protected, inherited]
Enumerator:
kAEExtract 
kExtractKeyDestFolder 
kAESendMessage 

Definition at line 78 of file nsAEGenericClass.h.

            {
              kAEExtract                  = 'Extr',
              kExtractKeyDestFolder       = 'Fold',
              
              kAESendMessage              = 'Post'
       };

Constructor & Destructor Documentation

Definition at line 51 of file nsAEDocumentClass.cpp.

:      AEGenericClass(cDocument, typeNull)
{
}

Definition at line 61 of file nsAEDocumentClass.cpp.

{
}

Member Function Documentation

Boolean AEDocumentClass::CanGetProperty ( DescType  propertyCode) [protected, virtual]

Implements AEGenericClass.

Definition at line 385 of file nsAEDocumentClass.cpp.

{
       Boolean       result = false;
       
       switch (property)
       {
              // Properties we can get:
              
              case pBestType:
              case pClass:
              case pDefaultType:
              case pObjectType:
              
              case pName:
              case pProperties:
              case pIsModified:
                     result = true;
                     break;
                     
              // Properties we can't get:
              default:
                     result = Inherited::CanGetProperty(property);
                     break;
       }

       return result;
}

Here is the call graph for this function:

Boolean AEDocumentClass::CanSetProperty ( DescType  propertyCode) [protected, virtual]

Implements AEGenericClass.

Definition at line 418 of file nsAEDocumentClass.cpp.

{
       Boolean       result = false;
       
       switch (property)
       {
              // Properties we can set:
              
              case pName:
                     result = true;
                     break;
                     
              // Properties we can't set:

              case pBestType:
              case pClass:
              case pDefaultType:
              case pObjectType:
              
              case pProperties:
              case pIsModified:
                     result = false;
                     break;
                     
              default:
                     result = Inherited::CanSetProperty(property);
                     break;
       }

       return result;
}

Here is the call graph for this function:

void AEDocumentClass::CloseWindowSaving ( AEDesc *  token,
const AEDesc *  saving,
AEDesc *  savingIn 
)

Definition at line 642 of file nsAEDocumentClass.cpp.

{
       OSErr                err                  = noErr;
       DocumentReference    document;

       document = GetDocumentReferenceFromToken(token);
       
       if (document != nil)
       {
              // DestroyDocument(document);
       }
       else
              err = errAEEventNotHandled;
       
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

void AEGenericClass::CompareObjects ( DescType  comparisonOperator,
const AEDesc *  object,
const AEDesc *  descriptorOrObject,
Boolean result 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass.

Definition at line 604 of file nsAEGenericClass.cpp.

{
       ThrowOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

Definition at line 573 of file nsAEDocumentClass.cpp.

{
       return 0;
}

Here is the caller graph for this function:

void AEGenericClass::CountObjects ( DescType  desiredType,
DescType  containerClass,
const AEDesc *  container,
long result 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, AEApplicationClass, and AEWordClass.

Definition at line 616 of file nsAEGenericClass.cpp.

{
       ThrowOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEDocumentClass::CreateSelfSpecifier ( const AEDesc *  token,
AEDesc *  outSpecifier 
) [protected, virtual]

Implements AEGenericClass.

Definition at line 665 of file nsAEDocumentClass.cpp.

{
       ThrowIfOSErr(errAENoSuchObject);
}
void AEGenericClass::CreateSpecifier ( const AEDesc *  token,
AEDesc *  outSpecifier 
) [protected, inherited]

Definition at line 840 of file nsAEGenericClass.cpp.

{
       CreateSelfSpecifier(token, outSpecifier);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::DispatchEvent ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [inherited]

Definition at line 97 of file nsAEGenericClass.cpp.

{
       OSErr         err = noErr;
       
       AEEventID            eventID;
       OSType        typeCode;
       Size                 actualSize    = 0L;
       
       // Get the event ID
       err = AEGetAttributePtr(appleEvent,       keyEventIDAttr, 
                                                               typeType, 
                                                               &typeCode, 
                                                               (Ptr)&eventID, 
                                                               sizeof(eventID), 
                                                               &actualSize);
       ThrowIfOSErr(err);
       
       try
       {
              switch (eventID)
              {
                     case kAEClone:
                            HandleDuplicate(token, appleEvent, reply);
                            break;
                            
                     case kAEClose:
                            HandleClose(token, appleEvent, reply);
                            break;
                            
                     case kAECountElements:
                            HandleCount(token, appleEvent, reply);
                            break;
                            
                     case kAECreateElement:
                            HandleMake(token, appleEvent, reply);
                            break;
                            
                     case kAEDelete:
                            HandleDelete(token, appleEvent, reply);
                            break;
                            
                     case kAEDoObjectsExist:
                            HandleExists(token, appleEvent, reply);
                            break;
                            
                     case kAEGetData:
                            HandleGetData(token, appleEvent, reply);
                            break;
                            
                     case kAEGetDataSize:
                            HandleDataSize(token, appleEvent, reply);
                            break;
                            
                     case kAEMove:
                            HandleMove(token, appleEvent, reply);
                            break;
                            
                     case kAEOpen:        // == kAEOpenDocuments
                            HandleOpen(token, appleEvent, reply);
                            break;
                            
                     case kAEPrint:
                            HandlePrint(token, appleEvent, reply);
                            break;
                     
                     case kAEOpenApplication:
                            HandleRun(token, appleEvent, reply);
                            break;
                     
                     case kAEReopenApplication:
                       HandleReOpen(token, appleEvent, reply);
                       break; 
                                                 
                     case kAEQuitApplication:
                            HandleQuit(token, appleEvent, reply);
                            break;
                            
                     case kAESave:
                            HandleSave(token, appleEvent, reply);
                            break;
                            
                     case kAESetData:
                            HandleSetData(token, appleEvent, reply);
                            break;

                     // MT-NW suite
                     case kAEExtract:
                            HandleExtract(token, appleEvent, reply);
                            break;
                            
                     case kAESendMessage:
                            HandleSendMessage(token, appleEvent, reply);
                            break;
                            
                     default:
                            err = errAEEventNotHandled;
                            break;
              }
       }
       catch (OSErr catchErr)
       {
              PutReplyErrorNumber(reply, catchErr);
              throw;
       }
       catch ( ... )
       {
              PutReplyErrorNumber(reply, paramErr);
              throw;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

pascal OSErr AEDocumentClass::DocumentAccessor ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken,
long  refCon 
) [static]

Definition at line 287 of file nsAEDocumentClass.cpp.

{
       AEDocumentClass*            docClass = reinterpret_cast<AEDocumentClass *>(refCon);
       if (!docClass) return paramErr;
       
       OSErr         err = noErr;
       
       try
       {
              docClass->GetDocumentFromApp(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
       }
       catch(OSErr catchErr)
       {
              err = catchErr;
       }
       catch(...)
       {
              err = paramErr;
       }
       
       return err;
}

Here is the call graph for this function:

DescType AEGenericClass::GetClass ( ) [inline, protected, inherited]

Definition at line 193 of file nsAEGenericClass.h.

{ return mClass; }

Here is the caller graph for this function:

void AEGenericClass::GetContainerSpecifier ( const AEDesc *  token,
AEDesc *  outContainerSpecifier 
) [protected, virtual, inherited]

Definition at line 849 of file nsAEGenericClass.cpp.

{
       outContainerSpecifier->descriptorType = typeNull;
       outContainerSpecifier->dataHandle = nil;
       
       AEDispatchHandler*   handler = AECoreClass::GetDispatchHandlerForClass(mContainerClass);
       if (handler)
       {
              handler->CreateSelfSpecifier(token, outContainerSpecifier);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEDocumentClass::GetDataFromList ( AEDesc *  srcList,
AEDesc *  desiredTypes,
AEDesc *  dstList 
) [protected]
void AEGenericClass::GetDataFromList ( const AEDesc *  srcList,
AEDesc *  desiredTypes,
AEDesc *  dstList 
) [protected, inherited]

Definition at line 692 of file nsAEGenericClass.cpp.

{
       OSErr         err;
       long                 itemNum;
       long                 numItems;
       DescType             keyword;
       StAEDesc             srcItem;
       StAEDesc             dstItem;
              
       err = AECountItems((AEDescList*)srcList, &numItems);
       ThrowIfOSErr(err);
              
       for (itemNum = 1; itemNum <= numItems; itemNum++)
       {
              err = AEGetNthDesc(srcList, itemNum, typeWildCard, &keyword, &srcItem);
              ThrowIfOSErr(err);
              
              if (AEListUtils::TokenContainsTokenList(&srcItem) == false)
              {
                     GetDataFromObject(&srcItem, desiredTypes, &dstItem);  // Get data from single item
              }
              else
              {
                     ThrowIfOSErr(AECreateList(nil, 0, false, &dstItem));
                     GetDataFromList(&srcItem, desiredTypes, &dstItem);
              }
              err = AEPutDesc(dstList, itemNum, &dstItem);
              ThrowIfOSErr(err);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::GetDataFromListOrObject ( const AEDesc *  tokenOrTokenList,
AEDesc *  desiredTypes,
AEDesc *  data 
) [protected, inherited]

Definition at line 632 of file nsAEGenericClass.cpp.

{
       if (AEListUtils::TokenContainsTokenList(tokenOrTokenList) == false)
       {
              GetDataFromObject(tokenOrTokenList, desiredTypes, data);
       }
       else
       {
              ThrowIfOSErr(AECreateList(nil, 0, false, data));
              GetDataFromList(tokenOrTokenList, desiredTypes, data);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEDocumentClass::GetDataFromObject ( const AEDesc *  token,
AEDesc *  desiredTypes,
AEDesc *  data 
) [protected, virtual]

Implements AEGenericClass.

Definition at line 458 of file nsAEDocumentClass.cpp.

{
       OSErr                err                         = noErr;
       Boolean                     usePropertyCode      = false;      
       DocumentReference    document                    = nil;
       ConstAETokenDesc            tokenDesc(token);
       DescType                    aType                = cDocument;
       Str63                documentName;
       Boolean                     isModified;
       
       // ugh
       document = GetDocumentReferenceFromToken(token);
       ThrowIfOSErr(err);
       if (document == nil)
              ThrowIfOSErr(paramErr);

       GetDocumentName(document, documentName);                                     
       isModified = DocumentIsModified(document);                                          

       usePropertyCode = tokenDesc.UsePropertyCode();
       
       DescType propertyCode = tokenDesc.GetPropertyCode();
       
       switch (propertyCode)
       {
              case pProperties:
                     err = AECreateList(NULL, 0L, true, data);
                     ThrowIfOSErr(err);

                     err = AEPutKeyPtr(data, pObjectType,      typeType,     &aType,                     sizeof(DescType));
                     err = AEPutKeyPtr(data, pName,            typeChar,     &documentName[1],    documentName[0]);
                     err = AEPutKeyPtr(data, pIsModified,      typeBoolean,  &isModified,         sizeof(Boolean));
                     break;
                     
              case pBestType:
              case pClass:
              case pDefaultType:
              case pObjectType:
                     err = AECreateDesc(typeType, &aType, sizeof(DescType), data);
                     break;
                     
              case pName:
                     err = AECreateDesc(typeChar, &documentName[1], documentName[0], data);
                     break;
                     
              case pIsModified:
                     err = AECreateDesc(typeBoolean, &isModified, sizeof(Boolean), data);
                     break;
                     
              default:
                     Inherited::GetDataFromObject(token, desiredTypes, data);
                     break;
       }
       
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

Definition at line 601 of file nsAEDocumentClass.cpp.

{
       return nil;
}

Here is the caller graph for this function:

Definition at line 592 of file nsAEDocumentClass.cpp.

{
       return nil;
}

Here is the caller graph for this function:

DocumentReference AEDocumentClass::GetDocumentByName ( ConstStr255Param  docName) [protected]

Definition at line 583 of file nsAEDocumentClass.cpp.

{
       return nil;
}

Here is the caller graph for this function:

void AEDocumentClass::GetDocumentFromApp ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken 
) [protected]

Definition at line 119 of file nsAEDocumentClass.cpp.

{
       OSErr                       err                  = noErr;
       DescType                           keyDataType   = keyData->descriptorType;
       long                               index;
       long                               numItems;
       Boolean                            wantsAllItems = false;
       StAEDesc                           startObject;  // These are used to resolve formRange
       StAEDesc                           stopObject;
       DocumentReference           document;
       Str63                       documentName;
       CoreTokenRecord             token;
       
       numItems = CountDocuments();

       switch (keyForm) 
       {
              case formName:                                                                             // Document by name
                     {
                            if (DescToPString(keyData, documentName, 63) != noErr)
                            {
                                   err = errAECoercionFail;
                            }
                            else
                            {
                                   document = GetDocumentByName(documentName);
                                   if (document == nil)
                                          err = errAENoSuchObject;
                            }
                     }
                     break;
              
              case formAbsolutePosition:                                                          // Document by number
                     err = NormalizeAbsoluteIndex(keyData, &index, numItems, &wantsAllItems);
                     if ((err == noErr) && (wantsAllItems == false))
                     {
                            document = GetDocumentByIndex(index);
                            if (document == nil)
                                   err = errAEIllegalIndex;
                     }
                     break; 
              
              case formRelativePosition:
                     ProcessFormRelativePostition(containerToken, keyData, &document);
                     break; 
              
              case formRange:
                     switch (keyDataType)
                     {             
                            case typeRangeDescriptor:
                                   err = ProcessFormRange((AEDesc *)keyData, &startObject, &stopObject);
                                   if (err == noErr)
                                   {
                                          ConstAETokenDesc     startTokenDesc(&startObject);
                                          ConstAETokenDesc     stopTokenDesc(&startObject);
                                          
                                          DescType startType = startTokenDesc.GetDispatchClass();
                                          DescType stopType  = stopTokenDesc.GetDispatchClass();
        
                                          if (startType != cDocument || stopType != cDocument)
                                                 err = errAEWrongDataType;
                                   }
                                   break;

                            default:
                                   err = errAEWrongDataType;
                                   break; 
                     }
                     break; 

              default:
                     err = errAEEventNotHandled;
                     break;
       }
       
       // if user asked for all items, and there aren't any,
       // we'll be kind and return an empty list.

       if (wantsAllItems && (err == errAENoSuchObject || err == errAEIllegalIndex))
       {
              err = AECreateList(NULL, 0, false, (AEDescList*)resultToken);
              ThrowIfOSErr(err);
              return;
       }

       ThrowIfOSErr(err);
       
       // fill in the result token

       token.dispatchClass         = GetClass();
       token.objectClass    = GetClass();
       token.propertyCode   = typeNull;

       if (wantsAllItems)
       {                                         
              err = AECreateList(NULL, 0, false, (AEDescList*)resultToken);
              
              if (err == noErr)
              {
                     for (index = 1; index <= numItems; index++)
                     {
                            document = GetDocumentByIndex(index);
                            ThrowIfOSErr(errAEEventNotHandled);
                            
                            token.documentID = GetDocumentID(document);
                            
                            err = AEPutPtr(resultToken, 0, desiredClass, &token, sizeof(token));
                            ThrowIfOSErr(err);
                     }
              }
       }
       else if (keyForm == formRange)
       {                    
              DocumentReference    beginDocument;
              DocumentReference    endDocument;
              long                        beginIndex;
              long                        endIndex;
              
              beginDocument = GetDocumentReferenceFromToken(&startObject);
              beginIndex = GetDocumentIndex(beginDocument);

              endDocument = GetDocumentReferenceFromToken(&stopObject);
              endIndex = GetDocumentIndex(endDocument);
                                                        
              err = AECreateList(NULL, 0, false, (AEDescList*)resultToken);
              ThrowIfOSErr(err);
                     
              if (beginIndex > endIndex) // swap elements
              {
                     DocumentReference temp;
                     temp                 = beginDocument;
                     beginDocument = endDocument;
                     endDocument   = temp;
              }
              
              document = beginDocument;
              while (document != nil)
              {
                     token.documentID = GetDocumentID(document);
                     
                     err = AEPutPtr(resultToken, 0, desiredClass, &token, sizeof(token));
                     ThrowIfOSErr(err);

                     if (document == endDocument)
                            break;
                     document = GetNextDocument(document);
              }
       }
       else
       {
              token.documentID = GetDocumentID(document);
              err = AECreateDesc(desiredClass, &token, sizeof(token), resultToken);
       }

       ThrowIfOSErr(err);          
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 630 of file nsAEDocumentClass.cpp.

{
       ConstAETokenDesc     tokenDesc(token);
       long                 docID = tokenDesc.GetDocumentID();
       
       return GetDocumentByID(docID);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEDocumentClass::GetItemFromContainer ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken 
) [protected, virtual]

Implements AEGenericClass.

Definition at line 105 of file nsAEDocumentClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}
DescType AEGenericClass::GetKeyEventDataAs ( DescType  propertyCode) [protected, virtual, inherited]

Reimplemented in AEApplicationClass.

Definition at line 799 of file nsAEGenericClass.cpp.

{
       return typeWildCard;
}

Here is the caller graph for this function:

Definition at line 610 of file nsAEDocumentClass.cpp.

{
       return nil;
}

Here is the caller graph for this function:

Definition at line 620 of file nsAEDocumentClass.cpp.

{
       return nil;
}

Here is the caller graph for this function:

void AEGenericClass::GetProperty ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken 
) [protected, virtual, inherited]

Reimplemented in AEApplicationClass.

Definition at line 213 of file nsAEGenericClass.cpp.

{
       
       // call the base class utility method, which calls back up to the object
       GetPropertyFromListOrObject(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::GetPropertyFromList ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken 
) [protected, inherited]

Definition at line 892 of file nsAEGenericClass.cpp.

{
       OSErr         err           = noErr;
       long                 itemNum;
       long                 numItems;
       DescType             keyword;
       
       err = AECountItems((AEDescList*)containerToken, &numItems);
       ThrowIfOSErr(err);
              
       for (itemNum = 1; itemNum <= numItems; itemNum++)
       {
              StAEDesc             srcItem;
              StAEDesc             dstItem;
              
              err = AEGetNthDesc(containerToken, itemNum, typeWildCard, &keyword, &srcItem);
              ThrowIfOSErr(err);
              
              if (AEListUtils::TokenContainsTokenList(&srcItem) == false)
              {
                     GetPropertyFromObject(desiredClass, &srcItem, containerClass, keyForm, keyData, &dstItem);
              }
              else
              {
                     err = AECreateList(nil, 0, false, &dstItem);
                     ThrowIfOSErr(err);
                     
                     GetPropertyFromList(desiredClass, &srcItem, containerClass, keyForm, keyData, &dstItem);
              }

              err = AEPutDesc(resultToken, itemNum, &dstItem);
              ThrowIfOSErr(err);
       }
       
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::GetPropertyFromListOrObject ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken 
) [protected, inherited]

Definition at line 867 of file nsAEGenericClass.cpp.

{
       if (AEListUtils::TokenContainsTokenList((AEDescList*)containerToken) == false)
       {
              GetPropertyFromObject(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
       }
       else
       {
              OSErr  err = AECreateList(nil, 0, false, resultToken);
              ThrowIfOSErr(err);
              
              GetPropertyFromList(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::GetPropertyFromObject ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken 
) [protected, virtual, inherited]

Definition at line 938 of file nsAEGenericClass.cpp.

{
       OSErr                err;   
       DescType                    requestedProperty;

       err = AEDuplicateDesc(containerToken, resultToken);
       ThrowIfOSErr(err);
              
       requestedProperty = **(DescType**)(keyData->dataHandle);
       
       if (requestedProperty == kAEAll || requestedProperty == keyAEProperties)
              requestedProperty = pProperties;

       if (CanGetProperty(requestedProperty) || CanSetProperty(requestedProperty))
       {
              AETokenDesc          resultTokenDesc(resultToken);
              resultToken->descriptorType = desiredType;
              resultTokenDesc.SetPropertyCode(requestedProperty);
       }
       else
       {
              ThrowIfOSErr(errAEEventNotHandled);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::HandleClose ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 269 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleCount ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEApplicationClass.

Definition at line 278 of file nsAEGenericClass.cpp.

{
       ConstAETokenDesc     tokenDesc(token);
       long                 numberOfObjects = 0;
       DescType             objectClass;
       OSErr         err = noErr;  

       if (!reply->dataHandle)
              return;
       
       // Get the class of object that we will count
       err = GetObjectClassFromAppleEvent(appleEvent, &objectClass);
       ThrowIfOSErr(err);
       
       err = CheckForUnusedParameters(appleEvent);
       ThrowIfOSErr(err);

       if (AEListUtils::TokenContainsTokenList(token))
       {
              err = AECountItems(token, &numberOfObjects);
              ThrowIfOSErr(err);
              
       }
       else
       {
              CountObjects(objectClass, tokenDesc.GetDispatchClass(), token, &numberOfObjects);
       }

       err = AEPutParamPtr(reply, keyAEResult, 
                                                         typeLongInteger, 
                                                         (Ptr)&numberOfObjects, 
                                                         sizeof(long));
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::HandleDataSize ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 349 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleDelete ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 361 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleDuplicate ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 370 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleExists ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 384 of file nsAEGenericClass.cpp.

{
       OSErr  err;
       Boolean       foundIt       = true;

       err = AEPutParamPtr(reply, 
                                    keyAEResult, 
                                    typeBoolean, 
                                    (Ptr)&foundIt, 
                                    sizeof(Boolean));
              
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::HandleExtract ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Definition at line 581 of file nsAEGenericClass.cpp.

{
       ThrowOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleGetData ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Definition at line 318 of file nsAEGenericClass.cpp.

{
       OSErr         err                  = noErr;      
       StAEDesc             data;
       StAEDesc             desiredTypes;
       
       (void)AEGetParamDesc(appleEvent, keyAERequestedType, typeAEList, &desiredTypes);
       
       GetDataFromListOrObject(tokenOrTokenList, &desiredTypes, &data);

       if (reply->descriptorType != typeNull)
       {
              err = AEPutKeyDesc(reply, keyDirectObject, &data);
              ThrowIfOSErr(err);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::HandleMake ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 403 of file nsAEGenericClass.cpp.

{
       DescType             insertionPos  = typeNull;
       OSErr         err                  = noErr;

       StAEDesc             insertionLoc;
       StAEDesc             objectSpec;

       // For Create Element, the object specifier is contained in  
       // a typeInsertionLoc record instead of in a direct parameter. 
       // We coerce the insertionLoc record into an AERecord so we can extract the fields.  
       // Notice that this is a REQUIRED parameter, but we give it a default behavior
       // by creating a new element at beginning of the first document
       
       err = ::AEGetParamDesc(appleEvent,                             // Extract as a AERecord
                                                          keyAEInsertHere, 
                                                          typeAERecord, 
                                                          &insertionLoc);
       if (err == errAEDescNotFound)
       {
              insertionPos  = kAEBeginning;
              err                  = noErr;
       }
       else if (err == noErr)
       {
              // Get the enumerated insertion location (at end, in front, before, after, replace.)
              
              OSType        typeCode;
              Size                 actualSize;
              err = ::AEGetKeyPtr(&insertionLoc, 
                                                               keyAEPosition,                     // insertion location
                                                               typeEnumeration, 
                                                               &typeCode, 
                                                               (Ptr)&insertionPos,
                                                               sizeof(insertionPos), 
                                                               &actualSize);

              // Extract and resolve the object specifier from the insertion location record.
              // In a case like "make new rectangle before rectangle 1 of document 1",
              // the ospec will resolve to "rectangle 1 of document 1"
                             
              err = ::AEGetKeyDesc(&insertionLoc, 
                                                               keyAEObject, 
                                                               typeWildCard, 
                                                               &objectSpec);
       }

       // if there was a object specifier in the insertion location (eg, "before rectangle 1 of document 1"),
       //   then we call AEResolve() to get a token for it,
       // Otherwise, is was something like "at end" or "at beginning", which is also OK, 
       //   then deal with it correctly later.
       if (objectSpec.descriptorType == typeNull) 
       {
              ::AEDisposeDesc(token);                   // destroy it's old representation, token will now be null descriptor
       }
       else
       {
              err = ::AEResolve(&objectSpec, 
                                                  kAEIDoMinimum, 
                                                  token);                    // token will contain info about the object to insert before, after, etc.
              ThrowIfOSErr(err);
       }
              
       // Extract the optional parameters from the AppleEvent
       
       // ----- [with data ....] -----
       
       StAEDesc             withData;
       const AEDesc* withDataPtr = nil;
       
       err = ::AEGetParamDesc(appleEvent, 
                                                          keyAEData,
                                                          typeWildCard,
                                                          &withData);
       if (err == errAEDescNotFound)
              err = noErr;
       else
       {
              ThrowIfOSErr(err);
              withDataPtr = &withData;
       }

       // ----- [with properties {property: value, ...}] -----
       StAEDesc             withProperties;
       const AEDesc* withPropertiesPtr = nil;
       err = AEGetParamDesc(appleEvent, 
                                                          keyAEPropData, 
                                                          typeWildCard, 
                                                          &withProperties);
                                                          
       if (err == errAEDescNotFound)
              err = noErr;
       else
       {
              ThrowIfOSErr(err);
              withPropertiesPtr = &withProperties;
       }
       
       // Finally, use the token and other parameters to create & initialize the object
       MakeNewObject(insertionPos, token, withDataPtr, withPropertiesPtr, reply);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::HandleMove ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 510 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleOpen ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 520 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandlePrint ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 550 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleQuit ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 560 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleReOpen ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEApplicationClass.

Definition at line 530 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleRun ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEApplicationClass.

Definition at line 540 of file nsAEGenericClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleSave ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Reimplemented in AEWindowClass, and AEApplicationClass.

Definition at line 570 of file nsAEGenericClass.cpp.

{
       ThrowOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleSendMessage ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Definition at line 592 of file nsAEGenericClass.cpp.

{
       ThrowOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEGenericClass::HandleSetData ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual, inherited]

Definition at line 340 of file nsAEGenericClass.cpp.

{
       SetDataForListOrObject(token, appleEvent, reply);
}

Here is the call graph for this function:

Here is the caller graph for this function:

pascal OSErr AEGenericClass::ItemFromContainerAccessor ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken,
long  refCon 
) [static, inherited]

Definition at line 232 of file nsAEGenericClass.cpp.

{
       AEGenericClass*      itemClass = reinterpret_cast<AEGenericClass *>(refCon);
       if (!itemClass) return paramErr;
       
       OSErr         err = noErr;
       
       try
       {
              itemClass->GetItemFromContainer(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
       }
       catch(OSErr catchErr)
       {
              err = catchErr;
       }
       catch(...)
       {
              err = paramErr;
       }
       
       return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEGenericClass::MakeNewObject ( const DescType  insertionPosition,
const AEDesc *  token,
const AEDesc *  ptrToWithData,
const AEDesc *  ptrToWithProperties,
AppleEvent *  reply 
) [protected, virtual, inherited]

Definition at line 976 of file nsAEGenericClass.cpp.

{
       ThrowOSErr(errAEEventNotHandled);
}

Here is the caller graph for this function:

void AEDocumentClass::ProcessFormRelativePostition ( const AEDesc *  anchorToken,
const AEDesc *  keyData,
DocumentReference document 
)

Definition at line 325 of file nsAEDocumentClass.cpp.

{
       ConstAETokenDesc            tokenDesc(anchorToken);
       OSErr                err = noErr;
       DescType                    positionEnum;
       DocumentReference    anchorDocument;
       DocumentReference    relativeDocument = nil;
       
       *document = nil;
       
       anchorDocument = GetDocumentReferenceFromToken(anchorToken);

       if (err == noErr)
       {
       
              switch (keyData->descriptorType)
              {
                 case typeEnumerated:
                            if (DescToDescType((AEDesc*)keyData, &positionEnum) != noErr)
                            {
                                   err = errAECoercionFail;
                            }
                            else
                            {
                                   switch (positionEnum)
                                   {
                                          case kAENext:                                    // get the document behind the anchor
                                                 *document = GetPreviousDocument(anchorDocument);
                                                 if (*document == nil)
                                                        err = errAENoSuchObject;
                                                 break;
                                                 
                                          case kAEPrevious:                                // get the document in front of the anchor
                                                 *document = GetNextDocument(anchorDocument);
                                                 if (*document == nil)
                                                        err = errAENoSuchObject;
                                                 break;
                                                 
                                          default:
                                                 err = errAEEventNotHandled;
                                                 break;
                                   }
                            }
                            break;
                            
                     default:
                            err = errAECoercionFail;
                            break;
              }
       }
       
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

Here is the caller graph for this function:

pascal OSErr AEDocumentClass::PropertyAccessor ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken,
long  refCon 
) [static]

Definition at line 71 of file nsAEDocumentClass.cpp.

{
       AEDocumentClass*     docClass = reinterpret_cast<AEDocumentClass *>(refCon);
       if (!docClass) return paramErr;
       
       OSErr         err = noErr;
       
       try
       {
              docClass->GetProperty(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
       }
       catch(OSErr catchErr)
       {
              err = catchErr;
       }
       catch(...)
       {
              err = paramErr;
       }
       
       return err;
}

Here is the call graph for this function:

void AEDocumentClass::SetDataForList ( const AEDesc *  token,
AEDesc *  data 
) [protected]

Reimplemented from AEGenericClass.

void AEGenericClass::SetDataForListOrObject ( const AEDesc *  tokenOrTokenList,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, inherited]

Definition at line 651 of file nsAEGenericClass.cpp.

{
       StAEDesc                    data;
       
       switch (tokenOrTokenList->descriptorType)
       {
              case typeAEList:
                     {
                            AECoreClass::GetAECoreHandler()->GetEventKeyDataParameter(appleEvent, typeWildCard, &data);
                            SetDataForList(tokenOrTokenList, &data);
                     }
                     break;
                            
              case cProperty:
                     {
                            ConstAETokenDesc     tokenDesc(tokenOrTokenList);
                            DescType             propertyCode = tokenDesc.GetPropertyCode();
                            //DescType           objectClass    = tokenDesc.GetObjectClass();
                            
                            if (CanSetProperty(propertyCode))
                            {
                                   AECoreClass::GetAECoreHandler()->GetEventKeyDataParameter(appleEvent, GetKeyEventDataAs(propertyCode), &data);
                                   SetDataForObject(tokenOrTokenList, &data);
                            }
                            else
                            {
                                   ThrowIfOSErr(errAENotModifiable);
                            }
                     }
                     break;
                     
              default:
                     ThrowIfOSErr(errAENotModifiable);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void AEDocumentClass::SetDataForObject ( const AEDesc *  token,
AEDesc *  data 
) [protected, virtual]

Implements AEGenericClass.

Definition at line 519 of file nsAEDocumentClass.cpp.

{
       OSErr                       err = noErr;         
       Boolean                            usePropertyCode;
       DescType                           propertyCode;
       DocumentReference           document = nil;
       ConstAETokenDesc                   tokenDesc(token);
       StAEDesc                           propertyRecord;

       usePropertyCode = tokenDesc.UsePropertyCode();
       document = GetDocumentReferenceFromToken(token);
              
       if (usePropertyCode == false)
       {
              err = errAEWriteDenied;
       }
       else
       {
              propertyCode = tokenDesc.GetPropertyCode();
              
              if (data->descriptorType == typeAERecord)
              {             
                     SetDocumentProperties(document, data);
              }
              else   // Build a record with one property
              {
                     err = AECreateList(NULL, 0L, true, &propertyRecord);
                     ThrowIfOSErr(err);
                     
                     err = AEPutKeyDesc(&propertyRecord, propertyCode, data);
                     ThrowIfOSErr(err);
              
                     SetDocumentProperties(document, &propertyRecord);
              }
       }

       ThrowIfOSErr(err);
}

Here is the call graph for this function:

void AEDocumentClass::SetDocumentProperties ( DocumentReference  document,
AEDesc *  propertyRecord 
) [protected]

Definition at line 563 of file nsAEDocumentClass.cpp.

{

}

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class AECoreClass [friend]

Definition at line 51 of file nsAEDocumentClass.h.


Member Data Documentation

DescType AEGenericClass::mClass [protected, inherited]

Definition at line 209 of file nsAEGenericClass.h.

DescType AEGenericClass::mContainerClass [protected, inherited]

Definition at line 210 of file nsAEGenericClass.h.

OSLAccessorUPP AEGenericClass::mItemFromContainerAccessor [protected, inherited]

Definition at line 212 of file nsAEGenericClass.h.


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