24 #if !defined( _TDEPRINT_COMPILE ) && defined( __GNUC__ )
25 #warning internal header, do not use except if you are a TDEPrint developer
29 #include <tqptrlist.h>
35 #include <tdelibs_export.h>
61 class TDEPRINT_EXPORT DrBase
64 enum Type { Base = 0, Main, ChoiceGroup, Group, String, Integer, Float, List, Boolean };
69 Type type()
const {
return m_type; }
70 bool isOption()
const {
return (m_type >= DrBase::String); }
72 const TQString& get(
const TQString& key)
const {
return m_map[key]; }
73 void set(
const TQString& key,
const TQString& val) { m_map[key] = val; }
74 bool has(
const TQString& key)
const {
return m_map.contains(key); }
75 const TQString& name()
const {
return m_name; }
76 void setName(
const TQString& s) { m_name = s; }
77 bool conflict()
const {
return m_conflict; }
78 void setConflict(
bool on) { m_conflict = on; }
80 virtual TQString valueText();
81 virtual TQString prettyText();
82 virtual void setValueText(
const TQString&);
83 virtual DriverItem* createItem(DriverItem *parent, DriverItem *after = 0);
84 virtual void setOptions(
const TQMap<TQString,TQString>& opts);
85 virtual void getOptions(TQMap<TQString,TQString>& opts,
bool incldef =
false);
86 virtual DrBase* clone();
89 TQMap<TQString,TQString> m_map;
106 class TDEPRINT_EXPORT DrGroup :
public DrBase
112 void addOption(DrBase *opt);
113 void addGroup(DrGroup *grp);
114 void addObject(DrBase *optgrp);
115 void clearConflict();
116 void removeOption(
const TQString& name);
117 void removeGroup(DrGroup *grp);
120 virtual DriverItem* createItem(DriverItem *parent, DriverItem *after = 0);
121 DrBase* findOption(
const TQString& name, DrGroup **parentGroup = 0);
122 DrGroup* findGroup(DrGroup *grp, DrGroup **parentGroup = 0);
123 void setOptions(
const TQMap<TQString,TQString>& opts);
124 void getOptions(TQMap<TQString,TQString>& opts,
bool incldef =
false);
127 const TQPtrList<DrGroup>& groups() {
return m_subgroups; }
128 const TQPtrList<DrBase>& options() {
return m_listoptions; }
130 static TQString groupForOption(
const TQString& optname );
133 void createTree(DriverItem *parent);
134 void flattenGroup(TQMap<TQString, DrBase*>&,
int&);
137 TQPtrList<DrGroup> m_subgroups;
138 TQDict<DrBase> m_options;
139 TQPtrList<DrBase> m_listoptions;
153 class TDEPRINT_EXPORT DrMain :
public DrGroup
159 DriverItem* createTreeView(TQListView *parent);
160 void addConstraint(DrConstraint *c) { m_constraints.append(c); }
161 int checkConstraints();
162 DrPageSize* findPageSize(
const TQString& name) {
return m_pagesizes.find(name); }
163 void addPageSize(DrPageSize *sz);
164 void removeOptionGlobally(
const TQString& name);
165 void removeGroupGlobally(DrGroup *grp);
166 TQMap<TQString, DrBase*> flatten();
167 DrMain* cloneDriver();
170 TQPtrList<DrConstraint> m_constraints;
171 TQDict<DrPageSize> m_pagesizes;
185 class DrChoiceGroup :
public DrGroup
191 DriverItem* createItem(DriverItem *parent, DriverItem *after = 0);
205 class TDEPRINT_EXPORT DrStringOption :
public DrBase
211 virtual TQString valueText();
212 virtual void setValueText(
const TQString& s);
229 class TDEPRINT_EXPORT DrIntegerOption :
public DrBase
235 virtual TQString valueText();
236 virtual void setValueText(
const TQString& s);
254 class TDEPRINT_EXPORT DrFloatOption :
public DrBase
260 virtual TQString valueText();
261 virtual void setValueText(
const TQString& s);
279 class TDEPRINT_EXPORT DrListOption :
public DrBase
285 void addChoice(DrBase *ch) { m_choices.append(ch); }
286 TQPtrList<DrBase>* choices() {
return &m_choices; }
287 DrBase* currentChoice()
const {
return m_current; }
288 DrBase* findChoice(
const TQString& txt);
289 void setChoice(
int choicenum);
291 virtual TQString valueText();
292 virtual TQString prettyText();
293 virtual void setValueText(
const TQString& s);
294 void setOptions(
const TQMap<TQString,TQString>& opts);
295 void getOptions(TQMap<TQString,TQString>& opts,
bool incldef =
false);
296 DriverItem* createItem(DriverItem *parent, DriverItem *after = 0);
300 TQPtrList<DrBase> m_choices;
311 class TDEPRINT_EXPORT DrBooleanOption :
public DrListOption
315 DrBooleanOption() : DrListOption() { m_type = DrBase::Boolean; }
316 ~DrBooleanOption() {}
333 DrConstraint(
const TQString& o1,
const TQString& o2,
const TQString& c1 = TQString::null,
const TQString& c2 = TQString::null);
334 DrConstraint(
const DrConstraint&);
339 TQString m_opt1, m_opt2;
340 TQString m_choice1, m_choice2;
341 DrListOption *m_option1, *m_option2;
358 DrPageSize(
const TQString& s,
float width,
float height,
float left,
float bottom,
float right,
float top);
359 DrPageSize(
const DrPageSize&);
366 float pageWidth()
const {
return m_width; }
367 float pageHeight()
const {
return m_height; }
368 float leftMargin()
const {
return m_left; }
369 float rightMargin()
const {
return m_right; }
370 float topMargin()
const {
return m_top; }
371 float bottomMargin()
const {
return m_bottom; }
372 TQString pageName()
const {
return m_name; }
374 TQSize pageSize()
const;
375 TQRect pageRect()
const;
376 TQSize margins()
const;
380 float m_width, m_height, m_left, m_bottom, m_right, m_top;