1 /************************************************************************
2 **
3 **  Copyright (C) 2015-2019 Kevin B. Hendricks, Stratford Ontario Canada
4 **  Copyright (C) 2009-2011 Strahinja Markovic  <strahinja.markovic@gmail.com>
5 **
6 **  This file is part of Sigil.
7 **
8 **  Sigil is free software: you can redistribute it and/or modify
9 **  it under the terms of the GNU General Public License as published by
10 **  the Free Software Foundation, either version 3 of the License, or
11 **  (at your option) any later version.
12 **
13 **  Sigil is distributed in the hope that it will be useful,
14 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 **  GNU General Public License for more details.
17 **
18 **  You should have received a copy of the GNU General Public License
19 **  along with Sigil.  If not, see <http://www.gnu.org/licenses/>.
20 **
21 *************************************************************************/
22 
23 #pragma once
24 #ifndef XMLTAB_H
25 #define XMLTAB_H
26 
27 #include "Tabs/TextTab.h"
28 #include "Tabs/WellFormedContent.h"
29 
30 class XMLResource;
31 class WellFormedCheckComponent;
32 
33 
34 class XMLTab : public TextTab, public WellFormedContent
35 {
36     Q_OBJECT
37 
38 public:
39 
40     XMLTab(XMLResource *resource,
41            int line_to_scroll_to = -1,
42            int position_to_scroll_to = -1,
43            QWidget *parent = 0);
44 
45     ~XMLTab();
46 
47     void ScrollToLine(int line);
48 
49     void ScrollToPosition(int cursor_position);
50 
51     virtual void AutoFixWellFormedErrors();
52 
53     void TakeControlOfUI();
54 
55     QString GetFilename();
56 
57     QString GetShortPathName();
58 
59 public slots:
60 
61     bool IsDataWellFormed();
62 
63 private:
64 
65     void ConnectSignalsToSlots();
66 
67 
68     ///////////////////////////////
69     // PRIVATE MEMBER VARIABLES
70     ///////////////////////////////
71 
72     XMLResource *m_XMLResource;
73 
74     /**
75      * The component used to display a dialog about
76      * well-formedness errors.
77      */
78     WellFormedCheckComponent *m_WellFormedCheckComponent;
79 };
80 
81 #endif // XMLTAB_H
82