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
AEApplicationClass Class Reference

#include <nsAEApplicationClass.h>

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

List of all members.

Public Member Functions

void DispatchEvent (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)

Static Public Member Functions

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

 AEApplicationClass ()
 ~AEApplicationClass ()
virtual void GetProperty (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)
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 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 HandleRun (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleReOpen (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleOpen (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 CreateSelfSpecifier (const AEDesc *token, AEDesc *outSpecifier)
virtual void GetDataFromObject (const AEDesc *token, AEDesc *desiredTypes, AEDesc *data)
virtual void SetDataForObject (const AEDesc *token, AEDesc *data)
virtual Boolean CanSetProperty (DescType propertyCode)
virtual Boolean CanGetProperty (DescType propertyCode)
virtual DescType GetKeyEventDataAs (DescType propertyCode)
long CountApplicationObjects (const AEDesc *token, DescType desiredType)
virtual void GetPropertyFromObject (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 HandleSetData (AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
virtual void HandleGetData (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 SetDataForList (const AEDesc *token, AEDesc *data)
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)
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
class AEDocumentClass

Detailed Description

Definition at line 45 of file nsAEApplicationClass.h.


Member Typedef Documentation

Definition at line 51 of file nsAEApplicationClass.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 68 of file nsAEApplicationClass.cpp.

:      AEGenericClass(cApplication, typeNull)
{
}

Definition at line 77 of file nsAEApplicationClass.cpp.

{
}

Member Function Documentation

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

Implements AEGenericClass.

Definition at line 837 of file nsAEApplicationClass.cpp.

{
       Boolean result = false;
       
       switch (propertyCode)
       {
              // Properties we can get:

              case pBestType:
              case pClass:
              case pDefaultType:
              case pObjectType:
                     
              case pProperties:
              
              case pFreeMemory:
              case pLargestFreeBlock:
              case pTicks:

              case pIsFrontProcess:
              case pName:
              case pVersion:
              case pInsertionLoc:
              case pSelection:
              case pUserSelection:
                     result = true;
                     break;
                     
              // Properties we should be able to get, but they're not implemented yet:
                                   
              // Properties we should not be able to get:
              
              default:
                     result = Inherited::CanGetProperty(propertyCode);
                     break;
       }
       
       return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements AEGenericClass.

Definition at line 787 of file nsAEApplicationClass.cpp.

{
       Boolean result = false;
       
       switch (propertyCode)
       {
              // Properties we can set:
              
              case pClipboard:
                     result = true;
                     break;
                     
              // Properties we should be able to set, but they're not implemented yet:
              
                                   
              // Properties that are read-only

              case pBestType:
              case pClass:
              case pDefaultType:
              case pObjectType:
              
              case pProperties:
              
              case pFreeMemory:
              case pLargestFreeBlock:
              case pTicks:

              case pIsFrontProcess:
              case pName:
              case pVersion:
              case pInsertionLoc:
              case pSelection:
              case pUserSelection:
                     result = false;
                     break;
              
              default:
                     result = Inherited::CanSetProperty(propertyCode);
                     break;
       }
       
       return result;
}

Here is the call graph for this function:

Here is the caller 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:

long AEApplicationClass::CountApplicationObjects ( const AEDesc *  token,
DescType  desiredType 
) [protected]

Definition at line 896 of file nsAEApplicationClass.cpp.

{
       long          numberOfObjects = 0;
       OSErr  err = noErr;
       
       if (AEListUtils::TokenContainsTokenList(token))
       {
              err = AECountItems(token, &numberOfObjects);
       }
       else
       {
              AEDispatchHandler*   countHandler = AECoreClass::sAECoreHandler->GetDispatchHandler(desiredType);
              if (countHandler == nil)
                     ThrowOSErr(errAEEventNotHandled);
              
              countHandler->CountObjects(desiredType, typeNull, token, &numberOfObjects);
              /*
              switch (desiredType)
              {
                     case cDocument:
                            numberOfObjects = AEDocumentClass::CountDocuments();
                            break;

                     case cWindow:
                            numberOfObjects = AEWindowClass::CountWindows(kAnyWindowKind);
                            break;
                     
                     // application specific classes
                     case cGroupWindow:
                            numberOfObjects = AEWindowClass::CountWindows(kUserGroupWindowKind);
                            break;
                     
                     
                     default:
                            err = errAEEventNotHandled;
                            break;
              }
              */
       }

       ThrowIfOSErr(err);
       return numberOfObjects;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 530 of file nsAEApplicationClass.cpp.

{
       long          numberOfObjects = CountApplicationObjects(container, desiredType);
       *result = numberOfObjects;
}

Here is the call graph for this function:

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

Implements AEGenericClass.

Definition at line 884 of file nsAEApplicationClass.cpp.

{
       OSErr  err = ::AECreateDesc(typeNull, nil, 0, outSpecifier);
       ThrowIfOSErr(err);
}
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:

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 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 AEApplicationClass::GetDataFromObject ( const AEDesc *  token,
AEDesc *  desiredTypes,
AEDesc *  data 
) [protected, virtual]

Implements AEGenericClass.

Definition at line 545 of file nsAEApplicationClass.cpp.

{
       OSErr                              err    = noErr;
       
       Str255                             applicationName = "\p";
       Str255                             versionString;
       
       ConstAETokenDesc                          tokenDesc(token);
       
       ProcessSerialNumber         applicationProcessNumber;
       ProcessInfoRec                            applicationInfo;
       FSSpec                             appFSSpec;

       Boolean                                   isFrontProcess              = true;       // еее !gInBackground;
       
       DescType                                  aDescType            = cApplication;
       
       long                                      documentNumber       = 0L;
       unsigned long                      elementNumber        = 0L;
              
       Boolean                                   usePropertyCode      = tokenDesc.UsePropertyCode();
       DescType                                  propertyCode;
       
       long                                      free;
       long                                      contiguous;
       unsigned long                             ticks;

       err = GetCurrentProcess(&applicationProcessNumber);     
       
       if (err == noErr)
       {
              applicationInfo.processInfoLength  = sizeof(ProcessInfoRec);
              applicationInfo.processName               = applicationName;
              applicationInfo.processAppSpec     = &appFSSpec;
              err = GetProcessInformation(&applicationProcessNumber, &applicationInfo);
       }
                            
       GetShortVersionString(2, versionString);
       PurgeSpace(&free, &contiguous);
                            
       ticks = TickCount();

       propertyCode = tokenDesc.GetPropertyCode();
       
       switch (propertyCode)
       {
              case pProperties:
                     err = AECreateList(nil, 0, true, data);
                     ThrowIfOSErr(err);

                     err = AEPutKeyPtr(data, pObjectType,             typeType,            &aDescType, sizeof(DescType));
                     err = AEPutKeyPtr(data, pName,                   typeChar,            &applicationName[1], applicationName[0]);
                     err = AEPutKeyPtr(data, pVersion,                typeChar,            &versionString[1], versionString[0]);
                     err = AEPutKeyPtr(data, pIsFrontProcess,  typeBoolean,         &isFrontProcess, sizeof(Boolean));
                     err = AEPutKeyPtr(data, pFreeMemory,             typeLongInteger,     &free, sizeof(long));
                     err = AEPutKeyPtr(data, pLargestFreeBlock,       typeLongInteger,     &contiguous, sizeof(long));
                     err = AEPutKeyPtr(data, pTicks,                  typeLongInteger,     &ticks, sizeof(long));
                     break;
                     
              case pBestType:
              case pClass:
              case pDefaultType:
              case pObjectType:
                     err = AECreateDesc(typeType, &aDescType, sizeof(DescType), data);
                     break;
                     
              case pName:   
                     err = AECreateDesc(typeChar, &applicationName[1], applicationName[0], data);
                     break;

              case pVersion:
                     err = AECreateDesc(typeChar, &versionString[1], versionString[0], data);
                     break;

              case pIsFrontProcess:
                     err = AECreateDesc(typeBoolean, &isFrontProcess, sizeof(Boolean), data);
                     break;

              case pFreeMemory:
                     err = AECreateDesc(typeLongInteger, &free, sizeof(long), data);
                     break;
                     
              case pLargestFreeBlock:
                     err = AECreateDesc(typeLongInteger, &contiguous, sizeof(long), data);
                     break;
                     
              case pTicks:
                     err = AECreateDesc(typeLongInteger, &ticks, sizeof(long), data);
                     break;
                     
              case pClipboard:
#if !TARGET_CARBON          
                     {
                            //     Return all of the items currently on the clipboard.
                            //     The returned information is an AEList, and each data type
                            //     on the scrap gets its own entry in the list
                            //     Since the OS doesn't supply the tools for getting all
                            //     of the types in the scrap, we have to scan the scrap ourselves

                            char                 *scrapPtr;
                            char                 *scrapEnd;
                            PScrapStuff    scrapInfo;
                            OSType         itemType;
                            long                  itemLength;
                            long                  index;
                            
                            err = AECreateList(NULL, 0, false, data);
                            ThrowIfOSErr(err);
                            
                            err = LoadScrap();                                                                  //     Make sure the scrap is in memory, not on disk.
                            ThrowIfOSErr(err);
                            
                            scrapInfo = InfoScrap();                                                     //     Get the base address of the scrap in RAM
                            MoveHHi(scrapInfo->scrapHandle);
                            HLock  (scrapInfo->scrapHandle);                                      // ...and lock it
                            
                            scrapPtr = (char *)*scrapInfo->scrapHandle;
                            scrapEnd = scrapPtr + scrapInfo->scrapSize;
                            
                            // scan the scrap in memory and extract each scrap type
                            
                            index = 1;
                            while (scrapPtr < scrapEnd) 
                            {
                                   itemType = *(OSType *)scrapPtr;
                                   scrapPtr += sizeof(itemType);
                                   itemLength = *(long *)scrapPtr;
                                   scrapPtr += sizeof(itemLength);
                                   
                                   // Move this information into the next entry on the list
                                   err = AEPutPtr(data, index, itemType, scrapPtr, itemLength);
                                   ThrowIfOSErr(err);
                                          
                                   index++;
                                   
                                   // Adjust the pointer to the start of the next item
                                   
                                   if (itemLength & 1) 
                                          itemLength++;                                                                       // If it's odd, make it even
                                          
                                   scrapPtr += itemLength;
                            }
                            HUnlock  (scrapInfo->scrapHandle);
                     }
#endif
                     break;

              default:
                     Inherited::GetDataFromObject(token, desiredTypes, data);
                     break;
       }

       ThrowIfOSErr(err);
}

Here is the call graph for this function:

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

Implements AEGenericClass.

Definition at line 123 of file nsAEApplicationClass.cpp.

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

Reimplemented from AEGenericClass.

Definition at line 763 of file nsAEApplicationClass.cpp.

{
       DescType             returnType;

       switch (propertyCode)
       {
              case pClipboard:
                     returnType = typeAEList;
                     break;
                     
              default:
                     returnType = typeWildCard;
       
       }
       return returnType;
}
void AEApplicationClass::GetProperty ( DescType  desiredClass,
const AEDesc *  containerToken,
DescType  containerClass,
DescType  keyForm,
const AEDesc *  keyData,
AEDesc *  resultToken 
) [protected, virtual]

Reimplemented from AEGenericClass.

Definition at line 90 of file nsAEApplicationClass.cpp.

{
       OSErr                err;
       CoreTokenRecord      token;
       DescType                    requestedProperty = **(DescType**)keyData->dataHandle;
       
       token.dispatchClass  = GetClass();
       token.objectClass           = GetClass();
       token.propertyCode   = requestedProperty;

       if (CanGetProperty(requestedProperty) || CanSetProperty(requestedProperty))
       {
              err = AECreateDesc(cProperty, (Ptr)&token, sizeof(CoreTokenRecord), resultToken);
              ThrowIfOSErr(err);
       }
       else
       {
              ThrowIfOSErr(errAEEventNotHandled);
       }
}

Here is the call 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 AEApplicationClass::HandleClose ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual]

Reimplemented from AEGenericClass.

Definition at line 140 of file nsAEApplicationClass.cpp.

{
       OSErr  err    = noErr;

       StAEDesc      saving;
       StAEDesc      savingIn;
              
       // Extract the [saving yes/no/ask] optional parameter, if present
       err = AEGetParamDesc(appleEvent, 
                                                          keyAESaveOptions, 
                                                          typeWildCard, 
                                                          &saving);
                                                          
       if (err != errAEDescNotFound)
              ThrowIfOSErr(err);
              
       // Extract the [saving in <alias>] optional parameter, if present
       err = AEGetParamDesc(appleEvent, 
                                                          keyAEFile, 
                                                          typeWildCard, 
                                                          &savingIn);
                                                          
       if (err != errAEDescNotFound)
              ThrowIfOSErr(err);
                     
       // Check for any required parameters we may have missed
       err = CheckForUnusedParameters(appleEvent);
       ThrowIfOSErr(err);
              
       // Now, do the application-related work
       SysBeep(2);
              

}

Here is the call graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 179 of file nsAEApplicationClass.cpp.

{
       OSErr  err                         = noErr;
       long          numberOfObjects      = 0L;

       DescType      objectClass;

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

       // Make sure we got & handled all of the required paramters
       err = CheckForUnusedParameters(appleEvent);
       ThrowIfOSErr(err);
       
       // Send back the results
       numberOfObjects = CountApplicationObjects(token, objectClass);
       err = AEPutParamPtr(reply, keyAEResult, typeLongInteger, (Ptr)&numberOfObjects, sizeof(long));
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 208 of file nsAEApplicationClass.cpp.

{
       OSErr  err = noErr;
       StAEDesc      data;
       long          size  = 0L;
       
       // First, get the data
       HandleGetData(token, appleEvent, reply);
       
       // now, extract it from the reply
       err = AEGetKeyDesc(reply, keyDirectObject, typeWildCard, &data);
       ThrowIfOSErr(err);
       
       size = data.GetDataSize();
       
       // do we leak all the data here?
       err = AEPutParamPtr(reply, 
                                                         keyAEResult, 
                                                         typeLongInteger, 
                                                         (Ptr)&size, 
                                                         sizeof(long));
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 240 of file nsAEApplicationClass.cpp.

{
       OSErr  err = noErr;
              
       if (AEListUtils::TokenContainsTokenList(token))
       {
              long                 numItems;
              
              AECountItems(token, &numItems);

              if (numItems > 0)
                     err = errAEEventNotHandled;
       }

       ThrowIfOSErr(err);
}

Here is the call graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 261 of file nsAEApplicationClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}
void AEApplicationClass::HandleExists ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual]

Reimplemented from AEGenericClass.

Definition at line 275 of file nsAEApplicationClass.cpp.

{
       OSErr  err           = noErr;
       Boolean       foundIt       = true;

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

Here is the call 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 AEApplicationClass::HandleMake ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual]

Reimplemented from AEGenericClass.

Definition at line 295 of file nsAEApplicationClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}
void AEApplicationClass::HandleMove ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual]

Reimplemented from AEGenericClass.

Definition at line 305 of file nsAEApplicationClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}
void AEApplicationClass::HandleOpen ( AEDesc *  token,
const AppleEvent *  appleEvent,
AppleEvent *  reply 
) [protected, virtual]

Reimplemented from AEGenericClass.

Definition at line 361 of file nsAEApplicationClass.cpp.

{
       OSErr  err;
       
       err = CheckForUnusedParameters(appleEvent);
       ThrowIfOSErr(err);

       long                 numItems, i;
       Boolean              openedGroups = false;

       err = ::AECountItems(token, &numItems);
       ThrowIfOSErr(err);
       
       for (i = 1; i <= numItems; i++)
       {
              FSSpec               fSpec;
              FInfo         fndrInfo;
              AEKeyword     keywd;
              DescType             returnedType;
              Size                 actualSize;

              err = ::AEGetNthPtr(token, i, typeFSS, &keywd, &returnedType, (Ptr)&fSpec, sizeof(fSpec), &actualSize);
              ThrowIfOSErr(err);
              
              err = ::FSpGetFInfo(&fSpec, &fndrInfo);
              ThrowIfOSErr(err);

              nsMacCommandLine&  cmdLine = nsMacCommandLine::GetMacCommandLine();
              cmdLine.HandleOpenOneDoc(fSpec, fndrInfo.fdType);
       }
}

Here is the call graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 399 of file nsAEApplicationClass.cpp.

{
       OSErr  err=noErr;
       
       err = CheckForUnusedParameters(appleEvent);
       ThrowIfOSErr(err);

       long                 numItems, i;
       Boolean              openedGroups = false;

       err = ::AECountItems(token, &numItems);
       ThrowIfOSErr(err);
       
       for (i = 1; i <= numItems; i++)
       {
              FSSpec               fSpec;
              FInfo         fndrInfo;
              AEKeyword     keywd;
              DescType             returnedType;
              Size                 actualSize;

              err = ::AEGetNthPtr(token, i, typeFSS, &keywd, &returnedType, (Ptr)&fSpec, sizeof(fSpec), &actualSize);
              ThrowIfOSErr(err);
              
              err = ::FSpGetFInfo(&fSpec, &fndrInfo);
              ThrowIfOSErr(err);

              nsMacCommandLine&  cmdLine = nsMacCommandLine::GetMacCommandLine();
              cmdLine.HandlePrintOneDoc(fSpec, fndrInfo.fdType);
       }
}

Here is the call graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 436 of file nsAEApplicationClass.cpp.

{
       // get optional saving param
       StAEDesc             savingParam;
       TAskSave             askSave = eSaveUnspecified;
       
       OSErr  err = ::AEGetKeyDesc(appleEvent, keyAESaveOptions, typeEnumeration, &savingParam);
       if (err != errAEDescNotFound)
       {
              DescType             enumValue = savingParam.GetEnumType();
              
              switch (enumValue)
              {
                     case 'yes ':         askSave = eSaveYes;         break;
                     case 'no  ':         askSave = eSaveNo;                 break;
                     case 'ask ':         askSave = eSaveAsk;         break;
              }
       }
       
       err = CheckForUnusedParameters(appleEvent);
       ThrowIfOSErr(err);

       nsMacCommandLine&  cmdLine = nsMacCommandLine::GetMacCommandLine();
       err = cmdLine.Quit(askSave);
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 330 of file nsAEApplicationClass.cpp.

{
  OSErr       err = noErr;
  nsresult rv = NS_OK;
  nsCOMPtr<nsINativeAppSupport> nas;

#ifdef MOZ_XUL_APP
  nas = do_CreateInstance(NS_NATIVEAPPSUPPORT_CONTRACTID);
  if (!nas) ThrowIfOSErr(errAEEventNotHandled);
#else
  nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
  NS_WARN_IF_FALSE(appStartup, "Failed to get appstartup service");
  if(!appStartup) ThrowIfOSErr(errAEEventNotHandled);
  
  rv = appStartup->GetNativeAppSupport(getter_AddRefs(nas));
  NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to get NativeAppSupport");  
  if(NS_FAILED(rv)) ThrowIfOSErr(errAEEventNotHandled);
#endif

  rv = nas->ReOpen();
  if(NS_FAILED(rv)) ThrowIfOSErr(errAEEventNotHandled);    

       err = CheckForUnusedParameters(appleEvent);
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 315 of file nsAEApplicationClass.cpp.

{
       OSErr  err = noErr;

        // do stuff on startup that we want to do
        
       err = CheckForUnusedParameters(appleEvent);
       ThrowIfOSErr(err);
}

Here is the call graph for this function:

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

Reimplemented from AEGenericClass.

Definition at line 468 of file nsAEApplicationClass.cpp.

{
       ThrowIfOSErr(errAEEventNotHandled);
}
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 AEGenericClass::SetDataForList ( const AEDesc *  token,
AEDesc *  data 
) [protected, inherited]

Reimplemented in AEDocumentClass.

Definition at line 759 of file nsAEGenericClass.cpp.

{
       OSErr                err;
              
       if (AEListUtils::TokenContainsTokenList(token) == false)
       {
              SetDataForObject(token, data);
       }
       else
       {
              long                 numItems;
              long                 itemNum;
              err = AECountItems((AEDescList*)token, &numItems);
              ThrowIfOSErr(err);
              
              for (itemNum = 1; itemNum <= numItems; itemNum++)
              {
                     StAEDesc             tempToken;
                     AEKeyword     keyword;
                     
                     err = AEGetNthDesc((AEDescList*)token, itemNum, typeWildCard, &keyword, &tempToken);
                     ThrowIfOSErr(err);
                     
                     if (AEListUtils::TokenContainsTokenList(&tempToken) == false)
                     {
                            SetDataForObject(&tempToken, data);              // Set data from single item
                     }
                     else
                     {
                            SetDataForList(&tempToken, data);  // Recurse sublist
                     }
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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 AEApplicationClass::SetDataForObject ( const AEDesc *  token,
AEDesc *  data 
) [protected, virtual]

Implements AEGenericClass.

Definition at line 707 of file nsAEApplicationClass.cpp.

{
       OSErr                       err                  = noErr;
       ConstAETokenDesc                   tokenDesc(token);
       Boolean                            usePropertyCode     = tokenDesc.UsePropertyCode();
       DescType                           propertyCode;
       
       if (usePropertyCode)
       {
              propertyCode = tokenDesc.GetPropertyCode();
              
#if !TARGET_CARBON
              long                 numItems;
#endif
              switch (propertyCode)
              {
                     // the clipboard is the only writeable property for the application object
                     case pClipboard:
                            //     The data should be an AE list containing a series of things to be placed on the
                            //     clipboard. The data type of each item is also the clipboard type for that data
#if !TARGET_CARBON
                            err = ZeroScrap();
                            ThrowIfOSErr(err);
                            
                            AECountItems(data, &numItems);
                            
                            //  Copy each item onto the clipboard
                            
                            for (long index = 1; index <= numItems; index++) 
                            {
                                   StAEDesc             currentItemDesc;
                                   AEKeyword            theAEKeyword;
                                   err = AEGetNthDesc(data, index, typeWildCard, &theAEKeyword, &currentItemDesc);
                                   ThrowIfOSErr(err);
                                          
                                   HLock(currentItemDesc.dataHandle);
                                   err = PutScrap(GetHandleSize(currentItemDesc.dataHandle), 
                                                                        currentItemDesc.descriptorType,
                                                                      *currentItemDesc.dataHandle);
                                   ThrowIfOSErr(err);
                            }
#endif
                            break;
                            
                     default:
                            ThrowIfOSErr(errAENotModifiable);
              }
       }
       
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class AECoreClass [friend]

Definition at line 47 of file nsAEApplicationClass.h.

friend class AEDocumentClass [friend]

Definition at line 48 of file nsAEApplicationClass.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: