00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __OP_GalleryEntry__
00019 #define __OP_GalleryEntry__
00020
00021 #include "OP_API.h"
00022 #include <UT/UT_Options.h>
00023 #include <UT/UT_PtrArray.h>
00024 #include <FS/FS_IndexFile.h>
00025
00026 class UT_StringArray;
00027 class OP_Gallery;
00028 class OP_Node;
00029 class OP_Network;
00030
00031 class OP_API OP_GalleryEntry
00032 {
00033 public:
00034
00035
00036 OP_GalleryEntry();
00037 virtual ~OP_GalleryEntry();
00038
00039 bool getEntryIsValid() const;
00040 bool match(const char *namepattern,
00041 const char *labelpattern,
00042 const char *keywordpattern,
00043 const char *category,
00044 const char *optable,
00045 const char *optype) const;
00046
00047 const UT_String &getFilePath() const;
00048 const UT_String &getEntryName() const;
00049 void setEntryName(const char *entryname);
00050
00051 void getLabel(UT_String &label) const;
00052 void setLabel(const char *label);
00053
00054 void getDescription(UT_String &description) const;
00055 void setDescription(const char *description);
00056
00057 void getIcon(UT_String &icon) const;
00058 void setIcon(const char *icon);
00059
00060 bool getAllowIconRegeneration() const;
00061 void setAllowIconRegeneration(bool flag);
00062
00063 void getHelpUrl(UT_String &helpurl) const;
00064 void setHelpUrl(const char *helpurl);
00065
00066 void getOTLPath(UT_String &otlpath) const;
00067 void setOTLPath(const char *otlpath);
00068
00069 void getOpTable(UT_String &optable) const;
00070 void setOpTable(const char *optable);
00071
00072 void getOpTypes(UT_String &optypes) const;
00073 void getOpTypes(UT_StringArray &optypes) const;
00074 void setOpTypes(const char *optypes);
00075 void setOpTypes(const UT_StringArray &optypes);
00076
00077 void getKeywords(UT_String &keywords) const;
00078 void getKeywords(UT_StringArray &keywords) const;
00079 void setKeywords(const char *keywords);
00080 void setKeywords(const UT_StringArray &keywords);
00081
00082 void getCategories(UT_String &cats) const;
00083 void getCategories(UT_StringArray &cats) const;
00084 void setCategories(const char *cats);
00085 void setCategories(const UT_StringArray &cats);
00086
00087 bool hasContents() const;
00088 bool applyContents(OP_Node *destnode) const;
00089 void setContents(OP_Node *srcnode);
00090
00091 bool hasParms() const;
00092 bool applyParms(OP_Node *destnode) const;
00093 void getParms(UT_String &script) const;
00094 void setParms(OP_Node *srcnode);
00095 void setParms(UT_OStrStream &os);
00096
00097
00098
00099 bool applyOther(OP_Node *destnode) const;
00100
00101
00102
00103 bool canApplyToNode(OP_Node *node) const;
00104 bool applyToNode(OP_Node *node) const;
00105
00106
00107 OP_Network *getNaturalOpManager(void) const;
00108
00109
00110
00111
00112
00113 bool canCreateChildNode(OP_Network *net=0) const;
00114 OP_Node *createChildNode(OP_Network *net=0) const;
00115
00116
00117 void getBestOpType(UT_String &optype) const;
00118
00119
00120
00121 void setInformationFromNode(OP_Node *node);
00122
00123
00124 void clearAllInformation();
00125
00126
00127
00128 const OP_GalleryEntry &operator=(const OP_GalleryEntry &src);
00129
00130
00131
00132 static int compareEntries(OP_GalleryEntry * const *a,
00133 OP_GalleryEntry * const *b);
00134
00135 protected:
00136
00137
00138 OP_GalleryEntry(OP_Gallery *owner,
00139 const char *entryname,
00140 bool newentry);
00141
00142 void clear();
00143 bool getOption(const char *optionname,
00144 UT_String &optionvalue) const;
00145 bool getOption(const char *optionname,
00146 UT_StringArray &optionvalues,
00147 bool spaceisseparator) const;
00148 bool getOptionBool(const char *optionname,
00149 bool &optionvalue) const;
00150 void setOption(const char *optionname,
00151 const UT_String &optionvalue);
00152 void setOption(const char *optionname,
00153 const UT_StringArray &optionvalues);
00154 void setOptionBool(const char *optionname,
00155 bool optionvalue);
00156 void saveCompressedSection(const char *section,
00157 UT_OStrStream &src);
00158 bool loadCompressedSection(const char *section,
00159 char *&buffer,
00160 int &buflen) const;
00161 void allowEditing();
00162
00163 private:
00164 void createDefault();
00165 void loadFromGallery();
00166
00167 OP_Gallery *myGallery;
00168 FS_IndexFile *myIndexFile;
00169 UT_String myEntryName;
00170 UT_Options myOptions;
00171 bool myEditableIndexFile;
00172
00173 friend class OP_Gallery;
00174 };
00175
00176 typedef UT_PtrArray<OP_GalleryEntry *> OP_GalleryEntryList;
00177
00178 #endif
00179