Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
target
target
.settings
.project
.classpath
3 changes: 1 addition & 2 deletions accessodf-addon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
<parent>
<groupId>be.docarch</groupId>
<artifactId>accessodf</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.1-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>accessodf-addon</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>oxt</packaging>
<name>accessodf :: Addon</name>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
import java.util.logging.FileHandler;
import java.util.logging.SimpleFormatter;

import com.sun.star.beans.Property;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XChild;
import com.sun.star.container.XEnumeration;
import com.sun.star.container.XEnumerationAccess;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.frame.XModel;
Expand All @@ -38,6 +42,7 @@

import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.ui.XUIElement;
import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.lib.uno.helper.Factory;

Expand All @@ -63,6 +68,10 @@ public final class AccessODFAddOn extends WeakBase
private File logFile = null;
private int counter = 0;

/**
* ProtocolHandler
* @param context
*/
public AccessODFAddOn( XComponentContext context )
{
m_xContext = context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package be.docarch.accessodf.ooo;

import com.sun.star.awt.MessageBoxButtons;
import com.sun.star.awt.MessageBoxType;
import com.sun.star.awt.Rectangle;
import com.sun.star.awt.XMessageBox;
import com.sun.star.awt.XMessageBoxFactory;
Expand Down Expand Up @@ -103,17 +104,15 @@ public static String showSaveAsDialog(String filename, String filterName, String
return sStorePath;
}

public static short showMessageBox(XWindowPeer parentWindowPeer, String messageBoxType, int messageBoxButtons, String messageBoxTitle, String message) {
public static short showMessageBox(XWindowPeer parentWindowPeer, MessageBoxType messageBoxType, int messageBoxButtons, String messageBoxTitle, String message) {
if (parentWindowPeer == null || messageBoxType == null || messageBoxTitle == null || message == null) {
return 0;
}

// Initialize the message box factory
XMessageBoxFactory messageBoxFactory = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, parentWindowPeer.getToolkit());

Rectangle messageBoxRectangle = new Rectangle();

XMessageBox box = messageBoxFactory.createMessageBox(parentWindowPeer, messageBoxRectangle, messageBoxType, messageBoxButtons, messageBoxTitle, message);
XMessageBox box = messageBoxFactory.createMessageBox(parentWindowPeer, messageBoxType, messageBoxButtons, messageBoxTitle, message);
return box.execute();
}

Expand All @@ -122,54 +121,54 @@ public static short showInfoMessageBox(XWindowPeer parentWindowPeer, String mess
return 0;
}

return showMessageBox(parentWindowPeer, "infobox", MessageBoxButtons.BUTTONS_OK, messageBoxTitle, message);
return showMessageBox(parentWindowPeer, MessageBoxType.INFOBOX, MessageBoxButtons.BUTTONS_OK, messageBoxTitle, message);
}

public static short showErrorMessageBox(XWindowPeer parentWindowPeer, String messageBoxTitle, String message) {
if (parentWindowPeer == null || messageBoxTitle == null || message == null) {
return 0;
}

return showMessageBox(parentWindowPeer, "errorbox", MessageBoxButtons.BUTTONS_OK, messageBoxTitle, message);
return showMessageBox(parentWindowPeer, MessageBoxType.ERRORBOX, MessageBoxButtons.BUTTONS_OK, messageBoxTitle, message);
}

public static short showYesNoWarningMessageBox(XWindowPeer parentWindowPeer, String messageBoxTitle, String message) {
if (parentWindowPeer == null || messageBoxTitle == null || message == null) {
return 0;
}

return showMessageBox(parentWindowPeer, "warningbox", MessageBoxButtons.BUTTONS_YES_NO + MessageBoxButtons.DEFAULT_BUTTON_NO, messageBoxTitle, message);
return showMessageBox(parentWindowPeer, MessageBoxType.WARNINGBOX, MessageBoxButtons.BUTTONS_YES_NO + MessageBoxButtons.DEFAULT_BUTTON_NO, messageBoxTitle, message);
}

public static short showOkCancelWarningMessageBox(XWindowPeer parentWindowPeer, String messageBoxTitle, String message) {
if (parentWindowPeer == null || messageBoxTitle == null || message == null) {
return 0;
}

return showMessageBox(parentWindowPeer, "warningbox", MessageBoxButtons.BUTTONS_OK_CANCEL + MessageBoxButtons.DEFAULT_BUTTON_OK, messageBoxTitle, message);
return showMessageBox(parentWindowPeer, MessageBoxType.WARNINGBOX, MessageBoxButtons.BUTTONS_OK_CANCEL + MessageBoxButtons.DEFAULT_BUTTON_OK, messageBoxTitle, message);
}

public static short showQuestionMessageBox(XWindowPeer parentWindowPeer, String messageBoxTitle, String message) {
if (parentWindowPeer == null || messageBoxTitle == null || message == null) {
return 0;
}

return showMessageBox(parentWindowPeer, "querybox", MessageBoxButtons.BUTTONS_YES_NO_CANCEL + MessageBoxButtons.DEFAULT_BUTTON_YES, messageBoxTitle, message);
return showMessageBox(parentWindowPeer, MessageBoxType.QUERYBOX, MessageBoxButtons.BUTTONS_YES_NO_CANCEL + MessageBoxButtons.DEFAULT_BUTTON_YES, messageBoxTitle, message);
}

public static short showAbortRetryIgnoreErrorMessageBox(XWindowPeer parentWindowPeer, String messageBoxTitle, String message) {
if (parentWindowPeer == null || messageBoxTitle == null || message == null) {
return 0;
}

return showMessageBox(parentWindowPeer, "errorbox", MessageBoxButtons.BUTTONS_ABORT_IGNORE_RETRY + MessageBoxButtons.DEFAULT_BUTTON_RETRY, messageBoxTitle, message);
return showMessageBox(parentWindowPeer, MessageBoxType.ERRORBOX, MessageBoxButtons.BUTTONS_ABORT_IGNORE_RETRY + MessageBoxButtons.DEFAULT_BUTTON_RETRY, messageBoxTitle, message);
}

public static short showRetryCancelErrorMessageBox(XWindowPeer parentWindowPeer, String messageBoxTitle, String message) {
if (parentWindowPeer == null || messageBoxTitle == null || message == null) {
return 0;
}

return showMessageBox(parentWindowPeer, "errorbox", MessageBoxButtons.BUTTONS_RETRY_CANCEL + MessageBoxButtons.DEFAULT_BUTTON_CANCEL, messageBoxTitle, message);
return showMessageBox(parentWindowPeer, MessageBoxType.ERRORBOX, MessageBoxButtons.BUTTONS_RETRY_CANCEL + MessageBoxButtons.DEFAULT_BUTTON_CANCEL, messageBoxTitle, message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
import com.sun.star.awt.tree.XTreeControl;
import com.sun.star.awt.tree.XMutableTreeDataModel;
import com.sun.star.awt.tree.XMutableTreeNode;
import com.sun.star.ui.LayoutSize;
import com.sun.star.ui.XSidebarPanel;
import com.sun.star.ui.XToolPanel;
import com.sun.star.deployment.PackageInformationProvider;
import com.sun.star.deployment.XPackageInformationProvider;
Expand Down Expand Up @@ -101,6 +103,7 @@ public class AccessibilityPanel extends ComponentBase
XItemListener,
XActionListener,
XWindowListener,
XSidebarPanel,
XAdjustmentListener,
XSelectionChangeListener {

Expand Down Expand Up @@ -231,6 +234,7 @@ public AccessibilityPanel(XComponentContext xContext,
window = (XWindow)UnoRuntime.queryInterface(XWindow.class, windowPeer);

if (window != null) {
window.setVisible(true);

window.setPosSize(0, 0, panelAnchorSize.Width, panelAnchorSize.Height, PosSize.POSSIZE);

Expand Down Expand Up @@ -1421,4 +1425,17 @@ private static String unoURLtoURL(String unoURL) {
return null;
}
}

@Override
public LayoutSize getHeightForWidth (final int nWidth)
{
// final int nMinHeight = 100;
// final int nMaxHeight = Math.max(nWidth, nMinHeight);
return new LayoutSize(100, 1000, 500); // min, max, preferred
}

@Override
public int getMinimalWidth() {
return 300;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,36 @@

import java.util.logging.Logger;

import com.sun.star.uno.XComponentContext;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.awt.XWindow;
import com.sun.star.frame.XFrame;
import com.sun.star.lang.XComponent;
import com.sun.star.ui.XUIElement;
import com.sun.star.ui.XToolPanel;
import com.sun.star.ui.UIElementType;
import com.sun.star.lib.uno.helper.ComponentBase;

import com.sun.star.lang.DisposedException;

import be.docarch.accessodf.Constants;

public class PanelUIElement extends ComponentBase
implements XUIElement {
public class PanelUIElement implements XUIElement {

private final String m_sResourceURL;
private XToolPanel m_xToolPanel;
private XFrame m_xFrame;

private static final Logger logger = Logger.getLogger(Constants.LOGGER_NAME);

public PanelUIElement(XComponentContext context,
XWindow i_rParentWindow,
String i_rResourceURL) {
public PanelUIElement(String i_rResourceURL,
XFrame xFrame, XToolPanel toolPanel) {

logger.entering("PanelUIElement", "<init>");

m_xFrame = xFrame;
m_xToolPanel = toolPanel;
m_sResourceURL = i_rResourceURL;
m_xToolPanel = new AccessibilityPanel(context, i_rParentWindow);

}

// XUIElement
// XUIElement
public XFrame getFrame() {

// TODO
return null;
return m_xFrame;
}

public String getResourceURL() {
Expand All @@ -79,11 +71,6 @@ public Object getRealInterface() {
return m_xToolPanel;
}

public void disposing() {

XComponent xPanelComponent = (XComponent)UnoRuntime.queryInterface(XComponent.class, m_xToolPanel);
xPanelComponent.dispose();
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.sun.star.registry.XRegistryKey;

import com.sun.star.container.NoSuchElementException;
import com.sun.star.frame.XFrame;
import com.sun.star.lang.IllegalArgumentException;

import be.docarch.accessodf.Constants;
Expand Down Expand Up @@ -88,25 +89,30 @@ public XUIElement createUIElement(String i_rResourceURL,

logger.entering("_ToolPanelFactory", "createUIElement");

if (!i_rResourceURL.startsWith("private:resource/toolpanel/be.docarch.accessodf.ooo.toolpanel")) {
throw new NoSuchElementException(i_rResourceURL, this);
if (!i_rResourceURL.startsWith("private:resource/toolpanel/AccessODFPanelFactory/be.docarch.accessodf.ooo.toolpanel")) {
logger.severe("got wrong resource url: " + i_rResourceURL);
throw new NoSuchElementException(i_rResourceURL, this);
}

// retrieve the parent window
XWindow xParentWindow = null;
XFrame xFrame = null;

for (int i=0; i<i_rArgs.length; i++) {
if (i_rArgs[i].Name.equals("ParentWindow")) {
xParentWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, i_rArgs[i].Value);
break;
}
else if (i_rArgs[i].Name.equals("Frame")) {
xFrame = (XFrame)UnoRuntime.queryInterface(XFrame.class, i_rArgs[i].Value);
}
}

if (xParentWindow == null) {
throw new IllegalArgumentException("No parent window provided in the creation arguments. Cannot create tool panel.");
if (xParentWindow == null || xFrame == null) {
throw new IllegalArgumentException("No parent window or Frame provided in the creation arguments. Cannot create tool panel.");
}

// create the panel
return new PanelUIElement(m_xContext, xParentWindow, i_rResourceURL);
return new PanelUIElement(i_rResourceURL, xFrame, new AccessibilityPanel(m_xContext, xParentWindow));

}

Expand Down
10 changes: 5 additions & 5 deletions accessodf-addon/src/main/oxt/Addons.xcu
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">~Accessibility Evaluation…</value>
<value xml:lang="es">~Accesibilidad…</value>
<value xml:lang="nl">~Toegankelijkheid…</value>
<value xml:lang="fr">~Accessibilité…</value>
<value xml:lang="el">~Προσβασιμότητα…</value>
<value xml:lang="de">~Barrierefreiheit…</value>
<value xml:lang="es">~Accesibilidad…</value>
<value xml:lang="nl">~Toegankelijkheid…</value>
<value xml:lang="fr">~Accessibilité…</value>
<value xml:lang="el">~Προσβασιμότητα…</value>
<value xml:lang="de">~Barrierefreiheit…</value>
</prop>
</node>
</node>
Expand Down
10 changes: 6 additions & 4 deletions accessodf-addon/src/main/oxt/META-INF/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
<manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Java"
manifest:full-path="accessodf-addon-${accessodf.version}.jar"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
manifest:full-path="WriterWindowState.xcu"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
manifest:full-path="ProtocolHandler.xcu"/>
manifest:full-path="registry/ProtocolHandler.xcu"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
manifest:full-path="Addons.xcu"/>

<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
manifest:full-path="registry/data/org/openoffice/Office/UI/Factories.xcu"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
manifest:full-path="Factories.xcu"/>
manifest:full-path="registry/data/org/openoffice/Office/UI/Sidebar.xcu"/>

<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-schema"
manifest:full-path="Settings.xcs"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
Expand Down
26 changes: 0 additions & 26 deletions accessodf-addon/src/main/oxt/WriterWindowState.xcu

This file was deleted.

10 changes: 6 additions & 4 deletions accessodf-addon/src/main/oxt/description.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink">
<description
xmlns="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Release Number -->
<version value="${accessodf.version}"/>
<!-- Identifier -->
<identifier value="be.docarch.accessodf.ooo.accessodfaddon"/>
<!-- OpenOffice.org Minimal Version -->
<dependencies>
<OpenOffice.org-minimal-version value="${openoffice.version}" name="OpenOffice.org ${openoffice.version}"/>
<!-- LibreOffice Minimal Version -->
<dependencies xmlns:lo="http://libreoffice.org/extensions/description/2011">
<lo:LibreOffice-minimal-version value="${libreoffice.version}" name="LibreOffice ${libreoffice.version}"/>
</dependencies>
<!-- Auto Update Link: TODO-->

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<node oor:name="Registered">
<node oor:name="UIElementFactories">
<node oor:name="UIElementFactories">
<node oor:name="be.docarch.accessodf.ooo.toolpanel" oor:op="replace">
<prop oor:name="Type">
<value>toolpanel</value>
</prop>
<prop oor:name="Name">
<value>be.docarch.accessodf.ooo.toolpanel</value>
<!-- <value>be.docarch.accessodf.ooo.toolpanel</value> -->
<value>AccessODFPanelFactory</value>
</prop>
<prop oor:name="Module">
<value/>
Expand Down
Loading