Index: src/UIElements/TextUI/Query/TextQuery.hpp
===================================================================
--- src/UIElements/TextUI/Query/TextQuery.hpp	(revision 33e80133683ce15eb991faac6abc6d540afee182)
+++ src/UIElements/TextUI/Query/TextQuery.hpp	(revision 37a67f216a1ec48288bc1b314c99cfb0d6cb6963)
@@ -17,60 +17,4 @@
 #include "TextUI/TextDialog.hpp"
 
-class TextDialog::AtomTextQuery : public Dialog::TQuery<const atom *> {
-public:
-  AtomTextQuery(Parameter<const atom *> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~AtomTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::AtomsTextQuery : public Dialog::TQuery<std::vector<const atom *> > {
-public:
-  AtomsTextQuery(Parameter<std::vector<const atom *> > &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~AtomsTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::BooleanTextQuery : public Dialog::TQuery<bool> {
-public:
-  BooleanTextQuery(Parameter<bool> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~BooleanTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::RealSpaceMatrixTextQuery : public Dialog::TQuery<RealSpaceMatrix> {
-public:
-  RealSpaceMatrixTextQuery(Parameter<RealSpaceMatrix> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~RealSpaceMatrixTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::DoubleTextQuery : public Dialog::TQuery<double> {
-public:
-  DoubleTextQuery(Parameter<double> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~DoubleTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::DoublesTextQuery : public Dialog::TQuery<std::vector<double> > {
-public:
-  DoublesTextQuery(Parameter<std::vector<double> > &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~DoublesTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::ElementTextQuery : public Dialog::TQuery<const element *> {
-public:
-  ElementTextQuery(Parameter<const element *> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~ElementTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::ElementsTextQuery : public Dialog::TQuery<std::vector<const element *> > {
-public:
-  ElementsTextQuery(Parameter<std::vector<const element *> > &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~ElementsTextQuery();
-  virtual bool handle();
-};
-
 class TextDialog::EmptyTextQuery : public Dialog::EmptyQuery {
 public:
@@ -80,101 +24,25 @@
 };
 
-class TextDialog::FileTextQuery : public Dialog::TQuery<boost::filesystem::path> {
-public:
-  FileTextQuery(Parameter<boost::filesystem::path> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~FileTextQuery();
-  virtual bool handle();
-};
 
-class TextDialog::FilesTextQuery : public Dialog::TQuery<std::vector<boost::filesystem::path> > {
-public:
-  FilesTextQuery(Parameter<std::vector< boost::filesystem::path> > &param, const std::string &_title, const std::string &_description = NULL);
-  virtual ~FilesTextQuery();
-  virtual bool handle();
-};
+  /** With the following boost::preprocessor code we generate forward declarations
+   * of query class for all desired query types in the Qt specialization class of
+   * Dialog.
+   */
+#include "UIElements/GlobalListOfParameterQueries.hpp"
+#include "UIElements/Dialog_impl_pre.hpp"
 
-class TextDialog::IntTextQuery : public Dialog::TQuery<int> {
-public:
-  IntTextQuery(Parameter<int> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~IntTextQuery();
-  virtual bool handle();
-};
+  #include <boost/preprocessor/facilities/empty.hpp>
 
-class TextDialog::IntsTextQuery : public Dialog::TQuery<std::vector<int> > {
-public:
-  IntsTextQuery(Parameter<std::vector<int> > &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~IntsTextQuery();
-  virtual bool handle();
-};
+  // iterate over all parameter query types for forward declarations
+  #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
+  #define BOOST_PP_LOCAL_MACRO(n) queryclass_definition(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type, Text)
+  #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
+  #include BOOST_PP_LOCAL_ITERATE()
+  #undef queryclass_definition
+  #endif
 
-class TextDialog::KeyValuePairTextQuery : public Dialog::TQuery<KeyValuePair> {
-public:
-  KeyValuePairTextQuery(Parameter<KeyValuePair> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~KeyValuePairTextQuery();
-  virtual bool handle();
-};
+#include "Dialog_impl_undef.hpp"
+  /* End of preprocessor code piece */
 
-class TextDialog::KeyValuePairsTextQuery : public Dialog::TQuery<std::vector<KeyValuePair> > {
-public:
-  KeyValuePairsTextQuery(Parameter<std::vector<KeyValuePair> > &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~KeyValuePairsTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::MoleculeTextQuery : public Dialog::TQuery<const molecule *> {
-public:
-  MoleculeTextQuery(Parameter<const molecule *> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~MoleculeTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::MoleculesTextQuery : public Dialog::TQuery<std::vector<const molecule *> > {
-public:
-  MoleculesTextQuery(Parameter<std::vector<const molecule *> > &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~MoleculesTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::StringTextQuery : public Dialog::TQuery<std::string> {
-public:
-  StringTextQuery(Parameter<std::string> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~StringTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::StringsTextQuery : public Dialog::TQuery<std::vector<std::string> > {
-public:
-  StringsTextQuery(Parameter<std::vector<std::string> > &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~StringsTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::UnsignedIntTextQuery : public Dialog::TQuery<unsigned int> {
-public:
-  UnsignedIntTextQuery(Parameter<unsigned int> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~UnsignedIntTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::UnsignedIntsTextQuery : public Dialog::TQuery<std::vector<unsigned int> > {
-public:
-  UnsignedIntsTextQuery(Parameter<std::vector<unsigned int> > &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~UnsignedIntsTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::VectorTextQuery : public Dialog::TQuery<Vector> {
-public:
-  VectorTextQuery(Parameter<Vector> &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~VectorTextQuery();
-  virtual bool handle();
-};
-
-class TextDialog::VectorsTextQuery : public Dialog::TQuery<std::vector<Vector> > {
-public:
-  VectorsTextQuery(Parameter<std::vector<Vector> > &, const std::string &_title, const std::string &_description = NULL);
-  virtual ~VectorsTextQuery();
-  virtual bool handle();
-};
 
 #endif /* TEXTQUERY_HPP_ */
