/* Overrides Comparable.compareTo */
/* Need to throw an exception when exp2 cannot be cast to OOOElement*/
int retval=0;
try{
XTextRange range1 = this.getTextRange();
XTextRange range2 = ((OOOElement)exp2).getTextRange();
XText text1 = range1.getText();
XText text2 = range2.getText();
String cellName1 = getCellName(range1);
String cellName2 = getCellName(range2);
XTextTable table1=getTable(range1);
XTextTable table2=getTable(range2);
Logger.getLogger("com.CompPad").log(Level.FINE,"range1 "+range1+" range2 "+range2);
Logger.getLogger("com.CompPad").log(Level.FINE,"cellName1 "+cellName1+" cellName2 "+cellName2);
Logger.getLogger("com.CompPad").log(Level.FINE,"table1 "+table1+" table2 "+table2);
if (text1 == text2){
// the formulas are in different parts of the same XText,
// either the main XText or else in the same cell in a table.
Logger.getLogger("com.CompPad").log(Level.FINE,"text1 "+range1.getText()+" text2 "+range2.getText());
Logger.getLogger("com.CompPad").log(Level.FINE,"range1 "+range1+" range2 "+range2);
XTextRangeCompare xTRC = (XTextRangeCompare)
UnoRuntime.queryInterface(XTextRangeCompare.class,
range1.getText());
retval = xTRC.compareRegionStarts(range2, range1);