Kaydet (Commit) 531a052b authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Java5 update - convert to use generics

Change-Id: Ie9d9b278341132d08477d015245fedf2b66f62fd
üst 8aa97e36
...@@ -61,7 +61,7 @@ public class AccessibleRelationSet { ...@@ -61,7 +61,7 @@ public class AccessibleRelationSet {
try { try {
firstrelation = set.getRelation(0).RelationType; firstrelation = set.getRelation(0).RelationType;
Object oTmp = set.getRelation(0).TargetSet[0]; Object oTmp = set.getRelation(0).TargetSet[0];
atarget = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp); atarget = UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
} catch (IndexOutOfBoundsException e) { } catch (IndexOutOfBoundsException e) {
fail("Exception when getting relations "+e); fail("Exception when getting relations "+e);
} }
...@@ -72,7 +72,7 @@ public class AccessibleRelationSet { ...@@ -72,7 +72,7 @@ public class AccessibleRelationSet {
types[firstrelation]); types[firstrelation]);
XAccessibleText paraTxt2 = XAccessibleText paraTxt2 =
(XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, para2); UnoRuntime.queryInterface(XAccessibleText.class, para2);
assertEquals( assertEquals(
"didn't gain correct target paragraph", atarget.getText(), "didn't gain correct target paragraph", atarget.getText(),
paraTxt2.getText()); paraTxt2.getText());
...@@ -92,13 +92,13 @@ public class AccessibleRelationSet { ...@@ -92,13 +92,13 @@ public class AccessibleRelationSet {
if ( tmprelation == 1 ) if ( tmprelation == 1 )
{ {
Object oTmp = set.getRelation(0).TargetSet[0]; Object oTmp = set.getRelation(0).TargetSet[0];
atargets[0] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp); atargets[0] = UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
relationtypes[0] = tmprelation; relationtypes[0] = tmprelation;
} }
else if ( tmprelation == 2 ) else if ( tmprelation == 2 )
{ {
Object oTmp = set.getRelation(0).TargetSet[0]; Object oTmp = set.getRelation(0).TargetSet[0];
atargets[1] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp); atargets[1] = UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
relationtypes[1] = tmprelation; relationtypes[1] = tmprelation;
} }
else else
...@@ -109,13 +109,13 @@ public class AccessibleRelationSet { ...@@ -109,13 +109,13 @@ public class AccessibleRelationSet {
if ( tmprelation == 1 ) if ( tmprelation == 1 )
{ {
Object oTmp = set.getRelation(1).TargetSet[0]; Object oTmp = set.getRelation(1).TargetSet[0];
atargets[0] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp); atargets[0] = UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
relationtypes[0] = tmprelation; relationtypes[0] = tmprelation;
} }
else if ( tmprelation == 2 ) else if ( tmprelation == 2 )
{ {
Object oTmp = set.getRelation(1).TargetSet[0]; Object oTmp = set.getRelation(1).TargetSet[0];
atargets[1] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp); atargets[1] = UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
relationtypes[1] = tmprelation; relationtypes[1] = tmprelation;
} }
else else
...@@ -132,7 +132,7 @@ public class AccessibleRelationSet { ...@@ -132,7 +132,7 @@ public class AccessibleRelationSet {
types[relationtypes[0]]); types[relationtypes[0]]);
XAccessibleText paraTxt1 = XAccessibleText paraTxt1 =
(XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, para1); UnoRuntime.queryInterface(XAccessibleText.class, para1);
assertEquals( assertEquals(
"didn't gain correct target paragraph", atargets[0].getText(), "didn't gain correct target paragraph", atargets[0].getText(),
paraTxt1.getText()); paraTxt1.getText());
...@@ -142,7 +142,7 @@ public class AccessibleRelationSet { ...@@ -142,7 +142,7 @@ public class AccessibleRelationSet {
types[relationtypes[1]]); types[relationtypes[1]]);
XAccessibleText paraTxt3 = XAccessibleText paraTxt3 =
(XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, para3); UnoRuntime.queryInterface(XAccessibleText.class, para3);
assertEquals( assertEquals(
"didn't gain correct target paragraph", atargets[1].getText(), "didn't gain correct target paragraph", atargets[1].getText(),
paraTxt3.getText()); paraTxt3.getText());
...@@ -167,8 +167,7 @@ public class AccessibleRelationSet { ...@@ -167,8 +167,7 @@ public class AccessibleRelationSet {
oCursor, ControlCharacter.PARAGRAPH_BREAK, false ); oCursor, ControlCharacter.PARAGRAPH_BREAK, false );
} }
XModel aModel = (XModel) XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc);
UnoRuntime.queryInterface(XModel.class, xTextDoc);
AccessibilityTools at = new AccessibilityTools(); AccessibilityTools at = new AccessibilityTools();
...@@ -187,8 +186,7 @@ public class AccessibleRelationSet { ...@@ -187,8 +186,7 @@ public class AccessibleRelationSet {
} }
public XAccessibleRelationSet getAccessibleRelation(XAccessible xAcc) { public XAccessibleRelationSet getAccessibleRelation(XAccessible xAcc) {
XAccessibleContext oObj = (XAccessibleContext) XAccessibleContext oObj = UnoRuntime.queryInterface(XAccessibleContext.class, xAcc);
UnoRuntime.queryInterface(XAccessibleContext.class, xAcc);
XAccessibleRelationSet set = oObj.getAccessibleRelationSet(); XAccessibleRelationSet set = oObj.getAccessibleRelationSet();
return set; return set;
......
...@@ -49,15 +49,15 @@ public class CheckChangeColor { ...@@ -49,15 +49,15 @@ public class CheckChangeColor {
*/ */
@Test public void checkChangeColor() throws Exception { @Test public void checkChangeColor() throws Exception {
// create a supplier to get the Style family collection // create a supplier to get the Style family collection
XStyleFamiliesSupplier xSupplier = ( XStyleFamiliesSupplier ) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, document); XStyleFamiliesSupplier xSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, document);
// get the NameAccess interface from the Style family collection // get the NameAccess interface from the Style family collection
XNameAccess xNameAccess = xSupplier.getStyleFamilies(); XNameAccess xNameAccess = xSupplier.getStyleFamilies();
XNameContainer xPageStyleCollection = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xNameAccess.getByName( "PageStyles" )); XNameContainer xPageStyleCollection = UnoRuntime.queryInterface(XNameContainer.class, xNameAccess.getByName( "PageStyles" ));
// create a PropertySet to set the properties for the new Pagestyle // create a PropertySet to set the properties for the new Pagestyle
XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Standard") ); XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Standard") );
assertEquals( assertEquals(
"BackColor", new Any(Type.LONG, 0xFFFFFFFF), "BackColor", new Any(Type.LONG, 0xFFFFFFFF),
......
...@@ -54,8 +54,7 @@ public class CheckIndeterminateState { ...@@ -54,8 +54,7 @@ public class CheckIndeterminateState {
* The used tools are in project qadevOOo/runner * The used tools are in project qadevOOo/runner
*/ */
@Test public void checkToolBoxItem() throws Exception { @Test public void checkToolBoxItem() throws Exception {
XModel aModel = (XModel) XModel aModel = UnoRuntime.queryInterface(XModel.class, document);
UnoRuntime.queryInterface(XModel.class, document);
XController xController = aModel.getCurrentController(); XController xController = aModel.getCurrentController();
...@@ -78,8 +77,7 @@ public class CheckIndeterminateState { ...@@ -78,8 +77,7 @@ public class CheckIndeterminateState {
AccessibleRole.TOGGLE_BUTTON, "Bold"); AccessibleRole.TOGGLE_BUTTON, "Bold");
assertNotNull("Found a TOGGLE_BUTTON", oObj); assertNotNull("Found a TOGGLE_BUTTON", oObj);
XAccessibleContext oContext = (XAccessibleContext) XAccessibleContext oContext = UnoRuntime.queryInterface(XAccessibleContext.class, oObj);
UnoRuntime.queryInterface(XAccessibleContext.class, oObj);
XAccessibleStateSet oSet = oContext.getAccessibleStateSet(); XAccessibleStateSet oSet = oContext.getAccessibleStateSet();
......
...@@ -63,13 +63,13 @@ class BookmarkHashes { ...@@ -63,13 +63,13 @@ class BookmarkHashes {
throws com.sun.star.uno.Exception, java.security.NoSuchAlgorithmException throws com.sun.star.uno.Exception, java.security.NoSuchAlgorithmException
{ {
StringBuffer buffer = new StringBuffer(""); StringBuffer buffer = new StringBuffer("");
XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier)UnoRuntime.queryInterface( XBookmarksSupplier xBookmarksSupplier = UnoRuntime.queryInterface(
XBookmarksSupplier.class, XBookmarksSupplier.class,
xDoc); xDoc);
XNameAccess xBookmarks = xBookmarksSupplier.getBookmarks(); XNameAccess xBookmarks = xBookmarksSupplier.getBookmarks();
for(String sBookmarkname : xBookmarks.getElementNames()) { for(String sBookmarkname : xBookmarks.getElementNames()) {
Object xBookmark = xBookmarks.getByName(sBookmarkname); Object xBookmark = xBookmarks.getByName(sBookmarkname);
XTextContent xBookmarkAsContent = (XTextContent)UnoRuntime.queryInterface( XTextContent xBookmarkAsContent = UnoRuntime.queryInterface(
XTextContent.class, XTextContent.class,
xBookmark); xBookmark);
buffer.append(sBookmarkname); buffer.append(sBookmarkname);
...@@ -152,7 +152,7 @@ public class CheckBookmarks { ...@@ -152,7 +152,7 @@ public class CheckBookmarks {
throws com.sun.star.uno.Exception throws com.sun.star.uno.Exception
{ {
XText xText = m_xDoc.getText(); XText xText = m_xDoc.getText();
XSimpleText xSimpleText = (XSimpleText)UnoRuntime.queryInterface( XSimpleText xSimpleText = UnoRuntime.queryInterface(
XSimpleText.class, XSimpleText.class,
xText); xText);
for(int nPara=0; nPara<10; ++nPara) { for(int nPara=0; nPara<10; ++nPara) {
...@@ -165,7 +165,7 @@ public class CheckBookmarks { ...@@ -165,7 +165,7 @@ public class CheckBookmarks {
xWordCrsr.setString(" "); xWordCrsr.setString(" ");
} }
XTextCursor xParaCrsr = xText.createTextCursor(); XTextCursor xParaCrsr = xText.createTextCursor();
XTextRange xParaCrsrAsRange = (XTextRange)UnoRuntime.queryInterface( XTextRange xParaCrsrAsRange = UnoRuntime.queryInterface(
XTextRange.class, XTextRange.class,
xParaCrsr); xParaCrsr);
xText.insertControlCharacter(xParaCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false); xText.insertControlCharacter(xParaCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
...@@ -203,7 +203,7 @@ public class CheckBookmarks { ...@@ -203,7 +203,7 @@ public class CheckBookmarks {
XTextCursor xCrsr = m_xDoc.getText().createTextCursor(); XTextCursor xCrsr = m_xDoc.getText().createTextCursor();
for(int i=0; i<30; i++) { for(int i=0; i<30; i++) {
xCrsr.goRight((short)rnd.nextInt(300), false); xCrsr.goRight((short)rnd.nextInt(300), false);
XTextRange xCrsrAsRange = (XTextRange)UnoRuntime.queryInterface( XTextRange xCrsrAsRange = UnoRuntime.queryInterface(
XTextRange.class, XTextRange.class,
xCrsr); xCrsr);
xText.insertControlCharacter(xCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false); xText.insertControlCharacter(xCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
...@@ -213,16 +213,16 @@ public class CheckBookmarks { ...@@ -213,16 +213,16 @@ public class CheckBookmarks {
private void insertBookmark(XTextCursor crsr, String name, String content) private void insertBookmark(XTextCursor crsr, String name, String content)
throws com.sun.star.uno.Exception throws com.sun.star.uno.Exception
{ {
XMultiServiceFactory xDocFactory = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory xDocFactory = UnoRuntime.queryInterface(
XMultiServiceFactory.class, XMultiServiceFactory.class,
m_xDoc); m_xDoc);
Object xBookmark = xDocFactory.createInstance("com.sun.star.text.Bookmark"); Object xBookmark = xDocFactory.createInstance("com.sun.star.text.Bookmark");
XTextContent xBookmarkAsTextContent = (XTextContent)UnoRuntime.queryInterface( XTextContent xBookmarkAsTextContent = UnoRuntime.queryInterface(
XTextContent.class, XTextContent.class,
xBookmark); xBookmark);
crsr.setString(content); crsr.setString(content);
XNamed xBookmarkAsNamed = (XNamed)UnoRuntime.queryInterface( XNamed xBookmarkAsNamed = UnoRuntime.queryInterface(
XNamed.class, XNamed.class,
xBookmark); xBookmark);
xBookmarkAsNamed.setName(name); xBookmarkAsNamed.setName(name);
...@@ -241,7 +241,7 @@ public class CheckBookmarks { ...@@ -241,7 +241,7 @@ public class CheckBookmarks {
aStoreProperties[0].Value = true; aStoreProperties[0].Value = true;
aStoreProperties[1].Name = "FilterName"; aStoreProperties[1].Name = "FilterName";
aStoreProperties[1].Value = sFilter; aStoreProperties[1].Value = sFilter;
XStorable xStorable = (XStorable)UnoRuntime.queryInterface( XStorable xStorable = UnoRuntime.queryInterface(
XStorable.class, XStorable.class,
m_xDoc); m_xDoc);
xStorable.storeToURL(sFileUrl, aStoreProperties); xStorable.storeToURL(sFileUrl, aStoreProperties);
......
...@@ -45,12 +45,12 @@ public class CheckCrossReferences { ...@@ -45,12 +45,12 @@ public class CheckCrossReferences {
if ( xPortionEnum != null ) { if ( xPortionEnum != null ) {
while ( xPortionEnum.hasMoreElements() ) { while ( xPortionEnum.hasMoreElements() ) {
com.sun.star.beans.XPropertySet xPortionProps = com.sun.star.beans.XPropertySet xPortionProps =
(com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class , xPortionEnum.nextElement()); com.sun.star.beans.XPropertySet.class , xPortionEnum.nextElement());
final String sPortionType = final String sPortionType =
xPortionProps.getPropertyValue( "TextPortionType" ).toString(); xPortionProps.getPropertyValue( "TextPortionType" ).toString();
if ( sPortionType.equals( "TextField") ) { if ( sPortionType.equals( "TextField") ) {
com.sun.star.text.XTextField xField = (com.sun.star.text.XTextField)UnoRuntime.queryInterface( com.sun.star.text.XTextField xField = UnoRuntime.queryInterface(
com.sun.star.text.XTextField.class, com.sun.star.text.XTextField.class,
xPortionProps.getPropertyValue( "TextField" ) ); xPortionProps.getPropertyValue( "TextField" ) );
assertNotNull("Cannot retrieve next field.", xField); assertNotNull("Cannot retrieve next field.", xField);
...@@ -61,17 +61,17 @@ public class CheckCrossReferences { ...@@ -61,17 +61,17 @@ public class CheckCrossReferences {
while ( xParaEnum.hasMoreElements() ) { while ( xParaEnum.hasMoreElements() ) {
com.sun.star.container.XEnumerationAccess aPara = com.sun.star.container.XEnumerationAccess aPara =
(com.sun.star.container.XEnumerationAccess)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.container.XEnumerationAccess.class, xParaEnum.nextElement()); com.sun.star.container.XEnumerationAccess.class, xParaEnum.nextElement());
xPortionEnum = aPara.createEnumeration(); xPortionEnum = aPara.createEnumeration();
while ( xPortionEnum.hasMoreElements() ) { while ( xPortionEnum.hasMoreElements() ) {
com.sun.star.beans.XPropertySet xPortionProps = com.sun.star.beans.XPropertySet xPortionProps =
(com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class , xPortionEnum.nextElement()); com.sun.star.beans.XPropertySet.class , xPortionEnum.nextElement());
final String sPortionType = final String sPortionType =
xPortionProps.getPropertyValue( "TextPortionType" ).toString(); xPortionProps.getPropertyValue( "TextPortionType" ).toString();
if ( sPortionType.equals( "TextField") ) { if ( sPortionType.equals( "TextField") ) {
com.sun.star.text.XTextField xField = (com.sun.star.text.XTextField)UnoRuntime.queryInterface( com.sun.star.text.XTextField xField = UnoRuntime.queryInterface(
com.sun.star.text.XTextField.class, com.sun.star.text.XTextField.class,
xPortionProps.getPropertyValue( "TextField" ) ); xPortionProps.getPropertyValue( "TextField" ) );
assertNotNull("Cannot retrieve next field.", xField); assertNotNull("Cannot retrieve next field.", xField);
...@@ -87,7 +87,7 @@ public class CheckCrossReferences { ...@@ -87,7 +87,7 @@ public class CheckCrossReferences {
public com.sun.star.beans.XPropertySet getFieldProps( public com.sun.star.beans.XPropertySet getFieldProps(
com.sun.star.text.XTextField xField ) { com.sun.star.text.XTextField xField ) {
com.sun.star.beans.XPropertySet xProps = com.sun.star.beans.XPropertySet xProps =
(com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xField ); com.sun.star.beans.XPropertySet.class, xField );
assertNotNull("Cannot retrieve field properties.", xProps); assertNotNull("Cannot retrieve field properties.", xProps);
...@@ -116,7 +116,7 @@ public class CheckCrossReferences { ...@@ -116,7 +116,7 @@ public class CheckCrossReferences {
// setup paragraph enumeration // setup paragraph enumeration
{ {
com.sun.star.container.XEnumerationAccess xParaEnumAccess = com.sun.star.container.XEnumerationAccess xParaEnumAccess =
(com.sun.star.container.XEnumerationAccess)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.container.XEnumerationAccess.class, document.getText()); com.sun.star.container.XEnumerationAccess.class, document.getText());
xParaEnum = xParaEnumAccess.createEnumeration(); xParaEnum = xParaEnumAccess.createEnumeration();
} }
...@@ -124,9 +124,9 @@ public class CheckCrossReferences { ...@@ -124,9 +124,9 @@ public class CheckCrossReferences {
// get field refresher // get field refresher
{ {
com.sun.star.text.XTextFieldsSupplier xFieldSupp = com.sun.star.text.XTextFieldsSupplier xFieldSupp =
(com.sun.star.text.XTextFieldsSupplier)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.text.XTextFieldsSupplier.class, document); com.sun.star.text.XTextFieldsSupplier.class, document);
xFldsRefresh = (com.sun.star.util.XRefreshable)UnoRuntime.queryInterface( xFldsRefresh = UnoRuntime.queryInterface(
com.sun.star.util.XRefreshable.class, xFieldSupp.getTextFields()); com.sun.star.util.XRefreshable.class, xFieldSupp.getTextFields());
} }
...@@ -195,14 +195,14 @@ public class CheckCrossReferences { ...@@ -195,14 +195,14 @@ public class CheckCrossReferences {
{ {
// restart paragraph enumeration // restart paragraph enumeration
com.sun.star.container.XEnumerationAccess xParaEnumAccess = com.sun.star.container.XEnumerationAccess xParaEnumAccess =
(com.sun.star.container.XEnumerationAccess)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.container.XEnumerationAccess.class, document.getText()); com.sun.star.container.XEnumerationAccess.class, document.getText());
xParaEnum = xParaEnumAccess.createEnumeration(); xParaEnum = xParaEnumAccess.createEnumeration();
// iterate on the paragraphs to find certain paragraph to insert the bookmark // iterate on the paragraphs to find certain paragraph to insert the bookmark
com.sun.star.text.XTextRange xParaTextRange = null; com.sun.star.text.XTextRange xParaTextRange = null;
while ( xParaEnum.hasMoreElements() ) { while ( xParaEnum.hasMoreElements() ) {
xParaTextRange = (com.sun.star.text.XTextRange)UnoRuntime.queryInterface( xParaTextRange = UnoRuntime.queryInterface(
com.sun.star.text.XTextRange.class, xParaEnum.nextElement()); com.sun.star.text.XTextRange.class, xParaEnum.nextElement());
if ( xParaTextRange.getString().equals( "J" ) ) { if ( xParaTextRange.getString().equals( "J" ) ) {
break; break;
...@@ -216,16 +216,16 @@ public class CheckCrossReferences { ...@@ -216,16 +216,16 @@ public class CheckCrossReferences {
xParaTextRange); xParaTextRange);
// insert bookmark // insert bookmark
XMultiServiceFactory xFac = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory xFac = UnoRuntime.queryInterface(
XMultiServiceFactory.class, document); XMultiServiceFactory.class, document);
final String cBookmarkName = "__RefNumPara__47114711"; final String cBookmarkName = "__RefNumPara__47114711";
com.sun.star.text.XTextContent xBookmark = com.sun.star.text.XTextContent xBookmark =
(com.sun.star.text.XTextContent)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.text.XTextContent.class, com.sun.star.text.XTextContent.class,
xFac.createInstance( "com.sun.star.text.Bookmark" ) ); xFac.createInstance( "com.sun.star.text.Bookmark" ) );
if ( xBookmark != null ) { if ( xBookmark != null ) {
com.sun.star.container.XNamed xName = com.sun.star.container.XNamed xName =
(com.sun.star.container.XNamed)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.container.XNamed.class, xBookmark ); com.sun.star.container.XNamed.class, xBookmark );
xName.setName( cBookmarkName ); xName.setName( cBookmarkName );
xBookmark.attach(xParaTextRange.getStart()); xBookmark.attach(xParaTextRange.getStart());
...@@ -233,18 +233,18 @@ public class CheckCrossReferences { ...@@ -233,18 +233,18 @@ public class CheckCrossReferences {
// insert reference field, which references the inserted bookmark // insert reference field, which references the inserted bookmark
com.sun.star.text.XTextContent xNewField = com.sun.star.text.XTextContent xNewField =
(com.sun.star.text.XTextContent)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.text.XTextContent.class, com.sun.star.text.XTextContent.class,
xFac.createInstance( "com.sun.star.text.TextField.GetReference" ) ); xFac.createInstance( "com.sun.star.text.TextField.GetReference" ) );
if ( xNewField != null ) { if ( xNewField != null ) {
com.sun.star.beans.XPropertySet xFieldProps = com.sun.star.beans.XPropertySet xFieldProps =
(com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.beans.XPropertySet.class, xNewField ); com.sun.star.beans.XPropertySet.class, xNewField );
xFieldProps.setPropertyValue( "ReferenceFieldPart", new Short(com.sun.star.text.ReferenceFieldPart.TEXT) ); xFieldProps.setPropertyValue( "ReferenceFieldPart", new Short(com.sun.star.text.ReferenceFieldPart.TEXT) );
xFieldProps.setPropertyValue( "ReferenceFieldSource", new Short(com.sun.star.text.ReferenceFieldSource.BOOKMARK) ); xFieldProps.setPropertyValue( "ReferenceFieldSource", new Short(com.sun.star.text.ReferenceFieldSource.BOOKMARK) );
xFieldProps.setPropertyValue( "SourceName", cBookmarkName ); xFieldProps.setPropertyValue( "SourceName", cBookmarkName );
com.sun.star.text.XTextRange xFieldTextRange = com.sun.star.text.XTextRange xFieldTextRange =
(com.sun.star.text.XTextRange)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.text.XTextRange.class, xParaEnum.nextElement()); com.sun.star.text.XTextRange.class, xParaEnum.nextElement());
xNewField.attach(xFieldTextRange.getEnd()); xNewField.attach(xFieldTextRange.getEnd());
xFldsRefresh.refresh(); xFldsRefresh.refresh();
...@@ -252,7 +252,7 @@ public class CheckCrossReferences { ...@@ -252,7 +252,7 @@ public class CheckCrossReferences {
// check inserted reference field // check inserted reference field
com.sun.star.text.XTextField xField = com.sun.star.text.XTextField xField =
(com.sun.star.text.XTextField)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.text.XTextField.class, xNewField ); com.sun.star.text.XTextField.class, xNewField );
assertEquals( "inserted reference field doesn't has correct field result", assertEquals( "inserted reference field doesn't has correct field result",
"J", xField.getPresentation( false ) ); "J", xField.getPresentation( false ) );
......
...@@ -105,11 +105,9 @@ public class CheckFields ...@@ -105,11 +105,9 @@ public class CheckFields
String file = TestDocument.getUrl("fdo39694.ott"); String file = TestDocument.getUrl("fdo39694.ott");
XComponent xComp = util.DesktopTools.loadDoc(m_xMSF, file, loadProps); XComponent xComp = util.DesktopTools.loadDoc(m_xMSF, file, loadProps);
XTextDocument xTextDoc = (XTextDocument) XTextDocument xTextDoc = UnoRuntime.queryInterface(XTextDocument.class, xComp);
UnoRuntime.queryInterface(XTextDocument.class, xComp);
XTextFieldsSupplier xTFS = (XTextFieldsSupplier) XTextFieldsSupplier xTFS = UnoRuntime.queryInterface(XTextFieldsSupplier.class, xComp);
UnoRuntime.queryInterface(XTextFieldsSupplier.class, xComp);
XEnumeration xEnum = xTFS.getTextFields().createEnumeration(); XEnumeration xEnum = xTFS.getTextFields().createEnumeration();
Set<String> placeholders = new HashSet<String>(); Set<String> placeholders = new HashSet<String>();
placeholders.add("<Kadr1>"); placeholders.add("<Kadr1>");
...@@ -123,12 +121,10 @@ public class CheckFields ...@@ -123,12 +121,10 @@ public class CheckFields
while (xEnum.hasMoreElements()) while (xEnum.hasMoreElements())
{ {
Object xField = xEnum.nextElement(); Object xField = xEnum.nextElement();
XServiceInfo xSI = (XServiceInfo) XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, xField);
UnoRuntime.queryInterface(XServiceInfo.class, xField);
if (xSI.supportsService("com.sun.star.text.TextField.JumpEdit")) if (xSI.supportsService("com.sun.star.text.TextField.JumpEdit"))
{ {
XTextContent xContent = (XTextContent) XTextContent xContent = UnoRuntime.queryInterface(XTextContent.class, xField);
UnoRuntime.queryInterface(XTextContent.class, xField);
XTextRange xAnchor = xContent.getAnchor(); XTextRange xAnchor = xContent.getAnchor();
String readContent = xAnchor.getString(); String readContent = xAnchor.getString();
if (!placeholders.remove(readContent)) if (!placeholders.remove(readContent))
...@@ -139,7 +135,7 @@ public class CheckFields ...@@ -139,7 +135,7 @@ public class CheckFields
} }
} }
assertTrue(placeholders.isEmpty()); assertTrue(placeholders.isEmpty());
XCloseable xClos = (XCloseable) UnoRuntime.queryInterface( XCloseable xClos = UnoRuntime.queryInterface(
XCloseable.class, xComp); XCloseable.class, xComp);
if (xClos != null) { if (xClos != null) {
xClos.close(true); xClos.close(true);
...@@ -149,19 +145,16 @@ public class CheckFields ...@@ -149,19 +145,16 @@ public class CheckFields
@Test @Test
public void test_fdo42073() throws Exception public void test_fdo42073() throws Exception
{ {
XMultiServiceFactory xDocFactory = (XMultiServiceFactory) XMultiServiceFactory xDocFactory = UnoRuntime.queryInterface(XMultiServiceFactory.class, m_xDoc);
UnoRuntime.queryInterface(XMultiServiceFactory.class, m_xDoc);
Object xField = Object xField =
xDocFactory.createInstance("com.sun.star.text.TextField.Input"); xDocFactory.createInstance("com.sun.star.text.TextField.Input");
XText xBodyText = m_xDoc.getText(); XText xBodyText = m_xDoc.getText();
XTextCursor xCursor = xBodyText.createTextCursor(); XTextCursor xCursor = xBodyText.createTextCursor();
XTextField xTextField = (XTextField) XTextField xTextField = UnoRuntime.queryInterface(XTextField.class, xField);
UnoRuntime.queryInterface(XTextField.class, xField);
xBodyText.insertTextContent(xCursor, xTextField, true); xBodyText.insertTextContent(xCursor, xTextField, true);
XPropertySet xPropSet = (XPropertySet) XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xField);
UnoRuntime.queryInterface(XPropertySet.class, xField);
{ {
Object readContent = xPropSet.getPropertyValue("Content"); Object readContent = xPropSet.getPropertyValue("Content");
assertEquals("", readContent); assertEquals("", readContent);
......
...@@ -41,15 +41,15 @@ public class CheckFlies { ...@@ -41,15 +41,15 @@ public class CheckFlies {
@Test public void checkFlies() @Test public void checkFlies()
throws com.sun.star.uno.Exception throws com.sun.star.uno.Exception
{ {
com.sun.star.text.XTextFramesSupplier xTFS = (com.sun.star.text.XTextFramesSupplier)UnoRuntime.queryInterface( com.sun.star.text.XTextFramesSupplier xTFS = UnoRuntime.queryInterface(
com.sun.star.text.XTextFramesSupplier.class, com.sun.star.text.XTextFramesSupplier.class,
document); document);
checkTextFrames(xTFS); checkTextFrames(xTFS);
com.sun.star.text.XTextGraphicObjectsSupplier xTGOS = (com.sun.star.text.XTextGraphicObjectsSupplier)UnoRuntime.queryInterface( com.sun.star.text.XTextGraphicObjectsSupplier xTGOS = UnoRuntime.queryInterface(
com.sun.star.text.XTextGraphicObjectsSupplier.class, com.sun.star.text.XTextGraphicObjectsSupplier.class,
document); document);
checkGraphicFrames(xTGOS); checkGraphicFrames(xTGOS);
com.sun.star.text.XTextEmbeddedObjectsSupplier xTEOS = (com.sun.star.text.XTextEmbeddedObjectsSupplier)UnoRuntime.queryInterface( com.sun.star.text.XTextEmbeddedObjectsSupplier xTEOS = UnoRuntime.queryInterface(
com.sun.star.text.XTextEmbeddedObjectsSupplier.class, com.sun.star.text.XTextEmbeddedObjectsSupplier.class,
document); document);
checkEmbeddedFrames(xTEOS); checkEmbeddedFrames(xTEOS);
...@@ -86,7 +86,7 @@ public class CheckFlies { ...@@ -86,7 +86,7 @@ public class CheckFlies {
"Has nonexisting embedded frame", "Has nonexisting embedded frame",
xEmbeddedFrames.hasByName("Nonexisting embedded frame")); xEmbeddedFrames.hasByName("Nonexisting embedded frame"));
com.sun.star.container.XIndexAccess xEmbeddedFramesIdx = (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface( com.sun.star.container.XIndexAccess xEmbeddedFramesIdx = UnoRuntime.queryInterface(
com.sun.star.container.XIndexAccess.class, com.sun.star.container.XIndexAccess.class,
xEmbeddedFrames); xEmbeddedFrames);
assertEquals( assertEquals(
...@@ -129,7 +129,7 @@ public class CheckFlies { ...@@ -129,7 +129,7 @@ public class CheckFlies {
"Has nonexisting graphics frame", "Has nonexisting graphics frame",
xGraphicFrames.hasByName("Nonexisting graphics frame")); xGraphicFrames.hasByName("Nonexisting graphics frame"));
com.sun.star.container.XIndexAccess xGraphicFramesIdx = (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface( com.sun.star.container.XIndexAccess xGraphicFramesIdx = UnoRuntime.queryInterface(
com.sun.star.container.XIndexAccess.class, com.sun.star.container.XIndexAccess.class,
xGraphicFrames); xGraphicFrames);
assertEquals( assertEquals(
...@@ -173,7 +173,7 @@ public class CheckFlies { ...@@ -173,7 +173,7 @@ public class CheckFlies {
"Has nonexisting text frame.", "Has nonexisting text frame.",
xTextFrames.hasByName("Nonexisting text frame")); xTextFrames.hasByName("Nonexisting text frame"));
com.sun.star.container.XIndexAccess xTextFramesIdx = (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface( com.sun.star.container.XIndexAccess xTextFramesIdx = UnoRuntime.queryInterface(
com.sun.star.container.XIndexAccess.class, com.sun.star.container.XIndexAccess.class,
xTextFrames); xTextFrames);
assertEquals( assertEquals(
......
...@@ -86,8 +86,7 @@ public class LoadSaveTest ...@@ -86,8 +86,7 @@ public class LoadSaveTest
XMultiServiceFactory.class, m_xContext.getServiceManager()); XMultiServiceFactory.class, m_xContext.getServiceManager());
Object oGEB = m_xMSF.createInstance( Object oGEB = m_xMSF.createInstance(
"com.sun.star.frame.GlobalEventBroadcaster"); "com.sun.star.frame.GlobalEventBroadcaster");
m_xGEB = (XDocumentEventBroadcaster) m_xGEB = UnoRuntime.queryInterface(XDocumentEventBroadcaster.class, oGEB);
UnoRuntime.queryInterface(XDocumentEventBroadcaster.class, oGEB);
assertNotNull("could not get global event broadcaster.", m_xGEB); assertNotNull("could not get global event broadcaster.", m_xGEB);
m_TmpDir = util.utils.getOfficeTemp/*Dir*/(m_xMSF); m_TmpDir = util.utils.getOfficeTemp/*Dir*/(m_xMSF);
System.out.println("tempdir: " + m_TmpDir); System.out.println("tempdir: " + m_TmpDir);
...@@ -145,7 +144,7 @@ public class LoadSaveTest ...@@ -145,7 +144,7 @@ public class LoadSaveTest
System.out.println("Storing document: " + fileName + " ..."); System.out.println("Storing document: " + fileName + " ...");
XStorable xStor = (XStorable) UnoRuntime.queryInterface( XStorable xStor = UnoRuntime.queryInterface(
XStorable.class, xDoc); XStorable.class, xDoc);
String targetFile = m_fileURL + m_TargetDir + fileName; String targetFile = m_fileURL + m_TargetDir + fileName;
......
...@@ -443,8 +443,8 @@ class FuzzyTester ...@@ -443,8 +443,8 @@ class FuzzyTester
{ {
assertEquals("__ROOT__", expected.getType()); assertEquals("__ROOT__", expected.getType());
assertEquals("__ROOT__", actual.getType()); assertEquals("__ROOT__", actual.getType());
m_StackExpected.push(new Pair(expected, expected.createEnumeration())); m_StackExpected.push(new Pair<TreeNode, TreeNodeEnum>(expected, expected.createEnumeration()));
m_StackActual.push(new Pair(actual, actual.createEnumeration())); m_StackActual.push(new Pair<TreeNode, TreeNodeEnum>(actual, actual.createEnumeration()));
do { do {
traverse(m_StackExpected, m_BufferExpected); traverse(m_StackExpected, m_BufferExpected);
traverse(m_StackActual, m_BufferActual); traverse(m_StackActual, m_BufferActual);
...@@ -477,7 +477,7 @@ class FuzzyTester ...@@ -477,7 +477,7 @@ class FuzzyTester
buffer.add(node); buffer.add(node);
TreeNodeEnum nodeEnum = node.createEnumeration(); TreeNodeEnum nodeEnum = node.createEnumeration();
if (nodeEnum.hasNext()) { if (nodeEnum.hasNext()) {
stack.push(new Pair(node, nodeEnum)); stack.push(new Pair<TreeNode, TreeNodeEnum>(node, nodeEnum));
} }
if (node.hasContent()) { if (node.hasContent()) {
if (!((node instanceof TextNode) // spurious empty text? if (!((node instanceof TextNode) // spurious empty text?
...@@ -632,10 +632,8 @@ class EnumConverter ...@@ -632,10 +632,8 @@ class EnumConverter
while (xEnum.hasMoreElements()) { while (xEnum.hasMoreElements()) {
TreeNode node; TreeNode node;
Object xElement = xEnum.nextElement(); Object xElement = xEnum.nextElement();
XTextRange xPortion = (XTextRange) XTextRange xPortion = UnoRuntime.queryInterface(XTextRange.class, xElement);
UnoRuntime.queryInterface(XTextRange.class, xElement); XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xPortion);
XPropertySet xPropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xPortion);
String type = (String) xPropSet.getPropertyValue("TextPortionType"); String type = (String) xPropSet.getPropertyValue("TextPortionType");
if (type.equals("Text")) { if (type.equals("Text")) {
String text = xPortion.getString(); String text = xPortion.getString();
...@@ -648,25 +646,21 @@ class EnumConverter ...@@ -648,25 +646,21 @@ class EnumConverter
} }
} else if (type.equals("TextField")) { } else if (type.equals("TextField")) {
Object xField = xPropSet.getPropertyValue("TextField"); Object xField = xPropSet.getPropertyValue("TextField");
XServiceInfo xService = (XServiceInfo) XServiceInfo xService = UnoRuntime.queryInterface(XServiceInfo.class, xField);
UnoRuntime.queryInterface(XServiceInfo.class, xField);
if (xService.supportsService( if (xService.supportsService(
"com.sun.star.text.textfield.MetadataField")) "com.sun.star.text.textfield.MetadataField"))
{ {
XMetadatable xMeta = (XMetadatable) XMetadatable xMeta = UnoRuntime.queryInterface(XMetadatable.class, xField);
UnoRuntime.queryInterface(XMetadatable.class, xField);
StringPair xmlid = xMeta.getMetadataReference(); StringPair xmlid = xMeta.getMetadataReference();
node = new MetaFieldNode(xmlid); node = new MetaFieldNode(xmlid);
m_Stack.push(node); m_Stack.push(node);
XEnumerationAccess xEA = (XEnumerationAccess) XEnumerationAccess xEA = UnoRuntime.queryInterface(XEnumerationAccess.class,
UnoRuntime.queryInterface(XEnumerationAccess.class,
xMeta); xMeta);
XEnumeration xEnumChildren = xEA.createEnumeration(); XEnumeration xEnumChildren = xEA.createEnumeration();
TreeNode node2 = convertChildren(xEnumChildren); TreeNode node2 = convertChildren(xEnumChildren);
assertSame("stack error: meta-field", node2, node); assertSame("stack error: meta-field", node2, node);
} else { } else {
XPropertySet xFieldPropSet = (XPropertySet) XPropertySet xFieldPropSet = UnoRuntime.queryInterface(XPropertySet.class, xField);
UnoRuntime.queryInterface(XPropertySet.class, xField);
String content = (String) String content = (String)
xFieldPropSet.getPropertyValue("Content"); xFieldPropSet.getPropertyValue("Content");
boolean isFixed = (Boolean) boolean isFixed = (Boolean)
...@@ -676,23 +670,19 @@ class EnumConverter ...@@ -676,23 +670,19 @@ class EnumConverter
} }
} else if (type.equals("Footnote")) { } else if (type.equals("Footnote")) {
Object xNote = xPropSet.getPropertyValue("Footnote"); Object xNote = xPropSet.getPropertyValue("Footnote");
XFootnote xFootnote = (XFootnote) XFootnote xFootnote = UnoRuntime.queryInterface(XFootnote.class, xNote);
UnoRuntime.queryInterface(XFootnote.class, xNote);
String label = xFootnote.getLabel(); String label = xFootnote.getLabel();
node = new FootnoteNode(label); node = new FootnoteNode(label);
} else if (type.equals("Frame")) { } else if (type.equals("Frame")) {
XContentEnumerationAccess xCEA = (XContentEnumerationAccess) XContentEnumerationAccess xCEA = UnoRuntime.queryInterface(XContentEnumerationAccess.class,
UnoRuntime.queryInterface(XContentEnumerationAccess.class,
xPortion); xPortion);
XEnumeration xContentEnum = xCEA.createContentEnumeration(""); XEnumeration xContentEnum = xCEA.createContentEnumeration("");
while (xContentEnum.hasMoreElements()) { while (xContentEnum.hasMoreElements()) {
Object xFrame = xContentEnum.nextElement(); Object xFrame = xContentEnum.nextElement();
XPropertySet xFramePropSet = (XPropertySet) XPropertySet xFramePropSet = UnoRuntime.queryInterface(XPropertySet.class, xFrame);
UnoRuntime.queryInterface(XPropertySet.class, xFrame);
TextContentAnchorType anchor = (TextContentAnchorType) TextContentAnchorType anchor = (TextContentAnchorType)
xFramePropSet.getPropertyValue("AnchorType"); xFramePropSet.getPropertyValue("AnchorType");
XNamed xNamed = (XNamed) XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xFrame);
UnoRuntime.queryInterface(XNamed.class, xFrame);
String name = xNamed.getName(); String name = xNamed.getName();
node = new FrameNode(name, anchor); node = new FrameNode(name, anchor);
m_Stack.peek().appendChild(node); m_Stack.peek().appendChild(node);
...@@ -704,11 +694,9 @@ class EnumConverter ...@@ -704,11 +694,9 @@ class EnumConverter
node = new ControlCharacterNode(c); node = new ControlCharacterNode(c);
} else if (type.equals("Bookmark")) { } else if (type.equals("Bookmark")) {
Object xMark = xPropSet.getPropertyValue("Bookmark"); Object xMark = xPropSet.getPropertyValue("Bookmark");
XNamed xNamed = (XNamed) XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xMark);
UnoRuntime.queryInterface(XNamed.class, xMark);
String name = xNamed.getName(); String name = xNamed.getName();
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xMark);
UnoRuntime.queryInterface(XMetadatable.class, xMark);
StringPair xmlid = xMetadatable.getMetadataReference(); StringPair xmlid = xMetadatable.getMetadataReference();
boolean isCollapsed = (Boolean) boolean isCollapsed = (Boolean)
xPropSet.getPropertyValue("IsCollapsed"); xPropSet.getPropertyValue("IsCollapsed");
...@@ -725,8 +713,7 @@ class EnumConverter ...@@ -725,8 +713,7 @@ class EnumConverter
} }
} else if (type.equals("ReferenceMark")) { } else if (type.equals("ReferenceMark")) {
Object xMark = xPropSet.getPropertyValue("ReferenceMark"); Object xMark = xPropSet.getPropertyValue("ReferenceMark");
XNamed xNamed = (XNamed) XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xMark);
UnoRuntime.queryInterface(XNamed.class, xMark);
String name = xNamed.getName(); String name = xNamed.getName();
boolean isCollapsed = (Boolean) boolean isCollapsed = (Boolean)
xPropSet.getPropertyValue("IsCollapsed"); xPropSet.getPropertyValue("IsCollapsed");
...@@ -743,8 +730,7 @@ class EnumConverter ...@@ -743,8 +730,7 @@ class EnumConverter
} }
} else if (type.equals("DocumentIndexMark")) { } else if (type.equals("DocumentIndexMark")) {
Object xMark = xPropSet.getPropertyValue("DocumentIndexMark"); Object xMark = xPropSet.getPropertyValue("DocumentIndexMark");
XPropertySet xMarkSet = (XPropertySet) XPropertySet xMarkSet = UnoRuntime.queryInterface(XPropertySet.class, xMark);
UnoRuntime.queryInterface(XPropertySet.class, xMark);
String name = (String) xMarkSet.getPropertyValue("PrimaryKey"); String name = (String) xMarkSet.getPropertyValue("PrimaryKey");
boolean isCollapsed = (Boolean) boolean isCollapsed = (Boolean)
xPropSet.getPropertyValue("IsCollapsed"); xPropSet.getPropertyValue("IsCollapsed");
...@@ -779,13 +765,11 @@ class EnumConverter ...@@ -779,13 +765,11 @@ class EnumConverter
} }
} else if (type.equals("InContentMetadata")) { } else if (type.equals("InContentMetadata")) {
Object xMeta = xPropSet.getPropertyValue("InContentMetadata"); Object xMeta = xPropSet.getPropertyValue("InContentMetadata");
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xMeta);
UnoRuntime.queryInterface(XMetadatable.class, xMeta);
StringPair xmlid = xMetadatable.getMetadataReference(); StringPair xmlid = xMetadatable.getMetadataReference();
node = new MetaNode(xmlid); node = new MetaNode(xmlid);
m_Stack.push(node); m_Stack.push(node);
XEnumerationAccess xEA = (XEnumerationAccess) XEnumerationAccess xEA = UnoRuntime.queryInterface(XEnumerationAccess.class, xMeta);
UnoRuntime.queryInterface(XEnumerationAccess.class, xMeta);
XEnumeration xEnumChildren = xEA.createEnumeration(); XEnumeration xEnumChildren = xEA.createEnumeration();
TreeNode node2 = convertChildren(xEnumChildren); TreeNode node2 = convertChildren(xEnumChildren);
assertSame("stack error: meta", node2, node); assertSame("stack error: meta", node2, node);
...@@ -810,12 +794,10 @@ abstract class Inserter ...@@ -810,12 +794,10 @@ abstract class Inserter
Inserter(XTextDocument xDoc) Inserter(XTextDocument xDoc)
{ {
m_xDocFactory = (XMultiServiceFactory) m_xDocFactory = UnoRuntime.queryInterface(XMultiServiceFactory.class, xDoc);
UnoRuntime.queryInterface(XMultiServiceFactory.class, xDoc);
m_xText = xDoc.getText(); m_xText = xDoc.getText();
XTextCursor xCursor = m_xText.createTextCursor(); XTextCursor xCursor = m_xText.createTextCursor();
m_xCursor = (XParagraphCursor) m_xCursor = UnoRuntime.queryInterface(XParagraphCursor.class, xCursor);
UnoRuntime.queryInterface(XParagraphCursor.class, xCursor);
} }
void initParagraph() throws Exception void initParagraph() throws Exception
...@@ -848,10 +830,8 @@ abstract class Inserter ...@@ -848,10 +830,8 @@ abstract class Inserter
{ {
Object xField = Object xField =
m_xDocFactory.createInstance("com.sun.star.text.textfield.Author"); m_xDocFactory.createInstance("com.sun.star.text.textfield.Author");
XTextContent xContent = (XTextContent) XTextContent xContent = UnoRuntime.queryInterface(XTextContent.class, xField);
UnoRuntime.queryInterface(XTextContent.class, xField); XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xField);
XPropertySet xPropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xField);
xPropSet.setPropertyValue("IsFixed", true); xPropSet.setPropertyValue("IsFixed", true);
xPropSet.setPropertyValue("FullName", false); xPropSet.setPropertyValue("FullName", false);
xPropSet.setPropertyValue("Content", content); xPropSet.setPropertyValue("Content", content);
...@@ -870,13 +850,10 @@ abstract class Inserter ...@@ -870,13 +850,10 @@ abstract class Inserter
{ {
Object xFrame = Object xFrame =
m_xDocFactory.createInstance("com.sun.star.text.TextFrame"); m_xDocFactory.createInstance("com.sun.star.text.TextFrame");
XTextContent xContent = (XTextContent) XTextContent xContent = UnoRuntime.queryInterface(XTextContent.class, xFrame);
UnoRuntime.queryInterface(XTextContent.class, xFrame); XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xFrame);
XPropertySet xPropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xFrame);
xPropSet.setPropertyValue("AnchorType", anchor); xPropSet.setPropertyValue("AnchorType", anchor);
XNamed xNamed = (XNamed) XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xContent);
UnoRuntime.queryInterface(XNamed.class, xContent);
xNamed.setName(name); xNamed.setName(name);
return xContent; return xContent;
} }
...@@ -891,10 +868,8 @@ abstract class Inserter ...@@ -891,10 +868,8 @@ abstract class Inserter
{ {
Object xNote = Object xNote =
m_xDocFactory.createInstance("com.sun.star.text.Footnote"); m_xDocFactory.createInstance("com.sun.star.text.Footnote");
XTextContent xContent = (XTextContent) XTextContent xContent = UnoRuntime.queryInterface(XTextContent.class, xNote);
UnoRuntime.queryInterface(XTextContent.class, xNote); XFootnote xFootnote = UnoRuntime.queryInterface(XFootnote.class, xNote);
XFootnote xFootnote = (XFootnote)
UnoRuntime.queryInterface(XFootnote.class, xNote);
xFootnote.setLabel(label); xFootnote.setLabel(label);
return xContent; return xContent;
} }
...@@ -906,8 +881,7 @@ abstract class Inserter ...@@ -906,8 +881,7 @@ abstract class Inserter
xContent.attach(xCursor); xContent.attach(xCursor);
if (!xmlid.First.equals("")) if (!xmlid.First.equals(""))
{ {
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xContent);
UnoRuntime.queryInterface(XMetadatable.class, xContent);
xMetadatable.setMetadataReference(xmlid); xMetadatable.setMetadataReference(xmlid);
} }
} }
...@@ -916,10 +890,8 @@ abstract class Inserter ...@@ -916,10 +890,8 @@ abstract class Inserter
{ {
Object xBookmark = Object xBookmark =
m_xDocFactory.createInstance("com.sun.star.text.Bookmark"); m_xDocFactory.createInstance("com.sun.star.text.Bookmark");
XTextContent xContent = (XTextContent) XTextContent xContent = UnoRuntime.queryInterface(XTextContent.class, xBookmark);
UnoRuntime.queryInterface(XTextContent.class, xBookmark); XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xContent);
XNamed xNamed = (XNamed)
UnoRuntime.queryInterface(XNamed.class, xContent);
xNamed.setName(name); xNamed.setName(name);
return xContent; return xContent;
} }
...@@ -934,10 +906,8 @@ abstract class Inserter ...@@ -934,10 +906,8 @@ abstract class Inserter
{ {
Object xMark = Object xMark =
m_xDocFactory.createInstance("com.sun.star.text.ReferenceMark"); m_xDocFactory.createInstance("com.sun.star.text.ReferenceMark");
XTextContent xContent = (XTextContent) XTextContent xContent = UnoRuntime.queryInterface(XTextContent.class, xMark);
UnoRuntime.queryInterface(XTextContent.class, xMark); XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xContent);
XNamed xNamed = (XNamed)
UnoRuntime.queryInterface(XNamed.class, xContent);
xNamed.setName(name); xNamed.setName(name);
return xContent; return xContent;
} }
...@@ -953,25 +923,21 @@ abstract class Inserter ...@@ -953,25 +923,21 @@ abstract class Inserter
{ {
Object xMark = Object xMark =
m_xDocFactory.createInstance("com.sun.star.text.DocumentIndexMark"); m_xDocFactory.createInstance("com.sun.star.text.DocumentIndexMark");
XTextContent xContent = (XTextContent) XTextContent xContent = UnoRuntime.queryInterface(XTextContent.class, xMark);
UnoRuntime.queryInterface(XTextContent.class, xMark); XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xMark);
XPropertySet xPropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xMark);
xPropSet.setPropertyValue("PrimaryKey", key); xPropSet.setPropertyValue("PrimaryKey", key);
return xContent; return xContent;
} }
void insertHyperlink(XTextCursor xCursor, String url) throws Exception void insertHyperlink(XTextCursor xCursor, String url) throws Exception
{ {
XPropertySet xPropSet = (XPropertySet) XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xCursor);
UnoRuntime.queryInterface(XPropertySet.class, xCursor);
xPropSet.setPropertyValue("HyperLinkURL", url); xPropSet.setPropertyValue("HyperLinkURL", url);
} }
void insertRuby(XTextCursor xCursor, String rubytext) throws Exception void insertRuby(XTextCursor xCursor, String rubytext) throws Exception
{ {
XPropertySet xPropSet = (XPropertySet) XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xCursor);
UnoRuntime.queryInterface(XPropertySet.class, xCursor);
xPropSet.setPropertyValue("RubyText", rubytext); xPropSet.setPropertyValue("RubyText", rubytext);
} }
...@@ -980,8 +946,7 @@ abstract class Inserter ...@@ -980,8 +946,7 @@ abstract class Inserter
{ {
XTextContent xContent = makeMeta(); XTextContent xContent = makeMeta();
xContent.attach(xCursor); xContent.attach(xCursor);
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xContent);
UnoRuntime.queryInterface(XMetadatable.class, xContent);
xMetadatable.setMetadataReference(xmlid); xMetadatable.setMetadataReference(xmlid);
return xContent; return xContent;
} }
...@@ -990,8 +955,7 @@ abstract class Inserter ...@@ -990,8 +955,7 @@ abstract class Inserter
{ {
Object xMeta = m_xDocFactory.createInstance( Object xMeta = m_xDocFactory.createInstance(
"com.sun.star.text.InContentMetadata"); "com.sun.star.text.InContentMetadata");
XTextContent xContent = (XTextContent) XTextContent xContent = UnoRuntime.queryInterface(XTextContent.class, xMeta);
UnoRuntime.queryInterface(XTextContent.class, xMeta);
return xContent; return xContent;
} }
...@@ -1000,8 +964,7 @@ abstract class Inserter ...@@ -1000,8 +964,7 @@ abstract class Inserter
{ {
XTextField xContent = makeMetaField(); XTextField xContent = makeMetaField();
xContent.attach(xCursor); xContent.attach(xCursor);
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xContent);
UnoRuntime.queryInterface(XMetadatable.class, xContent);
xMetadatable.setMetadataReference(xmlid); xMetadatable.setMetadataReference(xmlid);
return xContent; return xContent;
} }
...@@ -1010,8 +973,7 @@ abstract class Inserter ...@@ -1010,8 +973,7 @@ abstract class Inserter
{ {
Object xMeta = m_xDocFactory.createInstance( Object xMeta = m_xDocFactory.createInstance(
"com.sun.star.text.textfield.MetadataField"); "com.sun.star.text.textfield.MetadataField");
XTextField xContent = (XTextField) XTextField xContent = UnoRuntime.queryInterface(XTextField.class, xMeta);
UnoRuntime.queryInterface(XTextField.class, xMeta);
return xContent; return xContent;
} }
...@@ -1124,7 +1086,7 @@ class TreeInserter extends Inserter ...@@ -1124,7 +1086,7 @@ class TreeInserter extends Inserter
} else if (type.equals("Frame")) { } else if (type.equals("Frame")) {
FrameNode frame = (FrameNode) node; FrameNode frame = (FrameNode) node;
if (frame.getAnchor() == AT_CHARACTER) { if (frame.getAnchor() == AT_CHARACTER) {
m_FrameHints.add( new Pair(m_xCursor.getStart(), frame) ); m_FrameHints.add( new Pair<XTextRange, FrameNode>(m_xCursor.getStart(), frame) );
} else { } else {
insertFrame(m_xCursor, frame.getName(), frame.getAnchor()); insertFrame(m_xCursor, frame.getName(), frame.getAnchor());
} }
...@@ -1143,8 +1105,7 @@ class TreeInserter extends Inserter ...@@ -1143,8 +1105,7 @@ class TreeInserter extends Inserter
XParagraphCursor mkCursor(XTextRange xRange) XParagraphCursor mkCursor(XTextRange xRange)
{ {
XTextCursor xCursor = m_xText.createTextCursorByRange(xRange); XTextCursor xCursor = m_xText.createTextCursorByRange(xRange);
XParagraphCursor xParaCursor = (XParagraphCursor) XParagraphCursor xParaCursor = UnoRuntime.queryInterface(XParagraphCursor.class, xCursor);
UnoRuntime.queryInterface(XParagraphCursor.class, xCursor);
xParaCursor.gotoEndOfParagraph(true); xParaCursor.gotoEndOfParagraph(true);
return xParaCursor; return xParaCursor;
} }
...@@ -1243,11 +1204,9 @@ public class TextPortionEnumerationTest ...@@ -1243,11 +1204,9 @@ public class TextPortionEnumerationTest
m_xMSF = UnoRuntime.queryInterface( m_xMSF = UnoRuntime.queryInterface(
XMultiServiceFactory.class, XMultiServiceFactory.class,
connection.getComponentContext().getServiceManager()); connection.getComponentContext().getServiceManager());
XPropertySet xPropertySet = (XPropertySet) XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, m_xMSF);
UnoRuntime.queryInterface(XPropertySet.class, m_xMSF);
Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext"); Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext");
m_xContext = (XComponentContext) m_xContext = UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
assertNotNull("could not get component context.", m_xContext); assertNotNull("could not get component context.", m_xContext);
m_xDoc = util.WriterTools.createTextDoc(m_xMSF); m_xDoc = util.WriterTools.createTextDoc(m_xMSF);
m_TmpDir = util.utils.getOfficeTemp/*Dir*/(m_xMSF); m_TmpDir = util.utils.getOfficeTemp/*Dir*/(m_xMSF);
...@@ -2892,8 +2851,7 @@ public class TextPortionEnumerationTest ...@@ -2892,8 +2851,7 @@ public class TextPortionEnumerationTest
XText xDocText = m_xDoc.getText(); XText xDocText = m_xDoc.getText();
XTextCursor xDocTextCursor = xDocText.createTextCursor(); XTextCursor xDocTextCursor = xDocText.createTextCursor();
XParagraphCursor xParagraphCursor = (XParagraphCursor) XParagraphCursor xParagraphCursor = UnoRuntime.queryInterface(XParagraphCursor.class, xDocTextCursor);
UnoRuntime.queryInterface(XParagraphCursor.class, xDocTextCursor);
xParagraphCursor.gotoNextParagraph(false); // second paragraph xParagraphCursor.gotoNextParagraph(false); // second paragraph
// X12XX34X56X78X9 // X12XX34X56X78X9
// 1 23 4 5 6 // 1 23 4 5 6
...@@ -2917,17 +2875,14 @@ public class TextPortionEnumerationTest ...@@ -2917,17 +2875,14 @@ public class TextPortionEnumerationTest
id6, id6,
id6, id6,
}; };
XPropertySet xPropertySet = (XPropertySet) XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xDocTextCursor);
UnoRuntime.queryInterface(XPropertySet.class, xDocTextCursor);
for (int i = 0; i < nestedTextContent.length; ++i) { for (int i = 0; i < nestedTextContent.length; ++i) {
Object oNTC = xPropertySet.getPropertyValue("NestedTextContent"); Object oNTC = xPropertySet.getPropertyValue("NestedTextContent");
XTextContent xNTC = (XTextContent) XTextContent xNTC = UnoRuntime.queryInterface(XTextContent.class, oNTC);
UnoRuntime.queryInterface(XTextContent.class, oNTC);
if (null == nestedTextContent[i]) { if (null == nestedTextContent[i]) {
assertNull("unexpected NestedTextContent at: " + i, xNTC); assertNull("unexpected NestedTextContent at: " + i, xNTC);
} else { } else {
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xNTC);
UnoRuntime.queryInterface(XMetadatable.class, xNTC);
StringPair xmlid = xMetadatable.getMetadataReference(); StringPair xmlid = xMetadatable.getMetadataReference();
assertTrue("wrong NestedTextContent at: " + i, assertTrue("wrong NestedTextContent at: " + i,
MetaNode.eq(nestedTextContent[i], xmlid)); MetaNode.eq(nestedTextContent[i], xmlid));
...@@ -2935,18 +2890,12 @@ public class TextPortionEnumerationTest ...@@ -2935,18 +2890,12 @@ public class TextPortionEnumerationTest
xDocTextCursor.goRight((short)1, false); xDocTextCursor.goRight((short)1, false);
} }
XChild xChild1 = (XChild) XChild xChild1 = UnoRuntime.queryInterface(XChild.class, xMeta1);
UnoRuntime.queryInterface(XChild.class, xMeta1); XChild xChild2 = UnoRuntime.queryInterface(XChild.class, xMeta2);
XChild xChild2 = (XChild) XChild xChild3 = UnoRuntime.queryInterface(XChild.class, xMeta3);
UnoRuntime.queryInterface(XChild.class, xMeta2); XChild xChild4 = UnoRuntime.queryInterface(XChild.class, xMeta4);
XChild xChild3 = (XChild) XChild xChild5 = UnoRuntime.queryInterface(XChild.class, xMeta5);
UnoRuntime.queryInterface(XChild.class, xMeta3); XChild xChild6 = UnoRuntime.queryInterface(XChild.class, xMeta6);
XChild xChild4 = (XChild)
UnoRuntime.queryInterface(XChild.class, xMeta4);
XChild xChild5 = (XChild)
UnoRuntime.queryInterface(XChild.class, xMeta5);
XChild xChild6 = (XChild)
UnoRuntime.queryInterface(XChild.class, xMeta6);
try { try {
xChild1.setParent(xChild4); xChild1.setParent(xChild4);
fail("setParent(): allowed?"); fail("setParent(): allowed?");
...@@ -2957,22 +2906,19 @@ public class TextPortionEnumerationTest ...@@ -2957,22 +2906,19 @@ public class TextPortionEnumerationTest
{ {
Object xParent3 = xChild3.getParent(); Object xParent3 = xChild3.getParent();
assertNotNull("getParent(): null", xParent3); assertNotNull("getParent(): null", xParent3);
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xParent3);
UnoRuntime.queryInterface(XMetadatable.class, xParent3);
StringPair xmlid = xMetadatable.getMetadataReference(); StringPair xmlid = xMetadatable.getMetadataReference();
assertTrue("getParent(): wrong", MetaNode.eq(xmlid, id2)); assertTrue("getParent(): wrong", MetaNode.eq(xmlid, id2));
}{ }{
Object xParent4 = xChild4.getParent(); Object xParent4 = xChild4.getParent();
assertNotNull("getParent(): null", xParent4); assertNotNull("getParent(): null", xParent4);
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xParent4);
UnoRuntime.queryInterface(XMetadatable.class, xParent4);
StringPair xmlid = xMetadatable.getMetadataReference(); StringPair xmlid = xMetadatable.getMetadataReference();
assertTrue("getParent(): wrong", MetaNode.eq(xmlid, id3)); assertTrue("getParent(): wrong", MetaNode.eq(xmlid, id3));
}{ }{
Object xParent5 = xChild5.getParent(); Object xParent5 = xChild5.getParent();
assertNotNull("getParent(): null", xParent5); assertNotNull("getParent(): null", xParent5);
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xParent5);
UnoRuntime.queryInterface(XMetadatable.class, xParent5);
StringPair xmlid = xMetadatable.getMetadataReference(); StringPair xmlid = xMetadatable.getMetadataReference();
assertTrue("getParent(): wrong", MetaNode.eq(xmlid, id3)); assertTrue("getParent(): wrong", MetaNode.eq(xmlid, id3));
} }
...@@ -2995,10 +2941,9 @@ public class TextPortionEnumerationTest ...@@ -2995,10 +2941,9 @@ public class TextPortionEnumerationTest
xDocText.insertTextContent(xDocTextCursor, xMeta, true); xDocText.insertTextContent(xDocTextCursor, xMeta, true);
// xMeta.attach(xDocTextCursor); // xMeta.attach(xDocTextCursor);
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xMeta);
UnoRuntime.queryInterface(XMetadatable.class, xMeta);
xMetadatable.setMetadataReference(meta.getXmlId()); xMetadatable.setMetadataReference(meta.getXmlId());
XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta); XText xText = UnoRuntime.queryInterface(XText.class, xMeta);
XText xParentText = xText.getText(); XText xParentText = xText.getText();
assertNotNull("getText(): no parent", xParentText); assertNotNull("getText(): no parent", xParentText);
...@@ -3155,17 +3100,14 @@ public class TextPortionEnumerationTest ...@@ -3155,17 +3100,14 @@ public class TextPortionEnumerationTest
doTest(root, false); doTest(root, false);
*/ */
XEnumerationAccess xEA = (XEnumerationAccess) XEnumerationAccess xEA = UnoRuntime.queryInterface(XEnumerationAccess.class, xMeta);
UnoRuntime.queryInterface(XEnumerationAccess.class, xMeta);
XEnumeration xEnum = xEA.createEnumeration(); XEnumeration xEnum = xEA.createEnumeration();
assertNotNull("createEnumeration(): returns null", xEnum); assertNotNull("createEnumeration(): returns null", xEnum);
{ {
assertTrue("hasNext(): first missing", xEnum.hasMoreElements()); assertTrue("hasNext(): first missing", xEnum.hasMoreElements());
Object xElement = xEnum.nextElement(); Object xElement = xEnum.nextElement();
XTextRange xPortion = (XTextRange) XTextRange xPortion = UnoRuntime.queryInterface(XTextRange.class, xElement);
UnoRuntime.queryInterface(XTextRange.class, xElement); XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xPortion);
XPropertySet xPropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xPortion);
String type = (String) xPropSet.getPropertyValue("TextPortionType"); String type = (String) xPropSet.getPropertyValue("TextPortionType");
assertEquals("first: not text", "Text", type); assertEquals("first: not text", "Text", type);
String txt = xPortion.getString(); String txt = xPortion.getString();
...@@ -3174,18 +3116,15 @@ public class TextPortionEnumerationTest ...@@ -3174,18 +3116,15 @@ public class TextPortionEnumerationTest
{ {
assertTrue("hasNext(): second missing", xEnum.hasMoreElements()); assertTrue("hasNext(): second missing", xEnum.hasMoreElements());
Object xElement = xEnum.nextElement(); Object xElement = xEnum.nextElement();
XTextRange xPortion = (XTextRange) XTextRange xPortion = UnoRuntime.queryInterface(XTextRange.class, xElement);
UnoRuntime.queryInterface(XTextRange.class, xElement); XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xPortion);
XPropertySet xPropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xPortion);
String type = (String) xPropSet.getPropertyValue("TextPortionType"); String type = (String) xPropSet.getPropertyValue("TextPortionType");
assertEquals("second: not text", "TextField", type); assertEquals("second: not text", "TextField", type);
} }
// no ruby end here!!! // no ruby end here!!!
assertFalse("hasNext(): more elements?", xEnum.hasMoreElements()); assertFalse("hasNext(): more elements?", xEnum.hasMoreElements());
XComponent xComponent = (XComponent) XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, xMeta);
UnoRuntime.queryInterface(XComponent.class, xMeta);
xComponent.dispose(); xComponent.dispose();
try { try {
...@@ -3212,10 +3151,9 @@ public class TextPortionEnumerationTest ...@@ -3212,10 +3151,9 @@ public class TextPortionEnumerationTest
xDocText.insertTextContent(xDocTextCursor, xMeta, true); xDocText.insertTextContent(xDocTextCursor, xMeta, true);
xDocTextCursor.gotoStart(true); xDocTextCursor.gotoStart(true);
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xMeta);
UnoRuntime.queryInterface(XMetadatable.class, xMeta);
xMetadatable.setMetadataReference(met1.getXmlId()); xMetadatable.setMetadataReference(met1.getXmlId());
XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta); XText xText = UnoRuntime.queryInterface(XText.class, xMeta);
XTextRange xStart = xText.getStart(); XTextRange xStart = xText.getStart();
assertNotNull("getStart(): no start", xStart); assertNotNull("getStart(): no start", xStart);
...@@ -3247,8 +3185,7 @@ public class TextPortionEnumerationTest ...@@ -3247,8 +3185,7 @@ public class TextPortionEnumerationTest
// XWordCursor // XWordCursor
xText.setString("Two words"); xText.setString("Two words");
xTextCursor.gotoStart(false); xTextCursor.gotoStart(false);
XWordCursor xWordCursor = (XWordCursor) XWordCursor xWordCursor = UnoRuntime.queryInterface(XWordCursor.class, xTextCursor);
UnoRuntime.queryInterface(XWordCursor.class, xTextCursor);
bSuccess = xWordCursor.gotoNextWord(true); bSuccess = xWordCursor.gotoNextWord(true);
assertTrue("gotoNextWord(): failed", bSuccess); assertTrue("gotoNextWord(): failed", bSuccess);
...@@ -3293,8 +3230,7 @@ public class TextPortionEnumerationTest ...@@ -3293,8 +3230,7 @@ public class TextPortionEnumerationTest
// XSentenceCursor // XSentenceCursor
xText.setString("This is a sentence. Another sentence."); xText.setString("This is a sentence. Another sentence.");
xTextCursor.gotoStart(false); xTextCursor.gotoStart(false);
XSentenceCursor xSentenceCursor = (XSentenceCursor) XSentenceCursor xSentenceCursor = UnoRuntime.queryInterface(XSentenceCursor.class, xTextCursor);
UnoRuntime.queryInterface(XSentenceCursor.class, xTextCursor);
bSuccess = xSentenceCursor.gotoNextSentence(true); bSuccess = xSentenceCursor.gotoNextSentence(true);
assertTrue("gotoNextSentence(): failed", bSuccess); assertTrue("gotoNextSentence(): failed", bSuccess);
...@@ -3339,8 +3275,7 @@ public class TextPortionEnumerationTest ...@@ -3339,8 +3275,7 @@ public class TextPortionEnumerationTest
bSuccess = xSentenceCursor.gotoStartOfSentence(false); bSuccess = xSentenceCursor.gotoStartOfSentence(false);
assertFalse("gotoStartOfSentence(): succeeded", bSuccess); assertFalse("gotoStartOfSentence(): succeeded", bSuccess);
XParagraphCursor xParagraphCursor = (XParagraphCursor) XParagraphCursor xParagraphCursor = UnoRuntime.queryInterface(XParagraphCursor.class, xTextCursor);
UnoRuntime.queryInterface(XParagraphCursor.class, xTextCursor);
// XParagraphCursor (does not make sense) // XParagraphCursor (does not make sense)
bSuccess = xParagraphCursor.gotoNextParagraph(false); bSuccess = xParagraphCursor.gotoNextParagraph(false);
...@@ -3442,8 +3377,7 @@ public class TextPortionEnumerationTest ...@@ -3442,8 +3377,7 @@ public class TextPortionEnumerationTest
} }
void postInserted(TreeNode node, XTextContent xContent) void postInserted(TreeNode node, XTextContent xContent)
throws Exception { throws Exception {
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xContent);
UnoRuntime.queryInterface(XMetadatable.class, xContent);
xMetadatable.setMetadataReference( xMetadatable.setMetadataReference(
((MetaNode)node).getXmlId()); ((MetaNode)node).getXmlId());
} }
...@@ -3464,10 +3398,9 @@ public class TextPortionEnumerationTest ...@@ -3464,10 +3398,9 @@ public class TextPortionEnumerationTest
xDocTextCursor.goRight((short)2, true); xDocTextCursor.goRight((short)2, true);
xDocText.insertTextContent(xDocTextCursor, xMeta, true); xDocText.insertTextContent(xDocTextCursor, xMeta, true);
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xMeta);
UnoRuntime.queryInterface(XMetadatable.class, xMeta);
xMetadatable.setMetadataReference(met1.getXmlId()); xMetadatable.setMetadataReference(met1.getXmlId());
XText xText = (XText) UnoRuntime.queryInterface(XText.class, xMeta); XText xText = UnoRuntime.queryInterface(XText.class, xMeta);
XTextRange xStart = null; XTextRange xStart = null;
XTextRange xEnd = null; XTextRange xEnd = null;
...@@ -3681,7 +3614,7 @@ public class TextPortionEnumerationTest ...@@ -3681,7 +3614,7 @@ public class TextPortionEnumerationTest
@Test public void testMetaFieldXTextField() throws Exception @Test public void testMetaFieldXTextField() throws Exception
{ {
com.sun.star.rdf.XRepositorySupplier xModel = com.sun.star.rdf.XRepositorySupplier xModel =
(com.sun.star.rdf.XRepositorySupplier) UnoRuntime.queryInterface( UnoRuntime.queryInterface(
com.sun.star.rdf.XRepositorySupplier.class, m_xDoc); com.sun.star.rdf.XRepositorySupplier.class, m_xDoc);
com.sun.star.rdf.XRepository xRepo = xModel.getRDFRepository(); com.sun.star.rdf.XRepository xRepo = xModel.getRDFRepository();
// for testing just add it to the first graph // for testing just add it to the first graph
...@@ -3710,8 +3643,7 @@ public class TextPortionEnumerationTest ...@@ -3710,8 +3643,7 @@ public class TextPortionEnumerationTest
xDocText.insertTextContent(xDocTextCursor, xMetaField, true); xDocText.insertTextContent(xDocTextCursor, xMetaField, true);
XMetadatable xMetadatable = (XMetadatable) XMetadatable xMetadatable = UnoRuntime.queryInterface(XMetadatable.class, xMetaField);
UnoRuntime.queryInterface(XMetadatable.class, xMetaField);
xMetadatable.ensureMetadataReference(); xMetadatable.ensureMetadataReference();
xGraph.addStatement(xMetadatable, xOdfPrefix, xPrefix); xGraph.addStatement(xMetadatable, xOdfPrefix, xPrefix);
...@@ -3735,8 +3667,7 @@ public class TextPortionEnumerationTest ...@@ -3735,8 +3667,7 @@ public class TextPortionEnumerationTest
xDocText.insertTextContent(xDocTextCursor, xMetaField, true); xDocText.insertTextContent(xDocTextCursor, xMetaField, true);
XPropertySet xPropertySet = (XPropertySet) XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xMetaField);
UnoRuntime.queryInterface(XPropertySet.class, xMetaField);
assertNotNull("PropertySet: not supported?", xPropertySet); assertNotNull("PropertySet: not supported?", xPropertySet);
XPropertySetInfo xPropertySetInfo = xPropertySet.getPropertySetInfo(); XPropertySetInfo xPropertySetInfo = xPropertySet.getPropertySetInfo();
assertTrue("hasPropertyByName(\"NumberFormat\"):", assertTrue("hasPropertyByName(\"NumberFormat\"):",
...@@ -3782,7 +3713,7 @@ public class TextPortionEnumerationTest ...@@ -3782,7 +3713,7 @@ public class TextPortionEnumerationTest
{ {
System.out.println("Storing test document..."); System.out.println("Storing test document...");
XStorable xStor = (XStorable) UnoRuntime.queryInterface( XStorable xStor = UnoRuntime.queryInterface(
XStorable.class, xComp); XStorable.class, xComp);
xStor.storeToURL(file, new PropertyValue[0]); xStor.storeToURL(file, new PropertyValue[0]);
...@@ -3804,8 +3735,7 @@ public class TextPortionEnumerationTest ...@@ -3804,8 +3735,7 @@ public class TextPortionEnumerationTest
xComp = util.DesktopTools.loadDoc(m_xMSF, file, loadProps); xComp = util.DesktopTools.loadDoc(m_xMSF, file, loadProps);
// xComp = util.DesktopTools.getCLoader(m_xMSF).loadComponentFromURL(file, "_blank", 0, loadProps); // xComp = util.DesktopTools.getCLoader(m_xMSF).loadComponentFromURL(file, "_blank", 0, loadProps);
XTextDocument xTextDoc = (XTextDocument) XTextDocument xTextDoc = UnoRuntime.queryInterface(XTextDocument.class, xComp);
UnoRuntime.queryInterface(XTextDocument.class, xComp);
assertNotNull("cannot load: " + file, xTextDoc); assertNotNull("cannot load: " + file, xTextDoc);
...@@ -3894,21 +3824,18 @@ public class TextPortionEnumerationTest ...@@ -3894,21 +3824,18 @@ public class TextPortionEnumerationTest
System.out.println("Checking bookmarks in loaded test document..."); System.out.println("Checking bookmarks in loaded test document...");
XRepositorySupplier xRS = (XRepositorySupplier) XRepositorySupplier xRS = UnoRuntime.queryInterface(XRepositorySupplier.class, xTextDoc);
UnoRuntime.queryInterface(XRepositorySupplier.class, xTextDoc); XDocumentRepository xRepo = UnoRuntime.queryInterface(XDocumentRepository.class,
XDocumentRepository xRepo = (XDocumentRepository)
UnoRuntime.queryInterface(XDocumentRepository.class,
xRS.getRDFRepository()); xRS.getRDFRepository());
XBookmarksSupplier xBMS = (XBookmarksSupplier) XBookmarksSupplier xBMS = UnoRuntime.queryInterface(XBookmarksSupplier.class, xTextDoc);
UnoRuntime.queryInterface(XBookmarksSupplier.class, xTextDoc);
XNameAccess xBookmarks = xBMS.getBookmarks(); XNameAccess xBookmarks = xBMS.getBookmarks();
XMetadatable xMark1 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xMark1 = UnoRuntime.queryInterface(
XMetadatable.class, xBookmarks.getByName("mk1")); XMetadatable.class, xBookmarks.getByName("mk1"));
assertTrue("mark1", assertTrue("mark1",
eq(xMark1.getMetadataReference(), eq(xMark1.getMetadataReference(),
new StringPair("content.xml", "id90"))); new StringPair("content.xml", "id90")));
XMetadatable xMark2 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xMark2 = UnoRuntime.queryInterface(
XMetadatable.class, xBookmarks.getByName("mk2")); XMetadatable.class, xBookmarks.getByName("mk2"));
Pair<Statement[], Boolean> result = xRepo.getStatementRDFa(xMark2); Pair<Statement[], Boolean> result = xRepo.getStatementRDFa(xMark2);
assertTrue("mark2", (result.First.length == 1) assertTrue("mark2", (result.First.length == 1)
...@@ -3917,7 +3844,7 @@ public class TextPortionEnumerationTest ...@@ -3917,7 +3844,7 @@ public class TextPortionEnumerationTest
&& result.First[0].Object.getStringValue().contains("a fooish bar") && result.First[0].Object.getStringValue().contains("a fooish bar")
); );
XMetadatable xMark3 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xMark3 = UnoRuntime.queryInterface(
XMetadatable.class, xBookmarks.getByName("mk3")); XMetadatable.class, xBookmarks.getByName("mk3"));
assertTrue("mark3", assertTrue("mark3",
eq(xMark3.getMetadataReference(), eq(xMark3.getMetadataReference(),
...@@ -3927,58 +3854,57 @@ public class TextPortionEnumerationTest ...@@ -3927,58 +3854,57 @@ public class TextPortionEnumerationTest
System.out.println("Checking sections in loaded test document..."); System.out.println("Checking sections in loaded test document...");
XTextSectionsSupplier xTSS = (XTextSectionsSupplier) XTextSectionsSupplier xTSS = UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDoc);
UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDoc);
XNameAccess xSections = xTSS.getTextSections(); XNameAccess xSections = xTSS.getTextSections();
XMetadatable xSection1 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xSection1 = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("Section 1")); XMetadatable.class, xSections.getByName("Section 1"));
assertTrue("idsection1", eq(xSection1.getMetadataReference(), assertTrue("idsection1", eq(xSection1.getMetadataReference(),
new StringPair("content.xml", "idSection1"))); new StringPair("content.xml", "idSection1")));
XMetadatable xSection2 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xSection2 = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("Section 2")); XMetadatable.class, xSections.getByName("Section 2"));
assertTrue("idSection2", eq(xSection2.getMetadataReference(), assertTrue("idSection2", eq(xSection2.getMetadataReference(),
new StringPair("content.xml", "idSection2"))); new StringPair("content.xml", "idSection2")));
XMetadatable xSection3 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xSection3 = UnoRuntime.queryInterface(
XMetadatable.class, XMetadatable.class,
xSections.getByName("Table of Contents1_Head")); xSections.getByName("Table of Contents1_Head"));
assertTrue("idTOCTitle", eq(xSection3.getMetadataReference(), assertTrue("idTOCTitle", eq(xSection3.getMetadataReference(),
new StringPair("content.xml", "idTOCTitle"))); new StringPair("content.xml", "idTOCTitle")));
XMetadatable xSection4 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xSection4 = UnoRuntime.queryInterface(
XMetadatable.class, XMetadatable.class,
xSections.getByName("Alphabetical Index1_Head")); xSections.getByName("Alphabetical Index1_Head"));
assertTrue("idAITitle", eq(xSection4.getMetadataReference(), assertTrue("idAITitle", eq(xSection4.getMetadataReference(),
new StringPair("content.xml", "idAITitle"))); new StringPair("content.xml", "idAITitle")));
XMetadatable xSection5 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xSection5 = UnoRuntime.queryInterface(
XMetadatable.class, XMetadatable.class,
xSections.getByName("Illustration Index1_Head")); xSections.getByName("Illustration Index1_Head"));
assertTrue("idIITitle", eq(xSection5.getMetadataReference(), assertTrue("idIITitle", eq(xSection5.getMetadataReference(),
new StringPair("content.xml", "idIITitle"))); new StringPair("content.xml", "idIITitle")));
XMetadatable xSection6 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xSection6 = UnoRuntime.queryInterface(
XMetadatable.class, XMetadatable.class,
xSections.getByName("Index of Tables1_Head")); xSections.getByName("Index of Tables1_Head"));
assertTrue("idIOTTitle", eq(xSection6.getMetadataReference(), assertTrue("idIOTTitle", eq(xSection6.getMetadataReference(),
new StringPair("content.xml", "idIOTTitle"))); new StringPair("content.xml", "idIOTTitle")));
XMetadatable xSection7 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xSection7 = UnoRuntime.queryInterface(
XMetadatable.class, XMetadatable.class,
xSections.getByName("User-Defined1_Head")); xSections.getByName("User-Defined1_Head"));
assertTrue("idUDTitle", eq(xSection7.getMetadataReference(), assertTrue("idUDTitle", eq(xSection7.getMetadataReference(),
new StringPair("content.xml", "idUDTitle"))); new StringPair("content.xml", "idUDTitle")));
XMetadatable xSection8 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xSection8 = UnoRuntime.queryInterface(
XMetadatable.class, XMetadatable.class,
xSections.getByName("Table of Objects1_Head")); xSections.getByName("Table of Objects1_Head"));
assertTrue("idTOOTitle", eq(xSection8.getMetadataReference(), assertTrue("idTOOTitle", eq(xSection8.getMetadataReference(),
new StringPair("content.xml", "idTOOTitle"))); new StringPair("content.xml", "idTOOTitle")));
XMetadatable xSection9 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xSection9 = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("Bibliography1_Head")); XMetadatable.class, xSections.getByName("Bibliography1_Head"));
assertTrue("idBibTitle", eq(xSection9.getMetadataReference(), assertTrue("idBibTitle", eq(xSection9.getMetadataReference(),
new StringPair("content.xml", "idBibTitle"))); new StringPair("content.xml", "idBibTitle")));
...@@ -3987,71 +3913,70 @@ public class TextPortionEnumerationTest ...@@ -3987,71 +3913,70 @@ public class TextPortionEnumerationTest
System.out.println("Checking indexes in loaded test document..."); System.out.println("Checking indexes in loaded test document...");
XDocumentIndexesSupplier xDIS = (XDocumentIndexesSupplier) XDocumentIndexesSupplier xDIS = UnoRuntime.queryInterface(XDocumentIndexesSupplier.class, xTextDoc);
UnoRuntime.queryInterface(XDocumentIndexesSupplier.class, xTextDoc);
XIndexAccess xIndexesIA = xDIS.getDocumentIndexes(); XIndexAccess xIndexesIA = xDIS.getDocumentIndexes();
XNameAccess xIndexes = XNameAccess xIndexes =
UnoRuntime.queryInterface(XNameAccess.class, xIndexesIA); UnoRuntime.queryInterface(XNameAccess.class, xIndexesIA);
XMetadatable xIndex1 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex1 = UnoRuntime.queryInterface(
XMetadatable.class, xIndexes.getByName("Table of Contents1")); XMetadatable.class, xIndexes.getByName("Table of Contents1"));
assertTrue("idTOC", eq(xIndex1.getMetadataReference(), assertTrue("idTOC", eq(xIndex1.getMetadataReference(),
new StringPair("content.xml", "idTOC"))); new StringPair("content.xml", "idTOC")));
XMetadatable xIndex1s = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex1s = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("Table of Contents1")); XMetadatable.class, xSections.getByName("Table of Contents1"));
assertTrue("idTOC", eq(xIndex1s.getMetadataReference(), assertTrue("idTOC", eq(xIndex1s.getMetadataReference(),
new StringPair("content.xml", "idTOC"))); new StringPair("content.xml", "idTOC")));
XMetadatable xIndex2 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex2 = UnoRuntime.queryInterface(
XMetadatable.class, xIndexes.getByName("Alphabetical Index1")); XMetadatable.class, xIndexes.getByName("Alphabetical Index1"));
assertTrue("idAI", eq(xIndex2.getMetadataReference(), assertTrue("idAI", eq(xIndex2.getMetadataReference(),
new StringPair("content.xml", "idAI"))); new StringPair("content.xml", "idAI")));
XMetadatable xIndex2s = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex2s = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("Alphabetical Index1")); XMetadatable.class, xSections.getByName("Alphabetical Index1"));
assertTrue("idAI", eq(xIndex2s.getMetadataReference(), assertTrue("idAI", eq(xIndex2s.getMetadataReference(),
new StringPair("content.xml", "idAI"))); new StringPair("content.xml", "idAI")));
XMetadatable xIndex3 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex3 = UnoRuntime.queryInterface(
XMetadatable.class, xIndexes.getByName("Illustration Index1")); XMetadatable.class, xIndexes.getByName("Illustration Index1"));
assertTrue("idII", eq(xIndex3.getMetadataReference(), assertTrue("idII", eq(xIndex3.getMetadataReference(),
new StringPair("content.xml", "idII"))); new StringPair("content.xml", "idII")));
XMetadatable xIndex3s = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex3s = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("Illustration Index1")); XMetadatable.class, xSections.getByName("Illustration Index1"));
assertTrue("idII", eq(xIndex3s.getMetadataReference(), assertTrue("idII", eq(xIndex3s.getMetadataReference(),
new StringPair("content.xml", "idII"))); new StringPair("content.xml", "idII")));
XMetadatable xIndex4 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex4 = UnoRuntime.queryInterface(
XMetadatable.class, xIndexes.getByName("Index of Tables1")); XMetadatable.class, xIndexes.getByName("Index of Tables1"));
assertTrue("idIOT", eq(xIndex4.getMetadataReference(), assertTrue("idIOT", eq(xIndex4.getMetadataReference(),
new StringPair("content.xml", "idIOT"))); new StringPair("content.xml", "idIOT")));
XMetadatable xIndex4s = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex4s = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("Index of Tables1")); XMetadatable.class, xSections.getByName("Index of Tables1"));
assertTrue("idIOT", eq(xIndex4s.getMetadataReference(), assertTrue("idIOT", eq(xIndex4s.getMetadataReference(),
new StringPair("content.xml", "idIOT"))); new StringPair("content.xml", "idIOT")));
XMetadatable xIndex5 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex5 = UnoRuntime.queryInterface(
XMetadatable.class, xIndexes.getByName("User-Defined1")); XMetadatable.class, xIndexes.getByName("User-Defined1"));
assertTrue("idUD", eq(xIndex5.getMetadataReference(), assertTrue("idUD", eq(xIndex5.getMetadataReference(),
new StringPair("content.xml", "idUD"))); new StringPair("content.xml", "idUD")));
XMetadatable xIndex5s = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex5s = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("User-Defined1")); XMetadatable.class, xSections.getByName("User-Defined1"));
assertTrue("idUD", eq(xIndex5s.getMetadataReference(), assertTrue("idUD", eq(xIndex5s.getMetadataReference(),
new StringPair("content.xml", "idUD"))); new StringPair("content.xml", "idUD")));
XMetadatable xIndex6 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex6 = UnoRuntime.queryInterface(
XMetadatable.class, xIndexes.getByName("Table of Objects1")); XMetadatable.class, xIndexes.getByName("Table of Objects1"));
assertTrue("idTOO", eq(xIndex6.getMetadataReference(), assertTrue("idTOO", eq(xIndex6.getMetadataReference(),
new StringPair("content.xml", "idTOO"))); new StringPair("content.xml", "idTOO")));
XMetadatable xIndex6s = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex6s = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("Table of Objects1")); XMetadatable.class, xSections.getByName("Table of Objects1"));
assertTrue("idTOO", eq(xIndex6s.getMetadataReference(), assertTrue("idTOO", eq(xIndex6s.getMetadataReference(),
new StringPair("content.xml", "idTOO"))); new StringPair("content.xml", "idTOO")));
XMetadatable xIndex7 = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex7 = UnoRuntime.queryInterface(
XMetadatable.class, xIndexes.getByName("Bibliography1")); XMetadatable.class, xIndexes.getByName("Bibliography1"));
assertTrue("idBib", eq(xIndex7.getMetadataReference(), assertTrue("idBib", eq(xIndex7.getMetadataReference(),
new StringPair("content.xml", "idBib"))); new StringPair("content.xml", "idBib")));
XMetadatable xIndex7s = (XMetadatable) UnoRuntime.queryInterface( XMetadatable xIndex7s = UnoRuntime.queryInterface(
XMetadatable.class, xSections.getByName("Bibliography1")); XMetadatable.class, xSections.getByName("Bibliography1"));
assertTrue("idBib", eq(xIndex7s.getMetadataReference(), assertTrue("idBib", eq(xIndex7s.getMetadataReference(),
new StringPair("content.xml", "idBib"))); new StringPair("content.xml", "idBib")));
...@@ -4062,7 +3987,7 @@ public class TextPortionEnumerationTest ...@@ -4062,7 +3987,7 @@ public class TextPortionEnumerationTest
static void close(XComponent i_comp) static void close(XComponent i_comp)
{ {
try { try {
XCloseable xClos = (XCloseable) UnoRuntime.queryInterface( XCloseable xClos = UnoRuntime.queryInterface(
XCloseable.class, i_comp); XCloseable.class, i_comp);
if (xClos != null) xClos.close(true); if (xClos != null) xClos.close(true);
} catch (Exception e) { } catch (Exception e) {
...@@ -4091,14 +4016,12 @@ public class TextPortionEnumerationTest ...@@ -4091,14 +4016,12 @@ public class TextPortionEnumerationTest
//Thread.sleep(10000); //Thread.sleep(10000);
XText xText = xDoc.getText(); XText xText = xDoc.getText();
XEnumerationAccess xTextEA = (XEnumerationAccess) XEnumerationAccess xTextEA = UnoRuntime.queryInterface(XEnumerationAccess.class, xText);
UnoRuntime.queryInterface(XEnumerationAccess.class, xText);
XEnumeration xTextEnum = xTextEA.createEnumeration(); XEnumeration xTextEnum = xTextEA.createEnumeration();
// skip to right paragraph // skip to right paragraph
xTextEnum.nextElement(); // skip first -- always empty! xTextEnum.nextElement(); // skip first -- always empty!
Object xElement = xTextEnum.nextElement(); // second contains test case Object xElement = xTextEnum.nextElement(); // second contains test case
XEnumerationAccess xEA = (XEnumerationAccess) XEnumerationAccess xEA = UnoRuntime.queryInterface(XEnumerationAccess.class, xElement);
UnoRuntime.queryInterface(XEnumerationAccess.class, xElement);
XEnumeration xEnum = xEA.createEnumeration(); XEnumeration xEnum = xEA.createEnumeration();
TreeNode outtree = new EnumConverter().convert(xEnum); TreeNode outtree = new EnumConverter().convert(xEnum);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment