Accessibility
ISelectionMessages_8h-source
API classesBoss classesText interfacesSample plug-insSamples by typeCommonSnippetsBuild number
                   

ISelectionMessages.h

Go to the documentation of this file.
00001 //========================================================================================
00002 //  
00003 //  $File: //depot/indesign_3.x/dragonfly/source/public/interfaces/architecture/ISelectionMessages.h $
00004 //  
00005 //  Owner: Michael Martz
00006 //  
00007 //  $Author: sstudley $
00008 //  
00009 //  $DateTime: 2003/12/18 11:20:39 $
00010 //  
00011 //  $Revision: #1 $
00012 //  
00013 //  $Change: 237988 $
00014 //  
00015 //  Copyright 1997-2003 Adobe Systems Incorporated. All rights reserved.
00016 //  
00017 //  NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance 
00018 //  with the terms of the Adobe license agreement accompanying it.  If you have received
00019 //  this file from a source other than Adobe, then your use, modification, or 
00020 //  distribution of it requires the prior written permission of Adobe.
00021 //  
00022 //  
00023 //  Note:       This is not intended as an interface header. These are abstract C++ classes
00024 //  which are used to communicate information from subjects to observers within the
00025 //  selection architecture.
00026 //  
00027 //========================================================================================
00028 
00029 #ifndef _ISelectionMessages_
00030 #define _ISelectionMessages_
00031     
00032 //________________________________________________________________________________________________
00033 //  INCLUDES
00034 //________________________________________________________________________________________________
00035     //.......Interface headers....................................................................
00036     #include "IPMUnknown.h"                     // for the definition of 
00037 
00038     //.......Other headers........................................................................
00039     #include "K2SmartPtr.h"
00040     #include "K2Vector.h"
00041     #include "KeyValuePair.h"
00042     #include "tabletypes.h"
00043 //________________________________________________________________________________________________
00044 //  CLASS FORWARDS
00045 //________________________________________________________________________________________________
00046     class ISubject;
00047     class SelectionSuiteData;
00048     class UIDList;
00049     class ITableModel;
00050     class XMLReference;
00051     class XMLAttributeReference;
00052     namespace InDesign { class TextRange;}
00053     class RangeData;
00054     class ITextSelectionSuite;
00055 //________________________________________________________________________________________________
00056 //  TYPEDEFS
00057 //________________________________________________________________________________________________
00058     typedef K2Vector<KeyValuePair<PMIID,  K2::shared_ptr<SelectionSuiteData> > > SuiteBroadcastData;    // sorted
00059 
00060     namespace Selection 
00061     {
00062         enum Action { kReplace, kAddTo, kRemoveFrom };
00063         enum ScrollChoice { kDontScrollSelection, kScrollIntoView};
00064     }
00065 
00066 
00067 //________________________________________________________________________________________________
00068 //  COMPILER DIRECTIVES
00069 //________________________________________________________________________________________________
00070     #ifdef PUBLIC_BUILD
00071 #endif // PUBLIC_BUILD
00072 //================================================================================================
00073 //________________________________________________________________________________________________
00074 //  CLASS DECLARATIONS
00075 //________________________________________________________________________________________________ 
00076 //................................................................................................
00077 //  The internal selection message is used for communicating between the CSBs and the ASB. 
00078 //................................................................................................
00079 class IInternalSelectionMessage 
00080     {
00081     //____________________________________________________________________________________________
00082     //  Data Types
00083     //____________________________________________________________________________________________
00084     public:
00085         enum SelectionMessageType { kClientMessage, kASB_SuiteMessage, kSelectionChanged, kCSB_NeedsNotify };
00086 
00087     public:
00088         //________________________________________________________________________________________
00089         //  DESCR:      Return the message type of this message.
00090         //________________________________________________________________________________________
00091         virtual SelectionMessageType GetMessageType (void) const = 0;
00092 
00093         //________________________________________________________________________________________
00094         //  DESCR:      Return the ASB interface ID that is the destination of this message.
00095         //  
00096         //  NOTE:       Used only for messages of type: kASB_SuiteMessage
00097         //________________________________________________________________________________________
00098         virtual PMIID GetASB_SuiteIID (void) const = 0;
00099 
00100         //________________________________________________________________________________________
00101         //  DESCR:      Return the actual message. Unfortunately, a downcast based on 
00102         //              SelectionMessageType is necessary. For kClientMessage this is an 
00103         //              ISelectionMessage. It is ISuite specific for kASB_SuiteMessage.
00104         //________________________________________________________________________________________
00105         virtual void* GetMessage (void) const = 0;
00106     
00107         //________________________________________________________________________________________
00108         //  DESCR:      Return the CSB that is sending the message.
00109         //________________________________________________________________________________________
00110         virtual ClassID GetCSB_ClassID (void) const = 0;
00111 
00112     };
00113 
00114 //................................................................................................
00115 //  When a ISuite broadcasts data to its client code, it must inherit from this class, so that
00116 //  the message object has a virtual destructor in order to de-allocate memory.
00117 //................................................................................................
00118 class  SelectionSuiteData 
00119     {
00120     public:
00121         typedef object_type data_type;
00122         virtual     ~SelectionSuiteData (void);
00123     };
00124 //................................................................................................
00125 //  This is the void* for kClientMessage. It is used when the selection or a selection attribute
00126 //  has changed. The suite on the CSB broadcasts the change and the ASB responds by broadcasting 
00127 //  to the client code. 
00128 //................................................................................................
00129 class  ISelectionMessage 
00130     {
00131     //____________________________________________________________________________________________
00132     //  Data Types
00133     //____________________________________________________________________________________________
00134     public:
00135         enum SelectionMessageType { kSelectionChanged, kSelectionAttributeChanged, kSelectionChanged_Frequent};
00136 
00137     public:
00138         //________________________________________________________________________________________
00139         //  DESCR:      Return the message type of this message.
00140         //________________________________________________________________________________________
00141         virtual SelectionMessageType GetMessageType (void) const = 0;
00142 
00143         //________________________________________________________________________________________
00144         //  DESCR:      Was the suite affected by the change that caused this broadcast?
00145         //
00146         //  NOTE:       Used by the kSelectionAttributeChanged message.
00147         //
00148         //  RETURNS:    kTrue / kFalse
00149         //________________________________________________________________________________________
00150         virtual bool16 WasSuiteAffected (const PMIID&) const = 0;
00151 
00152         //________________________________________________________________________________________
00153         //  DESCR:      Return the Suite data associated with this broadcast.
00154         //
00155         //  NOTE:       Used by the kSelectionAttributeChanged message.
00156         //
00157         //  RETURNS:    Proprietary suite message (based on SelectionSuiteData)
00158         //________________________________________________________________________________________
00159         virtual SelectionSuiteData* GetSuiteBroadcastData (const PMIID&) const = 0;
00160 
00161         //________________________________________________________________________________________
00162         //  DESCR:      Return the list of SuiteBroadcastData.
00163         //
00164         //  NOTE:       Used by the IInternalSelectionMessage.
00165         //              DO NOT access the SuiteBroadcastData* directly.
00166         //
00167         //  RETURNS:    List of suite IID and Proprietary suite message pairs
00168         //________________________________________________________________________________________
00169         virtual SuiteBroadcastData* GetSuiteBroadcastDataList (void) = 0;
00170     };
00171 
00172 //................................................................................................
00173 //  This is the void* for IID_SELECTION_HIGHLIGHT_MESSAGE
00174 //................................................................................................
00175 class  ISelectionHighlightMessage 
00176     {
00177     public:
00178         //________________________________________________________________________________________
00179         //  DESCR:      Return the CSB target of this message.
00180         //________________________________________________________________________________________
00181         virtual ClassID GetCSB (void) const = 0;
00182 
00183         //________________________________________________________________________________________
00184         //  DESCR:      Return the CSB-specific message data.
00185         //________________________________________________________________________________________
00186         virtual void* GetMessage (void) const = 0;
00187     };
00188 
00189 //................................................................................................
00190 //  This is the void* message in a SelectionHighlightMessage for a layout selection
00191 //................................................................................................
00192 class  ILayoutSelectionHighlightMessage 
00193     {
00194     public:
00195         //________________________________________________________________________________________
00196         //  DESCR:      Return the list of items to deselect
00197         //________________________________________________________________________________________
00198         virtual UIDList GetItemsToRemove (void) const = 0;
00199 
00200         //________________________________________________________________________________________
00201         //  DESCR:      Return the list of items to add to the selection
00202         //________________________________________________________________________________________
00203         virtual UIDList GetItemsToAdd (void) const = 0;
00204 
00205         //________________________________________________________________________________________
00206         //  DESCR:      Return kTrue if the selection is a path selection
00207         //________________________________________________________________________________________
00208         virtual bool16  IsPathSelection (void) const = 0;
00209 
00210         //________________________________________________________________________________________
00211         //  DESCR:      Return kTrue if the suite should autoscroll.
00212         //________________________________________________________________________________________
00213         virtual bool16  IsAutoScroll (void) const = 0;
00214     };
00215     
00216     
00217 //................................................................................................
00218 //  Class used in ITextSelectionHighlightMessage to hold left and right track change deleted text highlight extension uid invormation.
00219 //................................................................................................
00220 class SelectionExtension
00221     {
00222     public:
00223         SelectionExtension() : fLeftExtension(kInvalidUID), fRightExtension(kInvalidUID) { }
00224         SelectionExtension (UID leftExtension, UID rightExtension) { SetExtension (leftExtension, rightExtension); }
00225     
00226         
00227         inline void SetExtension (UID leftExtension, UID rightExtension) { fLeftExtension = leftExtension; fRightExtension = rightExtension; }
00228         
00229         inline UID GetLeftExtension () const { return fLeftExtension; }
00230         inline UID GetRightExtension () const { return fRightExtension; }
00231         
00232     private:
00233         UID fLeftExtension;
00234         UID fRightExtension;
00235     };  
00236 
00237 //................................................................................................
00238 //  This is the void* message in a SelectionHighlightMessage for a text selection
00239 //................................................................................................
00240 class  ITextSelectionHighlightMessage 
00241     {
00242     public:
00243         //________________________________________________________________________________________
00244         //  DESCR:      Return the previous range
00245         //________________________________________________________________________________________
00246         virtual InDesign::TextRange GetOldRange (void) const = 0;
00247         //________________________________________________________________________________________
00248 
00249         //________________________________________________________________________________________
00250         //  DESCR:      Return the new range
00251         //________________________________________________________________________________________
00252         virtual InDesign::TextRange GetNewRange (void) const = 0;
00253 
00254 
00255         enum ScrollChoice { kDontScrollSelection, kScrollIntoView};
00256         virtual ScrollChoice GetAutoScroll( RangeData* ) const = 0;
00257 
00258         virtual ITextSelectionSuite* GetSelection(void) const = 0;
00259         
00260         virtual SelectionExtension GetOldSelectionExtension() const = 0;
00261         virtual SelectionExtension GeNewSelectionExtension() const = 0;
00262     };
00263     
00264 //................................................................................................
00265 //  This is the void* message in a SelectionHighlightMessage for a table selection
00266 //  You can pass in a nil table model for one of the table models if you only want to draw a new
00267 //      selection and not erase the old
00268 //................................................................................................
00269 class  ITableSelectionHighlightMessage 
00270     {
00271     public:
00272         //________________________________________________________________________________________
00273         //  DESCR:      Returns the previous selection's table model
00274         //              Used to erase the old selection
00275         //________________________________________________________________________________________
00276         virtual const ITableModel* GetPrevTableModel (void) const = 0;
00277         //________________________________________________________________________________________
00278         //  DESCR:      Returns the cells previously selection
00279         //              Used to erase the old selection
00280         //________________________________________________________________________________________
00281         virtual const GridArea GetPrevSelectedCells (void) const = 0;
00282 
00283         //________________________________________________________________________________________
00284         //  DESCR:      Return the new selection's table model
00285         //              Used to draw the new selection
00286         //________________________________________________________________________________________
00287         virtual const ITableModel* GetNewTableModel (void) const = 0;
00288         //________________________________________________________________________________________
00289         //  DESCR:      Return the new end index
00290         //              Used to draw the new selection
00291         //________________________________________________________________________________________
00292         virtual const GridArea GetNewSelectedCells  (void) const = 0;
00293     };
00294 
00295 //................................................................................................
00296 //  This is the void* message in a SelectionHighlightMessage for a layout selection
00297 //................................................................................................
00298 class  IXMLSelectionHighlightMessage 
00299     {
00300     public:
00301         //________________________________________________________________________________________
00302         //  DESCR:      Return the Elements to add to the selection
00303         //________________________________________________________________________________________
00304         virtual const K2Vector<XMLReference>* GetElementsToAdd (void) const = 0;
00305         //________________________________________________________________________________________
00306         //  DESCR:      Return the Elements to remove from the selection
00307         //________________________________________________________________________________________
00308         virtual const K2Vector<XMLReference>* GetElementsToRemove (void) const = 0;
00309 
00310         //________________________________________________________________________________________
00311         //  DESCR:      Return the Attributes to add to the selection
00312         //________________________________________________________________________________________
00313         virtual const K2Vector<XMLAttributeReference>* GetAttributesToAdd (void) const = 0;
00314         //________________________________________________________________________________________
00315         //  DESCR:      Return the Attributes to remove from the selection
00316         //________________________________________________________________________________________
00317         virtual const K2Vector<XMLAttributeReference>* GetAttributesToRemove (void) const = 0;
00318 
00319     };
00320 
00321 //................................................................................................
00322 //  This is the void* object when the ASB broadcasts a SelectionChanged() message to the ISuites.
00323 //................................................................................................
00324 class  ISelectionChangedISuiteMessage 
00325     {
00326     //____________________________________________________________________________________________
00327     //  Data Types
00328     //____________________________________________________________________________________________
00329     public:
00330         enum MessageType { kActiveCSBsChangedMessage };
00331 
00332     public:
00333         //________________________________________________________________________________________
00334         //  DESCR:      Return the message type.
00335         //________________________________________________________________________________________
00336         virtual MessageType GetMessageType (void) const = 0;
00337 
00338         //________________________________________________________________________________________
00339         //  DESCR:      Return a list of currently disabled CSBs. 
00340         //              (only valid for kActiveCSBsChangedMessage)
00341         //              The bool16 in the returned list has the enable value.
00342         //________________________________________________________________________________________
00343         virtual const K2Vector<KeyValuePair<ClassID, bool16> >* GetEnabledCSBs (void) const = 0;
00344 
00345         //________________________________________________________________________________________
00346         //  DESCR:      Return a list of enabled ISuites on the ASB.
00347         //              (only valid for kActiveCSBsChangedMessage)
00348         //________________________________________________________________________________________
00349         virtual const K2Vector<PMIID>* GetEnabledSuiteInterfaces (void) const = 0;
00350     };
00351 
00352 
00353 #endif // _ISelectionMessages_