sw: factor out a function to encapsulate object lifetimes
sw: factor out a function to encapsulate object lifetimes

Change-Id: Ie49cb4729d70f2b1fee9a2b7bd4ac095732a3d58

JurassicWordExcel/core,JurassicWordExcel/core,JurassicWordExcel/core,JurassicWordExcel/core,JurassicWordExcel/core,JurassicWordExcel/core,JurassicWordExcel/core,JurassicWordExcel/core,JurassicWordExcel/core,JurassicWordExcel/core