summaryrefslogtreecommitdiffstats
path: root/part/dcopiface_part_ro.h
blob: 0d73f1d720308b54c3a012c674daa5155d374493 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/***************************************************************************
                          dcopiface_part_ro.h  -  description
                             -------------------
    begin                : Tue Oct 23 2001
    copyright            : (C) 2001, 2002, 2003 by The KXMLEditor Team
    email                : lvanek@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef DCOPIFACE_PART_RO_H
#define DCOPIFACE_PART_RO_H

#include <dcopobject.h>


class KXMLEditorPart;
	/**
	* Allows perform action on represetntaion of XML file via DCOP protocol.
	* behavies as interface to @ref KXMLEditorPart and to it adresses most of requestests received by DCOP
	*
	*@see KXMLEditorPart
	*
	*@short Read only DCOP interface for XML document Kpart based kxmleditor.
	*
	*@author The KXMLEditor Team (matkor@users.sourceforge.net)
	**/

class KXMLEditorPartIfaceReadOnly
	:virtual public DCOPObject
{
	K_DCOP

protected:
	/** @ref KXMLEditorPart which Iface represensts **/
	KXMLEditorPart * m_pKXEPart;

public:
	/**
	* Default constructor
	*
	* @param kxe_part Specifies on what @ref KXMLEditorPart will interface operate.
	**/
	KXMLEditorPartIfaceReadOnly(KXMLEditorPart * kxe_part,const char * dcop_name = "KXMLEditorPartIface")
		: DCOPObject(dcop_name)
	{
		m_pKXEPart = kxe_part;
	}
	virtual ~KXMLEditorPartIfaceReadOnly()
		{};
k_dcop:
	/**
	* Saves document as file
	*
	* @returns Error description or empty string if file succesfully saved.
	**/

  TQString saveAsFile(const TQString & path_to_file);

	/** Tries to change current node
	* @param pathToNode Path to new node
	* @returns Empty string if selection OK otherwise error description
	**/
	TQString selectNode(const TQString & pathToNode);

	/** Returns path to current node
	* @returns If error empty string
	**/
	TQString currentNode() const;

};



	/**
	*@short Read/Write DCOP inteface for Kpart based kxmleditor.
	*@author The KXMLEditor Team
	**/
//
class KXMLEditorPartIfaceReadWrite
	:public KXMLEditorPartIfaceReadOnly
{
	K_DCOP
	/**
	* Default constructor
	*
	* @param kxe_part Specifies on what @ref KXMLEditorPart will interface operate.
	**/
public:
	KXMLEditorPartIfaceReadWrite(KXMLEditorPart * kxe_part,const char * dcop_name = "KXMLEditorPartIface")
		: DCOPObject(dcop_name)
		,KXMLEditorPartIfaceReadOnly(kxe_part,dcop_name)
		{}
	virtual ~KXMLEditorPartIfaceReadWrite()
		{};
k_dcop:

	/**
	* Opens given file
	*
	* @returns Error description or empty string if file succesfully loaded.
	**/
	TQString openURL(const TQString & szURL);

	/**
	* Closes object behind interface.
	* In curent implementation it means closing entire KXMLEditor.
	*
	* @returns Error description or empty string if program closed.
	**/
	TQString close();


};


#endif // DCOPIFACE_PART_RO_H