diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 246a7fe8e3a1..e41e3ece60c4 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -5261,36 +5261,38 @@ void ScXMLExport::GetChangeTrackViewSettings(ScDocument& rDoc, uno::Sequence& rProps) { - if (GetModel().is()) + if (!GetModel().is()) + return; + + ScModelObj* pDocObj(comphelper::getFromUnoTunnel( GetModel() )); + if (!pDocObj) + return; + + SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject(); + if (pEmbeddedObj) { rProps.realloc(4); beans::PropertyValue* pProps(rProps.getArray()); - ScModelObj* pDocObj(comphelper::getFromUnoTunnel( GetModel() )); - if (pDocObj) - { - SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject(); - if (pEmbeddedObj) - { - tools::Rectangle aRect(pEmbeddedObj->GetVisArea()); - sal_uInt16 i(0); - pProps[i].Name = "VisibleAreaTop"; - pProps[i].Value <<= static_cast(aRect.Top()); - pProps[++i].Name = "VisibleAreaLeft"; - pProps[i].Value <<= static_cast(aRect.Left()); - pProps[++i].Name = "VisibleAreaWidth"; - pProps[i].Value <<= static_cast(aRect.getOpenWidth()); - pProps[++i].Name = "VisibleAreaHeight"; - pProps[i].Value <<= static_cast(aRect.getOpenHeight()); - } - } - ScDocument* pDoc = pDocObj->GetDocument(); - if (!pDoc) - { - SAL_WARN("sc", "no ScDocument!"); - return; - } - GetChangeTrackViewSettings(*pDoc, rProps); + + tools::Rectangle aRect(pEmbeddedObj->GetVisArea()); + sal_uInt16 i(0); + pProps[i].Name = "VisibleAreaTop"; + pProps[i].Value <<= static_cast(aRect.Top()); + pProps[++i].Name = "VisibleAreaLeft"; + pProps[i].Value <<= static_cast(aRect.Left()); + pProps[++i].Name = "VisibleAreaWidth"; + pProps[i].Value <<= static_cast(aRect.getOpenWidth()); + pProps[++i].Name = "VisibleAreaHeight"; + pProps[i].Value <<= static_cast(aRect.getOpenHeight()); } + + ScDocument* pDoc = pDocObj->GetDocument(); + if (!pDoc) + { + SAL_WARN("sc", "no ScDocument!"); + return; + } + GetChangeTrackViewSettings(*pDoc, rProps); } void ScXMLExport::GetConfigurationSettings(uno::Sequence& rProps)