Can you write off IPR as R&D? You could probably massively over-inflate the value of the OO.org trademarks (and the copyrights). Donating then might be a financial mechanism, it dumps the trademarks but also prevents others from using them without having to use them yourself???
Oracle and Apache's accounts would show what's happening there.
For a tax break? No, those assets have already been written off as R&D. Maybe it's just for the PR. I cannot conceive of Larry Ellison doing anything out of altruism.