summaryrefslogtreecommitdiffstats
path: root/interfaces/ktexteditor/editinterface.cpp
blob: 095c44ba9baccbf6ca0d73c783466ddb70929487 (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
#include "editinterface.h"
#include "editdcopinterface.h"
#include "document.h"

using namespace KTextEditor;

namespace KTextEditor
{
  class PrivateEditInterface
  {
  public:
    PrivateEditInterface()
    {
    interface = 0;
    }
    ~PrivateEditInterface(){}
  // Data Members
  EditDCOPInterface *interface;
  };

}

uint EditInterface::globalEditInterfaceNumber = 0;

EditInterface::EditInterface()
{
  d = new PrivateEditInterface();
  globalEditInterfaceNumber++;
  myEditInterfaceNumber = globalEditInterfaceNumber;
  QString name = "EditInterface#" + QString::number(myEditInterfaceNumber);
  d->interface = new EditDCOPInterface(this, name.latin1());
}

EditInterface::~EditInterface()
{
  delete d->interface;
  delete d;
}

uint EditInterface::editInterfaceNumber () const
{
  return myEditInterfaceNumber;
}

void EditInterface::setEditInterfaceDCOPSuffix (const QCString &suffix)
{
  d->interface->setObjId ("EditInterface#"+suffix);
}

EditInterface *KTextEditor::editInterface (Document *doc)
{                    
  if (!doc)
    return 0;

  return static_cast<EditInterface*>(doc->qt_cast("KTextEditor::EditInterface"));
}