Search for the rightmost text that overlaps vertically and is to the left of the given box, but within the given left limit.
| 782 | // Search for the rightmost text that overlaps vertically and is to the left |
| 783 | // of the given box, but within the given left limit. |
| 784 | static int ExpandImageLeft(const TBOX& box, int left_limit, |
| 785 | ColPartitionGrid* part_grid) { |
| 786 | ColPartitionGridSearch search(part_grid); |
| 787 | ColPartition* part; |
| 788 | // Search right to left for any text that overlaps. |
| 789 | search.StartSideSearch(box.left(), box.bottom(), box.top()); |
| 790 | while ((part = search.NextSideSearch(true)) != NULL) { |
| 791 | if (part->flow() == BTFT_STRONG_CHAIN || part->flow() == BTFT_CHAIN) { |
| 792 | const TBOX& part_box(part->bounding_box()); |
| 793 | if (part_box.y_gap(box) < 0) { |
| 794 | if (part_box.right() > left_limit && part_box.right() < box.left()) |
| 795 | left_limit = part_box.right(); |
| 796 | break; |
| 797 | } |
| 798 | } |
| 799 | } |
| 800 | if (part != NULL) { |
| 801 | // Search for the nearest text up to the one we already found. |
| 802 | TBOX search_box(left_limit, box.bottom(), box.left(), box.top()); |
| 803 | search.StartRectSearch(search_box); |
| 804 | while ((part = search.NextRectSearch()) != NULL) { |
| 805 | if (part->flow() == BTFT_STRONG_CHAIN || part->flow() == BTFT_CHAIN) { |
| 806 | const TBOX& part_box(part->bounding_box()); |
| 807 | if (part_box.y_gap(box) < 0) { |
| 808 | if (part_box.right() > left_limit && part_box.right() < box.left()) { |
| 809 | left_limit = part_box.right(); |
| 810 | } |
| 811 | } |
| 812 | } |
| 813 | } |
| 814 | } |
| 815 | return left_limit; |
| 816 | } |
| 817 | |
| 818 | // Search for the leftmost text that overlaps vertically and is to the right |
| 819 | // of the given box, but within the given right limit. |
no test coverage detected