You are better off doing the ship's tours in St. Petersburg and in Germany. The train departs for Berlin right from the ship practically.
You can doo all of the ports you mentioned on your own simply walking from the ship with the exception of Stockholm (they should provide a shuttle) and Gdansk (where you will also have a shuttle I would think)
There is tons to do in all the ports and unless there is a shore excursion that you are dying to take, just take off on your own and explore.
Check out
www.EuropePortReviews.com for reviews on each port you are visiting.
Have a great cruise!
Tom