1841: def add_object(id, where = :this_page)
1842: obj = @loose_objects.detect { |ii| ii == id }
1843:
1844: if obj and @current_contents != obj
1845: case where
1846: when :all_pages, :this_page
1847: @add_loose_objects[obj] = where if where == :all_pages
1848: @current_contents.on_page.contents << obj if @current_contents.on_page
1849: when :even_pages
1850: @add_loose_objects[obj] = where
1851: page = @current_contents.on_page
1852: add_object(id) if (page.info.page_number % 2) == 0
1853: when :odd_pages
1854: @add_loose_objects[obj] = where
1855: page = @current_contents.on_page
1856: add_object(id) if (page.info.page_number % 2) == 1
1857: when :all_following_pages
1858: @add_loose_objects[obj] = :all_pages
1859: when :following_even_pages
1860: @add_loose_objects[obj] = :even_pages
1861: when :following_odd_pages
1862: @add_loose_objects[obj] = :odd_pages
1863: end
1864: end
1865: end