As part of my workflow, I frequently find myself in this scenario, where I have to select all the rows that are spanned by a single merged cell:

When doing this manually, I find that the keyboard shortcut "Shift+End" does exactly what I want without a fuss. It can tell exactly how many rows are spanned by the merged cell, and selects all the relevant data. So, in this example: Having B2 selected, it can tell that B2 spans from B2-B5, and it expands my selection to all the data in rows 2-5.

So far, so good. Making a macro that analyzes this data for my own purposes is easy, I simply use the functions getCurrentSelection() and getDataArray().
However, I've been trying to automate this process, so that I don't have to press "Shift+End" every time. This is where I find myself stuck. The most data that I can gather from B2 is whether B2.isMerged equals TRUE or FALSE, but this doesn't tell me B2's "height".
What function would I need to be able to tell that, in this example, B2 is actually a merged cell that goes from B2 to B5?
Thanks in advance. i am using OpenOffice 4.1.8 running on Windows 7.