I'm developing an extension in Java for Libreoffice Calc.
How to perform redrawing?
It means refresh the view of spreadsheet between executing extension process.
If in VB, DoEvents.
			
			
													[Solved] Redraw from LibreOffice Calc extension
							 [Solved] Redraw from LibreOffice Calc extension
						[Solved] Redraw from LibreOffice Calc extension
		
													
							
						
			
			
			
			
					Last edited by HCL on Mon Jul 26, 2021 5:32 am, edited 2 times in total.
									
			
						
							OpenOffice 3.1 on Windows 10
			
						Re: Redraw from Lireoffice Calc extention
The following Java code has been recorded with the MRI extension using OpenOffice 4.1. I do not fully understand the X,Y arguments to the draw function but it seems to redraw the ContainerWindow.
[Tutorial] Introduction into object inspection with MRI
			
			
									
						
							[Tutorial] Introduction into object inspection with MRI
Code: Select all
import com.sun.star.awt.XView;
import com.sun.star.awt.XWindow;
import com.sun.star.frame.XController;
import com.sun.star.frame.XFrame;
import com.sun.star.frame.XModel;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
public static void snippet(XComponentContext xComponentContext, Object oInitialTarget)
{
	XModel xModel = UnoRuntime.queryInterface(
		XModel.class, oInitialTarget);
	XController xController = xModel.getCurrentController();
	
	XFrame xFrame = xController.getFrame();
	
	XWindow xWindow = xFrame.getContainerWindow();
	
	XView xView = UnoRuntime.queryInterface(
		XView.class, xWindow);
	
	xView.draw(0, 0);
	
}Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
			
						Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Redraw from Lireoffice Calc extention
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
			
						Re: Redraw from Lireoffice Calc extention
invalidate and invalidateRect are for repainting a particular window:
https://www.openoffice.org/api/docs/com ... wPeer.html
			
			
									
						
							https://www.openoffice.org/api/docs/com ... wPeer.html
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
			
						Re: Redraw from Lireoffice Calc extention
Thank you for your reply.
I could perform redrawing
But, when I perform redrawing by below code in for loop repeatedly,
redrawing is performed just first one time.
			
			
									
						
							I could perform redrawing

But, when I perform redrawing by below code in for loop repeatedly,
redrawing is performed just first one time.
Code: Select all
	   XModel model = UnoRuntime.queryInterface(XModel.class, target);
	   XController xController = model.getCurrentController();
	   XFrame frame = xController.getFrame();
	   XWindow window = frame.getContainerWindow();
	   XView view = UnoRuntime.queryInterface(XView.class, window);
	   view.draw(0, 0);
OpenOffice 3.1 on Windows 10
			
						