1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released      *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission.     *
5  ******************************************************************************************************/
6 
7 #ifndef DOCUMENT_MODEL_EXPORT_FORMAT_H
8 #define DOCUMENT_MODEL_EXPORT_FORMAT_H
9 
10 #include "DocumentModelAbstractBase.h"
11 #include "ExportDelimiter.h"
12 #include "ExportHeader.h"
13 #include "ExportLayoutFunctions.h"
14 #include "ExportPointsIntervalUnits.h"
15 #include "ExportPointsSelectionFunctions.h"
16 #include "ExportPointsSelectionRelations.h"
17 #include <QStringList>
18 
19 class Document;
20 class QTextStream;
21 
22 /// Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
23 class DocumentModelExportFormat : public DocumentModelAbstractBase
24 {
25 public:
26   /// Default constructor.
27   DocumentModelExportFormat();
28 
29   /// Initial constructor from Document.
30   DocumentModelExportFormat(const Document &document);
31 
32   /// Copy constructor.
33   DocumentModelExportFormat(const DocumentModelExportFormat &other);
34 
35   /// Assignment constructor.
36   DocumentModelExportFormat &operator=(const DocumentModelExportFormat &other);
37 
38   /// Get method for curve names not exported.
39   QStringList curveNamesNotExported() const;
40 
41   /// Get method for delimiter.
42   ExportDelimiter delimiter() const;
43 
44   /// Get methods for extrapolation.
45   bool extrapolateOutsideEndpoints() const;
46 
47   /// Get method for header.
48   ExportHeader header() const;
49 
50   /// Get method for functions layout.
51   ExportLayoutFunctions layoutFunctions() const;
52 
53   virtual void loadXml(QXmlStreamReader &reader);
54 
55   /// Get method for csv/tsv format override
56   bool overrideCsvTsv () const;
57 
58   /// Get method for points interval for functions.
59   double pointsIntervalFunctions () const;
60 
61   /// Get method for relations interval for relations
62   double pointsIntervalRelations () const;
63 
64   /// Get method for points interval units for functions.
65   ExportPointsIntervalUnits pointsIntervalUnitsFunctions () const;
66 
67   /// Get method for points interval units for relations.
68   ExportPointsIntervalUnits pointsIntervalUnitsRelations () const;
69 
70   /// Get method for point selection for functions.
71   ExportPointsSelectionFunctions pointsSelectionFunctions() const;
72 
73   /// Get method for point selection for relations.
74   ExportPointsSelectionRelations pointsSelectionRelations() const;
75 
76   /// Debugging method that supports print method of this class and printStream method of some other class(es)
77   void printStream (QString indentation,
78                     QTextStream &str) const;
79 
80   virtual void saveXml(QXmlStreamWriter &writer) const;
81 
82   /// Set method for curve names not exported.
83   void setCurveNamesNotExported(const QStringList &curveNamesNotExported);
84 
85   /// Set method for delimiter.
86   void setDelimiter(ExportDelimiter exportDelimiter);
87 
88   /// Set methods for extrapolation.
89   void setExtrapolateOutsideEndpoints (bool extrapolateOutsideEndpoints);
90 
91   /// Set method for header.
92   void setHeader(ExportHeader exportHeader);
93 
94   /// Set method for functions layout.
95   void setLayoutFunctions(ExportLayoutFunctions exportLayoutFunctions);
96 
97   /// Set method for csv/tsv format override
98   void setOverrideCsvTsv (bool overrideCsvTsv);
99 
100   /// Set method for points interval for functions
101   void setPointsIntervalFunctions (double pointsIntervalFunctions);
102 
103   /// Set method for relations interval for relations
104   void setPointsIntervalRelations (double pointsIntervalRelations);
105 
106   /// Set method for points interval units for functions
107   void setPointsIntervalUnitsFunctions (ExportPointsIntervalUnits pointsIntervalUnitsFunctions);
108 
109   /// Set method for points interval units for relations
110   void setPointsIntervalUnitsRelations (ExportPointsIntervalUnits pointsIntervalUnitsRelations);
111 
112   /// Set method for point selection for functions.
113   void setPointsSelectionFunctions(ExportPointsSelectionFunctions exportPointsSelectionFunctions);
114 
115   /// Set method for point selection for relations.
116   void setPointsSelectionRelations(ExportPointsSelectionRelations exportPointsSelectionRelations);
117 
118   /// Set method for x label.
119   void setXLabel (const QString &xLabel);
120 
121   /// Get method for x label.
122   QString xLabel () const;
123 
124 private:
125 
126   // Curves to be excluded from export. New curves will not appear in this so they will be exported by default.
127   QStringList m_curveNamesNotExported;
128 
129   ExportPointsSelectionFunctions m_pointsSelectionFunctions;
130   double m_pointsIntervalFunctions;
131   ExportPointsIntervalUnits m_pointsIntervalUnitsFunctions;
132   ExportPointsSelectionRelations m_pointsSelectionRelations;
133   double m_pointsIntervalRelations;
134   ExportPointsIntervalUnits m_pointsIntervalUnitsRelations;
135   ExportLayoutFunctions m_layoutFunctions;
136   ExportDelimiter m_delimiter;
137   bool m_extrapolateOutsideEndpoints;
138   bool m_overrideCsvTsv;
139   ExportHeader m_header;
140   QString m_xLabel;
141 };
142 
143 #endif // DOCUMENT_MODEL_EXPORT_FORMAT_H
144