Skip navigation
Daves61
Currently Being Moderated

How to get notification when any master spread is set to active from InDesign

Apr 30, 2012 3:20 AM

Tags: #indesign #pages #spread #notification #selected #subject #master_spread #active_spread #notified

Hi all,

I need to get notified when any master spread is selected from InDesign or pages are inserted/deleted from any master spread.

For this, I have implemented a custom observer derived from CObserver.

In AutoAttach(), the code is as follows,

        InterfacePtr<IWorkspace> docWorkspace(doc->GetDocWorkSpace(), UseDefaultIID());

        if( !docWorkspace )

            break;

 

        InterfacePtr<ISubject> docSubject(docWorkspace, UseDefaultIID());

        if( !docSubject )

            break;

 

        docSubject->AttachObserver(this, IID_ISPREADLIST, IID_IABCDOCOBSERVER);

        docSubject->AttachObserver(this, IID_ICURRENTSPREAD, IID_IABCDOCOBSERVER);

        docSubject->AttachObserver(this, IID_IMASTERSPREADLIST, IID_IABCDOCOBSERVER);

        docSubject->AttachObserver(this, IID_IPAGEPREFERENCES, IID_IABCDOCOBSERVER);

 

I have observed these protocols but still don't get any notification when any spread is selected (set to active spread) or pages are added in any master spread.

 

Please let me know which interface should be observed to get notified for the same? Am I correct in checking the document workspace as subject?

Please help me out. Thanks in advance.

 
Replies
  • Currently Being Moderated
    May 3, 2012 12:48 AM   in reply to Daves61

    Shortly:

    Even if the method AutoAttach exists, it doesn't imply it will call automatically. You should call AutoAttach yourself.
    You need also e.g. a responder service (maybe Startup/Shutdown) from where you will call all AutoAttach methods of your observers.

     

    It is better to AddIn your IID_IABCDOCOBSERVER to existing boss-class (kWorkspaceBoss or kDocumentBoss).

     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2012 10:52 AM   in reply to Daves61

    Daves61,
    I need to clarify what kind of event you're interested in.

    1. When you click once on page/spead widget in the Pages panel and only widget becomes selected. The layout window remains unchanged. OR

    2. When you doubleclick on page/spread widget the selected master spread appears in the layout window.

     

    In the first case you work with Pages panel.

    Have a look to file PageTransitionsPanelObserver.cpp from SDK. 
    PageTransitionsPanelObserver::LazyUpdate()

     

    In the second case you work with Layout window.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points