当前位置: 首页>>代码示例>>Java>>正文


Java XDesktop.getCurrentComponent方法代码示例

本文整理汇总了Java中com.sun.star.frame.XDesktop.getCurrentComponent方法的典型用法代码示例。如果您正苦于以下问题:Java XDesktop.getCurrentComponent方法的具体用法?Java XDesktop.getCurrentComponent怎么用?Java XDesktop.getCurrentComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.star.frame.XDesktop的用法示例。


在下文中一共展示了XDesktop.getCurrentComponent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getXComponent

import com.sun.star.frame.XDesktop; //导入方法依赖的package包/类
private XComponent getXComponent() {
  try {
    final XMultiComponentFactory xMCF = xContext.getServiceManager();
    final Object desktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
    final XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, desktop);
    return xDesktop.getCurrentComponent();
  } catch (final Throwable t) {
    showError(t);
    return null;
  }
}
 
开发者ID:prowritingaid,项目名称:openoffice-extension,代码行数:12,代码来源:Main.java

示例2: getCurrentComponent

import com.sun.star.frame.XDesktop; //导入方法依赖的package包/类
/** 
 * Returns the current XComponent 
 * Returns null if it fails
 */
@Nullable
private static XComponent getCurrentComponent(XComponentContext xContext) throws Exception {
  try {
    XDesktop xdesktop = getCurrentDesktop(xContext);
    if(xdesktop == null) {
      return null;
    }
    else return xdesktop.getCurrentComponent();
  } catch (Exception e) {
    printException(e);     // all Exceptions thrown by UnoRuntime.queryInterface are caught
    return null;           // Return null as method failed
  }
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:18,代码来源:LOFlatParagraph.java

示例3: getCurrentComponent

import com.sun.star.frame.XDesktop; //导入方法依赖的package包/类
/**
 * Returns the current XComponent
 * Returns null if it fails
 */
@Nullable
private static XComponent getCurrentComponent(XComponentContext xContext) {
  try {
    XDesktop xdesktop = getCurrentDesktop(xContext);
    if(xdesktop == null) {
      return null;
    }
    else return xdesktop.getCurrentComponent();
  } catch (Exception e) {
    printException(e);     // all Exceptions thrown by UnoRuntime.queryInterface are caught
    return null;           // Return null as method failed
  }
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:18,代码来源:LOCursor.java

示例4: getViewCursor

import com.sun.star.frame.XDesktop; //导入方法依赖的package包/类
/** 
 * Returns ViewCursor 
 * Returns null if it fails
 */
@Nullable
private static XTextViewCursor getViewCursor(XComponentContext xContext) {
  try {
    XDesktop xDesktop = getCurrentDesktop(xContext);
    if(xDesktop == null) {
      return null;
    }
    XComponent xCurrentComponent = xDesktop.getCurrentComponent();
    if(xCurrentComponent == null) {
      return null;
    }
    XModel xModel = UnoRuntime.queryInterface(XModel.class, xCurrentComponent);
    if(xModel == null) {
      return null;
    }
    XController xController = xModel.getCurrentController();
    if(xController == null) {
      return null;
    }
    XTextViewCursorSupplier xViewCursorSupplier =
        UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
    if(xViewCursorSupplier == null) {
      return null;
    }
    return xViewCursorSupplier.getViewCursor();
  } catch (Exception e) {
    printException(e);     // all Exceptions thrown by UnoRuntime.queryInterface are caught
    return null;           // Return null as method failed
  }
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:35,代码来源:LOCursor.java

示例5: getXComponent

import com.sun.star.frame.XDesktop; //导入方法依赖的package包/类
@Nullable
private XComponent getXComponent() {
  try {
    XMultiComponentFactory xMCF = xContext.getServiceManager();
    Object desktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
    XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, desktop);
    return xDesktop.getCurrentComponent();
  } catch (Throwable t) {
    showError(t);
    return null;
  }
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:13,代码来源:Main.java

示例6: getCurrentComponent

import com.sun.star.frame.XDesktop; //导入方法依赖的package包/类
/**
 * Gets the current component.
 * @return the current component
 * @throws Exception
 *             the exception
 */
public static XComponent getCurrentComponent() throws Exception {
	XComponentContext xRemoteContext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);
	// XComponentContext xRemoteContext =
	// com.sun.star.comp.helper.Bootstrap.bootstrap();

	XMultiComponentFactory xRemoteServiceManager = xRemoteContext.getServiceManager();

	Object desktop = xRemoteServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xRemoteContext); //$NON-NLS-1$

	XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktop);

	XComponent currentComponent = xDesktop.getCurrentComponent();

	return currentComponent;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:22,代码来源:TerminationOpenoffice.java


注:本文中的com.sun.star.frame.XDesktop.getCurrentComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。