InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CXMLImportPreferences.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Ryan Gano
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 
24 #include "IXMLImportPreferences.h"
25 
26 #include "WideString.h"
27 #include "K2Vector.tpp"
28 
29 struct SinglePref
30 {
31  typedef object_type data_type;
32 
34  int32 intVal = -1, bool16 boolVal = kFalse, const WideString &stringVal = WideString()) :
35  fType(type), fValueName(name), fInt32Value(intVal), fBool16Value(boolVal), fWideStringValue(stringVal)
36  {}
37 
39  WideString fValueName;
40  int32 fInt32Value;
41  bool16 fBool16Value;
42  WideString fWideStringValue;
43 };
44 
45 //----------------------------------------------------------------------------------------
46 // XMLImportOptionsDefaultServiceProvider
47 //----------------------------------------------------------------------------------------
48 class CXMLImportPreferences : public CPMUnknown<IXMLImportPreferences>
49 {
50 public:
52 
53  // Use this to set each piece of data listed below
54  virtual void Initialize(IXMLImportOptionsPool *pool);
55 
56  virtual void Uninitialize();
57 
58  virtual int32 GetPrefCount() const {return fPrefs.size();}
59  virtual kPrefType GetNthPrefType(int32 n) const {return fPrefs[n].fType;}
60 
61  // Get the value of the nth pref
62  virtual int32 GetNthPrefAsInt(int32 n) const {return fPrefs[n].fInt32Value;}
63  virtual bool16 GetNthPrefAsBool(int32 n) const {return fPrefs[n].fBool16Value;}
64  virtual WideString GetNthPrefAsString(int32 n) const {return fPrefs[n].fWideStringValue;}
65 
66  // Set the value of the nth pref
67  virtual void SetNthPref(int32 n, const int32 &newVal) {fPrefs[n].fInt32Value = newVal;}
68  virtual void SetNthPref(int32 n, const bool16 &newVal) {fPrefs[n].fBool16Value = newVal;}
69  virtual void SetNthPref(int32 n, const WideString &newVal) {fPrefs[n].fWideStringValue = newVal;}
70 
71  // Commit stored changes. Override this to make sure the
72  // stored values are valid than then call
73  // CIXMLImportPreferences::CommitChanges() to actually
74  // store the changes.
75  virtual void CommitChanges();
76 
77 protected:
88  int32 intVal = -1, bool16 boolVal = kFalse, const WideString &stringVal = WideString());
89 
90  K2Vector<SinglePref> fPrefs;
92 };