InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MuteBackingStoreSubject.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Matt Joss
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //
23 // Purpose:
24 // Helper class for muting the ISubject of the backing store. For many commands,
25 // we don't want to broadcast their subcommands. Clients should just be able to listen for
26 // The higher level commands
27 //
28 //========================================================================================
29 
30 #include "VCPlugInHeaders.h"
31 
32 #include "IDataBase.h"
33 #include "IDocument.h"
34 #include "IXMLUtils.h"
35 #include "IIDXMLElement.h"
36 #include "ISubject.h"
37 
39 {
40  public:
41  MuteBackingStoreSubject(IDataBase* db) : fSubject(nil), fWasMuted(kFalse)
42  {
43  // -- We have to hang on to the subject here because it is not persistant. With the instance cache
44  // -- turned off the state of mute gets lost as soon as ISubject goes out of scope. Then the next
45  // -- time it is instantiated it gets un-muted. Hanging on to the subject will ensure that the
46  // -- mute state will persist as long as this class is in scope. [LDM]
47  /* fSubject = (ISubject*)Utils<IXMLUtils>()->GetBackingStore(db).Instantiate(IID_ISUBJECT);
48  if (fSubject)
49  {
50  fWasMuted = fSubject->IsMuted();
51  fSubject->Mute(kTrue);
52  }*/
53  }
54 
56  {
57  /* if (fSubject)
58  {
59  if (!fWasMuted)
60  fSubject->Mute(kFalse);
61 
62  fSubject->Release();
63  fSubject = nil;
64  }*/
65  }
66 
67 
68  private:
70 
71  ISubject* fSubject;
72  bool16 fWasMuted;
73 };