summaryrefslogtreecommitdiffstats
path: root/interfaces/ktexteditor/selectioninterface.cpp
blob: d568881d44ae4ac8d16deac84d54c781b0355fd8 (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
#include "selectioninterface.h"
#include "selectiondcopinterface.h"
#include "document.h"
#include "view.h"

using namespace KTextEditor;

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

}

unsigned int SelectionInterface::globalSelectionInterfaceNumber = 0;

SelectionInterface::SelectionInterface()
{
	d = new PrivateSelectionInterface();
	globalSelectionInterfaceNumber++;
        mySelectionInterfaceNumber = globalSelectionInterfaceNumber;
	QString name = "SelectionInterface#" + QString::number(mySelectionInterfaceNumber);
	 d->interface = new SelectionDCOPInterface(this, name.latin1());
}
SelectionInterface::~SelectionInterface()
{
  delete d->interface;
  delete d;
}

unsigned int SelectionInterface::selectionInterfaceNumber () const
{
  return mySelectionInterfaceNumber;
}

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

SelectionInterface *KTextEditor::selectionInterface (Document *doc)
{
  if (!doc)
    return 0;

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

SelectionInterface *KTextEditor::selectionInterface (View *view)
{
  if (!view)
    return 0;

  return static_cast<SelectionInterface*>(view->qt_cast("KTextEditor::SelectionInterface"));
}