diff options
author | Sebastian Geerken <devnull@localhost> | 2015-01-31 17:15:19 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2015-01-31 17:15:19 +0100 |
commit | 20be26d3698eeeeaf2c0a9e55a28831466fc0bd1 (patch) | |
tree | dd0388e3b11d9a409809609f1bf946964ebb58f4 /dw/textblock.cc | |
parent | eac1c960c8c875715fdb8d123e4c19302d93eb00 (diff) |
Relative positions, part 6 (hopefully last): calculating the positions.
Diffstat (limited to 'dw/textblock.cc')
-rw-r--r-- | dw/textblock.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index bdb8067d..d1d2fb26 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -3191,4 +3191,27 @@ int Textblock::yOffsetOfLineToBeCreated () return result; } +/** + * Includes margin, border, and padding. Can be used without allocation. + */ +int Textblock::yOffsetOfLineCreated (Line *line) +{ + // Similar applies (regarding exactness) as to yOffsetOfLineToBeCreated. + + DBG_OBJ_ENTER0 ("line.yoffset", 0, "yOffsetOfLineToBeCreated"); + + int result; + + Line *firstLine = lines->getRef (0); + result = calcVerticalBorder (getStyle()->padding.top, + getStyle()->borderWidth.top, + getStyle()->margin.top + extraSpace.top, + firstLine->borderAscent, + firstLine->marginAscent) + - firstLine->borderAscent + line->top; + + DBG_OBJ_LEAVE_VAL ("%d", result); + return result; +} + } // namespace dw |