protected void fillTables(XDispatchHelper xDispatchHelper) throws com.sun.star.uno.Exception {
List<String> tablesNames = TableManager.getTablesNames(xComponent);
for (String tableName : tablesNames) {
TableManager tableManager = new TableManager(xComponent, tableName);
BandFinder bandFinder = new BandFinder(tableManager).find();
BandData band = bandFinder.getBand();
String bandName = bandFinder.getBandName();
int numberOfRowWithAliases = tableManager.findRowWithAliases();
if (band != null && numberOfRowWithAliases > -1) {
XTextTable xTextTable = tableManager.getXTextTable();
// try to select one cell without it workaround
int columnCount = xTextTable.getColumns().getCount();
if (columnCount < 2) {
xTextTable.getColumns().insertByIndex(columnCount, 1);
}
fillTable(band.getName(), band.getParentBand(), tableManager, xDispatchHelper, numberOfRowWithAliases);
// end of workaround ->
if (columnCount < 2) {
xTextTable.getColumns().removeByIndex(columnCount, 1);
}
} else if (numberOfRowWithAliases > -1
&& rootBand.getFirstLevelBandDefinitionNames() != null
&& rootBand.getFirstLevelBandDefinitionNames().contains(bandName)) {
//if table is linked with band and has aliases on it, but no band data found -
//we are removing the row
tableManager.deleteRow(numberOfRowWithAliases);
}
}
}