summaryrefslogtreecommitdiffstats
path: root/parts/astyle/astyle_part.h
blob: f5a794856f256974723aef4473ae8b5e355c8112 (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
/*
 *  Copyright (C) 2001 Matthias H�zer-Klpfel <mhk@caldera.de>
 */


#ifndef __KDEVPART_ASTYLE_H__
#define __KDEVPART_ASTYLE_H__

class KDialogBase;
#include <kdevsourceformatter.h>
#include <tdeaction.h>
#include <tdeparts/part.h>
#include <kdevplugin.h>
#include <kdebug.h>
#include <tqmap.h>
#include <tqvariant.h>

class AStyleWidget;
class TQPopupMenu;
class Context;
class ConfigWidgetProxy;

class AStylePart : public KDevSourceFormatter
{
  Q_OBJECT
  

public:

  AStylePart(TQObject *parent, const char *name, const TQStringList &);
  ~AStylePart();

  TQString formatSource(const TQString text, AStyleWidget * widget, const TQStringVariantMap& options);
  virtual TQString formatSource(const TQString text);
  TQString indentString() const;
  void saveGlobal();
  void setExtensions(TQString ext, bool global);
  TQString getProjectExtensions();
  TQString getGlobalExtensions();
  void restorePartialProjectSession(const TQDomElement * el);
  void savePartialProjectSession(TQDomElement * el);

  TQStringVariantMap& getProjectOptions(){return m_project;}
  TQStringVariantMap& getGlobalOptions(){return m_global;}


private slots:

  void activePartChanged(KParts::Part *part);
  void beautifySource();
  void formatFiles();
  void formatFilesSelect();
  void insertConfigWidget(const KDialogBase *dlg, TQWidget *page, unsigned int pageNo);
  void contextMenu(TQPopupMenu *popup, const Context *context);

private:

  void cursorPos( KParts::Part *part, uint * col, uint * line );
  void setCursorPos( KParts::Part *part, uint col, uint line );

  void loadGlobal();

  ConfigWidgetProxy *m_configProxy;
  TDEAction *formatTextAction;
  TDEAction *formatFileAction;

  // the configurable options.
  TQStringVariantMap  m_project;
  TQStringVariantMap m_global;
  TQStringList m_projectExtensions;
  TQStringList m_globalExtensions;
  TQMap<TQString, TQString> m_searchExtensions;
  KURL::List m_urls;
};


#endif