diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-01-28 19:03:55 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-01-28 19:03:55 +0000 |
commit | 114b4766cefe57be30f4af858700e718c98b2bd1 (patch) | |
tree | 96a203bdea998f235ba8471d74ffce8a0059e49c | |
parent | 08ee2a3eec4227e80e030f328d7a63d37daf51a5 (diff) | |
parent | b4f7e9e44292d81c4645e790545461943fb003c6 (diff) |
koheidatapilot03: merge with DEV300_m57
135 files changed, 11720 insertions, 506 deletions
diff --git a/accessibility/prj/build.lst b/accessibility/prj/build.lst index 2288410ffba8..351473e38450 100755 --- a/accessibility/prj/build.lst +++ b/accessibility/prj/build.lst @@ -9,3 +9,9 @@ ac accessibility\source\helper nmake - all ac_h ac accessibility\source\standard nmake - all ac_standard ac_helper ac_inc NULL ac accessibility\source\extended nmake - all ac_extended ac_inc NULL ac accessibility\util nmake - all ac_util ac_helper ac_standard ac_extended NULL +ac accessibility\workben\org\openoffice\accessibility\awb nmake - all ac_awb_main ac_awb_misc ac_awb_canvas ac_awb_view ac_awb_tree NULL +ac accessibility\workben\org\openoffice\accessibility\misc nmake - all ac_awb_misc NULL +ac accessibility\workben\org\openoffice\accessibility\awb\canvas nmake - all ac_awb_canvas ac_awb_tree NULL +ac accessibility\workben\org\openoffice\accessibility\awb\tree nmake - all ac_awb_tree ac_awb_misc NULL +ac accessibility\workben\org\openoffice\accessibility\awb\view nmake - all ac_awb_view ac_awb_view_text NULL +ac accessibility\workben\org\openoffice\accessibility\awb\view\text nmake - all ac_awb_view_text NULL diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx index f75f9a1b265f..2db3debe33a4 100644 --- a/accessibility/source/extended/accessiblelistbox.cxx +++ b/accessibility/source/extended/accessiblelistbox.cxx @@ -132,6 +132,32 @@ namespace accessibility } } break; + + // --> OD 2009-04-01 #i92103# + case VCLEVENT_LISTBOX_ENTRY_EXPANDED : + case VCLEVENT_LISTBOX_ENTRY_COLLAPSED : + { + SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() ); + if ( pEntry ) + { + AccessibleListBoxEntry* pAccListBoxEntry = + new AccessibleListBoxEntry( *getListBox(), pEntry, this ); + Reference< XAccessible > xChild = pAccListBoxEntry; + const short nAccEvent = + ( rVclWindowEvent.GetId() == VCLEVENT_LISTBOX_ENTRY_EXPANDED ) + ? AccessibleEventId::LISTBOX_ENTRY_EXPANDED + : AccessibleEventId::LISTBOX_ENTRY_COLLAPSED; + uno::Any aListBoxEntry; + aListBoxEntry <<= xChild; + NotifyAccessibleEvent( nAccEvent, Any(), aListBoxEntry ); + if ( getListBox() && getListBox()->HasFocus() ) + { + NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), aListBoxEntry ); + } + } + break; + } + // <-- } default: VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx index bc6e77ab6191..ad1f4ab2e01b 100644 --- a/accessibility/source/standard/vclxaccessiblebox.cxx +++ b/accessibility/source/standard/vclxaccessiblebox.cxx @@ -155,7 +155,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven // combobox, however, we have to help the list with providing // the text of the currently selected item. VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); - if (pList != NULL) + if (pList != NULL && m_xText.is()) { Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY); if ( xText.is() ) diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index f89dbe1767c3..76507d22e3cf 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -47,6 +47,7 @@ #include <vcl/svapp.hxx> #include <vcl/toolbox.hxx> #include <vcl/unohelp2.hxx> +#include <vcl/help.hxx> #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/helper/externallock.hxx> #include <unotools/accessiblestatesethelper.hxx> @@ -618,9 +619,12 @@ awt::FontDescriptor SAL_CALL VCLXAccessibleToolBoxItem::getFontMetrics( const Re ::rtl::OUString sRet; if ( m_pToolBox ) { - sRet = m_pToolBox->GetQuickHelpText( m_nItemId ); + if ( Help::IsExtHelpEnabled() ) + sRet = m_pToolBox->GetHelpText( m_nItemId ); + else + sRet = m_pToolBox->GetQuickHelpText( m_nItemId ); if ( !sRet.getLength() ) - // no quick help text set, so use item text + // no help text set, so use item text sRet = m_pToolBox->GetItemText( m_nItemId ); } return sRet; diff --git a/accessibility/workben/TODO b/accessibility/workben/TODO new file mode 100644 index 000000000000..6fdfd5cb81aa --- /dev/null +++ b/accessibility/workben/TODO @@ -0,0 +1,13 @@ +This is a unsorted list of TODO's and idea regarding the Accessibility Workbench + +* increase repaint performance +* fix paint problems in ObjectViewContainer for e.g. File menu +* change package structure to be flat (apps don't need deep package names) +* add ant build script(s) +* evaluate TreeTable as enhanced overview +* add error panel and a bunch of consistency checks +* add focus tracking mode +* evaluate drawing transparent frames at screen coordinates of an object +* enhance text view (colors) +* add table view +* more generic view loading (Class.forName()) diff --git a/accessibility/workben/makefile b/accessibility/workben/makefile new file mode 100644 index 000000000000..4bd7c05e44dd --- /dev/null +++ b/accessibility/workben/makefile @@ -0,0 +1,9 @@ +all: + cd source/org/openoffice/accessibility ; $(MAKE) all + +ROOT=source +SUBDIRS=source/org/openoffice/accessibility +include source/makefile.in + +run: all + $(JAVA) -classpath $(CLASSPATH) org.openoffice.accessibility.awb.AccessibilityWorkBench diff --git a/accessibility/workben/makefile.in b/accessibility/workben/makefile.in new file mode 100644 index 000000000000..ad97448e7780 --- /dev/null +++ b/accessibility/workben/makefile.in @@ -0,0 +1,32 @@ +PRJ=$(ROOT)/.. +SETTINGS=$(OO_SDK_HOME)/settings +include $(SETTINGS)/settings.mk +include $(SETTINGS)/std.mk +include $(SETTINGS)/dk.mk + +OUT_COMP_JAVA = $(OUT_CLASS)/$(patsubst .,/,$(PACKAGE)) +JAVAC=$(JAVA_HOME)/bin/javac +JAVA=$(JAVA_HOME)/bin/java +CLASS_FILES = $(patsubst %.java, %.class, $(JAVAFILES)) +CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(OFFICE_CLASSES_DIR)/jurt.jar\ + $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/unoil.jar\ + $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/ridl.jar\ + $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/sandbox.jar\ + $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/juh.jar\ + $(PATH_SEPARATOR)$(OUT_COMP_JAVA)\ + $(PATH_SEPARATOR).\ + $(PATH_SEPARATOR)$(ROOT)\ + ) + +subdirs: + $(foreach dir,$(SUBDIRS), cd $(dir);$(MAKE);cd ..;) + +clean: + -rm *.class *.jar + $(foreach dir,$(SUBDIRS), cd $(dir);$(MAKE) clean ; cd ..;) + + +%.class : %.java + $(JAVAC) -classpath $(CLASSPATH) $< + +.PHONY: all package clean subdirs diff --git a/accessibility/workben/makefile.mk b/accessibility/workben/makefile.mk new file mode 100644 index 000000000000..33c1e2a0ef5e --- /dev/null +++ b/accessibility/workben/makefile.mk @@ -0,0 +1,40 @@ +# copied from settings.mk +SOLARBINDIR=$(SOLARVERSION)$/$(INPATH)$/bin$(UPDMINOREXT) + +# Please modify the following lines to match your environment: +# If you use the run: target at the end of the file, then adapt pipe name +PIPE_NAME = $(USER) + +# The following variables probably don't need to be changed. +JAVA = java +# The JAR_PATH points to the jar files of your local office installation. +JAR_PATH = $(SOLARBINDIR)$/ + + +# The rest of this makefile should not need to be touched. + +JAR_FILES = \ + unoil.jar \ + sandbox.jar \ + ridl.jar \ + jurt.jar \ + juh.jar \ + java_uno.jar + + +JAVA_CLASSPATHS := \ + ..$/$(INPATH)$/class \ + $(foreach,i,$(JAR_FILES) $(JAR_PATH)$i) \ + $(CLASSPATH) + +CLASSPATH !:=$(JAVA_CLASSPATHS:t$(PATH_SEPERATOR)) + +all: + build + +# Example of how to run the work bench. +run: + +$(JAVA) -classpath "$(CLASSPATH)" org/openoffice/accessibility/awb/AccessibilityWorkBench -p $(PIPE_NAME) + +runjar: + +$(JAVA) -classpath "$(CLASSPATH)" -jar AccessibilityWorkBench.jar -p $(PIPE_NAME) diff --git a/accessibility/workben/org/openoffice/accessibility/Makefile b/accessibility/workben/org/openoffice/accessibility/Makefile new file mode 100644 index 000000000000..a6db6a05ab4b --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/Makefile @@ -0,0 +1,6 @@ +all : subdirs + +ROOT=../../../ +SUBDIRS=misc awb +include $(ROOT)/makefile.in + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java b/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java new file mode 100644 index 000000000000..fd1d0e1fa13d --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java @@ -0,0 +1,724 @@ +/************************************************************************* + * + * $RCSfile: AccessibilityWorkBench.java,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: obr $ $Date: 2008/05/14 13:21:34 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb; + +import java.awt.Cursor; +import java.awt.GridBagConstraints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.event.TreeSelectionListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeExpansionListener; +import javax.swing.event.TreeWillExpandListener; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; + +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.frame.XFrame; +import com.sun.star.frame.XTerminateListener; +import com.sun.star.lang.EventObject; +import com.sun.star.uno.UnoRuntime; + +import org.openoffice.accessibility.misc.MessageArea; +import org.openoffice.accessibility.misc.Options; +import org.openoffice.accessibility.misc.OfficeConnection; +import org.openoffice.accessibility.misc.SimpleOffice; +import org.openoffice.accessibility.awb.canvas.Canvas; +import org.openoffice.accessibility.awb.tree.AccessibilityTree; +import org.openoffice.accessibility.awb.tree.AccessibilityModel; +import org.openoffice.accessibility.awb.tree.DynamicAccessibilityModel; +import org.openoffice.accessibility.awb.view.ObjectViewContainer; +import org.openoffice.accessibility.awb.view.ObjectViewContainerWindow; + + + +/** This class manages the GUI of the work bench. + @see AccessibilityTreeModel + for the implementation of the tree view on the left side which also + manages the registration of accessibility listeners. + @see Canvas + for the graphical view of the accessible objects. +*/ +public class AccessibilityWorkBench + extends JFrame + implements XTerminateListener, + ActionListener, + TreeSelectionListener +{ + public static final String msVersion = "v1.9"; + public String msOptionsFileName = ".AWBrc"; + + public static void main (String args[]) + { + String sPipeName = System.getenv( "USER" ); + + for (int i=0; i<args.length; i++) + { + if (args[i].equals ("-h") || args[i].equals ("--help") || args[i].equals ("-?")) + { + System.out.println ("usage: AccessibilityWorkBench <option>*"); + System.out.println ("options:"); + System.out.println (" -p <pipe-name> name of the pipe to use to connect to OpenOffice.org."); + System.out.println (" Defaults to $USER."); + System.exit (0); + } + else if (args[i].equals ("-p")) + { + sPipeName = args[++i]; + } + } + + saWorkBench = new AccessibilityWorkBench (sPipeName); + } + + + + + /** Return the one instance of the AccessibilityWorkBench + @return + Returns null when the AccessibilityWorkBench could not be + created successfully. + */ + public static AccessibilityWorkBench Instance () + { + return saWorkBench; + } + + + + /** Create an accessibility work bench that listens at the specified + port to Office applications. + */ + private AccessibilityWorkBench (String sPipeName) + { + mbInitialized = false; + + OfficeConnection.SetPipeName (sPipeName); + Options.Instance().Load (msOptionsFileName); + Layout (); + + MessageArea.println (System.getProperty ("os.name") + " / " + + System.getProperty ("os.arch") + " / " + + System.getProperty ("os.version")); + MessageArea.println ("Using pipe name " + sPipeName); + + maTree.addTreeSelectionListener (this); + + addWindowListener (new WindowAdapter () + { public void windowClosing (WindowEvent e) {Quit();} } + ); + + OfficeConnection.Instance().AddConnectionListener (this); + Initialize (); + } + + + + + /** Create and arrange the widgets of the GUI. + */ + public void Layout () + { + setSize (new java.awt.Dimension (800,600)); + + JScrollPane aScrollPane; + GridBagConstraints constraints; + + // Create new layout. + java.awt.GridBagLayout aLayout = new java.awt.GridBagLayout (); + getContentPane().setLayout (aLayout); + + // Accessible Tree. + javax.swing.tree.TreeModel treeModel = new DynamicAccessibilityModel(); + maTree = new AccessibilityTree(treeModel); + // Add the model as tree listeners to be able to populate/clear the + // child lists on demand. + maTree.addTreeExpansionListener((TreeExpansionListener) treeModel); + maTree.addTreeWillExpandListener((TreeWillExpandListener) treeModel); + + JScrollPane aTreeScrollPane = new JScrollPane( + maTree, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + aTreeScrollPane.setPreferredSize (new java.awt.Dimension (400,300)); + + // Object view shows details about the currently selected accessible + // object. + maObjectViewContainer = new ObjectViewContainer (); + JScrollPane aObjectViewContainerScrollPane = new JScrollPane( + maObjectViewContainer, + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + aObjectViewContainerScrollPane.setPreferredSize ( + new java.awt.Dimension (400,300)); + JButton aCornerButton = new JButton ("CreateNewViewWindow"); + aCornerButton.addActionListener (this); + aObjectViewContainerScrollPane.setCorner ( + JScrollPane.LOWER_RIGHT_CORNER, + aCornerButton); + + // Split pane for tree view and object view. + JSplitPane aLeftViewSplitPane = new JSplitPane ( + JSplitPane.VERTICAL_SPLIT, + aTreeScrollPane, + aObjectViewContainerScrollPane + ); + aLeftViewSplitPane.setDividerLocation (300); + aLeftViewSplitPane.setContinuousLayout (true); + + // Canvas. + maCanvas = new Canvas (); + maCanvas.SetTree (maTree); + JScrollPane aScrolledCanvas = new JScrollPane(maCanvas, + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + aScrolledCanvas.getViewport().setBackground (java.awt.Color.RED); + aScrolledCanvas.setPreferredSize (new java.awt.Dimension(600,400)); + + // Split pane for tree view and canvas. + JSplitPane aViewSplitPane = new JSplitPane ( + JSplitPane.HORIZONTAL_SPLIT, + aLeftViewSplitPane, + aScrolledCanvas + ); + aViewSplitPane.setOneTouchExpandable(true); + aViewSplitPane.setDividerLocation (400); + aViewSplitPane.setContinuousLayout (true); + + // Split pane for the three views at the top and the message area. + MessageArea.Instance().setPreferredSize (new java.awt.Dimension(600,50)); + JSplitPane aSplitPane = new JSplitPane ( + JSplitPane.VERTICAL_SPLIT, + aViewSplitPane, + MessageArea.Instance()); + aSplitPane.setOneTouchExpandable(true); + aSplitPane.setContinuousLayout (true); + addGridElement (aSplitPane, 0,0, 2,1, 3,3, + GridBagConstraints.CENTER, GridBagConstraints.BOTH); + + // Button bar. + maButtonBar = new javax.swing.JPanel(); + java.awt.GridBagLayout aButtonLayout = new java.awt.GridBagLayout (); + maButtonBar.setLayout (new java.awt.FlowLayout()); + addGridElement (maButtonBar, 0,3, 2,1, 1,0, + GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL); + + // Buttons. + // maConnectButton = createButton ("Connect", "connect"); + // maUpdateButton = createButton ("Update", "update"); + // maShapesButton = createButton ("Expand Shapes", "shapes"); + maExpandButton = createButton ("Expand All", "expand"); + maQuitButton = createButton ("Quit", "quit"); + UpdateButtonStates (); + + setJMenuBar (CreateMenuBar ()); + + setTitle("Accessibility Workbench " + msVersion); + + setVisible (true); + pack (); + aSplitPane.setDividerLocation (1.0); + validate (); + repaint(); + } + + + + + /** Shortcut method for adding an object to a GridBagLayout. + */ + void addGridElement (JComponent object, + int x, int y, + int width, int height, + int weightx, int weighty, + int anchor, int fill) + { + GridBagConstraints constraints = new GridBagConstraints (); + constraints.gridx = x; + constraints.gridy = y; + constraints.gridwidth = width; + constraints.gridheight = height; + constraints.weightx = weightx; + constraints.weighty = weighty; + constraints.anchor = anchor; + constraints.fill = fill; + getContentPane().add (object, constraints); + } + + + + + /** Create a new button and place at the right most position into the + button bar. + */ + public JButton createButton (String title, String command) + { + JButton aButton = new JButton (title); + aButton.setEnabled (false); + aButton.setActionCommand (command); + aButton.addActionListener (this); + + maButtonBar.add (aButton); + return aButton; + } + + + + + /** Create a menu bar for the application. + @return + Returns the new menu bar. The returned reference is also + remembered in the data member <member>maMenuBar</member>. + */ + javax.swing.JMenuBar CreateMenuBar() + { + // Menu bar. + maMenuBar = new JMenuBar (); + + // File menu. + JMenu aFileMenu = new JMenu ("File"); + maMenuBar.add (aFileMenu); + JMenuItem aItem; + aItem = new JMenuItem ("Quit"); + aFileMenu.add (aItem); + aItem.addActionListener (this); + + // View menu. + JMenu aViewMenu = new JMenu ("View"); + maMenuBar.add (aViewMenu); + ButtonGroup aGroup = new ButtonGroup (); + int nZoomMode = Options.GetInteger ("ZoomMode", Canvas.WHOLE_SCREEN); + JRadioButtonMenuItem aRadioButton = new JRadioButtonMenuItem ( + "Whole Screen", nZoomMode==Canvas.WHOLE_SCREEN); + aGroup.add (aRadioButton); + aViewMenu.add (aRadioButton); + aRadioButton.addActionListener (this); + aRadioButton = new JRadioButtonMenuItem ("200%", nZoomMode==200); + aGroup.add (aRadioButton); + aViewMenu.add (aRadioButton); + aRadioButton.addActionListener (this); + aRadioButton = new JRadioButtonMenuItem ("100%", nZoomMode==100); + aGroup.add (aRadioButton); + aViewMenu.add (aRadioButton); + aRadioButton.addActionListener (this); + aRadioButton = new JRadioButtonMenuItem ("50%", nZoomMode==50); + aGroup.add (aRadioButton); + aViewMenu.add (aRadioButton); + aRadioButton.addActionListener (this); + aRadioButton = new JRadioButtonMenuItem ("25%", nZoomMode==25); + aGroup.add (aRadioButton); + aViewMenu.add (aRadioButton); + aRadioButton.addActionListener (this); + aRadioButton = new JRadioButtonMenuItem ("10%", nZoomMode==10); + aGroup.add (aRadioButton); + aViewMenu.add (aRadioButton); + aRadioButton.addActionListener (this); + + // Options menu. + JMenu aOptionsMenu = new JMenu ("Options"); + maMenuBar.add (aOptionsMenu); + JCheckBoxMenuItem aCBItem; + aCBItem = new JCheckBoxMenuItem ("Show Descriptions", + Options.GetBoolean("ShowDescriptions")); + aOptionsMenu.add (aCBItem); + aCBItem.addActionListener (this); + + aCBItem = new JCheckBoxMenuItem ("Show Names", + Options.GetBoolean ("ShowNames")); + aOptionsMenu.add (aCBItem); + aCBItem.addActionListener (this); + + aCBItem = new JCheckBoxMenuItem ("Show Text", + Options.GetBoolean ("ShowText")); + aOptionsMenu.add (aCBItem); + aCBItem.addActionListener (this); + + aCBItem = new JCheckBoxMenuItem ("Antialiased Rendering", + Options.GetBoolean ("Antialiasing")); + aOptionsMenu.add (aCBItem); + aCBItem.addActionListener (this); + + // Help menu. + JMenu aHelpMenu = new JMenu ("Help"); + maMenuBar.add (aHelpMenu); + + aItem = new JMenuItem ("Help"); + aHelpMenu.add (aItem); + aItem.addActionListener (this); + + aItem = new JMenuItem ("News"); + aHelpMenu.add (aItem); + aItem.addActionListener (this); + + aItem = new JMenuItem ("About"); + aHelpMenu.add (aItem); + aItem.addActionListener (this); + + return maMenuBar; + } + + + + + /** Initialize the AWB. This includes clearing the canvas, add + listeners, creation of a new tree model for the tree list box and + the update of the button states. + + This method may be called any number of times. Note that all + actions will be carried out every time. The main purpose of a + second call is that of a re-initialization after a reconnect. + */ + protected void Initialize () + { + maCanvas.SetTree (maTree); + + SimpleOffice aOffice = SimpleOffice.Instance (); + if (aOffice != null) + { + // Add terminate listener. + if (aOffice.GetDesktop() != null) + aOffice.GetDesktop().addTerminateListener (this); + + } + + mbInitialized = true; + UpdateButtonStates (); + } + + + + + /** Update the states of the buttons according to the internal state of + the AWB. + */ + protected void UpdateButtonStates () + { + // maConnectButton.setEnabled (mbInitialized); + maQuitButton.setEnabled (true); + // maUpdateButton.setEnabled (mbInitialized); + maExpandButton.setEnabled (mbInitialized); + // maShapesButton.setEnabled (mbInitialized); + } + + + + /** Callback for GUI actions from the buttons. + */ + public void actionPerformed (ActionEvent aEvent) + { + String sCommand = aEvent.getActionCommand(); + if (sCommand.equals("connect")) + { + SimpleOffice.Clear(); + Initialize (); + } + else if (sCommand.equals("quit")) + { + Quit (); + } + else if (sCommand.equals("update")) + { +// maTree.Dispose(); + Initialize (); + } + else if (sCommand.equals("shapes")) + { + Cursor aCursor = getCursor(); + setCursor (new Cursor (Cursor.WAIT_CURSOR)); + // maTree.expandShapes(); + setCursor (aCursor); + } + else if (sCommand.equals("expand")) + { + Cursor aCursor = getCursor(); + setCursor (new Cursor (Cursor.WAIT_CURSOR)); + + for (int i=0; i<maTree.getRowCount(); i++) + maTree.expandRow (i); + // maAccessibilityTree.expandAll(); + setCursor (aCursor); + } + else if (sCommand.equals ("Quit")) + { + System.out.println ("exiting"); + System.exit (0); + } + else if (sCommand.equals ("Show Descriptions")) + { + Options.SetBoolean ("ShowDescriptions", + ((JCheckBoxMenuItem)aEvent.getSource()).getState()); + maCanvas.repaint(); + } + else if (sCommand.equals ("Show Names")) + { + Options.SetBoolean ("ShowNames", + ((JCheckBoxMenuItem)aEvent.getSource()).getState()); + maCanvas.repaint(); + } + else if (sCommand.equals ("Show Text")) + { + Options.SetBoolean ("ShowText", + ((JCheckBoxMenuItem)aEvent.getSource()).getState()); + maCanvas.repaint(); + } + else if (sCommand.equals ("Antialiased Rendering")) + { + Options.SetBoolean ("Antialiasing", + ((JCheckBoxMenuItem)aEvent.getSource()).getState()); + maCanvas.repaint(); + } + else if (sCommand.equals ("Help")) + { + HelpWindow.Instance().loadFile ("help.html"); + } + else if (sCommand.equals ("News")) + { + try{ + HelpWindow.Instance().loadFile ("news.html"); + } catch (Exception ex) {} + } + else if (sCommand.equals ("About")) + { + HelpWindow.Instance().loadFile ("about.html"); + } + else if (sCommand.equals ("Whole Screen")) + { + Options.SetInteger ("ZoomMode", Canvas.WHOLE_SCREEN); + maCanvas.repaint(); + } + else if (sCommand.equals ("200%")) + { + Options.SetInteger ("ZoomMode", 200); + maCanvas.repaint(); + } + else if (sCommand.equals ("100%")) + { + Options.SetInteger ("ZoomMode", 100); + maCanvas.repaint(); + } + else if (sCommand.equals ("50%")) + { + Options.SetInteger ("ZoomMode", 50); + maCanvas.repaint(); + } + else if (sCommand.equals ("25%")) + { + Options.SetInteger ("ZoomMode", 25); + maCanvas.repaint(); + } + else if (sCommand.equals ("10%")) + { + Options.SetInteger ("ZoomMode", 10); + maCanvas.repaint(); + } + else if (sCommand.equals ("<connected>")) + { + Connected (); + } + else if (sCommand.equals ("CreateNewViewWindow")) + { + TreePath aSelectionPath = maTree.getSelectionPath(); + if (aSelectionPath != null) + { + javax.swing.tree.TreeNode aSelectedNode = + (javax.swing.tree.TreeNode)aSelectionPath.getLastPathComponent(); + if (aSelectedNode instanceof XAccessible) { + new ObjectViewContainerWindow (((XAccessible) aSelectedNode).getAccessibleContext()); + } + } + } + else + { + System.err.println("unknown command " + sCommand); + } + } + + + + + /** TreeSelectionListener + Tell the object view and the canvas about the selected object. + */ + public void valueChanged (TreeSelectionEvent aEvent) { + + if (aEvent.isAddedPath()) { + Cursor aCursor = getCursor(); + setCursor (new Cursor (Cursor.WAIT_CURSOR)); + + javax.swing.tree.TreePath aPath = aEvent.getPath(); + maTree.scrollPathToVisible (aPath); + Object aObject = aPath.getLastPathComponent(); + if (aObject instanceof XAccessible) { + XAccessible xAccessible = (XAccessible) aObject; + if (maObjectViewContainer != null) { + ((AccessibilityModel) maTree.getModel()).addEventListener((TreeNode) aObject, maObjectViewContainer); + maObjectViewContainer.SetObject (xAccessible.getAccessibleContext()); + } + } + if (maCanvas != null) + maCanvas.SelectObject ((TreeNode) aObject); + setCursor (aCursor); + } else { + if (maObjectViewContainer != null) { + ((AccessibilityModel) maTree.getModel()).removeEventListener((TreeNode) aEvent.getPath().getLastPathComponent(), maObjectViewContainer); + maObjectViewContainer.SetObject (null); + } + if (maCanvas != null) + maCanvas.SelectObject (null); + } + } + + + + + // XEventListener + public void disposing (EventObject aSourceObj) + { + XFrame xFrame = (XFrame)UnoRuntime.queryInterface( + XFrame.class, aSourceObj.Source); + + if( xFrame != null ) + System.out.println("frame disposed"); + else + System.out.println("controller disposed"); + } + + + + + // XTerminateListener + public void queryTermination(final EventObject aEvent) throws com.sun.star.frame.TerminationVetoException + { + System.out.println ("Terminate Event : " + aEvent); + } + + + + + // XTerminateListener + public void notifyTermination(final EventObject aEvent) + { + System.out.println ("Notifiy Termination Event : " + aEvent); + } + + + /** Called after the AWB is connected to an Office application. + */ + private void Connected () + { + // Clear the tree and by expanding the root node initiate the + // scanning and insertion of nodes for the top-level windows. +// maTree.Clear(); +// maTree.collapseRow (0); +// maTree.expandRow (0); + + // Register the top window listener. + XExtendedToolkit xToolkit = + SimpleOffice.Instance().GetExtendedToolkit(); + if (xToolkit != null) + { + maTree.setToolkit(xToolkit); + } + } + + + /** Called when shutting down the AWB tool. + */ + private void Quit () + { +// maTree.Dispose(); + System.exit (0); + } + + /// The Singleton Workbench object. + private static AccessibilityWorkBench + saWorkBench = null; + + private JPanel maMainPanel; + private JPanel maButtonBar; + private Canvas maCanvas; + private AccessibilityTree maTree; + private ObjectViewContainer maObjectViewContainer; + private JButton + maConnectButton, + maQuitButton, + maUpdateButton, + maExpandButton, + maShapesButton; + private JMenuBar maMenuBar; + private boolean mbInitialized; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java b/accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java new file mode 100644 index 000000000000..2f9671d191e5 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java @@ -0,0 +1,187 @@ +package org.openoffice.accessibility.awb; + +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JEditorPane; +import javax.swing.JButton; +import java.net.URL; +import javax.swing.event.HyperlinkListener; +import javax.swing.event.HyperlinkEvent; +import java.net.MalformedURLException; +import java.io.IOException; +import java.io.File; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.awt.event.ActionListener; +import java.util.LinkedList; + +public class HelpWindow + implements ActionListener +{ + public static synchronized HelpWindow Instance () + { + if (maInstance == null) + maInstance = new HelpWindow(); + return maInstance; + } + + public void loadFile (String sFilename) + { + File aFile = new File (sFilename); + try + { + loadURL (aFile.toURL()); + } + catch (MalformedURLException e) + { + e.printStackTrace (System.err); + } + } + public void loadURL (String sURL) + { + try + { + loadURL (new URL (sURL)); + } + catch (MalformedURLException e) + { + e.printStackTrace (System.err); + } + } + + + + + public void loadURL (URL aURL) + { + maHistory.addLast (aURL); + selectHistoryPage (maHistory.size()-1); + maFrame.toFront (); + } + + + + + private HelpWindow () + { + try + { + maCurrentHistoryEntry = -1; + maHistory = new LinkedList(); + + maFrame = new JFrame (); + maFrame.addWindowListener (new WindowAdapter () + { + public void windowClosing (WindowEvent e) + { + maInstance = null; + } + }); + maContent = createContentWidget(); + + maFrame.getContentPane().setLayout (new GridBagLayout()); + GridBagConstraints aConstraints = new GridBagConstraints (); + aConstraints.gridx = 0; + aConstraints.gridy = 0; + aConstraints.gridwidth = 3; + aConstraints.weightx = 1; + aConstraints.weighty = 1; + aConstraints.fill = GridBagConstraints.BOTH; + maFrame.getContentPane().add (new JScrollPane (maContent), aConstraints); + + aConstraints = new GridBagConstraints(); + aConstraints.gridx = 0; + aConstraints.gridy = 1; + maPrevButton = new JButton ("Prev"); + maFrame.getContentPane().add (maPrevButton, aConstraints); + maPrevButton.addActionListener (this); + + aConstraints = new GridBagConstraints(); + aConstraints.gridx = 1; + aConstraints.gridy = 1; + maNextButton = new JButton ("Next"); + maFrame.getContentPane().add (maNextButton, aConstraints); + maNextButton.addActionListener (this); + + aConstraints = new GridBagConstraints(); + aConstraints.gridx = 2; + aConstraints.gridy = 1; + aConstraints.anchor = GridBagConstraints.EAST; + JButton aButton = new JButton ("Close"); + maFrame.getContentPane().add (aButton, aConstraints); + aButton.addActionListener (this); + + maFrame.setSize (600,400); + maFrame.setVisible (true); + } + catch (Exception e) + {} + } + + public void actionPerformed (java.awt.event.ActionEvent e) + { + if (e.getActionCommand().equals("Prev")) + { + selectHistoryPage (maCurrentHistoryEntry - 1); + } + else if (e.getActionCommand().equals("Next")) + { + selectHistoryPage (maCurrentHistoryEntry + 1); + } + else if (e.getActionCommand().equals("Close")) + { + maFrame.dispose (); + maInstance = null; + } + } + + private JEditorPane createContentWidget () + { + JEditorPane aContent = new JEditorPane (); + aContent.setEditable (false); + aContent.addHyperlinkListener (new HyperlinkListener() + { + public void hyperlinkUpdate (HyperlinkEvent e) + { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) + HelpWindow.Instance().loadURL (e.getURL()); + } + }); + return aContent; + } + + private void selectHistoryPage (int i) + { + if (i < 0) + i = 0; + else if (i >= maHistory.size()-1) + i = maHistory.size()-1; + if (i != maCurrentHistoryEntry) + { + URL aURL = (URL)maHistory.get (i); + try + { + maContent.setPage (aURL); + } + catch (java.io.IOException ex) + { + ex.printStackTrace(System.err); + } + + maCurrentHistoryEntry = i; + } + + maPrevButton.setEnabled (maCurrentHistoryEntry > 0); + maNextButton.setEnabled (maCurrentHistoryEntry < maHistory.size()-1); + } + + private static HelpWindow maInstance = null; + private JFrame maFrame; + private JEditorPane maContent; + private LinkedList maHistory; + private int maCurrentHistoryEntry; + private JButton maPrevButton; + private JButton maNextButton; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/Makefile new file mode 100644 index 000000000000..d38799bed109 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/Makefile @@ -0,0 +1,13 @@ +# $Id: Makefile,v 1.1 2003/06/13 16:30:18 af Exp $ + +all : package + +ROOT=../../../.. +PACKAGE = org.openoffice.accessibility.awb +SUBDIRS = canvas event tree view + +include makefile.common + +include $(ROOT)/makefile.in + +package: subdirs $(CLASS_FILES) diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java new file mode 100644 index 000000000000..9edf5dd928ae --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java @@ -0,0 +1,356 @@ +/************************************************************************* + * + * $RCSfile: Canvas.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:35 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.canvas; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Toolkit; +import java.awt.geom.Rectangle2D; +import java.util.Iterator; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JViewport; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.tree.TreePath; + +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleComponent; + +import org.openoffice.accessibility.misc.Options; + +/** This canvas displays accessible objects graphically. Each accessible + object with graphical representation is represented by an + CanvasShape object and has to be added by the + <member>addAccessible</member> member function. + + <p>The canvas listens to selection events of the associated JTree and + highlights the first selected node of that tree.</p> +*/ +public class Canvas + extends JPanel +{ + // This constant can be passed to SetZoomMode to always show the whole screen. + public static final int WHOLE_SCREEN = -1; + + public Canvas () + { + super (true); + maShapeList = new ShapeContainer (this); + maMouseObserver = new MouseObserver (this); + maTree = null; + mnHOffset = 0; + mnVOffset = 0; + mnScale = 1; + maLastWidgetSize = new Dimension (0,0); + } + + + + /** Tell the canvas which tree to use to highlight accessible + objects and to observe for changes in the tree structure. + */ + public void SetTree (javax.swing.JTree aTree) + { + if (aTree != maTree) + { + maTree = aTree; + maShapeList.SetTree (maTree); + maMouseObserver.SetTree (maTree); + } + } + + + + + private void Clear () + { + maShapeList.Clear(); + } + + + + + public Iterator GetShapeIterator () + { + return maShapeList.GetIterator(); + } + + + + + public void paintComponent (Graphics g) + { + synchronized (g) + { + super.paintComponent (g); + + Graphics2D g2 = (Graphics2D)g; + if (Options.GetBoolean("Antialiasing")) + g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + else + g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + + setupTransformation (); + g2.translate (mnHOffset, mnVOffset); + g2.scale (mnScale, mnScale); + + // Draw the screen representation to give a hint of the location of the + // accessible object on the screen. + Dimension aScreenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Rectangle2D.Double aScreen = new Rectangle2D.Double ( + 0, + 0, + aScreenSize.getWidth(), + aScreenSize.getHeight()); + // Fill the screen rectangle and draw a frame arround it to increase its visibility. + g2.setColor (new Color (250,240,230)); + g2.fill (aScreen); + g2.setColor (Color.BLACK); + g2.draw (aScreen); + + synchronized (maShapeList) + { + Iterator aShapeIterator = maShapeList.GetIterator(); + boolean bShowDescriptions = Options.GetBoolean ("ShowDescriptions"); + boolean bShowNames = Options.GetBoolean ("ShowNames"); + boolean bShowText = Options.GetBoolean ("ShowText"); + while (aShapeIterator.hasNext()) + { + CanvasShape aCanvasShape = + (CanvasShape)aShapeIterator.next(); + try + { + aCanvasShape.paint ( + g2, + bShowDescriptions, bShowNames, bShowText); + } + catch (Exception aException) + { + System.err.println ("caught exception while painting a shape:" + + aException); + aException.printStackTrace (System.err); + } + } + } + + // Paint highlighted frame around active object as the last thing. + if (maActiveObject != null) + maActiveObject.paint_highlight (g2); + } + } + + + + + /** Set up the transformation so that the graphical display can show a + centered representation of the whole screen. + */ + private void setupTransformation () + { + // Turn off scrollbars when showing the whole screen. Otherwise show them when needed. + JViewport aViewport = (JViewport)getParent(); + JScrollPane aScrollPane = (JScrollPane)aViewport.getParent(); + int nZoomMode = Options.GetInteger ("ZoomMode", WHOLE_SCREEN); + if (nZoomMode == WHOLE_SCREEN) + { + if (aScrollPane.getHorizontalScrollBarPolicy() + != JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) + aScrollPane.setHorizontalScrollBarPolicy ( + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + if (aScrollPane.getVerticalScrollBarPolicy() + != JScrollPane.VERTICAL_SCROLLBAR_NEVER) + aScrollPane.setVerticalScrollBarPolicy ( + JScrollPane.VERTICAL_SCROLLBAR_NEVER); + } + else + { + if (aScrollPane.getHorizontalScrollBarPolicy() + != JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) + aScrollPane.setHorizontalScrollBarPolicy ( + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + if (aScrollPane.getVerticalScrollBarPolicy() + != JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED) + aScrollPane.setVerticalScrollBarPolicy ( + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + } + + Dimension aScreenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension aWidgetSize = aViewport.getSize(); + { + if ((aScreenSize.getWidth() > 0) && (aScreenSize.getHeight() > 0)) + { + if (nZoomMode == WHOLE_SCREEN) + { + // Calculate the scales that would map the screen onto the + // widget in both of the coordinate axes and select the + // smaller + // of the two: it maps the screen onto the widget in both + // axes at the same time. + double nHScale = (aWidgetSize.getWidth() - 10) + / aScreenSize.getWidth(); + double nVScale = (aWidgetSize.getHeight() - 10) + / aScreenSize.getHeight(); + if (nHScale < nVScale) + mnScale = nHScale; + else + mnScale = nVScale; + } + else + { + mnScale = nZoomMode / 100.0; + } + + // Calculate offsets that center the scaled screen inside + // the widget. + mnHOffset = (aWidgetSize.getWidth() + - mnScale*aScreenSize.getWidth()) / 2.0; + mnVOffset = (aWidgetSize.getHeight() + - mnScale*aScreenSize.getHeight()) / 2.0; + if (mnHOffset < 0) + mnHOffset = 0; + if (mnVOffset < 0) + mnVOffset = 0; + + setPreferredSize (new Dimension ( + (int)(2*mnHOffset + mnScale * aScreenSize.getWidth()), + (int)(2*mnVOffset + mnScale * aScreenSize.getHeight()))); + revalidate (); + } + else + { + // In case of a degenerate (not yet initialized?) screen size + // use some meaningless default values. + mnScale = 1; + mnHOffset = 0; + mnVOffset = 0; + } + } + maLastWidgetSize = aWidgetSize; + } + + + + protected boolean HighlightObject (CanvasShape aNewActiveObject) + { + if (aNewActiveObject != maActiveObject) + { + if (maActiveObject != null) + maActiveObject.Highlight (false); + + maActiveObject = aNewActiveObject; + if (maActiveObject != null) + { + /* if (maTree != null) + { + TreePath aPath = new TreePath ( + maActiveObject.GetNode().GetPath()); + maTree.scrollPathToVisible (aPath); + maTree.setSelectionPath (aPath); + maTree.repaint (); + } + */ + maActiveObject.Highlight (true); + } + repaint (); + return true; + } + else + return false; + } + + + + + /** Called when the selection of the tree changes. Highlight the + corresponding graphical representation of the object. + */ + public void SelectObject (javax.swing.tree.TreeNode aNode) + { + CanvasShape aCanvasShape = maShapeList.Get (aNode); + HighlightObject (aCanvasShape); + } + + + + + private int + mnXAnchor, + mnYAnchor, + maResizeFlag; + private double + mnHOffset, + mnVOffset, + mnScale; + private CanvasShape maActiveObject; + private javax.swing.JTree maTree; + // The size of the widget at the last call of setupTransformation() + private Dimension maLastWidgetSize; + private ShapeContainer maShapeList; + private MouseObserver maMouseObserver; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java new file mode 100644 index 000000000000..5b1b2fb1f4e2 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java @@ -0,0 +1,446 @@ +/************************************************************************* + * + * $RCSfile: CanvasShape.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:35 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.canvas; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.awt.geom.AffineTransform; +import java.awt.geom.NoninvertibleTransformException; + + +import com.sun.star.accessibility.*; +import com.sun.star.lang.EventObject; +import com.sun.star.uno.UnoRuntime; + + +class CanvasShape implements XAccessibleEventListener +{ + public final Color maHighlightColor = Color.red; + public final Color maSelectionColor = Color.green; + public final Color maFocusColor = Color.blue; + + public CanvasShape (javax.swing.tree.TreeNode aNode, Canvas aCanvas) + { + maNode = aNode; + msName = "<no name>"; + msDescription = "<no description>"; + maShape = new Rectangle2D.Double (-10,-10,10,10); + maPosition = new Point (-10,-10); + maSize = new Dimension (10,10); + maFgColor = java.awt.Color.black; + maBgColor = Color.blue; + mnRole = -1; + mbHighlighted = false; + mbSelected = false; + mbFocused = false; + maCanvas = aCanvas; + + Update (); + } + + + + + public javax.swing.tree.TreePath getNodePath (javax.swing.tree.TreeNode node) + { + javax.swing.tree.TreeNode parent = node.getParent(); + return (parent != null) ? + getNodePath(parent).pathByAddingChild(node) : + new javax.swing.tree.TreePath(node); + } + + public javax.swing.tree.TreePath getNodePath () + { + return getNodePath(maNode); + } + + + + /** Update the data obtained from the <type>AccessibilityNode</type> + object. + */ + public void Update () + { + if (maNode instanceof XAccessible) { + mxContext = ((XAccessible) maNode).getAccessibleContext(); + mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface( + XAccessibleComponent.class, mxContext); + } + + if (mxContext != null) + { + msName = mxContext.getAccessibleName(); + msDescription = mxContext.getAccessibleDescription(); + mnRole = mxContext.getAccessibleRole(); + + // Extract the selected and focused flag. + XAccessibleStateSet xStateSet = mxContext.getAccessibleStateSet (); + if (xStateSet != null) + { + mbSelected = xStateSet.contains (AccessibleStateType.SELECTED); + mbFocused = xStateSet.contains (AccessibleStateType.FOCUSED); + } + } + + UpdateGeometry (); + + if (mxComponent != null) + { + // Note: alpha values in office 0..255 have to be mapped to + // 255..0 in Java + Color aCol = new Color (mxComponent.getForeground(), true); + maFgColor = new Color (aCol.getRed (), + aCol.getGreen (), + aCol.getBlue (), + 0xff - aCol.getAlpha ()); + aCol = new Color (mxComponent.getBackground(), true); + maBgColor = new Color (aCol.getRed (), + aCol.getGreen (), + aCol.getBlue (), + 0xff - aCol.getAlpha ()); + } + } + + + + public void UpdateGeometry () + { + if (mxComponent != null) + { + com.sun.star.awt.Point aLocationOnScreen = + mxComponent.getLocationOnScreen(); + com.sun.star.awt.Size aSizeOnScreen = mxComponent.getSize(); + maPosition = new Point ( + aLocationOnScreen.X, + aLocationOnScreen.Y); + maSize = new Dimension ( + aSizeOnScreen.Width, + aSizeOnScreen.Height); + } + } + + + + /** Paint the object into the specified canvas. It is transformed + according to the specified offset and scale. + */ + public void paint ( + Graphics2D g, + boolean bShowDescription, + boolean bShowName, + boolean bShowText) + { + try{ + // Transform the object's position and size according to the + // specified offset and scale. + Point aLocation = new Point(); + maShape = new Rectangle2D.Double ( + maPosition.x, + maPosition.y, + maSize.width, + maSize.height); + maTransformation = g.getTransform(); + + // Fill the object's bounding box with its background color if it + // has no children. + if (mxContext.getAccessibleChildCount() == 0) + { + g.setColor (maBgColor); + g.fill (maShape); + } + + // Remove alpha channel from color before drawing the frame. + Color color = maFgColor; + if (maFgColor.getAlpha()<128) + color = new Color (maFgColor.getRed(), maFgColor.getGreen(), maFgColor.getBlue()); + g.setColor (color); + g.draw (maShape); + + if (mbFocused) + { + g.setColor (maFocusColor); + for (int x=0; x<=2; x++) + for (int y=0; y<=2; y++) + g.fill ( + new Rectangle2D.Double ( + maShape.x + x/2.0 * maShape.width-3, + maShape.y + y/2.0 * maShape.height-3, + 6, + 6)); + } + if (mbSelected) + { + g.setColor (maSelectionColor); + for (int x=0; x<=2; x++) + for (int y=0; y<=2; y++) + g.draw ( + new Rectangle2D.Double ( + maShape.x + x/2.0 * maShape.width-2, + maShape.y + y/2.0 * maShape.height-2, + 4, + 4)); + } + + // Write the object's text OR name and description. + g.setColor (maFgColor); + if (bShowName) + paintName (g); + if (bShowDescription) + paintDescription (g); + if (bShowText) + paintText (g); + } + catch (Exception e) + { // don't care + } + } + + + public void paint_highlight (Graphics2D g) + { + if (mbHighlighted) + g.setColor (maHighlightColor); + else + g.setColor (maFgColor); + g.draw (maShape); + } + + + + + private void paintName (Graphics2D g) + { + g.drawString ("Name: " + msName, + (float)maShape.x+5, + (float)maShape.y+15); + } + + + + private void paintDescription (Graphics2D g) + { + g.drawString ("Description: " + msDescription, + (float)maShape.x+5, + (float)maShape.y+35); + } + + + + + private void paintText (Graphics2D g) + { + XAccessibleText xText = null; + // get XAccessibleText + xText = (XAccessibleText)UnoRuntime.queryInterface( + XAccessibleText.class, mxContext); + + // Draw every character in the text string. + if (xText != null) + { + String sText = xText.getText(); + try + { + for(int i = 0; i < sText.length(); i++) + { + com.sun.star.awt.Rectangle aRect = + xText.getCharacterBounds(i); + + double x = maShape.x + aRect.X; + double y = maShape.y + aRect.Y + aRect.Height; + + g.drawString (sText.substring(i, i+1), (float)x, (float)y); + } + } + catch (com.sun.star.lang.IndexOutOfBoundsException e) + {} + } + } + + + /** Compute whether the specified point lies inside the object's + bounding box. + */ + public boolean Contains (int x, int y) + { + Point2D aPosition = new Point2D.Double (x,y); + try + { + maTransformation.inverseTransform (aPosition, aPosition); + // System.out.println ("transformed "+x+","+y+" to "+aPosition); + } + catch (NoninvertibleTransformException aException) + { + return false; + } + return (maShape.contains (aPosition)); + } + + public void Highlight (boolean bFlag) + { + mbHighlighted = bFlag; + } + + public boolean IsHighlighted () + { + return mbHighlighted; + } + + public Rectangle GetBBox () + { + return new Rectangle (maPosition, maSize); + } + + public Point getOrigin () + { + return maPosition; + } + + public Dimension GetSize () + { + return maSize; + } + + public int getRole () + { + return mnRole; + } + + public XAccessibleContext getContext () + { + return mxContext; + } + + public XAccessibleComponent getComponent () + { + return mxComponent; + } + + public String toString () + { + return ">"+msName+", "+msDescription+" +"+maPosition.x+"+"+maPosition.y + +"x"+maSize.width+"x"+maSize.height+"<"; + } + + /** */ + public void notifyEvent(com.sun.star.accessibility.AccessibleEventObject aEvent) { + try { + switch (aEvent.EventId) { + case AccessibleEventId.BOUNDRECT_CHANGED: + case AccessibleEventId.VISIBLE_DATA_CHANGED: + UpdateGeometry (); + maCanvas.repaint(); + break; + default: + break; + } + } catch (Exception aException) { + System.err.println ("caught exception while updating a shape:" + + aException); + aException.printStackTrace (System.err); + } + } + + /** Callback for disposing events. + */ + public void disposing (com.sun.star.lang.EventObject e) + { + System.out.println ("Disposing"); + } + + + + + private Canvas + maCanvas; + private javax.swing.tree.TreeNode + maNode; + private XAccessibleContext + mxContext; + private XAccessibleComponent + mxComponent; + private String + msDescription, + msName; + private Rectangle2D.Double maShape; + private AffineTransform maTransformation; + private Point maPosition; + private Dimension + maTransformedSize, + maSize; + private Color + maFgColor, + maBgColor; + private boolean + // Highlighting objects is an internal concept. Corresponds to selection in the tree view. + mbHighlighted, + // Set when the accessible object is selected. + mbSelected, + // Set when the accessible object is focused. + mbFocused; + private int + mnRole; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile new file mode 100644 index 000000000000..8d9688433ff9 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile @@ -0,0 +1,15 @@ +# $Id: Makefile,v 1.1 2003/06/13 16:30:21 af Exp $ + +all : package + +ROOT=../../../../.. +PACKAGE = org.openoffice.accessibility.awb.canvas +SUBDIRS = +include makefile.common + +include $(ROOT)/makefile.in + + +package : $(CLASS_FILES) + + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java new file mode 100644 index 000000000000..3e7e2807906d --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java @@ -0,0 +1,104 @@ +package org.openoffice.accessibility.awb.canvas; + +import java.awt.Dimension; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.util.Iterator; +import javax.swing.tree.TreePath; + + +/** Observe the mouse and highlight shapes of the canvas when clicked. +*/ +public class MouseObserver + implements MouseListener, + MouseMotionListener +{ + public MouseObserver (Canvas aCanvas) + { + maCanvas = aCanvas; + maCanvas.addMouseListener (this); + maCanvas.addMouseMotionListener (this); + } + + + public void SetTree (javax.swing.JTree aTree) + { + maTree = aTree; + } + + public void mouseClicked (MouseEvent e) + {} + + public void mousePressed (MouseEvent e) + { + CanvasShape aObjectUnderMouse = FindCanvasShapeUnderMouse (e); + maTree.clearSelection(); + if (aObjectUnderMouse != null) + { + TreePath aPath = aObjectUnderMouse.getNodePath(); + if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0) + maTree.expandPath (aPath); + // Selecting the entry will eventually highlight the shape. + maTree.setSelectionPath (aPath); + maTree.makeVisible (aPath); + } + } + + public void mouseReleased (MouseEvent e) + {} + + public void mouseEntered (MouseEvent e) + {} + + public void mouseExited (MouseEvent e) + {} + + public void mouseDragged (MouseEvent e) + { + } + + public void mouseMoved (MouseEvent e) + { + if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) + maCanvas.HighlightObject (FindCanvasShapeUnderMouse (e)); + } + + + /** Search for the smallest shape that contains the mouse position. + */ + protected CanvasShape FindCanvasShapeUnderMouse (MouseEvent e) + { + Dimension aSmallestSize = null; + Iterator maShapeIterator = maCanvas.GetShapeIterator(); + CanvasShape aShapeUnderMouse = null; + while (maShapeIterator.hasNext()) + { + CanvasShape aShape = (CanvasShape)maShapeIterator.next(); + if (aShape != null) + if (aShape.Contains (e.getX(),e.getY())) + { + if (aShapeUnderMouse == null) + { + aSmallestSize = aShape.GetSize(); + aShapeUnderMouse = aShape; + } + else + { + Dimension aSize = aShape.GetSize(); + if (aSize.getWidth()<aSmallestSize.getWidth() + || aSize.getHeight()<aSmallestSize.getHeight()) + { + aSmallestSize = aSize; + aShapeUnderMouse = aShape; + } + } + } + } + return aShapeUnderMouse; + } + + private Canvas maCanvas; + private javax.swing.JTree maTree; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java new file mode 100644 index 000000000000..fd99d5601cc0 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java @@ -0,0 +1,271 @@ +/************************************************************************* + * + * $RCSfile: ShapeContainer.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:35 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.canvas; + +import java.awt.Rectangle; +import java.util.Iterator; +import javax.swing.event.TreeModelListener; +import javax.swing.event.TreeExpansionListener; +import javax.swing.event.TreeWillExpandListener; +import javax.swing.event.TreeExpansionEvent; +import javax.swing.event.TreeModelEvent; +import javax.swing.tree.TreeNode; + +import com.sun.star.accessibility.XAccessibleEventBroadcaster; + +/** Each canvas has a shape container that is responsible for maintaining + a collection of shapes that are displayed by the canvas. +*/ +public class ShapeContainer + implements TreeModelListener, + TreeExpansionListener, + TreeWillExpandListener +{ + public ShapeContainer (Canvas aCanvas) + { + maShapeList = new java.util.Hashtable(); + maBoundingBox = new Rectangle (0,0,100,100); + maCanvas = aCanvas; + maTree = null; + } + + + + + public synchronized void SetTree (javax.swing.JTree aTree) + { + if (aTree != maTree) + { + if (maTree != null) + { + maTree.getModel().removeTreeModelListener (this); + maTree.removeTreeExpansionListener (this); + maTree.removeTreeWillExpandListener (this); + } + + Clear(); + + maTree = aTree; + + maTree.getModel().addTreeModelListener (this); + maTree.addTreeExpansionListener (this); + maTree.addTreeWillExpandListener (this); + } + } + + + + + public synchronized boolean AddNode (TreeNode aNode) + { + CanvasShape aShape = (CanvasShape)maShapeList.get (aNode); + if (aShape == null) + { + aShape = new CanvasShape (aNode, maCanvas); + + if (aNode instanceof XAccessibleEventBroadcaster) + ((XAccessibleEventBroadcaster) aNode).addEventListener(aShape); + + // Update bounding box that includes all objects. + if (maShapeList.size() == 0) + maBoundingBox = aShape.GetBBox(); + else + maBoundingBox = maBoundingBox.union (aShape.GetBBox()); + + maShapeList.put (aNode, aShape); + + maCanvas.repaint(); + + return true; + } + else + return false; + } + + + /** + */ + public synchronized boolean RemoveNode (TreeNode aNode) + { + CanvasShape aShape = (CanvasShape)maShapeList.get (aNode); + if (aShape != null) + { + if (aNode instanceof XAccessibleEventBroadcaster) + ((XAccessibleEventBroadcaster) aNode).removeEventListener(aShape); + + maShapeList.remove (aNode); + maCanvas.SelectObject (null); + maCanvas.repaint (); + return true; + } + else + return false; + } + + + + + public synchronized void Clear () + { + maShapeList.clear (); + } + + + + + public Iterator GetIterator () + { + return maShapeList.values().iterator (); + } + + + + + public CanvasShape Get (TreeNode aNode) + { + if (aNode != null) { + return (CanvasShape)maShapeList.get (aNode); + } + return null; + } + + + private void PrintMessage (String aMessage, java.util.EventObject aEvent) + { + // System.out.println ("ShapeContainer: " + aMessage + ": " + aEvent); + } + + public void treeNodesChanged (TreeModelEvent aEvent) + { + PrintMessage ("treeNodesChanged", aEvent); + } + public void treeNodesInserted (TreeModelEvent aEvent) + { + PrintMessage ("treeNodesInserted", aEvent); + Object[] aNewNodes = aEvent.getChildren(); + for (int i=0; i<aNewNodes.length; i++) + AddNode ((TreeNode)aNewNodes[i]); + } + public void treeNodesRemoved (TreeModelEvent aEvent) + { + PrintMessage ("treeNodesRemoved", aEvent); + Object[] aOldNodes = aEvent.getChildren(); + for (int i=0; i<aOldNodes.length; i++) + RemoveNode ((TreeNode)aOldNodes[i]); + } + public void treeStructureChanged (TreeModelEvent aEvent) + { + PrintMessage ("treeStructureChanged", aEvent); + TreeNode aNode = (TreeNode)aEvent.getTreePath().getLastPathComponent(); + RemoveAllChildren(aNode); + AddAllChildren(aNode); + } + + public void treeWillExpand (TreeExpansionEvent aEvent) + { + PrintMessage ("treeWillExpand", aEvent); + } + public void treeWillCollapse (TreeExpansionEvent aEvent) + { + PrintMessage ("treeWillCollapse", aEvent); + TreeNode aNode = (TreeNode)aEvent.getPath().getLastPathComponent(); + RemoveAllChildren (aNode); + } + public void treeExpanded (TreeExpansionEvent aEvent) + { + PrintMessage ("treeExpanded", aEvent); + TreeNode aNode = (TreeNode)aEvent.getPath().getLastPathComponent(); + AddAllChildren (aNode); + } + public void treeCollapsed (TreeExpansionEvent aEvent) + { + PrintMessage ("treeCollapsed", aEvent); + } + + private void AddAllChildren (TreeNode aNode) { + java.util.Enumeration aChildList = aNode.children(); + while (aChildList.hasMoreElements()) { + TreeNode aChild = (TreeNode) aChildList.nextElement(); + if (aChild != null) { + AddAllChildren (aChild); + AddNode (aChild); + } + } + } + + private void RemoveAllChildren (TreeNode aNode) { + java.util.Enumeration aChildList = aNode.children(); + while (aChildList.hasMoreElements()) { + TreeNode aChild = (TreeNode) aChildList.nextElement(); + if (aChild != null) { + RemoveAllChildren (aChild); + RemoveNode (aChild); + } + } + } + + + private java.util.Hashtable maShapeList; + private Rectangle maBoundingBox; + private Canvas maCanvas; + private javax.swing.JTree maTree; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common new file mode 100644 index 000000000000..3b7262a8489d --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common @@ -0,0 +1,65 @@ +#************************************************************************* +# +# $RCSfile: makefile.common,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar +JAVAFILES = \ + CanvasShape.java \ + Canvas.java \ + MouseObserver.java \ + ShapeContainer.java + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk new file mode 100644 index 000000000000..6e3ef06aab8b --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk @@ -0,0 +1,86 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJNAME = awb +PRJ = ..$/..$/..$/..$/..$/.. +TARGET = awb_canvas +PACKAGE = org$/openoffice$/accessibility$/awb$/canvas + +USE_JAVAVER:=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +.IF "$(JAVAVER:s/.//)" >= "140" + +.INCLUDE : makefile.common + +JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +#JARTARGET = $(TARGET).jar +#JARCOMPRESS = TRUE +JARCLASSDIRS = $(PACKAGE) org/openoffice/java/accessibility/awb +#CUSTOMMANIFESTFILE = manifest +.ENDIF + +# --- Targets ------------------------------------------------------ + + +.INCLUDE : target.mk + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/makefile.common new file mode 100644 index 000000000000..80633d7e66ea --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/makefile.common @@ -0,0 +1,3 @@ +JAVAFILES = \ + AccessibilityWorkBench.java \ + HelpWindow.java diff --git a/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk new file mode 100644 index 000000000000..eb744d465cfb --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk @@ -0,0 +1,88 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJNAME = awb +PRJ = ..$/..$/..$/..$/.. +TARGET = java_awb +PACKAGE = org$/openoffice$/accessibility$/awb + +USE_JAVAVER:=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +.IF "$(JAVAVER:s/.//)" >= "140" +JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar + +.INCLUDE : makefile.common + +JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +JARTARGET = $(TARGET).jar +JARCOMPRESS = TRUE +JARCLASSDIRS = $(PACKAGE) \ + org$/openoffice$/accessibility$/misc +CUSTOMMANIFESTFILE = manifest +.ENDIF + +# --- Targets ------------------------------------------------------ + + +.INCLUDE : target.mk + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/manifest b/accessibility/workben/org/openoffice/accessibility/awb/manifest new file mode 100644 index 000000000000..951f9ec3128f --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/manifest @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: org.openoffice.accessibility.awb.AccessibilityWorkBench +Class-Path: classes.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar xt.jar jaxp.jar diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java new file mode 100644 index 000000000000..6bdb5976f843 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java @@ -0,0 +1,188 @@ +/************************************************************************* + * + * $RCSfile: AccessibilityModel.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:39 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.tree; + +import javax.swing.SwingUtilities; +import javax.swing.tree.TreeNode; +import javax.swing.tree.MutableTreeNode; +import javax.swing.tree.DefaultMutableTreeNode; + +import com.sun.star.uno.UnoRuntime; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XTopWindow; +import com.sun.star.awt.XTopWindowListener; +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleEventBroadcaster; +import com.sun.star.accessibility.XAccessibleEventListener; + +/** + * + */ +public abstract class AccessibilityModel extends javax.swing.tree.DefaultTreeModel { + + protected java.util.Hashtable nodeList; + protected static DefaultMutableTreeNode disconnectedRootNode = + new DefaultMutableTreeNode("<not connected>"); + + /** Creates a new instance of AccessibilityModel */ + public AccessibilityModel() { + super(disconnectedRootNode, false); + nodeList = new java.util.Hashtable(); + } + + /* Convenience method that creates a new Toolkit node from xToolkit + * and sets as the new root object of the tree. + */ + public synchronized void setRoot(XExtendedToolkit xToolkit) { + if (xToolkit != null) { + try { + // remove old root node as topwindow listener + if (getRoot() instanceof ToolkitNode) { + ToolkitNode tn = (ToolkitNode) getRoot(); + if (tn.xToolkit != null) { + tn.xToolkit.removeTopWindowListener(tn); + } + } + nodeList.clear(); + setRoot(new ToolkitNode(xToolkit, this)); + xToolkit.addTopWindowListener((ToolkitNode) getRoot()); + } catch (com.sun.star.uno.RuntimeException e) { + // FIXME: error message ! + } + } + } + + /* Appends the new child to parent's child list */ + public void addNodeInto(MutableTreeNode newChild, MutableTreeNode parent) { + int index = parent.getChildCount(); + if (newChild != null && newChild.getParent() == parent) { + index -= 1; + } + insertNodeInto(newChild, parent, index); + } + + /** Adds listener to the listener chain of node */ + public static void addEventListener(TreeNode node, XAccessibleEventListener listener) { + if (node instanceof AccessibilityNode) { + ((AccessibilityNode) node).addEventListener(listener); + } + } + + /** Removes listener from the listener chain of node */ + public static void removeEventListener(TreeNode node, XAccessibleEventListener listener) { + if (node instanceof AccessibilityNode) { + ((AccessibilityNode) node).removeEventListener(listener); + } + } + + protected abstract AccessibilityNode createWindowNode(XAccessible xAccessible, + XAccessibleContext xAccessibleContext); + protected abstract AccessibilityNode createNode(XAccessible xAccessible); + + /** Adds xAccessible,node to the internal hashtable */ + public AccessibilityNode putNode(XAccessible xAccessible, AccessibilityNode node) { + if (xAccessible != null) { + String oid = UnoRuntime.generateOid(xAccessible); + java.lang.ref.WeakReference ref = (java.lang.ref.WeakReference) + nodeList.put(oid, new java.lang.ref.WeakReference(node)); + if (ref != null) { + return (AccessibilityNode) ref.get(); + } + } + return null; + } + + /** Returns the AccessibilityNode for xAccessible */ + public AccessibilityNode findNode(XAccessible xAccessible) { + if (xAccessible != null) { + String oid = UnoRuntime.generateOid(xAccessible); + java.lang.ref.WeakReference ref = + (java.lang.ref.WeakReference) nodeList.get(oid); + if (ref != null) { + return (AccessibilityNode) ref.get(); + } + } + return null; + } + + /** Removes the AccessibilityNode for xAccessible from the internal hashtable */ + public AccessibilityNode removeNode(XAccessible xAccessible) { + if (xAccessible != null) { + String oid = UnoRuntime.generateOid(xAccessible); + java.lang.ref.WeakReference ref = + (java.lang.ref.WeakReference) nodeList.remove(oid); + if (ref != null) { + return (AccessibilityNode) ref.get(); + } + } + return null; + } + + public AccessibilityNode removeNode(Object o) { + if (o instanceof XAccessible) { + return removeNode((XAccessible) o); + } + return null; + } +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java new file mode 100644 index 000000000000..36c5d71b240e --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java @@ -0,0 +1,200 @@ +/************************************************************************* + * + * $RCSfile: AccessibilityNode.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:39 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.tree; + +import org.openoffice.accessibility.misc.AccessibleEventMulticaster; + +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.SwingUtilities; + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleEventBroadcaster; +import com.sun.star.accessibility.XAccessibleEventListener; + +import com.sun.star.uno.UnoRuntime; + +class AccessibilityNode extends DefaultMutableTreeNode implements XAccessible, + XAccessibleEventListener, XAccessibleEventBroadcaster { + + protected AccessibilityModel treeModel; + protected XAccessibleContext unoAccessibleContext; + + private XAccessibleEventListener listener; + + public AccessibilityNode(AccessibilityModel treeModel) { + this.treeModel = treeModel; + } + + protected void finalize() throws java.lang.Throwable { + if (userObject != null) { + treeModel.removeNode(userObject); + } + } + + /** Sets the XAccessibleContext object of this node */ + public void setAccessibleContext(XAccessibleContext xAccessibleContext) { + unoAccessibleContext = xAccessibleContext; + } + + /** Returns the XAccessibleContext object of this node */ + public XAccessibleContext getAccessibleContext() { + return unoAccessibleContext; + } + + /** Attaches or Detaches the itself as listener to unoAccessibleContext */ + protected void setAttached(boolean attach) { + XAccessibleContext xAccessibleContext = unoAccessibleContext; + if (xAccessibleContext != null) { + try { + XAccessibleEventBroadcaster xAccessibleEventBroadcaster = + (XAccessibleEventBroadcaster) UnoRuntime.queryInterface( + XAccessibleEventBroadcaster.class, xAccessibleContext); + if (xAccessibleEventBroadcaster != null) { + if (attach) { + xAccessibleEventBroadcaster.addEventListener(this); + } else { + xAccessibleEventBroadcaster.removeEventListener(this); + } + } + } catch (com.sun.star.uno.RuntimeException e) { + // FIXME: error message ! + } + } + } + + public void disposing(com.sun.star.lang.EventObject eventObject) { + XAccessibleEventListener listener = this.listener; + if (listener != null) { + listener.disposing(eventObject); + } + + treeModel.removeNode(userObject); + userObject = null; + unoAccessibleContext = null; + // FIXME: mark the object as being disposed in the tree view ! + } + + protected void handleChildRemoved(XAccessible xAccessible) { + final AccessibilityNode node = treeModel.findNode(xAccessible); + if (node != null) { + SwingUtilities.invokeLater(new java.lang.Runnable() { + public void run() { + treeModel.removeNodeFromParent(node); + } + }); + } + } + + protected void handleChildAdded(XAccessible xAccessible) { + final AccessibilityNode parent = this; + final AccessibilityNode node = treeModel.createNode(xAccessible); + if (node != null) { + SwingUtilities.invokeLater(new java.lang.Runnable() { + public void run() { + try { + XAccessibleContext xAC = node.getAccessibleContext(); + if (xAC != null) { + treeModel.insertNodeInto(node, parent, + xAC.getAccessibleIndexInParent()); + } + } catch (com.sun.star.uno.RuntimeException e) { + // FIXME: output + } + } + }); + } + } + + public void notifyEvent(AccessibleEventObject accessibleEventObject) { + if (accessibleEventObject.EventId == AccessibleEventId.CHILD) { + XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface( + XAccessible.class, accessibleEventObject.OldValue); + if (xAccessible != null) { + handleChildRemoved(xAccessible); + } + + xAccessible = (XAccessible) UnoRuntime.queryInterface( + XAccessible.class, accessibleEventObject.NewValue); + if (xAccessible != null) { + handleChildAdded(xAccessible); + } + } + + XAccessibleEventListener listener = this.listener; + if (listener != null) { + listener.notifyEvent(accessibleEventObject); + } + } + + public synchronized void addEventListener(com.sun.star.accessibility.XAccessibleEventListener xAccessibleEventListener) { + listener = AccessibleEventMulticaster.add(listener, xAccessibleEventListener); + } + + public synchronized void removeEventListener(com.sun.star.accessibility.XAccessibleEventListener xAccessibleEventListener) { + listener = AccessibleEventMulticaster.remove(listener, xAccessibleEventListener); + } +} + + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java new file mode 100644 index 000000000000..f7e71d21574e --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java @@ -0,0 +1,123 @@ +/************************************************************************* + * + * $RCSfile: AccessibilityTree.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:39 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.tree; + +import org.openoffice.accessibility.misc.NameProvider; + +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.DefaultMutableTreeNode; + +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; + +/** + * + */ +public class AccessibilityTree extends javax.swing.JTree { + + /** Creates a new instance of AccessibilityTree */ + public AccessibilityTree(javax.swing.tree.TreeModel model) { + super(model); + // always show handles to indicate expandable / collapsable + showsRootHandles = true; + } + + public void setToolkit(XExtendedToolkit xToolkit) { + AccessibilityModel model = (AccessibilityModel) getModel(); + if (model != null) { + // hide the root node when connected + setRootVisible(xToolkit == null); + // update the root node + model.setRoot(xToolkit); + model.reload(); + } + } + + public String convertValueToText(Object value, boolean selected, + boolean expanded, boolean leaf, int row, boolean hasFocus) { + + if (value instanceof DefaultMutableTreeNode) { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; + + Object userObject = node.getUserObject(); + if (userObject != null && userObject instanceof XAccessible) { + XAccessible xAccessible = (XAccessible) userObject; + try { + XAccessibleContext xAC = xAccessible.getAccessibleContext(); + if (xAC != null) { + String name = xAC.getAccessibleName(); + if (name.length() == 0) { + name = new String ("<no name>"); + } + value = name + " / " + NameProvider.getRoleName(xAC.getAccessibleRole()); + } + } catch (com.sun.star.uno.RuntimeException e) { + value = "???"; + } + } + } + + return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus); + } + +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java new file mode 100644 index 000000000000..acecd0100a2e --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java @@ -0,0 +1,251 @@ +/************************************************************************* + * + * $RCSfile: AccessibilityTreeModel.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc.,y October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.tree; + +import com.sun.star.accessibility.XAccessible; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.lang.DisposedException; +import com.sun.star.lang.IndexOutOfBoundsException; + +import org.openoffice.accessibility.misc.OfficeConnection; +import org.openoffice.accessibility.awb.event.EventQueue; + +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeNode; + + +public class AccessibilityTreeModel + extends DefaultTreeModel +{ + public AccessibilityTreeModel () + { + super (null); + setAsksAllowsChildren (false); + + SetRootNode(); + } + + + + /** Release all resources. + */ + synchronized public void Dispose () + { + Clear (); + } + + + + /** Calls to this method are dispatched to the given node but are + observed for exceptions. + */ + synchronized public boolean isLeaf (Object aObject) + { + boolean bIsLeaf = true; + + if (aObject != null) + { + AccessibilityNode aNode = (AccessibilityNode)aObject; + try + { + bIsLeaf = aNode.isLeaf(); + } + catch (DisposedException aException) + { + System.out.println ("node is disposed. removing it"); + /* TreeNode aParent = aNode.GetParent(); + int nIndexInParent = aParent.getIndex (aNode); + aNode.removeFromParent (); + System.out.println ("" + aParent + " # " + aNode + " # "+ nIndexInParent); + nodesWereRemoved ( + aParent, new int[]{nIndexInParent}, new + Object[]{aNode}); + */ + } + catch (Exception aException) + { + System.err.println ("caught exception in AccessibilityTreeModel.isLeaf():" + + aException); + aException.printStackTrace (System.err); + } + } + + return bIsLeaf; + } + + + + + synchronized public int getChildCount (Object aObject) + { + AccessibilityNode aNode = (AccessibilityNode)aObject; + return aNode.getChildCount(); + } + + + + + /** Return the requested child of aParent. If that child is not yet + known to the parent then try to create it. + */ + synchronized public Object getChild (Object aParent, final int nIndex) + { + AccessibilityNode aChild = null; + + final AccessibilityNode aParentNode = (AccessibilityNode)aParent; + + // Try to get an existing child from the super class object. + aChild = aParentNode.GetChildNoCreate (nIndex); + + // When the requested child does not yet exist and this node is not a + // special node then create a new node. + if (aChild == null) + { + aChild = aParentNode.CreateChild (nIndex); + aParentNode.SetChild ((AccessibilityNode)aChild, nIndex); + /* EventQueue.Instance().AddEvent (new Runnable() { public void run() { + AccessibilityTreeModel.this.nodeWasInserted ( + aParentNode, nIndex); + }}); + */ } + + return aChild; + } + + + synchronized public void nodeWasInserted (AccessibilityNode aParent, int nIndex) + { + nodesWereInserted (aParent, new int[]{nIndex}); + nodeStructureChanged (aParent); + + } + + + + + /** Clear the tree so that afterwards it has only the root node. + */ + public void Clear () + { + AccessibilityNode aRoot = (AccessibilityNode)getRoot(); + aRoot.RemoveAllChildren(); + SetRootNode(); + nodeStructureChanged (aRoot); + } + + + + + private void SetRootNode () + { + OfficeConnection aConnection = OfficeConnection.Instance(); + AccessibilityNode aRoot; + if (aConnection!=null && aConnection.IsValid()) + aRoot = new AccessibilityNode ("<connected>"); + else + aRoot = new AccessibilityNode ("<not connected>"); + setRoot (aRoot); + } + + + + + /** Add a new child to the root node. + */ + public synchronized void AddTopLevelNode (AccessibilityNode aNode) + { + if (aNode != null) + { + if ( ! OfficeConnection.Instance().IsValid()) + { + setRoot (null); + } + + AccessibilityNode aRoot = (AccessibilityNode)getRoot(); + if (aRoot == null) + { + aRoot = new AccessibilityNode ("<connected>"); + setRoot (aRoot); + } + + aNode.SetParent (aRoot); + aRoot.Append (aNode); + nodesWereInserted (aRoot, new int[]{aRoot.getIndex (aNode)}); + } + } + + + + + /** Remove a node that is a direct child of the root. + */ + public synchronized void RemoveTopLevelNode (AccessibilityNode aNode) + { + AccessibilityNode aRoot = (AccessibilityNode)getRoot(); + if (aRoot != null) + { + int nIndex = aRoot.getIndex (aNode); + aRoot.Remove (aNode); + nodesWereRemoved (aRoot, new int[]{nIndex}, new Object[]{aNode}); + } + } +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java new file mode 100644 index 000000000000..0f5626852238 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java @@ -0,0 +1,157 @@ +/************************************************************************* + * + * $RCSfile: DynamicAccessibilityModel.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:39 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.tree; + +import javax.swing.tree.TreeNode; +import javax.swing.tree.MutableTreeNode; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.event.TreeExpansionListener; +import javax.swing.event.TreeWillExpandListener; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; + +/** + * + */ +public class DynamicAccessibilityModel extends AccessibilityModel implements TreeExpansionListener, TreeWillExpandListener { + + /* Creates a AccessibilityNode object for a window */ + protected AccessibilityNode createWindowNode(XAccessible xAccessible, + XAccessibleContext xAccessibleContext) { + if (xAccessible != null) { + // Some objects inherit XAccessible, but should not appear in + // the hierarchy as toplevels (like sub-menus), so they don't + // return an accessible context. + if (xAccessibleContext != null) { + AccessibilityNode node = new AccessibilityNode(this); + node.setUserObject(xAccessible); + node.setAccessibleContext(xAccessibleContext); + putNode(xAccessible, node); + return node; + } + } + return null; + } + + /* Creates a DynamicAccessibilityNode object */ + protected AccessibilityNode createNode(XAccessible xAccessible) { + if (xAccessible != null) { + try { + // Some objects inherit XAccessible, but should not appear in + // the hierarchy as toplevels (like sub-menus), so they don't + // return an accessible context. + XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext(); + if (xAccessibleContext != null) { + AccessibilityNode node = new DynamicAccessibilityNode(this); + node.setUserObject(xAccessible); + node.setAccessibleContext(xAccessibleContext); + putNode(xAccessible, node); + return node; + } + } catch (com.sun.star.uno.RuntimeException e) { + } + } + return null; + } + + public void treeCollapsed(javax.swing.event.TreeExpansionEvent treeExpansionEvent) { + TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent(); + if (node instanceof DynamicAccessibilityNode) { + DynamicAccessibilityNode dynode = (DynamicAccessibilityNode) node; + dynode.clear(); + } + } + + public void treeExpanded(javax.swing.event.TreeExpansionEvent treeExpansionEvent) { + TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent(); + if (node instanceof AccessibilityNode) { + // Calling oneway methods from an UNO thread may cause + // deadlocks, so adding the listeners here. + for (java.util.Enumeration e = node.children(); e.hasMoreElements(); ) { + ((AccessibilityNode) e.nextElement()).setAttached(true); + } + } + } + + public void treeWillCollapse(javax.swing.event.TreeExpansionEvent treeExpansionEvent) + throws javax.swing.tree.ExpandVetoException { + TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent(); + if (node instanceof AccessibilityNode) { + // Calling oneway methods from an UNO thread may cause + // deadlocks, so adding the listeners here. + for (java.util.Enumeration e = node.children(); e.hasMoreElements(); ) { + ((AccessibilityNode) e.nextElement()).setAttached(false); + } + } + } + + public void treeWillExpand(javax.swing.event.TreeExpansionEvent treeExpansionEvent) + throws javax.swing.tree.ExpandVetoException { + TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent(); + if (node instanceof DynamicAccessibilityNode) { + DynamicAccessibilityNode dynode = (DynamicAccessibilityNode) node; + dynode.populate(); + } + } +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java new file mode 100644 index 000000000000..ff6f5ddd45ea --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java @@ -0,0 +1,126 @@ +/************************************************************************* + * + * $RCSfile: DynamicAccessibilityNode.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.tree; + +import com.sun.star.uno.UnoRuntime; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; + +/* + * This class is dynamic in the way that it does not contain any children + * until the node is going to be expanded. It also releases all children + * as soon as the node is collapsed again. + */ +class DynamicAccessibilityNode extends AccessibilityNode { + + public DynamicAccessibilityNode(AccessibilityModel treeModel) { + super(treeModel); + } + + // Populates the child list. Called by AccessibilityMode.treeWillExpand(). + protected void populate() { + try { + XAccessibleContext xAC = getAccessibleContext(); + if (xAC != null) { + int n = xAC.getAccessibleChildCount(); + for (int i=0; i<n; i++) { + XAccessible xAccessible = xAC.getAccessibleChild(i); + AccessibilityNode node = treeModel.findNode(xAccessible); + if (node == null) { + node = treeModel.createNode(xAccessible); + } + if (node != null) { + // NOTE: do not send any tree notifications here ! + add(node); + } + } + } + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + // This should never happen since we previously checked the child + // count. + // FIXME: error message + } catch (com.sun.star.uno.RuntimeException e) { + // FIXME: error message + } + } + + // Clears the child list. Called by AccessibilityModel.treeCollapsed(). + protected void clear() { + removeAllChildren(); + } + + /* This is called whenever the node is painted, no matter if collapsed + * or expanded. Making this a "life" value seems to be appropriate. + */ + public boolean isLeaf() { + try { + XAccessibleContext xAC = getAccessibleContext(); + if (xAC != null) { + return xAC.getAccessibleChildCount() == 0; + } + return true; + } catch (com.sun.star.uno.RuntimeException e) { + return true; + } + } + +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile new file mode 100644 index 000000000000..8166c0b91312 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile @@ -0,0 +1,71 @@ +#************************************************************************* +# +# $RCSfile: Makefile,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +all : package + +ROOT=../../../../.. +PACKAGE = org.openoffice.accessibility.awb.tree +SUBDIRS = +include makefile.common + +include $(ROOT)/makefile.in + + +package : $(CLASS_FILES) + + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java new file mode 100644 index 000000000000..30a6f578f06e --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java @@ -0,0 +1,249 @@ +/************************************************************************* + * + * $RCSfile: ToolkitNode.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.tree; + +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; + +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XTopWindow; + +import com.sun.star.uno.UnoRuntime; + +import javax.swing.SwingUtilities; +import javax.swing.tree.DefaultMutableTreeNode; + +/** + * + */ +public class ToolkitNode extends DefaultMutableTreeNode + implements com.sun.star.awt.XTopWindowListener { + + protected XExtendedToolkit xToolkit; + + private AccessibilityModel treeModel; + + /** Creates a new instance of TopWindowListener */ + public ToolkitNode(XExtendedToolkit xToolkit, AccessibilityModel treeModel) { + super("<connected>"); + this.xToolkit = xToolkit; + this.treeModel = treeModel; + + // Initially fill the child list + try { + for (int i=0,j=xToolkit.getTopWindowCount(); i<j; i++) { + XTopWindow xTopWindow = xToolkit.getTopWindow(i); + if (xTopWindow != null) { + AccessibilityNode an = getTopWindowNode(xTopWindow); + if (an != null) { + add(an); + // Calling oneway methods from an UNO thread may cause + // deadlocks, so adding the listeners here. + an.setAttached(true); + } + } + } + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + // This should never happen since we properly check the count + // before - anyway returning what we got so far. + } + } + + /** Returns an AccessibilityNode if xAccessible has a valid toplevel */ + private AccessibilityNode getTopWindowNode(XAccessible xAccessible) { + XAccessibleContext xAC = xAccessible.getAccessibleContext(); + if (xAC != null) { + short role = xAC.getAccessibleRole(); + if ((role == AccessibleRole.FRAME) || (role == AccessibleRole.DIALOG) || (role == AccessibleRole.WINDOW)) { + return treeModel.createWindowNode(xAccessible, xAC); + } + } + return null; + } + + /** Returns an AccessibilityNode if xAccessible has a valid toplevel */ + private AccessibilityNode getTopWindowNode(XAccessible xAccessible, XAccessibleContext xAC) { + if (xAC != null) { + short role = xAC.getAccessibleRole(); + if ((role == AccessibleRole.FRAME) || (role == AccessibleRole.DIALOG) || (role == AccessibleRole.WINDOW)) { + AccessibilityNode parent = treeModel.createWindowNode(xAccessible, xAC); + if (parent != null) { + try { + int n = xAC.getAccessibleChildCount(); + for (int i=0; i<n; i++) { + AccessibilityNode child = treeModel.createNode(xAC.getAccessibleChild(i)); + if (child != null) { + parent.add(child); + } + } + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + + } + } + return parent; + } + } + return null; + } + + /** Returns the XAccessible interface corresponding to the toplevel window */ + private AccessibilityNode getTopWindowNode(XTopWindow w) { + XAccessible xAccessible = (XAccessible) + UnoRuntime.queryInterface(XAccessible.class, w); + if (xAccessible != null) { + // XTopWindows usually have an accessible parent, which is the + // native container window .. + XAccessibleContext xAC = xAccessible.getAccessibleContext(); + if (xAC != null) { + XAccessible xParent = xAC.getAccessibleParent(); + if (xParent != null) { + AccessibilityNode parent = getTopWindowNode(xParent); + AccessibilityNode child = treeModel.createNode(xAccessible); + if (parent != null && child != null) { + parent.add(child); + } + return parent; + } else { + return getTopWindowNode(xAccessible, xAC); + } + } + } + return null; + } + + public void disposing(com.sun.star.lang.EventObject eventObject) { + // FIXME : message + // prevent setRoot from removing this as event listener + xToolkit = null; + treeModel.setRoot(treeModel.disconnectedRootNode); + } + + public void windowActivated(com.sun.star.lang.EventObject eventObject) { + } + + public void windowClosed(com.sun.star.lang.EventObject eventObject) { + XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface( + XAccessible.class, eventObject.Source); + if (xAccessible != null) { + AccessibilityNode node = treeModel.findNode(xAccessible); + + // The object implementing XTopWindow is often not the toplevel + // accessible object. + if (node != null && node.getParent() != this) { + node = (AccessibilityNode) node.getParent(); + } + + if (node != null) { + final AccessibilityNode an = node; + Runnable removeRun = new Runnable() { + public void run() { + try { + treeModel.removeNodeFromParent(an); + // Calling oneway methods from an UNO thread may cause + // deadlocks, so removing the listeners here. + an.setAttached(false); + } catch (IllegalArgumentException e) { + // for some toplevel we get more than one event - + // ignoring + } + } + }; + SwingUtilities.invokeLater(removeRun); + } + } + } + + public void windowClosing(com.sun.star.lang.EventObject eventObject) { + } + + public void windowDeactivated(com.sun.star.lang.EventObject eventObject) { + } + + public void windowMinimized(com.sun.star.lang.EventObject eventObject) { + } + + public void windowNormalized(com.sun.star.lang.EventObject eventObject) { + } + + public void windowOpened(com.sun.star.lang.EventObject eventObject) { + final XTopWindow xTopWindow = (XTopWindow) UnoRuntime.queryInterface( + XTopWindow.class, eventObject.Source); + if (xTopWindow != null) { + final ToolkitNode tn = this; + Runnable addNodeRun = new Runnable() { + public void run() { + // Note: UNO does not allow to make synchronous callbacks + // to oneway calls, so we have to fetch the node here. + AccessibilityNode an = getTopWindowNode(xTopWindow); + if (an != null) { + treeModel.addNodeInto(an, tn); + // Calling oneway methods from an UNO thread may cause + // deadlocks, so adding the listeners here. + an.setAttached(true); + } + } + }; + SwingUtilities.invokeLater(addNodeRun); + } + } +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common new file mode 100644 index 000000000000..7a0813b099db --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common @@ -0,0 +1,66 @@ +#************************************************************************* +# +# $RCSfile: makefile.common,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar +JAVAFILES = \ + AccessibilityModel.java \ + AccessibilityNode.java \ + AccessibilityTree.java \ + DynamicAccessibilityModel.java \ + DynamicAccessibilityNode.java \ + ToolkitNode.java diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk new file mode 100644 index 000000000000..7867cf1cc672 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJNAME = awb +PRJ = ..$/..$/..$/..$/..$/.. +TARGET = java_tree +PACKAGE = org$/openoffice$/accessibility$/awb$/tree + +USE_JAVAVER:=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +.IF "$(JAVAVER:s/.//)" >= "140" + +.INCLUDE : makefile.common + +JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +.ENDIF + +# --- Targets ------------------------------------------------------ + + +.INCLUDE : target.mk + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java new file mode 100644 index 000000000000..7d3da7c0ac16 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java @@ -0,0 +1,229 @@ +/************************************************************************* + * + * $RCSfile: ComponentView.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.Color; +import java.awt.Dimension; + +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +import javax.swing.JLabel; + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.uno.UnoRuntime; + +import org.openoffice.accessibility.misc.NameProvider; + +/** The <type>ContextView</type> class displays information accessible over + the <type>XAccessibleContext</type> interface. This includes name, + description, and role. +*/ +public class ComponentView + extends ObjectView +{ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + if (UnoRuntime.queryInterface( + XAccessibleComponent.class, xContext) != null) + return new ComponentView (aContainer); + else + return null; + } + + public ComponentView (ObjectViewContainer aContainer) + { + super (aContainer); + + ViewGridLayout aLayout = new ViewGridLayout (this); + + maRelativeLocationLabel = aLayout.AddLabeledEntry ("Relative Location: "); + maAbsoluteLocationLabel = aLayout.AddLabeledEntry ("Location on Screen: "); + maSizeLabel = aLayout.AddLabeledEntry ("Size"); + maBoundingBoxLabel = aLayout.AddLabeledEntry ("Bounding Box: "); + maConsistencyLabel = aLayout.AddLabeledEntry ("Consistent: "); + maForegroundColorLabel = aLayout.AddLabeledEntry ("Foreground Color: "); + maBackgroundColorLabel = aLayout.AddLabeledEntry ("Background Color: "); + } + + + public void SetObject (XAccessibleContext xContext) + { + mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface( + XAccessibleComponent.class, xContext); + super.SetObject (xContext); + } + + public void Update () + { + if (mxContext == null) + { + maRelativeLocationLabel.setText ("<null object>"); + maAbsoluteLocationLabel.setText ("<null object>"); + maSizeLabel.setText ("<null object>"); + maBoundingBoxLabel.setText ("<null object>"); + maConsistencyLabel.setText ("<null object>"); + maForegroundColorLabel.setText ("<null object>"); + maBackgroundColorLabel.setText ("<null object>"); + } + else + { + com.sun.star.awt.Point aLocation = mxComponent.getLocation(); + maRelativeLocationLabel.setText ( + aLocation.X + ", " + aLocation.Y); + com.sun.star.awt.Point aLocationOnScreen = + mxComponent.getLocationOnScreen(); + maAbsoluteLocationLabel.setText ( + aLocationOnScreen.X + ", " + aLocationOnScreen.Y); + com.sun.star.awt.Size aSize = mxComponent.getSize(); + maSizeLabel.setText ( + aSize.Width + ", " + aSize.Height); + com.sun.star.awt.Rectangle aBBox = mxComponent.getBounds(); + maBoundingBoxLabel.setText ( + aBBox.X + ", " + aBBox.Y + "," + + aBBox.Width + ", " + aBBox.Height); + int nColor = mxComponent.getForeground(); + maForegroundColorLabel.setText ( + "R"+ (nColor>>16&0xff) + + "G" + (nColor>>8&0xff) + + "B" + (nColor>>0&0xff) + + "A" + (nColor>>24&0xff)); + nColor = mxComponent.getBackground(); + maBackgroundColorLabel.setText ( + "R"+ (nColor>>16&0xff) + + "G" + (nColor>>8&0xff) + + "B" + (nColor>>0&0xff) + + "A" + (nColor>>24&0xff)); + + // Check consistency of coordinates. + String sConsistency = new String (); + if (aBBox.X!=aLocation.X || aBBox.Y!=aLocation.Y) + sConsistency += (sConsistency.length()!=0?", ":"") + + "Bounding box conflicts with relative location"; + if (aBBox.Width!=aSize.Width || aBBox.Height!=aSize.Height) + sConsistency += (sConsistency.length()!=0?", ":"") + + "Bounding box conflicts with size"; + XAccessible xParent = mxContext.getAccessibleParent(); + XAccessibleComponent xParentComponent = + (XAccessibleComponent)UnoRuntime.queryInterface( + XAccessibleComponent.class, xParent); + if (xParentComponent == null) + { + if (aLocation.X != aLocationOnScreen.X + || aLocation.Y != aLocationOnScreen.Y) + sConsistency += (sConsistency.length()!=0?", ":"") + + "location on screen does not equal " + + "relative location without parent"; + } + else + { + com.sun.star.awt.Point aParentLocationOnScreen = + xParentComponent.getLocationOnScreen(); + if (aLocation.X+aParentLocationOnScreen.X + != aLocationOnScreen.X + || aLocation.Y+aParentLocationOnScreen.Y + != aLocationOnScreen.Y) + sConsistency += (sConsistency.length()!=0?", ":"") + + "location on screen does not match " + + "relative location"; + } + if (sConsistency.length() == 0) + sConsistency += "yes"; + else + maConsistencyLabel.setBackground (GetContainer().GetErrorColor()); + maConsistencyLabel.setText (sConsistency); + } + } + + public String GetTitle () + { + return ("Component"); + } + + /** Listen for changes regarding displayed values. + */ + public void notifyEvent (AccessibleEventObject aEvent) + { + switch (aEvent.EventId) + { + case AccessibleEventId.BOUNDRECT_CHANGED : + case AccessibleEventId.VISIBLE_DATA_CHANGED : + Update (); + } + } + + private XAccessibleComponent mxComponent; + private JLabel + maRelativeLocationLabel, + maAbsoluteLocationLabel, + maSizeLabel, + maBoundingBoxLabel, + maConsistencyLabel, + maForegroundColorLabel, + maBackgroundColorLabel; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java new file mode 100644 index 000000000000..16d51b6edd97 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java @@ -0,0 +1,149 @@ +/************************************************************************* + * + * $RCSfile: ContextView.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.Color; +import java.awt.Dimension; + +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +import javax.swing.JLabel; +import javax.swing.JTextField; + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessibleContext; + +import org.openoffice.accessibility.misc.NameProvider; + +/** The <type>ContextView</type> class displays information accessible over + the <type>XAccessibleContext</type> interface. This includes name, + description, and role. +*/ +public class ContextView + extends ObjectView + implements ActionListener +{ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + if (xContext != null) + return new ContextView (aContainer); + else + return null; + } + + public ContextView (ObjectViewContainer aContainer) + { + super (aContainer); + + ViewGridLayout aLayout = new ViewGridLayout (this); + maNameLabel = aLayout.AddLabeledString ("Name:"); + maDescriptionLabel = aLayout.AddLabeledString ("Description:"); + maRoleLabel = aLayout.AddLabeledEntry ("Role:"); + } + + public void Update () + { + if (mxContext == null) + { + maNameLabel.setText ("<null object>"); + maDescriptionLabel.setText ("<null object>"); + maRoleLabel.setText ("<null object>"); + } + else + { + maNameLabel.setText (mxContext.getAccessibleName()); + maDescriptionLabel.setText (mxContext.getAccessibleDescription()); + maRoleLabel.setText (NameProvider.getRoleName (mxContext.getAccessibleRole())); + } + } + + public String GetTitle () + { + return ("Context"); + } + + /** Listen for changes regarding displayed values. + */ + public void notifyEvent (AccessibleEventObject aEvent) + { + switch (aEvent.EventId) + { + case AccessibleEventId.NAME_CHANGED : + case AccessibleEventId.DESCRIPTION_CHANGED : + Update (); + } + } + + public void actionPerformed (ActionEvent aEvent) + { + } + + + private JLabel + maNameLabel, + maDescriptionLabel, + maRoleLabel; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java new file mode 100644 index 000000000000..b60404f22efd --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java @@ -0,0 +1,153 @@ +/************************************************************************* + * + * $RCSfile: EditableTextView.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import javax.swing.JButton; + +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleEditableText; +import com.sun.star.uno.UnoRuntime; + +import org.openoffice.accessibility.awb.view.text.TextDialogFactory; + + +public class EditableTextView + extends ObjectView + implements ActionListener +{ + /** Create a EditableTextView when the given object supports the + XAccessibleEditableText interface. + */ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + XAccessibleEditableText xEditableText = + (XAccessibleEditableText)UnoRuntime.queryInterface( + XAccessibleEditableText.class, xContext); + if (xEditableText != null) + return new EditableTextView (aContainer); + else + return null; + } + + public EditableTextView (ObjectViewContainer aContainer) + { + super (aContainer); + + JButton aButton = new JButton ("cut..."); + aButton.setFont (ViewGridLayout.GetFont()); + aButton.addActionListener (this); + add (aButton); + aButton = new JButton ("paste..."); + aButton.setFont (ViewGridLayout.GetFont()); + aButton.addActionListener (this); + add (aButton); + aButton = new JButton ("edit..."); + aButton.setFont (ViewGridLayout.GetFont()); + aButton.addActionListener (this); + add (aButton); + aButton = new JButton ("format..."); + aButton.setFont (ViewGridLayout.GetFont()); + aButton.addActionListener (this); + add (aButton); + } + + + /** Additionally to the context store a reference to the + XAccessibleEditableText interface. + */ + public void SetObject (XAccessibleContext xObject) + { + mxEditableText = (XAccessibleEditableText)UnoRuntime.queryInterface( + XAccessibleEditableText.class, xObject); + super.SetObject (xObject); + } + + public String GetTitle () + { + return ("Editable Text"); + } + + synchronized public void Destroy () + { + mxEditableText = null; + super.Destroy(); + } + + public void actionPerformed (ActionEvent aEvent) + { + String sCommand = aEvent.getActionCommand(); + if (sCommand.equals ("cut...")) + TextDialogFactory.CreateCutDialog (mxContext); + else if (sCommand.equals ("past...")) + TextDialogFactory.CreatePasteDialog (mxContext); + else if (sCommand.equals ("edit...")) + TextDialogFactory.CreateEditDialog (mxContext); + else if (sCommand.equals ("format...")) + TextDialogFactory.CreateFormatDialog (mxContext); + } + + private XAccessibleEditableText mxEditableText; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java new file mode 100644 index 000000000000..e01f665b5e22 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java @@ -0,0 +1,158 @@ +/************************************************************************* + * + * $RCSfile: EventMonitorView.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.BorderLayout; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import javax.swing.JScrollBar; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessibleContext; + +import org.openoffice.accessibility.misc.NameProvider; + + +/** A simple event monitor that shows all events sent to one accessible + object. +*/ +class EventMonitorView + extends ObjectView +{ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + if (xContext != null) + return new EventMonitorView (aContainer); + else + return null; + } + + public EventMonitorView (ObjectViewContainer aContainer) + { + super (aContainer); + Layout(); + } + + public String GetTitle () + { + return "Event Monitor"; + } + + /** Create and arrange the widgets for this view. + */ + private void Layout () + { + setLayout (new GridBagLayout ()); + + maText = new JTextArea(); + maText.setBackground (new Color (255,250,240)); + maText.setFont (new Font ("Helvetica", Font.PLAIN, 9)); + + maScrollPane = new JScrollPane (maText, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + maScrollPane.setPreferredSize (new Dimension (300,80)); + + GridBagConstraints aConstraints = new GridBagConstraints (); + aConstraints.weightx = 1; + aConstraints.fill = GridBagConstraints.HORIZONTAL; + add (maScrollPane, aConstraints); + } + + + public void Update () + { + } + + + private void UpdateVerticalScrollBar () + { + JScrollBar sb = maScrollPane.getVerticalScrollBar(); + if (sb != null) + { + int nScrollBarValue = sb.getMaximum() - sb.getVisibleAmount() - 1; + sb.setValue (nScrollBarValue); + } + } + + + public void notifyEvent (AccessibleEventObject aEvent) + { + maText.append (NameProvider.getEventName (aEvent.EventId) + " : " + + aEvent.OldValue.toString() + + " -> " + + aEvent.NewValue.toString() + "\n"); + UpdateVerticalScrollBar(); + } + + private JTextArea maText; + private JScrollPane maScrollPane; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java new file mode 100644 index 000000000000..6f3f850aeb14 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java @@ -0,0 +1,182 @@ +/************************************************************************* + * + * $RCSfile: FocusView.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:34 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.Font; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +import javax.swing.JButton; +import javax.swing.JLabel; + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.AccessibleStateType; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleStateSet; +import com.sun.star.uno.UnoRuntime; + +public class FocusView + extends ObjectView + implements ActionListener +{ + /** Create a FocusView when the given object supports the + XAccessibleComponent interface. + */ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + XAccessibleComponent xComponent = (XAccessibleComponent)UnoRuntime.queryInterface( + XAccessibleComponent.class, xContext); + if (xComponent != null) + return new FocusView (aContainer); + else + return null; + } + + public FocusView (ObjectViewContainer aContainer) + { + super (aContainer); + + setLayout (new GridBagLayout()); + GridBagConstraints aConstraints = new GridBagConstraints (); + + maFocused = new JLabel (); + maFocused.setFont (GetContainer().GetViewFont()); + aConstraints.gridy = 0; + aConstraints.weightx = 1; + aConstraints.fill = GridBagConstraints.HORIZONTAL; + add (maFocused, aConstraints); + + maGrabFocus = new JButton ("grabFocus"); + maGrabFocus.setFont (GetContainer().GetViewFont()); + aConstraints.gridy = 1; + aConstraints.fill = GridBagConstraints.NONE; + aConstraints.anchor = GridBagConstraints.WEST; + add (maGrabFocus, aConstraints); + + maGrabFocus.addActionListener (this); + } + + /** Additionally to the context store a reference to the + XAccessibleComponent interface. + */ + public void SetObject (XAccessibleContext xObject) + { + mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface( + XAccessibleComponent.class, xObject); + super.SetObject (xObject); + } + + synchronized public void Destroy () + { + super.Destroy(); + maGrabFocus.removeActionListener (this); + } + + synchronized public void Update () + { + if (mxContext == null) + { + maFocused.setText ("<null object>"); + maGrabFocus.setEnabled (false); + } + else + { + XAccessibleStateSet aStateSet = mxContext.getAccessibleStateSet(); + if (aStateSet.contains(AccessibleStateType.FOCUSED)) + maFocused.setText ("focused"); + else + maFocused.setText ("not focused"); + if (maGrabFocus != null) + maGrabFocus.setEnabled (true); + } + } + + public String GetTitle () + { + return ("Focus"); + } + + synchronized public void actionPerformed (ActionEvent aEvent) + { + if (aEvent.getActionCommand().equals("grabFocus")) + { + mxComponent.grabFocus(); + } + } + + public void notifyEvent (AccessibleEventObject aEvent) + { + System.out.println (aEvent); + if (aEvent.EventId == AccessibleEventId.STATE_CHANGED) + Update (); + } + + private JLabel maFocused; + private JButton maGrabFocus; + private XAccessibleComponent mxComponent; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java b/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java new file mode 100644 index 000000000000..590d17c94954 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java @@ -0,0 +1,194 @@ +/************************************************************************* + * + * $RCSfile: LayoutManager.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:34 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.Component; +import java.awt.Cursor; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.awt.Point; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseEvent; +import javax.swing.JComponent; + +class LayoutManager + implements MouseListener, + MouseMotionListener +{ + public LayoutManager (JComponent aLayoutedComponent) + { + maLayoutedComponent = aLayoutedComponent; + maDraggedView = null; + mbInsertionPending = false; + } + + public void mouseClicked (MouseEvent aEvent) + { + System.out.println (aEvent); + } + public void mousePressed (MouseEvent aEvent) + { + mnOldY = aEvent.getPoint().y; + } + public void mouseReleased (MouseEvent aEvent) + { + if (mbInsertionPending) + { + InsertView (maDraggedView, aEvent.getPoint().y); + mbInsertionPending = false; + maDraggedView = null; + } + } + public void mouseEntered (MouseEvent aEvent) + { + } + public void mouseExited (MouseEvent aEvent) + { + if (mbInsertionPending) + { + InsertView (maDraggedView, mnOldY); + mbInsertionPending = false; + maDraggedView = null; + } + } + public void mouseDragged (MouseEvent aEvent) + { + int dy = mnOldY - aEvent.getPoint().y; + GridBagLayout aLayout = (GridBagLayout)maLayoutedComponent.getLayout(); + if ( ! mbInsertionPending && dy != 0) + { + maDraggedView = RemoveView (mnOldY); + if (maDraggedView != null) + mbInsertionPending = true; + } + } + public void mouseMoved (MouseEvent aEvent) + { + } + + + + + private ObjectView RemoveView (int y) + { + ObjectView aView = null; + GridBagLayout aLayout = (GridBagLayout)maLayoutedComponent.getLayout(); + + Point aGridLocation = aLayout.location (10,y); + Component[] aComponentList = maLayoutedComponent.getComponents(); + System.out.println ("removing view at " + aGridLocation); + for (int i=0; i<aComponentList.length && aView==null; i++) + { + GridBagConstraints aConstraints = aLayout.getConstraints ( + aComponentList[i]); + if (aConstraints.gridy == aGridLocation.y) + aView = (ObjectView)aComponentList[i]; + } + maNormalCursor = maLayoutedComponent.getCursor(); + if (aView != null) + { + System.out.println ("removing view at " + aGridLocation.y); + maLayoutedComponent.setCursor (new Cursor (Cursor.MOVE_CURSOR)); + maLayoutedComponent.remove (aView); + maLayoutedComponent.validate(); + maLayoutedComponent.repaint(); + } + + return aView; + } + + private void InsertView (ObjectView aView, int y) + { + if (aView != null) + { + GridBagLayout aLayout = (GridBagLayout)maLayoutedComponent.getLayout(); + Point aGridLocation = aLayout.location (0,y); + Component[] aComponentList = maLayoutedComponent.getComponents(); + System.out.println ("new position is " + aGridLocation.y); + for (int i=0; i<aComponentList.length; i++) + { + GridBagConstraints aConstraints = aLayout.getConstraints ( + aComponentList[i]); + if (aConstraints.gridy >= aGridLocation.y) + { + if (aConstraints.gridy == aGridLocation.y) + maLayoutedComponent.add (maDraggedView, aConstraints); + aConstraints.gridy += 1; + aLayout.setConstraints (aComponentList[i], aConstraints); + } + } + maLayoutedComponent.validate(); + maLayoutedComponent.repaint(); + } + maLayoutedComponent.setCursor (maNormalCursor); + } + + + + + private JComponent maLayoutedComponent; + private ObjectView maDraggedView; + private int mnOldY; + private boolean mbInsertionPending; + private Cursor maNormalCursor; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/view/Makefile new file mode 100644 index 000000000000..2e4eb1566afd --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/Makefile @@ -0,0 +1,13 @@ +# $Id: Makefile,v 1.1 2003/06/13 16:30:34 af Exp $ + +all : package + +ROOT=../../../../.. +PACKAGE = org.openoffice.accessibility.awb.view +SUBDIRS = text +include makefile.common + +include $(ROOT)/makefile.in + + +package : $(CLASS_FILES) diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java new file mode 100644 index 000000000000..3c1b8e90ff26 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java @@ -0,0 +1,90 @@ +package org.openoffice.accessibility.awb.view; + +import javax.swing.JPanel; + +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessibleContext; + +/** This is the base class for all object views that can be placed inside an + object view container. + + <p>When provided with a new accessible object the container will call + the Create method to create a new instance when certain conditions are + met. It then calls SetObject to pass the object to the instance. + Finally it calls Update.</p> + + <p>The SetObject and Update methods may be called for a new object + without calling Create first. In this way an existing instance is + recycled.</p> +*/ +abstract public class ObjectView + extends JPanel +{ + /** This factory method creates a new instance of the (derived) class + when the given accessible object supports all necessary features. + In the ususal case this will be the support of a specific + accessibility interface. + */ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + return null; + } + + public ObjectView (ObjectViewContainer aContainer) + { + maContainer = aContainer; + mxContext = null; + } + + /** Call this when you want the object to be destroyed. Release all + resources when called. + */ + public void Destroy () + { + } + + /** Tell the view to display information for a new accessible object. + @param xObject + The given object may be null. A typical behaviour in this case + would be to display a blank area. But is also possible to show + information about the last object. + */ + public void SetObject (XAccessibleContext xContext) + { + mxContext = xContext; + Update (); + } + + + /** This is a request of a repaint with the current state of the current + object. The current object may or may not be the same as the one + when Update() was called the last time. + */ + public void Update () + { + } + + + /** Return a string that is used as a title of an enclosing frame. + */ + abstract public String GetTitle (); + + + public ObjectViewContainer GetContainer () + { + return maContainer; + } + + + /** Implement this method if you are interested in accessible events. + */ + public void notifyEvent (AccessibleEventObject aEvent) + {} + + /// Reference to the current object to display information about. + protected XAccessibleContext mxContext; + + protected ObjectViewContainer maContainer; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java new file mode 100644 index 000000000000..e5eeec95b41a --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java @@ -0,0 +1,344 @@ +/************************************************************************* + * + * $RCSfile: ObjectViewContainer.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obr $ $Date: 2003/09/19 09:21:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.awt.Insets; + +import java.util.Vector; + +import java.lang.reflect.Method; +import java.lang.NoSuchMethodException; +import java.lang.IllegalAccessException; +import java.lang.reflect.InvocationTargetException; + +import javax.swing.JPanel; +import javax.swing.JTree; +import javax.swing.BorderFactory; +import javax.swing.border.Border; +import javax.swing.border.BevelBorder; +import javax.swing.SwingUtilities; + +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleEventBroadcaster; +import com.sun.star.accessibility.XAccessibleEventListener; +import com.sun.star.accessibility.XAccessibleSelection; +import com.sun.star.lang.EventObject; +import com.sun.star.uno.UnoRuntime; + +import org.openoffice.accessibility.awb.view.ObjectView; + + + +/** This container of specialized object views displays information about + one accessible object. + In this it plays several roles: + 1. Object container. + 2. Accessibility event dispatcher. + 3. Object view class registration manager. + 4. Swing widget. +*/ +public class ObjectViewContainer + extends JPanel + implements XAccessibleEventListener +{ + public ObjectViewContainer () + { + maFont = new Font ("Dialog", Font.PLAIN, 11); + maViewTemplates = new Vector (); + maViewBorder = BorderFactory.createBevelBorder (BevelBorder.RAISED); + GridBagLayout aLayout = new GridBagLayout (); + setLayout (aLayout); + // maLayoutManager = new LayoutManager (this); + maLayoutManager = null; + + RegisterView (ContextView.class); + RegisterView (ComponentView.class); + RegisterView (ParentView.class); + RegisterView (StateSetView.class); + RegisterView (FocusView.class); + RegisterView (TextView.class); + RegisterView (EditableTextView.class); + RegisterView (TableView.class); + RegisterView (SelectionView.class); + RegisterView (ServiceInterfaceView.class); + RegisterView (EventMonitorView.class); + + mxContext = null; + + // addMouseListener (maLayoutManager); + // addMouseMotionListener (maLayoutManager); + } + + + + /** Remove all existing views and create new ones according to the + interfaces supported by the given object. + */ + public synchronized void SetObject (XAccessibleContext xContext) + { + // Call Destroy at all views to give them a chance to release their + // resources. + int n = getComponentCount(); + for (int i=0; i<n; i++) + ((ObjectView)getComponent(i)).Destroy(); + // Remove existing views. + removeAll (); + + mxContext = xContext; + + // Add new views. + for (int i=0; i<maViewTemplates.size(); i++) + { + try + { + Class aViewClass = (Class)maViewTemplates.elementAt (i); + Method aCreateMethod = aViewClass.getDeclaredMethod ( + "Create", new Class[] { + ObjectViewContainer.class, + XAccessibleContext.class}); + if (aCreateMethod != null) + { + ObjectView aView = (ObjectView) + aCreateMethod.invoke ( + null, new Object[] {this, xContext}); + Add (aView); + } + } + catch (NoSuchMethodException e) + {System.err.println ("Caught exception while creating view " + + i + " : " + e);} + catch (IllegalAccessException e) + {System.err.println ("Caught exception while creating view " + + i + " : " + e);} + catch (InvocationTargetException e) + {System.err.println ("Caught exception while creating view " + + i + " : " + e);} + } + + UpdateLayoutManager (); + + // Now set the object at all views. + n = getComponentCount(); + for (int i=0; i<n; i++) + ((ObjectView)getComponent(i)).SetObject (xContext); + + setPreferredSize (getLayout().preferredLayoutSize (this)); + ((GridBagLayout) getLayout()).invalidateLayout(this); + validate(); + } + + + + + /** Add the given class to the list of classes which will be + instantiated the next time an accessible object is set. + */ + public void RegisterView (Class aObjectViewClass) + { + maViewTemplates.addElement (aObjectViewClass); + } + + + + + /** Replace one view class with another. + */ + public void ReplaceView (Class aObjectViewClass, Class aSubstitution) + { + int nIndex = maViewTemplates.indexOf (aObjectViewClass); + if (nIndex >= 0) + maViewTemplates.setElementAt (aSubstitution, nIndex); + } + + + /** Return a font that should be used for widgets in the views. + */ + public Font GetViewFont () + { + return maFont; + } + + public Color GetErrorColor () + { + return new Color (255,80,50); + } + + /** Add an object view and place it below all previously added views. + @param aView + This argument may be null. In this case nothing happens. + */ + private void Add (ObjectView aView) + { + if (aView != null) + { + GridBagConstraints constraints = new GridBagConstraints (); + constraints.gridx = 0; + constraints.gridy = getComponentCount(); + constraints.gridwidth = 1; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.weighty = 0; + constraints.ipadx = 2; + constraints.ipady = 5; + constraints.insets = new Insets (5,5,5,5); + constraints.anchor = GridBagConstraints.NORTH; + constraints.fill = GridBagConstraints.HORIZONTAL; + + aView.setBorder ( + BorderFactory.createTitledBorder ( + maViewBorder, aView.GetTitle())); + + add (aView, constraints); + } + } + + /** Update the layout manager by setting the vertical weight of the + bottom entry to 1 and so make it strech to over the available + space. + + */ + private void UpdateLayoutManager () + { + // Adapt the layout manager. + if (getComponentCount() > 1000) + { + Component aComponent = getComponent (getComponentCount()-1); + GridBagLayout aLayout = (GridBagLayout)getLayout(); + GridBagConstraints aConstraints = aLayout.getConstraints (aComponent); + aConstraints.weighty = 1; + aLayout.setConstraints (aComponent, aConstraints); + } + } + + + + + /** Put the event just received into the event queue which will deliver + it soon asynchronuously to the DispatchEvent method. + */ + public void notifyEvent (final AccessibleEventObject aEvent) + { + SwingUtilities.invokeLater( + new Runnable() + { + public void run() + { + DispatchEvent (aEvent); + } + } + ); + } + + + + + /** Forward accessibility events to all views without them being + registered as event listeners each on their own. + */ + private void DispatchEvent (AccessibleEventObject aEvent) + { + int n = getComponentCount(); + for (int i=0; i<n; i++) + ((ObjectView)getComponent(i)).notifyEvent (aEvent); + } + + + + /** When the object is disposed that is displayed by the views of this + container then tell all views about this. + */ + public void disposing (EventObject aEvent) + { + mxContext = null; + SwingUtilities.invokeLater( + new Runnable() + { + public void run() + { + SetObject (null); + } + } + ); + } + + + + + /// The current accessible context display by the views. + private XAccessibleContext mxContext; + + /// Observe this tree for selection changes and notify them to all + /// children. + private JTree maTree; + private Border maViewBorder; + /// List of view templates which are instantiated when new object is set. + private Vector maViewTemplates; + private Font maFont; + private LayoutManager maLayoutManager; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainerWindow.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainerWindow.java new file mode 100644 index 000000000000..8db9af4f46ca --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainerWindow.java @@ -0,0 +1,35 @@ +package org.openoffice.accessibility.awb.view; + +import java.awt.BorderLayout; +import javax.swing.JFrame; +import com.sun.star.accessibility.XAccessibleContext; + + +/** Top level window that creates a single object view container. This + container shows information about a specific accessible object and is + not affected by the selection of the accessbility tree widget. +*/ +public class ObjectViewContainerWindow + extends JFrame +{ + public ObjectViewContainerWindow (XAccessibleContext xContext) + { + setSize (new java.awt.Dimension (300,600)); + + maContainer = new ObjectViewContainer (); + maContainer.SetObject (xContext); + getContentPane().add (maContainer, BorderLayout.CENTER); + + pack (); + setVisible (true); + } + + /** Set the object that is displayed in this window. + */ + public void SetObject (XAccessibleContext xContext) + { + maContainer.SetObject (xContext); + } + + private ObjectViewContainer maContainer; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java new file mode 100644 index 000000000000..a6fb52a40ecb --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java @@ -0,0 +1,181 @@ +/************************************************************************* + * + * $RCSfile: ParentView.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:36 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.lang.Integer; +import javax.swing.JLabel; +import javax.swing.JTextField; + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.lang.IndexOutOfBoundsException; + +import org.openoffice.accessibility.misc.NameProvider; + + +/** Show informations related to the parent/child relationship. +*/ +public class ParentView + extends ObjectView +{ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + if (xContext != null) + return new ParentView (aContainer); + else + return null; + } + + public ParentView (ObjectViewContainer aContainer) + { + super (aContainer); + + ViewGridLayout aLayout = new ViewGridLayout (this); + maParentLabel = aLayout.AddLabeledEntry ("Has parent: "); + maIndexLabel = aLayout.AddLabeledEntry ("Index in parent: "); + maValidLabel = aLayout.AddLabeledEntry ("Parent/Child relationship valid: "); + maChildrenLabel = aLayout.AddLabeledEntry ("Child count: "); + } + + public void Update () + { + if (mxContext == null) + { + maParentLabel.setText ("<null object>"); + maIndexLabel.setText ("<null object>"); + maValidLabel.setText ("<null object>"); + maChildrenLabel.setText ("<null object>"); + } + else + { + XAccessible xParent = mxContext.getAccessibleParent(); + int nIndex = mxContext.getAccessibleIndexInParent(); + maIndexLabel.setText (Integer.toString(nIndex)); + if (xParent != null) + { + maParentLabel.setText ("yes"); + XAccessibleContext xParentContext = + xParent.getAccessibleContext(); + if (xParentContext != null) + { + try + { + XAccessible xChild = + xParentContext.getAccessibleChild(nIndex); + if (xChild != mxContext) + maValidLabel.setText ("yes"); + else + { + maValidLabel.setText ("no"); + maValidLabel.setBackground (GetContainer().GetErrorColor()); + } + } + catch (IndexOutOfBoundsException e) + { + maValidLabel.setText ("no: invalid index in parent"); + maValidLabel.setBackground (GetContainer().GetErrorColor()); + } + } + else + { + maValidLabel.setText ("no: parent has no context"); + maValidLabel.setBackground (GetContainer().GetErrorColor()); + } + } + else + maParentLabel.setText ("no"); + maChildrenLabel.setText (Integer.toString(mxContext.getAccessibleChildCount())); + } + } + + public String GetTitle () + { + return ("Parent"); + } + + + /** Listen for changes regarding displayed values. + */ + public void notifyEvent (AccessibleEventObject aEvent) + { + switch (aEvent.EventId) + { + default: + Update (); + } + } + + + private JLabel + maParentLabel, + maIndexLabel, + maValidLabel, + maChildrenLabel; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java new file mode 100644 index 000000000000..5967e4ae1ad4 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java @@ -0,0 +1,301 @@ +/************************************************************************* + * + * $RCSfile: SelectionView.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:36 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.util.Vector; + +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; + +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JOptionPane; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JToggleButton; +import javax.swing.ListSelectionModel; + + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.AccessibleStateType; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleSelection; +import com.sun.star.accessibility.XAccessibleStateSet; + +import com.sun.star.uno.UnoRuntime; +import com.sun.star.lang.IndexOutOfBoundsException; + + +/** Display a list of children and select/deselect buttons +*/ +class SelectionView + extends ObjectView + implements ActionListener +{ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + XAccessibleSelection xSelection = (XAccessibleSelection)UnoRuntime.queryInterface( + XAccessibleSelection.class, xContext); + if (xSelection != null) + return new SelectionView(aContainer); + else + return null; + } + + public SelectionView (ObjectViewContainer aContainer) + { + super (aContainer); + Layout(); + } + + public String GetTitle () + { + return "Selection"; + } + + /** Create and arrange the widgets for this view. + */ + private void Layout () + { + setLayout (new GridBagLayout()); + + GridBagConstraints aConstraints = new GridBagConstraints(); + + // Label that shows whether the selection is multi selectable. + aConstraints.gridx = 0; + aConstraints.gridy = 0; + aConstraints.anchor = GridBagConstraints.WEST; + maTypeLabel = new JLabel (); + maTypeLabel.setFont (maContainer.GetViewFont()); + add (maTypeLabel, aConstraints); + + // the JListBox + maChildrenSelector = new JPanel (); + maChildrenSelector.setPreferredSize (new Dimension (100,100)); + maChildrenSelector.setLayout ( + new BoxLayout (maChildrenSelector, BoxLayout.Y_AXIS)); + + aConstraints.gridx = 0; + aConstraints.gridwidth = 4; + aConstraints.gridy = 1; + aConstraints.fill = GridBagConstraints.HORIZONTAL; + add (new JScrollPane (maChildrenSelector, + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), + aConstraints); + + JButton aButton; + aButton = new JButton( "Select all" ); + aButton.setFont (maContainer.GetViewFont()); + aButton.setActionCommand( "Select all" ); + aButton.addActionListener( this ); + aConstraints.gridx = 0; + aConstraints.gridwidth = 1; + aConstraints.gridy = 2; + aConstraints.fill = GridBagConstraints.NONE; + aConstraints.anchor = GridBagConstraints.WEST; + add (aButton, aConstraints); + + aButton = new JButton( "Clear Selection" ); + aButton.setFont (maContainer.GetViewFont()); + aButton.setActionCommand( "Clear Selection" ); + aButton.addActionListener( this ); + aConstraints.gridx = 1; + aConstraints.gridy = 2; + aConstraints.weightx = 1; + add (aButton, aConstraints); + + setSize (getPreferredSize()); + } + + + public void SetObject (XAccessibleContext xContext) + { + mxSelection = (XAccessibleSelection)UnoRuntime.queryInterface( + XAccessibleSelection.class, xContext); + super.SetObject (xContext); + } + + + public void Update () + { + maChildrenSelector.removeAll (); + + // Determine whether multi selection is possible. + XAccessibleStateSet aStateSet = mxContext.getAccessibleStateSet(); + boolean bMultiSelectable = false; + if (aStateSet!=null && aStateSet.contains( + AccessibleStateType.MULTI_SELECTABLE)) + { + bMultiSelectable = true; + maTypeLabel.setText ("multi selectable"); + } + else + { + maTypeLabel.setText ("single selectable"); + } + + if (mxContext.getAccessibleRole() != AccessibleRole.TABLE) + { + int nCount = mxContext.getAccessibleChildCount(); + for (int i=0; i<nCount; i++) + { + try + { + XAccessible xChild = mxContext.getAccessibleChild(i); + XAccessibleContext xChildContext = xChild.getAccessibleContext(); + + String sName = i + " " + xChildContext.getAccessibleName(); + JToggleButton aChild; + aChild = new JCheckBox (sName); + aChild.setFont (maContainer.GetViewFont()); + + XAccessibleStateSet aChildStateSet = + mxContext.getAccessibleStateSet(); + aChild.setSelected (aChildStateSet!=null + && aChildStateSet.contains(AccessibleStateType.SELECTED)); + + aChild.addActionListener (this); + maChildrenSelector.add (aChild); + + } + catch (IndexOutOfBoundsException e) + { + } + } + } + } + + + void SelectAll() + { + mxSelection.selectAllAccessibleChildren(); + } + + void ClearSelection() + { + mxSelection.clearAccessibleSelection(); + } + + + + /** Call the function associated with the pressed button. + */ + public void actionPerformed (ActionEvent aEvent) + { + String sCommand = aEvent.getActionCommand(); + + if (sCommand.equals ("Clear Selection")) + ClearSelection(); + else if (sCommand.equals ("Select all")) + SelectAll(); + else + { + // Extract the child index from the widget text. + String[] aWords = sCommand.split (" "); + int nIndex = Integer.parseInt(aWords[0]); + try + { + if (((JToggleButton)aEvent.getSource()).isSelected()) + mxSelection.selectAccessibleChild (nIndex); + else + mxSelection.deselectAccessibleChild (nIndex); + } + catch (IndexOutOfBoundsException e) + { + System.err.println ( + "caught exception while changing selection: " + e); + } + } + } + + + public void notifyEvent (AccessibleEventObject aEvent) + { + switch (aEvent.EventId) + { + case AccessibleEventId.SELECTION_CHANGED: + case AccessibleEventId.STATE_CHANGED: + case AccessibleEventId.CHILD: + Update (); + } + } + + private JPanel maChildrenSelector; + private XAccessibleSelection mxSelection; + private JLabel maTypeLabel; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ServiceInterfaceView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ServiceInterfaceView.java new file mode 100644 index 000000000000..7c41ff01c97e --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ServiceInterfaceView.java @@ -0,0 +1,150 @@ +package org.openoffice.accessibility.awb.view; + +import java.awt.GridLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import java.lang.Integer; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.lang.IndexOutOfBoundsException; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XTypeProvider; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; + +import org.openoffice.accessibility.misc.NameProvider; + + +/** Show all supported services and interfaces. +*/ +public class ServiceInterfaceView + extends ObjectView +{ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + if (xContext != null) + return new ServiceInterfaceView (aContainer); + else + return null; + } + + + + + public ServiceInterfaceView (ObjectViewContainer aContainer) + { + super (aContainer); + + maImplementationNameRoot = new DefaultMutableTreeNode ("Implementation Name"); + maServiceRoot = new DefaultMutableTreeNode ("Supported Services"); + maInterfaceRoot = new DefaultMutableTreeNode ("Supported Interfaces"); + maTree = new JTree (new DefaultMutableTreeNode[] + {maServiceRoot,maInterfaceRoot}); + JScrollPane aScrollPane = new JScrollPane ( + maTree, + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + + setMinimumSize (new Dimension(300,200)); + setLayout (new GridLayout (1,1)); + add (aScrollPane); + } + + + + + public void Update () + { + DefaultTreeModel aModel = (DefaultTreeModel)maTree.getModel(); + + // Clear old tree. + DefaultMutableTreeNode aRoot =(DefaultMutableTreeNode)aModel.getRoot(); + aRoot.removeAllChildren(); + + // Create the new tree. + CreateImplementationNameTree (); + CreateServiceTree (); + CreateInterfaceTree (); + aRoot.add (maImplementationNameRoot); + aRoot.add (maServiceRoot); + aRoot.add (maInterfaceRoot); + aModel.setRoot (aRoot); + + // Expand whole tree. + for (int i=0; i<maTree.getRowCount(); i++) + maTree.expandRow (i); + } + + private void CreateImplementationNameTree () + { + XServiceInfo xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface( + XServiceInfo.class, mxContext); + maImplementationNameRoot.removeAllChildren(); + if (xServiceInfo != null) + { + maImplementationNameRoot.add ( + new DefaultMutableTreeNode ( + (xServiceInfo!=null + ? xServiceInfo.getImplementationName() + : "<XServiceInfo not supported>"))); + } + } + + private void CreateServiceTree () + { + XServiceInfo xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface( + XServiceInfo.class, mxContext); + maServiceRoot.removeAllChildren(); + if (xServiceInfo != null) + { + String[] aServiceNames = xServiceInfo.getSupportedServiceNames(); + int nCount = aServiceNames.length; + for (int i=0; i<nCount; i++) + maServiceRoot.add ( + new DefaultMutableTreeNode (aServiceNames[i])); + } + else + maServiceRoot.add ( + new DefaultMutableTreeNode("XServiceInfo not supported")); + } + + private void CreateInterfaceTree () + { + XTypeProvider xTypeProvider = (XTypeProvider)UnoRuntime.queryInterface( + XTypeProvider.class, mxContext); + maInterfaceRoot.removeAllChildren(); + if (xTypeProvider != null) + { + Type[] aTypes = xTypeProvider.getTypes(); + int nCount = aTypes.length; + for (int i=0; i<nCount; i++) + maInterfaceRoot.add ( + new DefaultMutableTreeNode (aTypes[i].getTypeName())); + } + else + maInterfaceRoot.add ( + new DefaultMutableTreeNode("XTypeProvider not supported")); + } + + public String GetTitle () + { + return ("Supported Services and Interfaces"); + } + + + private JTree maTree; + private DefaultMutableTreeNode maImplementationNameRoot; + private DefaultMutableTreeNode maServiceRoot; + private DefaultMutableTreeNode maInterfaceRoot; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java new file mode 100644 index 000000000000..a0d6e289156d --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java @@ -0,0 +1,233 @@ +/************************************************************************* + * + * $RCSfile: StateSetView.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:37 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.geom.AffineTransform; + + + +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleStateType; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleStateSet; + +import org.openoffice.accessibility.misc.NameProvider; + +public class StateSetView + extends ObjectView +{ + /** Create a FocusView when the given object supports the + XAccessibleComponent interface. + */ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + ObjectView aView = null; + if (xContext != null) + aView = new StateSetView (aContainer); + + return aView; + } + + public StateSetView (ObjectViewContainer aContainer) + { + super (aContainer); + setPreferredSize (new Dimension(300,110)); + setMinimumSize (new Dimension(200,80)); + } + + public String GetTitle () + { + return ("StateSet"); + } + + public void notifyEvent (AccessibleEventObject aEvent) + { + if (aEvent.EventId == AccessibleEventId.STATE_CHANGED) + Update(); + } + + + public void Update () + { + repaint (); + } + + public void paintChildren (Graphics g) + { + if (g != null) + synchronized (g) + { + super.paintChildren (g); + + // Calculcate the are inside the border. + Insets aInsets = getInsets (); + Dimension aSize = getSize(); + Rectangle aWidgetArea = new Rectangle ( + aInsets.left, + aInsets.top, + aSize.width-aInsets.left-aInsets.right, + aSize.height-aInsets.top-aInsets.bottom); + + PaintAllStates ((Graphics2D)g, aWidgetArea); + } + } + + private void PaintAllStates (Graphics2D g, Rectangle aWidgetArea) + { + Color aTextColor = g.getColor(); + + g.setRenderingHint ( + RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + + XAccessibleStateSet xStateSet = ( mxContext != null ) ? mxContext.getAccessibleStateSet() : null; + if (xStateSet != null) + { + short aStates[] = xStateSet.getStates (); + final int nMaxStateIndex = AccessibleStateType.VISIBLE;//MANAGES_DESCENDANTS; + int nStateWidth = (aWidgetArea.width-12) / (nMaxStateIndex+1); + AffineTransform aTransform = g.getTransform (); + g.setColor (aTextColor); + int y = aWidgetArea.y+aWidgetArea.height - 25; + double nTextRotation = -0.9;//-java.lang.Math.PI/2; + double nScale = 0.6; + + // Create a shape for the boxes. + int nBoxWidth = 8; + Rectangle aCheckBox = new Rectangle (-nBoxWidth/2,0,nBoxWidth,nBoxWidth); + + // For each state draw a box, fill it appropriately, and draw + // thre states name. + for (short i=0; i<=nMaxStateIndex; i++) + { + int x = nStateWidth + i * nStateWidth; + String sStateName = NameProvider.getStateName (i); + if (sStateName == null) + sStateName = new String ("<unknown state " + i + ">"); + boolean bStateSet = xStateSet.contains (i); + g.setTransform (aTransform); + g.translate (x,y); + if (bStateSet) + { + switch (i) + { + case AccessibleStateType.INVALID: + case AccessibleStateType.DEFUNC: + g.setColor (saInvalidColor); + break; + case AccessibleStateType.FOCUSED: + g.setColor (saFocusColor); + break; + case AccessibleStateType.SELECTED: + g.setColor (saSelectionColor); + break; + case AccessibleStateType.EDITABLE: + g.setColor (saEditColor); + break; + default: + g.setColor (saDefaultColor); + break; + } + g.fill (aCheckBox); + g.setColor (aTextColor); + } + g.draw (aCheckBox); + g.rotate (nTextRotation); + g.scale (nScale, nScale); + g.translate (2,-2); + g.drawString (sStateName, 0,0); + } + + // Draw string of set states. + String sStates = new String (); + for (int i=0; i<aStates.length; i++) + { + if (i > 0) + sStates = sStates + ", "; + sStates = sStates + NameProvider.getStateName(aStates[i]); + } + g.setTransform (aTransform); + g.translate (10,aWidgetArea.y+aWidgetArea.height-3); + g.scale (0.9,0.9); + g.drawString (sStates,0,0); + } + } + + static private Color + saInvalidColor = new Color (255,0,255), + saFocusColor = new Color (100,100,255), + saSelectionColor = Color.GREEN, + saDefaultColor = new Color (90,90,90), + saEditColor = new Color (240,240,0); +} + + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java new file mode 100644 index 000000000000..ad185ce86f7b --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java @@ -0,0 +1,195 @@ +/************************************************************************* + * + * $RCSfile: TableView.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:37 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.lang.Integer; +import java.lang.StringBuffer; + +import javax.swing.JLabel; + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleTable; +import com.sun.star.uno.UnoRuntime; + + + +/** The <type>ContextView</type> class displays information accessible over + the <type>XAccessibleContext</type> interface. This includes name, + description, and role. +*/ +public class TableView + extends ObjectView +{ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + if (UnoRuntime.queryInterface( + XAccessibleTable.class, xContext) != null) + return new TableView (aContainer); + else + return null; + } + + public TableView (ObjectViewContainer aContainer) + { + super (aContainer); + + ViewGridLayout aLayout = new ViewGridLayout (this); + + maRowCountLabel = aLayout.AddLabeledEntry ("Row Count: "); + maColumnCountLabel = aLayout.AddLabeledEntry ("Column Count: "); + maCellCountLabel = aLayout.AddLabeledEntry ("Cell Count: "); + maSelectedRowsLabel = aLayout.AddLabeledEntry ("Selected Rows: "); + maSelectedColumnsLabel = aLayout.AddLabeledEntry ("Selected Columns: "); + } + + + public void SetObject (XAccessibleContext xContext) + { + mxTable = (XAccessibleTable)UnoRuntime.queryInterface( + XAccessibleTable.class, xContext); + super.SetObject (xContext); + } + + + public void Update () + { + if (mxTable == null) + { + maRowCountLabel.setText ("<null object>"); + maColumnCountLabel.setText ("<null object>"); + maCellCountLabel.setText ("<null object>"); + maSelectedRowsLabel.setText ("<null object>"); + maSelectedColumnsLabel.setText ("<null object>"); + } + else + { + int nRowCount = mxTable.getAccessibleRowCount(); + int nColumnCount = mxTable.getAccessibleColumnCount(); + maRowCountLabel.setText (Integer.toString (nRowCount)); + maColumnCountLabel.setText (Integer.toString (nColumnCount)); + maCellCountLabel.setText (Integer.toString (nRowCount*nColumnCount)); + + StringBuffer sList = new StringBuffer(); + int[] aSelected = mxTable.getSelectedAccessibleRows(); + boolean bFirst = true; + for (int i=0; i<aSelected.length; i++) + { + if ( ! bFirst) + { + sList.append (", "); + bFirst = false; + } + sList.append (Integer.toString(aSelected[i])); + } + maSelectedRowsLabel.setText (sList.toString()); + sList = new StringBuffer(); + aSelected = mxTable.getSelectedAccessibleColumns(); + bFirst = true; + for (int i=0; i<aSelected.length; i++) + { + if ( ! bFirst) + { + sList.append (", "); + bFirst = false; + } + sList.append (Integer.toString(aSelected[i])); + } + maSelectedColumnsLabel.setText (sList.toString()); + } + } + + + + + public String GetTitle () + { + return ("Table"); + } + + + + + /** Listen for changes regarding displayed values. + */ + public void notifyEvent (AccessibleEventObject aEvent) + { + switch (aEvent.EventId) + { + case AccessibleEventId.TABLE_MODEL_CHANGED : + case AccessibleEventId.SELECTION_CHANGED: + Update (); + } + } + + private XAccessibleTable mxTable; + private JLabel + maRowCountLabel, + maColumnCountLabel, + maCellCountLabel, + maSelectedRowsLabel, + maSelectedColumnsLabel; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java new file mode 100644 index 000000000000..56f4c8758e61 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java @@ -0,0 +1,501 @@ +/************************************************************************* + * + * $RCSfile: TextView.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obr $ $Date: 2008/05/14 13:21:35 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JSpinner; +import javax.swing.JTree; +import javax.swing.tree.TreeNode; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.MutableTreeNode; + +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.AccessibleTextType; +import com.sun.star.accessibility.AccessibleStateType; +import com.sun.star.accessibility.TextSegment; +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleMultiLineText; +import com.sun.star.accessibility.XAccessibleStateSet; +import com.sun.star.awt.Point; +import com.sun.star.awt.Rectangle; +import com.sun.star.beans.PropertyValue; +import com.sun.star.lang.IndexOutOfBoundsException; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.uno.UnoRuntime; + +import org.openoffice.accessibility.awb.view.text.CaretSpinnerModel; +import org.openoffice.accessibility.awb.view.text.TextDialogFactory; + + +public class TextView + extends ObjectView + implements ActionListener +{ + + /** Create a TextView when the given object supports the + XAccessibleText interface. + */ + static public ObjectView Create ( + ObjectViewContainer aContainer, + XAccessibleContext xContext) + { + XAccessibleText xText = (XAccessibleText)UnoRuntime.queryInterface( + XAccessibleText.class, xContext); + if (xText != null) + return new TextView (aContainer); + else + return null; + } + + + public TextView (ObjectViewContainer aContainer) + { + super (aContainer); + + ViewGridLayout aLayout = new ViewGridLayout (this); + + maTextLabel = aLayout.AddLabeledString ("Text: "); + maCharacterArrayLabel = aLayout.AddLabeledEntry ("Characters: "); + maCharacterCountLabel = aLayout.AddLabeledEntry ("Character Count: "); + maSelectionLabel = aLayout.AddLabeledEntry ("Selection: "); + maBoundsLabel = aLayout.AddLabeledEntry ("Bounds Test: "); + maCaretPositionSpinner = (JSpinner)aLayout.AddLabeledComponent ( + "Caret position:", new JSpinner()); + Dimension aSize = maCaretPositionSpinner.getSize(); + maCaretPositionSpinner.setPreferredSize (new Dimension (100,20)); + maCaretLineNoLabel = aLayout.AddLabeledEntry ("Line number at caret: "); + maCaretLineTextLabel = aLayout.AddLabeledEntry ("Text of line at caret: "); + maLineNoFromCaretPosLabel = aLayout.AddLabeledEntry ("Line number at index of caret: "); + maLineTextFromCaretPosLabel = aLayout.AddLabeledEntry ("Text of line at index of caret: "); + + JPanel aButtonPanel = new JPanel (); + aLayout.AddComponent (aButtonPanel); + + JButton aButton = new JButton ("select..."); + aButton.setFont (aLayout.GetFont()); + aButton.addActionListener (this); + aButtonPanel.add (aButton); + + aButton = new JButton ("copy..."); + aButton.setFont (aLayout.GetFont()); + aButton.addActionListener (this); + aButtonPanel.add (aButton); + + // A tree that holds the text broken down into various segments. + maTree = new JTree (); + aLayout.AddComponent (new JScrollPane ( + maTree, + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED)); + } + + + /** Additionally to the context store a reference to the + XAccessibleText interface. + */ + public void SetObject (XAccessibleContext xObject) + { + mxText = (XAccessibleText)UnoRuntime.queryInterface( + XAccessibleText.class, xObject); + maCaretSpinnerModel = new CaretSpinnerModel(mxText); + maCaretPositionSpinner.setModel (maCaretSpinnerModel); + super.SetObject (xObject); + } + + synchronized public void Destroy () + { + mxText = null; + super.Destroy(); + } + + synchronized public void Update () + { + maCaretPositionSpinner.setEnabled (mxText != null); + DefaultMutableTreeNode aRoot = new DefaultMutableTreeNode ("Text Segments"); + if (mxText == null) + { + maTextLabel.setText ("<null object>"); + maCharacterArrayLabel.setText ("<null object>"); + maCharacterCountLabel.setText ("<null object>"); + maSelectionLabel.setText ("<null object>"); + maBoundsLabel.setText ("<null object>"); + maCaretLineNoLabel.setText ("<null object>"); + maCaretLineTextLabel.setText ("<null object>"); + maLineNoFromCaretPosLabel.setText ("<null object>"); + maLineTextFromCaretPosLabel.setText ("<null object>"); + } + else + { + maTextLabel.setText (mxText.getText()); + maCharacterArrayLabel.setText (GetCharacterArray()); + maCharacterCountLabel.setText ( + Integer.toString(mxText.getCharacterCount())); + // Selection. + maSelectionLabel.setText ( + "[" + mxText.getSelectionStart() + + "," + mxText.getSelectionEnd() + + "] \"" + mxText.getSelectedText() + "\""); + + // Character bounds. + maBoundsLabel.setText (GetTextBoundsString()); + + // Caret position. + maCaretPositionSpinner.setValue (new Integer (mxText.getCaretPosition())); + + // Multi line methods. + XAccessibleMultiLineText xMultiText = (XAccessibleMultiLineText) + UnoRuntime.queryInterface( XAccessibleMultiLineText.class, mxText ); + + if( null != xMultiText ) { + try { + maCaretLineNoLabel.setText ( Integer.toString( xMultiText.getNumberOfLineWithCaret() ) ); + TextSegment ts = xMultiText.getTextAtLineWithCaret(); + maCaretLineTextLabel.setText ( "[" + ts.SegmentStart + + "," + ts.SegmentEnd + + "] \"" + ts.SegmentText + "\""); + maLineNoFromCaretPosLabel.setText ( Integer.toString( xMultiText.getLineNumberAtIndex( mxText.getCaretPosition() ) ) ); + ts = xMultiText.getTextAtLineNumber(xMultiText.getLineNumberAtIndex( mxText.getCaretPosition() ) ); + maLineTextFromCaretPosLabel.setText ( "[" + ts.SegmentStart + + "," + ts.SegmentEnd + + "] \"" + ts.SegmentText + "\""); + } catch( IndexOutOfBoundsException e) { + } + } + + // Text segments. + aRoot.add (CreateNode ("Character", AccessibleTextType.CHARACTER)); + aRoot.add (CreateNode ("Word", AccessibleTextType.WORD)); + aRoot.add (CreateNode ("Sentence", AccessibleTextType.SENTENCE)); + aRoot.add (CreateNode ("Paragraph", AccessibleTextType.PARAGRAPH)); + aRoot.add (CreateNode ("Line", AccessibleTextType.LINE)); + aRoot.add (CreateNode ("Attribute", AccessibleTextType.ATTRIBUTE_RUN)); + aRoot.add (CreateNode ("Glyph", AccessibleTextType.GLYPH)); + } + ((DefaultTreeModel)maTree.getModel()).setRoot (aRoot); + } + + public String GetTitle () + { + return ("Text"); + } + + public void notifyEvent (AccessibleEventObject aEvent) + { + System.out.println (aEvent); + switch (aEvent.EventId) + { + case AccessibleEventId.CARET_CHANGED : + maCaretSpinnerModel.Update(); + Update (); + break; + + case AccessibleEventId.TEXT_CHANGED : + case AccessibleEventId.TEXT_SELECTION_CHANGED: + Update (); + break; + } + } + + public void actionPerformed (ActionEvent aEvent) + { + String sCommand = aEvent.getActionCommand(); + if (sCommand.equals ("select...")) + TextDialogFactory.CreateSelectionDialog (mxContext); + else if (sCommand.equals ("copy...")) + TextDialogFactory.CreateCopyDialog (mxContext); + } + + + + /** Create a string that is a list of all characters returned by the + getCharacter() method. + */ + private String GetCharacterArray () + { + // Do not show more than 30 characters. + int nCharacterCount = mxText.getCharacterCount(); + int nMaxDisplayCount = 30; + + // build up string + StringBuffer aCharacterArray = new StringBuffer(); + int nIndex = 0; + try + { + while (nIndex<nCharacterCount && nIndex<nMaxDisplayCount) + { + aCharacterArray.append (mxText.getCharacter (nIndex)); + if (nIndex < nCharacterCount-1) + aCharacterArray.append (","); + nIndex ++; + } + if (nMaxDisplayCount < nCharacterCount) + aCharacterArray.append (", ..."); + } + catch (IndexOutOfBoundsException e) + { + aCharacterArray.append ("; Index Out Of Bounds at index " + nIndex); + } + + return aCharacterArray.toString(); + } + + + + /** Iterate over all characters and translate their positions + back and forth. + */ + private String GetTextBoundsString () + { + StringBuffer aBuffer = new StringBuffer (); + try + { + // Iterate over all characters in the text. + int nCount = mxText.getCharacterCount(); + for (int i=0; i<nCount; i++) + { + // Get bounds for this character. + Rectangle aBBox = mxText.getCharacterBounds (i); + + // get the character by 'clicking' into the middle of + // the bounds + Point aMiddle = new Point(); + aMiddle.X = aBBox.X + (aBBox.Width / 2) - 1; + aMiddle.Y = aBBox.Y + (aBBox.Height / 2) - 1; + int nIndex = mxText.getIndexAtPoint (aMiddle); + + // get the character, or a '#' for an illegal index + if ((nIndex >= 0) && (nIndex < mxText.getCharacter(i))) + aBuffer.append (mxText.getCharacter(nIndex)); + else + aBuffer.append ('#'); + } + } + catch (IndexOutOfBoundsException aEvent) + { + // Ignore errors. + } + + return aBuffer.toString(); + } + + + + + private final static int BEFORE = -1; + private final static int AT = 0; + private final static int BEHIND = +1; + + private MutableTreeNode CreateNode (String sTitle, short nTextType) + { + DefaultMutableTreeNode aNode = new DefaultMutableTreeNode (sTitle); + + aNode.add (CreateSegmentNode ("Before", nTextType, BEFORE)); + aNode.add (CreateSegmentNode ("At", nTextType, AT)); + aNode.add (CreateSegmentNode ("Behind", nTextType, BEHIND)); + + return aNode; + } + + private MutableTreeNode CreateSegmentNode (String sTitle, short nTextType, int nWhere) + { + TextSegment aSegment; + int nTextLength = mxText.getCharacterCount(); + DefaultMutableTreeNode aNode = new DefaultMutableTreeNode (sTitle); + for (int nIndex=0; nIndex<=nTextLength; /* empty */) + { + aSegment = GetTextSegment (nIndex, nTextType, nWhere); + DefaultMutableTreeNode aSegmentNode = new DefaultMutableTreeNode ( + new StringBuffer ( + Integer.toString (nIndex) + " -> " + + Integer.toString (aSegment.SegmentStart) + " - " + + Integer.toString (aSegment.SegmentEnd) + " : " + + aSegment.SegmentText.toString())); + aNode.add (aSegmentNode); + if (nTextType == AccessibleTextType.ATTRIBUTE_RUN) + AddAttributeNodes (aSegmentNode, aSegment); + if (aSegment.SegmentEnd > nIndex) + nIndex = aSegment.SegmentEnd; + else + nIndex ++; + } + + return aNode; + } + + + private TextSegment GetTextSegment (int nIndex, short nTextType, int nWhere) + { + TextSegment aSegment; + + try + { + switch (nWhere) + { + case BEFORE: + aSegment = mxText.getTextBeforeIndex (nIndex, nTextType); + break; + + case AT: + aSegment = mxText.getTextAtIndex (nIndex, nTextType); + break; + + case BEHIND: + aSegment = mxText.getTextBehindIndex (nIndex, nTextType); + break; + + default: + aSegment = new TextSegment(); + aSegment.SegmentText = new String ("unknown position " + nWhere); + aSegment.SegmentStart = nIndex; + aSegment.SegmentStart = nIndex+1; + break; + } + } + catch (IndexOutOfBoundsException aException) + { + aSegment = new TextSegment (); + aSegment.SegmentText = new String ("Invalid index at ") + nIndex + " : " + + aException.toString(); + aSegment.SegmentStart = nIndex; + aSegment.SegmentEnd = nIndex+1; + } + catch (IllegalArgumentException aException) + { + aSegment = new TextSegment (); + aSegment.SegmentText = new String ("Illegal argument at ") + nIndex + " : " + + aException.toString(); + aSegment.SegmentStart = nIndex; + aSegment.SegmentEnd = nIndex+1; + } + + return aSegment; + } + + + /** Add to the given node one node for every attribute of the given segment. + */ + private void AddAttributeNodes ( + DefaultMutableTreeNode aNode, + TextSegment aSegment) + { + try + { + PropertyValue[] aValues = mxText.getCharacterAttributes ( + aSegment.SegmentStart, aAttributeList); + for (int i=0; i<aValues.length; i++) + aNode.add (new DefaultMutableTreeNode ( + aValues[i].Name + ": " + aValues[i].Value)); + } + catch (IndexOutOfBoundsException aException) + { + aNode.add (new DefaultMutableTreeNode ( + "caught IndexOutOfBoundsException while retrieveing attributes")); + } + } + + private XAccessibleText mxText; + private JLabel + maTextLabel, + maCharacterArrayLabel, + maCharacterCountLabel, + maSelectionLabel, + maBoundsLabel, + maCaretLineNoLabel, + maCaretLineTextLabel, + maLineNoFromCaretPosLabel, + maLineTextFromCaretPosLabel; + + private JSpinner maCaretPositionSpinner; + private JTree maTree; + private CaretSpinnerModel maCaretSpinnerModel; + + private static String[] aAttributeList = new String[] { + "CharBackColor", + "CharColor", + "CharEscapement", + "CharHeight", + "CharPosture", + "CharStrikeout", + "CharUnderline", + "CharWeight", + "ParaAdjust", + "ParaBottomMargin", + "ParaFirstLineIndent", + "ParaLeftMargin", + "ParaLineSpacing", + "ParaRightMargin", + "ParaTabStops"}; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java new file mode 100644 index 000000000000..e4f020a51455 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: ViewGridLayout.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:38 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.GridBagLayout; +import java.awt.GridBagConstraints; +import javax.swing.JComponent; +import javax.swing.JLabel; + + +/** This class is a convenience class for views to use the GridBagLayout. +*/ +class ViewGridLayout +{ + public ViewGridLayout (JComponent aComponent) + { + maComponent = aComponent; + maComponent.setLayout (new GridBagLayout()); + maComponent.setMinimumSize (new Dimension (300,30)); + maComponent.setMaximumSize (new Dimension (300,1000)); + mnCurrentLine = 0; + } + + public JLabel AddLabeledEntry (String sTitle) + { + return (JLabel)AddLabeledComponent (sTitle, new JLabel ("")); + } + + public JLabel AddLabeledString (String sTitle) + { + JLabel aLabel = AddLabeledEntry (sTitle); + aLabel.setBackground (new Color(220,220,220)); + aLabel.setOpaque (true); + return aLabel; + } + + public JComponent AddLabeledComponent (String sTitle, JComponent aComponent) + { + GridBagConstraints constraints = new GridBagConstraints (); + constraints.gridx = 0; + constraints.anchor = GridBagConstraints.WEST; + constraints.fill = GridBagConstraints.NONE; + constraints.gridy = mnCurrentLine; + + JLabel aLabel = new JLabel(sTitle); + aLabel.setFont (saFont); + maComponent.add (aLabel, constraints); + constraints.gridx = 1; + constraints.weightx = 1; + constraints.fill = GridBagConstraints.NONE; + aComponent.setFont (saFont); + maComponent.add (aComponent, constraints); + + mnCurrentLine += 1; + + return aComponent; + } + + public JComponent AddComponent (JComponent aComponent) + { + GridBagConstraints constraints = new GridBagConstraints (); + constraints.gridx = 0; + constraints.gridwidth = 2; + constraints.weightx = 1; + constraints.anchor = GridBagConstraints.WEST; + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridy = mnCurrentLine; + + maComponent.add (aComponent, constraints); + + mnCurrentLine += 1; + + return aComponent; + } + + static public Font GetFont () + { + return saFont; + } + + static private Font saFont; + private int mnCurrentLine; + private JComponent maComponent; + + static + { + saFont = new Font ("Dialog", Font.PLAIN, 11); + } +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common new file mode 100644 index 000000000000..d4929e3f1cd8 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common @@ -0,0 +1,76 @@ +#************************************************************************* +# +# $RCSfile: makefile.common,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar +JAVAFILES = \ + ComponentView.java \ + ContextView.java \ + EditableTextView.java \ + EventMonitorView.java \ + FocusView.java \ + LayoutManager.java \ + ObjectView.java \ + ObjectViewContainer.java \ + ObjectViewContainerWindow.java \ + ParentView.java \ + SelectionView.java \ + ServiceInterfaceView.java \ + StateSetView.java \ + TableView.java \ + TextView.java \ + ViewGridLayout.java diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk new file mode 100644 index 000000000000..c8ddd587635a --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJNAME = awb +PRJ = ..$/..$/..$/..$/..$/.. +TARGET = awb_view +PACKAGE = org$/openoffice$/accessibility$/awb$/view + +USE_JAVAVER:=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +.IF "$(JAVAVER:s/.//)" >= "140" + +.INCLUDE : makefile.common + +JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +.ENDIF + +# --- Targets ------------------------------------------------------ + + +.INCLUDE : target.mk + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java new file mode 100644 index 000000000000..6289697ee375 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java @@ -0,0 +1,156 @@ +/************************************************************************* + * + * $RCSfile: CaretSpinnerModel.java,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: obr $ $Date: 2008/05/14 13:21:37 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view.text; + +import java.lang.Integer; +import java.util.Vector; +import javax.swing.SpinnerModel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.lang.IndexOutOfBoundsException; + + +/** A simple model for JSpinner objects that clips the spinner values to valid + text indices. +*/ +public class CaretSpinnerModel + implements SpinnerModel +{ + public CaretSpinnerModel (XAccessibleText xText) + { + mxText = xText; + maListeners = new Vector (); + } + + public void addChangeListener (ChangeListener aListener) + { + if (aListener != null) + maListeners.add (aListener); + } + + public void removeChangeListener (ChangeListener aListener) + { + maListeners.removeElement (aListener); + } + + public Object getNextValue () + { + if (mxText != null) + { + int nPosition = mxText.getCaretPosition(); + if (nPosition+1 <= mxText.getCharacterCount()) + return new Integer (nPosition+1); + } + return null; + } + + public Object getPreviousValue () + { + if (mxText != null) + { + int nPosition = mxText.getCaretPosition(); + if (nPosition > 0) + return new Integer (nPosition-1); + } + return null; + } + + public Object getValue () + { + if (mxText != null) + return new Integer (mxText.getCaretPosition()); + else + return null; + } + + public void setValue (Object aValue) + { + if (mxText != null) + if (aValue instanceof Integer) + { + try + { + if( ((Integer)aValue).intValue() != mxText.getCaretPosition() ) + mxText.setCaretPosition (((Integer)aValue).intValue()); + } + catch (IndexOutOfBoundsException aException) + { + } + } + } + + /** Call this method when the caret position has changes so that the model + can inform its listeners about it. + */ + public void Update () + { + ChangeEvent aEvent = new ChangeEvent (this); + for (int i=0; i<maListeners.size(); i++) + ((ChangeListener)maListeners.elementAt(i)).stateChanged (aEvent); + } + + private XAccessibleText mxText; + private Integer maValue; + private Vector maListeners; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/view/text/Makefile new file mode 100644 index 000000000000..c58899a09f6e --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/Makefile @@ -0,0 +1,13 @@ +# $Id: Makefile,v 1.1 2003/06/13 16:30:41 af Exp $ + +all : package + +ROOT=../../../../.. +PACKAGE = org.openoffice.accessibility.awb.view.text +SUBDIRS = +include makefile.common + +include $(ROOT)/makefile.in + + +package : $(CLASS_FILES) diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java new file mode 100644 index 000000000000..420119515a41 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java @@ -0,0 +1,242 @@ +/************************************************************************* + * + * $RCSfile: TextActionDialog.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view.text; + +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.text.JTextComponent; + +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.accessibility.XAccessibleEditableText; +import com.sun.star.lang.IndexOutOfBoundsException; +import com.sun.star.uno.UnoRuntime; + + +/** + * Display a dialog with a text field and a pair of cancel/do-it buttons + */ +class TextActionDialog + extends JDialog + implements ActionListener +{ + public TextActionDialog ( + XAccessibleContext xContext, + String sExplanation, + String sTitle) + { + super();// AccessibilityWorkBench.Instance() ); + + mxContext = xContext; + msTitle = sTitle; + msExplanation = sExplanation; + Layout (); + setSize (350, 225); + + } + + + /** build dialog */ + protected void Layout() + { + setTitle (msTitle); + + // vertical stacking of the elements + Container aContent = getContentPane(); + // aContent.setLayout( new BorderLayout() ); + + // Label with explanation. + if (msExplanation.length() > 0) + aContent.add (new JLabel (msExplanation), BorderLayout.NORTH); + + // the text field + maText = new JTextArea(); + maText.setLineWrap (true); + maText.setEditable (false); + aContent.add (maText, BorderLayout.CENTER); + + XAccessibleText xText = (XAccessibleText)UnoRuntime.queryInterface( + XAccessibleText.class, mxContext); + String sText = xText.getText(); + maText.setText (sText); + maText.setRows (sText.length() / 40 + 1); + maText.setColumns (Math.min (Math.max (40, sText.length()), 20)); + + JPanel aButtons = new JPanel(); + aButtons.setLayout (new FlowLayout()); + maIndexToggle = new JCheckBox ("reverse selection"); + aButtons.add (maIndexToggle); + + JButton aActionButton = new JButton (msTitle); + aActionButton.setActionCommand ("Action"); + aActionButton.addActionListener (this); + aButtons.add (aActionButton); + + JButton aCancelButton = new JButton ("cancel"); + aCancelButton.setActionCommand ("Cancel"); + aCancelButton.addActionListener (this); + aButtons.add (aCancelButton); + + // add Panel with buttons + aContent.add (aButtons, BorderLayout.SOUTH); + } + + protected void Cancel() + { + hide(); + dispose(); + } + + public void actionPerformed(ActionEvent e) + { + String sCommand = e.getActionCommand(); + + if( "Cancel".equals( sCommand ) ) + Cancel(); + else if( "Action".equals( sCommand ) ) + Action(); + } + + + protected int GetSelectionStart() + { + return GetSelection(true); + } + protected int GetSelectionEnd() + { + return GetSelection(false); + } + private int GetSelection (boolean bStart) + { + if (bStart ^ maIndexToggle.isSelected()) + return maText.getSelectionStart(); + else + return maText.getSelectionEnd(); + } + + + + protected void Action () + { + String sError = null; + boolean bSuccess = true; + try + { + XAccessibleText xText = + (XAccessibleText)UnoRuntime.queryInterface( + XAccessibleText.class, mxContext); + if (xText != null) + bSuccess = bSuccess && TextAction (xText); + + XAccessibleEditableText xEditableText = + (XAccessibleEditableText)UnoRuntime.queryInterface( + XAccessibleEditableText.class, mxContext); + if (xEditableText != null) + bSuccess = bSuccess && EditableTextAction (xEditableText); + + if ( ! bSuccess) + sError = "Can't execute"; + } + catch (IndexOutOfBoundsException e) + { + sError = "Index out of bounds"; + } + + if (sError != null) + JOptionPane.showMessageDialog ( + this,// AccessibilityWorkBench.Instance(), + sError, + msTitle, + JOptionPane.ERROR_MESSAGE); + + Cancel(); + } + + /** override this for dialog-specific action */ + boolean TextAction (XAccessibleText xText) + throws IndexOutOfBoundsException + { + return true; + } + + boolean EditableTextAction (XAccessibleEditableText xText) + throws IndexOutOfBoundsException + { + return true; + } + + private XAccessibleContext mxContext; + protected JTextArea maText; + private String msTitle; + private String msExplanation; + private JCheckBox maIndexToggle; +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java new file mode 100644 index 000000000000..36d81162462c --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java @@ -0,0 +1,213 @@ +/************************************************************************* + * + * $RCSfile: TextAttributeDialog.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view.text; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import javax.swing.BoxLayout; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JColorChooser; +import javax.swing.JPanel; +import javax.swing.text.JTextComponent; + +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleEditableText; +import com.sun.star.beans.PropertyValue; +import com.sun.star.lang.IndexOutOfBoundsException; +import com.sun.star.uno.UnoRuntime; + + +class TextAttributeDialog + extends TextActionDialog +{ + public TextAttributeDialog (XAccessibleContext xContext) + { + super (xContext, + "Choose attributes, select text, and press 'Set':", + "set"); + } + + protected void Layout () + { + super.Layout (); + + maForeground = Color.black; + maBackground = Color.white; + + JPanel aPanel = new JPanel(); + aPanel.setLayout (new BoxLayout (aPanel, BoxLayout.Y_AXIS)); + + maBoldCheckBox = new JCheckBox ("bold"); + maUnderlineCheckBox = new JCheckBox ("underline"); + maItalicsCheckBox = new JCheckBox ("italics"); + + JButton aForegroundButton = new JButton ("Foreground", + new TextAttributeDialog.ColorIcon(true)); + aForegroundButton.addActionListener (new ActionListener() + { + public void actionPerformed (ActionEvent aEvent) + { + maForeground = JColorChooser.showDialog ( + TextAttributeDialog.this, + "Select Foreground Color", + maForeground); + } + } ); + + JButton aBackgroundButton = new JButton("Background", + new TextAttributeDialog.ColorIcon(false)); + aBackgroundButton.addActionListener (new ActionListener() + { + public void actionPerformed (ActionEvent eEvent) + { + maBackground = JColorChooser.showDialog( + TextAttributeDialog.this, + "Select Background Color", + maBackground); + } + } ); + + aPanel.add (maBoldCheckBox); + aPanel.add (maUnderlineCheckBox); + aPanel.add (maItalicsCheckBox); + aPanel.add (aForegroundButton); + aPanel.add (aBackgroundButton); + + getContentPane().add (aPanel, BorderLayout.WEST); + } + + + /** edit the text */ + boolean EditableTextAction (XAccessibleEditableText xText) + throws IndexOutOfBoundsException + { + PropertyValue[] aSequence = new PropertyValue[6]; + aSequence[0] = new PropertyValue(); + aSequence[0].Name = "CharWeight"; + aSequence[0].Value = new Integer (maBoldCheckBox.isSelected() ? 150 : 100); + aSequence[1] = new PropertyValue(); + aSequence[1].Name = "CharUnderline"; + aSequence[1].Value = new Integer (maUnderlineCheckBox.isSelected() ? 1 : 0); + aSequence[2] = new PropertyValue(); + aSequence[2].Name = "CharBackColor"; + aSequence[2].Value = new Integer (maBackground.getRGB()); + aSequence[3] = new PropertyValue(); + aSequence[3].Name = "CharColor"; + aSequence[3].Value = new Integer (maForeground.getRGB()); + aSequence[4] = new PropertyValue(); + aSequence[4].Name = "CharPosture"; + aSequence[4].Value = new Integer (maItalicsCheckBox.isSelected() ? 1 : 0); + aSequence[5] = new PropertyValue(); + aSequence[5].Name = "CharBackTransparent"; + aSequence[5].Value = new Boolean (false); + + return xText.setAttributes ( + GetSelectionStart(), + GetSelectionEnd(), + aSequence); + } + + class ColorIcon + implements Icon + { + public ColorIcon(boolean bWhich) { bForeground = bWhich; } + public int getIconHeight() { return nHeight; } + public int getIconWidth() { return nWidth; } + public void paintIcon (Component c, Graphics g, int x, int y) + { + g.setColor( getColor() ); + g.fillRect( x, y, nHeight, nWidth ); + g.setColor( c.getForeground() ); + g.drawRect( x, y, nHeight, nWidth ); + } + Color getColor() + { + if (bForeground) + return maForeground; + else + return maBackground; + } + + private static final int nHeight = 16; + private static final int nWidth = 16; + private boolean bForeground; + } + + + + + private JCheckBox + maBoldCheckBox, + maUnderlineCheckBox, + maItalicsCheckBox; + private Color + maForeground, + maBackground; + +} + diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java new file mode 100644 index 000000000000..397c3f8b1877 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java @@ -0,0 +1,170 @@ +/************************************************************************* + * + * $RCSfile: TextDialogFactory.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view.text; + +import javax.swing.JDialog; +import javax.swing.text.JTextComponent; + +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleEditableText; +import com.sun.star.accessibility.XAccessibleText; +import com.sun.star.lang.IndexOutOfBoundsException; +import com.sun.star.uno.UnoRuntime; + + +/** Factory for dialogs of the text views. +*/ +public class TextDialogFactory +{ + static public JDialog CreateSelectionDialog (XAccessibleContext xContext) + { + JDialog aDialog = new TextActionDialog( + xContext, + "Select range:", + "select") + { + boolean TextAction (XAccessibleText xText) + throws IndexOutOfBoundsException + { + return xText.setSelection( + GetSelectionStart(), + GetSelectionEnd() ); + } + }; + if (aDialog != null) + aDialog.show(); + return aDialog; + } + + static public JDialog CreateCopyDialog (XAccessibleContext xContext) + { + JDialog aDialog = new TextActionDialog( + xContext, + "Select range and copy:", + "copy") + { + boolean TextAction (XAccessibleText xText) + throws IndexOutOfBoundsException + { + return xText.copyText( + GetSelectionStart(), + GetSelectionEnd()); + } + }; + if (aDialog != null) + aDialog.show(); + return aDialog; + } + static public JDialog CreateCutDialog (XAccessibleContext xContext) + { + JDialog aDialog = new TextActionDialog( + xContext, + "Select range and cut:", + "cut") + { + boolean EditableTextAction (XAccessibleEditableText xText) + throws IndexOutOfBoundsException + { + return xText.cutText( + GetSelectionStart(), + GetSelectionEnd() ); + } + }; + if (aDialog != null) + aDialog.show(); + return aDialog; + } + static public JDialog CreatePasteDialog (XAccessibleContext xContext) + { + JDialog aDialog = new TextActionDialog ( + xContext, + "Place Caret and paste:", + "paste") + { + boolean EditableTextAction (XAccessibleEditableText xText) + throws IndexOutOfBoundsException + { + return xText.pasteText(maText.getCaretPosition()); + } + }; + if (aDialog != null) + aDialog.show(); + return aDialog; + } + static public JDialog CreateEditDialog (XAccessibleContext xContext) + { + JDialog aDialog = new TextEditDialog ( + xContext, + "Edit text:", + "edit"); + if (aDialog != null) + aDialog.show(); + return aDialog; + } + static public JDialog CreateFormatDialog (XAccessibleContext xContext) + { + JDialog aDialog = new TextAttributeDialog (xContext); + if (aDialog != null) + aDialog.show(); + return aDialog; + } +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java new file mode 100644 index 000000000000..55dfea6fb0b2 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java @@ -0,0 +1,156 @@ +/************************************************************************* + * + * $RCSfile: TextEditDialog.java,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: af $ $Date: 2003/06/13 16:30:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.awb.view.text; + +import javax.swing.text.JTextComponent; + +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleEditableText; +import com.sun.star.lang.IndexOutOfBoundsException; +import com.sun.star.uno.UnoRuntime; + + +class TextEditDialog + extends TextActionDialog +{ + public TextEditDialog ( + XAccessibleContext xContext, + String sExplanation, + String sTitle ) + { + super (xContext, sExplanation, sTitle); + } + + protected void Layout() + { + super.Layout(); + maText.setEditable (true); + } + + + /** edit the text */ + boolean EditableTextAction (XAccessibleEditableText xText) + { + return UpdateText (xText, maText.getText()); + } + + + /** update the text */ + boolean UpdateText (XAccessibleEditableText xText, String sNew) + { + boolean bResult = false; + + String sOld = xText.getText(); + + // false alarm? Early out if no change was done! + if ( ! sOld.equals (sNew)) + { + + // Get the minimum length of both strings. + int nMinLength = sOld.length(); + if (sNew.length() < nMinLength) + nMinLength = sNew.length(); + + // Count equal characters from front and end. + int nFront = 0; + while ((nFront < nMinLength) && + (sNew.charAt(nFront) == sOld.charAt(nFront))) + nFront++; + int nBack = 0; + while ((nBack < nMinLength) && + (sNew.charAt(sNew.length()-nBack-1) == + sOld.charAt(sOld.length()-nBack-1) )) + nBack++; + if (nFront + nBack > nMinLength) + nBack = nMinLength - nFront; + + // so... the first nFront and the last nBack characters are the + // same. Change the others! + String sDel = sOld.substring (nFront, sOld.length() - nBack); + String sIns = sNew.substring (nFront, sNew.length() - nBack); + + System.out.println ("edit text: " + + sOld.substring(0, nFront) + + " [ " + sDel + " -> " + sIns + " ] " + + sOld.substring(sOld.length() - nBack)); + + try + { + // edit the text, and use + // (set|insert|delete|replace)Text as needed + if( nFront+nBack == 0 ) + bResult = xText.setText( sIns ); + else if( sDel.length() == 0 ) + bResult = xText.insertText( sIns, nFront ); + else if( sIns.length() == 0 ) + bResult = xText.deleteText( nFront, sOld.length()-nBack ); + else + bResult = xText.replaceText(nFront, sOld.length()-nBack,sIns); + } + catch( IndexOutOfBoundsException aException) + { + } + } + + return bResult; + } +} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common new file mode 100644 index 000000000000..32655a0c6a6f --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common @@ -0,0 +1,65 @@ +#************************************************************************* +# +# $RCSfile: makefile.common,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar +JAVAFILES = \ + CaretSpinnerModel.java \ + TextActionDialog.java \ + TextEditDialog.java \ + TextAttributeDialog.java \ + TextDialogFactory.java diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk new file mode 100644 index 000000000000..05f5b3a99c35 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJNAME = awb +PRJ = ..$/..$/..$/..$/..$/..$/.. +TARGET = awb_view_text +PACKAGE = org$/openoffice$/accessibility$/awb$/view$/text + +USE_JAVAVER:=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +.IF "$(JAVAVER:s/.//)" >= "140" + +.INCLUDE : makefile.common + +JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +.ENDIF + +# --- Targets ------------------------------------------------------ + + +.INCLUDE : target.mk + diff --git a/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java b/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java new file mode 100644 index 000000000000..f9212e05a35c --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java @@ -0,0 +1,122 @@ +/************************************************************************* + * + * $RCSfile: AccessibleEventMulticaster.java,v $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +package org.openoffice.accessibility.misc; + +import com.sun.star.lang.EventObject; + +import com.sun.star.accessibility.AccessibleEventObject; +import com.sun.star.accessibility.XAccessibleEventBroadcaster; +import com.sun.star.accessibility.XAccessibleEventListener; + +/** + * + */ +public class AccessibleEventMulticaster implements XAccessibleEventListener { + + private final XAccessibleEventListener a; + private final XAccessibleEventListener b; + + /** Creates a new instance of AccessibleEventMulticaster */ + protected AccessibleEventMulticaster(XAccessibleEventListener a, + XAccessibleEventListener b) { + this.a = a; + this.b = b; + } + + protected XAccessibleEventListener remove(XAccessibleEventListener l) { + if (l == a) + return b; + if (l == b) + return a; + XAccessibleEventListener a2 = remove(a, l); + XAccessibleEventListener b2 = remove(b, l); + if (a2 == a && b2 == b) { + return this; // not found + } + return add(a2, b2); + } + + public void notifyEvent(AccessibleEventObject accessibleEventObject) { + a.notifyEvent(accessibleEventObject); + b.notifyEvent(accessibleEventObject); + } + + public void disposing(EventObject eventObject) { + a.disposing(eventObject); + b.disposing(eventObject); + } + + public static XAccessibleEventListener add(XAccessibleEventListener a, XAccessibleEventListener b) { + if (a == null) + return b; + if (b == null) + return a; + return new AccessibleEventMulticaster(a,b); + } + + public static XAccessibleEventListener remove(XAccessibleEventListener l, XAccessibleEventListener oldl) { + if (l == oldl || l == null) { + return null; + } else if (l instanceof AccessibleEventMulticaster) { + return ((AccessibleEventMulticaster) l).remove(oldl); + } else { + return l; + } + } + +} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/Connector.java b/accessibility/workben/org/openoffice/accessibility/misc/Connector.java new file mode 100644 index 000000000000..de188676e224 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/Connector.java @@ -0,0 +1,50 @@ +package org.openoffice.accessibility.misc; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Timer; +import java.util.TimerTask; +import java.util.Vector; + + +/** Wait for an Office application and connect to it. +*/ +public class Connector + extends TimerTask +{ + final public static long snDelay = 3000; + + public Connector () + { + maTimer = new Timer (true); + maListeners = new Vector(); + run (); + } + + public void AddConnectionListener (ActionListener aListener) + { + SimpleOffice aOffice = SimpleOffice.Instance(); + if (aOffice!=null && aOffice.IsConnected()) + aListener.actionPerformed ( + new ActionEvent (aOffice,0,"<connected>")); + maListeners.add (aListener); + } + + public void run () + { + SimpleOffice aOffice = SimpleOffice.Instance(); + if (aOffice!=null && !aOffice.IsConnected()) + if ( ! aOffice.Connect()) + maTimer.schedule (this, snDelay); + else + { + ActionEvent aEvent = new ActionEvent (aOffice,0,"<connected>"); + for (int i=0; i<maListeners.size(); i++) + ((ActionListener)maListeners.elementAt(i)).actionPerformed( + aEvent); + } + } + + Timer maTimer; + Vector maListeners; +} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/InformationWriter.java b/accessibility/workben/org/openoffice/accessibility/misc/InformationWriter.java new file mode 100644 index 000000000000..fbd1455cd295 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/InformationWriter.java @@ -0,0 +1,421 @@ +package org.openoffice.accessibility.misc; + +import java.lang.Thread; +import java.io.PrintStream; + +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XWindow; + +import com.sun.star.beans.Property; +import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertySetInfo; + +import com.sun.star.container.XIndexAccess; +import com.sun.star.container.XChild; +import com.sun.star.container.XEnumerationAccess; +import com.sun.star.container.XEnumeration; + +import com.sun.star.frame.XComponentLoader; +import com.sun.star.frame.XController; +import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XFrame; +import com.sun.star.frame.XTasksSupplier; +import com.sun.star.frame.XTask; + +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XServiceName; +import com.sun.star.lang.XTypeProvider; + +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.uno.Type; + +import com.sun.star.drawing.XDrawView; +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XShapes; +import com.sun.star.drawing.XShape; +import com.sun.star.drawing.XShapeDescriptor; + +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleRelationSet; +import com.sun.star.accessibility.XAccessibleStateSet; + +public class InformationWriter +{ + public InformationWriter (PrintStream aOut) + { + maOut = aOut; + } + + public void drawPageTest (XInterface xPage) + { + try + { + printProperty (xPage, "BorderBottom ", "BorderBottom"); + printProperty (xPage, "BorderLeft ", "BorderLeft"); + printProperty (xPage, "BorderRight ", "BorderRight"); + printProperty (xPage, "BorderTop ", "BorderTop"); + printProperty (xPage, "Height ", "Height"); + printProperty (xPage, "Width ", "Width"); + printProperty (xPage, "Number ", "Number"); + } + catch (Exception e) + { + System.out.println ("caught exception while testing draw page:" + e); + } + } + + public void printProperty (XInterface xObject, String prefix, String name) + { + try + { + XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet.class, xObject); + maOut.println (prefix + + xPropertySet.getPropertyValue (name)); + } + catch (Exception e) + { + maOut.println ("caught exception while getting property " + + name + " : " + e); + } + } + + + + public void showShapes (XDrawPage xPage) + { + try + { + XIndexAccess xShapeList = (XIndexAccess) UnoRuntime.queryInterface( + XIndexAccess.class, xPage); + + maOut.println ("There are " + xShapeList.getCount() + + " shapes"); + for (int i=0; i<xShapeList.getCount(); i++) + { + XShape xShape = (XShape) UnoRuntime.queryInterface( + XShape.class, xShapeList.getByIndex (i)); + + XShapeDescriptor xShapeDescriptor = + (XShapeDescriptor) UnoRuntime.queryInterface( + XShapeDescriptor.class, xShape); + String sName = xShapeDescriptor.getShapeType (); + maOut.println (" shape " + i + " : " + sName); + + XPropertySet xPropertySet = + (XPropertySet) UnoRuntime.queryInterface( + XPropertySet.class, xShape); + Integer nZOrder = + (Integer) xPropertySet.getPropertyValue ("ZOrder"); + maOut.println (" zorder = " + nZOrder); + } + } + catch (Exception e) + { + maOut.println ("caught exception in showShapes: " + e); + } + } + + + + + /** @descr Print all available services of the given object to the + standard output. + */ + public void showServices (XInterface xObject) + { + try + { + maOut.println ("Services:"); + XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface ( + XMultiServiceFactory.class, + xObject + ); + if (xMSF == null) + maOut.println (" object does not support interface XMultiServiceFactory"); + else + { + String[] sServiceNames = xMSF.getAvailableServiceNames (); + maOut.println (" object can create " + + sServiceNames.length + " services"); + for (int i=0; i<sServiceNames.length; i++) + maOut.println (" service " + i + " : " + sServiceNames[i]); + } + } + catch (Exception e) + { + maOut.println ("caught exception in showServices : " + e); + } + } + + /** @descr Print the service and implementation name of the given + object. + */ + public void showInfo (XInterface xObject) + { + try + { + System.out.println ("Info:"); + // Use interface XServiceName to retrieve name of (main) service. + XServiceName xSN = (XServiceName) UnoRuntime.queryInterface ( + XServiceName.class, xObject); + if (xSN == null) + maOut.println (" interface XServiceName not supported"); + else + { + maOut.println (" Service name : " + xSN.getServiceName ()); + } + + // Use interface XServiceInfo to retrieve information about + // supported services. + XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface ( + XServiceInfo.class, xObject); + if (xSI == null) + maOut.println (" interface XServiceInfo not supported"); + else + { + maOut.println (" Implementation name : " + + xSI.getImplementationName ()); + } + } + catch (Exception e) + { + maOut.println ("caught exception in showInfo : " + e); + } + } + + + + + /** @descr Print information about supported interfaces. + */ + public void showInterfaces (XInterface xObject) + { + try + { + maOut.println ("Interfaces:"); + // Use interface XTypeProvider to retrieve a list of supported + // interfaces. + XTypeProvider xTP = (XTypeProvider) UnoRuntime.queryInterface ( + XTypeProvider.class, xObject); + if (xTP == null) + maOut.println (" interface XTypeProvider not supported"); + else + { + Type[] aTypeList = xTP.getTypes (); + maOut.println (" object supports " + aTypeList.length + + " interfaces"); + for (int i=0; i<aTypeList.length; i++) + maOut.println (" " + i + " : " + + aTypeList[i].getTypeName()); + } + } + catch (Exception e) + { + maOut.println ("caught exception in showInterfaces : " + e); + } + } + + + /** @descr Print information concerning the accessibility of the given + object. + */ + public boolean showAccessibility (XInterface xObject, int depth) + { + try + { + // Create indentation string. + String sIndent = ""; + while (depth-- > 0) + sIndent += " "; + + // Get XAccessibleContext object if given object does not + // already support this interface. + XAccessibleContext xContext + = (XAccessibleContext) UnoRuntime.queryInterface ( + XAccessibleContext.class, xObject); + if (xContext == null) + { + XAccessible xAccessible + = (XAccessible) UnoRuntime.queryInterface ( + XAccessible.class, xObject); + if (xAccessible == null) + { + maOut.println (sIndent + "given object " + xObject + + " is not accessible"); + return false; + } + else + xContext = xAccessible.getAccessibleContext(); + } + + // Print information about the accessible context. + if (xContext != null) + { + maOut.println (sIndent + "Name : " + + xContext.getAccessibleName()); + maOut.println (sIndent + "Description : " + + xContext.getAccessibleDescription()); + maOut.println (sIndent + "Role : " + + xContext.getAccessibleRole()); + String sHasParent; + if (xContext.getAccessibleParent() != null) + { + maOut.println (sIndent + "Has parent : yes"); + maOut.println (sIndent + "Parent index : " + + xContext.getAccessibleIndexInParent()); + } + else + maOut.println (sIndent + "Has parent : no"); + maOut.println (sIndent + "Child count : " + + xContext.getAccessibleChildCount()); + maOut.print (sIndent + "Relation set : "); + XAccessibleRelationSet xRelationSet + = xContext.getAccessibleRelationSet(); + if (xRelationSet != null) + { + maOut.print (xRelationSet.getRelationCount() + " ("); + for (int i=0; i<xRelationSet.getRelationCount(); i++) + { + if (i > 0) + maOut.print (", "); + maOut.print (xRelationSet.getRelation(i).toString()); + } + maOut.println (")"); + } + else + maOut.println ("no relation set"); + + maOut.print (sIndent + "State set : "); + XAccessibleStateSet xStateSet = + xContext.getAccessibleStateSet(); + if (xStateSet != null) + { + XIndexAccess xStates = + (XIndexAccess) UnoRuntime.queryInterface ( + XIndexAccess.class, xStateSet); + maOut.print (xStates.getCount() + " ("); + for (int i=0; i<xStates.getCount(); i++) + { + if (i > 0) + maOut.print (", "); + maOut.print (xStates.getByIndex(i).toString()); + } + maOut.println (")"); + } + else + maOut.println ("no state set"); + + showAccessibleComponent (xContext, sIndent); + } + else + maOut.println ("object has no accessible context."); + + // showInfo (xContext); + // showServices (xContext); + // showInterfaces (xContext); + } + catch (Exception e) + { + System.out.println ("caught exception in showAccessibility :" + e); + } + return true; + } + + + + + /** @descr Print information about the given accessible component. + */ + public void showAccessibleComponent (XInterface xObject, String sIndent) + { + try + { + XAccessibleComponent xComponent = + (XAccessibleComponent) UnoRuntime.queryInterface ( + XAccessibleComponent.class, xObject); + + // Print information about the accessible context. + if (xComponent != null) + { + maOut.println (sIndent + "Position : " + + xComponent.getLocation().X+", " + + xComponent.getLocation().Y); + maOut.println (sIndent + "Screen position : " + + xComponent.getLocationOnScreen().X+", " + + xComponent.getLocationOnScreen().Y); + maOut.println (sIndent + "Size : " + + xComponent.getSize().Width+", " + + xComponent.getSize().Height); + } + } + catch (Exception e) + { + System.out.println ( + "caught exception in showAccessibleComponent : " + e); + } + } + + + /** Show a textual representation of the accessibility subtree rooted in + xRoot. + */ + public boolean showAccessibilityTree (XAccessible xRoot, int depth) + { + try + { + if ( ! showAccessibility (xRoot, depth)) + return false; + + String sIndent = ""; + for (int i=0; i<depth; i++) + sIndent += " "; + + // Iterate over children and show them. + XAccessibleContext xContext = xRoot.getAccessibleContext(); + if (xContext != null) + { + int n = xContext.getAccessibleChildCount(); + for (int i=0; i<n; i++) + { + maOut.println (sIndent + "child " + i + " :"); + showAccessibilityTree (xContext.getAccessibleChild(i),depth+1); + } + } + else + maOut.println ("Accessible object has no context"); + } + catch (Exception e) + { + System.out.println ( + "caught exception in showAccessibleTree : " + e); + return false; + } + + return true; + } + + public void showProperties (XInterface xObject) + { + XPropertySet xSet = (XPropertySet) UnoRuntime.queryInterface ( + XPropertySet.class, xObject); + if (xSet == null) + maOut.println ("object does not support XPropertySet"); + else + { + XPropertySetInfo xInfo = xSet.getPropertySetInfo (); + Property[] aProperties = xInfo.getProperties (); + int n = aProperties.length; + for (int i=0; i<n; i++) + maOut.println (i + " : " + aProperties[i].Name +", " + aProperties[i].Type); + } + } + + private PrintStream maOut; +} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/Makefile b/accessibility/workben/org/openoffice/accessibility/misc/Makefile new file mode 100644 index 000000000000..a33a430c0eaa --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/Makefile @@ -0,0 +1,69 @@ +#************************************************************************* +# +# $RCSfile: Makefile,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +all : package + +ROOT=../../../.. +PACKAGE = org.openoffice.accessibility.misc +SUBDIRS = + +include makefile.common + +include $(ROOT)/makefile.in + +package: subdirs $(CLASS_FILES) diff --git a/accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java b/accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java new file mode 100644 index 000000000000..d990a517dfc1 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java @@ -0,0 +1,125 @@ +package org.openoffice.accessibility.misc; + +import java.awt.Font; +import java.awt.Rectangle; +import java.awt.Color; +import java.awt.Graphics; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JScrollBar; + + + +/** A message area displays text in a scrollable text widget. It is a + singleton. Other objects can access it directly to display messages. +*/ +public class MessageArea + extends JScrollPane +{ + public static synchronized MessageArea Instance () + { + if (saInstance == null) + saInstance = new MessageArea (); + return saInstance; + } + + + + + /** Create a new message area. This method is private because the class is + a singleton and may therefore not be instanciated from the outside. + */ + private MessageArea () + { + maText = new JTextArea(); + maText.setBackground (new Color (255,250,240)); + maText.setFont (new Font ("Helvetica", Font.PLAIN, 9)); + setViewportView (maText); + setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + setHorizontalScrollBarPolicy (JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + + printMessage ( + "class path is " + System.getProperty ("java.class.path") + "\n"); + } + + + + + /** Show the given string at the end of the message area and scroll to make + it visible. + */ + public static synchronized void print (String aMessage) + { + print (0, aMessage); + } + + + + + /** Show the given string at the end of the message area and scroll to make + it visible. Indent the string as requested. + */ + public static synchronized void print (int nIndentation, String aMessage) + { + while (nIndentation-- > 0) + aMessage = " " + aMessage; + Instance().printMessage(aMessage); + } + + + + + /** Show the given string at the end of the message area and scroll to make + it visible. + */ + public static void println (String aMessage) + { + println (0, aMessage); + } + + + + + /** Show the given string at the end of the message area and scroll to make + it visible. + */ + public static void println (int nIndentation, String aMessage) + { + print (nIndentation, aMessage+"\n"); + } + + + + + public void paintComponent (Graphics g) + { + synchronized (g) + { + JScrollBar sb = getVerticalScrollBar(); + if (sb != null) + { + int nScrollBarValue = sb.getMaximum() - sb.getVisibleAmount() - 1; + sb.setValue (nScrollBarValue); + } + super.paintComponent (g); + } + } + + + + + /** Append the given string to the end of the text and scroll so that it + becomes visible. This is an internal method. Use one of the static + and public ones. + */ + private synchronized void printMessage (String aMessage) + { + maText.append (aMessage); + } + + + + + private static MessageArea saInstance = null; + private JTextArea maText; +} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java b/accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java new file mode 100644 index 000000000000..736bc2c7f17b --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java @@ -0,0 +1,263 @@ +package org.openoffice.accessibility.misc; + +import java.util.HashMap; +import com.sun.star.accessibility.AccessibleStateType; +import com.sun.star.accessibility.AccessibleEventId; +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.AccessibleRelationType; + + +/** Provide names for several accessibility constants groups. +*/ +public class NameProvider +{ + /** Return the name of the specified state. + @param nStateId + Id of the state for which to return its name. This is one of + the ids listed in the <type>AccessibleStateType</const> + constants group. + @return + Returns the name of the specified state. When an invalid or + unknown state id is given then a special string is returned that + says that the state does not exist. + */ + public static String getStateName (int nStateId) + { + String sStateName = (String)maStateMap.get (new Integer(nStateId)); + if (sStateName == null) + sStateName = new String ("<unknown state " + nStateId + ">"); + return sStateName; + } + + + /** Return the name of the specified event. + @param nEventId + Id of the event type for which to return its name. This is one + of the ids listed in the <type>AccessibleEventId</const> + constants group. + @return + Returns the name of the specified event type or an empty string + if an invalid / unknown event id was given. + */ + public static String getEventName (int nEventId) + { + return (String)maEventMap.get (new Integer(nEventId)); + } + + + /** Return the name of the specified role. + @param nRole + Id of the role for which to return its name. This is one of + the ids listed in the <type>AccessibleRole</const> + constants group. + @return + Returns the name of the specified role or an empty string if an + invalid / unknown role id was given. + */ + public static String getRoleName (int nRole) + { + return (String)maRoleMap.get (new Integer(nRole)); + } + + + /** Return the name of the specified relation. + @param nRelation + Id of the relation for which to return its name. This is one of + the ids listed in the <type>AccessibleRelationType</const> + constants group. + @return + Returns the name of the specified relation type or an empty + string if an invalid / unknown role id was given. + */ + public static String getRelationName (int nRelation) + { + return (String)maRelationMap.get (new Integer(nRelation)); + } + + + private static HashMap maStateMap = new HashMap(); + private static HashMap maEventMap = new HashMap(); + private static HashMap maRoleMap = new HashMap(); + private static HashMap maRelationMap = new HashMap(); + + static { + maStateMap.put (new Integer (AccessibleStateType.INVALID), "INVALID"); + maStateMap.put (new Integer (AccessibleStateType.ACTIVE), "ACTIVE"); + maStateMap.put (new Integer (AccessibleStateType.ARMED), "ARMED"); + maStateMap.put (new Integer (AccessibleStateType.BUSY), "BUSY"); + maStateMap.put (new Integer (AccessibleStateType.CHECKED), "CHECKED"); + // maStateMap.put (new Integer (AccessibleStateType.COLLAPSED), "COLLAPSED"); + maStateMap.put (new Integer (AccessibleStateType.DEFUNC), "DEFUNC"); + maStateMap.put (new Integer (AccessibleStateType.EDITABLE), "EDITABLE"); + maStateMap.put (new Integer (AccessibleStateType.ENABLED), "ENABLED"); + maStateMap.put (new Integer (AccessibleStateType.EXPANDABLE), "EXPANDABLE"); + maStateMap.put (new Integer (AccessibleStateType.EXPANDED), "EXPANDED"); + maStateMap.put (new Integer (AccessibleStateType.FOCUSABLE), "FOCUSABLE"); + maStateMap.put (new Integer (AccessibleStateType.FOCUSED), "FOCUSED"); + maStateMap.put (new Integer (AccessibleStateType.HORIZONTAL), "HORIZONTAL"); + maStateMap.put (new Integer (AccessibleStateType.ICONIFIED), "ICONIFIED"); + maStateMap.put (new Integer (AccessibleStateType.MODAL), "MODAL"); + maStateMap.put (new Integer (AccessibleStateType.MULTI_LINE), "MULTI_LINE"); + maStateMap.put (new Integer (AccessibleStateType.MULTI_SELECTABLE), "MULTI_SELECTABLE"); + maStateMap.put (new Integer (AccessibleStateType.OPAQUE), "OPAQUE"); + maStateMap.put (new Integer (AccessibleStateType.PRESSED), "PRESSED"); + maStateMap.put (new Integer (AccessibleStateType.RESIZABLE), "RESIZABLE"); + maStateMap.put (new Integer (AccessibleStateType.SELECTABLE), "SELECTABLE"); + maStateMap.put (new Integer (AccessibleStateType.SELECTED), "SELECTED"); + maStateMap.put (new Integer (AccessibleStateType.SENSITIVE), "SENSITIVE"); + maStateMap.put (new Integer (AccessibleStateType.SHOWING), "SHOWING"); + maStateMap.put (new Integer (AccessibleStateType.SINGLE_LINE), "SINGLE_LINE"); + maStateMap.put (new Integer (AccessibleStateType.STALE), "STALE"); + maStateMap.put (new Integer (AccessibleStateType.TRANSIENT), "TRANSIENT"); + maStateMap.put (new Integer (AccessibleStateType.VERTICAL), "VERTICAL"); + maStateMap.put (new Integer (AccessibleStateType.VISIBLE), "VISIBLE"); + maStateMap.put (new Integer (AccessibleStateType.MANAGES_DESCENDANTS), + "MANAGES_DESCENDANTS"); + //maStateMap.put (new Integer (AccessibleStateType.INCONSISTENT),"INCONSISTENT"); + + + maEventMap.put (new Integer (0), + "[UNKNOWN]"); + maEventMap.put (new Integer (AccessibleEventId.NAME_CHANGED), + "NAME_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.DESCRIPTION_CHANGED), + "DESCRIPTION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.ACTION_CHANGED), + "ACTION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.STATE_CHANGED), + "STATE_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.ACTIVE_DESCENDANT_CHANGED), + "ACTIVE_DESCENDANT_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.BOUNDRECT_CHANGED), + "BOUNDRECT_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.CHILD), + "CHILD"); + maEventMap.put (new Integer (AccessibleEventId.INVALIDATE_ALL_CHILDREN), + "INVALIDATE_ALL_CHILDREN"); + maEventMap.put (new Integer (AccessibleEventId.SELECTION_CHANGED), + "SELECTION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.VISIBLE_DATA_CHANGED), + "VISIBLE_DATA_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.VALUE_CHANGED), + "VALUE_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.CONTENT_FLOWS_FROM_RELATION_CHANGED), + "CONTENT_FLOWS_FROM_RELATION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.CONTENT_FLOWS_TO_RELATION_CHANGED), + "CONTENT_FLOWS_TO_RELATION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.CONTROLLED_BY_RELATION_CHANGED), + "CONTROLLED_BY_RELATION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.CONTROLLER_FOR_RELATION_CHANGED), + "CONTROLLER_FOR_RELATION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.LABEL_FOR_RELATION_CHANGED), + "LABEL_FOR_RELATION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.LABELED_BY_RELATION_CHANGED), + "LABELED_BY_RELATION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.MEMBER_OF_RELATION_CHANGED), + "MEMBER_OF_RELATION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.SUB_WINDOW_OF_RELATION_CHANGED), + "SUB_WINDOW_OF_RELATION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.CARET_CHANGED), + "CARET_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TEXT_SELECTION_CHANGED), + "TEXT_SELECTION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TEXT_CHANGED), + "TEXT_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TEXT_ATTRIBUTE_CHANGED), + "TEXT_ATTRIBUTE_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.HYPERTEXT_CHANGED), + "HYPERTEXT_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TABLE_CAPTION_CHANGED), + "TABLE_CAPTION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TABLE_COLUMN_DESCRIPTION_CHANGED), + "TABLE_COLUMN_DESCRIPTION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TABLE_COLUMN_HEADER_CHANGED), + "TABLE_COLUMN_HEADER_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TABLE_MODEL_CHANGED), + "TABLE_MODEL_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TABLE_ROW_DESCRIPTION_CHANGED), + "TABLE_ROW_DESCRIPTION_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TABLE_ROW_HEADER_CHANGED), + "TABLE_ROW_HEADER_CHANGED"); + maEventMap.put (new Integer (AccessibleEventId.TABLE_SUMMARY_CHANGED), + "TABLE_SUMMARY_CHANGED"); + + maRoleMap.put (new Integer(AccessibleRole.UNKNOWN), "UNKNOWN"); + maRoleMap.put (new Integer (AccessibleRole.UNKNOWN), "UNKNOWN"); + maRoleMap.put (new Integer (AccessibleRole.ALERT), "ALERT"); + maRoleMap.put (new Integer (AccessibleRole.COLUMN_HEADER), "COLUMN_HEADER"); + maRoleMap.put (new Integer (AccessibleRole.CANVAS), "CANVAS"); + maRoleMap.put (new Integer (AccessibleRole.CHECK_BOX), "CHECK_BOX"); + maRoleMap.put (new Integer (AccessibleRole.CHECK_MENU_ITEM), "CHECK_MENU_ITEM"); + maRoleMap.put (new Integer (AccessibleRole.COLOR_CHOOSER), "COLOR_CHOOSER"); + maRoleMap.put (new Integer (AccessibleRole.COMBO_BOX), "COMBO_BOX"); + maRoleMap.put (new Integer (AccessibleRole.DESKTOP_ICON), "DESKTOP_ICON"); + maRoleMap.put (new Integer (AccessibleRole.DESKTOP_PANE), "DESKTOP_PANE"); + maRoleMap.put (new Integer (AccessibleRole.DIRECTORY_PANE), "DIRECTORY_PANE"); + maRoleMap.put (new Integer (AccessibleRole.DIALOG), "DIALOG"); + maRoleMap.put (new Integer (AccessibleRole.DOCUMENT), "DOCUMENT"); + maRoleMap.put (new Integer (AccessibleRole.EMBEDDED_OBJECT), "EMBEDDED_OBJECT"); + maRoleMap.put (new Integer (AccessibleRole.END_NOTE), "END_NOTE"); + maRoleMap.put (new Integer (AccessibleRole.FILE_CHOOSER), "FILE_CHOOSER"); + maRoleMap.put (new Integer (AccessibleRole.FILLER), "FILLER"); + maRoleMap.put (new Integer (AccessibleRole.FONT_CHOOSER), "FONT_CHOOSER"); + maRoleMap.put (new Integer (AccessibleRole.FOOTER), "FOOTER"); + maRoleMap.put (new Integer (AccessibleRole.FOOTNOTE), "FOOTNOTE"); + maRoleMap.put (new Integer (AccessibleRole.FRAME), "FRAME"); + maRoleMap.put (new Integer (AccessibleRole.GLASS_PANE), "GLASS_PANE"); + maRoleMap.put (new Integer (AccessibleRole.GRAPHIC), "GRAPHIC"); + maRoleMap.put (new Integer (AccessibleRole.GROUP_BOX), "GROUP_BOX"); + maRoleMap.put (new Integer (AccessibleRole.HEADER), "HEADER"); + maRoleMap.put (new Integer (AccessibleRole.HEADING), "HEADING"); + maRoleMap.put (new Integer (AccessibleRole.HYPER_LINK), "HYPER_LINK"); + maRoleMap.put (new Integer (AccessibleRole.ICON), "ICON"); + maRoleMap.put (new Integer (AccessibleRole.INTERNAL_FRAME), "INTERNAL_FRAME"); + maRoleMap.put (new Integer (AccessibleRole.LABEL), "LABEL"); + maRoleMap.put (new Integer (AccessibleRole.LAYERED_PANE), "LAYERED_PANE"); + maRoleMap.put (new Integer (AccessibleRole.LIST), "LIST"); + maRoleMap.put (new Integer (AccessibleRole.LIST_ITEM), "LIST_ITEM"); + maRoleMap.put (new Integer (AccessibleRole.MENU), "MENU"); + maRoleMap.put (new Integer (AccessibleRole.MENU_BAR), "MENU_BAR"); + maRoleMap.put (new Integer (AccessibleRole.MENU_ITEM), "MENU_ITEM"); + maRoleMap.put (new Integer (AccessibleRole.OPTION_PANE), "OPTION_PANE"); + maRoleMap.put (new Integer (AccessibleRole.PAGE_TAB), "PAGE_TAB"); + maRoleMap.put (new Integer (AccessibleRole.PAGE_TAB_LIST), "PAGE_TAB_LIST"); + maRoleMap.put (new Integer (AccessibleRole.PANEL), "PANEL"); + maRoleMap.put (new Integer (AccessibleRole.PARAGRAPH), "PARAGRAPH"); + maRoleMap.put (new Integer (AccessibleRole.PASSWORD_TEXT), "PASSWORD_TEXT"); + maRoleMap.put (new Integer (AccessibleRole.POPUP_MENU), "POPUP_MENU"); + maRoleMap.put (new Integer (AccessibleRole.PUSH_BUTTON), "PUSH_BUTTON"); + maRoleMap.put (new Integer (AccessibleRole.PROGRESS_BAR), "PROGRESS_BAR"); + maRoleMap.put (new Integer (AccessibleRole.RADIO_BUTTON), "RADIO_BUTTON"); + maRoleMap.put (new Integer (AccessibleRole.RADIO_MENU_ITEM), "RADIO_MENU_ITEM"); + maRoleMap.put (new Integer (AccessibleRole.ROW_HEADER), "ROW_HEADER"); + maRoleMap.put (new Integer (AccessibleRole.ROOT_PANE), "ROOT_PANE"); + maRoleMap.put (new Integer (AccessibleRole.SCROLL_BAR), "SCROLL_BAR"); + maRoleMap.put (new Integer (AccessibleRole.SCROLL_PANE), "SCROLL_PANE"); + maRoleMap.put (new Integer (AccessibleRole.SHAPE), "SHAPE"); + maRoleMap.put (new Integer (AccessibleRole.SEPARATOR), "SEPARATOR"); + maRoleMap.put (new Integer (AccessibleRole.SLIDER), "SLIDER"); + maRoleMap.put (new Integer (AccessibleRole.SPIN_BOX), "SPIN_BOX"); + maRoleMap.put (new Integer (AccessibleRole.SPLIT_PANE), "SPLIT_PANE"); + maRoleMap.put (new Integer (AccessibleRole.STATUS_BAR), "STATUS_BAR"); + maRoleMap.put (new Integer (AccessibleRole.TABLE), "TABLE"); + maRoleMap.put (new Integer (AccessibleRole.TABLE_CELL), "TABLE_CELL"); + maRoleMap.put (new Integer (AccessibleRole.TEXT), "TEXT"); + maRoleMap.put (new Integer (AccessibleRole.TEXT_FRAME), "TEXT_FRAME"); + maRoleMap.put (new Integer (AccessibleRole.TOGGLE_BUTTON), "TOGGLE_BUTTON"); + maRoleMap.put (new Integer (AccessibleRole.TOOL_BAR), "TOOL_BAR"); + maRoleMap.put (new Integer (AccessibleRole.TOOL_TIP), "TOOL_TIP"); + maRoleMap.put (new Integer (AccessibleRole.TREE), "TREE"); + maRoleMap.put (new Integer (AccessibleRole.VIEW_PORT), "VIEW_PORT"); + maRoleMap.put (new Integer (AccessibleRole.WINDOW), "WINDOW"); + + maRelationMap.put (new Integer (AccessibleRelationType.INVALID), "INVALID"); + maRelationMap.put (new Integer (AccessibleRelationType.CONTENT_FLOWS_FROM), "CONTENT_FLOWS_FROM"); + maRelationMap.put (new Integer (AccessibleRelationType.CONTENT_FLOWS_TO), "CONTENT_FLOWS_TO"); + maRelationMap.put (new Integer (AccessibleRelationType.CONTROLLED_BY), "CONTROLLED_BY"); + maRelationMap.put (new Integer (AccessibleRelationType.CONTROLLER_FOR), "CONTROLLER_FOR"); + maRelationMap.put (new Integer (AccessibleRelationType.LABEL_FOR), "LABEL_FOR"); + maRelationMap.put (new Integer (AccessibleRelationType.LABELED_BY), "LABELED_BY"); + maRelationMap.put (new Integer (AccessibleRelationType.MEMBER_OF), "MEMBER_OF"); + maRelationMap.put (new Integer (AccessibleRelationType.SUB_WINDOW_OF), "SUB_WINDOW_OF"); + } +} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java b/accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java new file mode 100644 index 000000000000..d9f77d9e4e07 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java @@ -0,0 +1,169 @@ +package org.openoffice.accessibility.misc; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.PrintStream; +import java.util.Timer; +import java.util.TimerTask; +import java.util.Vector; + +import com.sun.star.uno.UnoRuntime; +import com.sun.star.bridge.XUnoUrlResolver; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.comp.helper.Bootstrap; + +/** This class establishes a connection to a StarOffice application. + */ +public class OfficeConnection + extends TimerTask +{ + final public static long snDelay = 3000; + + public static synchronized OfficeConnection Instance () + { + if (saInstance == null) + saInstance = new OfficeConnection (); + return saInstance; + } + + + + + static public void SetPipeName (String sPipeName) + { + ssDefaultPipeName = sPipeName; + } + + + + + public void AddConnectionListener (ActionListener aListener) + { + SimpleOffice aOffice = SimpleOffice.Instance(); + if (IsValid()) + aListener.actionPerformed ( + new ActionEvent (aOffice,0,"<connected>")); + maListeners.add (aListener); + } + + + + /** @descr Return the service manager that represents the connected + StarOffice application + */ + public XMultiServiceFactory GetServiceManager () + { + return maServiceManager; + } + + + + + /** Return a flag that indicates if the constructor has been able to + establish a valid connection. + */ + public boolean IsValid () + { + return (maServiceManager != null); + } + + + + + /** Connect to a already running StarOffice application that has + been started with a command line argument like + "-accept=pipe,name=<username>;urp;" + */ + private boolean Connect () + { + mbInitialized = true; + // Set up connection string. + String sConnectString = "uno:pipe,name=" + msPipeName + + ";urp;StarOffice.ServiceManager"; + + // connect to a running office and get the ServiceManager + try + { + // Create a URL Resolver. + XMultiServiceFactory aLocalServiceManager = + Bootstrap.createSimpleServiceManager(); + XUnoUrlResolver aURLResolver = + (XUnoUrlResolver) UnoRuntime.queryInterface ( + XUnoUrlResolver.class, + aLocalServiceManager.createInstance ( + "com.sun.star.bridge.UnoUrlResolver") + ); + + maServiceManager = + (XMultiServiceFactory) UnoRuntime.queryInterface ( + XMultiServiceFactory.class, + aURLResolver.resolve (sConnectString) + ); + } + + catch (Exception e) + { + if (maOut != null) + { + maOut.println ("Could not connect with " + + sConnectString + " : " + e); + maOut.println ("Please start OpenOffice/StarOffice with " + + "\"-accept=pipe,name=" + msPipeName + ";urp;\""); + } + } + + return maServiceManager != null; + } + + + public void run () + { + if ( ! IsValid()) + { + MessageArea.println ("trying to connect"); + if (Connect()) + { + // Stop the timer. + cancel (); + + ActionEvent aEvent = new ActionEvent (this,0,"<connected>"); + for (int i=0; i<maListeners.size(); i++) + ((ActionListener)maListeners.elementAt(i)).actionPerformed(aEvent); + } + } + } + + private OfficeConnection () + { + this (null); + } + + + private OfficeConnection (PrintStream aOut) + { + msPipeName = ssDefaultPipeName; + maOut = aOut; + maListeners = new Vector(); + maServiceManager = null; + + maTimer = new Timer (true); + maTimer.schedule (this, 0, snDelay); + } + + + private static OfficeConnection saInstance = null; + private static String ssDefaultPipeName = System.getenv( "USER" ); + + private XMultiServiceFactory maServiceManager; + String msPipeName; + + /** A value of true just indicates that it has been tried to establish a connection, + not that that has been successfull. + */ + private boolean mbInitialized = false; + + /// Stream used to print messages. + private PrintStream maOut; + private Timer maTimer; + private Vector maListeners; +} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/Options.java b/accessibility/workben/org/openoffice/accessibility/misc/Options.java new file mode 100644 index 000000000000..e3c358264a1d --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/Options.java @@ -0,0 +1,106 @@ +package org.openoffice.accessibility.misc; + +import java.io.File; +import java.io.FileReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.Properties; + + +/** Load from and save options into a file. +*/ +public class Options + extends Properties +{ + static public Options Instance () + { + if (saOptions == null) + saOptions = new Options (); + return saOptions; + } + + static public void SetString (String sName, String sValue) + { + Instance().setProperty (sName, sValue); + Instance().Save (); + } + + static public String GetString (String sName) + { + return Instance().getProperty (sName); + } + + static public void SetBoolean (String sName, boolean bValue) + { + Instance().setProperty (sName, Boolean.toString(bValue)); + Instance().Save (); + } + + static public boolean GetBoolean (String sName) + { + return Boolean.valueOf(Instance().getProperty (sName)).booleanValue(); + } + + static public void SetInteger (String sName, int nValue) + { + Instance().setProperty (sName, Integer.toString(nValue)); + Instance().Save (); + } + + static public int GetInteger (String sName, int nDefault) + { + String sValue = Instance().getProperty (sName); + if (sValue == null) + return nDefault; + else + return Integer.parseInt (sValue); + } + + public void Load (String sBaseName) + { + try + { + load (new FileInputStream (ProvideFile(sBaseName))); + } + catch (java.io.IOException e) + { + // Ignore a non-existing options file. + } + } + + public void Save (String sBaseName) + { + ProvideFile(sBaseName); + Save (); + } + + public void Save () + { + if (maFile != null) + { + try + { + store (new FileOutputStream (maFile), null); + } + catch (java.io.IOException e) + { + } + } + } + + private Options () + { + maFile = null; + } + + private File ProvideFile (String sBaseName) + { + maFile = new File ( + System.getProperty ("user.home"), + sBaseName); + return maFile; + } + + static private Options saOptions = null; + private File maFile; +} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/SimpleOffice.java b/accessibility/workben/org/openoffice/accessibility/misc/SimpleOffice.java new file mode 100644 index 000000000000..3a2dcdf21926 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/SimpleOffice.java @@ -0,0 +1,413 @@ +package org.openoffice.accessibility.misc; + +import java.lang.Thread; + +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.XExtendedToolkit; +import com.sun.star.awt.XWindow; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.XPropertySet; + +import com.sun.star.container.XIndexAccess; +import com.sun.star.container.XChild; +import com.sun.star.container.XEnumerationAccess; +import com.sun.star.container.XEnumeration; + +import com.sun.star.frame.XComponentLoader; +import com.sun.star.frame.XController; +import com.sun.star.frame.XDesktop; +import com.sun.star.frame.XFrame; +import com.sun.star.frame.XModel; +import com.sun.star.frame.XTasksSupplier; +import com.sun.star.frame.XTask; + +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XServiceName; +import com.sun.star.lang.XTypeProvider; + +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.uno.Type; + +import com.sun.star.drawing.XDrawView; +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XShapes; +import com.sun.star.drawing.XShape; +import com.sun.star.drawing.XShapeDescriptor; + +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.accessibility.XAccessibleRelationSet; +import com.sun.star.accessibility.XAccessibleStateSet; + + +/** This singleton class tries to simplify some tasks like loading a document + or getting various objects. +*/ +public class SimpleOffice +{ + synchronized static public SimpleOffice Instance () + { + if (saInstance == null) + saInstance = new SimpleOffice (); + + return saInstance; + } + + synchronized static public void Clear () + { + saInstance = null; + } + + + public XModel LoadDocument (String URL) + { + XModel xModel = null; + try + { + // Load the document from the specified URL. + XComponentLoader xLoader = + (XComponentLoader)UnoRuntime.queryInterface( + XComponentLoader.class, mxDesktop); + + XComponent xComponent = xLoader.loadComponentFromURL ( + URL, + "_blank", + 0, + new PropertyValue[0] + ); + + xModel = (XModel) UnoRuntime.queryInterface( + XModel.class, xComponent); + } + catch (java.lang.NullPointerException e) + { + MessageArea.println ("caught exception while loading " + + URL + " : " + e); + } + catch (Exception e) + { + MessageArea.println ("caught exception while loading " + + URL + " : " + e); + } + return xModel; + } + + + + + public XModel GetModel (String name) + { + XModel xModel = null; + try + { + XTasksSupplier xTasksSupplier = + (XTasksSupplier) UnoRuntime.queryInterface( + XTasksSupplier.class, mxDesktop); + XEnumerationAccess xEA = xTasksSupplier.getTasks(); + XEnumeration xE = xEA.createEnumeration(); + while (xE.hasMoreElements()) + { + XTask xTask = (XTask) UnoRuntime.queryInterface( + XTask.class, xE.nextElement()); + MessageArea.print (xTask.getName()); + } + } + catch (Exception e) + { + MessageArea.println ("caught exception while getting Model " + name + + ": " + e); + } + return xModel; + } + + + public XModel GetModel (XDrawView xView) + { + XController xController = (XController) UnoRuntime.queryInterface( + XController.class, xView); + if (xController != null) + return xController.getModel(); + else + { + MessageArea.println ("can't cast view to controller"); + return null; + } + } + + + + + public XDesktop GetDesktop () + { + if (mxDesktop != null) + return mxDesktop; + try + { + // Get the factory of the connected office. + XMultiServiceFactory xMSF = + OfficeConnection.Instance().GetServiceManager (); + if (xMSF == null) + { + MessageArea.println ("can't connect to office"); + return null; + } + else + MessageArea.println ("Connected successfully."); + + // Create a new desktop. + mxDesktop = (XDesktop) UnoRuntime.queryInterface( + XDesktop.class, + xMSF.createInstance ("com.sun.star.frame.Desktop") + ); + } + catch (Exception e) + { + MessageArea.println ("caught exception while creating desktop: " + + e); + } + + return mxDesktop; + } + + + /** Return a reference to the extended toolkit which is a broadcaster of + top window, key, and focus events. + */ + public XExtendedToolkit GetExtendedToolkit () + { + XExtendedToolkit xToolkit = null; + if (this != null) + try + { + // Get the factory of the connected office. + XMultiServiceFactory xMSF = + OfficeConnection.Instance().GetServiceManager (); + if (xMSF != null) + { + xToolkit = (XExtendedToolkit) UnoRuntime.queryInterface( + XExtendedToolkit.class, + xMSF.createInstance ("stardiv.Toolkit.VCLXToolkit") + ); + } + } + catch (Exception e) + { + MessageArea.println ( + "caught exception while creating extended toolkit: " + e); + } + + return xToolkit; + } + + + + static public XAccessible GetAccessibleObject (XInterface xObject) + { + XAccessible xAccessible = null; + try + { + xAccessible = (XAccessible) UnoRuntime.queryInterface( + XAccessible.class, xObject); + } + catch (Exception e) + { + System.err.println ( + "caught exception while getting accessible object" + e); + e.printStackTrace (System.err); + } + return xAccessible; + } + + static public XAccessibleContext GetAccessibleContext (XInterface xObject) + { + XAccessible xAccessible = GetAccessibleObject (xObject); + if (xAccessible != null) + return xAccessible.getAccessibleContext(); + else + return null; + } + + /** Return the root object of the accessibility hierarchy. + */ + public XAccessible GetAccessibleRoot (XAccessible xAccessible) + { + try + { + XAccessible xParent = null; + do + { + XAccessibleContext xContext = xAccessible.getAccessibleContext(); + if (xContext != null) + xParent = xContext.getAccessibleParent(); + if (xParent != null) + xAccessible = xParent; + } + while (xParent != null); + } + catch (Exception e) + { + MessageArea.println ( + "caught exception while getting accessible root" + e); + e.printStackTrace(); + } + return xAccessible; + } + + + + + /** @descr Return the current window associated with the given + model. + */ + public XWindow GetCurrentWindow () + { + return GetCurrentWindow ((XModel) UnoRuntime.queryInterface( + XModel.class, GetDesktop())); + } + + + + + + public XWindow GetCurrentWindow (XModel xModel) + { + XWindow xWindow = null; + try + { + if (xModel == null) + MessageArea.println ("invalid model (==null)"); + XController xController = xModel.getCurrentController(); + if (xController == null) + MessageArea.println ("can't get controller from model"); + XFrame xFrame = xController.getFrame(); + if (xFrame == null) + MessageArea.println ("can't get frame from controller"); + xWindow = xFrame.getComponentWindow (); + if (xWindow == null) + MessageArea.println ("can't get window from frame"); + } + catch (Exception e) + { + MessageArea.println ("caught exception while getting current window" + e); + } + + return xWindow; + } + + + /** @descr Return the current draw page of the given desktop. + */ + public XDrawPage GetCurrentDrawPage () + { + return GetCurrentDrawPage ( + (XDrawView) UnoRuntime.queryInterface( + XDrawView.class, + GetCurrentView())); + } + + + + + public XDrawPage GetCurrentDrawPage (XDrawView xView) + { + XDrawPage xPage = null; + try + { + if (xView == null) + MessageArea.println ("can't get current draw page from null view"); + else + xPage = xView.getCurrentPage(); + } + catch (Exception e) + { + MessageArea.println ("caught exception while getting current draw page : " + e); + } + + return xPage; + } + + + + + /** @descr Return the current view of the given desktop. + */ + public XDrawView GetCurrentView () + { + return GetCurrentView (GetDesktop()); + } + + public XDrawView GetCurrentView (XDesktop xDesktop) + { + if (xDesktop == null) + MessageArea.println ("can't get desktop to retrieve current view"); + + XDrawView xView = null; + try + { + XComponent xComponent = xDesktop.getCurrentComponent(); + if (xComponent == null) + MessageArea.println ("can't get component to retrieve current view"); + + XFrame xFrame = xDesktop.getCurrentFrame(); + if (xFrame == null) + MessageArea.println ("can't get frame to retrieve current view"); + + XController xController = xFrame.getController(); + if (xController == null) + MessageArea.println ("can't get controller to retrieve current view"); + + xView = (XDrawView) UnoRuntime.queryInterface( + XDrawView.class, xController); + if (xView == null) + MessageArea.println ("could not cast controller into view"); + } + catch (Exception e) + { + MessageArea.println ("caught exception while getting current view : " + e); + } + + return xView; + } + + + + + // Return the accessible object of the document window. + public static XAccessible GetAccessibleDocumentWindow (XDrawPage xPage) + { + XIndexAccess xShapeList = (XIndexAccess) UnoRuntime.queryInterface( + XIndexAccess.class, xPage); + if (xShapeList.getCount() > 0) + { + // All shapes return as accessible object the document window's + // accessible object. This is, of course, a hack and will be + // removed as soon as the missing infrastructure for obtaining + // the object directly is implemented. + XShape xShape = null; + try{ + xShape = (XShape) UnoRuntime.queryInterface( + XShape.class, xShapeList.getByIndex (0)); + } catch (Exception e) + {} + XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface ( + XAccessible.class, xShape); + return xAccessible; + } + else + return null; + } + + private SimpleOffice () + { + } + + + + private XDesktop mxDesktop; + private static SimpleOffice saInstance = null; +} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/makefile.common b/accessibility/workben/org/openoffice/accessibility/misc/makefile.common new file mode 100644 index 000000000000..d06336e12c56 --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/makefile.common @@ -0,0 +1,67 @@ +#************************************************************************* +# +# $RCSfile: makefile.common,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar juh.jar java_uno.jar +JAVAFILES = \ + AccessibleEventMulticaster.java \ + InformationWriter.java \ + MessageArea.java \ + NameProvider.java \ + OfficeConnection.java \ + Options.java \ + SimpleOffice.java diff --git a/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk b/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk new file mode 100644 index 000000000000..f0b71f860c3e --- /dev/null +++ b/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk @@ -0,0 +1,86 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJNAME = awb +PRJ = ..$/..$/..$/..$/.. +TARGET = java_misc +PACKAGE = org$/openoffice$/accessibility$/misc + +USE_JAVAVER:=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +.IF "$(JAVAVER:s/.//)" >= "140" + +.INCLUDE : makefile.common + +JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +#JARTARGET = $(TARGET).jar +#JARCOMPRESS = TRUE +#JARCLASSDIRS = $(PACKAGE) org/openoffice/java/accessibility/awb +#CUSTOMMANIFESTFILE = manifest +.ENDIF + +# --- Targets ------------------------------------------------------ + + +.INCLUDE : target.mk + diff --git a/automation/source/communi/communi.cxx b/automation/source/communi/communi.cxx index 55b72e1031e2..6f79551ecd72 100644 --- a/automation/source/communi/communi.cxx +++ b/automation/source/communi/communi.cxx @@ -260,7 +260,7 @@ long CommunicationLinkViaSocket::DataReceived( void* EMPTYARG ) IMPL_LINK( CommunicationLinkViaSocket, PutDataReceivedHdl, CommunicationLinkViaSocket*, EMPTYARG ) { - nDataReceivedEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationLinkViaSocket, DataReceived ) ); + nDataReceivedEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationLink, DataReceived ) ); return 0; } diff --git a/automation/source/server/server.cxx b/automation/source/server/server.cxx index 5d84cb6cd75d..988f4055a2eb 100644 --- a/automation/source/server/server.cxx +++ b/automation/source/server/server.cxx @@ -805,7 +805,7 @@ BOOL ImplRemoteControl::QueCommands( ULONG nServiceId, SvStream *pIn ) break; } default: - DBG_ERROR1( "Unbekannter Request Nr:%il", nId ); + DBG_ERROR1( "Unbekannter Request Nr:%i", nId ); break; } if( !pIn->IsEof() ) diff --git a/automation/source/testtool/makefile.mk b/automation/source/testtool/makefile.mk index 4cb27a48ddd4..79a811fdaee7 100644 --- a/automation/source/testtool/makefile.mk +++ b/automation/source/testtool/makefile.mk @@ -103,12 +103,15 @@ $(MISC)$/xfilter.pl : filter.pl .IF "$(GUI)"=="UNX" INIFILESUFFIX=rc +BRANDPATH=none .ELIF "$(GUI)"=="WNT" || "$(GUI)"=="OS2" INIFILESUFFIX=.ini +BRANDPATH=.. .END $(BIN)$/testtool$(INIFILESUFFIX): testtool.ini - $(SED) -e s/$(EMQ)!INIFILESUFFIX$(EMQ)!/$(INIFILESUFFIX)/ < $< > $@ + $(SED) -e s/$(EMQ)!INIFILESUFFIX$(EMQ)!/$(INIFILESUFFIX)/ \ + -e s/$(EMQ)!BRANDPATH$(EMQ)!/$(BRANDPATH)/ < $< > $@ ALLTAR: \ $(BIN)$/testtool$(INIFILESUFFIX) diff --git a/automation/source/testtool/tcommuni.cxx b/automation/source/testtool/tcommuni.cxx index f341bd3efe36..3ac135829f6d 100644 --- a/automation/source/testtool/tcommuni.cxx +++ b/automation/source/testtool/tcommuni.cxx @@ -36,7 +36,6 @@ #include <vcl/svapp.hxx> #include <tools/time.hxx> #include <tools/debug.hxx> -#include <vos/process.hxx> #include <vcl/timer.hxx> #ifndef _BASIC_TTRESHLP_HXX diff --git a/automation/source/testtool/testtool.ini b/automation/source/testtool/testtool.ini index bf1b54c8777e..ff2e43f5c0f6 100644 --- a/automation/source/testtool/testtool.ini +++ b/automation/source/testtool/testtool.ini @@ -1,7 +1,7 @@ [Bootstrap] URE_BOOTSTRAP=${ORIGIN}/fundamentalbasis!INIFILESUFFIX! OOO_BASE_DIR=${ORIGIN}/.. -BRAND_BASE_DIR=${OOO_BASE_DIR}/none +BRAND_BASE_DIR=${OOO_BASE_DIR}/!BRANDPATH! UserInstallation=${SYSUSERCONFIG}/.oootesttool [Misc] diff --git a/automation/util/manually_added_ids.hid b/automation/util/manually_added_ids.hid index 1a76246e5128..7372dc0d9879 100755 --- a/automation/util/manually_added_ids.hid +++ b/automation/util/manually_added_ids.hid @@ -3,11 +3,6 @@ MSC_Super_ID 123456 MSC_Super_ID2 1234567 MSC_Super_ID3 12345678 -HID_OPTIONS_JAVA_LIST 39997 - -PDF1TBO 867876864 -PDF2TBO 867860480 - FontWork1TBO 40026 FontWork2TBO 40027 diff --git a/basctl/util/makefile.mk b/basctl/util/makefile.mk index 80b3efd4325d..0f2a919ff655 100644 --- a/basctl/util/makefile.mk +++ b/basctl/util/makefile.mk @@ -54,6 +54,7 @@ SHL1TARGET= basctl$(DLLPOSTFIX) SHL1IMPLIB= basctl SHL1BASE = 0x1d800000 SHL1STDLIBS= \ + $(SVXCORELIB) \ $(SVXLIB) \ $(SFX2LIB) \ $(BASICLIB) \ diff --git a/crashrep/source/unx/makefile.mk b/crashrep/source/unx/makefile.mk index 54628be1f2f7..2f8be8f96a76 100755 --- a/crashrep/source/unx/makefile.mk +++ b/crashrep/source/unx/makefile.mk @@ -63,7 +63,7 @@ APP1RPATH=BRAND .IF "$(OS)" != "MACOSX" APP1STDLIBS=$(DYNAMIC) -lXext -lX11 .ENDIF -.IF "$(OS)" != "FREEBSD" && "$(OS)" != "MACOSX" +.IF "$(OS)" != "FREEBSD" && "$(OS)" != "MACOSX" && "$(OS)"!="NETBSD" APP1STDLIBS+=-ldl -lnsl .ENDIF .IF "$(OS)" == "SOLARIS" diff --git a/embedserv/source/inprocserv/makefile.mk b/embedserv/source/inprocserv/makefile.mk index 0f81dcc8bd0d..1928b1ec42ac 100644 --- a/embedserv/source/inprocserv/makefile.mk +++ b/embedserv/source/inprocserv/makefile.mk @@ -57,7 +57,17 @@ SLOFILES=\ $(SLO)$/inprocembobj.obj SHL1TARGET=$(TARGET) -SHL1STDLIBS=\ +.IF "$(COM)"=="GCC" +SHL1STDLIBS += -lstdc++ +.IF "$(MINGW_GCCLIB_EH)"=="YES" +SHL1STDLIBS += -lgcc_eh +.ENDIF +SHL1STDLIBS += -lgcc -lmingw32 -lmoldname -lmsvcrt +.ELSE +SHL1STDLIBS= +.ENDIF + +SHL1STDLIBS+=\ $(UUIDLIB)\ $(OLE32LIB)\ $(GDI32LIB)\ diff --git a/extensions/source/abpilot/makefile.mk b/extensions/source/abpilot/makefile.mk index 85a19ade9996..8830b9144409 100644 --- a/extensions/source/abpilot/makefile.mk +++ b/extensions/source/abpilot/makefile.mk @@ -94,6 +94,7 @@ SHL1STDLIBS= \ $(COMPHELPERLIB) \ $(TKLIB) \ $(UNOTOOLSLIB) \ + $(SVXCORELIB) \ $(SVXLIB) SHL1LIBS= $(SLB)$/$(TARGET).lib diff --git a/extensions/source/activex/main/SOActiveX.h b/extensions/source/activex/main/SOActiveX.h index f7017d582be9..2bf33f96b4e9 100644 --- a/extensions/source/activex/main/SOActiveX.h +++ b/extensions/source/activex/main/SOActiveX.h @@ -163,7 +163,7 @@ public: HRESULT GetUrlStruct( OLECHAR* sUrl, CComPtr<IDispatch>& pdispUrl ); HRESULT Cleanup(); HRESULT TerminateOffice(); - HRESULT CSOActiveX::GetURL( const OLECHAR* url, + HRESULT GetURL( const OLECHAR* url, const OLECHAR* target ); void CallbackCreateXInputStream( CBindStatusCallback<CSOActiveX>* pbsc, BYTE* pBytes, DWORD dwSize ); diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx index 7b36f27626c4..f86b284b72fd 100644 --- a/extensions/source/dbpilots/listcombowizard.cxx +++ b/extensions/source/dbpilots/listcombowizard.cxx @@ -223,9 +223,6 @@ namespace dbp // the bound field getContext().xObjectModel->setPropertyValue(::rtl::OUString::createFromAscii("DataField"), makeAny(::rtl::OUString(getSettings().sLinkedFormField))); - - // by default, create a drop down control - getContext().xObjectModel->setPropertyValue(::rtl::OUString::createFromAscii("Dropdown"), ::cppu::bool2any(sal_True)); } catch(Exception&) { diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx index 2addf2f037a7..255d66f46ea8 100644 --- a/extensions/source/ole/oleobjw.hxx +++ b/extensions/source/ole/oleobjw.hxx @@ -32,8 +32,10 @@ #define __OLEOBJW_HXX #include "ole2uno.hxx" +#ifdef _MSC_VER #pragma warning (push,1) #pragma warning (disable:4548) +#endif #include <tools/presys.h> #define _WIN32_WINNT 0x0400 @@ -46,7 +48,9 @@ #include <hash_map> #include <tools/postsys.h> +#ifdef _MSC_VER #pragma warning (pop) +#endif #include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase4.hxx> @@ -88,7 +92,7 @@ public: ~IUnknownWrapper_Impl(); //XInterface - Any SAL_CALL IUnknownWrapper_Impl::queryInterface(const Type& t) + Any SAL_CALL queryInterface(const Type& t) throw (RuntimeException); // XInvokation diff --git a/extensions/source/oooimprovecore/makefile.mk b/extensions/source/oooimprovecore/makefile.mk index 53de4e333994..74a9ad9aee19 100644 --- a/extensions/source/oooimprovecore/makefile.mk +++ b/extensions/source/oooimprovecore/makefile.mk @@ -62,6 +62,7 @@ SHL1STDLIBS= \ $(SVLLIB) \ $(SVTOOLLIB) \ $(SFXLIB) \ + $(SVXCORELIB) \ $(SVXLIB) \ $(TOOLSLIB) diff --git a/extensions/source/oooimprovement/config.cxx b/extensions/source/oooimprovement/config.cxx index daf1e81bc60d..bece7e089f1a 100644 --- a/extensions/source/oooimprovement/config.cxx +++ b/extensions/source/oooimprovement/config.cxx @@ -222,6 +222,7 @@ namespace oooimprovement return result; } +#ifdef FUTURE sal_Int32 Config::getFailedAttempts() const { sal_Int32 result = 0; @@ -231,6 +232,7 @@ namespace oooimprovement MyConfigurationHelper::E_READONLY) >>= result; return result; } +#endif sal_Int32 Config::getOfficeStartCounterdown() const { diff --git a/extensions/source/oooimprovement/config.hxx b/extensions/source/oooimprovement/config.hxx index ff032a6032a5..c5ea887fa76f 100644 --- a/extensions/source/oooimprovement/config.hxx +++ b/extensions/source/oooimprovement/config.hxx @@ -53,7 +53,9 @@ namespace oooimprovement ::rtl::OUString getSoapId() const; ::rtl::OUString getSoapUrl() const; sal_Int32 getReportCount() const; +#ifdef FUTURE sal_Int32 getFailedAttempts() const; +#endif sal_Int32 getOfficeStartCounterdown() const; sal_Int32 incrementEventCount(sal_Int32 by); sal_Int32 incrementReportCount(sal_Int32 by); diff --git a/extensions/source/oooimprovement/corecontroller.cxx b/extensions/source/oooimprovement/corecontroller.cxx index 34fc24e42302..3c9245d3faa9 100644 --- a/extensions/source/oooimprovement/corecontroller.cxx +++ b/extensions/source/oooimprovement/corecontroller.cxx @@ -33,7 +33,6 @@ #include "corecontroller.hxx" #include "config.hxx" - using ::rtl::OUString; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; @@ -41,14 +40,6 @@ using namespace ::com::sun::star::uno; namespace oooimprovement { - - CoreController::CoreController(const Reference<XComponentContext>& context) - : m_ServiceFactory(Reference<XMultiServiceFactory>( - context->getServiceManager()->createInstanceWithContext( - OUString::createFromAscii("com.sun.star.lang.XMultiServiceFactory"), context), - UNO_QUERY)) - { } - CoreController::CoreController(const Reference<XMultiServiceFactory>& sf) : m_ServiceFactory(sf) { } @@ -96,9 +87,6 @@ namespace oooimprovement return aServiceNames; } - Reference<XInterface> SAL_CALL CoreController::Create(const Reference<XComponentContext>& context) - { return *(new CoreController(context)); } - Reference<XInterface> SAL_CALL CoreController::Create(const Reference<XMultiServiceFactory>& sm) { return *(new CoreController(sm)); } } diff --git a/extensions/source/oooimprovement/corecontroller.hxx b/extensions/source/oooimprovement/corecontroller.hxx index 3f1cadb82b69..4f62e9d026b6 100644 --- a/extensions/source/oooimprovement/corecontroller.hxx +++ b/extensions/source/oooimprovement/corecontroller.hxx @@ -54,8 +54,8 @@ namespace oooimprovement // css::lang::XServiceInfo - static version static ::rtl::OUString SAL_CALL getImplementationName_static(); static css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static(); - static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( - const css::uno::Reference<css::uno::XComponentContext>& context); + //static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( + // const css::uno::Reference<css::uno::XComponentContext>& context); static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( const css::uno::Reference< css::lang::XMultiServiceFactory>& sm); diff --git a/extensions/source/oooimprovement/invite_job.cxx b/extensions/source/oooimprovement/invite_job.cxx index 20efafcaa69a..bb1ce11d23fe 100644 --- a/extensions/source/oooimprovement/invite_job.cxx +++ b/extensions/source/oooimprovement/invite_job.cxx @@ -67,12 +67,12 @@ namespace namespace oooimprovement { - InviteJob::InviteJob(const Reference<XComponentContext>& context) - : m_ServiceFactory(Reference<XMultiServiceFactory>( - context->getServiceManager()->createInstanceWithContext( - OUString::createFromAscii("com.sun.star.lang.XMultiServiceFactory"), context), - UNO_QUERY)) - { } +// InviteJob::InviteJob(const Reference<XComponentContext>& context) +// : m_ServiceFactory(Reference<XMultiServiceFactory>( +// context->getServiceManager()->createInstanceWithContext( +// OUString::createFromAscii("com.sun.star.lang.XMultiServiceFactory"), context), +// UNO_QUERY)) +// { } InviteJob::InviteJob(const Reference<XMultiServiceFactory>& sf) : m_ServiceFactory(sf) @@ -128,8 +128,8 @@ namespace oooimprovement return aServiceNames; } - Reference<XInterface> InviteJob::Create(const Reference<XComponentContext>& context) - { return *(new InviteJob(context)); } +// Reference<XInterface> InviteJob::Create(const Reference<XComponentContext>& context) +// { return *(new InviteJob(context)); } Reference<XInterface> InviteJob::Create(const Reference<XMultiServiceFactory>& sm) { return *(new InviteJob(sm)); } diff --git a/extensions/source/oooimprovement/invite_job.hxx b/extensions/source/oooimprovement/invite_job.hxx index 17e5c2586003..8c1cd57f07a8 100644 --- a/extensions/source/oooimprovement/invite_job.hxx +++ b/extensions/source/oooimprovement/invite_job.hxx @@ -53,8 +53,8 @@ namespace oooimprovement // XServiceInfo - static version static ::rtl::OUString SAL_CALL getImplementationName_static(); static css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static(); - static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( - const css::uno::Reference< css::uno::XComponentContext>& context); + //static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( + // const css::uno::Reference< css::uno::XComponentContext>& context); static css::uno::Reference< css::uno::XInterface> SAL_CALL Create(const css::uno::Reference< css::lang::XMultiServiceFactory>& sm); diff --git a/extensions/source/oooimprovement/myconfigurationhelper.cxx b/extensions/source/oooimprovement/myconfigurationhelper.cxx index c6e68e92a064..e0f14c6ec445 100644 --- a/extensions/source/oooimprovement/myconfigurationhelper.cxx +++ b/extensions/source/oooimprovement/myconfigurationhelper.cxx @@ -149,33 +149,6 @@ namespace oooimprovement xProps->setPropertyValue(sKey, aValue); } - Reference<XInterface> MyConfigurationHelper::makeSureSetNodeExists( - const Reference<XInterface> xCFG, - const OUString& sRelPathToSet, - const OUString& sSetNode) - { - Reference<css::container::XHierarchicalNameAccess> xAccess(xCFG, UNO_QUERY_THROW); - Reference<css::container::XNameAccess> xSet; - xAccess->getByHierarchicalName(sRelPathToSet) >>= xSet; - if (!xSet.is()) - throw css::container::NoSuchElementException( - noSuchElement(sRelPathToSet), - Reference<XInterface>()); - - Reference<XInterface> xNode; - if (xSet->hasByName(sSetNode)) - xSet->getByName(sSetNode) >>= xNode; - else - { - Reference<XSingleServiceFactory> xNodeFactory(xSet, UNO_QUERY_THROW); - xNode = xNodeFactory->createInstance(); - Reference<css::container::XNameContainer> xSetReplace(xSet, UNO_QUERY_THROW); - xSetReplace->insertByName(sSetNode, makeAny(xNode)); - } - - return xNode; - } - Any MyConfigurationHelper::readDirectKey( const Reference<XMultiServiceFactory> xSMGR, const OUString& sPackage, diff --git a/extensions/source/oooimprovement/myconfigurationhelper.hxx b/extensions/source/oooimprovement/myconfigurationhelper.hxx index a5d0c749e81a..5c5cb38b6a68 100644 --- a/extensions/source/oooimprovement/myconfigurationhelper.hxx +++ b/extensions/source/oooimprovement/myconfigurationhelper.hxx @@ -163,40 +163,6 @@ namespace oooimprovement const css::uno::Any& aValue); //----------------------------------------------- - /** it checks if the specified set node exists ... or create an empty one - * otherwise. - * - * This method must be used in combination with openConfig(). - * The cached configuration access must be provided here ... and - * all operations are made relativ to this access point. - * - * Further this method must be used only with configuration set's. - * Atomic keys can't be "created" ... they "exists everytimes". - * - * @param xCFG - * the configuration root, where sRelPathToSet should be interpreted - * as relativ path. - * - * @param sRelPathToSet - * path relative to xCFG parameter. - * - * @param sSetNode - * the set node, which should be checked if its exists ... - * or which should be created with default values. - * - * @return A reference to the found (or new created) set node. - * Cant be NULL .. in such case an exception occure ! - * - * @throw css::uno::Any exceptions the underlying configuration can throw. - * E.g. css::uno::Exception if the provided configuration - * access does not allow writing for this set. - */ - static css::uno::Reference< css::uno::XInterface> makeSureSetNodeExists( - const css::uno::Reference< css::uno::XInterface> xCFG, - const ::rtl::OUString& sRelPathToSet, - const ::rtl::OUString& sSetNode); - - //----------------------------------------------- /** commit all changes made on the specified configuration access. * * This method must be used in combination with openConfig(). diff --git a/extensions/source/oooimprovement/soaprequest.cxx b/extensions/source/oooimprovement/soaprequest.cxx index d67ce911d204..94099cc21aee 100644 --- a/extensions/source/oooimprovement/soaprequest.cxx +++ b/extensions/source/oooimprovement/soaprequest.cxx @@ -33,6 +33,7 @@ #include "soaprequest.hxx" #include "errormail.hxx" +#include "config.hxx" #include <boost/shared_ptr.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -56,7 +57,7 @@ namespace { static unsigned long asUlong(sal_Int8 input) { - return *reinterpret_cast<unsigned char *>(&input) ; + return *reinterpret_cast<unsigned char *>(&input); }; static Sequence<sal_Int8> base64_encode(const Sequence<sal_Int8>& input) @@ -150,10 +151,22 @@ namespace "</SOAP-ENV:Envelope>\n"); static const OString SOAP_ITEM_END("]]></value></item>\n"); - static const OString getSoapSoapId(const OString& soap_id) + static const OString getSoapOfficeversion(const Reference<XMultiServiceFactory>& sf) { OStringBuffer buf = - "<body xsi:type=\"xsd:string\">" + xmlEncode(soap_id) + "</body>\n"; + "<Officeversion Productname=\"" + + ::rtl::OUStringToOString(oooimprovement::Config(sf).getCompleteProductname(), RTL_TEXTENCODING_ASCII_US) + + "\"/>\n"; + return buf.makeStringAndClear(); + }; + + static const OString getSoapSoapId(const Reference<XMultiServiceFactory>& sf, const OString& soap_id) + { + OStringBuffer buf; + buf.append("<body xsi:type=\"xsd:string\">"); + buf.append(xmlEncode(soap_id)).append("\n"); + buf.append(getSoapOfficeversion(sf)); + buf.append("</body>\n"); return buf.makeStringAndClear(); }; @@ -180,7 +193,7 @@ namespace oooimprovement writeString(target, SOAP_START); writeString( target, - getSoapSoapId(rtl::OUStringToOString(m_SoapId, RTL_TEXTENCODING_ASCII_US))); + getSoapSoapId(m_ServiceFactory, rtl::OUStringToOString(m_SoapId, RTL_TEXTENCODING_ASCII_US))); writeString(target, SOAP_ITEMS_START); writeString(target, getSoapItemStart("reportmail.xml")); writeString(target, Errormail(m_ServiceFactory).getXml()); diff --git a/extensions/source/propctrlr/eformspropertyhandler.cxx b/extensions/source/propctrlr/eformspropertyhandler.cxx index d0ac0de3857a..b200d37cb83b 100644 --- a/extensions/source/propctrlr/eformspropertyhandler.cxx +++ b/extensions/source/propctrlr/eformspropertyhandler.cxx @@ -412,6 +412,18 @@ namespace pcr } //-------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL EFormsPropertyHandler::getSupersededProperties( ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_pHelper.get() ) + return Sequence< ::rtl::OUString >(); + + Sequence< ::rtl::OUString > aReturn( 1 ); + aReturn[ 0 ] = PROPERTY_INPUT_REQUIRED; + return aReturn; + } + + //-------------------------------------------------------------------- LineDescriptor SAL_CALL EFormsPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, const Reference< XPropertyControlFactory >& _rxControlFactory ) throw (UnknownPropertyException, NullPointerException, RuntimeException) diff --git a/extensions/source/propctrlr/eformspropertyhandler.hxx b/extensions/source/propctrlr/eformspropertyhandler.hxx index 700cf43431cf..55c464d77076 100644 --- a/extensions/source/propctrlr/eformspropertyhandler.hxx +++ b/extensions/source/propctrlr/eformspropertyhandler.hxx @@ -77,6 +77,8 @@ namespace pcr virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > + SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::inspection::InteractiveSelectionResult diff --git a/extensions/source/propctrlr/makefile.mk b/extensions/source/propctrlr/makefile.mk index c043850e3c73..9b9ffe47aa15 100644 --- a/extensions/source/propctrlr/makefile.mk +++ b/extensions/source/propctrlr/makefile.mk @@ -120,6 +120,7 @@ SHL1TARGET= $(TARGET)$(DLLPOSTFIX) SHL1VERSIONMAP= $(TARGET).map SHL1STDLIBS= \ + $(SVXCORELIB) \ $(SVXLIB) \ $(SFXLIB) \ $(SVTOOLLIB)\ diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index c0374bbb3ce5..de2e7f272350 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -224,6 +224,19 @@ void SaneDlg::InitFields() maReslBox.SetMin( (long)pDouble[0] ); maReslBox.SetMax( (long)pDouble[1] ); maReslBox.InsertValue( (long)pDouble[0] ); + // mh@openoffice.org: issue 68557: Can only select 75 and 2400 dpi in Scanner dialogue + // scanner allows random setting of dpi resolution, a slider might be useful + // support that + // workaround: offer at least some more standard dpi resolution between + // min and max value + int bGot300 = 0; + for ( int nRes = (long) pDouble[0] * 2; nRes < (long) pDouble[1]; nRes = nRes * 2 ) + { + if ( !bGot300 && nRes > 300 ) { + nRes = 300; bGot300 = 1; + } + maReslBox.InsertValue(nRes); + } maReslBox.InsertValue( (long)pDouble[1] ); } if( pDouble ) diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index 2e0d470b3241..0b1d1e68f9f3 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -197,7 +197,14 @@ void ScannerThread::run() void ScannerManager::DestroyData() { - // unused + // was unused, now because of i99835: "Scanning interface not SANE API compliant" + // delete all SaneHolder to get Sane Dtor called + int i; + for ( i = allSanes.Count(); i > 0; i-- ) + { + SaneHolder *pSaneHolder = allSanes.GetObject(i-1); + if ( pSaneHolder ) delete pSaneHolder; + } } // ----------------------------------------------------------------------------- diff --git a/extensions/util/hidother.src b/extensions/util/hidother.src index 49b67060f8a3..3f8fcd5ed7f8 100644 --- a/extensions/util/hidother.src +++ b/extensions/util/hidother.src @@ -30,208 +30,92 @@ #include "../inc/extensio.hrc" -hidspecial HID_BIB_CHANGESOURCE { HelpId = HID_BIB_CHANGESOURCE; } -hidspecial HID_BIB_MAPPINGDLG { HelpId = HID_BIB_MAPPINGDLG; } -hidspecial HID_BIB_TBX_TABLE { HelpId = HID_BIB_TBX_TABLE; } -hidspecial HID_BIB_TBX_SEARCH { HelpId = HID_BIB_TBX_SEARCH; } -hidspecial HID_BIB_TBX_AUTOFILTER { HelpId = HID_BIB_TBX_AUTOFILTER; } +hidspecial HID_ABSPILOT { HelpId = HID_ABSPILOT; } +hidspecial HID_ABSPILOT_CANCEL { HelpId = HID_ABSPILOT_CANCEL; } +hidspecial HID_ABSPILOT_FINISH { HelpId = HID_ABSPILOT_FINISH; } +hidspecial HID_ABSPILOT_NEXT { HelpId = HID_ABSPILOT_NEXT; } +hidspecial HID_ABSPILOT_PREVIOUS { HelpId = HID_ABSPILOT_PREVIOUS; } -hidspecial HID_BIB_IDENTIFIER_POS { HelpId = HID_BIB_IDENTIFIER_POS; } +hidspecial HID_BIB_ADDRESS_POS { HelpId = HID_BIB_ADDRESS_POS; } +hidspecial HID_BIB_ANNOTE_POS { HelpId = HID_BIB_ANNOTE_POS; } hidspecial HID_BIB_AUTHORITYTYPE_POS { HelpId = HID_BIB_AUTHORITYTYPE_POS; } hidspecial HID_BIB_AUTHOR_POS { HelpId = HID_BIB_AUTHOR_POS; } -hidspecial HID_BIB_TITLE_POS { HelpId = HID_BIB_TITLE_POS; } -hidspecial HID_BIB_YEAR_POS { HelpId = HID_BIB_YEAR_POS; } -hidspecial HID_BIB_ISBN_POS { HelpId = HID_BIB_ISBN_POS; } hidspecial HID_BIB_BOOKTITLE_POS { HelpId = HID_BIB_BOOKTITLE_POS; } +hidspecial HID_BIB_CHANGESOURCE { HelpId = HID_BIB_CHANGESOURCE; } hidspecial HID_BIB_CHAPTER_POS { HelpId = HID_BIB_CHAPTER_POS; } +hidspecial HID_BIB_CONTROL_PAGE { HelpId = HID_BIB_CONTROL_PAGE; } +hidspecial HID_BIB_CONTROL_PARENT { HelpId = HID_BIB_CONTROL_PARENT; } +hidspecial HID_BIB_CUSTOM1_POS { HelpId = HID_BIB_CUSTOM1_POS; } +hidspecial HID_BIB_CUSTOM2_POS { HelpId = HID_BIB_CUSTOM2_POS; } +hidspecial HID_BIB_CUSTOM3_POS { HelpId = HID_BIB_CUSTOM3_POS; } +hidspecial HID_BIB_CUSTOM4_POS { HelpId = HID_BIB_CUSTOM4_POS; } +hidspecial HID_BIB_CUSTOM5_POS { HelpId = HID_BIB_CUSTOM5_POS; } +hidspecial HID_BIB_DB_GRIDCTRL { HelpId = HID_BIB_DB_GRIDCTRL; } +hidspecial HID_BIB_DB_TBX { HelpId = HID_BIB_DB_TBX; } +hidspecial HID_BIB_DELETE_RECORD { HelpId = HID_BIB_DELETE_RECORD; } hidspecial HID_BIB_EDITION_POS { HelpId = HID_BIB_EDITION_POS; } hidspecial HID_BIB_EDITOR_POS { HelpId = HID_BIB_EDITOR_POS; } hidspecial HID_BIB_HOWPUBLISHED_POS { HelpId = HID_BIB_HOWPUBLISHED_POS; } +hidspecial HID_BIB_IDENTIFIER_POS { HelpId = HID_BIB_IDENTIFIER_POS; } +hidspecial HID_BIB_INSERT_RECORD { HelpId = HID_BIB_INSERT_RECORD; } hidspecial HID_BIB_INSTITUTION_POS { HelpId = HID_BIB_INSTITUTION_POS; } +hidspecial HID_BIB_ISBN_POS { HelpId = HID_BIB_ISBN_POS; } hidspecial HID_BIB_JOURNAL_POS { HelpId = HID_BIB_JOURNAL_POS; } +hidspecial HID_BIB_MAPPINGDLG { HelpId = HID_BIB_MAPPINGDLG; } hidspecial HID_BIB_MONTH_POS { HelpId = HID_BIB_MONTH_POS; } hidspecial HID_BIB_NOTE_POS { HelpId = HID_BIB_NOTE_POS; } -hidspecial HID_BIB_ANNOTE_POS { HelpId = HID_BIB_ANNOTE_POS; } hidspecial HID_BIB_NUMBER_POS { HelpId = HID_BIB_NUMBER_POS; } hidspecial HID_BIB_ORGANIZATIONS_POS { HelpId = HID_BIB_ORGANIZATIONS_POS; } hidspecial HID_BIB_PAGES_POS { HelpId = HID_BIB_PAGES_POS; } hidspecial HID_BIB_PUBLISHER_POS { HelpId = HID_BIB_PUBLISHER_POS; } -hidspecial HID_BIB_ADDRESS_POS { HelpId = HID_BIB_ADDRESS_POS; } +hidspecial HID_BIB_REPORTTYPE_POS { HelpId = HID_BIB_REPORTTYPE_POS; } hidspecial HID_BIB_SCHOOL_POS { HelpId = HID_BIB_SCHOOL_POS; } hidspecial HID_BIB_SERIES_POS { HelpId = HID_BIB_SERIES_POS; } -hidspecial HID_BIB_REPORTTYPE_POS { HelpId = HID_BIB_REPORTTYPE_POS; } -hidspecial HID_BIB_VOLUME_POS { HelpId = HID_BIB_VOLUME_POS; } +hidspecial HID_BIB_TBX_AUTOFILTER { HelpId = HID_BIB_TBX_AUTOFILTER; } +hidspecial HID_BIB_TBX_SEARCH { HelpId = HID_BIB_TBX_SEARCH; } +hidspecial HID_BIB_TBX_TABLE { HelpId = HID_BIB_TBX_TABLE; } +hidspecial HID_BIB_TITLE_POS { HelpId = HID_BIB_TITLE_POS; } hidspecial HID_BIB_URL_POS { HelpId = HID_BIB_URL_POS; } -hidspecial HID_BIB_CUSTOM1_POS { HelpId = HID_BIB_CUSTOM1_POS; } -hidspecial HID_BIB_CUSTOM2_POS { HelpId = HID_BIB_CUSTOM2_POS; } -hidspecial HID_BIB_CUSTOM3_POS { HelpId = HID_BIB_CUSTOM3_POS; } -hidspecial HID_BIB_CUSTOM4_POS { HelpId = HID_BIB_CUSTOM4_POS; } -hidspecial HID_BIB_CUSTOM5_POS { HelpId = HID_BIB_CUSTOM5_POS; } - -hidspecial HID_BIB_DB_TBX { HelpId = HID_BIB_DB_TBX; } -hidspecial HID_BIB_DB_GRIDCTRL { HelpId = HID_BIB_DB_GRIDCTRL; } -hidspecial HID_BIB_CONTROL_PAGE { HelpId = HID_BIB_CONTROL_PAGE; } -hidspecial HID_BIB_CONTROL_PARENT { HelpId = HID_BIB_CONTROL_PARENT; } - -hidspecial HID_GRIDWIZARD_PREVIOUS { HelpId = HID_GRIDWIZARD_PREVIOUS; }; -hidspecial HID_GRIDWIZARD_NEXT { HelpId = HID_GRIDWIZARD_NEXT; } -hidspecial HID_GRIDWIZARD_CANCEL { HelpId = HID_GRIDWIZARD_CANCEL; } -hidspecial HID_GRIDWIZARD_FINISH { HelpId = HID_GRIDWIZARD_FINISH; } -hidspecial HID_GROUPWIZARD_PREVIOUS { HelpId = HID_GROUPWIZARD_PREVIOUS; } -hidspecial HID_GROUPWIZARD_NEXT { HelpId = HID_GROUPWIZARD_NEXT; } -hidspecial HID_GROUPWIZARD_CANCEL { HelpId = HID_GROUPWIZARD_CANCEL; } -hidspecial HID_GROUPWIZARD_FINISH { HelpId = HID_GROUPWIZARD_FINISH; } -hidspecial HID_LISTWIZARD_PREVIOUS { HelpId = HID_LISTWIZARD_PREVIOUS; } -hidspecial HID_LISTWIZARD_NEXT { HelpId = HID_LISTWIZARD_NEXT; } -hidspecial HID_LISTWIZARD_CANCEL { HelpId = HID_LISTWIZARD_CANCEL; } -hidspecial HID_LISTWIZARD_FINISH { HelpId = HID_LISTWIZARD_FINISH; } -hidspecial HID_DBIWIZARD_PREVIOUS { HelpId = HID_DBIWIZARD_PREVIOUS; } -hidspecial HID_DBIWIZARD_NEXT { HelpId = HID_DBIWIZARD_NEXT; } -hidspecial HID_DBIWIZARD_CANCEL { HelpId = HID_DBIWIZARD_CANCEL; } -hidspecial HID_DBIWIZARD_FINISH { HelpId = HID_DBIWIZARD_FINISH; } -hidspecial UID_DBIWIZARD_SOURCESTATS { HelpId = UID_DBIWIZARD_SOURCESTATS; } -hidspecial UID_DBIWIZARD_SOURCEFILE { HelpId = UID_DBIWIZARD_SOURCEFILE; } -hidspecial UID_DBIWIZARD_QUERIES { HelpId = UID_DBIWIZARD_QUERIES; } -hidspecial UID_DBIWIZARD_FORMS { HelpId = UID_DBIWIZARD_FORMS; } -hidspecial UID_DBIWIZARD_FORMS_SAVETO { HelpId = UID_DBIWIZARD_FORMS_SAVETO; } -hidspecial UID_BIB_FRAME_WINDOW { HelpId = UID_BIB_FRAME_WINDOW;} +hidspecial HID_BIB_VOLUME_POS { HelpId = HID_BIB_VOLUME_POS; } +hidspecial HID_BIB_YEAR_POS { HelpId = HID_BIB_YEAR_POS; } -hidspecial HID_ABSPILOT_PREVIOUS { HelpId = HID_ABSPILOT_PREVIOUS; } -hidspecial HID_ABSPILOT_NEXT { HelpId = HID_ABSPILOT_NEXT; } -hidspecial HID_ABSPILOT_CANCEL { HelpId = HID_ABSPILOT_CANCEL; } -hidspecial HID_ABSPILOT_FINISH { HelpId = HID_ABSPILOT_FINISH; } -hidspecial HID_ABSPILOT { HelpId = HID_ABSPILOT; } +hidspecial HID_CHECK_FOR_UPD_CANCEL { HelpId = HID_CHECK_FOR_UPD_CANCEL; } +hidspecial HID_CHECK_FOR_UPD_CLOSE { HelpId = HID_CHECK_FOR_UPD_CLOSE; } +hidspecial HID_CHECK_FOR_UPD_DESCRIPTION { HelpId = HID_CHECK_FOR_UPD_DESCRIPTION; } +hidspecial HID_CHECK_FOR_UPD_DLG { HelpId = HID_CHECK_FOR_UPD_DLG; } +hidspecial HID_CHECK_FOR_UPD_DOWNLOAD { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD; } +hidspecial HID_CHECK_FOR_UPD_DOWNLOAD2 { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD2; } +hidspecial HID_CHECK_FOR_UPD_INSTALL { HelpId = HID_CHECK_FOR_UPD_INSTALL; } +hidspecial HID_CHECK_FOR_UPD_PAUSE { HelpId = HID_CHECK_FOR_UPD_PAUSE; } +hidspecial HID_CHECK_FOR_UPD_RESUME { HelpId = HID_CHECK_FOR_UPD_RESUME; } +hidspecial HID_CHECK_FOR_UPD_STATUS { HelpId = HID_CHECK_FOR_UPD_STATUS; } -hidspecial UID_ABSPILOT_HELP { HelpId = UID_ABSPILOT_HELP; } hidspecial HID_DBIWIZARD { HelpId = HID_DBIWIZARD; } -hidspecial UID_DBIWIZARD_HELP { HelpId = UID_DBIWIZARD_HELP; } +hidspecial HID_DBIWIZARD_CANCEL { HelpId = HID_DBIWIZARD_CANCEL; } hidspecial HID_DBIWIZARD_FILESELECTION { HelpId = HID_DBIWIZARD_FILESELECTION; } +hidspecial HID_DBIWIZARD_FINISH { HelpId = HID_DBIWIZARD_FINISH; } +hidspecial HID_DBIWIZARD_NEXT { HelpId = HID_DBIWIZARD_NEXT; } +hidspecial HID_DBIWIZARD_PREVIOUS { HelpId = HID_DBIWIZARD_PREVIOUS; } -hidspecial HID_BIB_DELETE_RECORD { HelpId = HID_BIB_DELETE_RECORD; } -hidspecial HID_BIB_INSERT_RECORD { HelpId = HID_BIB_INSERT_RECORD; } - -hidspecial HID_PROP_TITLE { HelpId = HID_PROP_TITLE; } -hidspecial HID_PROP_STEP { HelpId = HID_PROP_STEP; } -hidspecial HID_PROP_VALUE { HelpId = HID_PROP_VALUE; } -hidspecial HID_PROP_PROGRESSVALUE { HelpId = HID_PROP_PROGRESSVALUE; } -hidspecial HID_PROP_PROGRESSVALUE_MIN { HelpId = HID_PROP_PROGRESSVALUE_MIN; } -hidspecial HID_PROP_PROGRESSVALUE_MAX { HelpId = HID_PROP_PROGRESSVALUE_MAX; } -hidspecial HID_PROP_SCROLLVALUE { HelpId = HID_PROP_SCROLLVALUE; } -hidspecial HID_PROP_SCROLLVALUE_MIN { HelpId = HID_PROP_SCROLLVALUE_MIN; } -hidspecial HID_PROP_SCROLLVALUE_MAX { HelpId = HID_PROP_SCROLLVALUE_MAX; } -hidspecial HID_PROP_LINEINCREMENT { HelpId = HID_PROP_LINEINCREMENT; } -hidspecial HID_PROP_BLOCKINCREMENT { HelpId = HID_PROP_BLOCKINCREMENT; } -hidspecial HID_PROP_VISIBLESIZE { HelpId = HID_PROP_VISIBLESIZE; } -hidspecial HID_PROP_ORIENTATION { HelpId = HID_PROP_ORIENTATION; } -hidspecial HID_PROP_POSITIONX { HelpId = HID_PROP_POSITIONX; } -hidspecial HID_PROP_POSITIONY { HelpId = HID_PROP_POSITIONY; } -hidspecial HID_PROP_PUSHBUTTONTYPE { HelpId = HID_PROP_PUSHBUTTONTYPE; } -hidspecial HID_PROP_STATE { HelpId = HID_PROP_STATE; } -hidspecial HID_PROP_SCALEIMAGE { HelpId = HID_PROP_SCALEIMAGE; } -hidspecial HID_PROP_BOUND_CELL { HelpId = HID_PROP_BOUND_CELL; } -hidspecial HID_PROP_LIST_CELL_RANGE { HelpId = HID_PROP_LIST_CELL_RANGE; } -hidspecial HID_PROP_CELL_EXCHANGE_TYPE { HelpId = HID_PROP_CELL_EXCHANGE_TYPE; } -hidspecial HID_PROP_SELECTEDITEMS { HelpId = HID_PROP_SELECTEDITEMS; } -hidspecial HID_PROP_SCROLLVALUEMIN { HelpId = HID_PROP_SCROLLVALUE_MIN; } -hidspecial HID_PROP_DEFAULT_SCROLLVALUE { HelpId = HID_PROP_DEFAULT_SCROLLVALUE; } -hidspecial HID_PROP_REPEAT_DELAY { HelpId = HID_PROP_REPEAT_DELAY; } -hidspecial HID_PROP_SYMBOLCOLOR { HelpId = HID_PROP_SYMBOLCOLOR; } -hidspecial HID_PROP_SPINVALUE { HelpId = HID_PROP_SPINVALUE; } -hidspecial HID_PROP_SPINVALUE_MIN { HelpId = HID_PROP_SPINVALUE_MIN; } -hidspecial HID_PROP_SPINVALUE_MAX { HelpId = HID_PROP_SPINVALUE_MAX; } -hidspecial HID_PROP_DEFAULT_SPINVALUE { HelpId = HID_PROP_DEFAULT_SPINVALUE; } -hidspecial HID_PROP_SPININCREMENT { HelpId = HID_PROP_SPININCREMENT; } -hidspecial HID_PROP_REPEAT { HelpId = HID_PROP_REPEAT; } -hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; } -hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; } -hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; } -hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; } -hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; } -hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; } -hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; } -hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; } -hidspecial UID_PROP_DLG_SYMBOLCOLOR { HelpId = UID_PROP_DLG_SYMBOLCOLOR; } -hidspecial UID_EVT_MACRODLG { HelpId = UID_EVT_MACRODLG; } -hidspecial HID_PROP_WORDBREAK { HelpId = HID_PROP_WORDBREAK; } -hidspecial HID_PROP_SHOW_SCROLLBARS { HelpId = HID_PROP_SHOW_SCROLLBARS; } -hidspecial HID_PROP_TABORDER_CONTROLS { HelpId = HID_PROP_TABORDER_CONTROLS; } -hidspecial HID_PROP_ICONSIZE { HelpId = HID_PROP_ICONSIZE; } -hidspecial HID_PROP_SHOW_POSITION { HelpId = HID_PROP_SHOW_POSITION; } -hidspecial HID_PROP_SHOW_NAVIGATION { HelpId = HID_PROP_SHOW_NAVIGATION; } -hidspecial HID_PROP_SHOW_RECORDACTIONS { HelpId = HID_PROP_SHOW_RECORDACTIONS; } -hidspecial HID_PROP_SHOW_FILTERSORT { HelpId = HID_PROP_SHOW_FILTERSORT; } - -hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; } -hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; } -hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; } -hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; } -hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; } -hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; } -hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; } -hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; } -hidspecial UID_PROP_DLG_TABINDEX { HelpId = UID_PROP_DLG_TABINDEX; } -hidspecial UID_PROP_DLG_SQLCOMMAND { HelpId = UID_PROP_DLG_SQLCOMMAND; } -hidspecial UID_PROP_DLG_FORMLINKFIELDS { HelpId = UID_PROP_DLG_FORMLINKFIELDS; } -hidspecial HID_FIELDLINK_DETAIL_COLUMN { HelpId = HID_FIELDLINK_DETAIL_COLUMN; } -hidspecial HID_FIELDLINK_MASTER_COLUMN { HelpId = HID_FIELDLINK_MASTER_COLUMN; } -hidspecial UID_FIELDLINK_DETAIL1 { HelpId = UID_FIELDLINK_DETAIL1; } -hidspecial UID_FIELDLINK_MASTER1 { HelpId = UID_FIELDLINK_MASTER1; } -hidspecial UID_FIELDLINK_DETAIL2 { HelpId = UID_FIELDLINK_DETAIL2; } -hidspecial UID_FIELDLINK_MASTER2 { HelpId = UID_FIELDLINK_MASTER2; } -hidspecial UID_FIELDLINK_DETAIL3 { HelpId = UID_FIELDLINK_DETAIL3; } -hidspecial UID_FIELDLINK_MASTER3 { HelpId = UID_FIELDLINK_MASTER3; } -hidspecial UID_FIELDLINK_DETAIL4 { HelpId = UID_FIELDLINK_DETAIL4; } -hidspecial UID_FIELDLINK_MASTER4 { HelpId = UID_FIELDLINK_MASTER4; } -hidspecial UID_PROP_DLG_FILTER { HelpId = UID_PROP_DLG_FILTER; } -hidspecial UID_PROP_DLG_ORDER { HelpId = UID_PROP_DLG_ORDER; } -hidspecial UID_PROP_DLG_SELECTION { HelpId = UID_PROP_DLG_SELECTION; } -hidspecial UID_PROP_DLG_SYMBOLCOLOR { HelpId = UID_PROP_DLG_SYMBOLCOLOR; } -hidspecial UID_BRWEVT_APPROVEACTIONPERFORMED { HelpId = UID_BRWEVT_APPROVEACTIONPERFORMED; } -hidspecial UID_BRWEVT_ACTIONPERFORMED { HelpId = UID_BRWEVT_ACTIONPERFORMED; } -hidspecial UID_BRWEVT_CHANGED { HelpId = UID_BRWEVT_CHANGED; } -hidspecial UID_BRWEVT_TEXTCHANGED { HelpId = UID_BRWEVT_TEXTCHANGED; } -hidspecial UID_BRWEVT_ITEMSTATECHANGED { HelpId = UID_BRWEVT_ITEMSTATECHANGED; } -hidspecial UID_BRWEVT_FOCUSGAINED { HelpId = UID_BRWEVT_FOCUSGAINED; } -hidspecial UID_BRWEVT_FOCUSLOST { HelpId = UID_BRWEVT_FOCUSLOST; } -hidspecial UID_BRWEVT_KEYTYPED { HelpId = UID_BRWEVT_KEYTYPED; } -hidspecial UID_BRWEVT_KEYUP { HelpId = UID_BRWEVT_KEYUP; } -hidspecial UID_BRWEVT_MOUSEENTERED { HelpId = UID_BRWEVT_MOUSEENTERED; } -hidspecial UID_BRWEVT_MOUSEDRAGGED { HelpId = UID_BRWEVT_MOUSEDRAGGED; } -hidspecial UID_BRWEVT_MOUSEMOVED { HelpId = UID_BRWEVT_MOUSEMOVED; } -hidspecial UID_BRWEVT_MOUSEPRESSED { HelpId = UID_BRWEVT_MOUSEPRESSED; } -hidspecial UID_BRWEVT_MOUSERELEASED { HelpId = UID_BRWEVT_MOUSERELEASED; } -hidspecial UID_BRWEVT_MOUSEEXITED { HelpId = UID_BRWEVT_MOUSEEXITED; } -hidspecial UID_BRWEVT_APPROVERESETTED { HelpId = UID_BRWEVT_APPROVERESETTED; } -hidspecial UID_BRWEVT_RESETTED { HelpId = UID_BRWEVT_RESETTED; } -hidspecial UID_BRWEVT_SUBMITTED { HelpId = UID_BRWEVT_SUBMITTED; } -hidspecial UID_BRWEVT_BEFOREUPDATE { HelpId = UID_BRWEVT_BEFOREUPDATE; } -hidspecial UID_BRWEVT_AFTERUPDATE { HelpId = UID_BRWEVT_AFTERUPDATE; } -hidspecial UID_BRWEVT_LOADED { HelpId = UID_BRWEVT_LOADED; } -hidspecial UID_BRWEVT_RELOADING { HelpId = UID_BRWEVT_RELOADING; } -hidspecial UID_BRWEVT_RELOADED { HelpId = UID_BRWEVT_RELOADED; } -hidspecial UID_BRWEVT_UNLOADING { HelpId = UID_BRWEVT_UNLOADING; } -hidspecial UID_BRWEVT_UNLOADED { HelpId = UID_BRWEVT_UNLOADED; } -hidspecial UID_BRWEVT_CONFIRMDELETE { HelpId = UID_BRWEVT_CONFIRMDELETE; } -hidspecial UID_BRWEVT_APPROVEROWCHANGE { HelpId = UID_BRWEVT_APPROVEROWCHANGE; } -hidspecial UID_BRWEVT_ROWCHANGE { HelpId = UID_BRWEVT_ROWCHANGE; } -hidspecial UID_BRWEVT_POSITIONING { HelpId = UID_BRWEVT_POSITIONING; } -hidspecial UID_BRWEVT_POSITIONED { HelpId = UID_BRWEVT_POSITIONED; } -hidspecial UID_BRWEVT_APPROVEPARAMETER { HelpId = UID_BRWEVT_APPROVEPARAMETER; } -hidspecial UID_BRWEVT_ERROROCCURED { HelpId = UID_BRWEVT_ERROROCCURED; } -hidspecial UID_BRWEVT_ADJUSTMENTVALUECHANGED { HelpId = UID_BRWEVT_ADJUSTMENTVALUECHANGED; } -hidspecial HID_PROP_AUTOLINEBREAK { HelpId = HID_PROP_AUTOLINEBREAK; } -hidspecial HID_PROP_TEXTTYPE { HelpId = HID_PROP_TEXTTYPE; } -hidspecial HID_PROP_LINEEND_FORMAT { HelpId = HID_PROP_LINEEND_FORMAT; } +hidspecial HID_DLG_DBCHANGE { HelpId = HID_DLG_DBCHANGE; } +hidspecial HID_DLG_MAPPING { HelpId = HID_DLG_MAPPING; } hidspecial HID_EVT_ACTIONPERFORMED { HelpId = HID_EVT_ACTIONPERFORMED; } +hidspecial HID_EVT_ADJUSTMENTVALUECHANGED { HelpId = HID_EVT_ADJUSTMENTVALUECHANGED; } hidspecial HID_EVT_AFTERUPDATE { HelpId = HID_EVT_AFTERUPDATE; } +hidspecial HID_EVT_APPROVEACTIONPERFORMED { HelpId = HID_EVT_APPROVEACTIONPERFORMED; } +hidspecial HID_EVT_APPROVEPARAMETER { HelpId = HID_EVT_APPROVEPARAMETER; } +hidspecial HID_EVT_APPROVERESETTED { HelpId = HID_EVT_APPROVERESETTED; } +hidspecial HID_EVT_APPROVEROWCHANGE { HelpId = HID_EVT_APPROVEROWCHANGE; } hidspecial HID_EVT_BEFOREUPDATE { HelpId = HID_EVT_BEFOREUPDATE; } +hidspecial HID_EVT_CHANGED { HelpId = HID_EVT_CHANGED; } hidspecial HID_EVT_CONFIRMDELETE { HelpId = HID_EVT_CONFIRMDELETE; } hidspecial HID_EVT_ERROROCCURED { HelpId = HID_EVT_ERROROCCURED; } hidspecial HID_EVT_FOCUSGAINED { HelpId = HID_EVT_FOCUSGAINED; } hidspecial HID_EVT_FOCUSLOST { HelpId = HID_EVT_FOCUSLOST; } hidspecial HID_EVT_ITEMSTATECHANGED { HelpId = HID_EVT_ITEMSTATECHANGED; } hidspecial HID_EVT_KEYTYPED { HelpId = HID_EVT_KEYTYPED; } +hidspecial HID_EVT_KEYUP { HelpId = HID_EVT_KEYUP; } hidspecial HID_EVT_LOADED { HelpId = HID_EVT_LOADED; } hidspecial HID_EVT_MOUSEDRAGGED { HelpId = HID_EVT_MOUSEDRAGGED; } hidspecial HID_EVT_MOUSEENTERED { HelpId = HID_EVT_MOUSEENTERED; } @@ -240,74 +124,314 @@ hidspecial HID_EVT_MOUSEMOVED { HelpId = HID_EVT_MOUSEMOVED; } hidspecial HID_EVT_MOUSEPRESSED { HelpId = HID_EVT_MOUSEPRESSED; } hidspecial HID_EVT_MOUSERELEASED { HelpId = HID_EVT_MOUSERELEASED; } hidspecial HID_EVT_POSITIONED { HelpId = HID_EVT_POSITIONED; } +hidspecial HID_EVT_POSITIONING { HelpId = HID_EVT_POSITIONING; } +hidspecial HID_EVT_RELOADED { HelpId = HID_EVT_RELOADED; } +hidspecial HID_EVT_RELOADING { HelpId = HID_EVT_RELOADING; } hidspecial HID_EVT_RESETTED { HelpId = HID_EVT_RESETTED; } +hidspecial HID_EVT_ROWCHANGE { HelpId = HID_EVT_ROWCHANGE; } hidspecial HID_EVT_SUBMITTED { HelpId = HID_EVT_SUBMITTED; } hidspecial HID_EVT_TEXTCHANGED { HelpId = HID_EVT_TEXTCHANGED; } hidspecial HID_EVT_UNLOADED { HelpId = HID_EVT_UNLOADED; } -hidspecial HID_EVT_CHANGED { HelpId = HID_EVT_CHANGED; } -hidspecial HID_EVT_APPROVEACTIONPERFORMED { HelpId = HID_EVT_APPROVEACTIONPERFORMED; } -hidspecial HID_EVT_APPROVERESETTED { HelpId = HID_EVT_APPROVERESETTED; } -hidspecial HID_EVT_KEYUP { HelpId = HID_EVT_KEYUP; } -hidspecial HID_EVT_APPROVEPARAMETER { HelpId = HID_EVT_APPROVEPARAMETER; } -hidspecial HID_EVT_POSITIONING { HelpId = HID_EVT_POSITIONING; } -hidspecial HID_EVT_RELOADED { HelpId = HID_EVT_RELOADED; } -hidspecial HID_EVT_APPROVEROWCHANGE { HelpId = HID_EVT_APPROVEROWCHANGE; } -hidspecial HID_EVT_ROWCHANGE { HelpId = HID_EVT_ROWCHANGE; } -hidspecial HID_EVT_RELOADING { HelpId = HID_EVT_RELOADING; } hidspecial HID_EVT_UNLOADING { HelpId = HID_EVT_UNLOADING; } -hidspecial HID_EVT_ADJUSTMENTVALUECHANGED { HelpId = HID_EVT_ADJUSTMENTVALUECHANGED; } -hidspecial HID_PROP_TOGGLE { HelpId = HID_PROP_TOGGLE; } + +hidspecial HID_FIELDLINK_DETAIL_COLUMN { HelpId = HID_FIELDLINK_DETAIL_COLUMN; } +hidspecial HID_FIELDLINK_MASTER_COLUMN { HelpId = HID_FIELDLINK_MASTER_COLUMN; } + +hidspecial HID_GRIDWIZARD_CANCEL { HelpId = HID_GRIDWIZARD_CANCEL; } +hidspecial HID_GRIDWIZARD_FINISH { HelpId = HID_GRIDWIZARD_FINISH; } +hidspecial HID_GRIDWIZARD_NEXT { HelpId = HID_GRIDWIZARD_NEXT; } +hidspecial HID_GRIDWIZARD_PREVIOUS { HelpId = HID_GRIDWIZARD_PREVIOUS; }; +hidspecial HID_GROUPWIZARD_CANCEL { HelpId = HID_GROUPWIZARD_CANCEL; } +hidspecial HID_GROUPWIZARD_FINISH { HelpId = HID_GROUPWIZARD_FINISH; } +hidspecial HID_GROUPWIZARD_NEXT { HelpId = HID_GROUPWIZARD_NEXT; } +hidspecial HID_GROUPWIZARD_PREVIOUS { HelpId = HID_GROUPWIZARD_PREVIOUS; } + +hidspecial HID_LISTWIZARD_CANCEL { HelpId = HID_LISTWIZARD_CANCEL; } +hidspecial HID_LISTWIZARD_FINISH { HelpId = HID_LISTWIZARD_FINISH; } +hidspecial HID_LISTWIZARD_NEXT { HelpId = HID_LISTWIZARD_NEXT; } +hidspecial HID_LISTWIZARD_PREVIOUS { HelpId = HID_LISTWIZARD_PREVIOUS; } + +hidspecial HID_PROP_ALIGN { HelpId = HID_PROP_ALIGN; } +hidspecial HID_PROP_ALLOW_ADDITIONS { HelpId = HID_PROP_ALLOW_ADDITIONS; } +hidspecial HID_PROP_ALLOW_DELETIONS { HelpId = HID_PROP_ALLOW_DELETIONS; } +hidspecial HID_PROP_ALLOW_EDITS { HelpId = HID_PROP_ALLOW_EDITS; } +hidspecial HID_PROP_ANCHOR_TYPE { HelpId = HID_PROP_ANCHOR_TYPE; } +hidspecial HID_PROP_AUTOCOMPLETE { HelpId = HID_PROP_AUTOCOMPLETE; } +hidspecial HID_PROP_AUTOLINEBREAK { HelpId = HID_PROP_AUTOLINEBREAK; } +hidspecial HID_PROP_BACKGROUNDCOLOR { HelpId = HID_PROP_BACKGROUNDCOLOR; } +hidspecial HID_PROP_BINDING_NAME { HelpId = HID_PROP_BINDING_NAME; } +hidspecial HID_PROP_BIND_EXPRESSION { HelpId = HID_PROP_BIND_EXPRESSION; } +hidspecial HID_PROP_BLOCKINCREMENT { HelpId = HID_PROP_BLOCKINCREMENT; } +hidspecial HID_PROP_BORDER { HelpId = HID_PROP_BORDER; } +hidspecial HID_PROP_BORDERCOLOR { HelpId = HID_PROP_BORDERCOLOR; } +hidspecial HID_PROP_BOUNDCOLUMN { HelpId = HID_PROP_BOUNDCOLUMN; } +hidspecial HID_PROP_BOUND_CELL { HelpId = HID_PROP_BOUND_CELL; } +hidspecial HID_PROP_BUTTONTYPE { HelpId = HID_PROP_BUTTONTYPE; } +hidspecial HID_PROP_CELL_EXCHANGE_TYPE { HelpId = HID_PROP_CELL_EXCHANGE_TYPE; } +hidspecial HID_PROP_CLASSID { HelpId = HID_PROP_CLASSID; } +hidspecial HID_PROP_CONTROLLABEL { HelpId = HID_PROP_CONTROLLABEL; } +hidspecial HID_PROP_CONTROLSOURCE { HelpId = HID_PROP_CONTROLSOURCE; } +hidspecial HID_PROP_CURRENCYSYMBOL { HelpId = HID_PROP_CURRENCYSYMBOL; } +hidspecial HID_PROP_CURRSYM_POSITION { HelpId = HID_PROP_CURRSYM_POSITION; } +hidspecial HID_PROP_CURSORSOURCE { HelpId = HID_PROP_CURSORSOURCE; } +hidspecial HID_PROP_CURSORSOURCETYPE { HelpId = HID_PROP_CURSORSOURCETYPE; } +hidspecial HID_PROP_CURSORTYPE { HelpId = HID_PROP_CURSORTYPE; } +hidspecial HID_PROP_CYCLE { HelpId = HID_PROP_CYCLE; } +hidspecial HID_PROP_DATAENTRY { HelpId = HID_PROP_DATAENTRY; } +hidspecial HID_PROP_DATASOURCE { HelpId = HID_PROP_DATASOURCE; } +hidspecial HID_PROP_DATE { HelpId = HID_PROP_DATE; } +hidspecial HID_PROP_DATEFORMAT { HelpId = HID_PROP_DATEFORMAT; } +hidspecial HID_PROP_DATEMAX { HelpId = HID_PROP_DATEMAX; } +hidspecial HID_PROP_DATEMIN { HelpId = HID_PROP_DATEMIN; } +hidspecial HID_PROP_DECIMAL_ACCURACY { HelpId = HID_PROP_DECIMAL_ACCURACY; } +hidspecial HID_PROP_DECORATION { HelpId = HID_PROP_DECORATION; } +hidspecial HID_PROP_DEFAULTVALUE { HelpId = HID_PROP_DEFAULTVALUE; } +hidspecial HID_PROP_DEFAULT_BUTTON { HelpId = HID_PROP_DEFAULT_BUTTON; } +hidspecial HID_PROP_DEFAULT_DATE { HelpId = HID_PROP_DEFAULT_DATE; } +hidspecial HID_PROP_DEFAULT_LONG_VALUE { HelpId = HID_PROP_DEFAULT_LONG_VALUE; } +hidspecial HID_PROP_DEFAULT_SCROLLVALUE { HelpId = HID_PROP_DEFAULT_SCROLLVALUE; } +hidspecial HID_PROP_DEFAULT_SELECT_SEQ { HelpId = HID_PROP_DEFAULT_SELECT_SEQ; } +hidspecial HID_PROP_DEFAULT_SPINVALUE { HelpId = HID_PROP_DEFAULT_SPINVALUE; } +hidspecial HID_PROP_DEFAULT_STATE { HelpId = HID_PROP_DEFAULT_STATE; } +hidspecial HID_PROP_DEFAULT_TIME { HelpId = HID_PROP_DEFAULT_TIME; } +hidspecial HID_PROP_DIRTY { HelpId = HID_PROP_DIRTY; } +hidspecial HID_PROP_DROPDOWN { HelpId = HID_PROP_DROPDOWN; } +hidspecial HID_PROP_ECHO_CHAR { HelpId = HID_PROP_ECHO_CHAR; } +hidspecial HID_PROP_EDITABLE { HelpId = HID_PROP_EDITABLE; } +hidspecial HID_PROP_EDITMASK { HelpId = HID_PROP_EDITMASK; } +hidspecial HID_PROP_EFFECTIVEDEFAULT { HelpId = HID_PROP_EFFECTIVEDEFAULT; } +hidspecial HID_PROP_EFFECTIVEMAX { HelpId = HID_PROP_EFFECTIVEMAX; } +hidspecial HID_PROP_EFFECTIVEMIN { HelpId = HID_PROP_EFFECTIVEMIN; } +hidspecial HID_PROP_EMPTY_IS_NULL { HelpId = HID_PROP_EMPTY_IS_NULL; } +hidspecial HID_PROP_ENABLED { HelpId = HID_PROP_ENABLED; } +hidspecial HID_PROP_ENABLE_VISIBLE { HelpId = HID_PROP_ENABLE_VISIBLE; } +hidspecial HID_PROP_ESCAPE_PROCESSING { HelpId = HID_PROP_ESCAPE_PROCESSING; } +hidspecial HID_PROP_FILLCOLOR { HelpId = HID_PROP_FILLCOLOR; } +hidspecial HID_PROP_FILTER { HelpId = HID_PROP_FILTER; } +hidspecial HID_PROP_FILTERPROPOSAL { HelpId = HID_PROP_FILTERPROPOSAL; } hidspecial HID_PROP_FOCUSONCLICK { HelpId = HID_PROP_FOCUSONCLICK; } +hidspecial HID_PROP_FONT { HelpId = HID_PROP_FONT; } +hidspecial HID_PROP_FORMATKEY { HelpId = HID_PROP_FORMATKEY; } +hidspecial HID_PROP_GROUPBOX { HelpId = HID_PROP_GROUPBOX; } +hidspecial HID_PROP_HEIGHT { HelpId = HID_PROP_HEIGHT; } +hidspecial HID_PROP_HELPTEXT { HelpId = HID_PROP_HELPTEXT; } +hidspecial HID_PROP_HELPURL { HelpId = HID_PROP_HELPURL; } +hidspecial HID_PROP_HIDDEN_VALUE { HelpId = HID_PROP_HIDDEN_VALUE; } hidspecial HID_PROP_HIDEINACTIVESELECTION { HelpId = HID_PROP_HIDEINACTIVESELECTION; } -hidspecial HID_PROP_VISUALEFFECT { HelpId = HID_PROP_VISUALEFFECT; } -hidspecial HID_PROP_BORDERCOLOR { HelpId = HID_PROP_BORDERCOLOR; } -hidspecial UID_PROP_DLG_BORDERCOLOR { HelpId = UID_PROP_DLG_BORDERCOLOR; } +hidspecial HID_PROP_HSCROLL { HelpId = HID_PROP_HSCROLL; } +hidspecial HID_PROP_ICONSIZE { HelpId = HID_PROP_ICONSIZE; } hidspecial HID_PROP_IMAGEPOSITION { HelpId = HID_PROP_IMAGEPOSITION; } +hidspecial HID_PROP_IMAGE_URL { HelpId = HID_PROP_IMAGE_URL; } +hidspecial HID_PROP_INPUT_REQUIRED { HelpId = HID_PROP_INPUT_REQUIRED; } +hidspecial HID_PROP_INVOKES_STOP_NOT_EDITING { HelpId = HID_PROP_INVOKES_STOP_NOT_EDITING; } +hidspecial HID_PROP_LABEL { HelpId = HID_PROP_LABEL; } +hidspecial HID_PROP_LEFT { HelpId = HID_PROP_LEFT; } +hidspecial HID_PROP_LINECOLOR { HelpId = HID_PROP_LINECOLOR; } +hidspecial HID_PROP_LINECOUNT { HelpId = HID_PROP_LINECOUNT; } +hidspecial HID_PROP_LINEEND_FORMAT { HelpId = HID_PROP_LINEEND_FORMAT; } +hidspecial HID_PROP_LINEINCREMENT { HelpId = HID_PROP_LINEINCREMENT; } +hidspecial HID_PROP_LISTINDEX { HelpId = HID_PROP_LISTINDEX; } +hidspecial HID_PROP_LISTSOURCE { HelpId = HID_PROP_LISTSOURCE; } +hidspecial HID_PROP_LISTSOURCETYPE { HelpId = HID_PROP_LISTSOURCETYPE; } +hidspecial HID_PROP_LIST_BINDING { HelpId = HID_PROP_LIST_BINDING; } +hidspecial HID_PROP_LIST_CELL_RANGE { HelpId = HID_PROP_LIST_CELL_RANGE; } +hidspecial HID_PROP_LITERALMASK { HelpId = HID_PROP_LITERALMASK; } +hidspecial HID_PROP_LOCKED { HelpId = HID_PROP_LOCKED; } +hidspecial HID_PROP_MASTERFIELDS { HelpId = HID_PROP_MASTERFIELDS; } +hidspecial HID_PROP_MAXTEXTLEN { HelpId = HID_PROP_MAXTEXTLEN; } +hidspecial HID_PROP_MULTILINE { HelpId = HID_PROP_MULTILINE; } +hidspecial HID_PROP_MULTISELECTION { HelpId = HID_PROP_MULTISELECTION; } +hidspecial HID_PROP_NAME { HelpId = HID_PROP_NAME; } +hidspecial HID_PROP_NAVIGATION { HelpId = HID_PROP_NAVIGATION; } +hidspecial HID_PROP_NAVIGATIONBAR { HelpId = HID_PROP_NAVIGATIONBAR; } +hidspecial HID_PROP_NOLABEL { HelpId = HID_PROP_NOLABEL; } +hidspecial HID_PROP_OLDVALUE { HelpId = HID_PROP_OLDVALUE; } +hidspecial HID_PROP_ORIENTATION { HelpId = HID_PROP_ORIENTATION; } +hidspecial HID_PROP_POSITIONX { HelpId = HID_PROP_POSITIONX; } +hidspecial HID_PROP_POSITIONY { HelpId = HID_PROP_POSITIONY; } +hidspecial HID_PROP_PRINTABLE { HelpId = HID_PROP_PRINTABLE; } +hidspecial HID_PROP_PROGRESSVALUE { HelpId = HID_PROP_PROGRESSVALUE; } +hidspecial HID_PROP_PROGRESSVALUE_MAX { HelpId = HID_PROP_PROGRESSVALUE_MAX; } +hidspecial HID_PROP_PROGRESSVALUE_MIN { HelpId = HID_PROP_PROGRESSVALUE_MIN; } +hidspecial HID_PROP_PUSHBUTTONTYPE { HelpId = HID_PROP_PUSHBUTTONTYPE; } +hidspecial HID_PROP_READONLY { HelpId = HID_PROP_READONLY; } +hidspecial HID_PROP_RECORDMARKER { HelpId = HID_PROP_RECORDMARKER; } +hidspecial HID_PROP_REFVALUE { HelpId = HID_PROP_REFVALUE; } +hidspecial HID_PROP_REPEAT { HelpId = HID_PROP_REPEAT; } +hidspecial HID_PROP_REPEAT_DELAY { HelpId = HID_PROP_REPEAT_DELAY; } +hidspecial HID_PROP_REQUIRED { HelpId = HID_PROP_REQUIRED; } +hidspecial HID_PROP_RIGHT { HelpId = HID_PROP_RIGHT; } +hidspecial HID_PROP_ROOT_DISPLAYED { HelpId = HID_PROP_ROOT_DISPLAYED; } +hidspecial HID_PROP_ROWHEIGHT { HelpId = HID_PROP_ROWHEIGHT; } +hidspecial HID_PROP_ROW_HEIGHT { HelpId = HID_PROP_ROW_HEIGHT; } +hidspecial HID_PROP_SCALEIMAGE { HelpId = HID_PROP_SCALEIMAGE; } +hidspecial HID_PROP_SCROLLVALUE { HelpId = HID_PROP_SCROLLVALUE; } +hidspecial HID_PROP_SCROLLVALUEMIN { HelpId = HID_PROP_SCROLLVALUE_MIN; } +hidspecial HID_PROP_SCROLLVALUE_MAX { HelpId = HID_PROP_SCROLLVALUE_MAX; } +hidspecial HID_PROP_SCROLLVALUE_MIN { HelpId = HID_PROP_SCROLLVALUE_MIN; } +hidspecial HID_PROP_SEARCHING { HelpId = HID_PROP_SEARCHING; } +hidspecial HID_PROP_SELECTEDITEMS { HelpId = HID_PROP_SELECTEDITEMS; } +hidspecial HID_PROP_SELECTION_TYPE { HelpId = HID_PROP_SELECTION_TYPE; } +hidspecial HID_PROP_SHOWS_HANDLES { HelpId = HID_PROP_SHOWS_HANDLES; } +hidspecial HID_PROP_SHOWS_ROOT_HANDLES { HelpId = HID_PROP_SHOWS_ROOT_HANDLES; } +hidspecial HID_PROP_SHOWTHOUSANDSEP { HelpId = HID_PROP_SHOWTHOUSANDSEP; } +hidspecial HID_PROP_SHOW_FILTERSORT { HelpId = HID_PROP_SHOW_FILTERSORT; } +hidspecial HID_PROP_SHOW_NAVIGATION { HelpId = HID_PROP_SHOW_NAVIGATION; } +hidspecial HID_PROP_SHOW_POSITION { HelpId = HID_PROP_SHOW_POSITION; } +hidspecial HID_PROP_SHOW_RECORDACTIONS { HelpId = HID_PROP_SHOW_RECORDACTIONS; } +hidspecial HID_PROP_SHOW_SCROLLBARS { HelpId = HID_PROP_SHOW_SCROLLBARS; } +hidspecial HID_PROP_SLAVEFIELDS { HelpId = HID_PROP_SLAVEFIELDS; } +hidspecial HID_PROP_SORT_CRITERIA { HelpId = HID_PROP_SORT_CRITERIA; } +hidspecial HID_PROP_SPIN { HelpId = HID_PROP_SPIN; } +hidspecial HID_PROP_SPININCREMENT { HelpId = HID_PROP_SPININCREMENT; } +hidspecial HID_PROP_SPINVALUE { HelpId = HID_PROP_SPINVALUE; } +hidspecial HID_PROP_SPINVALUE_MAX { HelpId = HID_PROP_SPINVALUE_MAX; } +hidspecial HID_PROP_SPINVALUE_MIN { HelpId = HID_PROP_SPINVALUE_MIN; } +hidspecial HID_PROP_STATE { HelpId = HID_PROP_STATE; } +hidspecial HID_PROP_STEP { HelpId = HID_PROP_STEP; } +hidspecial HID_PROP_STRICTFORMAT { HelpId = HID_PROP_STRICTFORMAT; } +hidspecial HID_PROP_STRINGITEMLIST { HelpId = HID_PROP_STRINGITEMLIST; } +hidspecial HID_PROP_SUBMISSION_ID { HelpId = HID_PROP_SUBMISSION_ID; } +hidspecial HID_PROP_SUBMIT_ACTION { HelpId = HID_PROP_SUBMIT_ACTION; } +hidspecial HID_PROP_SUBMIT_ENCODING { HelpId = HID_PROP_SUBMIT_ENCODING; } +hidspecial HID_PROP_SUBMIT_METHOD { HelpId = HID_PROP_SUBMIT_METHOD; } +hidspecial HID_PROP_SUBMIT_TARGET { HelpId = HID_PROP_SUBMIT_TARGET; } +hidspecial HID_PROP_SYMBOLCOLOR { HelpId = HID_PROP_SYMBOLCOLOR; } +hidspecial HID_PROP_TABINDEX { HelpId = HID_PROP_TABINDEX; } +hidspecial HID_PROP_TABORDER_CONTROLS { HelpId = HID_PROP_TABORDER_CONTROLS; } +hidspecial HID_PROP_TABSTOP { HelpId = HID_PROP_TABSTOP; } +hidspecial HID_PROP_TAG { HelpId = HID_PROP_TAG; } +hidspecial HID_PROP_TARGET_FRAME { HelpId = HID_PROP_TARGET_FRAME; } +hidspecial HID_PROP_TARGET_URL { HelpId = HID_PROP_TARGET_URL; } +hidspecial HID_PROP_TEXT { HelpId = HID_PROP_TEXT; } +hidspecial HID_PROP_TEXTTYPE { HelpId = HID_PROP_TEXTTYPE; } +hidspecial HID_PROP_TIME { HelpId = HID_PROP_TIME; } +hidspecial HID_PROP_TIMEFORMAT { HelpId = HID_PROP_TIMEFORMAT; } +hidspecial HID_PROP_TIMEMAX { HelpId = HID_PROP_TIMEMAX; } +hidspecial HID_PROP_TIMEMIN { HelpId = HID_PROP_TIMEMIN; } +hidspecial HID_PROP_TITLE { HelpId = HID_PROP_TITLE; } +hidspecial HID_PROP_TOGGLE { HelpId = HID_PROP_TOGGLE; } +hidspecial HID_PROP_TRISTATE { HelpId = HID_PROP_TRISTATE; } +hidspecial HID_PROP_UNCHECKEDREFVALUE { HelpId = HID_PROP_UNCHECKEDREFVALUE; } +hidspecial HID_PROP_UNIQUE { HelpId = HID_PROP_UNIQUE; } +hidspecial HID_PROP_VALUE { HelpId = HID_PROP_VALUE; } +hidspecial HID_PROP_VALUEMAX { HelpId = HID_PROP_VALUEMAX; } +hidspecial HID_PROP_VALUEMIN { HelpId = HID_PROP_VALUEMIN; } +hidspecial HID_PROP_VALUESTEP { HelpId = HID_PROP_VALUESTEP; } +hidspecial HID_PROP_VERTICAL_ALIGN { HelpId = HID_PROP_VERTICAL_ALIGN; } +hidspecial HID_PROP_VISIBLESIZE { HelpId = HID_PROP_VISIBLESIZE; } +hidspecial HID_PROP_VISUALEFFECT { HelpId = HID_PROP_VISUALEFFECT; } +hidspecial HID_PROP_VSCROLL { HelpId = HID_PROP_VSCROLL; } +hidspecial HID_PROP_WHEEL_BEHAVIOR { HelpId = HID_PROP_WHEEL_BEHAVIOR; } +hidspecial HID_PROP_WIDTH { HelpId = HID_PROP_WIDTH; } +hidspecial HID_PROP_WORDBREAK { HelpId = HID_PROP_WORDBREAK; } +hidspecial HID_PROP_WRITING_MODE { HelpId = HID_PROP_WRITING_MODE; } hidspecial HID_PROP_XML_DATA_MODEL { HelpId = HID_PROP_XML_DATA_MODEL; } -hidspecial HID_PROP_BIND_EXPRESSION { HelpId = HID_PROP_BIND_EXPRESSION; } -hidspecial HID_PROP_XSD_REQUIRED { HelpId = HID_PROP_XSD_REQUIRED; } -hidspecial HID_PROP_XSD_RELEVANT { HelpId = HID_PROP_XSD_RELEVANT; } -hidspecial HID_PROP_XSD_READONLY { HelpId = HID_PROP_XSD_READONLY; } -hidspecial HID_PROP_XSD_CONSTRAINT { HelpId = HID_PROP_XSD_CONSTRAINT; } hidspecial HID_PROP_XSD_CALCULATION { HelpId = HID_PROP_XSD_CALCULATION; } +hidspecial HID_PROP_XSD_CONSTRAINT { HelpId = HID_PROP_XSD_CONSTRAINT; } hidspecial HID_PROP_XSD_DATA_TYPE { HelpId = HID_PROP_XSD_DATA_TYPE; } -hidspecial HID_PROP_XSD_WHITESPACES { HelpId = HID_PROP_XSD_WHITESPACES; } -hidspecial HID_PROP_XSD_PATTERN { HelpId = HID_PROP_XSD_PATTERN; } +hidspecial HID_PROP_XSD_FRACTION_DIGITS { HelpId = HID_PROP_XSD_FRACTION_DIGITS; } hidspecial HID_PROP_XSD_LENGTH { HelpId = HID_PROP_XSD_LENGTH; } -hidspecial HID_PROP_XSD_MIN_LENGTH { HelpId = HID_PROP_XSD_MIN_LENGTH; } +hidspecial HID_PROP_XSD_MAX_EXCLUSIVE { HelpId = HID_PROP_XSD_MAX_EXCLUSIVE; } +hidspecial HID_PROP_XSD_MAX_INCLUSIVE { HelpId = HID_PROP_XSD_MAX_INCLUSIVE; } hidspecial HID_PROP_XSD_MAX_LENGTH { HelpId = HID_PROP_XSD_MAX_LENGTH; } +hidspecial HID_PROP_XSD_MIN_EXCLUSIVE { HelpId = HID_PROP_XSD_MIN_EXCLUSIVE; } +hidspecial HID_PROP_XSD_MIN_INCLUSIVE { HelpId = HID_PROP_XSD_MIN_INCLUSIVE; } +hidspecial HID_PROP_XSD_MIN_LENGTH { HelpId = HID_PROP_XSD_MIN_LENGTH; } +hidspecial HID_PROP_XSD_PATTERN { HelpId = HID_PROP_XSD_PATTERN; } +hidspecial HID_PROP_XSD_READONLY { HelpId = HID_PROP_XSD_READONLY; } +hidspecial HID_PROP_XSD_RELEVANT { HelpId = HID_PROP_XSD_RELEVANT; } +hidspecial HID_PROP_XSD_REQUIRED { HelpId = HID_PROP_XSD_REQUIRED; } +hidspecial HID_PROP_XSD_TOTAL_DIGITS { HelpId = HID_PROP_XSD_TOTAL_DIGITS; } +hidspecial HID_PROP_XSD_WHITESPACES { HelpId = HID_PROP_XSD_WHITESPACES; } + +hidspecial HID_PROTOCOLS { HelpId = HID_PROTOCOLS; } +hidspecial HID_SELECTION_TLB { HelpId = HID_SELECTION_TLB; } + +hidspecial UID_ABSPILOT_HELP { HelpId = UID_ABSPILOT_HELP; } +hidspecial UID_BIB_FRAME_WINDOW { HelpId = UID_BIB_FRAME_WINDOW;} + +hidspecial UID_BRWEVT_ACTIONPERFORMED { HelpId = UID_BRWEVT_ACTIONPERFORMED; } +hidspecial UID_BRWEVT_ADJUSTMENTVALUECHANGED { HelpId = UID_BRWEVT_ADJUSTMENTVALUECHANGED; } +hidspecial UID_BRWEVT_AFTERUPDATE { HelpId = UID_BRWEVT_AFTERUPDATE; } +hidspecial UID_BRWEVT_APPROVEACTIONPERFORMED { HelpId = UID_BRWEVT_APPROVEACTIONPERFORMED; } +hidspecial UID_BRWEVT_APPROVEPARAMETER { HelpId = UID_BRWEVT_APPROVEPARAMETER; } +hidspecial UID_BRWEVT_APPROVERESETTED { HelpId = UID_BRWEVT_APPROVERESETTED; } +hidspecial UID_BRWEVT_APPROVEROWCHANGE { HelpId = UID_BRWEVT_APPROVEROWCHANGE; } +hidspecial UID_BRWEVT_BEFOREUPDATE { HelpId = UID_BRWEVT_BEFOREUPDATE; } +hidspecial UID_BRWEVT_CHANGED { HelpId = UID_BRWEVT_CHANGED; } +hidspecial UID_BRWEVT_CONFIRMDELETE { HelpId = UID_BRWEVT_CONFIRMDELETE; } +hidspecial UID_BRWEVT_ERROROCCURED { HelpId = UID_BRWEVT_ERROROCCURED; } +hidspecial UID_BRWEVT_FOCUSGAINED { HelpId = UID_BRWEVT_FOCUSGAINED; } +hidspecial UID_BRWEVT_FOCUSLOST { HelpId = UID_BRWEVT_FOCUSLOST; } +hidspecial UID_BRWEVT_ITEMSTATECHANGED { HelpId = UID_BRWEVT_ITEMSTATECHANGED; } +hidspecial UID_BRWEVT_KEYTYPED { HelpId = UID_BRWEVT_KEYTYPED; } +hidspecial UID_BRWEVT_KEYUP { HelpId = UID_BRWEVT_KEYUP; } +hidspecial UID_BRWEVT_LOADED { HelpId = UID_BRWEVT_LOADED; } +hidspecial UID_BRWEVT_MOUSEDRAGGED { HelpId = UID_BRWEVT_MOUSEDRAGGED; } +hidspecial UID_BRWEVT_MOUSEENTERED { HelpId = UID_BRWEVT_MOUSEENTERED; } +hidspecial UID_BRWEVT_MOUSEEXITED { HelpId = UID_BRWEVT_MOUSEEXITED; } +hidspecial UID_BRWEVT_MOUSEMOVED { HelpId = UID_BRWEVT_MOUSEMOVED; } +hidspecial UID_BRWEVT_MOUSEPRESSED { HelpId = UID_BRWEVT_MOUSEPRESSED; } +hidspecial UID_BRWEVT_MOUSERELEASED { HelpId = UID_BRWEVT_MOUSERELEASED; } +hidspecial UID_BRWEVT_POSITIONED { HelpId = UID_BRWEVT_POSITIONED; } +hidspecial UID_BRWEVT_POSITIONING { HelpId = UID_BRWEVT_POSITIONING; } +hidspecial UID_BRWEVT_RELOADED { HelpId = UID_BRWEVT_RELOADED; } +hidspecial UID_BRWEVT_RELOADING { HelpId = UID_BRWEVT_RELOADING; } +hidspecial UID_BRWEVT_RESETTED { HelpId = UID_BRWEVT_RESETTED; } +hidspecial UID_BRWEVT_ROWCHANGE { HelpId = UID_BRWEVT_ROWCHANGE; } +hidspecial UID_BRWEVT_SUBMITTED { HelpId = UID_BRWEVT_SUBMITTED; } +hidspecial UID_BRWEVT_TEXTCHANGED { HelpId = UID_BRWEVT_TEXTCHANGED; } +hidspecial UID_BRWEVT_UNLOADED { HelpId = UID_BRWEVT_UNLOADED; } +hidspecial UID_BRWEVT_UNLOADING { HelpId = UID_BRWEVT_UNLOADING; } + +hidspecial UID_DBIWIZARD_FORMS { HelpId = UID_DBIWIZARD_FORMS; } +hidspecial UID_DBIWIZARD_FORMS_SAVETO { HelpId = UID_DBIWIZARD_FORMS_SAVETO; } +hidspecial UID_DBIWIZARD_HELP { HelpId = UID_DBIWIZARD_HELP; } +hidspecial UID_DBIWIZARD_QUERIES { HelpId = UID_DBIWIZARD_QUERIES; } +hidspecial UID_DBIWIZARD_SOURCEFILE { HelpId = UID_DBIWIZARD_SOURCEFILE; } +hidspecial UID_DBIWIZARD_SOURCESTATS { HelpId = UID_DBIWIZARD_SOURCESTATS; } + +hidspecial UID_EVT_MACRODLG { HelpId = UID_EVT_MACRODLG; } + +hidspecial UID_FIELDLINK_DETAIL1 { HelpId = UID_FIELDLINK_DETAIL1; } +hidspecial UID_FIELDLINK_DETAIL2 { HelpId = UID_FIELDLINK_DETAIL2; } +hidspecial UID_FIELDLINK_DETAIL3 { HelpId = UID_FIELDLINK_DETAIL3; } +hidspecial UID_FIELDLINK_DETAIL4 { HelpId = UID_FIELDLINK_DETAIL4; } +hidspecial UID_FIELDLINK_MASTER1 { HelpId = UID_FIELDLINK_MASTER1; } +hidspecial UID_FIELDLINK_MASTER2 { HelpId = UID_FIELDLINK_MASTER2; } +hidspecial UID_FIELDLINK_MASTER3 { HelpId = UID_FIELDLINK_MASTER3; } +hidspecial UID_FIELDLINK_MASTER4 { HelpId = UID_FIELDLINK_MASTER4; } + +hidspecial UID_PROP_ADD_DATA_TYPE { HelpId = UID_PROP_ADD_DATA_TYPE; } +hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; } +hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; } +hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; } +hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; } +hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; } +hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; } hidspecial UID_PROP_DLG_BIND_EXPRESSION { HelpId = UID_PROP_DLG_BIND_EXPRESSION; } -hidspecial UID_PROP_DLG_XSD_REQUIRED { HelpId = UID_PROP_DLG_XSD_REQUIRED; } -hidspecial UID_PROP_DLG_XSD_RELEVANT { HelpId = UID_PROP_DLG_XSD_RELEVANT; } -hidspecial UID_PROP_DLG_XSD_READONLY { HelpId = UID_PROP_DLG_XSD_READONLY; } -hidspecial UID_PROP_DLG_XSD_CONSTRAINT { HelpId = UID_PROP_DLG_XSD_CONSTRAINT; } +hidspecial UID_PROP_DLG_BORDERCOLOR { HelpId = UID_PROP_DLG_BORDERCOLOR; } +hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; } +hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; } +hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; } +hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; } +hidspecial UID_PROP_DLG_FILTER { HelpId = UID_PROP_DLG_FILTER; } +hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; } +hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; } +hidspecial UID_PROP_DLG_FORMLINKFIELDS { HelpId = UID_PROP_DLG_FORMLINKFIELDS; } +hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; } +hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; } +hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; } +hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; } +hidspecial UID_PROP_DLG_ORDER { HelpId = UID_PROP_DLG_ORDER; } +hidspecial UID_PROP_DLG_SELECTION { HelpId = UID_PROP_DLG_SELECTION; } +hidspecial UID_PROP_DLG_SQLCOMMAND { HelpId = UID_PROP_DLG_SQLCOMMAND; } +hidspecial UID_PROP_DLG_SYMBOLCOLOR { HelpId = UID_PROP_DLG_SYMBOLCOLOR; } +hidspecial UID_PROP_DLG_TABINDEX { HelpId = UID_PROP_DLG_TABINDEX; } hidspecial UID_PROP_DLG_XSD_CALCULATION { HelpId = UID_PROP_DLG_XSD_CALCULATION; } -hidspecial UID_PROP_ADD_DATA_TYPE { HelpId = UID_PROP_ADD_DATA_TYPE; } +hidspecial UID_PROP_DLG_XSD_CONSTRAINT { HelpId = UID_PROP_DLG_XSD_CONSTRAINT; } +hidspecial UID_PROP_DLG_XSD_READONLY { HelpId = UID_PROP_DLG_XSD_READONLY; } +hidspecial UID_PROP_DLG_XSD_RELEVANT { HelpId = UID_PROP_DLG_XSD_RELEVANT; } +hidspecial UID_PROP_DLG_XSD_REQUIRED { HelpId = UID_PROP_DLG_XSD_REQUIRED; } hidspecial UID_PROP_REMOVE_DATA_TYPE { HelpId = UID_PROP_REMOVE_DATA_TYPE; } -hidspecial HID_PROP_XSD_TOTAL_DIGITS { HelpId = HID_PROP_XSD_TOTAL_DIGITS; } -hidspecial HID_PROP_XSD_FRACTION_DIGITS { HelpId = HID_PROP_XSD_FRACTION_DIGITS; } -hidspecial HID_PROP_XSD_MAX_INCLUSIVE { HelpId = HID_PROP_XSD_MAX_INCLUSIVE; } -hidspecial HID_PROP_XSD_MAX_EXCLUSIVE { HelpId = HID_PROP_XSD_MAX_EXCLUSIVE; } -hidspecial HID_PROP_XSD_MIN_INCLUSIVE { HelpId = HID_PROP_XSD_MIN_INCLUSIVE; } -hidspecial HID_PROP_XSD_MIN_EXCLUSIVE { HelpId = HID_PROP_XSD_MIN_EXCLUSIVE; } -hidspecial HID_PROP_UNCHECKEDREFVALUE { HelpId = HID_PROP_UNCHECKEDREFVALUE; } -hidspecial HID_PROP_SUBMISSION_ID { HelpId = HID_PROP_SUBMISSION_ID; } -hidspecial HID_PROP_LIST_BINDING { HelpId = HID_PROP_LIST_BINDING; } -hidspecial HID_PROP_BINDING_NAME { HelpId = HID_PROP_BINDING_NAME; } - -hidspecial HID_CHECK_FOR_UPD_DLG { HelpId = HID_CHECK_FOR_UPD_DLG; } -hidspecial HID_CHECK_FOR_UPD_CLOSE { HelpId = HID_CHECK_FOR_UPD_CLOSE; } -hidspecial HID_CHECK_FOR_UPD_PAUSE { HelpId = HID_CHECK_FOR_UPD_PAUSE; } -hidspecial HID_CHECK_FOR_UPD_RESUME { HelpId = HID_CHECK_FOR_UPD_RESUME; } -hidspecial HID_CHECK_FOR_UPD_DOWNLOAD { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD; } -hidspecial HID_CHECK_FOR_UPD_DOWNLOAD2 { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD2; } -hidspecial HID_CHECK_FOR_UPD_INSTALL { HelpId = HID_CHECK_FOR_UPD_INSTALL; } -hidspecial HID_CHECK_FOR_UPD_STATUS { HelpId = HID_CHECK_FOR_UPD_STATUS; } -hidspecial HID_CHECK_FOR_UPD_DESCRIPTION { HelpId = HID_CHECK_FOR_UPD_DESCRIPTION; } -hidspecial HID_CHECK_FOR_UPD_CANCEL { HelpId = HID_CHECK_FOR_UPD_CANCEL; } -hidspecial HID_PROP_NOLABEL { HelpId = HID_PROP_NOLABEL; } -hidspecial HID_PROP_INPUT_REQUIRED { HelpId = HID_PROP_INPUT_REQUIRED; } -hidspecial HID_PROP_WRITING_MODE { HelpId = HID_PROP_WRITING_MODE; } -hidspecial HID_PROP_ENABLE_VISIBLE { HelpId = HID_PROP_ENABLE_VISIBLE; } -hidspecial HID_PROP_WHEEL_BEHAVIOR { HelpId = HID_PROP_WHEEL_BEHAVIOR; } -hidspecial HID_PROP_ANCHOR_TYPE { HelpId = HID_PROP_ANCHOR_TYPE; } diff --git a/forms/qa/integration/forms/TestSkeleton.java b/forms/qa/integration/forms/TestSkeleton.java index f16083664cbe..8f2765b3a6d5 100644 --- a/forms/qa/integration/forms/TestSkeleton.java +++ b/forms/qa/integration/forms/TestSkeleton.java @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: TestSkeleton.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,61 +26,50 @@ ************************************************************************/ package integration.forms; -import com.sun.star.uno.UnoRuntime; - -import com.sun.star.lang.XMultiServiceFactory; - -import com.sun.star.util.XCloseable; +import com.sun.star.uno.Exception; -import integration.forms.DocumentHelper; - -public class TestSkeleton extends complexlib.ComplexTestCase +public class TestSkeleton extends TestCase { - private DocumentHelper m_document; - private FormLayer m_formLayer; - private XMultiServiceFactory m_orb; - - /** Creates a new instance of ValueBinding */ + /** Creates a new instance of TestSkeleton */ public TestSkeleton() { + super( DocumentType.WRITER ); } /* ------------------------------------------------------------------ */ public String[] getTestMethodNames() { return new String[] { - "checkSomething" + "checkTestSkeleton" }; } /* ------------------------------------------------------------------ */ public String getTestObjectName() { - return "Form Control Spreadsheet Cell Binding Test"; + return "Test Skeleton"; + } + + /* ------------------------------------------------------------------ */ + public void checkTestSkeleton() throws com.sun.star.uno.Exception, java.lang.Exception + { } /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception + public void before() throws Exception, java.lang.Exception { - m_orb = (XMultiServiceFactory)param.getMSF(); - m_document = DocumentHelper.blankTextDocument( m_orb ); - m_formLayer = new FormLayer( m_document ); + super.before(); } /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception + public void after() throws Exception, java.lang.Exception { - // close our document - if ( m_document != null ) - { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, - m_document.getDocument() ); - closeDoc.close( true ); - } + super.before(); } /* ------------------------------------------------------------------ */ - public void checkSomething() throws com.sun.star.uno.Exception, java.lang.Exception + protected void prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception { + super.prepareDocument(); } -} + } diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index ed3e85a905ec..23c05be9f89f 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -2151,9 +2151,9 @@ sal_Bool OBoundControlModel::connectToField(const Reference<XRowSet>& rForm) try { + sal_Int32 nFieldType = DataType::OTHER; if ( xFieldCandidate.is() ) { - sal_Int32 nFieldType = 0; xFieldCandidate->getPropertyValue( PROPERTY_FIELDTYPE ) >>= nFieldType; if ( approveDbColumnType( nFieldType ) ) impl_setField_noNotify( xFieldCandidate ); @@ -2165,6 +2165,8 @@ sal_Bool OBoundControlModel::connectToField(const Reference<XRowSet>& rForm) { if( m_xField->getPropertySetInfo()->hasPropertyByName( PROPERTY_VALUE ) ) { + m_nFieldType = nFieldType; + // an wertaenderungen horchen m_xField->addPropertyChangeListener( PROPERTY_VALUE, this ); m_xColumnUpdate = Reference< XColumnUpdate >( m_xField, UNO_QUERY ); diff --git a/forms/util/makefile.mk b/forms/util/makefile.mk index 1e99e6446f47..17f594ba7c4f 100644 --- a/forms/util/makefile.mk +++ b/forms/util/makefile.mk @@ -73,7 +73,7 @@ SHL1STDLIBS= \ $(COMPHELPERLIB) \ $(DBTOOLSLIB) \ $(TKLIB) \ - $(SVXLIB) \ + $(SVXCORELIB) \ $(UCBHELPERLIB) \ $(LIBXML2LIB) \ $(ICUUCLIB) \ diff --git a/setup_native/prj/build.lst b/setup_native/prj/build.lst index fcb276075a09..e3690f14381a 100644 --- a/setup_native/prj/build.lst +++ b/setup_native/prj/build.lst @@ -2,6 +2,7 @@ pk setup_native : soltools xml2cmp sal officecfg unoil NULL pk setup_native usr1 - all sn_mkout NULL pk setup_native\scripts\source nmake - u sn_source NULL pk setup_native\scripts nmake - u sn_scripts sn_source.u NULL +pk setup_native\source\mac nmake - u sn_mac NULL pk setup_native\source\win32\customactions\tools nmake - w sn_tools NULL pk setup_native\source\win32\customactions\relnotes nmake - w sn_relnotes NULL pk setup_native\source\win32\customactions\rebase nmake - w sn_rebase NULL diff --git a/setup_native/prj/d.lst b/setup_native/prj/d.lst index a5df50320a73..3be9984f8728 100644 --- a/setup_native/prj/d.lst +++ b/setup_native/prj/d.lst @@ -19,6 +19,7 @@ mkdir: %_DEST%\bin%_EXT%\userscripts ..\%__SRC%\bin\javaloader.sh %_DEST%\bin%_EXT%\javaloader.sh ..\%__SRC%\bin\stclient_wrapper.sh %_DEST%\bin%_EXT%\stclient_wrapper ..\%__SRC%\bin\stclient_wrapper.exe %_DEST%\bin%_EXT%\stclient_wrapper.exe +..\%__SRC%\misc\mac_ulffiles_dest\*.ulf %_DEST%\bin%_EXT%\*.ulf ..\source\win32\msi-encodinglist.txt %_DEST%\bin%_EXT%\msi-encodinglist.txt ..\source\win32\patchlist.txt %_DEST%\bin%_EXT%\patchlist.txt ..\source\win32\desktophelper.txt %_DEST%\bin%_EXT%\desktophelper.txt @@ -27,6 +28,8 @@ mkdir: %_DEST%\bin%_EXT%\userscripts ..\source\win32\nsis\*.ico %_DEST%\bin%_EXT%\*.ico ..\source\win32\nsis\*.bmp %_DEST%\bin%_EXT%\*.bmp ..\source\linux\*.dat %_DEST%\bin%_EXT%\*.dat +..\source\mac\*.icns %_DEST%\bin%_EXT%\*.icns +..\source\mac\Info.plist.langpack %_DEST%\bin%_EXT%\Info.plist.langpack ..\source\java\openofficeorg_setup.gif %_DEST%\bin%_EXT%\osl\Setup.gif ..\source\java\javaversion.dat %_DEST%\bin%_EXT%\javaversion.dat ..\source\java\javaversion2.dat %_DEST%\bin%_EXT%\javaversion2.dat @@ -35,6 +38,9 @@ mkdir: %_DEST%\bin%_EXT%\userscripts ..\source\packinfo\*.pcp %_DEST%\bin%_EXT%\*.pcp ..\scripts\admin.pl %_DEST%\bin%_EXT%\admin.pl ..\scripts\*.txt %_DEST%\bin%_EXT%\*.txt +..\scripts\mac_install.script %_DEST%\bin%_EXT%\mac_install.script +..\scripts\osx_install_languagepack.applescript %_DEST%\bin%_EXT%\osx_install_languagepack.applescript +..\scripts\osx_install_patch.applescript %_DEST%\bin%_EXT%\osx_install_patch.applescript ..\%__SRC%\lib\getuid.so %_DEST%\bin%_EXT%\getuid.so diff --git a/setup_native/scripts/mac_install.script b/setup_native/scripts/mac_install.script new file mode 100644 index 000000000000..2b34da1b04ed --- /dev/null +++ b/setup_native/scripts/mac_install.script @@ -0,0 +1,10 @@ +#!/bin/bash + +# shell script as a workaraound since it is hard to impossible to store compiled +# applescript in CVS and running osacompile would require a GUI session while +# building (or root privileges) +# using osascript only works when the shell script is camouflaged as application + +MY_DIR=$(dirname "$0") + +osascript "$MY_DIR/osx_install.applescript" diff --git a/setup_native/scripts/osx_install_languagepack.applescript b/setup_native/scripts/osx_install_languagepack.applescript new file mode 100644 index 000000000000..33d376adec1b --- /dev/null +++ b/setup_native/scripts/osx_install_languagepack.applescript @@ -0,0 +1,115 @@ +(* +This script is meant to + 1) Identify installed instances of the product + 2) check whether the user has write-access (and if not + ask for authentification) + 3) install the shipped tarball +*) + +-- strings for localisations - to be meant to be replaced +-- by a makefile or similar +set OKLabel to "[OKLabel]" +set InstallLabel to "[InstallLabel]" +set AbortLabel to "[AbortLabel]" +set intro to "[IntroText1] + +[IntroText2] + +[IntroText3]" +set chooseMyOwn to "[ChooseMyOwnText]" +set listPrompt to "[ListPromptText]" +set chooseManual to "[ChooseManualText]" +set listOKLabel to "[ListOKLabelText]" +set listCancelLabel to "[ListCancelLabel]" +set appInvalid to "[AppInvalidText1] + +[AppInvalidText2]" -- string will begin with the chosen application's name +set startInstall to "[StartInstallText1] + +[StartInstallText2]" +set IdentifyQ to "[IdentifyQText] + +[IdentifyQText2]" +set IdentifyYES to "[IdentifyYES]" +set IdentifyNO to "[IdentifyNO]" +set installFailed to "[InstallFailedText]" +set installComplete to "[InstallCompleteText] + +[InstallCompleteText2]" + +set sourcedir to (do shell script "dirname " & quoted form of POSIX path of (path to of me)) + +display dialog intro buttons {AbortLabel, InstallLabel} default button 2 + +if (button returned of result) is AbortLabel then + return 2 +end if + +set the found_ooos to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLPRODUCTNAME].app'\"") & " +" & chooseMyOwn + +-- the choice returned is of type "list" +-- Show selection dialog only if more than one or no product was found +if (get first paragraph of found_ooos) is "" then + set the choice to (choose from list of paragraphs in found_ooos default items (get last paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +else if (get second paragraph of found_ooos) is chooseMyOwn then + -- set choice to found installation + set the choice to (get first paragraph of found_ooos) +else + set the choice to (choose from list of paragraphs in found_ooos default items (get first paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +end if + +-- now only check whether the path is really from [PRODUCTNAME] +try + do shell script "grep '<string>[PRODUCTNAME] [PRODUCTVERSION]' " & quoted form of (choice as string) & "/Contents/Info.plist" +on error + display dialog (choice as string) & appInvalid buttons {InstallLabel} default button 1 with icon 0 + return 3 --wrong target-directory +end try + +(* +display dialog startInstall buttons {AbortLabel, InstallLabel} default button 2 + +if (button returned of result) is AbortLabel then + return 2 +end if +*) + +set tarCommand to "/usr/bin/tar -C " & quoted form of (choice as string) & " -xjf " & quoted form of sourcedir & "/tarball.tar.bz2" +try + do shell script tarCommand + +on error errMSG number errNUM + display dialog IdentifyQ buttons {IdentifyYES, IdentifyNO} with icon 2 + if (button returned of result) is IdentifyYES then + try + do shell script tarCommand with administrator privileges + on error errMSG number errNUM + display dialog installFailed buttons {OKLabel} default button 1 with icon 0 + -- -60005 username/password wrong + -- -128 aborted by user + -- 2 error from tar - tarball not found (easy to test) + return errNUM + end try + else + return 2 -- aborted by user + end if +end try + +display dialog installComplete buttons {OKLabel} default button 1 diff --git a/setup_native/scripts/osx_install_patch.applescript b/setup_native/scripts/osx_install_patch.applescript new file mode 100644 index 000000000000..33a9d4126339 --- /dev/null +++ b/setup_native/scripts/osx_install_patch.applescript @@ -0,0 +1,113 @@ +(* +This script is meant to + 1) Identify installed instances of the product + 2) check whether the user has write-access (and if not + ask for authentification) + 3) install the shipped tarball +*) + +-- strings for localisations - to be meant to be replaced +-- by a makefile or similar +set OKLabel to "[OKLabel]" +set InstallLabel to "[InstallLabel]" +set AbortLabel to "[AbortLabel]" +set intro to "[IntroText1] + +[IntroText2] + +[IntroText3]" +set chooseMyOwn to "[ChooseMyOwnText]" +set listPrompt to "[ListPromptText]" +set chooseManual to "[ChooseManualText]" +set listOKLabel to "[ListOKLabelText]" +set listCancelLabel to "[ListCancelLabel]" +set appInvalid to "[AppInvalidText1] + +[AppInvalidText2]" -- string will begin with the chosen application's name +set startInstall to "[StartInstallText1] + +[StartInstallText2]" +set IdentifyQ to "[IdentifyQText] + +[IdentifyQText2]" +set IdentifyYES to "[IdentifyYES]" +set IdentifyNO to "[IdentifyNO]" +set installFailed to "[InstallFailedText]" +set installComplete to "[InstallCompleteTextPatch]" + +set sourcedir to (do shell script "dirname " & quoted form of POSIX path of (path to of me)) + +display dialog intro buttons {AbortLabel, InstallLabel} default button 2 + +if (button returned of result) is AbortLabel then + return 2 +end if + +set the found_ooos to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLPRODUCTNAME].app'\"") & " +" & chooseMyOwn + +-- the choice returned is of type "list" +-- Show selection dialog only if more than one or no product was found +if (get first paragraph of found_ooos) is "" then + set the choice to (choose from list of paragraphs in found_ooos default items (get last paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +else if (get second paragraph of found_ooos) is chooseMyOwn then + -- set choice to found installation + set the choice to (get first paragraph of found_ooos) +else + set the choice to (choose from list of paragraphs in found_ooos default items (get first paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel) + if choice is false then + -- do nothing, the user cancelled the installation + return 2 --aborted by user + else if (choice as string) is chooseMyOwn then + -- yeah, one needs to use "choose file", otherwise + -- the user would not be able to select the .app + set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles) + end if +end if + +-- now only check whether the path is really from [PRODUCTNAME] +try + do shell script "grep '<string>[PRODUCTNAME] [PRODUCTVERSION]' " & quoted form of (choice as string) & "/Contents/Info.plist" +on error + display dialog (choice as string) & appInvalid buttons {InstallLabel} default button 1 with icon 0 + return 3 --wrong target-directory +end try + +(* +display dialog startInstall buttons {AbortLabel, InstallLabel} default button 2 + +if (button returned of result) is AbortLabel then + return 2 +end if +*) + +set tarCommand to "/usr/bin/tar -C " & quoted form of (choice as string) & " -xjf " & quoted form of sourcedir & "/tarball.tar.bz2" +try + do shell script tarCommand + +on error errMSG number errNUM + display dialog IdentifyQ buttons {IdentifyYES, IdentifyNO} with icon 2 + if (button returned of result) is IdentifyYES then + try + do shell script tarCommand with administrator privileges + on error errMSG number errNUM + display dialog installFailed buttons {OKLabel} default button 1 with icon 0 + -- -60005 username/password wrong + -- -128 aborted by user + -- 2 error from tar - tarball not found (easy to test) + return errNUM + end try + else + return 2 -- aborted by user + end if +end try + +display dialog installComplete buttons {OKLabel} default button 1 diff --git a/setup_native/scripts/source/getuid.c b/setup_native/scripts/source/getuid.c index 926c2b809af2..9af63f4f079d 100644 --- a/setup_native/scripts/source/getuid.c +++ b/setup_native/scripts/source/getuid.c @@ -88,13 +88,29 @@ int fstatat64(int fildes, const char *path, struct stat64 *buf, int flag) return ret; } - -#elif defined LINUX +#elif defined LINUX uid_t getuid (void) {return 0;} uid_t geteuid (void) {return 0;} /* This is to fool tar */ +#ifdef X86_64 +int __lxstat(int n, const char *path, struct stat *buf) +{ + int ret = 0; + static int (*p_lstat) (int n, const char *path, struct stat *buf) = NULL; + if (p_lstat == NULL) + p_lstat = (int (*)(int n, const char *path, struct stat *buf)) + dlsym (RTLD_NEXT, "__lxstat"); + ret = (*p_lstat)(n, path, buf); + if (buf != NULL) + { + buf->st_uid = 0; /* root */ + buf->st_gid = 0; /* root */ + } + return ret; +} +#else int __lxstat64(int n, const char *path, struct stat64 *buf) { int ret = 0; @@ -105,13 +121,12 @@ int __lxstat64(int n, const char *path, struct stat64 *buf) ret = (*p_lstat)(n, path, buf); if (buf != NULL) { - buf->st_uid = 0; /* root */ - buf->st_gid = 0; /* root */ + buf->st_uid = 0; + buf->st_gid = 0; } - return ret; } - +#endif #endif #ifdef _cplusplus diff --git a/setup_native/source/java/javaversion2.dat b/setup_native/source/java/javaversion2.dat index e997838421b6..87172c3a6495 100644 --- a/setup_native/source/java/javaversion2.dat +++ b/setup_native/source/java/javaversion2.dat @@ -30,30 +30,30 @@ #************************************************************************* # GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})") -JAVAVERSION=Java 6 Update 15 -WINDOWSJAVAVERSION=Java 6 Update 15 +JAVAVERSION=Java 6 Update 16 +WINDOWSJAVAVERSION=Java 6 Update 16 # Windows (scp2 and downloadtemplate.nsi) -WINDOWSJAVAFILENAME=jre-6u15-windows-i586.exe -WINDOWSJAVAREGISTRYENTRY=1.6.0_15 +WINDOWSJAVAFILENAME=jre-6u16-windows-i586.exe +WINDOWSJAVAREGISTRYENTRY=1.6.0_16 # Linux (scp2) -LINUXJAVAFILENAME=jre-6u15-linux-i586.rpm +LINUXJAVAFILENAME=jre-6u16-linux-i586.rpm # Linux (rpmUnit.xml, rpm -qp <filename> ) -LINUXJAVANAME=jre-1.6.0_15-fcs +LINUXJAVANAME=jre-1.6.0_16-fcs # Linux-x64 (scp2) -LINUXX64JAVAFILENAME=jre-6u15-linux-amd64.rpm +LINUXX64JAVAFILENAME=jre-6u16-linux-amd64.rpm # Solaris Sparc (scp2) -SOLSJAVARTPACKED=SUNWj6rt_1_6_0_15_sparc.tar.gz -SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_15_sparc.tar.gz -SOLSJAVAMANPACKED=SUNWj6man_1_6_0_15_sparc.tar.gz +SOLSJAVARTPACKED=SUNWj6rt_1_6_0_16_sparc.tar.gz +SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_16_sparc.tar.gz +SOLSJAVAMANPACKED=SUNWj6man_1_6_0_16_sparc.tar.gz # Solaris x86 (scp2) -SOLIJAVARTPACKED=SUNWj6rt_1_6_0_15_x86.tar.gz -SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_15_x86.tar.gz -SOLIJAVAMANPACKED=SUNWj6man_1_6_0_15_x86.tar.gz +SOLIJAVARTPACKED=SUNWj6rt_1_6_0_16_x86.tar.gz +SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_16_x86.tar.gz +SOLIJAVAMANPACKED=SUNWj6man_1_6_0_16_x86.tar.gz # Solaris (pkgUnit.xml, needs only to be changed in major changes) SOLARISJAVART=SUNWj6rt diff --git a/setup_native/source/mac/Info.plist.langpack b/setup_native/source/mac/Info.plist.langpack new file mode 100644 index 000000000000..3c1eb2c6f369 --- /dev/null +++ b/setup_native/source/mac/Info.plist.langpack @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <!-- UTI declarations for OS X >= 10.4 --> + <key>UTExportedTypeDeclarations</key> + + <key>UTImportedTypeDeclarations</key> + + <key>CFBundleExecutable</key> + <string>[FULLPRODUCTNAME]</string> + <key>CFBundleGetInfoString</key> + <string>[FULLPRODUCTNAME]</string> + <key>CFBundleIconFile</key> + <string>ooo3_installer.icns</string> + <key>CFBundleShortVersionString</key> + <string>9</string> + <key>CFBundleIdentifier</key> + <string>org.openoffice.script</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>[FULLPRODUCTNAME]</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>OOo3</string> + <key>LSRequiresCarbon</key> + <string>1</string> + <key>NSPrincipalClass</key> + <string>VCL_NSApplication</string> +</dict> +</plist> + diff --git a/setup_native/source/mac/macinstall.ulf b/setup_native/source/mac/macinstall.ulf new file mode 100644 index 000000000000..4651d93e03ab --- /dev/null +++ b/setup_native/source/mac/macinstall.ulf @@ -0,0 +1,68 @@ +[OKLabel] +en-US = "Ok" + +[InstallLabel] +en-US = "Install" + +[AbortLabel] +en-US = "Abort" + +[IntroText1] +en-US = "Welcome to the [FULLPRODUCTNAME] Installation Wizard" + +[IntroText2] +en-US = "This installation will update your installed versions of [PRODUCTNAME]" + +[IntroText3] +en-US = "This might take a moment." + +[ChooseMyOwnText] +en-US = "Not listed (choose location in an extra step)" + +[ListPromptText] +en-US = "Choose [PRODUCTNAME] [PRODUCTVERSION] installation for which you want to install the [FULLPRODUCTNAME]" + +[ChooseManualText] +en-US = "Point the dialog to your [PRODUCTNAME] [PRODUCTVERSION] installation." + +[ListOKLabelText] +en-US = "Install" + +[ListCancelLabel] +en-US = "Abort" + +[AppInvalidText1] +en-US = "This is not a valid [PRODUCTNAME] [PRODUCTVERSION] installation." + +[AppInvalidText2] +en-US = "Run the installer again and choose a valid [PRODUCTNAME] [PRODUCTVERSION] installation" + +[StartInstallText1] +en-US = "Click Install to start the installation" + +[StartInstallText2] +en-US = "Installation might take a minute..." + +[IdentifyQText] +en-US = "Installation failed, most likely your account does not have the necessary privileges." + +[IdentifyQText2] +en-US = "Do you want to identify as administrator and try again?" + +[IdentifyYES] +en-US = "Yes, identify" + +[IdentifyNO] +en-US = "No, abort installation" + +[InstallFailedText] +en-US = "Installation failed." + +[InstallCompleteText] +en-US = "Installation of [PRODUCTNAME] language pack completed." + +[InstallCompleteText2] +en-US = "Call 'Tools-Options-Language Settings' to change the user interface language." + +[InstallCompleteTextPatch] +en-US = "Installation of [FULLPRODUCTNAME] completed" diff --git a/setup_native/source/mac/makefile.mk b/setup_native/source/mac/makefile.mk new file mode 100644 index 000000000000..026073b65c44 --- /dev/null +++ b/setup_native/source/mac/makefile.mk @@ -0,0 +1,65 @@ +#************************************************************************* +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# last change: $Author: rt $ $Date: 2005-09-07 18:20:20 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=setup_native +TARGET=mac_ulffiles + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# ------------------------------------------------------------------ + +ULFFILES = macinstall.ulf + +ULFDESTFILES=$(foreach,i,$(ULFFILES) $(MISC)$/$(TARGET)_dest$/$i) + +# --- Targets ------------------------------------------------------ + +.IF "$(OS)"=="MACOSX" +ALLTAR : $(ULFDESTFILES) +.ENDIF + +.INCLUDE : target.mk + +.IF "$(WITH_LANG)"!="" +$(MISC)$/$(TARGET)_dest$/%.ulf : $(COMMONMISC)$/$(TARGET)$/%.ulf +.ELSE # "$(WITH_LANG)"!="" +$(MISC)$/$(TARGET)_dest$/%.ulf : %.ulf +.ENDIF # "$(WITH_LANG)"!="" + @-$(MKDIRHIER) $(MISC)$/$(TARGET)_dest + $(COPY) $< $@ diff --git a/setup_native/source/mac/ooo3_installer.icns b/setup_native/source/mac/ooo3_installer.icns Binary files differnew file mode 100644 index 000000000000..e064ad70479d --- /dev/null +++ b/setup_native/source/mac/ooo3_installer.icns diff --git a/setup_native/source/win32/customactions/indexingfilter/makefile.mk b/setup_native/source/win32/customactions/indexingfilter/makefile.mk index ae7fc33a524f..7f8df5bad93a 100644 --- a/setup_native/source/win32/customactions/indexingfilter/makefile.mk +++ b/setup_native/source/win32/customactions/indexingfilter/makefile.mk @@ -39,7 +39,6 @@ ENABLE_EXCEPTIONS=TRUE DYNAMIC_CRT= NO_DEFAULT_STL=TRUE USE_DEFFILE=TRUE -MINGW_NODLL=YES .INCLUDE : settings.mk diff --git a/setup_native/source/win32/customactions/javafilter/makefile.mk b/setup_native/source/win32/customactions/javafilter/makefile.mk index 0c71f1268bd8..fc9cd828dfcc 100644 --- a/setup_native/source/win32/customactions/javafilter/makefile.mk +++ b/setup_native/source/win32/customactions/javafilter/makefile.mk @@ -39,7 +39,6 @@ TARGET=jfregca NO_DEFAULT_STL=TRUE ENABLE_EXCEPTIONS=TRUE DYNAMIC_CRT= -MINGW_NODLL=YES .INCLUDE : settings.mk diff --git a/setup_native/source/win32/customactions/languagepacks/makefile.mk b/setup_native/source/win32/customactions/languagepacks/makefile.mk index 5246b4717fd5..76906308a676 100644 --- a/setup_native/source/win32/customactions/languagepacks/makefile.mk +++ b/setup_native/source/win32/customactions/languagepacks/makefile.mk @@ -40,7 +40,6 @@ ENABLE_EXCEPTIONS=TRUE NO_DEFAULT_STL=TRUE DYNAMIC_CRT= USE_DEFFILE=TRUE -MINGW_NODLL=YES .INCLUDE : settings.mk diff --git a/setup_native/source/win32/customactions/patch/makefile.mk b/setup_native/source/win32/customactions/patch/makefile.mk index 996b4fc38e5d..2f3b952aeb2c 100755 --- a/setup_native/source/win32/customactions/patch/makefile.mk +++ b/setup_native/source/win32/customactions/patch/makefile.mk @@ -39,7 +39,6 @@ ENABLE_EXCEPTIONS=TRUE NO_DEFAULT_STL=TRUE DYNAMIC_CRT= USE_DEFFILE=TRUE -MINGW_NODLL=YES .INCLUDE : settings.mk diff --git a/setup_native/source/win32/customactions/quickstarter/makefile.mk b/setup_native/source/win32/customactions/quickstarter/makefile.mk index 44ce1a2b1acf..4d56f45adeca 100644 --- a/setup_native/source/win32/customactions/quickstarter/makefile.mk +++ b/setup_native/source/win32/customactions/quickstarter/makefile.mk @@ -42,7 +42,6 @@ ENABLE_EXCEPTIONS=TRUE NO_DEFAULT_STL=TRUE DYNAMIC_CRT= USE_DEFFILE=TRUE -MINGW_NODLL=YES .INCLUDE : settings.mk diff --git a/setup_native/source/win32/customactions/regactivex/makefile.mk b/setup_native/source/win32/customactions/regactivex/makefile.mk index 45707071d33f..96300d45ba0d 100644 --- a/setup_native/source/win32/customactions/regactivex/makefile.mk +++ b/setup_native/source/win32/customactions/regactivex/makefile.mk @@ -39,7 +39,6 @@ ENABLE_EXCEPTIONS=TRUE NO_DEFAULT_STL=TRUE DYNAMIC_CRT= USE_DEFFILE=TRUE -MINGW_NODLL=YES .INCLUDE : settings.mk diff --git a/setup_native/source/win32/customactions/regpatchactivex/makefile.mk b/setup_native/source/win32/customactions/regpatchactivex/makefile.mk index 7c194e94b1d3..69511c936f0e 100644 --- a/setup_native/source/win32/customactions/regpatchactivex/makefile.mk +++ b/setup_native/source/win32/customactions/regpatchactivex/makefile.mk @@ -55,7 +55,11 @@ INCPRE+=.\Include SLOFILES = $(SLO)$/regpatchactivex.obj .IF "$(COM)"=="GCC" -SHL1STDLIBS= -lmingw32 -lstdc++ -lgcc -lmsvcrt +SHL1STDLIBS += -lstdc++ +.IF "$(MINGW_GCCLIB_EH)"=="YES" +SHL1STDLIBS += -lgcc_eh +.ENDIF +SHL1STDLIBS += -lgcc -lmingw32 -lmoldname -lmsvcrt .ELSE SHL1STDLIBS= .ENDIF diff --git a/setup_native/source/win32/customactions/relnotes/makefile.mk b/setup_native/source/win32/customactions/relnotes/makefile.mk index 8d3af6286009..b83d58468ec6 100644 --- a/setup_native/source/win32/customactions/relnotes/makefile.mk +++ b/setup_native/source/win32/customactions/relnotes/makefile.mk @@ -40,7 +40,6 @@ ENABLE_EXCEPTIONS=TRUE NO_DEFAULT_STL=TRUE DYNAMIC_CRT= USE_DEFFILE=TRUE -MINGW_NODLL=YES .INCLUDE : settings.mk diff --git a/setup_native/source/win32/customactions/shellextensions/makefile.mk b/setup_native/source/win32/customactions/shellextensions/makefile.mk index 14546c834807..e7dc9a561883 100644 --- a/setup_native/source/win32/customactions/shellextensions/makefile.mk +++ b/setup_native/source/win32/customactions/shellextensions/makefile.mk @@ -39,7 +39,6 @@ ENABLE_EXCEPTIONS=TRUE NO_DEFAULT_STL=TRUE DYNAMIC_CRT= USE_DEFFILE=TRUE -MINGW_NODLL=YES .INCLUDE : settings.mk diff --git a/setup_native/source/win32/customactions/tools/makefile.mk b/setup_native/source/win32/customactions/tools/makefile.mk index 2c6a63a6fff2..e7a6c44d6ee3 100644 --- a/setup_native/source/win32/customactions/tools/makefile.mk +++ b/setup_native/source/win32/customactions/tools/makefile.mk @@ -40,7 +40,6 @@ ENABLE_EXCEPTIONS=TRUE NO_DEFAULT_STL=TRUE DYNAMIC_CRT= USE_DEFFILE=TRUE -MINGW_NODLL=YES .INCLUDE : settings.mk diff --git a/xmlsecurity/prj/build.lst b/xmlsecurity/prj/build.lst index b9853a77c6f2..cd438326bd00 100644 --- a/xmlsecurity/prj/build.lst +++ b/xmlsecurity/prj/build.lst @@ -1,4 +1,4 @@ -xs xmlsecurity : l10n xmloff unotools offapi unoil svx MOZ:moz SO:moz_prebuilt LIBXMLSEC:libxmlsec NULL +xs xmlsecurity : l10n xmloff unotools offapi unoil svx MOZ:moz SO:moz_prebuilt LIBXMLSEC:libxmlsec NSS:nss NULL xs xmlsecurity usr1 - all xs_mkout NULL xs xmlsecurity\inc nmake - all xs_inc NULL xs xmlsecurity\source\framework nmake - all xs_fw xs_inc NULL diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index 831eb48befae..c65aed21dd3f 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -254,7 +254,8 @@ Sequence< ::com::sun::star::security::DocumentSignatureInformation > DocumentDig if (rSigInfo.Signer.is()) { try { - rSigInfo.CertificateStatus = xSecEnv->verifyCertificate(rSigInfo.Signer); + rSigInfo.CertificateStatus = xSecEnv->verifyCertificate(rSigInfo.Signer, + Sequence<Reference<css::security::XCertificate> >()); } catch (SecurityException& ) { OSL_ENSURE(0, "Verification of certificate failed"); rSigInfo.CertificateStatus = css::security::CertificateValidity::INVALID; diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 0d77d05df31c..fb9b41d5f637 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -126,7 +126,8 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif maKeyImg.SetImage( Image( XMLSEC_RES( IMG_KEY_HC ) ) ); //Verify the certificate - sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(mpDlg->mxCert); + sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(mpDlg->mxCert, + Sequence<Reference<css::security::XCertificate> >()); //We currently have two status //These errors are alloweds sal_Int32 validCertErrors = css::security::CertificateValidity::VALID @@ -481,7 +482,8 @@ void CertificateViewerCertPathTP::ActivatePage() const Reference< security::XCertificate > rCert = pCertPath[ --i ]; String sName = XmlSec::GetContentPart( rCert->getSubjectName() ); //Verify the certificate - sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert); + sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert, + Sequence<Reference<css::security::XCertificate> >()); //We currently have two status //These errors are alloweds sal_Int32 validCertErrors = css::security::CertificateValidity::VALID diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index e0c27b59c3c0..109959be1554 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -530,7 +530,8 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() { //check the validity of the cert try { - sal_Int32 certResult = xSecEnv->verifyCertificate(xCert); + sal_Int32 certResult = xSecEnv->verifyCertificate(xCert, + Sequence<css::uno::Reference<css::security::XCertificate> >()); //These errors are alloweds sal_Int32 validErrors = css::security::CertificateValidity::VALID diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index c6c71c01a677..1b35d2b968bc 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -882,7 +882,33 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: createCertificateFr return createCertificateFromRaw( rawCert ) ; } -sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& aCert ) throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException ) { + +HCERTSTORE getCertStoreForIntermediatCerts( + const Sequence< Reference< ::com::sun::star::security::XCertificate > >& seqCerts) +{ + HCERTSTORE store = NULL; + store = CertOpenStore( + CERT_STORE_PROV_MEMORY, 0, NULL, 0, NULL); + if (store == NULL) + return NULL; + + for (int i = 0; i < seqCerts.getLength(); i++) + { + Sequence<sal_Int8> data = seqCerts[i]->getEncoded(); + PCCERT_CONTEXT cert = CertCreateCertificateContext( + X509_ASN_ENCODING, ( const BYTE* )&data[0], data.getLength()); + //Adding the certificate creates a copy and not just increases the ref count + //Therefore we free later the certificate that we now add + CertAddCertificateContextToStore(store, cert, CERT_STORE_ADD_ALWAYS, NULL); + CertFreeCertificateContext(cert); + } + return store; +} +sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate( + const Reference< ::com::sun::star::security::XCertificate >& aCert, + const Sequence< Reference< ::com::sun::star::security::XCertificate > >& seqCerts) + throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException ) +{ sal_Int32 validity = 0; PCCERT_CHAIN_CONTEXT pChainContext = NULL; PCCERT_CONTEXT pCertContext = NULL; @@ -913,52 +939,50 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate( const ::com::sun chainPara.cbSize = sizeof( CERT_CHAIN_PARA ) ; chainPara.RequestedUsage = certUsage ; + + HCERTSTORE hCollectionStore = NULL; + HCERTSTORE hIntermediateCertsStore = NULL; BOOL bChain = FALSE; if( pCertContext != NULL ) { - HCERTSTORE hAdditionalStore = NULL; - HCERTSTORE hCollectionStore = NULL; - if (m_hCertStore && m_hKeyStore) + hIntermediateCertsStore = + getCertStoreForIntermediatCerts(seqCerts); + + //Merge m_hCertStore and m_hKeyStore and the store of the intermediate + //certificates into one store. + hCollectionStore = CertOpenStore( + CERT_STORE_PROV_COLLECTION , + 0 , + NULL , + 0 , + NULL + ) ; + if (hCollectionStore != NULL) { - //Merge m_hCertStore and m_hKeyStore into one store. - hCollectionStore = CertOpenStore( - CERT_STORE_PROV_COLLECTION , - 0 , - NULL , - 0 , - NULL - ) ; - if (hCollectionStore != NULL) - { - CertAddStoreToCollection ( - hCollectionStore , - m_hCertStore , - CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG , - 0) ; - CertAddStoreToCollection ( - hCollectionStore , - m_hCertStore , - CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG , - 0) ; - hAdditionalStore = hCollectionStore; - } + CertAddStoreToCollection ( + hCollectionStore , + m_hCertStore , + CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG , + 0) ; + CertAddStoreToCollection ( + hCollectionStore , + m_hCertStore , + CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG , + 0) ; + CertAddStoreToCollection ( + hCollectionStore, + hIntermediateCertsStore, + CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, + 0); } - //if the merge of both stores failed then we add only m_hCertStore - if (hAdditionalStore == NULL && m_hCertStore) - hAdditionalStore = m_hCertStore; - else if (hAdditionalStore == NULL && m_hKeyStore) - hAdditionalStore = m_hKeyStore; - else - hAdditionalStore = NULL; - //CertGetCertificateChain searches by default in MY, CA, ROOT and TRUST bChain = CertGetCertificateChain( NULL , pCertContext , NULL , //use current system time - hAdditionalStore, + hCollectionStore, &chainPara , CERT_CHAIN_REVOCATION_CHECK_CHAIN | CERT_CHAIN_TIMESTAMP_TIME , NULL , @@ -967,8 +991,6 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate( const ::com::sun if (!bChain) pChainContext = NULL; - //Close the additional store - CertCloseStore(hCollectionStore, CERT_CLOSE_STORE_CHECK_FLAG); } if(bChain && pChainContext != NULL ) @@ -1081,6 +1103,12 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate( const ::com::sun if (pChainContext) CertFreeCertificateChain(pChainContext); + //Close the additional store, do not destroy the contained certs + CertCloseStore(hCollectionStore, CERT_CLOSE_STORE_CHECK_FLAG); + //Close the temporary store containing the intermediate certificates and make + //sure all certificates are deleted. + CertCloseStore(hIntermediateCertsStore, CERT_CLOSE_STORE_CHECK_FLAG); + return validity ; } diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx index 9770d5c1cba7..f1441184602f 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx @@ -108,7 +108,11 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper4< virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > SAL_CALL createCertificateFromAscii( const ::rtl::OUString& asciiCertificate ) throw( ::com::sun::star::uno::SecurityException , ::com::sun::star::uno::RuntimeException ) ; - virtual ::sal_Int32 SAL_CALL verifyCertificate( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert ) throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ; + virtual ::sal_Int32 SAL_CALL verifyCertificate( + const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< + ::com::sun::star::security::XCertificate > >& intermediateCertificates) + throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ; virtual ::sal_Int32 SAL_CALL getCertificateCharacters( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert ) throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ; virtual ::rtl::OUString SAL_CALL getSecurityEnvironmentInformation( ) throw (::com::sun::star::uno::RuntimeException); diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index d0e6670fd2ff..4a290ae2feb5 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -28,22 +28,20 @@ * ************************************************************************/ + // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmlsecurity.hxx" + +//todo before commit: nssrenam.h is not delivered!!! +#include "nssrenam.h" +#include "cert.h" +#include "secerr.h" + #include <sal/config.h> #include "securityenvironment_nssimpl.hxx" #include "x509certificate_nssimpl.hxx" #include <rtl/uuid.h> -#include "nspr.h" -#include "nss.h" -#include "secport.h" -#include "secitem.h" -#include "secder.h" -#include "secerr.h" -#include "limits.h" -#include "certt.h" -#include "prerror.h" #include <sal/types.h> //For reasons that escape me, this is what xmlsec does when size_t is not 4 @@ -64,7 +62,7 @@ #include <xmlsecurity/biginteger.hxx> #include <rtl/logfile.h> #include <com/sun/star/task/XInteractionHandler.hpp> - +#include <vector> #include "boost/scoped_array.hpp" // MM : added for password exception @@ -84,6 +82,7 @@ using ::com::sun::star::security::XCertificate ; extern X509Certificate_NssImpl* NssCertToXCert( CERTCertificate* cert ) ; extern X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* ) ; + char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ ) { uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); @@ -748,17 +747,23 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromAs return createCertificateFromRaw( rawCert ) ; } -sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& aCert ) throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException ) { +sal_Int32 SecurityEnvironment_NssImpl :: +verifyCertificate( const Reference< csss::XCertificate >& aCert, + const Sequence< Reference< csss::XCertificate > >& intermediateCerts ) + throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException ) +{ sal_Int32 validity = 0; const X509Certificate_NssImpl* xcert ; const CERTCertificate* cert ; - + ::std::vector<CERTCertificate*> vecTmpNSSCertificates; Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY ) ; if( !xCertTunnel.is() ) { throw RuntimeException() ; } - + OSL_TRACE("[xmlsecurity] Start verification of certificate: %s", + OUStringToOString( + aCert->getIssuerName(), osl_getThreadTextEncoding()).getStr()); xcert = reinterpret_cast<X509Certificate_NssImpl*>( @@ -769,7 +774,38 @@ sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::st cert = xcert->getNssCert() ; if( cert != NULL ) + { + + //prepare the intermediate certificates + CERTCertDBHandle * certDb = m_pHandler != NULL ? m_pHandler : CERT_GetDefaultCertDB(); + for (sal_Int32 i = 0; i < intermediateCerts.getLength(); i++) { + Sequence<sal_Int8> der = intermediateCerts[i]->getEncoded(); + SECItem item; + item.type = siBuffer; + item.data = (unsigned char*)der.getArray(); + item.len = der.getLength(); + + CERTCertificate* certTmp = CERT_NewTempCertificate(certDb, &item, + NULL /* nickname */, + PR_FALSE /* isPerm */, + PR_TRUE /* copyDER */); + if (!certTmp) + { + OSL_TRACE("[xmlsecurity] Failed to add a temporary certificate: %s", + OUStringToOString(intermediateCerts[i]->getIssuerName(), + osl_getThreadTextEncoding()).getStr()); + + } + else + { + OSL_TRACE("[xmlsecurity] Added temporary certificate: %s", + certTmp->subjectName ? certTmp->subjectName : ""); + vecTmpNSSCertificates.push_back(certTmp); + } + } + + int64 timeboundary ; SECStatus status ; @@ -779,15 +815,15 @@ sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::st // create log - CERTVerifyLog realLog; + CERTVerifyLog realLog; CERTVerifyLog *log; - log = &realLog; + log = &realLog; - log->count = 0; - log->head = NULL; - log->tail = NULL; + log->count = 0; + log->head = NULL; + log->tail = NULL; log->arena = PORT_NewArena( DER_DEFAULT_CHUNKSIZE ); //CERTVerifyLog *log; @@ -798,11 +834,6 @@ sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::st //log->arena = arena; validity = csss::CertificateValidity::INVALID; - CERTCertificateList * certList; - - certList = CERT_CertChainFromCert( (CERTCertificateStr *) cert, (SECCertUsage) 0, 0); - - if( m_pHandler != NULL ) { //JL: We must not pass a particular usage in the requiredUsages argument (the 4th) because, @@ -894,9 +925,23 @@ sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::st } else { + validity = ::com::sun::star::security::CertificateValidity::INVALID ; } + //Destroying the temporary certificates + std::vector<CERTCertificate*>::const_iterator cert_i; + for (cert_i = vecTmpNSSCertificates.begin(); cert_i != vecTmpNSSCertificates.end(); cert_i++) + { + OSL_TRACE("[xmlsecurity] Destroying temporary certificate"); + CERT_DestroyCertificate(*cert_i); + } +#if OSL_DEBUG_LEVEL > 1 + if (validity == ::com::sun::star::security::CertificateValidity::VALID) + OSL_TRACE("[xmlsecurity] Certificate is valid."); + else + OSL_TRACE("[xmlsecurity] Certificate is invalid."); +#endif return validity ; } diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx index bfa9295e50fe..d6586794bea5 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx @@ -115,7 +115,13 @@ private : static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ) ; - virtual ::sal_Int32 SAL_CALL verifyCertificate( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert ) throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ; + virtual ::sal_Int32 SAL_CALL verifyCertificate( + const ::com::sun::star::uno::Reference< + ::com::sun::star::security::XCertificate >& xCert, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > > & + intermediateCerts) + throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ; virtual ::sal_Int32 SAL_CALL getCertificateCharacters( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert ) throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ; diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index 5a3c80dfb162..3255a2d5bf58 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -54,7 +54,12 @@ #include <sal/types.h> - +#include "rtl/instance.hxx" +#include "rtl/bootstrap.hxx" +#include "rtl/string.hxx" +#include "rtl/strbuf.hxx" +#include "osl/file.hxx" +#include "osl/thread.h" #include <tools/debug.hxx> #include <rtl/logfile.hxx> @@ -64,18 +69,10 @@ #include <com/sun/star/mozilla/XMozillaBootstrap.hpp> #include "nspr.h" -#include "prtypes.h" -#include "pk11func.h" -#ifdef SYSTEM_MOZILLA -#include "nssrenam.h" -#include "secmod.h" -#endif #include "cert.h" -#include "cryptohi.h" -#include "certdb.h" #include "nss.h" -#include "prerror.h" - +#include "secmod.h" +#include "nssckbi.h" namespace cssu = com::sun::star::uno; @@ -83,49 +80,234 @@ namespace cssl = com::sun::star::lang; namespace cssxc = com::sun::star::xml::crypto; using namespace com::sun::star; +using ::rtl::OUString; +using ::rtl::OString; #define SERVICE_NAME "com.sun.star.xml.crypto.SEInitializer" #define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.SEInitializer_NssImpl" #define SECURITY_ENVIRONMENT "com.sun.star.xml.crypto.SecurityEnvironment" #define SECURITY_CONTEXT "com.sun.star.xml.crypto.XMLSecurityContext" -bool nsscrypto_initialize( const char* token ) { - static char initialized = 0 ; - //PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1 ) ; - if( !initialized ) { - PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ; +#define ROOT_CERTS "Root Certs for OpenOffice.org" + + +extern "C" void nsscrypto_finalize(); + + +namespace +{ - if( NSS_InitReadWrite( token ) != SECSuccess ) +bool nsscrypto_initialize( const char * sProfile, bool & out_nss_init); + +struct InitNSSInitialize +{ + //path to the database folder + const OString m_sProfile; + InitNSSInitialize(const OString & sProfile): m_sProfile(sProfile) {}; + bool * operator()() + { + static bool bInitialized = false; + bool bNSSInit = false; + bInitialized = nsscrypto_initialize(m_sProfile.getStr(), bNSSInit); + if (bNSSInit) + atexit(nsscrypto_finalize ); + return & bInitialized; + + } +}; + +bool * initNSS(const OString & sProfile) +{ + return rtl_Instance< bool, InitNSSInitialize, + ::osl::MutexGuard, ::osl::GetGlobalMutex >::create( + InitNSSInitialize(sProfile), ::osl::GetGlobalMutex()); +} + +void deleteRootsModule() +{ + SECMODModule *RootsModule = 0; + SECMODModuleList *list = SECMOD_GetDefaultModuleList(); + SECMODListLock *lock = SECMOD_GetDefaultModuleListLock(); + SECMOD_GetReadLock(lock); + + while (!RootsModule && list) + { + SECMODModule *module = list->module; + + for (int i=0; i < module->slotCount; i++) + { + PK11SlotInfo *slot = module->slots[i]; + if (PK11_IsPresent(slot)) + { + if (PK11_HasRootCerts(slot)) { - char * error = NULL; + OSL_TRACE("[xmlsecurity] The root certifificates module \"%s" + "\" is already loaded: \n%s", + module->commonName, module->dllName); - PR_GetErrorText(error); - if (error) - printf("%s",error); - return false ; + RootsModule = SECMOD_ReferenceModule(module); + break; } + } + } + list = list->next; + } + SECMOD_ReleaseReadLock(lock); -#ifdef SYSTEM_MOZILLA - if (!SECMOD_HasRootCerts()) + if (RootsModule) + { + PRInt32 modType; + if (SECSuccess == SECMOD_DeleteModule(RootsModule->commonName, &modType)) + { + OSL_TRACE("[xmlsecurity] Deleted module \"%s\".", RootsModule->commonName); + } + else { - SECMOD_AddNewModule("Root Certs", "libnssckbi" SAL_DLLEXTENSION, - 0, 0); + OSL_TRACE("[xmlsecurity] Failed to delete \"%s\" : \n%s", + RootsModule->commonName, RootsModule->dllName); } + SECMOD_DestroyModule(RootsModule); + RootsModule = 0; + } +} + +//Older versions of Firefox (FF), for example FF2, and Thunderbird (TB) 2 write +//the roots certificate module (libnssckbi.so), which they use, into the +//profile. This module will then already be loaded during NSS_Init (and the +//other init functions). This fails in two cases. First, FF3 was used to create +//the profile, or possibly used that profile before, and second the profile was +//used on a different platform. +// +//Then one needs to add the roots module oneself. This should be done with +//SECMOD_LoadUserModule rather then SECMOD_AddNewModule. The latter would write +//the location of the roots module to the profile, which makes FF2 and TB2 use +//it instead of there own module. +// +//When using SYSTEM_MOZILLA then the libnss3.so lib is typically found in +///usr/lib. This folder may, however, NOT contain the roots certificate +//module. That is, just providing the library name in SECMOD_LoadUserModule or +//SECMOD_AddNewModule will FAIL to load the mozilla unless the LD_LIBRARY_PATH +//contains an FF or TB installation. +//ATTENTION: DO NOT call this function directly instead use initNSS +//return true - whole initialization was successful +//param out_nss_init = true: at least the NSS initialization (NSS_InitReadWrite +//was successful and therefor NSS_Shutdown should be called when terminating. +bool nsscrypto_initialize( const char* token, bool & out_nss_init ) +{ + bool return_value = true; + + OSL_TRACE("[xmlsecurity] Using profile: %s", token); + + PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ; + + if( NSS_InitReadWrite( token ) != SECSuccess ) + { + char * error = NULL; + + PR_GetErrorText(error); + if (error) + printf("%s",error); + return false ; + } + out_nss_init = true; + +#if defined SYSTEM_MOZILLA + if (!SECMOD_HasRootCerts()) + { #endif + deleteRootsModule(); + +#if defined SYSTEM_MOZILLA + OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("libnssckbi"SAL_DLLEXTENSION)); +#else + OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("${OOO_BASE_DIR}/program/libnssckbi"SAL_DLLEXTENSION)); +#endif + ::rtl::Bootstrap::expandMacros(rootModule); + + OUString rootModulePath; + if (::osl::File::E_None == ::osl::File::getSystemPathFromFileURL(rootModule, rootModulePath)) + { + ::rtl::OString ospath = ::rtl::OUStringToOString(rootModulePath, osl_getThreadTextEncoding()); + ::rtl::OStringBuffer pkcs11moduleSpec; + pkcs11moduleSpec.append("name=\""); + pkcs11moduleSpec.append(ROOT_CERTS); + pkcs11moduleSpec.append("\" library=\""); + pkcs11moduleSpec.append(ospath.getStr()); + pkcs11moduleSpec.append("\""); + + SECMODModule * RootsModule = + SECMOD_LoadUserModule( + const_cast<char*>(pkcs11moduleSpec.makeStringAndClear().getStr()), + 0, // no parent + PR_FALSE); // do not recurse + + if (RootsModule) + { + + bool found = RootsModule->loaded; + + SECMOD_DestroyModule(RootsModule); + RootsModule = 0; + if (found) + OSL_TRACE("[xmlsecurity] Added new root certificate module " + "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr()); + else + { + OSL_TRACE("[xmlsecurity] FAILED to load the new root certificate module " + "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr()); + return_value = false; + } + } + else + { + OSL_TRACE("[xmlsecurity] FAILED to add new root certifice module: " + "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr()); + return_value = false; - initialized = 1 ; + } + } + else + { + OSL_TRACE("[xmlsecurity] Adding new root certificate module failed."); + return_value = false; + } +#if SYSTEM_MOZILLA } +#endif - return true ; + return return_value; } + // must be extern "C" because we pass the function pointer to atexit -extern "C" void nsscrypto_finalize() { +extern "C" void nsscrypto_finalize() +{ + SECMODModule *RootsModule = SECMOD_FindModule(ROOT_CERTS); + + if (RootsModule) + { + + if (SECSuccess == SECMOD_UnloadUserModule(RootsModule)) + { + OSL_TRACE("[xmlsecurity] Unloaded module \""ROOT_CERTS"\"."); + } + else + { + OSL_TRACE("[xmlsecurity] Failed unloadeding module \""ROOT_CERTS"\"."); + } + SECMOD_DestroyModule(RootsModule); + } + else + { + OSL_TRACE("[xmlsecurity] Unloading module \""ROOT_CERTS + "\" failed because it was not found."); + } PK11_LogoutAll(); NSS_Shutdown(); } + bool getMozillaCurrentProfile( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF, rtl::OUString& profilePath) @@ -143,7 +325,7 @@ bool getMozillaCurrentProfile( else { RTL_LOGFILE_TRACE( "getMozillaCurrentProfile: Using MozillaBootstrap..." ); - mozilla::MozillaProductType productTypes[4] = { + mozilla::MozillaProductType productTypes[4] = { mozilla::MozillaProductType_Thunderbird, mozilla::MozillaProductType_Mozilla, mozilla::MozillaProductType_Firefox, @@ -180,6 +362,8 @@ bool getMozillaCurrentProfile( } } +} // namespace + SEInitializer_NssImpl::SEInitializer_NssImpl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF) :mxMSF( rxMSF ) @@ -238,7 +422,7 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL return NULL; } ----*/ - if( !nsscrypto_initialize( sCertDir.getStr() ) ) + if( ! *initNSS( sCertDir.getStr() ) ) { RTL_LOGFILE_TRACE( "XMLSEC: Error - nsscrypto_initialize() failed." ); if ( NSS_NoDB_Init(NULL) != SECSuccess ) @@ -251,8 +435,6 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL RTL_LOGFILE_TRACE( "XMLSEC: NSS_NoDB_Init works, enough for verifying signatures..." ); } } - else - atexit(nsscrypto_finalize ); pCertHandle = CERT_GetDefaultCertDB() ; diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index c457b4fb8a30..d6b5e189330e 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -30,14 +30,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmlsecurity.hxx" -#include <sal/config.h> -#include <rtl/uuid.h> -#include "x509certificate_nssimpl.hxx" -#ifndef _CERTIFICATEEXTENSION_NSSIMPL_HXX_ -#include "certificateextension_xmlsecimpl.hxx" -#endif + +#include "nssrenam.h" #include "nspr.h" #include "nss.h" #include "secder.h" @@ -48,6 +44,17 @@ #include "pk11func.h" //MM : end + + +#include <sal/config.h> +#include <rtl/uuid.h> +#include "x509certificate_nssimpl.hxx" + +#ifndef _CERTIFICATEEXTENSION_NSSIMPL_HXX_ +#include "certificateextension_xmlsecimpl.hxx" +#endif + + using namespace ::com::sun::star::uno ; using namespace ::com::sun::star::security ; using ::rtl::OUString ; diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx index 51b2b2fd1d7f..bb16bcc7fb6e 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx @@ -40,9 +40,6 @@ #include "com/sun/star/uno/SecurityException.hpp" #include <com/sun/star/security/XCertificate.hpp> -#ifdef SYSTEM_MOZILLA -#include "nssrenam.h" -#endif #include "cert.h" class X509Certificate_NssImpl : public ::cppu::WeakImplHelper2< diff --git a/xmlsecurity/util/makefile.mk b/xmlsecurity/util/makefile.mk index e3f78a45592f..cfc012a78cd2 100644 --- a/xmlsecurity/util/makefile.mk +++ b/xmlsecurity/util/makefile.mk @@ -152,7 +152,7 @@ SHL4STDLIBS=\ $(SALLIB) \ $(SVLLIB) \ $(XMLOFFLIB) \ - $(SVXLIB) + $(SVXCORELIB) SHL4VERSIONMAP = xmlsecurity.map SHL4DEPN= |