sw/qa: Code refactor.
Change-Id: I552b5111901a2e1011a2bd0acaf0231dadd56614
This commit is contained in:
@@ -50,29 +50,37 @@ using namespace oox;
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
OUString lclGetAnchorIdFromGrabBag(const SdrObject* pObj)
|
template<class T>
|
||||||
|
T lclGetProperty(uno::Reference<drawing::XShape> rShape, OUString rPropName)
|
||||||
{
|
{
|
||||||
OUString aResult;
|
T aResult;
|
||||||
uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pObj)->getUnoShape(), uno::UNO_QUERY);
|
uno::Reference<beans::XPropertySet> xPropertySet(rShape, uno::UNO_QUERY);
|
||||||
uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
|
|
||||||
uno::Reference<beans::XPropertySetInfo> xPropSetInfo;
|
uno::Reference<beans::XPropertySetInfo> xPropSetInfo;
|
||||||
|
|
||||||
if (!xPropertySet.is())
|
if (!xPropertySet.is())
|
||||||
return aResult;
|
return aResult;
|
||||||
|
|
||||||
xPropSetInfo = xPropertySet->getPropertySetInfo();
|
xPropSetInfo = xPropertySet->getPropertySetInfo();
|
||||||
if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("FrameInteropGrabBag"))
|
if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(rPropName))
|
||||||
{
|
{
|
||||||
uno::Sequence< beans::PropertyValue > propList;
|
xPropertySet->getPropertyValue(rPropName) >>= aResult;
|
||||||
xPropertySet->getPropertyValue("FrameInteropGrabBag") >>= propList;
|
}
|
||||||
for (sal_Int32 nProp = 0; nProp < propList.getLength(); ++nProp)
|
return aResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
OUString lclGetAnchorIdFromGrabBag(const SdrObject* pObj)
|
||||||
|
{
|
||||||
|
OUString aResult;
|
||||||
|
uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pObj)->getUnoShape(), uno::UNO_QUERY);
|
||||||
|
uno::Sequence< beans::PropertyValue > propList =
|
||||||
|
lclGetProperty< uno::Sequence<beans::PropertyValue> >(xShape, "FrameInteropGrabBag");
|
||||||
|
for (sal_Int32 nProp = 0; nProp < propList.getLength(); ++nProp)
|
||||||
|
{
|
||||||
|
OUString aPropName = propList[nProp].Name;
|
||||||
|
if (aPropName == "AnchorId")
|
||||||
{
|
{
|
||||||
OUString aPropName = propList[nProp].Name;
|
propList[nProp].Value >>= aResult;
|
||||||
if (aPropName == "AnchorId")
|
break;
|
||||||
{
|
|
||||||
propList[nProp].Value >>= aResult;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return aResult;
|
return aResult;
|
||||||
@@ -555,31 +563,6 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrmFmt*
|
|||||||
pFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef);
|
pFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef);
|
||||||
|
|
||||||
uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
|
uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
|
||||||
uno::Reference< beans::XPropertySet > xPropertySet(xShape, uno::UNO_QUERY);
|
|
||||||
uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
|
|
||||||
if (xPropertySet.is())
|
|
||||||
xPropSetInfo = xPropertySet->getPropertySetInfo();
|
|
||||||
|
|
||||||
bool bLockedCanvas = false;
|
|
||||||
if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("InteropGrabBag"))
|
|
||||||
{
|
|
||||||
uno::Sequence< beans::PropertyValue > propList;
|
|
||||||
xPropertySet->getPropertyValue("InteropGrabBag") >>= propList;
|
|
||||||
for (sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp)
|
|
||||||
{
|
|
||||||
OUString propName = propList[nProp].Name;
|
|
||||||
if (propName == "LockedCanvas")
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Export as Locked Canvas only if the drawing
|
|
||||||
* was originally a Locked Canvas and is now inside a Text Frame.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bLockedCanvas = m_pImpl->m_bIsInDMLTextFrame;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const char* pNamespace = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
|
const char* pNamespace = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
|
||||||
if (xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
|
if (xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
|
||||||
pNamespace = "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
|
pNamespace = "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
|
||||||
@@ -592,6 +575,22 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrmFmt*
|
|||||||
XML_uri, pNamespace,
|
XML_uri, pNamespace,
|
||||||
FSEND);
|
FSEND);
|
||||||
|
|
||||||
|
bool bLockedCanvas = false;
|
||||||
|
uno::Sequence< beans::PropertyValue > propList =
|
||||||
|
lclGetProperty< uno::Sequence<beans::PropertyValue> >(xShape, "InteropGrabBag");
|
||||||
|
for (sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp)
|
||||||
|
{
|
||||||
|
OUString propName = propList[nProp].Name;
|
||||||
|
if (propName == "LockedCanvas")
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Export as Locked Canvas only if the drawing
|
||||||
|
* was originally a Locked Canvas and is now inside a Text Frame.
|
||||||
|
*/
|
||||||
|
bLockedCanvas = m_pImpl->m_bIsInDMLTextFrame;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (bLockedCanvas)
|
if (bLockedCanvas)
|
||||||
pFS->startElementNS(XML_lc, XML_lockedCanvas,
|
pFS->startElementNS(XML_lc, XML_lockedCanvas,
|
||||||
FSNS(XML_xmlns, XML_lc), "http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas",
|
FSNS(XML_xmlns, XML_lc), "http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas",
|
||||||
|
Reference in New Issue
Block a user