Example #1
0
  protected void fillTable(
      String name,
      BandData parentBand,
      TableManager tableManager,
      XDispatchHelper xDispatchHelper,
      int numberOfRowWithAliases)
      throws com.sun.star.uno.Exception {
    // Lock clipboard, cause uno uses it to grow tables, relevant for desktops
    synchronized (clipboardLock) {
      XTextTable xTextTable = tableManager.getXTextTable();
      if (officeIntegration.isDisplayDeviceAvailable()) {
        clearClipboard();
      }

      List<BandData> childrenByName = parentBand.getChildrenByName(name);
      for (BandData ignored : childrenByName) {
        tableManager.copyRow(
            xDispatchHelper,
            as(XTextDocument.class, xComponent).getCurrentController(),
            numberOfRowWithAliases);
      }

      int i = numberOfRowWithAliases;
      for (BandData child : childrenByName) {
        if (name.equals(child.getName())) {
          fillRow(child, tableManager, i);
          i++;
        }
      }
      tableManager.deleteRow(i);
    }
  }