| 415 | } |
| 416 | |
| 417 | bool modifyBlockFormat(QTextBlockFormat &blockFormat, |
| 418 | Layout * where) |
| 419 | // ---------------------------------------------------------------------------- |
| 420 | // Modify a blockFormat with the given layout |
| 421 | // ---------------------------------------------------------------------------- |
| 422 | { |
| 423 | bool modified = false; |
| 424 | if (blockFormat.alignment() != |
| 425 | (where->alongX.toQtHAlign() | where->alongY.toQtVAlign())) |
| 426 | { |
| 427 | blockFormat.setAlignment(where->alongX.toQtHAlign() | |
| 428 | where->alongY.toQtVAlign()); |
| 429 | modified = true; |
| 430 | } |
| 431 | |
| 432 | if (blockFormat.topMargin() != where->top) |
| 433 | { |
| 434 | blockFormat.setTopMargin(where->top); |
| 435 | modified = true; |
| 436 | } |
| 437 | |
| 438 | if ( blockFormat.bottomMargin() != where->bottom) |
| 439 | { |
| 440 | blockFormat.setBottomMargin(where->bottom); |
| 441 | modified = true; |
| 442 | } |
| 443 | |
| 444 | if ( blockFormat.leftMargin() != where->left) |
| 445 | { |
| 446 | blockFormat.setLeftMargin(where->left); |
| 447 | modified = true; |
| 448 | } |
| 449 | |
| 450 | if ( blockFormat.rightMargin() != where->right) |
| 451 | { |
| 452 | blockFormat.setRightMargin(where->right); |
| 453 | modified = true; |
| 454 | } |
| 455 | |
| 456 | return modified; |
| 457 | |
| 458 | } |
| 459 | |
| 460 | |
| 461 | bool modifyCharFormat(QTextCharFormat &format, |
no test coverage detected