Adding tabs for outline
This commit is contained in:
parent
71776fa54b
commit
cebf79d67e
2 changed files with 13 additions and 2 deletions
|
@ -50,6 +50,7 @@ public class Document {
|
||||||
private XDocumentProperties documentProperties;
|
private XDocumentProperties documentProperties;
|
||||||
private XDocumentPropertiesSupplier documentPropertiesSupplier;
|
private XDocumentPropertiesSupplier documentPropertiesSupplier;
|
||||||
private XText text = null;
|
private XText text = null;
|
||||||
|
private ArrayList<OutlineElement> outline = new ArrayList<OutlineElement>();
|
||||||
|
|
||||||
public Document(XComponentContext componentContext) {
|
public Document(XComponentContext componentContext) {
|
||||||
context = componentContext;
|
context = componentContext;
|
||||||
|
@ -99,8 +100,7 @@ public class Document {
|
||||||
XTextRange textRange = textContent.getAnchor();
|
XTextRange textRange = textContent.getAnchor();
|
||||||
String name = textRange.getString();
|
String name = textRange.getString();
|
||||||
System.out.println("Outline element found! " + name);
|
System.out.println("Outline element found! " + name);
|
||||||
new OutlineElement(textRange);
|
outline.add(new OutlineElement(textRange));
|
||||||
//TODO: outline element found. Save outline element name and anchor
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
|
@ -297,5 +297,8 @@ public class Document {
|
||||||
return info.supportsService(service);
|
return info.supportsService(service);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public ArrayList<OutlineElement> getOutline(){
|
||||||
|
return outline;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import javax.swing.table.TableModel;
|
||||||
|
|
||||||
import pro.litvinovg.libreoffice.metadata.CustomDocumentProperty;
|
import pro.litvinovg.libreoffice.metadata.CustomDocumentProperty;
|
||||||
import pro.litvinovg.libreoffice.metadata.Document;
|
import pro.litvinovg.libreoffice.metadata.Document;
|
||||||
|
import pro.litvinovg.libreoffice.metadata.OutlineElement;
|
||||||
|
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
|
@ -62,6 +63,7 @@ public class EditorGUI extends JFrame {
|
||||||
private Document document = null;
|
private Document document = null;
|
||||||
private JButton btnNewButton;
|
private JButton btnNewButton;
|
||||||
private JMenuItem menuItemPupupDocUserProps;
|
private JMenuItem menuItemPupupDocUserProps;
|
||||||
|
private ArrayList<OutlineElement> outline;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,11 +114,13 @@ public class EditorGUI extends JFrame {
|
||||||
this.document = doc;
|
this.document = doc;
|
||||||
docProps = document.getDocumentProperties();
|
docProps = document.getDocumentProperties();
|
||||||
docCustomProps = document.getDocumentCustomProperties();
|
docCustomProps = document.getDocumentCustomProperties();
|
||||||
|
outline = document.getOutline();
|
||||||
initComponents();
|
initComponents();
|
||||||
createEvents();
|
createEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditorGUI() {
|
public EditorGUI() {
|
||||||
|
outline = new ArrayList<OutlineElement>();
|
||||||
initComponents();
|
initComponents();
|
||||||
createEvents();
|
createEvents();
|
||||||
}
|
}
|
||||||
|
@ -176,6 +180,10 @@ public class EditorGUI extends JFrame {
|
||||||
|
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
tabbedPane.addTab("Документ", null, panel, null);
|
tabbedPane.addTab("Документ", null, panel, null);
|
||||||
|
for (OutlineElement element : outline) {
|
||||||
|
tabbedPane.addTab(element.getName(), null, new JPanel(), null);
|
||||||
|
|
||||||
|
}
|
||||||
tabbedPane.setEnabledAt(0, true);
|
tabbedPane.setEnabledAt(0, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue