Hi Max,

On 12/10/07 19:58, Maximilian Odendahl wrote:

I am using this function to get the position of a note:

SwRect SwCrsrShell::GetRectOfCurrentChar()
{
    SwContentNode* pNode = pCurrCrsr->GetContentNode();
    SwCntntFrm* pFrm = pNode->GetFrm( 0, pCurrCrsr->GetPoint(), FALSE );
    SwRect aRet;
    pFrm->GetCharRect( aRet, pCurrCrsr->GetPoint(), 0 )
    return aRet;
}

Up to now, I was under the impression that the height of the returned rect should be the font height of the position/ cursor height at that position. Well, seems like I was wrong, when actually verifying this it turns out that the height is the height of the largest height on this line and not the current one.

yes, this is correct.


Any idea how to get the height of the current position?

I tried also with:

.......
SwCrsrMoveState aTmpState( MV_NONE );
aTmpState.bRealHeight = TRUE;
pFrm->GetCharRect( aRet, *pCurCrsr->GetPoint(), &aTmpState );
.........

but this did not change anything. (this was just a guess anyway, not sure if this variable has anything to do with my issue)

You're almost there. I had a look at how the bRealHeight flag is evaluated. If bRealHeight is true, the 'real' height of the current character can be obtained this way:

pFrm->GetCharRect( aRet, *pCurCrsr->GetPoint(), &aTmpState );
const SwTwips nRealHeight = aTmpState.aRealHeight.Y()

and I think that aRealHeight.X() is the y-offset of the current character in its line.

Hope this helps,

Frank

--
Frank Meies (fme) - OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to