1778: def add_object(id, where = :this_page)
1779: obj = @loose_objects.detect { |ii| ii == id }
1780:
1781: if obj and @current_contents != obj
1782: case where
1783: when :all_pages, :this_page
1784: @add_loose_objects[obj] = where if where == :all_pages
1785: @current_contents.on_page.contents << obj if @current_contents.on_page
1786: when :even_pages
1787: @add_loose_objects[obj] = where
1788: page = @current_contents.on_page
1789: add_object(id) if (page.info.page_number % 2) == 0
1790: when :odd_pages
1791: @add_loose_objects[obj] = where
1792: page = @current_contents.on_page
1793: add_object(id) if (page.info.page_number % 2) == 1
1794: when :all_following_pages
1795: @add_loose_objects[obj] = :all_pages
1796: when :following_even_pages
1797: @add_loose_objects[obj] = :even_pages
1798: when :following_odd_pages
1799: @add_loose_objects[obj] = :odd_pages
1800: end
1801: end
1802: end