summaryrefslogtreecommitdiffstats
path: root/interfaces/tdetexteditor/selectioninterface.cpp
blob: 0a8dc6b0044935d4898d69d45f92e7b8864b10e7 (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;
	TQString name = "SelectionInterface#" + TQString::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 TQCString &suffix)
{
  d->interface->setObjId ("SelectionInterface#"+suffix);
}

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

  return dynamic_cast<KTextEditor::SelectionInterface*>(doc);
}

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

  return dynamic_cast<KTextEditor::SelectionInterface*>(view);
}