InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SDKFileHelper.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Adobe Developer Technologies
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 #ifndef __SDKFileHelper_H_DEFINED__
25 #define __SDKFileHelper_H_DEFINED__
26 
27 #include "IOpenFileCmdData.h"
28 #include "SysFileList.h"
29 class IOpenManager;
31 class IImportManager;
32 
43 
44 friend class SDKFileHelperUnitTest;
45 
46 public:
47 
48 
55  SDKFileHelper(const PMString& path);
56 
63  SDKFileHelper(const IDFile& file);
64 
66  virtual ~SDKFileHelper();
67 
73  bool16 IsExisting() const;
74 
80  bool16 IsChosen() const;
81 
85  PMString GetPath() const;
86 
92  IDFile GetIDFile() const;
93 
100  IDFile GetAbsoluteFromRelative(const PMString& relativePath) const;
101 
105 
110  static bool16 isMacPosixPathEnabled();
111 
112 protected:
114  SDKFileHelper();
115 
116 
121  void initFromString();
122 
123 
128  void initFromSysFile();
129 
130 
134  void traceInitializeDiagnostics(int32 e) const;
135 
140 
145  void setChosen(bool16 chsen);
146 
155  void setIDFile(const IDFile& file);
156 
163  void setPath(const PMString& path);
164 
170  PMString absoluteFromRelative(const PMString& folder, const PMString& path) const;
171 
172 
180  bool16 isAbsolutePath(const PMString& path) const;
181 
188  bool16 isUnixPath(const PMString& path) const;
189 
196  bool16 isMacPath(const PMString& path) const;
197 
204  bool16 isWinPath(const PMString& path) const;
205 
211  PMString getMinusLastElement(const PMString& path) const;
212 
218  PMString getMinusFirstElement(const PMString& path) const;
219 
224  PMString getAsMacPath(const PMString& path) const;
225 
230  PMString getAsWinPath(const PMString& path) const;
231 
232 private:
233  PMString fPath;
234  IDFile fSysFile;
235  bool16 fChosen;
236 };
237 
238 
293 public:
294 
298 
301  virtual ~SDKFileOpenChooser();
302 
312  void AddFilter(const FileTypeInfoID& fileTypeInfoID, const PMString& filterName);
313 
325  void AddFilter(const SysOSType& macFileType, const PMString& extension, const PMString& filterName);
326 
331  void AddAllFiles();
332 
336  void SetTitle(const PMString& title);
337 
350  void ShowDialog();
351 
352 protected:
358  class Filter {
359  public:
360  typedef object_type data_type;
361  public:
362  Filter(const SysOSType& macFileType,
363  const PMString& extension,
364  const PMString& filterName);
365  virtual ~Filter();
366  SysOSType fMacFileType;
367  PMString fExtension;
368  PMString fFilterName;
369  };
370 
374 
375  Filters fFilters;
376  PMString fTitle;
377  bool16 fIsAllFilesEnabled;
378  IOpenFileCmdData::OpenFlags fOpenFlags;
379 };
380 
415 public:
416 
420 
423  virtual ~SDKFileDocumentChooser();
424 
433  void ShowDialog();
434 
440 
446 
447 private:
448  IOpenFileCmdData::OpenFlags fOpenFlags;
449 };
450 
487 public:
491 
494  virtual ~SDKFileSaveChooser();
495 
505  void AddFilter(const FileTypeInfoID& fileTypeInfoID, const PMString& filterName);
506 
518  void AddFilter(const SysOSType& macFileCreator, const SysOSType& macFileType, const PMString& extension, const PMString& filterName);
519 
523  void SetTitle(const PMString& title);
524 
529  void SetFilename(const PMString& filename);
530 
534  int32 GetFilterIndex();
535 
547  void ShowDialog();
548 
549 private:
554  class Filter {
555  public:
556  typedef object_type data_type;
557  public:
558  Filter(const SysOSType& macFileCreator,
559  const SysOSType& macFileType,
560  const PMString& extension,
561  const PMString& filterName);
562  virtual ~Filter();
563  SysOSType fMacFileCreator;
564  SysOSType fMacFileType;
565  PMString fExtension;
566  PMString fFilterName;
567  };
568 
571  typedef K2Vector<Filter> Filters;
572 
573 private:
574 
575  Filters fFilters;
576  PMString fTitle;
577  PMString fFilename;
578  int32 fFilterIndex;
579 };
580 
608 public:
614  virtual ~SDKFilePlaceChooser();
615 
616 public:
628  void ShowDialog();
629 
630 public:
631  // Mutators for the place file dialog options.
632 
636  void SetShowFilterPrefs(bool16 showFilterPrefs);
637 
641  void SetRetainFormat(bool16 retainFormat);
642 
646  void SetConvertQuotes(bool16 convertQuotes);
647 
651  void SetReplaceSelectedItem(bool16 replaceSelectedItem);
652 
656  void SetApplyCJKGrid(bool16 applyGrid);
657 
661  void SetShowPreview(bool16 showPreview);
662 
663 public:
664  // Accessors for the place file dialog options.
665 
668  bool16 GetShowFilterPrefs() const;
669 
672  bool16 GetRetainFormat() const;
673 
676  bool16 GetConvertQuotes() const;
677 
680  bool16 GetReplaceSelectedItem() const;
681 
684  bool16 GetApplyCJKGrid() const;
685 
688  bool16 GetShowPreview() const;
689 
690 protected:
696 
703 
704 private:
705  // IImportManagerOptions cached by this object so that the caller
706  // can set the options before the dialog is opened and find out the
707  // options the user specified once the dialog is dismissed.
708  bool16 fShowFilterPrefs;
709  bool16 fRetainFormat;
710  bool16 fConvertQuotes;
711  bool16 fReplaceSelectedItem;
712  bool16 fApplyCJKGrid;
713  bool16 fShowPreview;
714 };
715 
733 public:
737 
740  virtual ~SDKFolderChooser();
741 
748  void ShowDialog();
749 
754  void SetTitle(const PMString& title);
755 
756 protected:
757  void initFromSysFile();
758 
759 private:
760  PMString fTitle;
761 
762 };
763 
790 
791 public:
792 
803  void ShowDialog();
804 
809  int32 GetFileCount() const;
810 
816  IDFile* GetNthFile(int32 n) const;
817 
818 private:
819  SysFileList fFileList;
820 };
821 
822 #endif // __SDKFile_H_DEFINED__
823 
824 
825 // Code generated by DollyXS code generator