Showing posts with label Exploiting an Open-Source Office Suite. Show all posts
Showing posts with label Exploiting an Open-Source Office Suite. Show all posts

2022-09-25

73: Handle Each Type of Dialog Controls from Non-Basic Macro or Non-Macro for LibreOffice/OpenOffice

<The previous article in this series | The table of contents of this series |

Label, Text, Command, Image, Check, Option, List, Combo, Scroll, Progress, Date, Time, Numeric, Formatted, File, Tree, Grid, Hyperlink, Spin, etc.

Topics


About: UNO (Universal Network Objects)
About: LibreOffice
About: Apache OpenOffice
About: the Java programming language
About: C++
About: C#
About: the Python programming language

The table of contents of this article


Starting Context



Target Context


  • The reader will know how to handle and receive events from each type of dialog controls, from non-Basic macro or non-macro.

Orientation


There is an article on how to create any external UNO client in Java, C++, C#, or Python, in a just-connecting way.

There is an article on how to create any external UNO client in Java, C++, C#, or Python, in a connection-aware way.

There is an article on how to create any user/application-owned Python macro for LibreOffice/Apache OpenOffice.

There is an article on how to create any in-document Python macro for LibreOffice/Apache OpenOffice.

There is an article on how to create any LibreOffice/Apache OpenOffice extension that contains Python macros.

There is an article on using Python instead of Basic for LibreOffice/Apache OpenOffice.


Main Body

Stage Direction
Here are Special-Student-7, Lenard (a Python programmer), and Jane (a Python programmer) in front of a computer.


0: You Are Supposed to Know How to Invoke and Handle any Dialog and Receive Events from the Dialog, from Non-Basic Macro or Non-Macro


Special-Student-7
This has been already clearly stated in Starting Context, but I repeat here that you are supposed to know how to invoke and handle any dialog and receive events from the dialog, from any non-Basic macro or any non-macro, as probably many people have the habit of snubbing such preparatory parts, however indispensable.

This article is a sequel to the the previous article and concentrates on handling each type of dialog controls.


1: Handling Each Type of Dialog Controls


Special-Student-7
We will see how to typically handle each type of dialog controls, from non-Basic macro or non-macro.

All the types present on the Basic IDE of LibreOffice version '6.4' will be dealt with.

I will show only Java and Python code, hoping that the reader will be able to translate it to C++ or C#, if necessary. The C++ or C# code in the previous article will be helpful.

Lenard
When you say "typically" . . .

Special-Student-7
A type of dialog controls may have many methods, and I do not necessarily show calling all the methods, supposing that you will be able to easily know how to call non-typical methods.


1-1: Label


Special-Student-7
Let us handle a Label control.

This gets the Label control, sets a text on it, gets the text of it.

@Java Source Code
~
import com.sun.star.awt.XFixedText;
~

public class Test1Test {
	~
	
	public static void main (String [] a_argumentsArray) {
				~
				l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("Label1");
				UnoRuntime.queryInterface (XFixedText.class, l_underlyingUnoControlInXControl).setText ("Hi, bro!");
				System.out.println (String.format ("### Label1 text: %s", UnoRuntime.queryInterface (XFixedText.class, l_underlyingUnoControlInXControl).getText ()));
	}
}

@Python Source Code
~
from com.sun.star.awt import XFixedText
~

class Test1Test:
	~
	
	def main (a_arguments: List [str]) -> None:
				~
				l_underlyingUnoControlInXControl = (cast (XControlContainer, l_underlyingUnoDialogInXDialog)).getControl ("Label1")
				(cast (XFixedText, l_underlyingUnoControlInXControl)).setText ("Hi, bro!")
				sys.stdout.write ("### Label1 text: {0:s}\n".format ( (cast (XFixedText, l_underlyingUnoControlInXControl)).getText ()))
				sys.stdout.flush ()


1-2: TextField


Special-Student-7
Let us handle a TextField control.

This gets the TextField control, registers an events listener to it, sets a text on it, gets the text of it, and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.TextEvent;
~
import com.sun.star.awt.XTextListener;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	
	private static class UnoTextFieldEventsListener extends WeakBase implements XTextListener {
		@Override
		public void textChanged (TextEvent a_event) {
			System.out.println (String.format ("### UnoTextFieldEventsListener.textChanged: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
				~
				UnoTextFieldEventsListener l_unoTextFieldEventsListener = new UnoTextFieldEventsListener ();
				~
				l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("TextField1");
				UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).addTextListener (l_unoTextFieldEventsListener);
				UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).setText ("Hi, bro!");
				System.out.println (String.format ("### TextField1 text: %s", UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).getText ()));
				~
				UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).removeTextListener (l_unoTextFieldEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import TextEvent
~
from com.sun.star.awt import XTextListener
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	
	class UnoTextFieldEventsListener (UnoBase, XTextListener):
		def textChanged (a_this: "Test1Test.UnoTextFieldEventsListener", a_event: TextEvent)-> None:
			sys.stdout.write ("### UnoTextFieldEventsListener.textChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoTextFieldEventsListener", a_eventSource: EventObject)-> None:
			None
	~
	
	def main (a_arguments: List [str]) -> None:
				~
				l_unoTextFieldEventsListener: "Test1Test.UnoTextFieldEventsListener" = Test1Test.UnoTextFieldEventsListener ()
				~
				l_underlyingUnoControlInXControl = (cast (XControlContainer, l_underlyingUnoDialogInXDialog)).getControl ("TextField1")
				(cast (XTextComponent, l_underlyingUnoControlInXControl)).addTextListener (l_unoTextFieldEventsListener)
				(cast (XTextComponent, l_underlyingUnoControlInXControl)).setText ("Hi, bro!")
				sys.stdout.write ("### TextField1 text: {0:s}\n".format ( (cast (XTextComponent, l_underlyingUnoControlInXControl)).getText ()))
				sys.stdout.flush ()
				~
				(cast (XTextComponent, l_underlyingUnoControlInXControl)).removeTextListener (l_unoTextFieldEventsListener)


1-3: CommandButton


Special-Student-7
Let us handle a CommandButton control.

This gets the CommandButton control, registers an events listener to it and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.ActionEvent;
~
import com.sun.star.awt.XActionListener;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	
	private static class UnoButtonEventsListener extends WeakBase implements XActionListener {
		@Override
		public void actionPerformed (ActionEvent a_event) {
			System.out.println (String.format ("### UnoButtonEventsListener.actionPerformed: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
				~
				UnoButtonEventsListener l_unoButtonEventsListener = new UnoButtonEventsListener ();
				~
				l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("CommandButton1");
				UnoRuntime.queryInterface (XButton.class, l_underlyingUnoControlInXControl).addActionListener (l_unoButtonEventsListener);
				~
				UnoRuntime.queryInterface (XButton.class, l_underlyingUnoControlInXControl).removeActionListener (l_unoButtonEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import ActionEvent
~
from com.sun.star.awt import XActionListener
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	
	class UnoButtonEventsListener (UnoBase, XActionListener):
		def actionPerformed (a_this: "Test1Test.UnoButtonEventsListener", a_event: ActionEvent)-> None:
			sys.stdout.write ("### UnoButtonEventsListener.actionPerformed: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoButtonEventsListener", a_eventSource: EventObject)-> None:
			None
	~
	
	def main (a_arguments: List [str]) -> None:
				~
				l_unoButtonEventsListener: "Test1Test.UnoButtonEventsListener" = Test1Test.UnoButtonEventsListener ()
				~
				l_underlyingUnoControlInXControl = (cast (XControlContainer, l_underlyingUnoDialogInXDialog)).getControl ("CommandButton1")
				(cast (XButton, l_underlyingUnoControlInXControl)).addActionListener (l_unoButtonEventsListener)
				~
				(cast (XButton, l_underlyingUnoControlInXControl)).removeActionListener (l_unoButtonEventsListener)


1-4: ImageControl


Special-Student-7
Let us handle a ImageControl control.

This gets the ImageControl control, registers an events listener to it, sets an image, gets the image URL, and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.FocusEvent;
~
import com.sun.star.awt.KeyEvent;
import com.sun.star.awt.MouseEvent;
import com.sun.star.awt.PaintEvent;
~
import com.sun.star.awt.WindowEvent;
~
import com.sun.star.awt.XControlModel;
~
import com.sun.star.awt.XFocusListener;
~
import com.sun.star.awt.XKeyListener;
~
import com.sun.star.awt.XMouseListener;
~
import com.sun.star.awt.XMouseMotionListener;
~
import com.sun.star.awt.XPaintListener;
~
import com.sun.star.awt.XWindow2;
~
import com.sun.star.awt.XWindowListener;
~
import com.sun.star.beans.XPropertySet;
~
import com.sun.star.lang.EventObject;
~
import com.sun.star.uno.XInterface;
~

public class Test1Test {
	~
	
	private static class UnoWindowEventsListener extends WeakBase implements XWindowListener, XFocusListener, XMouseListener, XMouseMotionListener, XKeyListener, XPaintListener {
		@Override
		public void windowResized (WindowEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.windowResized: %s", a_event));
		}
		
		@Override
		public void windowMoved (WindowEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.windowMoved: %s", a_event));
		}
		 
		@Override
		public void windowShown (EventObject a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.windowShown: %s", a_event));
		}
		 
		@Override
		public void windowHidden (EventObject a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.windowHidden: %s", a_event));
		}
		 
		@Override
		public void focusGained (FocusEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.focusGained: %s", a_event));
		}
		
		@Override
		public void focusLost (FocusEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.focusLost: %s", a_event));
		}
		
		@Override
		public void mousePressed (MouseEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.mousePressed: %s", a_event));
		}
		
		@Override
		public void mouseReleased (MouseEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.mouseReleased: %s", a_event));
		}
		
		@Override
		public void mouseEntered (MouseEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.mouseEntered: %s", a_event));
		}
		
		@Override
		public void mouseExited (MouseEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.mouseExited: %s", a_event));
		}
		
		@Override
		public void mouseDragged (MouseEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.mouseDragged: %s", a_event));
		}
		
		@Override
		public void mouseMoved (MouseEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.mouseMoved: %s", a_event));
		}
		
		@Override
		public void keyPressed (KeyEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.keyPressed: %s", a_event));
		}
		
		@Override
		public void keyReleased (KeyEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.keyReleased: %s", a_event));
		}
		
		@Override
		public void windowPaint (PaintEvent a_event) {
			System.out.println (String.format ("### UnoWindowEventsListener.windowPaint: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoWindowEventsListener l_unoWindowEventsListener = new UnoWindowEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("ImageControl1");
					registerUnoWindowListener (l_underlyingUnoControlInXControl, l_unoWindowEventsListener);
					XControlModel l_underlyingUnoControlModelInXControlModel = null;
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ();
					UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("ImageURL", "file:///home/fruit/.config/libreoffice/4/user/gallery/WaveMark.png");
					System.out.println (String.format ("### ImageControl1 image URL: %s", UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("ImageURL")));
					~
					unregisterUnoWindowListener (l_underlyingUnoControlInXControl, l_unoWindowEventsListener);
					~
	}
	
	private static boolean registerUnoWindowListener (XInterface a_underlyingPossiblyUnoWindowInXInterface, UnoWindowEventsListener a_unoWindowEventsListener) {
		XWindow2 l_unoWindowInXWindow2 = UnoRuntime.queryInterface (XWindow2.class, a_underlyingPossiblyUnoWindowInXInterface);
		if (l_unoWindowInXWindow2 != null) {
			l_unoWindowInXWindow2.addWindowListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.addFocusListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.addKeyListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.addMouseListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.addMouseMotionListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.addPaintListener (a_unoWindowEventsListener);
			return true;
		}
		else {
			return false;
		}
	}
	
	private static boolean unregisterUnoWindowListener (XInterface a_underlyingPossiblyUnoWindowInXInterface, UnoWindowEventsListener a_unoWindowEventsListener) {
		XWindow2 l_unoWindowInXWindow2 = UnoRuntime.queryInterface (XWindow2.class, a_underlyingPossiblyUnoWindowInXInterface);
		if (l_unoWindowInXWindow2 != null) {
			l_unoWindowInXWindow2.removeWindowListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.removeFocusListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.removeKeyListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.removeMouseListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.removeMouseMotionListener (a_unoWindowEventsListener);
			l_unoWindowInXWindow2.removePaintListener (a_unoWindowEventsListener);
			return true;
		}
		else {
			return false;
		}
	}
}

@Python Source Code
~
from com.sun.star.awt import FocusEvent
~
from com.sun.star.awt import KeyEvent
from com.sun.star.awt import MouseEvent
from com.sun.star.awt import PaintEvent
~
from com.sun.star.awt import WindowEvent
~
from com.sun.star.awt import XControlModel
~
from com.sun.star.awt import XFocusListener
~
from com.sun.star.awt import XKeyListener
~
from com.sun.star.awt import XMouseListener
~
from com.sun.star.awt import XMouseMotionListener
~
from com.sun.star.awt import XPaintListener
~
from com.sun.star.awt import XWindow2
~
from com.sun.star.awt import XWindowListener
~
from com.sun.star.beans import XPropertySet
~
from com.sun.star.lang import EventObject
~
from com.sun.star.uno import XInterface
~

class Test1Test:
	~
	
	class UnoWindowEventsListener (UnoBase, XWindowListener, XFocusListener, XMouseListener, XMouseMotionListener, XKeyListener, XPaintListener):
		def windowResized (a_this: "Test1Test.UnoWindowEventsListener", a_event: WindowEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.windowResized: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def windowMoved (a_this: "Test1Test.UnoWindowEventsListener", a_event: WindowEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.windowMoved: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def windowShown (a_this: "Test1Test.UnoWindowEventsListener", a_event: EventObject)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.windowShown: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def windowHidden (a_this: "Test1Test.UnoWindowEventsListener", a_event: EventObject)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.windowHidden: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def focusGained (a_this: "Test1Test.UnoWindowEventsListener", a_event: FocusEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.focusGained: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def focusLost (a_this: "Test1Test.UnoWindowEventsListener", a_event: FocusEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.focusLost: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def mousePressed (a_this: "Test1Test.UnoWindowEventsListener", a_event: MouseEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.mousePressed: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def mouseReleased (a_this: "Test1Test.UnoWindowEventsListener", a_event: MouseEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.mouseReleased: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def mouseEntered (a_this: "Test1Test.UnoWindowEventsListener", a_event: MouseEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.mouseEntered: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def mouseExited (a_this: "Test1Test.UnoWindowEventsListener", a_event: MouseEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.mouseExited: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def mouseDragged (a_this: "Test1Test.UnoWindowEventsListener", a_event: MouseEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.mouseDragged: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def mouseMoved (a_this: "Test1Test.UnoWindowEventsListener", a_event: MouseEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.mouseMoved: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def keyPressed (a_this: "Test1Test.UnoWindowEventsListener", a_event: KeyEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.keyPressed: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def keyReleased (a_this: "Test1Test.UnoWindowEventsListener", a_event: KeyEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.keyReleased: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def windowPaint (a_this: "Test1Test.UnoWindowEventsListener", a_event: PaintEvent)-> None:
			sys.stdout.write ("### UnoWindowEventsListener.windowPaint: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoWindowEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoWindowEventsListener: "Test1Test.UnoWindowEventsListener" = Test1Test.UnoWindowEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("ImageControl1")
					Test1Test.registerUnoWindowListener (l_underlyingUnoControlInXControl, l_unoWindowEventsListener)
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ()
					cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("ImageURL", "file:///home/fruit/.config/libreoffice/4/user/gallery/WaveMark.png")
					sys.stdout.write ("### ImageControl1 image URL: {0:s}".format (cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("ImageURL")))
					sys.stdout.flush ()
					~
					Test1Test.unregisterUnoWindowListener (l_underlyingUnoControlInXControl, l_unoWindowEventsListener)
					~
	
	@staticmethod
	def registerUnoWindowListener (a_underlyingPossiblyUnoWindowInXInterface: XInterface, a_unoWindowEventsListener: UnoWindowEventsListener)-> bool:
		l_unoWindowInXWindow2: XWindow2 = cast (XWindow2, a_underlyingPossiblyUnoWindowInXInterface)
		if l_unoWindowInXWindow2 is not None:
			l_unoWindowInXWindow2.addWindowListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.addFocusListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.addKeyListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.addMouseListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.addMouseMotionListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.addPaintListener (a_unoWindowEventsListener)
			return True
		else:
			return False
	
	@staticmethod
	def unregisterUnoWindowListener (a_underlyingPossiblyUnoWindowInXInterface: XInterface, a_unoWindowEventsListener: UnoWindowEventsListener)-> bool:
		l_unoWindowInXWindow2: XWindow2 = cast (XWindow2, a_underlyingPossiblyUnoWindowInXInterface)
		if l_unoWindowInXWindow2 is not None:
			l_unoWindowInXWindow2.removeWindowListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.removeFocusListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.removeKeyListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.removeMouseListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.removeMouseMotionListener (a_unoWindowEventsListener)
			l_unoWindowInXWindow2.removePaintListener (a_unoWindowEventsListener)
			return True
		else:
			return False


1-5: CheckBox


Special-Student-7
Let us handle a CheckBox control.

This gets the CheckBox control, registers an events listener to it, sets a state to it, gets the state of it, and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.ActionEvent;
~
import com.sun.star.awt.ItemEvent;
~
import com.sun.star.awt.XActionListener;
~
import com.sun.star.awt.XCheckBox;
~
import com.sun.star.awt.XItemListener;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	
	private static class UnoCheckBoxEventsListener extends WeakBase implements XActionListener, XItemListener {
		@Override
		public void actionPerformed (ActionEvent a_event) {
			System.out.println (String.format ("### UnoCheckBoxEventsListener.actionPerformed: %s", a_event));
		}
		
		@Override
		public void itemStateChanged (ItemEvent a_event) {
			System.out.println (String.format ("### UnoCheckBoxEventsListener.itemStateChanged: Selected -> %d, Highlighted-> %d, ItemId-> %d", a_event.Selected, a_event.Highlighted, a_event.ItemId));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoCheckBoxEventsListener l_unoCheckBoxEventsListener = new UnoCheckBoxEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("CheckBox1");
					UnoRuntime.queryInterface (XCheckBox.class, l_underlyingUnoControlInXControl).addItemListener (l_unoCheckBoxEventsListener);
					UnoRuntime.queryInterface (XCheckBox.class, l_underlyingUnoControlInXControl).setState ( (short) 1);
					System.out.println (String.format ("### CheckBox1 state: %d", UnoRuntime.queryInterface (XCheckBox.class, l_underlyingUnoControlInXControl).getState ()));
					~
					UnoRuntime.queryInterface (XCheckBox.class, l_underlyingUnoControlInXControl).removeItemListener (l_unoCheckBoxEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import ActionEvent
~
from com.sun.star.awt import ItemEvent
~
from com.sun.star.awt import XActionListener
~
from com.sun.star.awt import XCheckBox
~
from com.sun.star.awt import XItemListener
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	
	class UnoCheckBoxEventsListener (UnoBase, XActionListener, XItemListener):
		def actionPerformed (a_this: "Test1Test.UnoCheckBoxEventsListener", a_event: ActionEvent)-> None:
			sys.stdout.write ("### UnoCheckBoxEventsListener.actionPerformed: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def itemStateChanged (a_this: "Test1Test.UnoCheckBoxEventsListener", a_event: ItemEvent)-> None:
			sys.stdout.write ("### UnoCheckBoxEventsListener.itemStateChanged: Selected -> {0:d}, Highlighted-> {1:d}, ItemId-> {2:d}".format (a_event.Selected, a_event.Highlighted, a_event.ItemId))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoCheckBoxEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoCheckBoxEventsListener: "Test1Test.UnoCheckBoxEventsListener " = Test1Test.UnoCheckBoxEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("CheckBox1")
					cast (XCheckBox, l_underlyingUnoControlInXControl).addItemListener (l_unoCheckBoxEventsListener)
					cast (XCheckBox, l_underlyingUnoControlInXControl).setState (1)
					sys.stdout.write ("### CheckBox1 state: {0:d}".format (cast (XCheckBox, l_underlyingUnoControlInXControl).getState ()))
					sys.stdout.flush ()
					~
					cast (XCheckBox, l_underlyingUnoControlInXControl).removeItemListener (l_unoCheckBoxEventsListener)


1-6: OptionButton


Special-Student-7
Let us handle a OptionButton control.

This gets the OptionButton control, registers an events listener to it, sets a state to it, gets the state of it, and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.ActionEvent;
~
import com.sun.star.awt.ItemEvent;
~
import com.sun.star.awt.XActionListener;
~
import com.sun.star.awt.XItemListener;
~
import com.sun.star.awt.XRadioButton;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	
	private static class UnoRadioButtonEventsListener extends WeakBase implements XActionListener, XItemListener {
		@Override
		public void actionPerformed (ActionEvent a_event) {
			System.out.println (String.format ("### UnoRadioButtonEventsListener.actionPerformed: %s", a_event));
		}
		
		@Override
		public void itemStateChanged (ItemEvent a_event) {
			System.out.println (String.format ("### UnoRadioButtonEventsListener.itemStateChanged: Selected -> %d, Highlighted-> %d, ItemId-> %d", a_event.Selected, a_event.Highlighted, a_event.ItemId));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoRadioButtonEventsListener l_unoRadioButtonEventsListener = new UnoRadioButtonEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("OptionButton1");
					UnoRuntime.queryInterface (XRadioButton.class, l_underlyingUnoControlInXControl).addItemListener (l_unoRadioButtonEventsListener);
					UnoRuntime.queryInterface (XRadioButton.class, l_underlyingUnoControlInXControl).setState (true);
					System.out.println (String.format ("### OptionButton1 state: %b", UnoRuntime.queryInterface (XRadioButton.class, l_underlyingUnoControlInXControl).getState ()));
					~
					UnoRuntime.queryInterface (XRadioButton.class, l_underlyingUnoControlInXControl).removeItemListener (l_unoRadioButtonEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import ActionEvent
~
from com.sun.star.awt import ItemEvent
~
from com.sun.star.awt import XActionListener
~
from com.sun.star.awt import XItemListener
~
from com.sun.star.awt import XRadioButton
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoRadioButtonEventsListener (UnoBase, XActionListener, XItemListener):
		def actionPerformed (a_this: "Test1Test.UnoRadioButtonEventsListener", a_event: ActionEvent)-> None:
			sys.stdout.write ("### UnoRadioButtonEventsListener.actionPerformed: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def itemStateChanged (a_this: "Test1Test.UnoRadioButtonEventsListener", a_event: ItemEvent)-> None:
			sys.stdout.write ("### UnoRadioButtonEventsListener.itemStateChanged: Selected -> {0:d}, Highlighted-> {1:d}, ItemId-> {2:d}".format (a_event.Selected, a_event.Highlighted, a_event.ItemId))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoRadioButtonEventsListener", a_eventSource: EventObject)-> None:
			None
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoRadioButtonEventsListener: "Test1Test.UnoRadioButtonEventsListener" = Test1Test.UnoRadioButtonEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("OptionButton1")
					cast (XRadioButton, l_underlyingUnoControlInXControl).addItemListener (l_unoRadioButtonEventsListener)
					cast (XRadioButton, l_underlyingUnoControlInXControl).setState (True)
					sys.stdout.write ("### OptionButton1 state: {0:b}".format (cast (XRadioButton, l_underlyingUnoControlInXControl).getState ()))
					sys.stdout.flush ()
					~
					cast (XRadioButton, l_underlyingUnoControlInXControl).removeItemListener (l_unoRadioButtonEventsListener)


1-7: FrameControl


Special-Student-7
Let us handle a FrameControl control.

This gets the FrameControl control, disables it, and gets the enabled state of it.

@Java Source Code
~
import com.sun.star.awt.XWindow2;
~

public class Test1Test {
	~
	public static void main (String [] a_argumentsArray) {
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("FrameControl1");
					UnoRuntime.queryInterface (XWindow2.class, l_underlyingUnoControlInXControl).setEnable (false);
					System.out.println (String.format ("### FrameControl1 state: %b", UnoRuntime.queryInterface (XWindow2.class, l_underlyingUnoControlInXControl).isEnabled ()));
	}
}

@Python Source Code
~
from com.sun.star.awt import XWindow2
~

class Test1Test:
	~
	def main (a_arguments: List [str]) -> None:
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("FrameControl1")
					cast (XWindow2, l_underlyingUnoControlInXControl).setEnable (False)
					sys.stdout.write ("### FrameControl1 state: {0:b}".format (cast (XWindow2, l_underlyingUnoControlInXControl).isEnabled ()))
					sys.stdout.flush ()


1-8: ListBox


Special-Student-7
Let us handle a ListBox control.

This gets the ListBox control, registers an events listener to it, sets an item to it, selects the item of it, gets the selected item of it, and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.ActionEvent;
~
import com.sun.star.awt.ItemEvent;
~
import com.sun.star.awt.XActionListener;
~
import com.sun.star.awt.XItemListener;
~
import com.sun.star.awt.XListBox;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoListBoxEventsListener extends WeakBase implements XActionListener, XItemListener {
		@Override
		public void actionPerformed (ActionEvent a_event) {
			System.out.println (String.format ("### UnoListBoxEventsListener.actionPerformed: %s", a_event));
		}
		
		@Override
		public void itemStateChanged (ItemEvent a_event) {
			System.out.println (String.format ("### UnoListBoxEventsListener.itemStateChanged: Selected -> %d, Highlighted-> %d, ItemId-> %d", a_event.Selected, a_event.Highlighted, a_event.ItemId));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoListBoxEventsListener l_unoListBoxEventsListener = new UnoListBoxEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("ListBox1");
					UnoRuntime.queryInterface (XListBox.class, l_underlyingUnoControlInXControl).addItemListener (l_unoListBoxEventsListener);
					UnoRuntime.queryInterface (XListBox.class, l_underlyingUnoControlInXControl).addItem ("Hi, bro!", (short) 0);
					UnoRuntime.queryInterface (XListBox.class, l_underlyingUnoControlInXControl).selectItem ("Hi, bro!", true);
					System.out.println (String.format ("### ListBox1 selected item: %s", UnoRuntime.queryInterface (XListBox.class, l_underlyingUnoControlInXControl).getSelectedItem ()));
					~
					UnoRuntime.queryInterface (XListBox.class, l_underlyingUnoControlInXControl).removeItemListener (l_unoListBoxEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import ActionEvent
~
from com.sun.star.awt import ItemEvent
~
from com.sun.star.awt import XActionListener
~
from com.sun.star.awt import XItemListener
~
from com.sun.star.awt import XListBox
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoListBoxEventsListener (UnoBase, XActionListener, XItemListener):
		def actionPerformed (a_this: "Test1Test.UnoListBoxEventsListener", a_event: ActionEvent)-> None:
			sys.stdout.write ("### UnoListBoxEventsListener.actionPerformed: {0:s}".format (a_event))
			sys.stdout.flush ()
		
		def itemStateChanged (a_this: "Test1Test.UnoListBoxEventsListener", a_event: ItemEvent)-> None:
			sys.stdout.write ("### UnoListBoxEventsListener.itemStateChanged: Selected -> {0:d}, Highlighted-> {1:s}, ItemId-> {2:s}".format (a_event.Selected, a_event.Highlighted, a_event.ItemId))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoListBoxEventsListener", a_eventSource: EventObject)-> None:
			None
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoListBoxEventsListener: "Test1Test.UnoListBoxEventsListener" = Test1Test.UnoListBoxEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("ListBox1")
					cast (XListBox, l_underlyingUnoControlInXControl).addItemListener (l_unoListBoxEventsListener)
					cast (XListBox, l_underlyingUnoControlInXControl).addItem ("Hi, bro!", 0)
					cast (XListBox, l_underlyingUnoControlInXControl).selectItem ("Hi, bro!", True)
					sys.stdout.write ("### ListBox1 selected item: {0:s}".format (cast (XListBox, l_underlyingUnoControlInXControl).getSelectedItem ()))
					sys.stdout.flush ()
					~
					cast (XListBox, l_underlyingUnoControlInXControl).removeItemListener (l_unoListBoxEventsListener)


1-9: ComboBox


Special-Student-7
Let us handle a ComboBox control.

This gets the ComboBox control, registers some events listeners to it, sets an item to it, sets a text to it, gets the text of it, and unregisters the events listeners from it.

@Java Source Code
~
import com.sun.star.awt.ActionEvent;
~
import com.sun.star.awt.ItemEvent;
~
import com.sun.star.awt.TextEvent;
~
import com.sun.star.awt.XActionListener;
~
import com.sun.star.awt.XComboBox;
~
import com.sun.star.awt.XItemListener;
~
import com.sun.star.awt.XTextComponent;
~
import com.sun.star.awt.XTextListener;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoComboBoxEventsListener extends WeakBase implements XActionListener, XTextListener, XItemListener {
		@Override
		public void actionPerformed (ActionEvent a_event) {
			System.out.println (String.format ("### UnoComboBoxEventsListener.actionPerformed: %s", a_event));
		}
		
		@Override
		public void textChanged (TextEvent a_event) {
			System.out.println (String.format ("### UnoComboBoxEventsListener.textChanged: %s", a_event));
		}
		
		@Override
		public void itemStateChanged (ItemEvent a_event) {
			System.out.println (String.format ("### UnoComboBoxEventsListener.itemStateChanged: Selected -> %d, Highlighted-> %d, ItemId-> %d", a_event.Selected, a_event.Highlighted, a_event.ItemId));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoComboBoxEventsListener l_unoComboBoxEventsListener = new UnoComboBoxEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("ComboBox1");
					UnoRuntime.queryInterface (XComboBox.class, l_underlyingUnoControlInXControl).addActionListener (l_unoComboBoxEventsListener);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).addTextListener (l_unoComboBoxEventsListener);
					UnoRuntime.queryInterface (XComboBox.class, l_underlyingUnoControlInXControl).addItemListener (l_unoComboBoxEventsListener);
					UnoRuntime.queryInterface (XComboBox.class, l_underlyingUnoControlInXControl).addItem ("Hi, bro!", (short) 0);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).setText ("Hi, bro!");
					System.out.println (String.format ("### ComboBox1 text: %s", UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).getText ()));
					~
					UnoRuntime.queryInterface (XComboBox.class, l_underlyingUnoControlInXControl).removeItemListener (l_unoComboBoxEventsListener);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).removeTextListener (l_unoComboBoxEventsListener);
					UnoRuntime.queryInterface (XComboBox.class, l_underlyingUnoControlInXControl).removeActionListener (l_unoComboBoxEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import ActionEvent
~
from com.sun.star.awt import ItemEvent
~
from com.sun.star.awt import TextEvent
~
from com.sun.star.awt import XActionListener
~
from com.sun.star.awt import XComboBox
~
from com.sun.star.awt import XItemListener
~
from com.sun.star.awt import XTextComponent
~
from com.sun.star.awt import XTextListener
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoComboBoxEventsListener (UnoBase, XActionListener, XTextListener, XItemListener):
		def actionPerformed (a_this: "Test1Test.UnoComboBoxEventsListener", a_event: ActionEvent)-> None:
			sys.stdout.write ("### UnoComboBoxEventsListener.actionPerformed: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def textChanged (a_this: "Test1Test.UnoComboBoxEventsListener", a_event: TextEvent)-> None:
			sys.stdout.write ("### UnoComboBoxEventsListener.textChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def itemStateChanged (a_this: "Test1Test.UnoComboBoxEventsListener", a_event: ItemEvent)-> None:
			sys.stdout.write ("### UnoComboBoxEventsListener.itemStateChanged: Selected -> {0:d}, Highlighted-> {1:d}, ItemId-> {2:d}\n".format (a_event.Selected, a_event.Highlighted, a_event.ItemId))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoComboBoxEventsListener", a_eventSource: EventObject)-> None:
			None
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoComboBoxEventsListener: "Test1Test.UnoComboBoxEventsListener" = Test1Test.UnoComboBoxEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("ComboBox1")
					cast (XComboBox, l_underlyingUnoControlInXControl).addActionListener (l_unoComboBoxEventsListener)
					cast (XTextComponent, l_underlyingUnoControlInXControl).addTextListener (l_unoComboBoxEventsListener)
					cast (XComboBox, l_underlyingUnoControlInXControl).addItemListener (l_unoComboBoxEventsListener)
					cast (XComboBox, l_underlyingUnoControlInXControl).addItem ("Hi, bro!", 0)
					sys.stdout.write ("### ComboBox1 text: {0:s}\n".format (cast (XTextComponent, l_underlyingUnoControlInXControl).getText ()))
					sys.stdout.flush ()
					~
					cast (XComboBox, l_underlyingUnoControlInXControl).removeItemListener (l_unoComboBoxEventsListener)
					cast (XTextComponent, l_underlyingUnoControlInXControl).removeTextListener (l_unoComboBoxEventsListener)
					cast (XComboBox, l_underlyingUnoControlInXControl).removeActionListener (l_unoComboBoxEventsListener)


1-10: ScrollBar


Special-Student-7
Let us handle a ScrollBar control.

This gets the ScrollBar control, registers a events listener to it, sets some values to it, gets the value of it, and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.AdjustmentEvent;
~
import com.sun.star.awt.XAdjustmentListener;
~
import com.sun.star.awt.XScrollBar;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoScrollBarEventsListener extends WeakBase implements XAdjustmentListener {
		@Override
		public void adjustmentValueChanged (AdjustmentEvent a_event) {
			System.out.println (String.format ("### UnoScrollBarEventsListener.adjustmentValueChanged: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoScrollBarEventsListener l_unoScrollBarEventsListener = new UnoScrollBarEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("ScrollBar1");
					UnoRuntime.queryInterface (XScrollBar.class, l_underlyingUnoControlInXControl).addAdjustmentListener (l_unoScrollBarEventsListener);
					UnoRuntime.queryInterface (XScrollBar.class, l_underlyingUnoControlInXControl).setMaximum (100);
					UnoRuntime.queryInterface (XScrollBar.class, l_underlyingUnoControlInXControl).setValue (33);
					System.out.println (String.format ("### ScrollBar1 value: %d", UnoRuntime.queryInterface (XScrollBar.class, l_underlyingUnoControlInXControl).getValue ()));
					~
					UnoRuntime.queryInterface (XScrollBar.class, l_underlyingUnoControlInXControl).removeAdjustmentListener (l_unoScrollBarEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import AdjustmentEvent
~
from com.sun.star.awt import XAdjustmentListener
~
from com.sun.star.lang import EventObject
~
from com.sun.star.awt import XScrollBar
~

class Test1Test:
	~
	class UnoScrollBarEventsListener (UnoBase, XAdjustmentListener):
		def adjustmentValueChanged (a_this: "Test1Test.UnoScrollBarEventsListener", a_event: AdjustmentEvent)-> None:
			sys.stdout.write ("### UnoScrollBarEventsListener.adjustmentValueChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoScrollBarEventsListener", a_eventSource: EventObject)-> None:
			None
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoScrollBarEventsListener: "Test1Test.UnoScrollBarEventsListener" = Test1Test.UnoScrollBarEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("ScrollBar1")
					cast (XScrollBar, l_underlyingUnoControlInXControl).addAdjustmentListener (l_unoScrollBarEventsListener)
					cast (XScrollBar, l_underlyingUnoControlInXControl).setMaximum (100)
					cast (XScrollBar, l_underlyingUnoControlInXControl).setValue (33)
					sys.stdout.write ("### ScrollBar1 value: {0:d}\n".format (cast (XScrollBar, l_underlyingUnoControlInXControl).getValue ()))
					sys.stdout.flush ()
					~
					cast (XScrollBar, l_underlyingUnoControlInXControl).removeAdjustmentListener (l_unoScrollBarEventsListener)


1-11: ProgressBar


Special-Student-7
Let us handle a ProgressBar control.

This gets the ProgressBar control, sets the range to it, sets the value to it, gets the value of it.

@Java Source Code
~
import com.sun.star.awt.XProgressBar;
~

public class Test1Test {
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("ProgressBar1")
					cast (XProgressBar, l_underlyingUnoControlInXControl).setRange (0, 100)
					cast (XProgressBar, l_underlyingUnoControlInXControl).setValue (33)
					sys.stdout.write ("### ProgressBar1 value: {0:d}\n".format ( cast (XProgressBar, l_underlyingUnoControlInXControl).getValue ()))
					sys.stdout.flush ()
	}
}

@Python Source Code
~
from com.sun.star.awt import XProgressBar
~

class Test1Test:
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("ProgressBar1")
					cast (XProgressBar, l_underlyingUnoControlInXControl).setRange (0, 100)
					cast (XProgressBar, l_underlyingUnoControlInXControl).setValue (33)
					sys.stdout.write ("### ProgressBar1 value: {0:d}\n".format ( cast (XProgressBar, l_underlyingUnoControlInXControl).getValue ()))
					sys.stdout.flush ()


1-12: FixedLine


Special-Student-7
Let us handle a FixedLine control.

This gets the FixedLine control, sets the position of it, sets the size of it.

@Java Source Code
~
import com.sun.star.awt.XControlModel;
~
import com.sun.star.beans.XPropertySet;
~

public class Test1Test {
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("FixedLine1");
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ();
					UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("PositionX", 0);
					UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("PositionY", 0);
					UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("Width", 100);
	}
}

@Python Source Code
~
from com.sun.star.awt import XControlModel
~
from com.sun.star.beans import XPropertySet
~

class Test1Test:
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("FixedLine1")
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ()
					cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("PositionX", 0)
					cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("PositionY", 0)
					cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("Width", 100)


1-13: DateField


Special-Student-7
Let us handle a DateField control.

This gets the DateField control, registers some events listeners to it, sets the format of it, sets the range of it, sets a value to it, moves the value of it, gets the value of it, and unregisters the events listeners from it.

@Java Source Code
~
import com.sun.star.awt.SpinEvent;
~
import com.sun.star.awt.TextEvent;
~
import com.sun.star.awt.XControlModel;
~
import com.sun.star.awt.XDateField;
~
import com.sun.star.awt.XSpinField;
~
import com.sun.star.awt.XSpinListener;
~
import com.sun.star.awt.XTextComponent;
~
import com.sun.star.awt.XTextListener;
~
import com.sun.star.beans.XPropertySet;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoDateFieldEventsListener extends WeakBase implements XTextListener, XSpinListener {
		@Override
		public void textChanged (TextEvent a_event) {
			System.out.println (String.format ("### UnoDateFieldEventsListener.textChanged: %s", a_event));
		}
		
		@Override
		public void up (SpinEvent a_event) {
			System.out.println (String.format ("### UnoDateFieldEventsListener.up: %s", a_event));
		}
		
		@Override
		public void down (SpinEvent a_event) {
			System.out.println (String.format ("### UnoDateFieldEventsListener.down : %s", a_event));
		}
		
		@Override
		public void first (SpinEvent a_event) {
			System.out.println (String.format ("### UnoDateFieldEventsListener.first : %s", a_event));
		}
		
		@Override
		public void last (SpinEvent a_event) {
			System.out.println (String.format ("### UnoDateFieldEventsListener.last : %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoDateFieldEventsListener l_unoDateFieldEventsListener = new UnoDateFieldEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("DateField1");
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).addSpinListener (l_unoDateFieldEventsListener);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).addTextListener (l_unoDateFieldEventsListener);
					UnoRuntime.queryInterface (XDateField.class, l_underlyingUnoControlInXControl).setLongFormat (false);
					UnoRuntime.queryInterface (XDateField.class, l_underlyingUnoControlInXControl).setStrictFormat (true);
					UnoRuntime.queryInterface (XDateField.class, l_underlyingUnoControlInXControl).setMin (new com.sun.star.util.Date ( (short) 1, (short) 1, (short) 1900));
					UnoRuntime.queryInterface (XDateField.class, l_underlyingUnoControlInXControl).setMax (new com.sun.star.util.Date ( (short) 31, (short) 12, (short) 3000));
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ();
					UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("DateFormat", Short.valueOf ( (short) 2));
					UnoRuntime.queryInterface (XDateField.class, l_underlyingUnoControlInXControl).setDate (new com.sun.star.util.Date ( (short) 2, (short) 5, (short) 2020));
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).up ();
					System.out.println (String.format ("### DateField1 text: %s", UnoRuntime.queryInterface (XDateField.class, l_underlyingUnoControlInXControl).getDate ().toString ()));
					~
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).removeTextListener (l_unoDateFieldEventsListener);
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).removeSpinListener (l_unoDateFieldEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import SpinEvent
~
from com.sun.star.awt import TextEvent
~
from com.sun.star.awt import XDateField
~
from com.sun.star.awt import XSpinField
~
from com.sun.star.awt import XSpinListener
~
from com.sun.star.awt import XTextComponent
~
from com.sun.star.awt import XTextListener
~
from com.sun.star.beans import XPropertySet
~
from com.sun.star.lang import EventObject
~
from com.sun.star.util import Date as com_sun_star_util_Date
~

class Test1Test:
	~
	class UnoDateFieldEventsListener (UnoBase, XTextListener, XSpinListener):
		def textChanged (a_this: "Test1Test.UnoDateFieldEventsListener", a_event: TextEvent)-> None:
			sys.stdout.write ("### UnoDateFieldEventsListener.textChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def up (a_this: "Test1Test.UnoDateFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoDateFieldEventsListener.up: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def down (a_this: "Test1Test.UnoDateFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoDateFieldEventsListener.down : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def first (a_this: "Test1Test.UnoDateFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoDateFieldEventsListener.first : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def last (a_this: "Test1Test.UnoDateFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoDateFieldEventsListener.last : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoDateFieldEventsListener", a_eventSource: EventObject)-> None:
			None
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoDateFieldEventsListener: "Test1Test.UnoDateFieldEventsListener" = Test1Test.UnoDateFieldEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("DateField1")
					cast (XSpinField, l_underlyingUnoControlInXControl).addSpinListener (l_unoDateFieldEventsListener)
					cast (XTextComponent, l_underlyingUnoControlInXControl).addTextListener (l_unoDateFieldEventsListener)
					cast (XDateField, l_underlyingUnoControlInXControl).setLongFormat (False)
					cast (XDateField, l_underlyingUnoControlInXControl).setStrictFormat (True)
					cast (XDateField, l_underlyingUnoControlInXControl).setMin (com_sun_star_util_Date (1, 1, 1900))
					cast (XDateField, l_underlyingUnoControlInXControl).setMax (com_sun_star_util_Date (31, 12, 3000))
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ()
					cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("DateFormat", 2)
					cast (XDateField, l_underlyingUnoControlInXControl).setDate (com_sun_star_util_Date (2, 5, 2020))
					cast (XSpinField, l_underlyingUnoControlInXControl).up ()
					sys.stdout.write ("### DateField1 text: {0:s}\n".format (str (cast (XDateField, l_underlyingUnoControlInXControl).getDate ())))
					sys.stdout.flush ()
					~
					cast (XTextComponent, l_underlyingUnoControlInXControl).removeTextListener (l_unoDateFieldEventsListener)
					cast (XSpinField, l_underlyingUnoControlInXControl).removeSpinListener (l_unoDateFieldEventsListener)


1-14: TimeField


Special-Student-7
Let us handle a TimeField control.

This gets the TimeField control, registers some events listeners to it, sets the format of it, sets the range of it, sets a value to it, moves the value of it, gets the value of it, and unregisters the events listeners from it.

@Java Source Code
~
import com.sun.star.awt.SpinEvent;
~
import com.sun.star.awt.TextEvent;
~
import com.sun.star.awt.XControlModel;
~
import com.sun.star.awt.XSpinField;
~
import com.sun.star.awt.XSpinListener;
~
import com.sun.star.awt.XTimeField;
~
import com.sun.star.awt.XTextComponent;
~
import com.sun.star.awt.XTextListener;
~
import com.sun.star.beans.XPropertySet;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoTimeFieldEventsListener extends WeakBase implements XTextListener, XSpinListener {
		@Override
		public void textChanged (TextEvent a_event) {
			System.out.println (String.format ("### UnoTimeFieldEventsListener.textChanged: %s", a_event));
		}
		
		@Override
		public void up (SpinEvent a_event) {
			System.out.println (String.format ("### UnoTimeFieldEventsListener.up: %s", a_event));
		}
		
		@Override
		public void down (SpinEvent a_event) {
			System.out.println (String.format ("### UnoTimeFieldEventsListener.down : %s", a_event));
		}
		
		@Override
		public void first (SpinEvent a_event) {
			System.out.println (String.format ("### UnoTimeFieldEventsListener.first : %s", a_event));
		}
		
		@Override
		public void last (SpinEvent a_event) {
			System.out.println (String.format ("### UnoTimeFieldEventsListener.last : %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoTimeFieldEventsListener l_unoTimeFieldEventsListener = new UnoTimeFieldEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("TimeField1");
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).addSpinListener (l_unoTimeFieldEventsListener);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).addTextListener (l_unoTimeFieldEventsListener);
					UnoRuntime.queryInterface (XTimeField.class, l_underlyingUnoControlInXControl).setStrictFormat (true);
					UnoRuntime.queryInterface (XTimeField.class, l_underlyingUnoControlInXControl).setMin (new com.sun.star.util.Time (0, (short) 0, (short) 0, (short) 0, false));
					UnoRuntime.queryInterface (XTimeField.class, l_underlyingUnoControlInXControl).setMax (new com.sun.star.util.Time (999999999, (short) 59, (short) 59, (short) 23, false));
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ();
					UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("TimeFormat", Short.valueOf ( (short) 1));
					UnoRuntime.queryInterface (XTimeField.class, l_underlyingUnoControlInXControl).setTime (new com.sun.star.util.Time (33, (short) 31, (short) 7, (short) 14, false));
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).up ();
					System.out.println (String.format ("### TimeField1 text: %s", UnoRuntime.queryInterface (XTimeField.class, l_underlyingUnoControlInXControl).getTime ().toString ()));
					~
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).removeTextListener (l_unoTimeFieldEventsListener);
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).removeSpinListener (l_unoTimeFieldEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import SpinEvent
~
from com.sun.star.awt import TextEvent
~
from com.sun.star.awt import XTimeField
~
from com.sun.star.awt import XSpinField
~
from com.sun.star.awt import XSpinListener
~
from com.sun.star.awt import XTextComponent
~
from com.sun.star.awt import XTextListener
~
from com.sun.star.beans import XPropertySet
~
from com.sun.star.lang import EventObject
~
from com.sun.star.util import Time as com_sun_star_util_Time
~

class Test1Test:
	~
	class UnoTimeFieldEventsListener (UnoBase, XTextListener, XSpinListener):
		def textChanged (a_this: "Test1Test.UnoTimeFieldEventsListener", a_event: TextEvent)-> None:
			sys.stdout.write ("### UnoTimeFieldEventsListener.textChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def up (a_this: "Test1Test.UnoTimeFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoTimeFieldEventsListener.up: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def down (a_this: "Test1Test.UnoTimeFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoTimeFieldEventsListener.down : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def first (a_this: "Test1Test.UnoTimeFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoTimeFieldEventsListener.first : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def last (a_this: "Test1Test.UnoTimeFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoTimeFieldEventsListener.last : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoTimeFieldEventsListener", a_eventSource: EventObject)-> None:
			None
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoTimeFieldEventsListener: "Test1Test.UnoTimeFieldEventsListener" = Test1Test.UnoTimeFieldEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("TimeField1")
					cast (XSpinField, l_underlyingUnoControlInXControl).addSpinListener (l_unoTimeFieldEventsListener)
					cast (XTextComponent, l_underlyingUnoControlInXControl).addTextListener (l_unoTimeFieldEventsListener)
					cast (XTimeField, l_underlyingUnoControlInXControl).setStrictFormat (True)
					cast (XTimeField, l_underlyingUnoControlInXControl).setMin (com_sun_star_util_Time (0, 0, 0, 0, False))
					cast (XTimeField, l_underlyingUnoControlInXControl).setMax (com_sun_star_util_Time (999999999, 59, 59, 23, False))
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ()
					cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("TimeFormat", 1)
					cast (XTimeField, l_underlyingUnoControlInXControl).setTime (com_sun_star_util_Time (33, 31, 7, 14, False))
					cast (XSpinField, l_underlyingUnoControlInXControl).up ()
					sys.stdout.write ("### TimeField1 text: {0:s}\n".format (str (cast (XTimeField, l_underlyingUnoControlInXControl).getTime ())))
					sys.stdout.flush ()
					~
					cast (XTextComponent, l_underlyingUnoControlInXControl).removeTextListener (l_unoTimeFieldEventsListener)
					cast (XSpinField, l_underlyingUnoControlInXControl).removeSpinListener (l_unoTimeFieldEventsListener)


1-15: NumericField


Special-Student-7
Let us handle a NumericField control.

This gets the NumericField control, registers some events listeners to it, sets the range of it, sets a value to it, gets the value of it, and unregisters the events listeners from it.

@Java Source Code
~
import com.sun.star.awt.SpinEvent;
~
import com.sun.star.awt.TextEvent;
~
import com.sun.star.awt.XNumericField;
~
import com.sun.star.awt.XSpinField;
~
import com.sun.star.awt.XSpinListener;
~
import com.sun.star.awt.XTextComponent;
~
import com.sun.star.awt.XTextListener;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoNumericFieldEventsListener extends WeakBase implements XTextListener, XSpinListener {
		@Override
		public void textChanged (TextEvent a_event) {
			System.out.println (String.format ("### UnoNumericFieldEventsListener.textChanged: %s", a_event));
		}
		
		@Override
		public void up (SpinEvent a_event) {
			System.out.println (String.format ("### UnoNumericFieldEventsListener.up: %s", a_event));
		}
		
		@Override
		public void down (SpinEvent a_event) {
			System.out.println (String.format ("### UnoNumericFieldEventsListener.down : %s", a_event));
		}
		
		@Override
		public void first (SpinEvent a_event) {
			System.out.println (String.format ("### UnoNumericFieldEventsListener.first : %s", a_event));
		}
		
		@Override
		public void last (SpinEvent a_event) {
			System.out.println (String.format ("### UnoNumericFieldEventsListener.last : %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoNumericFieldEventsListener l_unoNumericFieldEventsListener = new UnoNumericFieldEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("NumericField1");
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).addTextListener (l_unoNumericFieldEventsListener);
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).addSpinListener (l_unoNumericFieldEventsListener);
					UnoRuntime.queryInterface (XNumericField.class, l_underlyingUnoControlInXControl).setMin (0);
					UnoRuntime.queryInterface (XNumericField.class, l_underlyingUnoControlInXControl).setMax (100);
					UnoRuntime.queryInterface (XNumericField.class, l_underlyingUnoControlInXControl).setValue (33);
					System.out.println (String.format ("### NumericField1 value: %f", UnoRuntime.queryInterface (XNumericField.class, l_underlyingUnoControlInXControl).getValue ()));
					~
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).removeSpinListener (l_unoNumericFieldEventsListener);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).removeTextListener (l_unoNumericFieldEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import SpinEvent
~
from com.sun.star.awt import TextEvent
~
from com.sun.star.awt import XNumericField
~
from com.sun.star.awt import XSpinField
~
from com.sun.star.awt import XSpinListener
~
from com.sun.star.awt import XTextComponent
~
from com.sun.star.awt import XTextListener
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoNumericFieldEventsListener (UnoBase, XTextListener, XSpinListener):
		def textChanged (a_this: "Test1Test.UnoNumericFieldEventsListener", a_event: TextEvent)-> None:
			sys.stdout.write ("### UnoNumericFieldEventsListener.textChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def up (a_this: "Test1Test.UnoNumericFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoNumericFieldEventsListener.up: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def down (a_this: "Test1Test.UnoNumericFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoNumericFieldEventsListener.down : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def first (a_this: "Test1Test.UnoNumericFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoNumericFieldEventsListener.first : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def last (a_this: "Test1Test.UnoNumericFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoNumericFieldEventsListener.last : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoNumericFieldEventsListener", a_eventSource: EventObject)-> None:
			None
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoNumericFieldEventsListener: "Test1Test.UnoNumericFieldEventsListener" = Test1Test.UnoNumericFieldEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("NumericField1")
					cast (XTextComponent, l_underlyingUnoControlInXControl).addTextListener (l_unoNumericFieldEventsListener)
					cast (XSpinField, l_underlyingUnoControlInXControl).addSpinListener (l_unoNumericFieldEventsListener)
					cast (XNumericField, l_underlyingUnoControlInXControl).setMin (0)
					cast (XNumericField, l_underlyingUnoControlInXControl).setMax (100)
					cast (XNumericField, l_underlyingUnoControlInXControl).setValue (33)
					sys.stdout.write ("### NumericField1 value: {0:f}\n".format (cast (XNumericField, l_underlyingUnoControlInXControl).getValue ()))
					sys.stdout.flush ()
					~
					cast (XSpinField, l_underlyingUnoControlInXControl).removeSpinListener (l_unoNumericFieldEventsListener)
					cast (XTextComponent, l_underlyingUnoControlInXControl).removeTextListener (l_unoNumericFieldEventsListener)


1-16: CurrencyField


Special-Student-7
Let us handle a CurrencyField control.

This gets the CurrencyField control, registers some events listeners to it, sets the range of it, sets a value to it, gets the value of it, and unregisters the events listeners from it.

@Java Source Code
~
import com.sun.star.awt.SpinEvent;
~
import com.sun.star.awt.TextEvent;
~
import com.sun.star.awt.XCurrencyField;
~
import com.sun.star.awt.XSpinField;
~
import com.sun.star.awt.XSpinListener;
~
import com.sun.star.awt.XTextComponent;
~
import com.sun.star.awt.XTextListener;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoCurrencyFieldEventsListener extends WeakBase implements XTextListener, XSpinListener {
		@Override
		public void textChanged (TextEvent a_event) {
			System.out.println (String.format ("### UnoCurrencyFieldEventsListener.textChanged: %s", a_event));
		}
		
		@Override
		public void up (SpinEvent a_event) {
			System.out.println (String.format ("### UnoCurrencyFieldEventsListener.up: %s", a_event));
		}
		
		@Override
		public void down (SpinEvent a_event) {
			System.out.println (String.format ("### UnoCurrencyFieldEventsListener.down : %s", a_event));
		}
		
		@Override
		public void first (SpinEvent a_event) {
			System.out.println (String.format ("### UnoCurrencyFieldEventsListener.first : %s", a_event));
		}
		
		@Override
		public void last (SpinEvent a_event) {
			System.out.println (String.format ("### UnoCurrencyFieldEventsListener.last : %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoCurrencyFieldEventsListener l_unoCurrencyFieldEventsListener = new UnoCurrencyFieldEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("CurrencyField1");
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).addTextListener (l_unoCurrencyFieldEventsListener);
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).addSpinListener (l_unoCurrencyFieldEventsListener);
					UnoRuntime.queryInterface (XCurrencyField.class, l_underlyingUnoControlInXControl).setMin (0);
					UnoRuntime.queryInterface (XCurrencyField.class, l_underlyingUnoControlInXControl).setMax (100);
					UnoRuntime.queryInterface (XCurrencyField.class, l_underlyingUnoControlInXControl).setValue (33);
					System.out.println (String.format ("### CurrencyField1 value: %f", UnoRuntime.queryInterface (XCurrencyField.class, l_underlyingUnoControlInXControl).getValue ()));
					~
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).removeSpinListener (l_unoCurrencyFieldEventsListener);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).removeTextListener (l_unoCurrencyFieldEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import SpinEvent
~
from com.sun.star.awt import TextEvent
~
from com.sun.star.awt import XCurrencyField
~
from com.sun.star.awt import XSpinField
~
from com.sun.star.awt import XSpinListener
~
from com.sun.star.awt import XTextComponent
~
from com.sun.star.awt import XTextListener
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoCurrencyFieldEventsListener (UnoBase, XTextListener, XSpinListener):
		def textChanged (a_this: "Test1Test.UnoCurrencyFieldEventsListener", a_event: TextEvent)-> None:
			sys.stdout.write ("### UnoCurrencyFieldEventsListener.textChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def up (a_this: "Test1Test.UnoCurrencyFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoCurrencyFieldEventsListener.up: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def down (a_this: "Test1Test.UnoCurrencyFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoCurrencyFieldEventsListener.down : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def first (a_this: "Test1Test.UnoCurrencyFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoCurrencyFieldEventsListener.first : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def last (a_this: "Test1Test.UnoCurrencyFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoCurrencyFieldEventsListener.last : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoCurrencyFieldEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoCurrencyFieldEventsListener: "Test1Test.UnoCurrencyFieldEventsListener" = Test1Test.UnoCurrencyFieldEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("CurrencyField1")
					cast (XTextComponent, l_underlyingUnoControlInXControl).addTextListener (l_unoCurrencyFieldEventsListener)
					cast (XSpinField, l_underlyingUnoControlInXControl).addSpinListener (l_unoCurrencyFieldEventsListener)
					cast (XCurrencyField, l_underlyingUnoControlInXControl).setMin (0)
					cast (XCurrencyField, l_underlyingUnoControlInXControl).setMax (100)
					cast (XCurrencyField, l_underlyingUnoControlInXControl).setValue (33)
					sys.stdout.write ("### CurrencyField1 value: {0:f}\n".format (cast (XCurrencyField, l_underlyingUnoControlInXControl).getValue ()))
					sys.stdout.flush ()
					~
					cast (XSpinField, l_underlyingUnoControlInXControl).removeSpinListener (l_unoCurrencyFieldEventsListener)
					cast (XTextComponent, l_underlyingUnoControlInXControl).removeTextListener (l_unoCurrencyFieldEventsListener)


1-17: FormattedField


Special-Student-7
Let us handle a FormattedField control.

This gets the FormattedField control, registers some events listeners to it, sets a value to it, gets the value of it, and unregisters the events listeners from it.

@Java Source Code
~
import com.sun.star.awt.SpinEvent;
~
import com.sun.star.awt.TextEvent;
~
import com.sun.star.awt.XSpinField;
~
import com.sun.star.awt.XSpinListener;
~
import com.sun.star.awt.XTextComponent;
~
import com.sun.star.awt.XTextListener;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoFormattedFieldEventsListener extends WeakBase implements XTextListener, XSpinListener {
		@Override
		public void textChanged (TextEvent a_event) {
			System.out.println (String.format ("### UnoFormattedFieldEventsListener.textChanged: %s", a_event));
		}
		
		@Override
		public void up (SpinEvent a_event) {
			System.out.println (String.format ("### UnoFormattedFieldEventsListener.up: %s", a_event));
		}
		
		@Override
		public void down (SpinEvent a_event) {
			System.out.println (String.format ("### UnoFormattedFieldEventsListener.down : %s", a_event));
		}
		
		@Override
		public void first (SpinEvent a_event) {
			System.out.println (String.format ("### UnoFormattedFieldEventsListener.first : %s", a_event));
		}
		
		@Override
		public void last (SpinEvent a_event) {
			System.out.println (String.format ("### UnoFormattedFieldEventsListener.last : %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoFormattedFieldEventsListener l_unoFormattedFieldEventsListener = new UnoFormattedFieldEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("FormattedField1");
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).addTextListener (l_unoFormattedFieldEventsListener);
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).addSpinListener (l_unoFormattedFieldEventsListener);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).setText ("33");
					System.out.println (String.format ("### FormattedField1 value: %s", UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).getText ()));
					~
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).removeSpinListener (l_unoFormattedFieldEventsListener);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).removeTextListener (l_unoFormattedFieldEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import SpinEvent
~
from com.sun.star.awt import TextEvent
~
from com.sun.star.awt import XSpinField
~
from com.sun.star.awt import XSpinListener
~
from com.sun.star.awt import XTextComponent
~
from com.sun.star.awt import XTextListener
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoFormattedFieldEventsListener (UnoBase, XTextListener, XSpinListener):
		def textChanged (a_this: "Test1Test.UnoFormattedFieldEventsListener", a_event: TextEvent)-> None:
			sys.stdout.write ("### UnoFormattedFieldEventsListener.textChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def up (a_this: "Test1Test.UnoFormattedFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoFormattedFieldEventsListener.up: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def down (a_this: "Test1Test.UnoFormattedFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoFormattedFieldEventsListener.down : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def first (a_this: "Test1Test.UnoFormattedFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoFormattedFieldEventsListener.first : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def last (a_this: "Test1Test.UnoFormattedFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoFormattedFieldEventsListener.last : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoFormattedFieldEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoFormattedFieldEventsListener: "Test1Test.UnoFormattedFieldEventsListener" = Test1Test.UnoFormattedFieldEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("FormattedField1")
					cast (XTextComponent, l_underlyingUnoControlInXControl).addTextListener (l_unoFormattedFieldEventsListener)
					cast (XSpinField, l_underlyingUnoControlInXControl).addSpinListener (l_unoFormattedFieldEventsListener)
					cast (XTextComponent, l_underlyingUnoControlInXControl).setText ("33")
					sys.stdout.write ("### FormattedField1 value: {0:s}\n".format (cast (XTextComponent, l_underlyingUnoControlInXControl).getText ()))
					sys.stdout.flush ()
					~
					cast (XSpinField, l_underlyingUnoControlInXControl).removeSpinListener (l_unoFormattedFieldEventsListener)
					cast (XTextComponent, l_underlyingUnoControlInXControl).removeTextListener (l_unoFormattedFieldEventsListener)


1-18: PatternField


Special-Student-7
Let us handle a PatternField control.

This gets the PatternField control, registers some events listeners to it, sets the format of it, sets a value to it, gets the value of it, and unregisters the events listeners from it.

@Java Source Code
~
import com.sun.star.awt.SpinEvent;
~
import com.sun.star.awt.TextEvent;
~
import com.sun.star.awt.XPatternField;
~
import com.sun.star.awt.XSpinField;
~
import com.sun.star.awt.XSpinListener;
~
import com.sun.star.awt.XTextComponent;
~
import com.sun.star.awt.XTextListener;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoPatternFieldEventsListener extends WeakBase implements XTextListener, XSpinListener {
		@Override
		public void textChanged (TextEvent a_event) {
			System.out.println (String.format ("### UnoPatternFieldEventsListener.textChanged: %s", a_event));
		}
		
		@Override
		public void up (SpinEvent a_event) {
			System.out.println (String.format ("### UnoPatternFieldEventsListener.up: %s", a_event));
		}
		
		@Override
		public void down (SpinEvent a_event) {
			System.out.println (String.format ("### UnoPatternFieldEventsListener.down : %s", a_event));
		}
		
		@Override
		public void first (SpinEvent a_event) {
			System.out.println (String.format ("### UnoPatternFieldEventsListener.first : %s", a_event));
		}
		
		@Override
		public void last (SpinEvent a_event) {
			System.out.println (String.format ("### UnoPatternFieldEventsListener.last : %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoPatternFieldEventsListener l_unoPatternFieldEventsListener = new UnoPatternFieldEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("PatternField1");
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).addTextListener (l_unoPatternFieldEventsListener);
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).addSpinListener (l_unoPatternFieldEventsListener);
					UnoRuntime.queryInterface (XPatternField.class, l_underlyingUnoControlInXControl).setMasks ("000", "999");
					UnoRuntime.queryInterface (XPatternField.class, l_underlyingUnoControlInXControl).setString ("333");
					System.out.println (String.format ("### PatternField1 value: %s", UnoRuntime.queryInterface (XPatternField.class, l_underlyingUnoControlInXControl).getString ()));
					~
					UnoRuntime.queryInterface (XSpinField.class, l_underlyingUnoControlInXControl).removeSpinListener (l_unoPatternFieldEventsListener);
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).removeTextListener (l_unoPatternFieldEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import SpinEvent
~
from com.sun.star.awt import TextEvent
~
from com.sun.star.awt import XPatternField
~
from com.sun.star.awt import XSpinField
~
from com.sun.star.awt import XSpinListener
~
from com.sun.star.awt import XTextComponent
~
from com.sun.star.awt import XTextListener
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoPatternFieldEventsListener (UnoBase, XTextListener, XSpinListener):
		def textChanged (a_this: "Test1Test.UnoPatternFieldEventsListener", a_event: TextEvent)-> None:
			sys.stdout.write ("### UnoPatternFieldEventsListener.textChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def up (a_this: "Test1Test.UnoPatternFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoPatternFieldEventsListener.up: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def down (a_this: "Test1Test.UnoPatternFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoPatternFieldEventsListener.down : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def first (a_this: "Test1Test.UnoPatternFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoPatternFieldEventsListener.first : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def last (a_this: "Test1Test.UnoPatternFieldEventsListener", a_event: SpinEvent)-> None:
			sys.stdout.write ("### UnoPatternFieldEventsListener.last : {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoPatternFieldEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoPatternFieldEventsListener: "Test1Test.UnoPatternFieldEventsListener" = Test1Test.UnoPatternFieldEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("PatternField1")
					cast (XTextComponent, l_underlyingUnoControlInXControl).addTextListener (l_unoPatternFieldEventsListener)
					cast (XSpinField, l_underlyingUnoControlInXControl).addSpinListener (l_unoPatternFieldEventsListener)
					cast (XPatternField, l_underlyingUnoControlInXControl).setMasks ("000", "999")
					cast (XPatternField, l_underlyingUnoControlInXControl).setString ("333")
					sys.stdout.write ("### PatternField1 value: {0:s}\n".format (cast (XPatternField, l_underlyingUnoControlInXControl).getString ()))
					sys.stdout.flush ()
					~
					cast (XSpinField, l_underlyingUnoControlInXControl).removeSpinListener (l_unoPatternFieldEventsListener)
					cast (XTextComponent, l_underlyingUnoControlInXControl).removeTextListener (l_unoPatternFieldEventsListener)


1-19: FileControl


Special-Student-7
Let us handle a FileControl control.

This gets the FileControl control, registers a events listener to it, gets the value of it, and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.TextEvent;
~
import com.sun.star.awt.XTextComponent;
~
import com.sun.star.awt.XTextListener;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoFileControlEventsListener extends WeakBase implements XTextListener {
		@Override
		public void textChanged (TextEvent a_event) {
			System.out.println (String.format ("### UnoFileControlEventsListener.textChanged: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoFileControlEventsListener l_unoFileControlEventsListener = new UnoFileControlEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("FileControl1");
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).addTextListener (l_unoFileControlEventsListener);
					System.out.println (String.format ("### FileControl1 text: %s", UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).getText ()));

					~
					UnoRuntime.queryInterface (XTextComponent.class, l_underlyingUnoControlInXControl).removeTextListener (l_unoFileControlEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import TextEvent
~
from com.sun.star.awt import XTextComponent
~
from com.sun.star.awt import XTextListener
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoFileControlEventsListener (UnoBase, XTextListener):
		def textChanged (a_this: "Test1Test.UnoFileControlEventsListener", a_event: TextEvent)-> None:
			sys.stdout.write ("### UnoFileControlEventsListener.textChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoFileControlEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoFileControlEventsListener: "Test1Test.UnoFileControlEventsListener" = Test1Test.UnoFileControlEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("FileControl1")
					cast (XTextComponent, l_underlyingUnoControlInXControl).addTextListener (l_unoFileControlEventsListener)
					sys.stdout.write ("### FileControl1 text: {0:s}\n".format ( cast (XTextComponent, l_underlyingUnoControlInXControl).getText ()))
					sys.stdout.flush ()
					~
					cast (XTextComponent, l_underlyingUnoControlInXControl).removeTextListener (l_unoFileControlEventsListener)


1-20: TreeControl


Special-Student-7
Let us handle a TreeControl control.

This gets the TreeControl control, registers some events listeners to it, add some nodes to it, and unregisters the events listeners from it.

@Java Source Code
~
import com.sun.star.awt.XControlModel;
~
import com.sun.star.awt.tree.ExpandVetoException;
~
import com.sun.star.awt.tree.TreeExpansionEvent;
~
import com.sun.star.awt.tree.XMutableTreeDataModel;
~
import com.sun.star.awt.tree.XMutableTreeNode;
~
import com.sun.star.awt.tree.XTreeControl;
~
import com.sun.star.awt.tree.XTreeEditListener;
~
import com.sun.star.awt.tree.XTreeExpansionListener;
~
import com.sun.star.awt.tree.XTreeNode;
~
import com.sun.star.beans.XPropertySet;
~
import com.sun.star.util.VetoException;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoTreeControlEventsListener extends WeakBase implements XTreeExpansionListener, XTreeEditListener {
		@Override
		public void requestChildNodes (TreeExpansionEvent a_event) {
			System.out.println (String.format ("### UnoTreeControlEventsListener.requestChildNodes: %s", a_event));
		}
		 
		@Override
		public void treeExpanding (TreeExpansionEvent a_event) throws ExpandVetoException {
			System.out.println (String.format ("### UnoTreeControlEventsListener.treeExpanding: %s", a_event));
		}
		 
		@Override
		public void treeCollapsing (TreeExpansionEvent a_event) throws ExpandVetoException {
			System.out.println (String.format ("### UnoTreeControlEventsListener.treeCollapsing: %s", a_event));
		}
		
		@Override
		public void treeExpanded (TreeExpansionEvent a_event) {
			System.out.println (String.format ("### UnoTreeControlEventsListener.treeExpanded: %s", a_event));
		}
		
		@Override
		public void treeCollapsed (TreeExpansionEvent a_event) {
			System.out.println (String.format ("### UnoTreeControlEventsListener.treeCollapsed: %s", a_event));
		}
		
		@Override
		public void nodeEditing (XTreeNode a_node) throws VetoException {
			System.out.println (String.format ("### UnoTreeControlEventsListener.nodeEditing: %s", a_node));
		}
		 
		@Override
		public void nodeEdited (XTreeNode a_node, String a_newText) {
			System.out.println (String.format ("### UnoTreeControlEventsListener.nodeEdited: %s", a_node));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoTreeControlEventsListener l_unoTreeControlEventsListener = new UnoTreeControlEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("TreeControl1");
					UnoRuntime.queryInterface (XTreeControl.class, l_underlyingUnoControlInXControl).addTreeExpansionListener (l_unoTreeControlEventsListener);
					UnoRuntime.queryInterface (XTreeControl.class, l_underlyingUnoControlInXControl).addTreeEditListener (l_unoTreeControlEventsListener);
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ();
					XMutableTreeDataModel l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel = UnoRuntime.queryInterface (XMutableTreeDataModel.class, l_underlyingRemoteUnoObjectsContextInXComponentContext.getServiceManager ().createInstanceWithContext ("com.sun.star.awt.tree.MutableTreeDataModel", l_underlyingRemoteUnoObjectsContextInXComponentContext));
					XMutableTreeNode l_underlyingUnoMutableTreeRootNodeInXMutableTreeNode = (XMutableTreeNode) l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel.createNode ("the root", true);
					l_underlyingUnoMutableTreeRootNodeInXMutableTreeNode.appendChild (l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel.createNode ("the 1st child", true));
					l_underlyingUnoMutableTreeRootNodeInXMutableTreeNode.appendChild (l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel.createNode ("the 2nd child", true));
					l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel.setRoot (l_underlyingUnoMutableTreeRootNodeInXMutableTreeNode);
					UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("DataModel", l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel);
					~
					UnoRuntime.queryInterface (XTreeControl.class, l_underlyingUnoControlInXControl).removeTreeEditListener (l_unoTreeControlEventsListener);
					UnoRuntime.queryInterface (XTreeControl.class, l_underlyingUnoControlInXControl).removeTreeExpansionListener (l_unoTreeControlEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import XControlModel
~
from com.sun.star.awt.tree import TreeExpansionEvent
~
from com.sun.star.awt.tree import XMutableTreeDataModel
~
from com.sun.star.awt.tree import XMutableTreeNode
~
from com.sun.star.awt.tree import XTreeControl
~
from com.sun.star.awt.tree import XTreeEditListener
~
from com.sun.star.awt.tree import XTreeExpansionListener
~
from com.sun.star.awt.tree import XTreeNode
~
from com.sun.star.beans import XPropertySet
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoTreeControlEventsListener (UnoBase, XTreeExpansionListener, XTreeEditListener):
		def requestChildNodes (a_this: "Test1Test.UnoFileControlEventsListener", a_event: TreeExpansionEvent)-> None:
			sys.stdout.write ("### UnoTreeControlEventsListener.requestChildNodes: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def treeExpanding (a_this: "Test1Test.UnoFileControlEventsListener", a_event: TreeExpansionEvent)-> None:
			sys.stdout.write ("### UnoTreeControlEventsListener.treeExpanding: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def treeCollapsing (a_this: "Test1Test.UnoFileControlEventsListener", a_event: TreeExpansionEvent)-> None:
			sys.stdout.write ("### UnoTreeControlEventsListener.treeCollapsing: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def treeExpanded (a_this: "Test1Test.UnoFileControlEventsListener", a_event: TreeExpansionEvent)-> None:
			sys.stdout.write ("### UnoTreeControlEventsListener.treeExpanded: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def treeCollapsed (a_this: "Test1Test.UnoFileControlEventsListener", a_event: TreeExpansionEvent)-> None:
			sys.stdout.write ("### UnoTreeControlEventsListener.treeCollapsed: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def nodeEditing (a_this: "Test1Test.UnoFileControlEventsListener", a_node: XTreeNode)-> None:
			sys.stdout.write ("### UnoTreeControlEventsListener.nodeEditing: {0:s}\n".format (str (a_node)))
			sys.stdout.flush ()
		
		def nodeEdited (a_this: "Test1Test.UnoFileControlEventsListener", a_node: XTreeNode, a_newText: str)-> None:
			sys.stdout.write ("### UnoTreeControlEventsListener.nodeEdited: {0:s}\n".format (str (a_node)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoFileControlEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoTreeControlEventsListener: "Test1Test.UnoTreeControlEventsListener" = Test1Test.UnoTreeControlEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("TreeControl1")
					cast (XTreeControl, l_underlyingUnoControlInXControl).addTreeExpansionListener (l_unoTreeControlEventsListener)
					cast (XTreeControl, l_underlyingUnoControlInXControl).addTreeEditListener (l_unoTreeControlEventsListener)
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ()
					l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel: XMutableTreeDataModel = cast (XMutableTreeDataModel, l_underlyingRemoteUnoObjectsContextInXComponentContext.getServiceManager ().createInstanceWithContext ("com.sun.star.awt.tree.MutableTreeDataModel", l_underlyingRemoteUnoObjectsContextInXComponentContext))
					l_underlyingUnoMutableTreeRootNodeInXMutableTreeNode: XMutableTreeNode = cast (XMutableTreeNode, l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel.createNode ("the root", True))
					l_underlyingUnoMutableTreeRootNodeInXMutableTreeNode.appendChild (l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel.createNode ("the 1st child", True))
					l_underlyingUnoMutableTreeRootNodeInXMutableTreeNode.appendChild (l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel.createNode ("the 2nd child", True))
					l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel.setRoot (l_underlyingUnoMutableTreeRootNodeInXMutableTreeNode)
					cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).setPropertyValue ("DataModel", l_underlyingUnoMutableTreeDataModelInXMutableTreeDataModel)
					~
					cast (XTreeControl, l_underlyingUnoControlInXControl).removeTreeEditListener (l_unoTreeControlEventsListener)
					cast (XTreeControl, l_underlyingUnoControlInXControl).removeTreeExpansionListener (l_unoTreeControlEventsListener)


1-21: GridControl


Special-Student-7
Let us handle a GridControl control.

This gets the GridControl control, add some columns, registers corresponding column events listeners, sets the column sizes, sets the column titles, registers a rows events listener, registers a data events listener, add some rows, and unregisters the events listeners from it.

@Java Source Code
~
import com.sun.star.awt.XControlModel;
~
import com.sun.star.awt.grid.GridColumnEvent;
import com.sun.star.awt.grid.GridDataEvent;
import com.sun.star.awt.grid.GridSelectionEvent;
import com.sun.star.awt.grid.XGridColumn;
import com.sun.star.awt.grid.XGridColumnListener;
import com.sun.star.awt.grid.XGridColumnModel;
import com.sun.star.awt.grid.XGridDataListener;
import com.sun.star.awt.grid.XGridDataModel;
import com.sun.star.awt.grid.XGridRowSelection;
import com.sun.star.awt.grid.XGridSelectionListener;
import com.sun.star.awt.grid.XMutableGridDataModel;
~
import com.sun.star.beans.XPropertySet;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoGridColumnEventsListener extends WeakBase implements XGridColumnListener {
		@Override
		public void columnChanged (GridColumnEvent a_event) { 
			System.out.println (String.format ("### UnoGridColumnEventsListener.columnChanged: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	private static class UnoGridRowSelectionEventsListener extends WeakBase implements XGridSelectionListener {
		@Override
		public void selectionChanged (GridSelectionEvent a_event) {
			System.out.println (String.format ("### UnoGridRowSelectionEventsListener.selectionChanged: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	private static class UnoGridDataEventsListener extends WeakBase implements XGridDataListener {
		@Override
		public void rowsInserted (GridDataEvent a_event) {
			System.out.println (String.format ("### UnoGridDataEventsListener.rowsInserted: %s", a_event));
		}
		
		@Override
		public void rowsRemoved (GridDataEvent a_event) {
			System.out.println (String.format ("### UnoGridDataEventsListener.rowsRemoved: %s", a_event));
		}
		 
		@Override
		public void dataChanged (GridDataEvent a_event) {
			System.out.println (String.format ("### UnoGridDataEventsListener.dataChanged: %s", a_event));
		}
		 
		@Override
		public void rowHeadingChanged (GridDataEvent a_event) {
			System.out.println (String.format ("### UnoGridDataEventsListener.rowHeadingChanged: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoGridColumnEventsListener l_unoGridColumnEventsListener = new UnoGridColumnEventsListener ();
					UnoGridRowSelectionEventsListener l_unoGridRowSelectionEventsListener = new UnoGridRowSelectionEventsListener ();
					UnoGridDataEventsListener l_unoGridDataEventsListener = new UnoGridDataEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("GridControl1");
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ();
					XGridColumnModel l_underlyingUnoGridColumnModelInXGridColumnModel = (XGridColumnModel) ( (com.sun.star.uno.Any) UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("ColumnModel")).getObject ();
					XGridColumn l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.createColumn ();
					l_underlyingUnoGridColumnInXGridColumn.addGridColumnListener (l_unoGridColumnEventsListener);
					l_underlyingUnoGridColumnInXGridColumn.setColumnWidth (20);
					l_underlyingUnoGridColumnInXGridColumn.setMaxWidth (20);
					l_underlyingUnoGridColumnInXGridColumn.setTitle ("C1");
					l_underlyingUnoGridColumnModelInXGridColumnModel.addColumn (l_underlyingUnoGridColumnInXGridColumn);
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.createColumn ();
					l_underlyingUnoGridColumnInXGridColumn.addGridColumnListener (l_unoGridColumnEventsListener);
					l_underlyingUnoGridColumnInXGridColumn.setColumnWidth (20);
					l_underlyingUnoGridColumnInXGridColumn.setMaxWidth (20);
					l_underlyingUnoGridColumnInXGridColumn.setTitle ("C2");
					l_underlyingUnoGridColumnModelInXGridColumnModel.addColumn (l_underlyingUnoGridColumnInXGridColumn);
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.createColumn ();
					l_underlyingUnoGridColumnInXGridColumn.addGridColumnListener (l_unoGridColumnEventsListener);
					l_underlyingUnoGridColumnInXGridColumn.setColumnWidth (20);
					l_underlyingUnoGridColumnInXGridColumn.setMaxWidth (20);
					l_underlyingUnoGridColumnInXGridColumn.setTitle ("C3");
					l_underlyingUnoGridColumnModelInXGridColumnModel.addColumn (l_underlyingUnoGridColumnInXGridColumn);
					UnoRuntime.queryInterface (XGridRowSelection.class, l_underlyingUnoControlInXControl).addSelectionListener (l_unoGridRowSelectionEventsListener);
					XGridDataModel l_underlyingUnoGridDataModelInXGridDataModel = (XGridDataModel) ( (com.sun.star.uno.Any) UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("GridDataModel")).getObject ();
					XMutableGridDataModel l_underlyingUnoMutableGridDataModelInXMutableGridDataModel = UnoRuntime.queryInterface (XMutableGridDataModel.class, l_underlyingUnoGridDataModelInXGridDataModel);
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel.addGridDataListener (l_unoGridDataEventsListener);
					Object [] l_rowData = new Object [3];
					l_rowData [0] = "D11";
					l_rowData [1] = "D12";
					l_rowData [2] = "D13";
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel.addRow ("Row1", l_rowData);
					l_rowData [0] = "D21";
					l_rowData [1] = "D22";
					l_rowData [2] = "D23";
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel.addRow ("Row1", l_rowData);
					~
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ();
					l_underlyingUnoGridDataModelInXGridDataModel = (XGridDataModel) ( (com.sun.star.uno.Any) UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("GridDataModel")).getObject ();
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel = UnoRuntime.queryInterface (XMutableGridDataModel.class, l_underlyingUnoGridDataModelInXGridDataModel);
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel.removeGridDataListener (l_unoGridDataEventsListener);
					UnoRuntime.queryInterface (XGridRowSelection.class, l_underlyingUnoControlInXControl).removeSelectionListener (l_unoGridRowSelectionEventsListener);
					l_underlyingUnoGridColumnModelInXGridColumnModel = (XGridColumnModel) ( (com.sun.star.uno.Any) UnoRuntime.queryInterface (XPropertySet.class, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("ColumnModel")).getObject ();
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.getColumn (0);
					l_underlyingUnoGridColumnInXGridColumn.removeGridColumnListener (l_unoGridColumnEventsListener);
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.getColumn (1);
					l_underlyingUnoGridColumnInXGridColumn.removeGridColumnListener (l_unoGridColumnEventsListener);
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.getColumn (2);
					l_underlyingUnoGridColumnInXGridColumn.removeGridColumnListener (l_unoGridColumnEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import XControlModel
~
from com.sun.star.awt.grid import GridColumnEvent
from com.sun.star.awt.grid import GridDataEvent
from com.sun.star.awt.grid import GridSelectionEvent
from com.sun.star.awt.grid import XGridColumn
from com.sun.star.awt.grid import XGridColumnListener
from com.sun.star.awt.grid import XGridColumnModel
from com.sun.star.awt.grid import XGridDataListener
from com.sun.star.awt.grid import XGridDataModel
from com.sun.star.awt.grid import XGridRowSelection
from com.sun.star.awt.grid import XGridSelectionListener
from com.sun.star.awt.grid import XMutableGridDataModel
~
from com.sun.star.beans import XPropertySet
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoGridColumnEventsListener (UnoBase, XGridColumnListener):
		def columnChanged (a_this: "Test1Test.UnoGridColumnEventsListener", a_event: GridColumnEvent)-> None: 
			sys.stdout.write ("### UnoGridColumnEventsListener.columnChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoGridColumnEventsListener", a_eventSource: EventObject)-> None:
			None
	class UnoGridRowSelectionEventsListener (UnoBase, XGridSelectionListener):
		def selectionChanged (a_this: "Test1Test.UnoGridColumnEventsListener", a_event: GridSelectionEvent)-> None:
			sys.stdout.write ("### UnoGridRowSelectionEventsListener.selectionChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoGridColumnEventsListener", a_eventSource: EventObject)-> None:
			None
	class UnoGridDataEventsListener (UnoBase, XGridDataListener):
		def rowsInserted (a_this: "Test1Test.UnoGridColumnEventsListener", a_event: GridDataEvent)-> None:
			sys.stdout.write ("### UnoGridDataEventsListener.rowsInserted: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def rowsRemoved (a_this: "Test1Test.UnoGridColumnEventsListener", a_event: GridDataEvent)-> None:
			sys.stdout.write ("### UnoGridDataEventsListener.rowsRemoved: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def dataChanged (a_this: "Test1Test.UnoGridColumnEventsListener", a_event: GridDataEvent)-> None:
			sys.stdout.write ("### UnoGridDataEventsListener.dataChanged: {0:s}\n".format ( str (a_event)))
			sys.stdout.flush ()
		
		def rowHeadingChanged (a_this: "Test1Test.UnoGridColumnEventsListener", a_event: GridDataEvent)-> None:
			sys.stdout.write ("### UnoGridDataEventsListener.rowHeadingChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoGridColumnEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoGridColumnEventsListener: "Test1Test.UnoGridColumnEventsListener" = Test1Test.UnoGridColumnEventsListener ()
					l_unoGridRowSelectionEventsListener: "Test1Test.UnoGridRowSelectionEventsListener" = Test1Test.UnoGridRowSelectionEventsListener ()
					l_unoGridDataEventsListener: "Test1Test.UnoGridDataEventsListener" = Test1Test.UnoGridDataEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("GridControl1")
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ()
					l_underlyingUnoGridColumnModelInXGridColumnModel: XGridColumnModel = cast (XGridColumnModel, cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("ColumnModel"))
					l_underlyingUnoGridColumnInXGridColumn: XGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.createColumn ()
					l_underlyingUnoGridColumnInXGridColumn.addGridColumnListener (l_unoGridColumnEventsListener)
					l_underlyingUnoGridColumnInXGridColumn.ColumnWidth = 20
					l_underlyingUnoGridColumnInXGridColumn.MaxWidth = 20
					l_underlyingUnoGridColumnInXGridColumn.Title = "C1"
					l_underlyingUnoGridColumnModelInXGridColumnModel.addColumn (l_underlyingUnoGridColumnInXGridColumn)
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.createColumn ()
					l_underlyingUnoGridColumnInXGridColumn.addGridColumnListener (l_unoGridColumnEventsListener)
					l_underlyingUnoGridColumnInXGridColumn.ColumnWidth = 20
					l_underlyingUnoGridColumnInXGridColumn.MaxWidth = 20
					l_underlyingUnoGridColumnInXGridColumn.Title = "C2"
					l_underlyingUnoGridColumnModelInXGridColumnModel.addColumn (l_underlyingUnoGridColumnInXGridColumn)
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.createColumn ()
					l_underlyingUnoGridColumnInXGridColumn.addGridColumnListener (l_unoGridColumnEventsListener)
					l_underlyingUnoGridColumnInXGridColumn.ColumnWidth = 20
					l_underlyingUnoGridColumnInXGridColumn.MaxWidth = 20
					l_underlyingUnoGridColumnInXGridColumn.Title = "C3"
					l_underlyingUnoGridColumnModelInXGridColumnModel.addColumn (l_underlyingUnoGridColumnInXGridColumn)
					cast (XGridRowSelection, l_underlyingUnoControlInXControl).addSelectionListener (l_unoGridRowSelectionEventsListener)
					l_underlyingUnoGridDataModelInXGridDataModel: XGridDataModel = cast (XGridDataModel, cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("GridDataModel"))
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel: XMutableGridDataModel = cast (XMutableGridDataModel, l_underlyingUnoGridDataModelInXGridDataModel)
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel.addGridDataListener (l_unoGridDataEventsListener)
					l_rowData: List [object] = [None] * 3
					l_rowData [0] = "D11"
					l_rowData [1] = "D12"
					l_rowData [2] = "D13"
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel.addRow ("Row1", l_rowData)
					l_rowData [0] = "D21"
					l_rowData [1] = "D22"
					l_rowData [2] = "D23"
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel.addRow ("Row1", l_rowData)
					~
					l_underlyingUnoControlModelInXControlModel = l_underlyingUnoControlInXControl.getModel ()
					l_underlyingUnoGridDataModelInXGridDataModel = cast (XGridDataModel, cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("GridDataModel"))
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel = cast (XMutableGridDataModel, l_underlyingUnoGridDataModelInXGridDataModel)
					l_underlyingUnoMutableGridDataModelInXMutableGridDataModel.removeGridDataListener (l_unoGridDataEventsListener)
					cast (XGridRowSelection, l_underlyingUnoControlInXControl).removeSelectionListener (l_unoGridRowSelectionEventsListener)
					l_underlyingUnoGridColumnModelInXGridColumnModel = cast (XGridColumnModel, cast (XPropertySet, l_underlyingUnoControlModelInXControlModel).getPropertyValue ("ColumnModel"))
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.getColumn (0)
					l_underlyingUnoGridColumnInXGridColumn.removeGridColumnListener (l_unoGridColumnEventsListener)
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.getColumn (1)
					l_underlyingUnoGridColumnInXGridColumn.removeGridColumnListener (l_unoGridColumnEventsListener)
					l_underlyingUnoGridColumnInXGridColumn = l_underlyingUnoGridColumnModelInXGridColumnModel.getColumn (2)
					l_underlyingUnoGridColumnInXGridColumn.removeGridColumnListener (l_unoGridColumnEventsListener)


1-22: HyperlinkControl


Special-Student-7
Let us handle a HyperlinkControl control.

This gets the HyperlinkControl control, registers an events listener to it, sets a text to it, sets a URL to it, get the URL of it, get the text of it, and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.ActionEvent;
~
import com.sun.star.awt.XActionListener;
~
import com.sun.star.awt.XFixedHyperlink;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoHyperlinkEventsListener extends WeakBase implements XActionListener {
		@Override
		public void actionPerformed (ActionEvent a_event) {
			System.out.println (String.format ("### UnoHyperlinkEventsListener.actionPerformed: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoHyperlinkEventsListener l_unoHyperlinkEventsListener = new UnoHyperlinkEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("HyperlinkControl1");
					UnoRuntime.queryInterface (XFixedHyperlink.class, l_underlyingUnoControlInXControl).addActionListener (l_unoHyperlinkEventsListener);
					UnoRuntime.queryInterface (XFixedHyperlink.class, l_underlyingUnoControlInXControl).setText ("localhost");
					UnoRuntime.queryInterface (XFixedHyperlink.class, l_underlyingUnoControlInXControl).setURL ("http://localhost/");
					System.out.println (String.format ("### HyperlinkControl1 URL: %s", UnoRuntime.queryInterface (XFixedHyperlink.class, l_underlyingUnoControlInXControl).getURL ()));
					System.out.println (String.format ("### HyperlinkControl1 text: %s", UnoRuntime.queryInterface (XFixedHyperlink.class, l_underlyingUnoControlInXControl).getText ()));
					~
					UnoRuntime.queryInterface (XFixedHyperlink.class, l_underlyingUnoControlInXControl).removeActionListener (l_unoHyperlinkEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import ActionEvent
~
from com.sun.star.awt import XActionListener
~
from com.sun.star.awt import XFixedHyperlink
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoHyperlinkEventsListener (UnoBase, XActionListener):
		def actionPerformed (a_this: "Test1Test.UnoHyperlinkEventsListener", a_event: ActionEvent)-> None:
			sys.stdout.write ("### UnoHyperlinkEventsListener.actionPerformed: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoHyperlinkEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoHyperlinkEventsListener: "Test1Test.UnoHyperlinkEventsListener" = Test1Test.UnoHyperlinkEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("HyperlinkControl1")
					cast (XFixedHyperlink, l_underlyingUnoControlInXControl).addActionListener (l_unoHyperlinkEventsListener)
					cast (XFixedHyperlink, l_underlyingUnoControlInXControl).setText ("localhost")
					cast (XFixedHyperlink, l_underlyingUnoControlInXControl).setURL ("http://localhost/")
					sys.stdout.write ("### HyperlinkControl1 URL: {0:s}\n".format (cast (XFixedHyperlink, l_underlyingUnoControlInXControl).getURL ()))
					sys.stdout.flush ()
					sys.stdout.write ("### HyperlinkControl1 text: {0:s}\n".format (cast (XFixedHyperlink, l_underlyingUnoControlInXControl).getText ()))
					sys.stdout.flush ()
					~
					cast (XFixedHyperlink, l_underlyingUnoControlInXControl).removeActionListener (l_unoHyperlinkEventsListener)


1-23: SpinButton


Special-Student-7
Let us handle a SpinButton control.

This gets the SpinButton control, registers an events listener to it, set the orientation of it, sets the range of it, sets the increment of it, sets a value to it, gets the value of it, and unregisters the events listener from it.

@Java Source Code
~
import com.sun.star.awt.AdjustmentEvent;
~
import com.sun.star.awt.XAdjustmentListener;
~
import com.sun.star.awt.XSpinValue;
~
import com.sun.star.lang.EventObject;
~

public class Test1Test {
	~
	private static class UnoSpinValueEventsListener extends WeakBase implements XAdjustmentListener {
		@Override
		public void adjustmentValueChanged (AdjustmentEvent a_event) {
			System.out.println (String.format ("### UnoSpinValueEventsListener.adjustmentValueChanged: %s", a_event));
		}
		
		@Override
		public void disposing (EventObject a_eventSource) {
		}
	}
	
	~
	
	public static void main (String [] a_argumentsArray) {
					~
					UnoSpinValueEventsListener l_unoSpinValueEventsListener = new UnoSpinValueEventsListener ();
					~
					l_underlyingUnoControlInXControl = UnoRuntime.queryInterface (XControlContainer.class, l_underlyingUnoDialogInXDialog).getControl ("SpinButton1");
					UnoRuntime.queryInterface (XSpinValue.class, l_underlyingUnoControlInXControl).addAdjustmentListener (l_unoSpinValueEventsListener);
					UnoRuntime.queryInterface (XSpinValue.class, l_underlyingUnoControlInXControl).setOrientation (1);
					UnoRuntime.queryInterface (XSpinValue.class, l_underlyingUnoControlInXControl).setMinimum (0);
					UnoRuntime.queryInterface (XSpinValue.class, l_underlyingUnoControlInXControl).setMaximum (100);
					UnoRuntime.queryInterface (XSpinValue.class, l_underlyingUnoControlInXControl).setSpinIncrement (1);
					UnoRuntime.queryInterface (XSpinValue.class, l_underlyingUnoControlInXControl).setValue (33);
					
					System.out.println (String.format ("### SpinButton1 value: %d", UnoRuntime.queryInterface (XSpinValue.class, l_underlyingUnoControlInXControl).getValue ()));
					~
					UnoRuntime.queryInterface (XSpinValue.class, l_underlyingUnoControlInXControl).removeAdjustmentListener (l_unoSpinValueEventsListener);
	}
}

@Python Source Code
~
from com.sun.star.awt import AdjustmentEvent
~
from com.sun.star.awt import XAdjustmentListener
~
from com.sun.star.awt import XSpinValue
~
from com.sun.star.lang import EventObject
~

class Test1Test:
	~
	class UnoSpinValueEventsListener (UnoBase, XAdjustmentListener):
		def adjustmentValueChanged (a_this: "Test1Test.UnoSpinValueEventsListener", a_event: AdjustmentEvent)-> None:
			sys.stdout.write ("### UnoSpinValueEventsListener.adjustmentValueChanged: {0:s}\n".format (str (a_event)))
			sys.stdout.flush ()
		
		def disposing (a_this: "Test1Test.UnoSpinValueEventsListener", a_eventSource: EventObject)-> None:
			None
	
	~
	
	def main (a_arguments: List [str]) -> None:
					~
					l_unoSpinValueEventsListener: "Test1Test.UnoSpinValueEventsListener" = Test1Test.UnoSpinValueEventsListener ()
					~
					l_underlyingUnoControlInXControl = cast (XControlContainer, l_underlyingUnoDialogInXDialog).getControl ("SpinButton1")
					cast (XSpinValue, l_underlyingUnoControlInXControl).addAdjustmentListener (l_unoSpinValueEventsListener)
					cast (XSpinValue, l_underlyingUnoControlInXControl).setOrientation (1)
					cast (XSpinValue, l_underlyingUnoControlInXControl).setMinimum (0)
					cast (XSpinValue, l_underlyingUnoControlInXControl).setMaximum (100)
					cast (XSpinValue, l_underlyingUnoControlInXControl).setSpinIncrement (1)
					cast (XSpinValue, l_underlyingUnoControlInXControl).setValue (33)
					
					sys.stdout.write ("### SpinButton1 value: {0:d}\n".format (cast (XSpinValue, l_underlyingUnoControlInXControl).getValue ()))
					sys.stdout.flush ()
					~
					cast (XSpinValue, l_underlyingUnoControlInXControl).removeAdjustmentListener (l_unoSpinValueEventsListener)


References


<The previous article in this series | The table of contents of this series |