UnoControlGrid and XView.setZoom()

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
hika
Posts: 39
Joined: Tue Apr 17, 2018 12:53 am

UnoControlGrid and XView.setZoom()

Post by hika »

I have a problem with the com.sun.star.awt.grid.UnoControlGrid control. I have it working OK, but I can not change the fontsize at runtime.
On all other controls I use the XView.setZoom() methode to resize control content, but it does nothing on the Grid control. So I tried adjusting the FontHeight property in the gridmodel and the Height property in the FontDescriptor. To no avail. I even tried recreating the columns and recreating the component and re-adding it to the dialog. Tricky but that works for adding and removing pull-down buttons at runtime. Nothing works, I can resize the columns and cells, but not the content.

On further reflection I guess the columns get their font settings from the ColumnModel (com.sun.star.awt.grid.DefaultGridColumnModel) which retrieves it on creation from the UnoControlGridModel where they are no longer exposed and editable. So possibly creating a new DefaultGridColumnModel based on changed UnoControlGridModel settings would work. I guess this is a bug.

Is there a way to access these presumably unexposed settings in the DefaultGridColumnModel? or to apply the XView.setZoom() methode on the columns?
openoffice 4.1.2/4.1.4 and libreoffice 5.4.4.2/5.4.5.1 both on Gentoo and on Windows
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: UnoControlGrid and XView.setZoom()

Post by JeJe »

We've had a similar question before. You could perhaps write your own grid control using a class module and labels to do what's missing with it?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
hika
Posts: 39
Joined: Tue Apr 17, 2018 12:53 am

Re: UnoControlGrid and XView.setZoom()

Post by hika »

So I guess that previous question did not result in a solution? Is the bug filled?

I can write a lot in Python, but C++ I can only read a little and I guess that is needed for what you do suggest.

I have been thinking of creating a more true grid control by stacking Inputboxes. This grid control is only a slightly extended listcontrol. But for right now I do not have the time.
openoffice 4.1.2/4.1.4 and libreoffice 5.4.4.2/5.4.5.1 both on Gentoo and on Windows
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: UnoControlGrid and XView.setZoom()

Post by JeJe »

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
hika
Posts: 39
Joined: Tue Apr 17, 2018 12:53 am

Re: UnoControlGrid and XView.setZoom()

Post by hika »

You could perhaps write your own grid control using a class module and labels to do what's missing with it?
I did some preliminary research for creating an adapted GridColumnModel.
If I create an instance of DefaultGridColumnModel through the servicemanager and replace it for the one in the ColumnModel property I get a fully functional grid, except ... the columns are invisible. I guess I have to make the new model known to the UnoControlGridModel, but I cannot find any functionality to do that. Any ideas?
openoffice 4.1.2/4.1.4 and libreoffice 5.4.4.2/5.4.5.1 both on Gentoo and on Windows
hika
Posts: 39
Joined: Tue Apr 17, 2018 12:53 am

Re: UnoControlGrid and XView.setZoom()

Post by hika »

Found that one. Has to be done prior to inserting it in the dialog.
openoffice 4.1.2/4.1.4 and libreoffice 5.4.4.2/5.4.5.1 both on Gentoo and on Windows
Post Reply