• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XNameAccess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.star.container.XNameAccess的典型用法代码示例。如果您正苦于以下问题:Java XNameAccess类的具体用法?Java XNameAccess怎么用?Java XNameAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XNameAccess类属于com.sun.star.container包,在下文中一共展示了XNameAccess类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getInfo

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * This method can be used to get any info from the application that is available.
 * (Possible paths and keys can be retrieved with the dumpInfo method).
 * Returns the object described by the path and key, or <code>null</code> if not available.
 * 
 * @param path the path to the key information
 * @param key the key to get the value for
 * 
 * @return the object described by the path and key, or <code>null</code> if not available
 * 
 * @throws Exception if retreiving the value fails
 * 
 * @author Markus Krüger
 * @date 18.11.2008
 */
public Object getInfo(String path, String key) throws Exception {
  Object configProviderObject = serviceProvider.createService("com.sun.star.comp.configuration.ConfigurationProvider");
  XMultiServiceFactory xConfigServiceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
      configProviderObject);
  String readConfAccess = "com.sun.star.configuration.ConfigurationAccess";
  PropertyValue[] properties = new PropertyValue[1];
  properties[0] = new PropertyValue();
  properties[0].Name = "nodepath";
  properties[0].Value = path;
  Object configReadAccessObject = xConfigServiceFactory.createInstanceWithArguments(readConfAccess,
      properties);
  XNameAccess xConfigNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,
      configReadAccessObject);
  return xConfigNameAccess.getByName(key);
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:31,代码来源:ApplicationInfo.java


示例2: getTextTables

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Returns all available text tables.
 * 
 * @return all available text tables
 * 
 * @author Andreas Bröker
 */
public ITextTable[] getTextTables() {
  XTextTablesSupplier xTextTablesSupplier = (XTextTablesSupplier)UnoRuntime.queryInterface(XTextTablesSupplier.class, textDocument.getXTextDocument());
  XNameAccess xNameAccess = xTextTablesSupplier.getTextTables();
  XIndexAccess xIndexAccess = (XIndexAccess)UnoRuntime.queryInterface(XIndexAccess.class, xNameAccess);
  ITextTable[] textTables = new ITextTable[xIndexAccess.getCount()];
  for(int i=0, n=xIndexAccess.getCount(); i<n; i++) {
    try {
      Any any = (Any)xIndexAccess.getByIndex(i);
      XTextTable textTable = (XTextTable)any.getObject();
      if(textTable.getColumns().getCount() <= ITextTable.MAX_COLUMNS_IN_TABLE) {
        textTables[i] = new TextTable(textDocument, textTable);
    	}
    }
    catch(Exception exception) {
      //do nothing
    }
  }
  return textTables;
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:27,代码来源:TextTableService.java


示例3: getTextTable

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Returns table with the submitted name.
 * 
 * @param name name of the table
 * 
 * @return table with the submitted name
 * 
 * @throws TextException if the table does not exist
 * 
 * @author Andreas Bröker
 */
public ITextTable getTextTable(String name) throws TextException {
  try {
    XTextTablesSupplier xTextTablesSupplier = (XTextTablesSupplier)UnoRuntime.queryInterface(XTextTablesSupplier.class, textDocument.getXTextDocument());
    XNameAccess xNameAccess = xTextTablesSupplier.getTextTables();
    Any any = (Any)xNameAccess.getByName(name);
    XTextTable textTable = (XTextTable)any.getObject();
    if(textTable.getColumns().getCount() <= ITextTable.MAX_COLUMNS_IN_TABLE) {
    	return new TextTable(textDocument, textTable);
    }
    else {
    	throw new TextException("The submitted table is not valid");
    }
  }
  catch(Exception exception) {
    TextException textException = new TextException(exception.getMessage());
    textException.initCause(exception);
    throw textException;
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:31,代码来源:TextTableService.java


示例4: getRegisteredDatabaseNames

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Returns the names of all datasources registered in OOo.
 * 
 * @author Matthias Benkmann (D-III-ITD-D101)
 * 
 *         TESTED
 */
private List<String> getRegisteredDatabaseNames()
{
  List<String> datasourceNames = new Vector<String>();
  try
  {
    String[] datasourceNamesA = UNO.XNameAccess(UNO.dbContext).getElementNames();
    for (int i = 0; i < datasourceNamesA.length; ++i)
      datasourceNames.add(datasourceNamesA[i]);
  }
  catch (Exception x)
  {
    Logger.error(x);
  }
  return datasourceNames;
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:23,代码来源:MailMergeDatasource.java


示例5: startsWithSection

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Liefert true gdw der Start von doc mit dem Starter einer Section von doc
 * zusammenfällt.
 * 
 * @author Matthias Benkmann (D-III-ITD 5.1) TESTED
 */
private static boolean startsWithSection(XTextDocument doc)
{
  XTextRange docText = doc.getText();
  XTextRangeCompare compare = UNO.XTextRangeCompare(docText);
  XNameAccess sections = UNO.XTextSectionsSupplier(doc).getTextSections();
  String[] names = sections.getElementNames();
  for (int i = 0; i < names.length; ++i)
  {
    try
    {
      XTextRange range =
        UNO.XTextContent(sections.getByName(names[i])).getAnchor();
      if (compare.compareRegionStarts(docText, range) == 0) return true;
    }
    catch (Exception x)
    {
      Logger.error(x);
    }
  }
  return false;
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:28,代码来源:PrintIntoFile.java


示例6: registerTempDatasouce

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Registriert die {@link XDocumentDataSource} dataSource mit einem neuen
 * Zufallsnamen in OOo (so, dass sie z.B. in der Liste der Datenbanken unter
 * Tools->Extras->Optionen->Base/Datenbanken auftaucht) und gibt den Zufallsnamen
 * zurück.
 * 
 * @author Christoph Lutz (D-III-ITD-D101)
 */
private static String registerTempDatasouce(XDocumentDataSource dataSource)
{
  // neuen Zufallsnamen für Datenquelle bestimmen
  XSingleServiceFactory dbContext =
    UNO.XSingleServiceFactory(UNO.createUNOService("com.sun.star.sdb.DatabaseContext"));
  String name = null;
  XNameAccess nameAccess = UNO.XNameAccess(dbContext);
  if (nameAccess != null) do
  {
    name = TEMP_WOLLMUX_MAILMERGE_PREFIX + new Random().nextInt(100000);
  } while (nameAccess.hasByName(name));

  // Datenquelle registrieren
  if (name != null && UNO.XNamingService(dbContext) != null) try
  {
    UNO.XNamingService(dbContext).registerObject(name, dataSource);
  }
  catch (Exception e)
  {
    Logger.error(e);
  }

  return name;
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:33,代码来源:OOoBasedMailMerge.java


示例7: createNewSectionFromTextRange

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Erzeugt einen neuen Textbereich, der range umschließt und erzeugt ein
 * zugehöriges {@link SectionModel} und fügt es zu {@link #sectionModelList} hinzu.
 * 
 * @throws Exception
 *           , wenn was schief geht
 * @author Matthias Benkmann (D-III-ITD-D101)
 * 
 *         TESTED
 */
private void createNewSectionFromTextRange(XTextRange range) throws Exception
{
  XNamed section =
    UNO.XNamed(UNO.XMultiServiceFactory(doc).createInstance(
      "com.sun.star.text.TextSection"));
  XTextSectionsSupplier tssupp = UNO.XTextSectionsSupplier(doc);
  XNameAccess textSections = tssupp.getTextSections();
  String baseName = L.m("Sichtbarkeitsbereich");
  int count = 1;
  while (textSections.hasByName(baseName + count))
    ++count;
  String sectionName = baseName + count;
  section.setName(sectionName);
  XTextContent sectionContent = UNO.XTextContent(section);
  doc.getText().insertTextContent(range, sectionContent, true);
  sectionModelList.add(new SectionModel(sectionName, tssupp, formularMax4000));
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:28,代码来源:AllSectionLineViewsPanel.java


示例8: removeNonWMBookmarks

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Entfernt alle Bookmarks, die keine WollMux-Bookmarks sind aus dem Dokument doc.
 * 
 * @author Matthias Benkmann (D-III-ITD 5.1)
 */
public synchronized void removeNonWMBookmarks()
{
  model.updateLastTouchedByVersionInfo();

  XBookmarksSupplier bmSupp = UNO.XBookmarksSupplier(model.doc);
  XNameAccess bookmarks = bmSupp.getBookmarks();
  String[] names = bookmarks.getElementNames();
  for (int i = 0; i < names.length; ++i)
  {
    try
    {
      String bookmark = names[i];
      if (!TextDocumentModel.WOLLMUX_BOOKMARK_PATTERN.matcher(bookmark).matches())
      {
        XTextContent bm = UNO.XTextContent(bookmarks.getByName(bookmark));
        bm.getAnchor().getText().removeTextContent(bm);
      }

    }
    catch (Exception x)
    {
      Logger.error(x);
    }
  }
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:31,代码来源:TextDocumentController.java


示例9: getUserFieldMaster

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Diese Methode liefert den TextFieldMaster, der für Zugriffe auf das Benutzerfeld
 * mit den Namen userFieldName zuständig ist.
 * 
 * @param userFieldName
 * @return den TextFieldMaster oder null, wenn das Benutzerfeld userFieldName nicht
 *         existiert.
 * 
 * @author Christoph Lutz (D-III-ITD-5.1)
 */
private XPropertySet getUserFieldMaster(String userFieldName)
{
  XNameAccess masters = UNO.XTextFieldsSupplier(model.doc).getTextFieldMasters();
  String elementName = "com.sun.star.text.FieldMaster.User." + userFieldName;
  if (masters.hasByName(elementName))
  {
    try
    {
      return UNO.XPropertySet(masters.getByName(elementName));
    }
    catch (java.lang.Exception e)
    {
      Logger.error(e);
    }
  }
  return null;
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:28,代码来源:TextDocumentController.java


示例10: findCitedKeys

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
private List<String> findCitedKeys() throws NoSuchElementException, WrappedTargetException {
    XNameAccess xNamedMarks = getReferenceMarks();
    String[] names = xNamedMarks.getElementNames();
    List<String> keys = new ArrayList<>();
    for (String name1 : names) {
        Object bookmark = xNamedMarks.getByName(name1);
        UnoRuntime.queryInterface(XTextContent.class, bookmark);

        List<String> newKeys = parseRefMarkName(name1);
        for (String key : newKeys) {
            if (!keys.contains(key)) {
                keys.add(key);
            }
        }
    }

    return keys;
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:19,代码来源:OOBibBase.java


示例11: getFilterNames

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
public static List getFilterNames(XMultiComponentFactory xmulticomponentfactory) throws Exception {
    XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xmulticomponentfactory);
    Object oDefaultContext = xPropertySet.getPropertyValue("DefaultContext");
    XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, oDefaultContext);


    Object filterFactory = xmulticomponentfactory.createInstanceWithContext("com.sun.star.document.FilterFactory", xComponentContext);
    XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, filterFactory);
    String [] filterNames = xNameAccess.getElementNames();

    //String [] serviceNames = filterFactory.getAvailableServiceNames();
    for (int i=0; i < filterNames.length; i++) {
        String s = filterNames[i];
        Debug.logInfo(s, module);
        /*
        if (s.toLowerCase().indexOf("filter") >= 0) {
            Debug.logInfo("FILTER: " + s, module);
        }
        if (s.toLowerCase().indexOf("desktop") >= 0) {
            Debug.logInfo("DESKTOP: " + s, module);
        }
        */
    }

    List filterNameList = UtilMisc.toListArray(filterNames);
    return filterNameList;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:OpenOfficeWorker.java


示例12: dumpInfo

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * This method dumps info from the application described by the path.
 * 
 * @param path the path to be dumped, or null to dump from root
 * 
 * @throws Exception if dumping info fails
 * 
 * @author Markus Krüger
 * @date 18.11.2008
 */
public void dumpInfo(String path) throws Exception {
  if (path == null || path.length() == 0)
    path = NODE_ROOT;
  Object configProviderObject = serviceProvider.createService("com.sun.star.comp.configuration.ConfigurationProvider");
  XMultiServiceFactory xConfigServiceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
      configProviderObject);
  String readConfAccess = "com.sun.star.configuration.ConfigurationAccess";
  PropertyValue[] properties = new PropertyValue[1];
  properties[0] = new PropertyValue();
  properties[0].Name = "nodepath";
  properties[0].Value = path;
  Object configReadAccessObject = xConfigServiceFactory.createInstanceWithArguments(readConfAccess,
      properties);
  XNameAccess xConfigNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,
      configReadAccessObject);
  String[] names = xConfigNameAccess.getElementNames();
  System.out.println(path);
  System.out.println("=======================================");
  for (int i = 0; i < names.length; i++) {
    Object element = xConfigNameAccess.getByName(names[i]);
    if (element instanceof String || element instanceof Boolean
        || element instanceof Number
        || element instanceof Character
        || element instanceof CharSequence) {
      System.out.println(names[i] + ": "
          + element);
    }
    else if (element instanceof String[]) {
      System.out.println(names[i] + ": "
          + Arrays.asList((String[]) element).toString());
    }
    else if (!(element instanceof Any)) {
      dumpInfo(path + "/"
          + names[i]);
    }
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:48,代码来源:ApplicationInfo.java


示例13: convertLinkedImagesToEmbeded

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Convert linked text images to embedded images.
 * 
 * @throws TextException if conversion fails
 * 
 * @author Markus Krüger
 * @date 07.09.2009
 */
public void convertLinkedImagesToEmbeded() throws TextException {
  try {
    XTextGraphicObjectsSupplier graphicObjSupplier = (XTextGraphicObjectsSupplier) UnoRuntime.queryInterface(XTextGraphicObjectsSupplier.class,
        textDocument.getXTextDocument());
    XNameAccess nameAccess = graphicObjSupplier.getGraphicObjects();
    String[] names = nameAccess.getElementNames();
    for (int i = 0; i < names.length; i++) {
      Any xImageAny = (Any) nameAccess.getByName(names[i]);
      Object xImageObject = xImageAny.getObject();
      XTextContent xImage = (XTextContent) xImageObject;
      XServiceInfo xInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xImage);
      if (xInfo.supportsService("com.sun.star.text.TextGraphicObject")) {
        XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
            xImage);
        String name = xPropSet.getPropertyValue("LinkDisplayName").toString();
        String graphicURL = xPropSet.getPropertyValue("GraphicURL").toString();
        //only ones that are not embedded
        if (graphicURL.indexOf("vnd.sun.") == -1) {
          XMultiServiceFactory multiServiceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
              textDocument.getXTextDocument());
          XNameContainer xBitmapContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class,
              multiServiceFactory.createInstance("com.sun.star.drawing.BitmapTable"));
          if (!xBitmapContainer.hasByName(name)) {
            xBitmapContainer.insertByName(name, graphicURL);
            String newGraphicURL = xBitmapContainer.getByName(name).toString();
            xPropSet.setPropertyValue("GraphicURL", newGraphicURL);
          }
        }
      }
    }
  }
  catch (Exception exception) {
    TextException textException = new TextException(exception.getMessage());
    textException.initCause(exception);
    throw textException;
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:46,代码来源:TextContentService.java


示例14: getBookmarks

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Returns all bookmarks.
 * 
 * @return all bookmarks
 * 
 * @author Markus Krüger
 */
public IBookmark[] getBookmarks() {
  try {
    XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier) UnoRuntime.queryInterface(XBookmarksSupplier.class,
        textDocument.getXTextDocument());
    if (xBookmarksSupplier == null)
      return new IBookmark[0];
    XNameAccess nameAccess = xBookmarksSupplier.getBookmarks();
    String[] names = nameAccess.getElementNames();
    if (names.length < 1)
      return new IBookmark[0];
    List bookmarks = new ArrayList();
    for (int i = 0; i < names.length; i++) {
      Object bookmark = nameAccess.getByName(names[i]);
      XTextContent xBookmarkContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class,
          bookmark);
      XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, bookmark);
      if (xBookmarkContent == null)
        continue;
      XTextRange xBookmarkRange = xBookmarkContent.getAnchor();
      if (xBookmarkRange == null)
        continue;
      bookmarks.add(new Bookmark(textDocument, xBookmarkRange, xNamed));
    }
    return (IBookmark[]) bookmarks.toArray(new IBookmark[bookmarks.size()]);
  }
  catch (Exception exception) {
    return new IBookmark[0];
  }
}
 
开发者ID:LibreOffice,项目名称:noa-libre,代码行数:37,代码来源:BookmarkService.java


示例15: getConfigValue

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
private static String getConfigValue(String path, String name)
{
  try
  {
    XMultiComponentFactory xMultiComponentFactory =
      UNO.defaultContext.getServiceManager();
    Object oProvider =
      xMultiComponentFactory.createInstanceWithContext(
        "com.sun.star.configuration.ConfigurationProvider", UNO.defaultContext);
    XMultiServiceFactory xConfigurationServiceFactory =
      UnoRuntime.queryInterface(XMultiServiceFactory.class,
      oProvider);

    PropertyValue[] lArgs = new PropertyValue[1];
    lArgs[0] = new PropertyValue();
    lArgs[0].Name = "nodepath";
    lArgs[0].Value = path;

    Object configAccess =
      xConfigurationServiceFactory.createInstanceWithArguments(
        "com.sun.star.configuration.ConfigurationAccess", lArgs);

    XNameAccess xNameAccess =
      UnoRuntime.queryInterface(XNameAccess.class, configAccess);

    return xNameAccess.getByName(name).toString();
  }
  catch (Exception ex)
  {
    Logger.log(ex);
    return "";
  }
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:34,代码来源:WollMuxFiles.java


示例16: getStyleContainer

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Liefert den Styles vom Typ type des Dokuments doc.
 * 
 * @param doc
 *          Das Dokument, dessen StyleContainer zurückgeliefert werden soll.
 * @param type
 *          kann z.B. CHARACTER_STYLE oder PARAGRAPH_STYLE sein.
 * @return Liefert den Container der Styles vom Typ type des Dokuments doc oder
 *         null, falls der Container nicht bestimmt werden konnte.
 */
private static XNameContainer getStyleContainer(XTextDocument doc,
    String containerName)
{
  try
  {
    return UNO.XNameContainer(UNO.XNameAccess(
      UNO.XStyleFamiliesSupplier(doc).getStyleFamilies()).getByName(containerName));
  }
  catch (java.lang.Exception e)
  {}
  return null;
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:23,代码来源:SachleitendeVerfuegung.java


示例17: rangeStartTouchesNewSection

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Liefert true gdw der Anfang von range mit dem Anfang einer Section aus doc
 * zusammenfällt, deren Name nicht in oldSections ist.
 * 
 * @author Matthias Benkmann (D-III-ITD 5.1) TESTED
 */
private static boolean rangeStartTouchesNewSection(XTextRange range,
    Set<String> oldSectionNames, XTextDocument doc)
{
  XTextRange docText = doc.getText();
  XTextRangeCompare compare = UNO.XTextRangeCompare(docText);
  XNameAccess sections = UNO.XTextSectionsSupplier(doc).getTextSections();
  String[] names = sections.getElementNames();
  for (int i = 0; i < names.length; ++i)
  {
    if (!oldSectionNames.contains(names[i]))
    {
      try
      {
        XTextRange sectionRange =
          UNO.XTextContent(sections.getByName(names[i])).getAnchor();
        if (compare.compareRegionStarts(range, sectionRange) == 0) return true;
      }
      catch (Exception x)
      {
        // keine Logger-Meldung. Dies tritt regulär auf bei Bereichen, die in
        // anderen
        // Rahmen liegen und daher nicht mit einem Cursor im Dokumenthaupttext
        // vergleichbar sind.
      }
    }
  }
  return false;
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:35,代码来源:PrintIntoFile.java


示例18: deForm

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
/**
 * Entfernt die WollMux-Kommandos "insertFormValue", "setGroups", "setType
 * formDocument" und "form", sowie die WollMux-Formularbeschreibung und Daten aus
 * dem Dokument doc.
 * 
 * @author Matthias Benkmann (D-III-ITD 5.1) TESTED
 */
public synchronized void deForm()
{
  model.updateLastTouchedByVersionInfo();

  XBookmarksSupplier bmSupp = UNO.XBookmarksSupplier(model.doc);
  XNameAccess bookmarks = bmSupp.getBookmarks();
  String[] names = bookmarks.getElementNames();
  for (int i = 0; i < names.length; ++i)
  {
    try
    {
      String bookmark = names[i];
      if (TextDocumentModel.BOOKMARK_KILL_PATTERN.matcher(bookmark).matches())
      {
        XTextContent bm = UNO.XTextContent(bookmarks.getByName(bookmark));
        bm.getAnchor().getText().removeTextContent(bm);
      }

    }
    catch (Exception x)
    {
      Logger.error(x);
    }
  }

  model.getPersistentData().removeData(DataID.FORMULARBESCHREIBUNG);
  model.getPersistentData().removeData(DataID.FORMULARWERTE);
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:36,代码来源:TextDocumentController.java


示例19: getJabRefReferenceMarks

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
public List<String> getJabRefReferenceMarks(XNameAccess nameAccess) {
    String[] names = nameAccess.getElementNames();
    // Remove all reference marks that don't look like JabRef citations:
    List<String> result = new ArrayList<>();
    if (names != null) {
        for (String name : names) {
            if (CITE_PATTERN.matcher(name).find()) {
                result.add(name);
            }
        }
    }
    return result;
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:14,代码来源:OOBibBase.java


示例20: getSortedReferenceMarks

import com.sun.star.container.XNameAccess; //导入依赖的package包/类
private List<String> getSortedReferenceMarks(final XNameAccess nameAccess)
        throws WrappedTargetException, NoSuchElementException {
    XTextViewCursorSupplier cursorSupplier = UnoRuntime.queryInterface(XTextViewCursorSupplier.class,
            mxDoc.getCurrentController());

    XTextViewCursor viewCursor = cursorSupplier.getViewCursor();
    XTextRange initialPos = viewCursor.getStart();
    List<String> names = Arrays.asList(nameAccess.getElementNames());
    List<Point> positions = new ArrayList<>(names.size());
    for (String name : names) {
        XTextContent textContent = UnoRuntime.queryInterface(XTextContent.class, nameAccess.getByName(name));
        XTextRange range = textContent.getAnchor();
        // Check if we are inside a footnote:
        if (UnoRuntime.queryInterface(XFootnote.class, range.getText()) != null) {
            // Find the linking footnote marker:
            XFootnote footer = UnoRuntime.queryInterface(XFootnote.class, range.getText());
            // The footnote's anchor gives the correct position in the text:
            range = footer.getAnchor();
        }

        positions.add(findPosition(viewCursor, range));
    }
    Set<ComparableMark> set = new TreeSet<>();
    for (int i = 0; i < positions.size(); i++) {
        set.add(new ComparableMark(names.get(i), positions.get(i)));
    }

    List<String> result = new ArrayList<>(set.size());
    for (ComparableMark mark : set) {
        result.add(mark.getName());
    }
    viewCursor.gotoRange(initialPos, false);

    return result;
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:36,代码来源:OOBibBase.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnjoPermissionsHandler类代码示例发布时间:2022-05-23
下一篇:
Java DiscoveryService类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap