Issue 126391

Summary: race in using sdk api to set a fat border to a rectangle/range in a text table
Product: App Dev Reporter: Martin <mjmbakker>
Component: sdkAssignee: AOO issues mailing list <issues>
Status: UNCONFIRMED --- QA Contact:
Severity: Normal    
Priority: P5 (lowest) CC: knmc, marcelly.bernard, mseidel
Version: 4.1.3   
Target Milestone: ---   
Hardware: PC   
OS: Linux 64-bit   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Description Flags
wrong output
the correct output
java test program
Document with a table and two macros
used outborder with sleep 100
file as intended when using sleep 1000 none

Description Martin 2015-07-02 06:13:40 UTC
Created attachment 84811 [details]
wrong output

when trying to give a cellrange in a writer table fat borderlines more lines are fattened than ordered.

inserting a sleep a more than 500 msec corrects this behaviour.
the time is dependend on at least the amount of work done to the table ahead of this (eg , when also doing cell merging and text bolding this increases to 1000 msec)

 BorderLine borderstruct = new BorderLine();
 borderstruct.Color = 0;
 borderstruct.InnerLineWidth = 50;
 borderstruct.LineDistance = 0;
 borderstruct.OuterLineWidth = 0;
xCellRange = xCellRange.getCellRangeByPosition(1, 1, 2, 2);

XPropertySet xCellProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xCellRange);

xCellProperties.setPropertyValue("TopBorder", borderstruct);


xCellProperties.setPropertyValue("RightBorder", borderstruct);
xCellProperties.setPropertyValue("BottomBorder", borderstruct);
xCellProperties.setPropertyValue("LeftBorder", borderstruct);
Comment 1 Martin 2015-07-02 06:16:06 UTC
Created attachment 84812 [details]
the correct output
Comment 2 Martin 2015-07-03 09:00:02 UTC
also I noticed that opening the previous attachments from a windows pc using a00 4.1.1 both attachments look wrong!? As obvious from the code, there should be a thick line around the cellRange (1,1,2,2).
Comment 3 mroe 2015-07-03 09:19:08 UTC
Please provide a full running macro (sub/function) for testing. Best way is to include it in a macro library inside the document.
Comment 4 Martin 2015-07-03 13:04:11 UTC
Created attachment 84815 [details]
java test program

sorry, having to learn the aoo-basic proved to be to difficult without having any ide comfort or huge amounts of time. :(

Attached is the smallest netbeans/java project I could make showing the erronous behaviour. it is build from using the aoo plugin. no gui , all statics.
Comment 5 bmarcelly 2015-07-05 17:23:45 UTC
Created attachment 84817 [details]
Document with a table and two macros

Attachment 84811 [details] and attachment 84812 [details] are Writer files, extension odt is missing.

I confirm that both documents are incorrect, as seen from Windows 7. It may be due to an incorrect structure of the table after setting of borders.

Read the API documentation of BorderLine structure :
 InnerLineWidth is only used as the inner part of a double line.
 OuterLineWidth has to be used for a single line.

According to the API doc, your usage of the borders is incorrect.

My attachment FatBorders is a proof.
Macro Main1 contains the Basic equivalent to your Java code. Run it, save to another name, reload : the borders have changed.
Macro Main2 is the same, but uses OuterLineWidth instead of InnerLineWidth. This time the borders stay correct after reload.
Comment 6 Martin 2015-07-05 19:24:20 UTC
Comment on attachment 84817 [details]
Document with a table and two macros

I agree I mixed up the inner with the outer. 
Changing this however does not improve when using the java code. the race remains. ( guess basic is not fast enough?)
Comment 7 Martin 2015-07-06 18:34:53 UTC
Created attachment 84819 [details]
used outborder with sleep 100

changing to using OuterLineWidth indeed show the document on reload equivalant to what was saved, but it is still wrong when using non or little sleep
Comment 8 Martin 2015-07-06 18:38:36 UTC
Created attachment 84820 [details]
file as intended when using sleep 1000

changing to using OuterLineWidth indeed shows the document on reload equivelant to what was saved, and it is correct when using enough sleep
Comment 9 Keith N. McKenna 2020-05-27 14:57:08 UTC
As this appears not to have been ever been confirmed by another user. The use of the last confirmation field is not appropriate.
Comment 10 Martin 2021-09-08 08:12:26 UTC
4.1.10 stil fails.

(change  test code to read
borderstruct.Color = 0;
borderstruct.InnerLineWidth = 0;
borderstruct.LineDistance = 0;
borderstruct.OuterLineWidth = 50;

to accommodate comment 5)