summaryrefslogtreecommitdiffstats
path: root/interfaces/ktexteditor/searchinterface.cpp
blob: 738567e8762dd922bfc1ef2ee4a449d1271439de (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
#include "searchinterface.h"
#include "searchdcopinterface.h"
#include "document.h"

using namespace KTextEditor;

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

}

unsigned int SearchInterface::globalSearchInterfaceNumber = 0;

SearchInterface::SearchInterface()
{
	d = new PrivateSearchInterface();
	globalSearchInterfaceNumber++;
	mySearchInterfaceNumber=globalSearchInterfaceNumber;
        QString name = "SearchInterface#" + QString::number(mySearchInterfaceNumber);
	 d->interface = new SearchDCOPInterface(this, name.latin1());
}
SearchInterface::~SearchInterface()
{
  delete d->interface;
  delete d;
}

unsigned int SearchInterface::searchInterfaceNumber () const
{
  return mySearchInterfaceNumber;
}

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

SearchInterface *KTextEditor::searchInterface (Document *doc)
{  
  if (!doc)
    return 0;

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