Actually I left out a step. Before I even do that, I am going to switch the code from creating abstract UNO objects e.g. uno::Reference<drawing::XShape> to creating explicit types e.g. rtl::Reference<SvxShapePolyPolygon>
Just to make it obvious what is happening, and easier to fix regressions.