summaryrefslogtreecommitdiffstats
path: root/quanta/components/csseditor/csseditor.h
blob: fa9e333954e6c3847c40fa5301c7d56f089807dd (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/***************************************************************************
                          csseditor.h  -  description
                             -------------------
    begin                : mer lug 23 11:20:17 CEST 2003
    copyright            : (C) 2003 by gulmini luciano    
    email                : gulmini.luciano@student.unife.it
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 CSSEDITOR_H
#define CSSEDITOR_H

#include <tqwidget.h>
#include "csseditors.h"
#include <tqdom.h>
#include <tqmap.h>
#include <tqlistview.h>
#include <tqsignal.h>

class propertySetter;
class TDEConfig;
class KHTMLPart;
class TQListViewItem;
class TQDomNodeList;
class TQVariant;
class TQMyHighlighter;


class myCheckListItem : public TQCheckListItem
{
  private:
    TQSignal *m_sig;
    unsigned int m_checkedChildren;

  public :
    myCheckListItem(TQCheckListItem * parent, const TQString & text);
    myCheckListItem(TQListView * parent, const TQString & text);
    ~myCheckListItem();
    void connect( TQObject *receiver, const char *member );
    void addCheckedChild();

  protected :
    virtual void activate();
    virtual void stateChange (bool);
};

/** CSSEditor is the base class of the project */
class CSSEditor : public CSSEditorS
{
  Q_OBJECT
  
  private:
    TQMyHighlighter *m_myhi;
    propertySetter *m_ps;
    myCheckListItem *m_currentProp;
    KHTMLPart *m_previewer;
    TQDomDocument m_doc;
    TQMap<TQString,TQString> m_properties;
    TQString m_selectorName,
                 m_initialProperties,
                 m_Selectors,
                 m_Header,
                 m_Footer,
                 
                 m_InlineStyleContent,
                 m_externalStyleSheetDefinition,
                 m_fileToPreview;
           
    bool m_isFileToPreviewExternal;                              
    TDEConfig *m_config;
     
            //sourceFileName;   
   
    void Connect();
    void appendSub(TQDomNodeList, myCheckListItem *);
    void buildListView(TQDomNodeList, TQListView *);
    void updateDisplay();    
    void activatePreview();
    void setCurrentPropOn(const TQString& s);
    void addProperty(const TQString& property, const TQString& value) { m_properties[property] = value; }
    void addAndSetPropertyOn(const TQString& property, const TQString& value);
    void setSidesOfPropertyBorderOn(const TQString& s);

  private slots:
    void checkProperty(const TQString&);   
    void removeProperty(const TQVariant&); 
    void updatePreview();
    void setMiniEditors(TQListViewItem*);
    void toggleShortendForm();
    
  public:
    
    CSSEditor(TQWidget* parent=0, const char *name=0): CSSEditorS(parent, name), m_config(0L){}
    CSSEditor( TQListViewItem * i, TQWidget* parent=0, const char *name=0);
    ~CSSEditor(); 
    void initialize();
    void setSelectors( const TQString& s) { m_Selectors = s; }
    void setHeader( const TQString& s) { m_Header = s; }
    void setFooter( const TQString& s) { m_Footer = s;}
    void setInlineStyleContent( const TQString& s){ m_InlineStyleContent = s; }
    TQString generateProperties();
    void hidePreviewer();
    void setFileToPreview(const TQString& s,bool b) { m_fileToPreview = s; m_isFileToPreviewExternal = b;}                                                                         
    void setExternalStyleSheetDefinition(const TQString& s) { m_externalStyleSheetDefinition = s;}

  signals:
    void signalUpdatePreview();
};

#endif