Placing cursor in the document for a given position using PyUNO - libreoffice

I am having Libreoffice7 installed with custom python 3.8.6 in Windows.
I want to use PyUNO to navigate the view cursor to a specific position based on the X, Y coordinates(of instance com.sun.star.awt.Point) in a writer document.
Is there a way by which this can be achieved? I am unable to find any resource or documentation that helps.
Please let me know if any other info or clarifications needed.
Thank you in advance.

Precise positioning using points and pixels is difficult or impossible with the UNO API. The numbers seem to be unpredictable, for example https://ask.libreoffice.org/t/what-is-the-base-for-cursor-x-position-in-basic/71827.
Instead, move the cursor to a character or paragraph or object, for example with goRight().
To investigate point positioning further, take a look at this discussion on positioning a dialog in Calc: https://ask.libreoffice.org/t/dynamically-position-a-dialog/67289/39

Related

How to get cursor position of McCLIM

I'm trying to add Input Method supportto McCLIM so that it can input CJK in McCLIM, using input method client like fcitx.
To draw fcitx better, I want to get the cursor position of text editing area when it changed.
looks like this:
I found something called cursor-position/stream-cursor-position, but I don't know how to get the cursor/stream currently focus on. I have tried *standard-output*, but it failed.
How could I do this?
I know you're not using libx11, but I'd like just show you how libX11 do this.
Basically this is done by XIM_SET_IC_VALUES in the protocol. The values the spot location within a nested value of preedit attributes.
The spot is simply a X point (x, y). Despite of that, the point is a relative coordinates to the focus window. The focus window is also a part of ic vlaues, with property name XNFocusWindow.
If you don't set focus window, the client window that passed through XCreateIC will be used as the focus window.
XVaNestedList preedit_attr;
preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &nspot, NULL);
XSetICValues(ic, XNPreeditAttributes, preedit_attr, NULL);
XFree(preedit_attr);

How to combine 2 boxes (not grouping) in visio

I have a diagram like this -
But I want to have a single box for SI-2130, 2131 & 2132, something like this. How do I do that. I tried various things but I'm stuck.
I do see these kind of diagrams, See this figure - but not sure how they did it
You need to edit the shape's geometry section.
First, ensure you have Developer Mode enabled. Right-click on the shape you want to edit and select Edit Shapesheet.
Near the top of the dit window you will see a Geometry section, this determines the shape and outline of your shape. You will need to insert new lines in this section for the new vertices.
For details on how to do this use your search engine on the details of the Geometry section.
Here is a starting place for you:
https://learn.microsoft.com/en-us/office/client-developer/visio/about-the-shapesheet-spreadsheet
Thanks peter. Yea, I got to know about the developer tab, and the options for 'union/intersection/subtract', etc. I could do this using this approach easily

Controlling the display range in a history' chart in the BCG library

I am asking to the StackOverflow for the first time.
If I rude to you, Tell me it. I will fix it.
Thank you.
Asking...
In the BCG Library. Using Visual Studio 2012, MFC.
I want to control the display of data range in the chart of historical.
When I call below functions.
CBCGPChartAxis::SetFixedMaximumDisplayValue
CBCGPChartAxis::SetFixedMinimumDisplayValue
CBCGPChartAxis::SetScrollRange
CBCGPChartAxis::EnableScroll
CBCGPChartAxis::EnableZoom
CBCGPChartAxis::SetAlwaysShowScrollBar
The chart just worked once.
And then, The chart seemed calling CBCGPChartAxis::SetAutoDisplayRange() automatically.
In other words. I don't want to call CBCGPChartAxis::SetAutoDisplayRange() automatically by the chart.
controlling the display range in a history' chart.
As far as I can see in the source code this function is called from serveral places. Maybe the easiest method to block this function is to call CBCGPChartSeries::ReplaceAxis and replace the automatically created axis with you implementation, that may ignore SetAutoDisplayRange.
If this doesn't help or as a method for further investigation:
Set a breakpoint and look into the callstack to see who calls this function and when this function is called. Again: As far as I understand the source code the function is called automatically when something changes in the chart.
CBCGPChartAxis* pXAxis=***;
pXAxis->EnableScroll();
pXAxis->EnableZoom();
pXAxis->ShowScrollBar();
pXAxis->SetFixedUnitCount(20,1);
20 means the totle number of V grid line in every visible range and 1 menas there is one point in a single range of every grid.
Might be your wanna.

add shape dynamically to activereports

I've got a kinda requirement in which there is a kinda graph (static picture) on a page. In that picture I need to plot some points dynamically. That means using a shape filled with blue color. The number of points is floating depending upon the number of applicants choosen. How can I make it work or how can I add new elements to report at runtime. Am working in ASP.nET using VB and the AR version is 6.2
If I have understood your query right,then you want to plot some points depending on the dynamic data.
A suggestion would be to make use of Chart control in report. The chart can be bound to anything from a list to an array and the data can be changed dynamically from time to time.
Moreover,you can set the backcolor and other properties of the Chart control to give a look and feel of your choice.
Regards,
Mohita
Sorry if my question makes any confusion.. Actually I was able to make that. So am just sharing that code if it helpful for someone else.. I put this to the report start event. (We are not permitted to make this in details event)
Dim pic As New DataDynamics.ActiveReports.Picture
pic.Image = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(String.Format("~/images/circle.gif", cl)))
pic.SizeMode = SizeModes.Zoom
Detail1.Controls.Add(pic)

Paragraph starting positioning itext

I am using IText library. I am using Paragraph in it cause the text is running and may be larger then one page. My problem is that I have to give paragraph starting positioning and I am unable to see any method regarding positioning it. Any help?
Something like that
page 2 is new page.... And this is whole one paragraph. I have starting coordinate of paragraph.
As explained in the comment section, you need ColumnText to achieve what you want. See for instance the MovieColumns1 example. You add text to a ColumnText instance with the addText() method. Then you set some parameters, such as the coordinates of the rectangle defining the absolute positions. This is done with the setSimpleColumn() method. To draw the text, you invoke the go() method. If the text didn't fit in the rectangle, ColumnText.hasMoreText(status) will return true, in which case, you trigger newPage(), define a new rectangle, change the Y position, and go() again as long as the column contains content.
All of this is explained in the documentation of which I'm the author. Reading the documentation saves time: your time as well as the time of the people on StackOverflow.
You could try searching for the first occurrence of a line break or carriage return, ie: Chr(13) and Chr(20).