/***************************************************************************
                            kde_Range.cpp -  description
                             -------------------
    begin                : Wed Feb  6 15:12:26 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Feb  6 15:12:26 2002, using kalyptus 0.9.
 ***************************************************************************/

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

extern "C" {
#include "kde_Range.h"
}

#include <dom/dom2_range.h>

class RangeBridge : public DOM::Range
{
public:
	RangeBridge() : Range() {}
	RangeBridge(const DOM::Document rootContainer) : Range(rootContainer) {}
	RangeBridge(const Range& other) : Range(other) {}
	RangeBridge(const DOM::Node startContainer, const long startOffset, const DOM::Node endContainer, const long endOffset) : Range(startContainer, startOffset, endContainer, endOffset) {}
	~RangeBridge() {}
};

kde_Range * kde_new_Range(){
	return (kde_Range *) new RangeBridge();
}
kde_Range * kde_new_Range1(kde_Document* rootContainer){
	return (kde_Range *) new RangeBridge((DOM::Document)* (DOM::Document*)rootContainer);
}
kde_Range * kde_new_Range2(kde_Range* other){
	return (kde_Range *) new RangeBridge((DOM::Range&)* (DOM::Range*)other);
}
kde_Range * kde_new_Range3(kde_DOMNode* startContainer, long startOffset, kde_DOMNode* endContainer, long endOffset){
	return (kde_Range *) new RangeBridge((DOM::Node)* (DOM::Node*)startContainer, (long)startOffset, (DOM::Node)* (DOM::Node*)endContainer, (long)endOffset);
}
void kde_del_Range( kde_Range* p ){
	delete (RangeBridge*) p;
}
kde_DOMNode* kde_Range_startContainer( kde_Range* instPointer){
	return (kde_DOMNode*)new DOM::Node(((RangeBridge*)instPointer)->startContainer());
}
long kde_Range_startOffset( kde_Range* instPointer){
	return (long) ((RangeBridge*)instPointer)->startOffset();
}
kde_DOMNode* kde_Range_endContainer( kde_Range* instPointer){
	return (kde_DOMNode*)new DOM::Node(((RangeBridge*)instPointer)->endContainer());
}
long kde_Range_endOffset( kde_Range* instPointer){
	return (long) ((RangeBridge*)instPointer)->endOffset();
}
int kde_Range_collapsed( kde_Range* instPointer){
	return (int) ((RangeBridge*)instPointer)->collapsed();
}
kde_DOMNode* kde_Range_commonAncestorContainer( kde_Range* instPointer){
	return (kde_DOMNode*)new DOM::Node(((RangeBridge*)instPointer)->commonAncestorContainer());
}
void kde_Range_setStart( kde_Range* instPointer,kde_DOMNode* refNode, long offset){
	((RangeBridge*)instPointer)->setStart((DOM::Node&)* (DOM::Node*)refNode, (long)offset);
	return;
}
void kde_Range_setEnd( kde_Range* instPointer,kde_DOMNode* refNode, long offset){
	((RangeBridge*)instPointer)->setEnd((DOM::Node&)* (DOM::Node*)refNode, (long)offset);
	return;
}
void kde_Range_setStartBefore( kde_Range* instPointer,kde_DOMNode* refNode){
	((RangeBridge*)instPointer)->setStartBefore((DOM::Node&)* (DOM::Node*)refNode);
	return;
}
void kde_Range_setStartAfter( kde_Range* instPointer,kde_DOMNode* refNode){
	((RangeBridge*)instPointer)->setStartAfter((DOM::Node&)* (DOM::Node*)refNode);
	return;
}
void kde_Range_setEndBefore( kde_Range* instPointer,kde_DOMNode* refNode){
	((RangeBridge*)instPointer)->setEndBefore((DOM::Node&)* (DOM::Node*)refNode);
	return;
}
void kde_Range_setEndAfter( kde_Range* instPointer,kde_DOMNode* refNode){
	((RangeBridge*)instPointer)->setEndAfter((DOM::Node&)* (DOM::Node*)refNode);
	return;
}
void kde_Range_collapse( kde_Range* instPointer,int toStart){
	((RangeBridge*)instPointer)->collapse((bool)toStart);
	return;
}
void kde_Range_selectNode( kde_Range* instPointer,kde_DOMNode* refNode){
	((RangeBridge*)instPointer)->selectNode((DOM::Node&)* (DOM::Node*)refNode);
	return;
}
void kde_Range_selectNodeContents( kde_Range* instPointer,kde_DOMNode* refNode){
	((RangeBridge*)instPointer)->selectNodeContents((DOM::Node&)* (DOM::Node*)refNode);
	return;
}
short kde_Range_compareBoundaryPoints( kde_Range* instPointer,int how, kde_Range* sourceRange){
	return (short) ((RangeBridge*)instPointer)->compareBoundaryPoints((DOM::Range::CompareHow)how, (DOM::Range&)* (DOM::Range*)sourceRange);
}
int kde_Range_boundaryPointsValid( kde_Range* instPointer){
	return (int) ((RangeBridge*)instPointer)->boundaryPointsValid();
}
void kde_Range_deleteContents( kde_Range* instPointer){
	((RangeBridge*)instPointer)->deleteContents();
	return;
}
kde_DocumentFragment* kde_Range_extractContents( kde_Range* instPointer){
	return (kde_DocumentFragment*)new DOM::DocumentFragment(((RangeBridge*)instPointer)->extractContents());
}
kde_DocumentFragment* kde_Range_cloneContents( kde_Range* instPointer){
	return (kde_DocumentFragment*)new DOM::DocumentFragment(((RangeBridge*)instPointer)->cloneContents());
}
void kde_Range_insertNode( kde_Range* instPointer,kde_DOMNode* newNode){
	((RangeBridge*)instPointer)->insertNode((DOM::Node&)* (DOM::Node*)newNode);
	return;
}
void kde_Range_surroundContents( kde_Range* instPointer,kde_DOMNode* newParent){
	((RangeBridge*)instPointer)->surroundContents((DOM::Node&)* (DOM::Node*)newParent);
	return;
}
kde_Range* kde_Range_cloneRange( kde_Range* instPointer){
	return (kde_Range*)new DOM::Range(((RangeBridge*)instPointer)->cloneRange());
}
kde_DOMString* kde_Range_toString( kde_Range* instPointer){
	return (kde_DOMString*)new DOM::DOMString(((RangeBridge*)instPointer)->toString());
}
kde_DOMString* kde_Range_toHTML( kde_Range* instPointer){
	return (kde_DOMString*)new DOM::DOMString(((RangeBridge*)instPointer)->toHTML());
}
void kde_Range_detach( kde_Range* instPointer){
	((RangeBridge*)instPointer)->detach();
	return;
}
int kde_Range_isDetached( kde_Range* instPointer){
	return (int) ((RangeBridge*)instPointer)->isDetached();
}
//kde_RangeImpl* kde_Range_handle( kde_Range* instPointer){
//	return (kde_RangeImpl*) ((RangeBridge*)instPointer)->handle();
//}
int kde_Range_isNull( kde_Range* instPointer){
	return (int) ((RangeBridge*)instPointer)->isNull();
}
