summaryrefslogtreecommitdiffstats
path: root/quanta/dialogs/tagdialogs/tagdialog.h
blob: c715085f080e6a0bf4d4ee35d5e8a782ae710ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/***************************************************************************
                          tagdialog.h  -  description
                             -------------------
    begin                : Sat Apr 1 2000
    copyright            : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <pdima@mail.univ.kiev.ua>
                           (C) 2002-2003 by Andras Mantia <amantia@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TAGDIALOG_H
#define TAGDIALOG_H

#include <tqwidget.h>
#include <tqtabdialog.h>
#include <tqdict.h>
#include <tqstrlist.h>

#include "resource.h"

/**class for insert/edit tags
  *@author Yacovlev Alexander & Dmitry Poplavsky & Andras Mantia
  */

class Document;
class TagWidget;
class Tagxml;
class QTag;
class Tag;
class KURL;
class TQShowEvent;

class TagDialog : public TQTabDialog  {
   Q_OBJECT

public:
  /**
    constructor: edit tag if "tag" == 0L or insert new tag if tag != 0L
    attr format: "attr1='value1' attr2='value2'..."
    insertInLine :
        true : <a></a>
        false: <a>
               </a>

  */
  TagDialog(QTag* dtdTag, Tag* tag, KURL a_baseURL = KURL());
  TagDialog(QTag* dtdTag, Tag* tag, const TQString& selection, KURL a_baseURL = KURL());
  TagDialog(QTag* dtdTag, TQString attrs=TQString::null, KURL a_baseURL = KURL());
  TagDialog(QTag* dtdTag, const TQString& selection, TQString attrs=TQString::null, KURL a_baseURL = KURL());
  ~TagDialog();
  /** Insert an attribute to dict*/
  void insertAttribute(TQString *attr, TQString *value);
  /**  */
  void parseTag();
  /** returen doc path */
  KURL baseURL();


  /** Return the attributes in TQDict<TQString> format*/
  TQDict<TQString> * getAttributes();
  /** Return all the attributes in one string*/
  TQString getAttributeString();
  /**Return the value of the attribute specified by attr. */
  TQString getAttribute(const TQString& attr);
  /** Insert the new tag into the Document*/
  void insertTag(Document *w, bool insertInLine = true);
  /** build and return the new Node.*/
  Node *buildNode(Document *w);

public:

  TQWidget *mainDlg;

  TQDict<TQString> *dict;
  KURL m_baseURL;

public slots: // Public slots
  void slotAccept();

protected slots:
  virtual void showEvent(TQShowEvent *ev);

private:
  bool deleteTag;
  Tag *m_tag;
  QTag* dtdTag;
  TQString m_selection;

  TQPtrList<Tagxml> *extraPageList;

  void init(QTag* dtdTag, KURL a_baseURL);
  void parseAttributes(const TQString &attrs);
};

#endif