Bug 33477 - com.sun.star.text.CellProperties.VertOrient do not work
Summary: com.sun.star.text.CellProperties.VertOrient do not work
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-25 08:24 UTC by bugzilla33
Modified: 2016-10-25 19:02 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
testcase (1.25 KB, text/plain)
2011-01-26 00:57 UTC, bugzilla33
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bugzilla33 2011-01-25 08:24:15 UTC
oTable = oDoc.createInstance ( "com.sun.star.text.TextTable" )
oTable.initialize( 5, 5 )
oCells = oTable.getCellRangeByPosition ( 0, 0, 4, 4 )

' Range chars weight works
oCells.CharWeight = 150

' Range vertical centering do not work!
oCells.VertOrient = 2
Comment 1 Noel Power 2011-01-25 12:41:35 UTC
uh, this macro snippet doesn't work for me,

oDoc isn't initialised with anything ( I presume it is the document e.g. thiscomponent ) but even after changing that I get an indexoutofbounds exception.

Please supply a working macro to demonstrate the problem ( or a macro in a document ). I am marking this as invalid for the moment, please reopen when you can supply the information
Comment 2 bugzilla33 2011-01-26 00:55:34 UTC
Sub Main

Dim oSM
Dim oDesk, oDoc As Object
Dim arg()
Dim oTable As Object
Dim oCells As Object
Dim oText As Object
Dim oCursor As Object

Dim oCellText As Object
Dim oCellCursor As Object
    
Set oSM = CreateObject("com.sun.star.ServiceManager")
Set oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
Set oDoc = oDesk.loadComponentFromURL("private:factory/swriter","_blank",0,arg())

Set oText = oDoc.Text
Set oCursor = oDoc.CurrentController.GetViewCursor

Set oTable = oDoc.createInstance("com.sun.star.text.TextTable")
oTable.initialize(1,2)
oText.InsertTextContent(oCursor,oTable,false)

Set oCells = oTable.getCellRangeByPosition (0,0,1,0)
' Range chars weight works
oCells.CharWeight = 150
' Range vertical centering do not work !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
oCells.VertOrient = 2

Set oCellText = oTable.GetCellByPosition(0,0)
Set oCellCursor = oCellText.CreateTextCursor
oCellText.InsertString(oCellCursor,"oCells.VertOrient = 2" + chr(13) + "do not" + chr(13) + "work",false)

Set oCellText = oTable.GetCellByPosition(1,0)
Set oCellCursor = oCellText.CreateTextCursor
oCellText.InsertString(oCellCursor,"bolder and vertical centered Text",false)

' amazingly, it works:
' oCellText.VertOrient = 2

End Sub
Comment 3 bugzilla33 2011-01-26 00:57:21 UTC
Created attachment 42513 [details]
testcase
Comment 4 bugzilla33 2011-01-26 00:59:52 UTC
Go to attachments for testcase with BASIC code.

VertOrient do not work with cellRange
...only with single cell.

Amazingly, others properties (eg CharWeight) work with cellRange.
Comment 5 bugzilla33 2011-01-26 01:04:11 UTC
Sub Main

Dim oSM
Dim oDesk, oDoc As Object
Dim arg()
Dim oTable As Object
Dim oCells As Object
Dim oText As Object
Dim oCursor As Object

Dim oCellText As Object
Dim oCellCursor As Object
    
Set oSM = CreateObject("com.sun.star.ServiceManager")
Set oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
Set oDoc = oDesk.loadComponentFromURL("private:factory/swriter","_blank",0,arg())

Set oText = oDoc.Text
Set oCursor = oDoc.CurrentController.GetViewCursor

Set oTable = oDoc.createInstance("com.sun.star.text.TextTable")
oTable.initialize(1,2)
oText.InsertTextContent(oCursor,oTable,false)

Set oCells = oTable.getCellRangeByPosition (0,0,1,0)
' Range chars weight works
oCells.CharWeight = 150
' Range vertical centering do not work !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
oCells.VertOrient = 2

Set oCellText = oTable.GetCellByPosition(0,0)
Set oCellCursor = oCellText.CreateTextCursor
oCellText.InsertString(oCellCursor,"oCells.VertOrient = 2" + chr(13) + "do not" + chr(13) + "work",false)

Set oCellText = oTable.GetCellByPosition(1,0)
Set oCellCursor = oCellText.CreateTextCursor
oCellText.InsertString(oCellCursor,"bolder and vertical centered Text",false)

' amazingly, it works:
' oCellText.VertOrient = 2

End Sub
Comment 6 bugzilla33 2011-01-26 01:05:07 UTC
sorry for re-code - by mistake
Comment 7 Noel Power 2011-01-26 04:27:38 UTC
ok, I can reproduce
Not sure if this is by design ( although sounds weird if it is ) 

cedric do you have any idea about this api ?
Comment 8 bugzilla33 2011-01-26 11:56:51 UTC
People from openoffice.org are working also.
This is their proposed fix:

http://www.openoffice.org/nonav/issues/showattachment.cgi/75659/i116420.diff
Comment 9 Noel Power 2011-01-27 01:32:22 UTC
can you review the patch mentioned in comment #8
Comment 10 Cédric Bosdonnat 2011-01-28 04:20:27 UTC
(In reply to comment #9)
> can you review the patch mentioned in comment #8

That patch looks good to me... and seems to indicate that this property wasn't handled at all in Writer tables...

I just pushed the patch to master branch under os's credentials as he is the original patch author:
http://cgit.freedesktop.org/libreoffice/writer/commit/?id=f53a5f8a3278b38b61579216c6fc767ed15aead8
Comment 11 Michael Meeks 2012-11-29 12:20:25 UTC
over the next few days, I'll have to revert this in 4.0 as part of the re-basing; we would want this code included at Apache first under the ALv2 before it can be then included in LibreOffice.

Sorry about this - one of a very small number of cases where that is necessary.
Comment 12 Not Assigned 2012-11-30 10:15:40 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=05af023b6a8f93405b13c4ddc4e23c29ed2a827c

Revert "i#116420, fdo#33477: Implemented VertOrient on Writer table cell..."



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 13 Julien Nabet 2013-10-19 23:10:31 UTC
Michael: the patch is still "Accepted" on Apache OpenOffice, are we stuck or may we include the patch again?
Comment 14 Michael Meeks 2013-10-20 05:23:34 UTC
it would be great if someone could independently fix this issue without basing their work on the AOO patch :-)
Comment 15 Cédric Bosdonnat 2014-01-20 09:00:37 UTC
Restricted my LibreOffice hacking area
Comment 16 Joel Madero 2015-05-02 15:43:05 UTC Comment hidden (obsolete)
Comment 17 Commit Notification 2015-12-18 14:49:04 UTC
Oliver Specht committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d95428278d54697064973a70c68fd2c40d174d8a

tdf#33477: added support of property VertOrient to cell range

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Julien Nabet 2016-07-03 10:42:41 UTC
Here's the backport to review on 5.1 branch:
https://gerrit.libreoffice.org/#/c/26879/

Let's consider this one to FIXED.
Comment 19 Julien Nabet 2016-07-03 11:24:35 UTC
(In reply to Julien Nabet from comment #18)
> Here's the backport to review on 5.1 branch:
> https://gerrit.libreoffice.org/#/c/26879/
> 
> Let's consider this one to FIXED.

The cherry-pick from master branch doesn't work because context code has changed (see my abandon comment).
If someone wants to reopen this tracker because the fix concerns only LO version >= 5.2.0, don't hesitate.