When I try to copy a small portion of PDF that contains a graphic like a table or like a syntax highlighted program code listing, the writer only paste text context and even removes formatting/white space or messes up this, so it does a very poor job. On the other hand if I copy from a web page (in most cases) or from my IDE, the pasting correctly pastes exact same graphics. How to fix this problem?
I think the formatting information is lost at the time you copy, and not at the paste. OpenOffice / LibreOffice have a pdf import plugin that converts a pdf into an editable document with graphics. After the import you'll be able to select only the bits that interest you.