summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--solenv/clang-format/blacklist5
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx969
-rw-r--r--xmlsecurity/inc/documentsignaturemanager.hxx9
-rw-r--r--xmlsecurity/inc/pdfsignaturehelper.hxx9
-rw-r--r--xmlsecurity/source/helper/documentsignaturemanager.cxx213
-rw-r--r--xmlsecurity/source/helper/pdfsignaturehelper.cxx23
6 files changed, 662 insertions, 566 deletions
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 6eb9adf1d741..d80378d1ab1d 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -15947,7 +15947,6 @@ sw/source/filter/ww8/docxexportfilter.cxx
sw/source/filter/ww8/docxexportfilter.hxx
sw/source/filter/ww8/docxfootnotes.hxx
sw/source/filter/ww8/docxhelper.hxx
-sw/source/filter/ww8/docxsdrexport.cxx
sw/source/filter/ww8/docxsdrexport.hxx
sw/source/filter/ww8/docxtablestyleexport.cxx
sw/source/filter/ww8/docxtablestyleexport.hxx
@@ -19710,7 +19709,6 @@ xmlsecurity/inc/certificatechooser.hxx
xmlsecurity/inc/certificateviewer.hxx
xmlsecurity/inc/digitalsignaturesdialog.hxx
xmlsecurity/inc/documentsignaturehelper.hxx
-xmlsecurity/inc/documentsignaturemanager.hxx
xmlsecurity/inc/framework/saxeventkeeperimpl.hxx
xmlsecurity/inc/framework/securityengine.hxx
xmlsecurity/inc/framework/signaturecreatorimpl.hxx
@@ -19729,7 +19727,6 @@ xmlsecurity/inc/pch/precompiled_xsec_gpg.hxx
xmlsecurity/inc/pch/precompiled_xsec_xmlsec.cxx
xmlsecurity/inc/pch/precompiled_xsec_xmlsec.hxx
xmlsecurity/inc/pdfio/pdfdocument.hxx
-xmlsecurity/inc/pdfsignaturehelper.hxx
xmlsecurity/inc/resourcemanager.hxx
xmlsecurity/inc/xmlsec-wrapper.h
xmlsecurity/inc/xmlsec/errorcallback.hxx
@@ -19787,12 +19784,10 @@ xmlsecurity/source/gpg/XMLSecurityContext.cxx
xmlsecurity/source/gpg/XMLSecurityContext.hxx
xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
xmlsecurity/source/helper/documentsignaturehelper.cxx
-xmlsecurity/source/helper/documentsignaturemanager.cxx
xmlsecurity/source/helper/ooxmlsecexporter.cxx
xmlsecurity/source/helper/ooxmlsecexporter.hxx
xmlsecurity/source/helper/ooxmlsecparser.cxx
xmlsecurity/source/helper/ooxmlsecparser.hxx
-xmlsecurity/source/helper/pdfsignaturehelper.cxx
xmlsecurity/source/helper/xmlsignaturehelper.cxx
xmlsecurity/source/helper/xmlsignaturehelper2.cxx
xmlsecurity/source/helper/xsecctl.cxx
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index cdeb103d66e6..b8c4f47dfc63 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -41,8 +41,8 @@ using namespace oox;
namespace
{
-
-uno::Sequence<beans::PropertyValue> lclGetProperty(const uno::Reference<drawing::XShape>& rShape, const OUString& rPropName)
+uno::Sequence<beans::PropertyValue> lclGetProperty(const uno::Reference<drawing::XShape>& rShape,
+ const OUString& rPropName)
{
uno::Sequence<beans::PropertyValue> aResult;
uno::Reference<beans::XPropertySet> xPropertySet(rShape, uno::UNO_QUERY);
@@ -62,14 +62,15 @@ uno::Sequence<beans::PropertyValue> lclGetProperty(const uno::Reference<drawing:
OUString lclGetAnchorIdFromGrabBag(const SdrObject* pObj)
{
OUString aResult;
- uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pObj)->getUnoShape(), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pObj)->getUnoShape(),
+ uno::UNO_QUERY);
OUString aGrabBagName;
uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY);
if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
aGrabBagName = "FrameInteropGrabBag";
else
aGrabBagName = "InteropGrabBag";
- uno::Sequence< beans::PropertyValue > propList = lclGetProperty(xShape, aGrabBagName);
+ uno::Sequence<beans::PropertyValue> propList = lclGetProperty(xShape, aGrabBagName);
for (sal_Int32 nProp = 0; nProp < propList.getLength(); ++nProp)
{
OUString aPropName = propList[nProp].Name;
@@ -97,33 +98,30 @@ void lclMovePositionWithRotation(awt::Point& aPos, const Size& rSize, sal_Int64
while (nRotation > 9000)
nRotation = (18000 - (nRotation % 18000));
- double fVal = (double) nRotation * F_PI18000;
- double fCos = cos(fVal);
- double fSin = sin(fVal);
+ double fVal = (double)nRotation * F_PI18000;
+ double fCos = cos(fVal);
+ double fSin = sin(fVal);
- double nWidthHalf = (double) rSize.Width() / 2;
- double nHeightHalf = (double) rSize.Height() / 2;
+ double nWidthHalf = (double)rSize.Width() / 2;
+ double nHeightHalf = (double)rSize.Height() / 2;
- double nXDiff = fSin * nHeightHalf + fCos * nWidthHalf - nWidthHalf;
- double nYDiff = fSin * nWidthHalf + fCos * nHeightHalf - nHeightHalf;
+ double nXDiff = fSin * nHeightHalf + fCos * nWidthHalf - nWidthHalf;
+ double nYDiff = fSin * nWidthHalf + fCos * nHeightHalf - nHeightHalf;
aPos.X += nXDiff;
aPos.Y += nYDiff;
}
-
}
-ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd, ww8::Frame const* pParentFrame)
+ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong nStt, sal_uLong nEnd,
+ ww8::Frame const* pParentFrame)
: m_rExport(rExport)
{
m_rExport.SaveData(nStt, nEnd);
m_rExport.m_pParentFrame = pParentFrame;
}
-ExportDataSaveRestore::~ExportDataSaveRestore()
-{
- m_rExport.RestoreData();
-}
+ExportDataSaveRestore::~ExportDataSaveRestore() { m_rExport.RestoreData(); }
/// Holds data used by DocxSdrExport only.
struct DocxSdrExport::Impl
@@ -152,23 +150,24 @@ struct DocxSdrExport::Impl
/// Preserved rotation for TextFrames.
sal_Int32 m_nDMLandVMLTextFrameRotation;
- Impl(DocxSdrExport& rSdrExport, DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML)
- : m_rSdrExport(rSdrExport),
- m_rExport(rExport),
- m_pSerializer(std::move(pSerializer)),
- m_pDrawingML(pDrawingML),
- m_pFlyFrameSize(nullptr),
- m_bTextFrameSyntax(false),
- m_bDMLTextFrameSyntax(false),
- m_bFrameBtLr(false),
- m_bDrawingOpen(false),
- m_bParagraphSdtOpen(false),
- m_bParagraphHasDrawing(false),
- m_bFlyFrameGraphic(false),
- m_pFlyWrapAttrList(nullptr),
- m_pBodyPrAttrList(nullptr),
- m_bDMLAndVMLDrawingOpen(false),
- m_nDMLandVMLTextFrameRotation(0)
+ Impl(DocxSdrExport& rSdrExport, DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer,
+ oox::drawingml::DrawingML* pDrawingML)
+ : m_rSdrExport(rSdrExport)
+ , m_rExport(rExport)
+ , m_pSerializer(std::move(pSerializer))
+ , m_pDrawingML(pDrawingML)
+ , m_pFlyFrameSize(nullptr)
+ , m_bTextFrameSyntax(false)
+ , m_bDMLTextFrameSyntax(false)
+ , m_bFrameBtLr(false)
+ , m_bDrawingOpen(false)
+ , m_bParagraphSdtOpen(false)
+ , m_bParagraphHasDrawing(false)
+ , m_bFlyFrameGraphic(false)
+ , m_pFlyWrapAttrList(nullptr)
+ , m_pBodyPrAttrList(nullptr)
+ , m_bDMLAndVMLDrawingOpen(false)
+ , m_nDMLandVMLTextFrameRotation(0)
{
}
@@ -180,7 +179,8 @@ struct DocxSdrExport::Impl
bool checkFrameBtlr(SwNode* pStartNode, bool bDML);
};
-DocxSdrExport::DocxSdrExport(DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML)
+DocxSdrExport::DocxSdrExport(DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer,
+ oox::drawingml::DrawingML* pDrawingML)
: m_pImpl(o3tl::make_unique<Impl>(*this, rExport, pSerializer, pDrawingML))
{
}
@@ -192,20 +192,11 @@ void DocxSdrExport::setSerializer(const sax_fastparser::FSHelperPtr& pSerializer
m_pImpl->m_pSerializer = pSerializer;
}
-const Size* DocxSdrExport::getFlyFrameSize()
-{
- return m_pImpl->m_pFlyFrameSize;
-}
+const Size* DocxSdrExport::getFlyFrameSize() { return m_pImpl->m_pFlyFrameSize; }
-bool DocxSdrExport::getTextFrameSyntax()
-{
- return m_pImpl->m_bTextFrameSyntax;
-}
+bool DocxSdrExport::getTextFrameSyntax() { return m_pImpl->m_bTextFrameSyntax; }
-bool DocxSdrExport::getDMLTextFrameSyntax()
-{
- return m_pImpl->m_bDMLTextFrameSyntax;
-}
+bool DocxSdrExport::getDMLTextFrameSyntax() { return m_pImpl->m_bDMLTextFrameSyntax; }
rtl::Reference<sax_fastparser::FastAttributeList>& DocxSdrExport::getFlyAttrList()
{
@@ -217,35 +208,20 @@ rtl::Reference<sax_fastparser::FastAttributeList>& DocxSdrExport::getTextboxAttr
return m_pImpl->m_pTextboxAttrList;
}
-OStringBuffer& DocxSdrExport::getTextFrameStyle()
-{
- return m_pImpl->m_aTextFrameStyle;
-}
+OStringBuffer& DocxSdrExport::getTextFrameStyle() { return m_pImpl->m_aTextFrameStyle; }
-bool DocxSdrExport::getFrameBtLr()
-{
- return m_pImpl->m_bFrameBtLr;
-}
+bool DocxSdrExport::getFrameBtLr() { return m_pImpl->m_bFrameBtLr; }
-bool DocxSdrExport::IsDrawingOpen()
-{
- return m_pImpl->m_bDrawingOpen;
-}
+bool DocxSdrExport::IsDrawingOpen() { return m_pImpl->m_bDrawingOpen; }
void DocxSdrExport::setParagraphSdtOpen(bool bParagraphSdtOpen)
{
m_pImpl->m_bParagraphSdtOpen = bParagraphSdtOpen;
}
-bool DocxSdrExport::IsDMLAndVMLDrawingOpen()
-{
- return m_pImpl->m_bDMLAndVMLDrawingOpen;
-}
+bool DocxSdrExport::IsDMLAndVMLDrawingOpen() { return m_pImpl->m_bDMLAndVMLDrawingOpen; }
-bool DocxSdrExport::IsParagraphHasDrawing()
-{
- return m_pImpl->m_bParagraphHasDrawing;
-}
+bool DocxSdrExport::IsParagraphHasDrawing() { return m_pImpl->m_bParagraphHasDrawing; }
void DocxSdrExport::setParagraphHasDrawing(bool bParagraphHasDrawing)
{
@@ -305,21 +281,21 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
sal_Int32 nShadowWidth(TwipsToEMU(aShadowItem.GetWidth()));
switch (aShadowItem.GetLocation())
{
- case SvxShadowLocation::TopLeft:
- nTopExt = nLeftExt = nShadowWidth;
- break;
- case SvxShadowLocation::TopRight:
- nTopExt = nRightExt = nShadowWidth;
- break;
- case SvxShadowLocation::BottomLeft:
- nBottomExt = nLeftExt = nShadowWidth;
- break;
- case SvxShadowLocation::BottomRight:
- nBottomExt = nRightExt = nShadowWidth;
- break;
- case SvxShadowLocation::NONE:
- case SvxShadowLocation::End:
- break;
+ case SvxShadowLocation::TopLeft:
+ nTopExt = nLeftExt = nShadowWidth;
+ break;
+ case SvxShadowLocation::TopRight:
+ nTopExt = nRightExt = nShadowWidth;
+ break;
+ case SvxShadowLocation::BottomLeft:
+ nBottomExt = nLeftExt = nShadowWidth;
+ break;
+ case SvxShadowLocation::BottomRight:
+ nBottomExt = nRightExt = nShadowWidth;
+ break;
+ case SvxShadowLocation::NONE:
+ case SvxShadowLocation::End:
+ break;
}
}
else if (const SdrObject* pObject = pFrameFormat->FindRealSdrObject())
@@ -348,31 +324,42 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
if (isAnchor)
{
- sax_fastparser::FastAttributeList* attrList = sax_fastparser::FastSerializerHelper::createAttrList();
+ sax_fastparser::FastAttributeList* attrList
+ = sax_fastparser::FastSerializerHelper::createAttrList();
bool bOpaque = pFrameFormat->GetOpaque().GetValue();
- awt::Point aPos(pFrameFormat->GetHoriOrient().GetPos(), pFrameFormat->GetVertOrient().GetPos());
+ awt::Point aPos(pFrameFormat->GetHoriOrient().GetPos(),
+ pFrameFormat->GetVertOrient().GetPos());
const SdrObject* pObj = pFrameFormat->FindRealSdrObject();
if (pObj != nullptr)
{
// SdrObjects know their layer, consider that instead of the frame format.
- bOpaque = pObj->GetLayer() != pFrameFormat->GetDoc()->getIDocumentDrawModelAccess().GetHellId() && pObj->GetLayer() != pFrameFormat->GetDoc()->getIDocumentDrawModelAccess().GetInvisibleHellId();
+ bOpaque = pObj->GetLayer()
+ != pFrameFormat->GetDoc()->getIDocumentDrawModelAccess().GetHellId()
+ && pObj->GetLayer()
+ != pFrameFormat->GetDoc()
+ ->getIDocumentDrawModelAccess()
+ .GetInvisibleHellId();
lclMovePositionWithRotation(aPos, rSize, pObj->GetRotateAngle());
}
attrList->add(XML_behindDoc, bOpaque ? "0" : "1");
// The type of dist* attributes is unsigned, so make sure no negative value is written.
- sal_Int64 nDistT = std::max(static_cast<sal_Int64>(0), TwipsToEMU(aULSpaceItem.GetUpper()) - nTopExt);
+ sal_Int64 nDistT
+ = std::max(static_cast<sal_Int64>(0), TwipsToEMU(aULSpaceItem.GetUpper()) - nTopExt);
attrList->add(XML_distT, OString::number(nDistT).getStr());
- sal_Int64 nDistB = std::max(static_cast<sal_Int64>(0), TwipsToEMU(aULSpaceItem.GetLower()) - nBottomExt);
+ sal_Int64 nDistB
+ = std::max(static_cast<sal_Int64>(0), TwipsToEMU(aULSpaceItem.GetLower()) - nBottomExt);
attrList->add(XML_distB, OString::number(nDistB).getStr());
- sal_Int64 nDistL = std::max(static_cast<sal_Int64>(0), TwipsToEMU(aLRSpaceItem.GetLeft()) - nLeftExt);
+ sal_Int64 nDistL
+ = std::max(static_cast<sal_Int64>(0), TwipsToEMU(aLRSpaceItem.GetLeft()) - nLeftExt);
attrList->add(XML_distL, OString::number(nDistL).getStr());
- sal_Int64 nDistR = std::max(static_cast<sal_Int64>(0), TwipsToEMU(aLRSpaceItem.GetRight()) - nRightExt);
+ sal_Int64 nDistR
+ = std::max(static_cast<sal_Int64>(0), TwipsToEMU(aLRSpaceItem.GetRight()) - nRightExt);
attrList->add(XML_distR, OString::number(nDistR).getStr());
attrList->add(XML_simplePos, "0");
attrList->add(XML_locked, "0");
attrList->add(XML_layoutInCell, "1");
- attrList->add(XML_allowOverlap, "1"); // TODO
+ attrList->add(XML_allowOverlap, "1"); // TODO
if (pObj != nullptr)
// It seems 0 and 1 have special meaning: just start counting from 2 to avoid issues with that.
attrList->add(XML_relativeHeight, OString::number(pObj->GetOrdNum() + 2));
@@ -383,100 +370,105 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
{
OUString sAnchorId = lclGetAnchorIdFromGrabBag(pObj);
if (!sAnchorId.isEmpty())
- attrList->addNS(XML_wp14, XML_anchorId, OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8));
+ attrList->addNS(XML_wp14, XML_anchorId,
+ OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8));
}
sax_fastparser::XFastAttributeListRef xAttrList(attrList);
m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_anchor, xAttrList);
- m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_simplePos, XML_x, "0", XML_y, "0", FSEND); // required, unused
+ m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_simplePos, XML_x, "0", XML_y, "0",
+ FSEND); // required, unused
const char* relativeFromH;
const char* relativeFromV;
const char* alignH = nullptr;
const char* alignV = nullptr;
switch (pFrameFormat->GetVertOrient().GetRelationOrient())
{
- case text::RelOrientation::PAGE_PRINT_AREA:
- relativeFromV = "margin";
- break;
- case text::RelOrientation::PAGE_FRAME:
- relativeFromV = "page";
- break;
- case text::RelOrientation::FRAME:
- relativeFromV = "paragraph";
- break;
- case text::RelOrientation::TEXT_LINE:
- default:
- relativeFromV = "line";
- break;
+ case text::RelOrientation::PAGE_PRINT_AREA:
+ relativeFromV = "margin";
+ break;
+ case text::RelOrientation::PAGE_FRAME:
+ relativeFromV = "page";
+ break;
+ case text::RelOrientation::FRAME:
+ relativeFromV = "paragraph";
+ break;
+ case text::RelOrientation::TEXT_LINE:
+ default:
+ relativeFromV = "line";
+ break;
}
switch (pFrameFormat->GetVertOrient().GetVertOrient())
{
- case text::VertOrientation::TOP:
- case text::VertOrientation::CHAR_TOP:
- case text::VertOrientation::LINE_TOP:
- if (pFrameFormat->GetVertOrient().GetRelationOrient() == text::RelOrientation::TEXT_LINE)
- alignV = "bottom";
- else
- alignV = "top";
- break;
- case text::VertOrientation::BOTTOM:
- case text::VertOrientation::CHAR_BOTTOM:
- case text::VertOrientation::LINE_BOTTOM:
- if (pFrameFormat->GetVertOrient().GetRelationOrient() == text::RelOrientation::TEXT_LINE)
- alignV = "top";
- else
- alignV = "bottom";
- break;
- case text::VertOrientation::CENTER:
- case text::VertOrientation::CHAR_CENTER:
- case text::VertOrientation::LINE_CENTER:
- alignV = "center";
- break;
- default:
- break;
+ case text::VertOrientation::TOP:
+ case text::VertOrientation::CHAR_TOP:
+ case text::VertOrientation::LINE_TOP:
+ if (pFrameFormat->GetVertOrient().GetRelationOrient()
+ == text::RelOrientation::TEXT_LINE)
+ alignV = "bottom";
+ else
+ alignV = "top";
+ break;
+ case text::VertOrientation::BOTTOM:
+ case text::VertOrientation::CHAR_BOTTOM:
+ case text::VertOrientation::LINE_BOTTOM:
+ if (pFrameFormat->GetVertOrient().GetRelationOrient()
+ == text::RelOrientation::TEXT_LINE)
+ alignV = "top";
+ else
+ alignV = "bottom";
+ break;
+ case text::VertOrientation::CENTER:
+ case text::VertOrientation::CHAR_CENTER:
+ case text::VertOrientation::LINE_CENTER:
+ alignV = "center";
+ break;
+ default:
+ break;
}
switch (pFrameFormat->GetHoriOrient().GetRelationOrient())
{
- case text::RelOrientation::PAGE_PRINT_AREA:
- relativeFromH = "margin";
- break;
- case text::RelOrientation::PAGE_FRAME:
- relativeFromH = "page";
- break;
- case text::RelOrientation::CHAR:
- relativeFromH = "character";
- break;
- case text::RelOrientation::PAGE_RIGHT:
- relativeFromH = "rightMargin";
- break;
- case text::RelOrientation::PAGE_LEFT:
- relativeFromH = "leftMargin";
- break;
- case text::RelOrientation::FRAME:
- default:
- relativeFromH = "column";
- break;
+ case text::RelOrientation::PAGE_PRINT_AREA:
+ relativeFromH = "margin";
+ break;
+ case text::RelOrientation::PAGE_FRAME:
+ relativeFromH = "page";
+ break;
+ case text::RelOrientation::CHAR:
+ relativeFromH = "character";
+ break;
+ case text::RelOrientation::PAGE_RIGHT:
+ relativeFromH = "rightMargin";
+ break;
+ case text::RelOrientation::PAGE_LEFT:
+ relativeFromH = "leftMargin";
+ break;
+ case text::RelOrientation::FRAME:
+ default:
+ relativeFromH = "column";
+ break;
}
switch (pFrameFormat->GetHoriOrient().GetHoriOrient())
{
- case text::HoriOrientation::LEFT:
- alignH = "left";
- break;
- case text::HoriOrientation::RIGHT:
- alignH = "right";
- break;
- case text::HoriOrientation::CENTER:
- alignH = "center";
- break;
- case text::HoriOrientation::INSIDE:
- alignH = "inside";
- break;
- case text::HoriOrientation::OUTSIDE:
- alignH = "outside";
- break;
- default:
- break;
+ case text::HoriOrientation::LEFT:
+ alignH = "left";
+ break;
+ case text::HoriOrientation::RIGHT:
+ alignH = "right";
+ break;
+ case text::HoriOrientation::CENTER:
+ alignH = "center";
+ break;
+ case text::HoriOrientation::INSIDE:
+ alignH = "inside";
+ break;
+ case text::HoriOrientation::OUTSIDE:
+ alignH = "outside";
+ break;
+ default:
+ break;
}
- m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_positionH, XML_relativeFrom, relativeFromH, FSEND);
+ m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_positionH, XML_relativeFrom,
+ relativeFromH, FSEND);
/**
* Sizes of integral types
* climits header defines constants with the limits of integral types for the specific system and compiler implementation used.
@@ -518,7 +510,8 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
m_pImpl->m_pSerializer->endElementNS(XML_wp, XML_posOffset);
}
m_pImpl->m_pSerializer->endElementNS(XML_wp, XML_positionH);
- m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_positionV, XML_relativeFrom, relativeFromV, FSEND);
+ m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_positionV, XML_relativeFrom,
+ relativeFromV, FSEND);
sal_Int64 nPosYEMU = TwipsToEMU(aPos.Y);
@@ -526,9 +519,9 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
// wrap top+bottom or other wraps is affecting the line directly
// above the anchor line, which seems odd, but a tiny adjustment
// here to bring the top down convinces msoffice to wrap like us
- if (nPosYEMU == 0 &&
- (strcmp(relativeFromV, "line") == 0 || strcmp(relativeFromV, "paragraph") == 0) &&
- (!alignV || strcmp(alignV, "top") == 0))
+ if (nPosYEMU == 0
+ && (strcmp(relativeFromV, "line") == 0 || strcmp(relativeFromV, "paragraph") == 0)
+ && (!alignV || strcmp(alignV, "top") == 0))
{
alignV = nullptr;
nPosYEMU = 635;
@@ -558,7 +551,8 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
}
else
{
- sax_fastparser::FastAttributeList* aAttrList = sax_fastparser::FastSerializerHelper::createAttrList();
+ sax_fastparser::FastAttributeList* aAttrList
+ = sax_fastparser::FastSerializerHelper::createAttrList();
aAttrList->add(XML_distT, OString::number(TwipsToEMU(aULSpaceItem.GetUpper())).getStr());
aAttrList->add(XML_distB, OString::number(TwipsToEMU(aULSpaceItem.GetLower())).getStr());
aAttrList->add(XML_distL, OString::number(TwipsToEMU(aLRSpaceItem.GetLeft())).getStr());
@@ -568,7 +562,8 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
{
OUString sAnchorId = lclGetAnchorIdFromGrabBag(pObj);
if (!sAnchorId.isEmpty())
- aAttrList->addNS(XML_wp14, XML_anchorId, OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8));
+ aAttrList->addNS(XML_wp14, XML_anchorId,
+ OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8));
}
m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_inline, aAttrList);
}
@@ -592,8 +587,8 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
* 2147483647( MAX_INTEGER_VALUE ).
* Therefore changing the following accordingly so that LO sync's up with MSO.
**/
- sal_uInt64 cx = 0 ;
- sal_uInt64 cy = 0 ;
+ sal_uInt64 cx = 0;
+ sal_uInt64 cy = 0;
const sal_Int64 MAX_INTEGER_VALUE = SAL_MAX_INT32;
// the 'Size' type uses 'long' for width and height, so on
@@ -601,46 +596,46 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
// larger than the max signed 32-bit integer.
#if SAL_TYPES_SIZEOFLONG > 4
if (rSize.Width() > MAX_INTEGER_VALUE)
- cx = MAX_INTEGER_VALUE ;
+ cx = MAX_INTEGER_VALUE;
else
#endif
{
if (0 > rSize.Width())
- cx = 0 ;
+ cx = 0;
else
cx = rSize.Width();
}
#if SAL_TYPES_SIZEOFLONG > 4
if (rSize.Height() > MAX_INTEGER_VALUE)
- cy = MAX_INTEGER_VALUE ;
+ cy = MAX_INTEGER_VALUE;
else
#endif
{
if (0 > rSize.Height())
- cy = 0 ;
+ cy = 0;
else
cy = rSize.Height();
}
OString aWidth(OString::number(TwipsToEMU(cx)));
//we explicitly check the converted EMU value for the range as mentioned in above comment.
- aWidth = (aWidth.toInt64() > 0 ? (aWidth.toInt64() > MAX_INTEGER_VALUE ? I64S(MAX_INTEGER_VALUE) : aWidth.getStr()): "0");
+ aWidth = (aWidth.toInt64() > 0 ? (aWidth.toInt64() > MAX_INTEGER_VALUE ? I64S(MAX_INTEGER_VALUE)
+ : aWidth.getStr())
+ : "0");
OString aHeight(OString::number(TwipsToEMU(cy)));
- aHeight = (aHeight.toInt64() > 0 ? (aHeight.toInt64() > MAX_INTEGER_VALUE ? I64S(MAX_INTEGER_VALUE) : aHeight.getStr()): "0");
+ aHeight
+ = (aHeight.toInt64() > 0 ? (aHeight.toInt64() > MAX_INTEGER_VALUE ? I64S(MAX_INTEGER_VALUE)
+ : aHeight.getStr())
+ : "0");
- m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_extent,
- XML_cx, aWidth,
- XML_cy, aHeight,
+ m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_extent, XML_cx, aWidth, XML_cy, aHeight,
FSEND);
// effectExtent, extent including the effect (shadow only for now)
- m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_effectExtent,
- XML_l, OString::number(nLeftExt),
- XML_t, OString::number(nTopExt),
- XML_r, OString::number(nRightExt),
- XML_b, OString::number(nBottomExt),
- FSEND);
+ m_pImpl->m_pSerializer->singleElementNS(
+ XML_wp, XML_effectExtent, XML_l, OString::number(nLeftExt), XML_t, OString::number(nTopExt),
+ XML_r, OString::number(nRightExt), XML_b, OString::number(nBottomExt), FSEND);
// See if we know the exact wrap type from grab-bag.
sal_Int32 nWrapToken = 0;
@@ -658,26 +653,27 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
else if (sType == "wrapThrough")
nWrapToken = XML_wrapThrough;
else
- SAL_WARN("sw.ww8", "DocxSdrExport::startDMLAnchorInline: unexpected EG_WrapType value");
+ SAL_WARN("sw.ww8",
+ "DocxSdrExport::startDMLAnchorInline: unexpected EG_WrapType value");
- m_pImpl->m_pSerializer->startElementNS(XML_wp, nWrapToken,
- XML_wrapText, "bothSides", FSEND);
+ m_pImpl->m_pSerializer->startElementNS(XML_wp, nWrapToken, XML_wrapText, "bothSides",
+ FSEND);
it = aGrabBag.find("CT_WrapPath");
if (it != aGrabBag.end())
{
- m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_wrapPolygon,
- XML_edited, "0",
+ m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_wrapPolygon, XML_edited, "0",
FSEND);
- drawing::PointSequenceSequence aSeqSeq = it->second.get< drawing::PointSequenceSequence >();
- std::vector<awt::Point> aPoints(comphelper::sequenceToContainer<std::vector<awt::Point> >(aSeqSeq[0]));
+ drawing::PointSequenceSequence aSeqSeq
+ = it->second.get<drawing::PointSequenceSequence>();
+ std::vector<awt::Point> aPoints(
+ comphelper::sequenceToContainer<std::vector<awt::Point>>(aSeqSeq[0]));
for (auto i = aPoints.begin(); i != aPoints.end(); ++i)
{
awt::Point& rPoint = *i;
- m_pImpl->m_pSerializer->singleElementNS(XML_wp, (i == aPoints.begin() ? XML_start : XML_lineTo),
- XML_x, OString::number(rPoint.X),
- XML_y, OString::number(rPoint.Y),
- FSEND);
+ m_pImpl->m_pSerializer->singleElementNS(
+ XML_wp, (i == aPoints.begin() ? XML_start : XML_lineTo), XML_x,
+ OString::number(rPoint.X), XML_y, OString::number(rPoint.Y), FSEND);
}
m_pImpl->m_pSerializer->endElementNS(XML_wp, XML_wrapPolygon);
}
@@ -695,18 +691,16 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
if (pPolyPoly && pPolyPoly->Count())
{
nWrapToken = XML_wrapTight;
- m_pImpl->m_pSerializer->startElementNS(XML_wp, nWrapToken,
- XML_wrapText, "bothSides", FSEND);
+ m_pImpl->m_pSerializer->startElementNS(XML_wp, nWrapToken, XML_wrapText,
+ "bothSides", FSEND);
- m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_wrapPolygon,
- XML_edited, "0",
+ m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_wrapPolygon, XML_edited, "0",
FSEND);
tools::Polygon aPoly = sw::util::CorrectWordWrapPolygonForExport(*pPolyPoly, pNd);
for (sal_uInt16 i = 0; i < aPoly.GetSize(); ++i)
- m_pImpl->m_pSerializer->singleElementNS(XML_wp, (i == 0 ? XML_start : XML_lineTo),
- XML_x, OString::number(aPoly[i].X()),
- XML_y, OString::number(aPoly[i].Y()),
- FSEND);
+ m_pImpl->m_pSerializer->singleElementNS(
+ XML_wp, (i == 0 ? XML_start : XML_lineTo), XML_x,
+ OString::number(aPoly[i].X()), XML_y, OString::number(aPoly[i].Y()), FSEND);
m_pImpl->m_pSerializer->endElementNS(XML_wp, XML_wrapPolygon);
m_pImpl->m_pSerializer->endElementNS(XML_wp, nWrapToken);
@@ -719,21 +713,21 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
{
switch (pFrameFormat->GetSurround().GetValue())
{
- case css::text::WrapTextMode_NONE:
- m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_wrapTopAndBottom, FSEND);
- break;
- case css::text::WrapTextMode_THROUGH:
- m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_wrapNone, FSEND);
- break;
- case css::text::WrapTextMode_PARALLEL:
- m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_wrapSquare,
- XML_wrapText, "bothSides", FSEND);
- break;
- case css::text::WrapTextMode_DYNAMIC:
- default:
- m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_wrapSquare,
- XML_wrapText, "largest", FSEND);
- break;
+ case css::text::WrapTextMode_NONE:
+ m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_wrapTopAndBottom, FSEND);
+ break;
+ case css::text::WrapTextMode_THROUGH:
+ m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_wrapNone, FSEND);
+ break;
+ case css::text::WrapTextMode_PARALLEL:
+ m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_wrapSquare, XML_wrapText,
+ "bothSides", FSEND);
+ break;
+ case css::text::WrapTextMode_DYNAMIC:
+ default:
+ m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_wrapSquare, XML_wrapText,
+ "largest", FSEND);
+ break;
}
}
}
@@ -760,12 +754,13 @@ void DocxSdrExport::writeVMLDrawing(const SdrObject* sdrObj, const SwFrameFormat
bool bSwapInPage = false;
if (!sdrObj->GetPage())
{
- if (SdrModel* pModel = m_pImpl->m_rExport.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel())
+ if (SdrModel* pModel
+ = m_pImpl->m_rExport.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel())
{
if (SdrPage* pPage = pModel->GetPage(0))
{
bSwapInPage = true;
- const_cast< SdrObject* >(sdrObj)->SetPage(pPage);
+ const_cast<SdrObject*>(sdrObj)->SetPage(pPage);
}
}
}
@@ -776,22 +771,20 @@ void DocxSdrExport::writeVMLDrawing(const SdrObject* sdrObj, const SwFrameFormat
const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient();
const SwFormatVertOrient& rVertOri = rFrameFormat.GetVertOrient();
- m_pImpl->m_rExport.VMLExporter().AddSdrObject(*sdrObj,
- rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(),
- rHoriOri.GetRelationOrient(),
- rVertOri.GetRelationOrient(), true);
+ m_pImpl->m_rExport.VMLExporter().AddSdrObject(
+ *sdrObj, rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(), rHoriOri.GetRelationOrient(),
+ rVertOri.GetRelationOrient(), true);
m_pImpl->m_pSerializer->endElementNS(XML_w, XML_pict);
if (bSwapInPage)
- const_cast< SdrObject* >(sdrObj)->SetPage(nullptr);
+ const_cast<SdrObject*>(sdrObj)->SetPage(nullptr);
}
bool lcl_isLockedCanvas(const uno::Reference<drawing::XShape>& xShape)
{
bool bRet = false;
- uno::Sequence< beans::PropertyValue > propList =
- lclGetProperty(xShape, "InteropGrabBag");
- for (sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp)
+ uno::Sequence<beans::PropertyValue> propList = lclGetProperty(xShape, "InteropGrabBag");
+ for (sal_Int32 nProp = 0; nProp < propList.getLength(); ++nProp)
{
OUString propName = propList[nProp].Name;
if (propName == "LockedCanvas")
@@ -807,9 +800,11 @@ bool lcl_isLockedCanvas(const uno::Reference<drawing::XShape>& xShape)
return bRet;
}
-void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFormat* pFrameFormat, int nAnchorId)
+void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFormat* pFrameFormat,
+ int nAnchorId)
{
- uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObject)->getUnoShape(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObject)->getUnoShape(),
+ uno::UNO_QUERY_THROW);
if (!Impl::isSupportedDMLShape(xShape))
return;
@@ -819,13 +814,17 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFo
Size aSize(pSdrObject->GetLogicRect().GetWidth(), pSdrObject->GetLogicRect().GetHeight());
startDMLAnchorInline(pFrameFormat, aSize);
- sax_fastparser::FastAttributeList* pDocPrAttrList = sax_fastparser::FastSerializerHelper::createAttrList();
+ sax_fastparser::FastAttributeList* pDocPrAttrList
+ = sax_fastparser::FastSerializerHelper::createAttrList();
pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr());
- pDocPrAttrList->add(XML_name, OUStringToOString(pSdrObject->GetName(), RTL_TEXTENCODING_UTF8).getStr());
+ pDocPrAttrList->add(XML_name,
+ OUStringToOString(pSdrObject->GetName(), RTL_TEXTENCODING_UTF8).getStr());
if (!pSdrObject->GetTitle().isEmpty())
- pDocPrAttrList->add(XML_title, OUStringToOString(pSdrObject->GetTitle(), RTL_TEXTENCODING_UTF8));
+ pDocPrAttrList->add(XML_title,
+ OUStringToOString(pSdrObject->GetTitle(), RTL_TEXTENCODING_UTF8));
if (!pSdrObject->GetDescription().isEmpty())
- pDocPrAttrList->add(XML_descr, OUStringToOString(pSdrObject->GetDescription(), RTL_TEXTENCODING_UTF8));
+ pDocPrAttrList->add(XML_descr,
+ OUStringToOString(pSdrObject->GetDescription(), RTL_TEXTENCODING_UTF8));
sax_fastparser::XFastAttributeListRef xDocPrAttrListRef(pDocPrAttrList);
pFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef);
@@ -835,17 +834,21 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFo
pNamespace = "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup";
else if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
pNamespace = "http://schemas.openxmlformats.org/drawingml/2006/picture";
- pFS->startElementNS(XML_a, XML_graphic,
- FSNS(XML_xmlns, XML_a), OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dml)), RTL_TEXTENCODING_UTF8).getStr(),
- FSEND);
- pFS->startElementNS(XML_a, XML_graphicData,
- XML_uri, pNamespace,
- FSEND);
+ pFS->startElementNS(
+ XML_a, XML_graphic, FSNS(XML_xmlns, XML_a),
+ OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dml)),
+ RTL_TEXTENCODING_UTF8)
+ .getStr(),
+ FSEND);
+ pFS->startElementNS(XML_a, XML_graphicData, XML_uri, pNamespace, FSEND);
bool bLockedCanvas = lcl_isLockedCanvas(xShape);
if (bLockedCanvas)
- pFS->startElementNS(XML_lc, XML_lockedCanvas,
- FSNS(XML_xmlns, XML_lc), OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dmlLockedCanvas)), RTL_TEXTENCODING_UTF8).getStr(),
+ pFS->startElementNS(XML_lc, XML_lockedCanvas, FSNS(XML_xmlns, XML_lc),
+ OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(
+ OOX_NS(dmlLockedCanvas)),
+ RTL_TEXTENCODING_UTF8)
+ .getStr(),
FSEND);
m_pImpl->m_rExport.OutputDML(xShape);
@@ -859,21 +862,27 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFo
if (pSdrObject->GetRelativeWidth())
{
// At the moment drawinglayer objects are always relative from page.
- pFS->startElementNS(XML_wp14, XML_sizeRelH,
- XML_relativeFrom, (pSdrObject->GetRelativeWidthRelation() == text::RelOrientation::FRAME ? "margin" : "page"),
+ pFS->startElementNS(XML_wp14, XML_sizeRelH, XML_relativeFrom,
+ (pSdrObject->GetRelativeWidthRelation() == text::RelOrientation::FRAME
+ ? "margin"
+ : "page"),
FSEND);
pFS->startElementNS(XML_wp14, XML_pctWidth, FSEND);
- pFS->writeEscaped(OUString::number(*pSdrObject->GetRelativeWidth() * 100 * oox::drawingml::PER_PERCENT));
+ pFS->writeEscaped(
+ OUString::number(*pSdrObject->GetRelativeWidth() * 100 * oox::drawingml::PER_PERCENT));
pFS->endElementNS(XML_wp14, XML_pctWidth);
pFS->endElementNS(XML_wp14, XML_sizeRelH);
}
if (pSdrObject->GetRelativeHeight())
{
- pFS->startElementNS(XML_wp14, XML_sizeRelV,
- XML_relativeFrom, (pSdrObject->GetRelativeHeightRelation() == text::RelOrientation::FRAME ? "margin" : "page"),
+ pFS->startElementNS(XML_wp14, XML_sizeRelV, XML_relativeFrom,
+ (pSdrObject->GetRelativeHeightRelation() == text::RelOrientation::FRAME
+ ? "margin"
+ : "page"),
FSEND);
pFS->startElementNS(XML_wp14, XML_pctHeight, FSEND);
- pFS->writeEscaped(OUString::number(*pSdrObject->GetRelativeHeight() * 100 * oox::drawingml::PER_PERCENT));
+ pFS->writeEscaped(
+ OUString::number(*pSdrObject->GetRelativeHeight() * 100 * oox::drawingml::PER_PERCENT));
pFS->endElementNS(XML_wp14, XML_pctHeight);
pFS->endElementNS(XML_wp14, XML_sizeRelV);
}
@@ -891,38 +900,35 @@ void DocxSdrExport::Impl::textFrameShadow(const SwFrameFormat& rFrameFormat)
OString aOffset;
switch (aShadowItem.GetLocation())
{
- case SvxShadowLocation::TopLeft:
- aOffset = "-" + aShadowWidth + ",-" + aShadowWidth;
- break;
- case SvxShadowLocation::TopRight:
- aOffset = aShadowWidth + ",-" + aShadowWidth;
- break;
- case SvxShadowLocation::BottomLeft:
- aOffset = "-" + aShadowWidth + "," + aShadowWidth;
- break;
- case SvxShadowLocation::BottomRight:
- aOffset = aShadowWidth + "," + aShadowWidth;
- break;
- case SvxShadowLocation::NONE:
- case SvxShadowLocation::End:
- break;
+ case SvxShadowLocation::TopLeft:
+ aOffset = "-" + aShadowWidth + ",-" + aShadowWidth;
+ break;
+ case SvxShadowLocation::TopRight:
+ aOffset = aShadowWidth + ",-" + aShadowWidth;
+ break;
+ case SvxShadowLocation::BottomLeft:
+ aOffset = "-" + aShadowWidth + "," + aShadowWidth;
+ break;
+ case SvxShadowLocation::BottomRight:
+ aOffset = aShadowWidth + "," + aShadowWidth;
+ break;
+ case SvxShadowLocation::NONE:
+ case SvxShadowLocation::End:
+ break;
}
if (aOffset.isEmpty())
return;
OString aShadowColor = msfilter::util::ConvertColor(aShadowItem.GetColor());
- m_pSerializer->singleElementNS(XML_v, XML_shadow,
- XML_on, "t",
- XML_color, "#" + aShadowColor,
- XML_offset, aOffset,
- FSEND);
+ m_pSerializer->singleElementNS(XML_v, XML_shadow, XML_on, "t", XML_color, "#" + aShadowColor,
+ XML_offset, aOffset, FSEND);
}
bool DocxSdrExport::Impl::isSupportedDMLShape(const uno::Reference<drawing::XShape>& xShape)
{
uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
if (xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonShape")
- || xServiceInfo->supportsService("com.sun.star.drawing.PolyLineShape"))
+ || xServiceInfo->supportsService("com.sun.star.drawing.PolyLineShape"))
return false;
// For signature line shapes, we don't want DML, just the VML shape.
@@ -938,7 +944,8 @@ bool DocxSdrExport::Impl::isSupportedDMLShape(const uno::Reference<drawing::XSha
return true;
}
-void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrameFormat& rFrameFormat, int nAnchorId)
+void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj,
+ const SwFrameFormat& rFrameFormat, int nAnchorId)
{
bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
m_pImpl->m_bDMLAndVMLDrawingOpen = true;
@@ -946,24 +953,26 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrame
// Depending on the shape type, we actually don't write the shape as DML.
OUString sShapeType;
ShapeFlag nMirrorFlags = ShapeFlag::NONE;
- uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(sdrObj)->getUnoShape(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(sdrObj)->getUnoShape(),
+ uno::UNO_QUERY_THROW);
// Locked canvas is OK inside DML.
if (lcl_isLockedCanvas(xShape))
bDMLAndVMLDrawingOpen = false;
- MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType(xShape, nMirrorFlags, sShapeType);
+ MSO_SPT eShapeType
+ = EscherPropertyContainer::GetCustomShapeType(xShape, nMirrorFlags, sShapeType);
// In case we are already inside a DML block, then write the shape only as VML, turn out that's allowed to do.
// A common service created in util to check for VML shapes which are allowed to have textbox in content
- if ((msfilter::util::HasTextBoxContent(eShapeType)) && Impl::isSupportedDMLShape(xShape) && !bDMLAndVMLDrawingOpen)
+ if ((msfilter::util::HasTextBoxContent(eShapeType)) && Impl::isSupportedDMLShape(xShape)
+ && !bDMLAndVMLDrawingOpen)
{
m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND);
auto pObjGroup = dynamic_cast<const SdrObjGroup*>(sdrObj);
- m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_Choice,
- XML_Requires, (pObjGroup ? "wpg" : "wps"),
- FSEND);
+ m_pImpl->m_pSerializer->startElementNS(XML_mc, XML_Choice, XML_Requires,
+ (pObjGroup ? "wpg" : "wps"), FSEND);
writeDMLDrawing(sdrObj, &rFrameFormat, nAnchorId);
m_pImpl->m_pSerializer->endElementNS(XML_mc, XML_Choice);
@@ -1000,57 +1009,57 @@ void DocxSdrExport::writeDMLEffectLst(const SwFrameFormat& rFrameFormat)
return;
// Distance is measured diagonally from corner
- double nShadowDist = sqrt((double)aShadowItem.GetWidth()*aShadowItem.GetWidth()*2.0);
+ double nShadowDist = sqrt((double)aShadowItem.GetWidth() * aShadowItem.GetWidth() * 2.0);
OString aShadowDist(OString::number(TwipsToEMU(nShadowDist)));
OString aShadowColor = msfilter::util::ConvertColor(aShadowItem.GetColor());
OString aShadowAlpha = lcl_ConvertTransparency(aShadowItem.GetColor());
sal_uInt32 nShadowDir = 0;
switch (aShadowItem.GetLocation())
{
- case SvxShadowLocation::TopLeft:
- nShadowDir = 13500000;
- break;
- case SvxShadowLocation::TopRight:
- nShadowDir = 18900000;
- break;
- case SvxShadowLocation::BottomLeft:
- nShadowDir = 8100000;
- break;
- case SvxShadowLocation::BottomRight:
- nShadowDir = 2700000;
- break;
- case SvxShadowLocation::NONE:
- case SvxShadowLocation::End:
- break;
+ case SvxShadowLocation::TopLeft:
+ nShadowDir = 13500000;
+ break;
+ case SvxShadowLocation::TopRight:
+ nShadowDir = 18900000;
+ break;
+ case SvxShadowLocation::BottomLeft:
+ nShadowDir = 8100000;
+ break;
+ case SvxShadowLocation::BottomRight:
+ nShadowDir = 2700000;
+ break;
+ case SvxShadowLocation::NONE:
+ case SvxShadowLocation::End:
+ break;
}
OString aShadowDir(OString::number(nShadowDir));
m_pImpl->m_pSerializer->startElementNS(XML_a, XML_effectLst, FSEND);
- m_pImpl->m_pSerializer->startElementNS(XML_a, XML_outerShdw,
- XML_dist, aShadowDist.getStr(),
+ m_pImpl->m_pSerializer->startElementNS(XML_a, XML_outerShdw, XML_dist, aShadowDist.getStr(),
XML_dir, aShadowDir.getStr(), FSEND);
if (aShadowAlpha.isEmpty())
- m_pImpl->m_pSerializer->singleElementNS(XML_a, XML_srgbClr,
- XML_val, aShadowColor.getStr(), FSEND);
+ m_pImpl->m_pSerializer->singleElementNS(XML_a, XML_srgbClr, XML_val, aShadowColor.getStr(),
+ FSEND);
else
{
- m_pImpl->m_pSerializer->startElementNS(XML_a, XML_srgbClr, XML_val, aShadowColor.getStr(), FSEND);
- m_pImpl->m_pSerializer->singleElementNS(XML_a, XML_alpha, XML_val, aShadowAlpha.getStr(), FSEND);
+ m_pImpl->m_pSerializer->startElementNS(XML_a, XML_srgbClr, XML_val, aShadowColor.getStr(),
+ FSEND);
+ m_pImpl->m_pSerializer->singleElementNS(XML_a, XML_alpha, XML_val, aShadowAlpha.getStr(),
+ FSEND);
m_pImpl->m_pSerializer->endElementNS(XML_a, XML_srgbClr);
}
m_pImpl->m_pSerializer->endElementNS(XML_a, XML_outerShdw);
m_pImpl->m_pSerializer->endElementNS(XML_a, XML_effectLst);
-
-
}
-void DocxSdrExport::writeDiagramRels(const uno::Sequence< uno::Sequence< uno::Any > >& xRelSeq,
- const uno::Reference<io::XOutputStream>& xOutStream, const OUString& sGrabBagProperyName,
- int nAnchorId)
+void DocxSdrExport::writeDiagramRels(const uno::Sequence<uno::Sequence<uno::Any>>& xRelSeq,
+ const uno::Reference<io::XOutputStream>& xOutStream,
+ const OUString& sGrabBagProperyName, int nAnchorId)
{
// add image relationships of OOXData, OOXDiagram
OUString sType(oox::getRelationship(Relationship::IMAGE));
- uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create(comphelper::getProcessComponentContext());
+ uno::Reference<xml::sax::XWriter> xWriter
+ = xml::sax::Writer::create(comphelper::getProcessComponentContext());
xWriter->setOutputStream(xOutStream);
// retrieve the relationships from Sequence
@@ -1059,7 +1068,7 @@ void DocxSdrExport::writeDiagramRels(const uno::Sequence< uno::Sequence< uno::An
// diagramDataRelTuple[0] => RID,
// diagramDataRelTuple[1] => xInputStream
// diagramDataRelTuple[2] => extension
- uno::Sequence< uno::Any > diagramDataRelTuple = xRelSeq[j];
+ uno::Sequence<uno::Any> diagramDataRelTuple = xRelSeq[j];
OUString sRelId, sExtension;
diagramDataRelTuple[0] >>= sRelId;
@@ -1073,24 +1082,27 @@ void DocxSdrExport::writeDiagramRels(const uno::Sequence< uno::Sequence< uno::An
StreamDataSequence dataSeq;
diagramDataRelTuple[1] >>= dataSeq;
- uno::Reference<io::XInputStream> dataImagebin(new ::comphelper::SequenceInputStream(dataSeq));
+ uno::Reference<io::XInputStream> dataImagebin(
+ new ::comphelper::SequenceInputStream(dataSeq));
OUString sFragment("../media/");
//nAnchorId is used to make the name unique irrespective of the number of smart arts.
- sFragment += sGrabBagProperyName + OUString::number(nAnchorId) + "_" + OUString::number(j) + sExtension;
+ sFragment += sGrabBagProperyName + OUString::number(nAnchorId) + "_" + OUString::number(j)
+ + sExtension;
PropertySet aProps(xOutStream);
aProps.setAnyProperty(PROP_RelId, uno::makeAny(sRelId.toInt32()));
m_pImpl->m_rExport.GetFilter().addRelation(xOutStream, sType, sFragment);
- sFragment = sFragment.replaceFirst("..","word");
- uno::Reference< io::XOutputStream > xBinOutStream = m_pImpl->m_rExport.GetFilter().openFragmentStream(sFragment, sContentType);
+ sFragment = sFragment.replaceFirst("..", "word");
+ uno::Reference<io::XOutputStream> xBinOutStream
+ = m_pImpl->m_rExport.GetFilter().openFragmentStream(sFragment, sContentType);
try
{
sal_Int32 nBufferSize = 512;
- uno::Sequence< sal_Int8 > aDataBuffer(nBufferSize);
+ uno::Sequence<sal_Int8> aDataBuffer(nBufferSize);
sal_Int32 nRead;
do
{
@@ -1104,36 +1116,38 @@ void DocxSdrExport::writeDiagramRels(const uno::Sequence< uno::Sequence< uno::An
}
xBinOutStream->writeBytes(aDataBuffer);
}
- }
- while (nRead);
+ } while (nRead);
xBinOutStream->flush();
}
catch (const uno::Exception& rException)
{
- SAL_WARN("sw.ww8", "DocxSdrExport::writeDiagramRels Failed to copy grabbaged Image: " << rException);
+ SAL_WARN("sw.ww8", "DocxSdrExport::writeDiagramRels Failed to copy grabbaged Image: "
+ << rException);
}
dataImagebin->closeInput();
}
}
-void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat& rFrameFormat, int nAnchorId)
+void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat& rFrameFormat,
+ int nAnchorId)
{
sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
- uno::Reference< drawing::XShape > xShape(const_cast<SdrObject*>(sdrObject)->getUnoShape(), uno::UNO_QUERY);
- uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(sdrObject)->getUnoShape(),
+ uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
uno::Reference<xml::dom::XDocument> dataDom;
uno::Reference<xml::dom::XDocument> layoutDom;
uno::Reference<xml::dom::XDocument> styleDom;
uno::Reference<xml::dom::XDocument> colorDom;
uno::Reference<xml::dom::XDocument> drawingDom;
- uno::Sequence< uno::Sequence< uno::Any > > xDataRelSeq;
- uno::Sequence< uno::Any > diagramDrawing;
+ uno::Sequence<uno::Sequence<uno::Any>> xDataRelSeq;
+ uno::Sequence<uno::Any> diagramDrawing;
// retrieve the doms from the GrabBag
- uno::Sequence< beans::PropertyValue > propList;
+ uno::Sequence<beans::PropertyValue> propList;
xPropSet->getPropertyValue(UNO_NAME_MISC_OBJ_INTEROPGRABBAG) >>= propList;
- for (sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp)
+ for (sal_Int32 nProp = 0; nProp < propList.getLength(); ++nProp)
{
OUString propName = propList[nProp].Name;
if (propName == "OOXData")
@@ -1147,7 +1161,8 @@ void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat
else if (propName == "OOXDrawing")
{
propList[nProp].Value >>= diagramDrawing;
- diagramDrawing[0] >>= drawingDom; // if there is OOXDrawing property then set drawingDom here only.
+ diagramDrawing[0]
+ >>= drawingDom; // if there is OOXDrawing property then set drawingDom here only.
}
else if (propName == "OOXDiagramDataRels")
propList[nProp].Value >>= xDataRelSeq;
@@ -1163,7 +1178,8 @@ void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat
startDMLAnchorInline(&rFrameFormat, aSize);
// generate an unique id
- sax_fastparser::FastAttributeList* pDocPrAttrList = sax_fastparser::FastSerializerHelper::createAttrList();
+ sax_fastparser::FastAttributeList* pDocPrAttrList
+ = sax_fastparser::FastSerializerHelper::createAttrList();
pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr());
OUString sName = "Diagram" + OUString::number(nAnchorId);
pDocPrAttrList->add(XML_name, OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr());
@@ -1173,130 +1189,149 @@ void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat
sal_Int32 diagramCount;
diagramCount = nAnchorId;
- pFS->singleElementNS(XML_wp, XML_cNvGraphicFramePr,
- FSEND);
+ pFS->singleElementNS(XML_wp, XML_cNvGraphicFramePr, FSEND);
- pFS->startElementNS(XML_a, XML_graphic,
- FSNS(XML_xmlns, XML_a), OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dml)), RTL_TEXTENCODING_UTF8).getStr(),
- FSEND);
+ pFS->startElementNS(
+ XML_a, XML_graphic, FSNS(XML_xmlns, XML_a),
+ OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dml)),
+ RTL_TEXTENCODING_UTF8)
+ .getStr(),
+ FSEND);
- pFS->startElementNS(XML_a, XML_graphicData,
- XML_uri, "http://schemas.openxmlformats.org/drawingml/2006/diagram",
- FSEND);
+ pFS->startElementNS(XML_a, XML_graphicData, XML_uri,
+ "http://schemas.openxmlformats.org/drawingml/2006/diagram", FSEND);
// add data relation
OUString dataFileName = "diagrams/data" + OUString::number(diagramCount) + ".xml";
- OString dataRelId = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
- oox::getRelationship(Relationship::DIAGRAMDATA),
- dataFileName), RTL_TEXTENCODING_UTF8);
-
+ OString dataRelId = OUStringToOString(
+ m_pImpl->m_rExport.GetFilter().addRelation(
+ pFS->getOutputStream(), oox::getRelationship(Relationship::DIAGRAMDATA), dataFileName),
+ RTL_TEXTENCODING_UTF8);
// add layout relation
OUString layoutFileName = "diagrams/layout" + OUString::number(diagramCount) + ".xml";
- OString layoutRelId = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
- oox::getRelationship(Relationship::DIAGRAMLAYOUT),
- layoutFileName), RTL_TEXTENCODING_UTF8);
+ OString layoutRelId
+ = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(
+ pFS->getOutputStream(),
+ oox::getRelationship(Relationship::DIAGRAMLAYOUT), layoutFileName),
+ RTL_TEXTENCODING_UTF8);
// add style relation
OUString styleFileName = "diagrams/quickStyle" + OUString::number(diagramCount) + ".xml";
- OString styleRelId = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
- oox::getRelationship(Relationship::DIAGRAMQUICKSTYLE),
- styleFileName), RTL_TEXTENCODING_UTF8);
+ OString styleRelId = OUStringToOString(
+ m_pImpl->m_rExport.GetFilter().addRelation(
+ pFS->getOutputStream(), oox::getRelationship(Relationship::DIAGRAMQUICKSTYLE),
+ styleFileName),
+ RTL_TEXTENCODING_UTF8);
// add color relation
OUString colorFileName = "diagrams/colors" + OUString::number(diagramCount) + ".xml";
- OString colorRelId = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
- oox::getRelationship(Relationship::DIAGRAMCOLORS),
- colorFileName), RTL_TEXTENCODING_UTF8);
+ OString colorRelId
+ = OUStringToOString(m_pImpl->m_rExport.GetFilter().addRelation(
+ pFS->getOutputStream(),
+ oox::getRelationship(Relationship::DIAGRAMCOLORS), colorFileName),
+ RTL_TEXTENCODING_UTF8);
OUString drawingFileName;
if (drawingDom.is())
{
// add drawing relation
drawingFileName = "diagrams/drawing" + OUString::number(diagramCount) + ".xml";
- OUString drawingRelId = m_pImpl->m_rExport.GetFilter().addRelation(pFS->getOutputStream(),
- oox::getRelationship(Relationship::DIAGRAMDRAWING),
- drawingFileName);
+ OUString drawingRelId = m_pImpl->m_rExport.GetFilter().addRelation(
+ pFS->getOutputStream(), oox::getRelationship(Relationship::DIAGRAMDRAWING),
+ drawingFileName);
// the data dom contains a reference to the drawing relation. We need to update it with the new generated
// relation value before writing the dom to a file
// Get the dsp:damaModelExt node from the dom
- uno::Reference< xml::dom::XNodeList > nodeList =
- dataDom->getElementsByTagNameNS("http://schemas.microsoft.com/office/drawing/2008/diagram", "dataModelExt");
+ uno::Reference<xml::dom::XNodeList> nodeList = dataDom->getElementsByTagNameNS(
+ "http://schemas.microsoft.com/office/drawing/2008/diagram", "dataModelExt");
// There must be one element only so get it
- uno::Reference< xml::dom::XNode > node = nodeList->item(0);
+ uno::Reference<xml::dom::XNode> node = nodeList->item(0);
// Get the list of attributes of the node
- uno::Reference< xml::dom::XNamedNodeMap > nodeMap = node->getAttributes();
+ uno::Reference<xml::dom::XNamedNodeMap> nodeMap = node->getAttributes();
// Get the node with the relId attribute and set its new value
- uno::Reference< xml::dom::XNode > relIdNode = nodeMap->getNamedItem("relId");
+ uno::Reference<xml::dom::XNode> relIdNode = nodeMap->getNamedItem("relId");
relIdNode->setNodeValue(drawingRelId);
}
- pFS->singleElementNS(XML_dgm, XML_relIds,
- FSNS(XML_xmlns, XML_dgm), OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dmlDiagram)), RTL_TEXTENCODING_UTF8).getStr(),
- FSNS(XML_xmlns, XML_r), OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(officeRel)), RTL_TEXTENCODING_UTF8).getStr(),
- FSNS(XML_r, XML_dm), dataRelId.getStr(),
- FSNS(XML_r, XML_lo), layoutRelId.getStr(),
- FSNS(XML_r, XML_qs), styleRelId.getStr(),
- FSNS(XML_r, XML_cs), colorRelId.getStr(),
- FSEND);
+ pFS->singleElementNS(
+ XML_dgm, XML_relIds, FSNS(XML_xmlns, XML_dgm),
+ OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dmlDiagram)),
+ RTL_TEXTENCODING_UTF8)
+ .getStr(),
+ FSNS(XML_xmlns, XML_r),
+ OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(officeRel)),
+ RTL_TEXTENCODING_UTF8)
+ .getStr(),
+ FSNS(XML_r, XML_dm), dataRelId.getStr(), FSNS(XML_r, XML_lo), layoutRelId.getStr(),
+ FSNS(XML_r, XML_qs), styleRelId.getStr(), FSNS(XML_r, XML_cs), colorRelId.getStr(), FSEND);
pFS->endElementNS(XML_a, XML_graphicData);
pFS->endElementNS(XML_a, XML_graphic);
endDMLAnchorInline(&rFrameFormat);
- uno::Reference< xml::sax::XSAXSerializable > serializer;
- uno::Reference< xml::sax::XWriter > writer = xml::sax::Writer::create(comphelper::getProcessComponentContext());
+ uno::Reference<xml::sax::XSAXSerializable> serializer;
+ uno::Reference<xml::sax::XWriter> writer
+ = xml::sax::Writer::create(comphelper::getProcessComponentContext());
// write data file
serializer.set(dataDom, uno::UNO_QUERY);
- uno::Reference< io::XOutputStream > xDataOutputStream = m_pImpl->m_rExport.GetFilter().openFragmentStream(
- "word/" + dataFileName, "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml");
+ uno::Reference<io::XOutputStream> xDataOutputStream
+ = m_pImpl->m_rExport.GetFilter().openFragmentStream(
+ "word/" + dataFileName,
+ "application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml");
writer->setOutputStream(xDataOutputStream);
- serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
- uno::Sequence< beans::StringPair >());
+ serializer->serialize(uno::Reference<xml::sax::XDocumentHandler>(writer, uno::UNO_QUERY_THROW),
+ uno::Sequence<beans::StringPair>());
// write the associated Images and rels for data file
writeDiagramRels(xDataRelSeq, xDataOutputStream, "OOXDiagramDataRels", nAnchorId);
// write layout file
serializer.set(layoutDom, uno::UNO_QUERY);
- writer->setOutputStream(m_pImpl->m_rExport.GetFilter().openFragmentStream("word/" + layoutFileName,
- "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml"));
- serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
- uno::Sequence< beans::StringPair >());
+ writer->setOutputStream(m_pImpl->m_rExport.GetFilter().openFragmentStream(
+ "word/" + layoutFileName,
+ "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml"));
+ serializer->serialize(uno::Reference<xml::sax::XDocumentHandler>(writer, uno::UNO_QUERY_THROW),
+ uno::Sequence<beans::StringPair>());
// write style file
serializer.set(styleDom, uno::UNO_QUERY);
- writer->setOutputStream(m_pImpl->m_rExport.GetFilter().openFragmentStream("word/" + styleFileName,
- "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml"));
- serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
- uno::Sequence< beans::StringPair >());
+ writer->setOutputStream(m_pImpl->m_rExport.GetFilter().openFragmentStream(
+ "word/" + styleFileName,
+ "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml"));
+ serializer->serialize(uno::Reference<xml::sax::XDocumentHandler>(writer, uno::UNO_QUERY_THROW),
+ uno::Sequence<beans::StringPair>());
// write color file
serializer.set(colorDom, uno::UNO_QUERY);
- writer->setOutputStream(m_pImpl->m_rExport.GetFilter().openFragmentStream("word/" + colorFileName,
- "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml"));
- serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
- uno::Sequence< beans::StringPair >());
+ writer->setOutputStream(m_pImpl->m_rExport.GetFilter().openFragmentStream(
+ "word/" + colorFileName,
+ "application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml"));
+ serializer->serialize(uno::Reference<xml::sax::XDocumentHandler>(writer, uno::UNO_QUERY_THROW),
+ uno::Sequence<beans::StringPair>());
// write drawing file
if (drawingDom.is())
{
serializer.set(drawingDom, uno::UNO_QUERY);
- uno::Reference< io::XOutputStream > xDrawingOutputStream = m_pImpl->m_rExport.GetFilter().openFragmentStream("word/" + drawingFileName,
+ uno::Reference<io::XOutputStream> xDrawingOutputStream
+ = m_pImpl->m_rExport.GetFilter().openFragmentStream(
+ "word/" + drawingFileName,
"application/vnd.openxmlformats-officedocument.drawingml.diagramDrawing+xml");
writer->setOutputStream(xDrawingOutputStream);
- serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
- uno::Sequence< beans::StringPair >());
+ serializer->serialize(
+ uno::Reference<xml::sax::XDocumentHandler>(writer, uno::UNO_QUERY_THROW),
+ uno::Sequence<beans::StringPair>());
// write the associated Images and rels for drawing file
- uno::Sequence< uno::Sequence< uno::Any > > xDrawingRelSeq;
+ uno::Sequence<uno::Sequence<uno::Any>> xDrawingRelSeq;
diagramDrawing[1] >>= xDrawingRelSeq;
writeDiagramRels(xDrawingRelSeq, xDrawingOutputStream, "OOXDiagramDrawingRels", nAnchorId);
}
@@ -1308,14 +1343,15 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame)
const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx();
sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
- sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex()+1 : 0;
+ sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : 0;
sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0;
//Save data here and restore when out of scope
ExportDataSaveRestore aDataGuard(m_pImpl->m_rExport, nStt, nEnd, pParentFrame);
m_pImpl->m_pBodyPrAttrList = sax_fastparser::FastSerializerHelper::createAttrList();
- m_pImpl->m_bFrameBtLr = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/true);
+ m_pImpl->m_bFrameBtLr
+ = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/true);
m_pImpl->m_bFlyFrameGraphic = true;
m_pImpl->m_rExport.WriteText();
m_pImpl->m_bFlyFrameGraphic = false;
@@ -1349,17 +1385,14 @@ void DocxSdrExport::writeBoxItemLine(const SvxBoxItem& rBox)
}
sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
- double fConverted(editeng::ConvertBorderWidthToWord(pBorderLine->GetBorderLineStyle(), pBorderLine->GetWidth()));
+ double fConverted(editeng::ConvertBorderWidthToWord(pBorderLine->GetBorderLineStyle(),
+ pBorderLine->GetWidth()));
OString sWidth(OString::number(TwipsToEMU(fConverted)));
- pFS->startElementNS(XML_a, XML_ln,
- XML_w, sWidth.getStr(),
- FSEND);
+ pFS->startElementNS(XML_a, XML_ln, XML_w, sWidth.getStr(), FSEND);
pFS->startElementNS(XML_a, XML_solidFill, FSEND);
OString sColor(msfilter::util::ConvertColor(pBorderLine->GetColor()));
- pFS->singleElementNS(XML_a, XML_srgbClr,
- XML_val, sColor,
- FSEND);
+ pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, sColor, FSEND);
pFS->endElementNS(XML_a, XML_solidFill);
if (SvxBorderLineStyle::DASHED == pBorderLine->GetBorderLineStyle()) // Line Style is Dash type
@@ -1368,7 +1401,8 @@ void DocxSdrExport::writeBoxItemLine(const SvxBoxItem& rBox)
pFS->endElementNS(XML_a, XML_ln);
}
-void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAnchorId, bool bTextBoxOnly)
+void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAnchorId,
+ bool bTextBoxOnly)
{
bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
m_pImpl->m_bDMLAndVMLDrawingOpen = true;
@@ -1377,7 +1411,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat();
const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx();
- sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex()+1 : 0;
+ sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : 0;
sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0;
//Save data here and restore when out of scope
@@ -1387,12 +1421,12 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
// to lots of contents, this size contains the real size.
const Size aSize = pParentFrame->GetSize();
- uno::Reference< drawing::XShape > xShape;
+ uno::Reference<drawing::XShape> xShape;
const SdrObject* pSdrObj = rFrameFormat.FindRealSdrObject();
if (pSdrObj)
xShape.set(const_cast<SdrObject*>(pSdrObj)->getUnoShape(), uno::UNO_QUERY);
- uno::Reference< beans::XPropertySet > xPropertySet(xShape, uno::UNO_QUERY);
- uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
+ uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySetInfo> xPropSetInfo;
if (xPropertySet.is())
xPropSetInfo = xPropertySet->getPropertySetInfo();
@@ -1408,70 +1442,67 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
{
startDMLAnchorInline(&rFrameFormat, aSize);
- sax_fastparser::FastAttributeList* pDocPrAttrList = sax_fastparser::FastSerializerHelper::createAttrList();
+ sax_fastparser::FastAttributeList* pDocPrAttrList
+ = sax_fastparser::FastSerializerHelper::createAttrList();
pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr());
- pDocPrAttrList->add(XML_name, OUStringToOString(rFrameFormat.GetName(), RTL_TEXTENCODING_UTF8).getStr());
+ pDocPrAttrList->add(
+ XML_name, OUStringToOString(rFrameFormat.GetName(), RTL_TEXTENCODING_UTF8).getStr());
sax_fastparser::XFastAttributeListRef xDocPrAttrListRef(pDocPrAttrList);
pFS->singleElementNS(XML_wp, XML_docPr, xDocPrAttrListRef);
- pFS->startElementNS(XML_a, XML_graphic,
- FSNS(XML_xmlns, XML_a), OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dml)), RTL_TEXTENCODING_UTF8).getStr(),
- FSEND);
- pFS->startElementNS(XML_a, XML_graphicData,
- XML_uri, "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
+ pFS->startElementNS(
+ XML_a, XML_graphic, FSNS(XML_xmlns, XML_a),
+ OUStringToOString(m_pImpl->m_rExport.GetFilter().getNamespaceURL(OOX_NS(dml)),
+ RTL_TEXTENCODING_UTF8)
+ .getStr(),
+ FSEND);
+ pFS->startElementNS(XML_a, XML_graphicData, XML_uri,
+ "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
FSEND);
pFS->startElementNS(XML_wps, XML_wsp, FSEND);
- pFS->singleElementNS(XML_wps, XML_cNvSpPr,
- XML_txBox, "1",
- FSEND);
+ pFS->singleElementNS(XML_wps, XML_cNvSpPr, XML_txBox, "1", FSEND);
- uno::Any aRotation ;
+ uno::Any aRotation;
m_pImpl->m_nDMLandVMLTextFrameRotation = 0;
if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("FrameInteropGrabBag"))
{
- uno::Sequence< beans::PropertyValue > propList;
+ uno::Sequence<beans::PropertyValue> propList;
xPropertySet->getPropertyValue("FrameInteropGrabBag") >>= propList;
- for (sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp)
+ for (sal_Int32 nProp = 0; nProp < propList.getLength(); ++nProp)
{
OUString propName = propList[nProp].Name;
if (propName == "mso-rotation-angle")
{
- aRotation = propList[nProp].Value ;
+ aRotation = propList[nProp].Value;
break;
}
}
}
- aRotation >>= m_pImpl->m_nDMLandVMLTextFrameRotation ;
- OString sRotation(OString::number((OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(m_pImpl->m_nDMLandVMLTextFrameRotation))));
+ aRotation >>= m_pImpl->m_nDMLandVMLTextFrameRotation;
+ OString sRotation(OString::number(
+ (OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(m_pImpl->m_nDMLandVMLTextFrameRotation))));
// Shape properties
pFS->startElementNS(XML_wps, XML_spPr, FSEND);
if (m_pImpl->m_nDMLandVMLTextFrameRotation)
{
- pFS->startElementNS(XML_a, XML_xfrm,
- XML_rot, sRotation.getStr(),
- FSEND);
+ pFS->startElementNS(XML_a, XML_xfrm, XML_rot, sRotation.getStr(), FSEND);
}
else
{
pFS->startElementNS(XML_a, XML_xfrm, FSEND);
}
- pFS->singleElementNS(XML_a, XML_off,
- XML_x, "0",
- XML_y, "0",
- FSEND);
+ pFS->singleElementNS(XML_a, XML_off, XML_x, "0", XML_y, "0", FSEND);
OString aWidth(OString::number(TwipsToEMU(aSize.Width())));
OString aHeight(OString::number(TwipsToEMU(aSize.Height())));
- pFS->singleElementNS(XML_a, XML_ext,
- XML_cx, aWidth.getStr(),
- XML_cy, aHeight.getStr(),
+ pFS->singleElementNS(XML_a, XML_ext, XML_cx, aWidth.getStr(), XML_cy, aHeight.getStr(),
FSEND);
pFS->endElementNS(XML_a, XML_xfrm);
OUString shapeType = "rect";
if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("FrameInteropGrabBag"))
{
- uno::Sequence< beans::PropertyValue > propList;
+ uno::Sequence<beans::PropertyValue> propList;
xPropertySet->getPropertyValue("FrameInteropGrabBag") >>= propList;
- for (sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp)
+ for (sal_Int32 nProp = 0; nProp < propList.getLength(); ++nProp)
{
OUString propName = propList[nProp].Name;
if (propName == "mso-orig-shape-type")
@@ -1485,9 +1516,8 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
if (shapeType.isEmpty())
shapeType = "rect";
- pFS->singleElementNS(XML_a, XML_prstGeom,
- XML_prst, OUStringToOString(shapeType, RTL_TEXTENCODING_UTF8).getStr(),
- FSEND);
+ pFS->singleElementNS(XML_a, XML_prstGeom, XML_prst,
+ OUStringToOString(shapeType, RTL_TEXTENCODING_UTF8).getStr(), FSEND);
m_pImpl->m_bDMLTextFrameSyntax = true;
m_pImpl->m_rExport.OutputFormat(pParentFrame->GetFrameFormat(), false, false, true);
m_pImpl->m_bDMLTextFrameSyntax = false;
@@ -1499,12 +1529,13 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
std::map<OUString, MSWordExportBase::LinkedTextboxInfo>::iterator linkedTextboxesIter;
if (!m_pImpl->m_rExport.m_bLinkedTextboxesHelperInitialized)
{
- sal_Int32 nSeq=0;
+ sal_Int32 nSeq = 0;
linkedTextboxesIter = m_pImpl->m_rExport.m_aLinkedTextboxesHelper.begin();
while (linkedTextboxesIter != m_pImpl->m_rExport.m_aLinkedTextboxesHelper.end())
{
//find the start of a textbox chain: has no PREVIOUS link, but does have NEXT link
- if (linkedTextboxesIter->second.sPrevChain.isEmpty() && !linkedTextboxesIter->second.sNextChain.isEmpty())
+ if (linkedTextboxesIter->second.sPrevChain.isEmpty()
+ && !linkedTextboxesIter->second.sNextChain.isEmpty())
{
//assign this chain a unique ID and start a new sequence
nSeq = 0;
@@ -1514,8 +1545,9 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
OUString sCheckForBrokenChains = linkedTextboxesIter->first;
//follow the chain and assign the same id, and incremental sequence numbers.
- std::map<OUString, MSWordExportBase::LinkedTextboxInfo>::iterator followChainIter;
- followChainIter = m_pImpl->m_rExport.m_aLinkedTextboxesHelper.find(linkedTextboxesIter->second.sNextChain);
+ std::map<OUString, MSWordExportBase::LinkedTextboxInfo>::iterator followChainIter;
+ followChainIter = m_pImpl->m_rExport.m_aLinkedTextboxesHelper.find(
+ linkedTextboxesIter->second.sNextChain);
while (followChainIter != m_pImpl->m_rExport.m_aLinkedTextboxesHelper.end())
{
//verify that the NEXT textbox also points to me as the PREVIOUS.
@@ -1531,7 +1563,8 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
break;
sCheckForBrokenChains = followChainIter->first;
- followChainIter = m_pImpl->m_rExport.m_aLinkedTextboxesHelper.find(followChainIter->second.sNextChain);
+ followChainIter = m_pImpl->m_rExport.m_aLinkedTextboxesHelper.find(
+ followChainIter->second.sNextChain);
}
}
++linkedTextboxesIter;
@@ -1540,8 +1573,8 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
}
m_pImpl->m_rExport.m_pParentFrame = nullptr;
- bool skipTxBxContent = false ;
- bool isTxbxLinked = false ;
+ bool skipTxBxContent = false;
+ bool isTxbxLinked = false;
OUString sLinkChainName;
if (xPropSetInfo.is())
@@ -1556,39 +1589,39 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
linkedTextboxesIter = m_pImpl->m_rExport.m_aLinkedTextboxesHelper.find(sLinkChainName);
if (linkedTextboxesIter != m_pImpl->m_rExport.m_aLinkedTextboxesHelper.end())
{
- if ((linkedTextboxesIter->second.nId !=0) && (linkedTextboxesIter->second.nSeq != 0))
+ if ((linkedTextboxesIter->second.nId != 0) && (linkedTextboxesIter->second.nSeq != 0))
{
//not the first in the chain, so write the tag as linkedTxbx
- pFS->singleElementNS(XML_wps, XML_linkedTxbx,
- XML_id, I32S(linkedTextboxesIter->second.nId),
- XML_seq, I32S(linkedTextboxesIter->second.nSeq),
- FSEND);
+ pFS->singleElementNS(XML_wps, XML_linkedTxbx, XML_id,
+ I32S(linkedTextboxesIter->second.nId), XML_seq,
+ I32S(linkedTextboxesIter->second.nSeq), FSEND);
/* no text content should be added to this tag,
since the textbox is linked, the entire content
is written in txbx block
*/
- skipTxBxContent = true ;
+ skipTxBxContent = true;
}
else if ((linkedTextboxesIter->second.nId != 0) && (linkedTextboxesIter->second.nSeq == 0))
{
/* this is the first textbox in the chaining, we add the text content
to this block*/
//since the text box is linked, it needs an id.
- pFS->startElementNS(XML_wps, XML_txbx,
- XML_id, I32S(linkedTextboxesIter->second.nId),
+ pFS->startElementNS(XML_wps, XML_txbx, XML_id, I32S(linkedTextboxesIter->second.nId),
FSEND);
- isTxbxLinked = true ;
+ isTxbxLinked = true;
}
}
if (!skipTxBxContent)
{
if (!isTxbxLinked)
- pFS->startElementNS(XML_wps, XML_txbx, FSEND);//text box is not linked, therefore no id.
+ pFS->startElementNS(XML_wps, XML_txbx,
+ FSEND); //text box is not linked, therefore no id.
pFS->startElementNS(XML_w, XML_txbxContent, FSEND);
- m_pImpl->m_bFrameBtLr = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/true);
+ m_pImpl->m_bFrameBtLr
+ = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/true);
m_pImpl->m_bFlyFrameGraphic = true;
m_pImpl->m_rExport.WriteText();
if (m_pImpl->m_bParagraphSdtOpen)
@@ -1606,13 +1639,13 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
// We need to init padding to 0, if it's not set.
// In LO the default is 0 and so ins attributes are not set when padding is 0
// but in MSO the default is 254 / 127, so we need to set 0 padding explicitly
- if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_lIns))
+ if (!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_lIns))
m_pImpl->m_pBodyPrAttrList->add(XML_lIns, OString::number(0));
- if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_tIns))
+ if (!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_tIns))
m_pImpl->m_pBodyPrAttrList->add(XML_tIns, OString::number(0));
- if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_rIns))
+ if (!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_rIns))
m_pImpl->m_pBodyPrAttrList->add(XML_rIns, OString::number(0));
- if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_bIns))
+ if (!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_bIns))
m_pImpl->m_pBodyPrAttrList->add(XML_bIns, OString::number(0));
sax_fastparser::XFastAttributeListRef xBodyPrAttrList(m_pImpl->m_pBodyPrAttrList);
@@ -1622,7 +1655,9 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
pFS->startElementNS(XML_wps, XML_bodyPr, xBodyPrAttrList);
// AutoSize of the Text Frame.
const SwFormatFrameSize& rSize = rFrameFormat.GetFrameSize();
- pFS->singleElementNS(XML_a, (rSize.GetHeightSizeType() == ATT_VAR_SIZE ? XML_spAutoFit : XML_noAutofit), FSEND);
+ pFS->singleElementNS(
+ XML_a, (rSize.GetHeightSizeType() == ATT_VAR_SIZE ? XML_spAutoFit : XML_noAutofit),
+ FSEND);
pFS->endElementNS(XML_wps, XML_bodyPr);
pFS->endElementNS(XML_wps, XML_wsp);
@@ -1633,8 +1668,10 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
const sal_uInt8 nWidthPercent = rSize.GetWidthPercent();
if (nWidthPercent && nWidthPercent != SwFormatFrameSize::SYNCED)
{
- pFS->startElementNS(XML_wp14, XML_sizeRelH,
- XML_relativeFrom, (rSize.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME ? "page" : "margin"),
+ pFS->startElementNS(XML_wp14, XML_sizeRelH, XML_relativeFrom,
+ (rSize.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME
+ ? "page"
+ : "margin"),
FSEND);
pFS->startElementNS(XML_wp14, XML_pctWidth, FSEND);
pFS->writeEscaped(OUString::number(nWidthPercent * oox::drawingml::PER_PERCENT));
@@ -1644,9 +1681,11 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
const sal_uInt8 nHeightPercent = rSize.GetHeightPercent();
if (nHeightPercent && nHeightPercent != SwFormatFrameSize::SYNCED)
{
- pFS->startElementNS(XML_wp14, XML_sizeRelV,
- XML_relativeFrom, (rSize.GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME ? "page" : "margin"),
- FSEND);
+ pFS->startElementNS(
+ XML_wp14, XML_sizeRelV, XML_relativeFrom,
+ (rSize.GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME ? "page"
+ : "margin"),
+ FSEND);
pFS->startElementNS(XML_wp14, XML_pctHeight, FSEND);
pFS->writeEscaped(OUString::number(nHeightPercent * oox::drawingml::PER_PERCENT));
pFS->endElementNS(XML_wp14, XML_pctHeight);
@@ -1667,7 +1706,7 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText
const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat();
const SwNodeIndex* pNodeIndex = rFrameFormat.GetContent().GetContentIdx();
- sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex()+1 : 0;
+ sal_uLong nStt = pNodeIndex ? pNodeIndex->GetIndex() + 1 : 0;
sal_uLong nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0;
//Save data here and restore when out of scope
@@ -1695,11 +1734,13 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText
{
OUString sAnchorId = lclGetAnchorIdFromGrabBag(pObject);
if (!sAnchorId.isEmpty())
- m_pImpl->m_pFlyAttrList->addNS(XML_w14, XML_anchorId, OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8));
+ m_pImpl->m_pFlyAttrList->addNS(XML_w14, XML_anchorId,
+ OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8));
}
sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->m_pFlyAttrList.get());
m_pImpl->m_pFlyAttrList.clear();
- m_pImpl->m_bFrameBtLr = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/false);
+ m_pImpl->m_bFrameBtLr
+ = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/false);
sax_fastparser::XFastAttributeListRef xTextboxAttrList(m_pImpl->m_pTextboxAttrList.get());
m_pImpl->m_pTextboxAttrList.clear();
m_pImpl->m_bTextFrameSyntax = false;
@@ -1713,13 +1754,15 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText
m_pImpl->textFrameShadow(rFrameFormat);
if (m_pImpl->m_pFlyFillAttrList.is())
{
- sax_fastparser::XFastAttributeListRef xFlyFillAttrList(m_pImpl->m_pFlyFillAttrList.get());
+ sax_fastparser::XFastAttributeListRef xFlyFillAttrList(
+ m_pImpl->m_pFlyFillAttrList.get());
m_pImpl->m_pFlyFillAttrList.clear();
pFS->singleElementNS(XML_v, XML_fill, xFlyFillAttrList);
}
if (m_pImpl->m_pDashLineStyleAttr.is())
{
- sax_fastparser::XFastAttributeListRef xDashLineStyleAttr(m_pImpl->m_pDashLineStyleAttr.get());
+ sax_fastparser::XFastAttributeListRef xDashLineStyleAttr(
+ m_pImpl->m_pDashLineStyleAttr.get());
m_pImpl->m_pDashLineStyleAttr.clear();
pFS->singleElementNS(XML_v, XML_stroke, xDashLineStyleAttr);
}
diff --git a/xmlsecurity/inc/documentsignaturemanager.hxx b/xmlsecurity/inc/documentsignaturemanager.hxx
index 8a3837ded39b..50f683a35850 100644
--- a/xmlsecurity/inc/documentsignaturemanager.hxx
+++ b/xmlsecurity/inc/documentsignaturemanager.hxx
@@ -42,7 +42,7 @@ public:
std::unique_ptr<PDFSignatureHelper> mpPDFSignatureHelper;
SignatureInformations maCurrentSignatureInformations;
DocumentSignatureMode meSignatureMode;
- css::uno::Sequence< css::uno::Sequence<css::beans::PropertyValue> > m_manifest;
+ css::uno::Sequence<css::uno::Sequence<css::beans::PropertyValue>> m_manifest;
css::uno::Reference<css::io::XStream> mxSignatureStream;
css::uno::Reference<css::io::XStream> mxTempSignatureStream;
/// Storage containing all OOXML signatures, unused for ODF.
@@ -52,7 +52,8 @@ public:
css::uno::Reference<css::xml::crypto::XSEInitializer> mxGpgSEInitializer;
css::uno::Reference<css::xml::crypto::XXMLSecurityContext> mxGpgSecurityContext;
- DocumentSignatureManager(const css::uno::Reference<css::uno::XComponentContext>& xContext, DocumentSignatureMode eMode);
+ DocumentSignatureManager(const css::uno::Reference<css::uno::XComponentContext>& xContext,
+ DocumentSignatureMode eMode);
~DocumentSignatureManager();
/**
* Checks if a particular stream is a valid xml stream. Those are treated
@@ -81,8 +82,8 @@ public:
/// Get the security environment.
css::uno::Reference<css::xml::crypto::XSecurityEnvironment> getSecurityEnvironment();
css::uno::Reference<css::xml::crypto::XSecurityEnvironment> getGpgSecurityEnvironment();
- css::uno::Reference<css::xml::crypto::XXMLSecurityContext> const & getSecurityContext();
- css::uno::Reference<css::xml::crypto::XXMLSecurityContext> const & getGpgSecurityContext();
+ css::uno::Reference<css::xml::crypto::XXMLSecurityContext> const& getSecurityContext();
+ css::uno::Reference<css::xml::crypto::XXMLSecurityContext> const& getGpgSecurityContext();
};
#endif // INCLUDED_XMLSECURITY_INC_DOCUMENTSIGNATUREMANAGER_HXX
diff --git a/xmlsecurity/inc/pdfsignaturehelper.hxx b/xmlsecurity/inc/pdfsignaturehelper.hxx
index 392331832963..95df24c1abc1 100644
--- a/xmlsecurity/inc/pdfsignaturehelper.hxx
+++ b/xmlsecurity/inc/pdfsignaturehelper.hxx
@@ -32,8 +32,10 @@ class XMLSECURITY_DLLPUBLIC PDFSignatureHelper
public:
PDFSignatureHelper();
bool ReadAndVerifySignature(const css::uno::Reference<css::io::XInputStream>& xInputStream);
- css::uno::Sequence<css::security::DocumentSignatureInformation> GetDocumentSignatureInformations(const css::uno::Reference<css::xml::crypto::XSecurityEnvironment>& xSecEnv) const;
- SignatureInformations const & GetSignatureInformations() const;
+ css::uno::Sequence<css::security::DocumentSignatureInformation>
+ GetDocumentSignatureInformations(
+ const css::uno::Reference<css::xml::crypto::XSecurityEnvironment>& xSecEnv) const;
+ SignatureInformations const& GetSignatureInformations() const;
/// Return the ID of the next created signature.
sal_Int32 GetNewSecurityId() const;
@@ -44,7 +46,8 @@ public:
/// Append a new signature at the end of xInputStream.
bool Sign(const css::uno::Reference<css::io::XInputStream>& xInputStream, bool bAdES);
/// Remove the signature at nPosition (and all dependent signatures) from xInputStream.
- static bool RemoveSignature(const css::uno::Reference<css::io::XInputStream>& xInputStream, sal_uInt16 nPosition);
+ static bool RemoveSignature(const css::uno::Reference<css::io::XInputStream>& xInputStream,
+ sal_uInt16 nPosition);
};
#endif // INCLUDED_XMLSECURITY_INC_PDFSIGNATUREHELPER_HXX
diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index 9fb36dbb699e..7d9acf5ea7a4 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -44,23 +44,24 @@
using namespace css;
-DocumentSignatureManager::DocumentSignatureManager(const uno::Reference<uno::XComponentContext>& xContext, DocumentSignatureMode eMode)
- : mxContext(xContext),
- maSignatureHelper(xContext),
- meSignatureMode(eMode)
+DocumentSignatureManager::DocumentSignatureManager(
+ const uno::Reference<uno::XComponentContext>& xContext, DocumentSignatureMode eMode)
+ : mxContext(xContext)
+ , maSignatureHelper(xContext)
+ , meSignatureMode(eMode)
{
}
-DocumentSignatureManager::~DocumentSignatureManager()
-{
- deInitXmlSec();
-}
+DocumentSignatureManager::~DocumentSignatureManager() { deInitXmlSec(); }
bool DocumentSignatureManager::init()
{
- SAL_WARN_IF(mxSEInitializer.is(), "xmlsecurity.helper", "DocumentSignatureManager::Init - mxSEInitializer already set!");
- SAL_WARN_IF(mxSecurityContext.is(), "xmlsecurity.helper", "DocumentSignatureManager::Init - mxSecurityContext already set!");
- SAL_WARN_IF(mxGpgSEInitializer.is(), "xmlsecurity.helper", "DocumentSignatureManager::Init - mxGpgSEInitializer already set!");
+ SAL_WARN_IF(mxSEInitializer.is(), "xmlsecurity.helper",
+ "DocumentSignatureManager::Init - mxSEInitializer already set!");
+ SAL_WARN_IF(mxSecurityContext.is(), "xmlsecurity.helper",
+ "DocumentSignatureManager::Init - mxSecurityContext already set!");
+ SAL_WARN_IF(mxGpgSEInitializer.is(), "xmlsecurity.helper",
+ "DocumentSignatureManager::Init - mxGpgSEInitializer already set!");
// xmlsec is needed by both services, so init before those
initXmlSec();
@@ -152,7 +153,7 @@ bool DocumentSignatureManager::isXML(const OUString& rURI)
}
if (DocumentSignatureHelper::equalsReferenceUriManifestPath(rURI, sPath))
{
- bIsXML = sMediaType == "text/xml" && ! bEncrypted;
+ bIsXML = sMediaType == "text/xml" && !bEncrypted;
bPropsAvailable = true;
break;
}
@@ -167,7 +168,7 @@ bool DocumentSignatureManager::isXML(const OUString& rURI)
sal_Int32 nSep = rURI.lastIndexOf('.');
if (nSep != -1)
{
- OUString aExt = rURI.copy(nSep+1);
+ OUString aExt = rURI.copy(nSep + 1);
if (aExt.equalsIgnoreAsciiCase("XML"))
bIsXML = true;
}
@@ -181,7 +182,8 @@ bool DocumentSignatureManager::isXML(const OUString& rURI)
//We keep the temporary stream as member because ImplGetSignatureInformations
//will later access the stream to create DocumentSignatureInformation objects
//which are stored in maCurrentSignatureInformations.
-SignatureStreamHelper DocumentSignatureManager::ImplOpenSignatureStream(sal_Int32 nStreamOpenMode, bool bTempStream)
+SignatureStreamHelper DocumentSignatureManager::ImplOpenSignatureStream(sal_Int32 nStreamOpenMode,
+ bool bTempStream)
{
SignatureStreamHelper aHelper;
if (mxStore.is())
@@ -201,7 +203,8 @@ SignatureStreamHelper DocumentSignatureManager::ImplOpenSignatureStream(sal_Int3
aHelper.xSignatureStream = mxTempSignatureStream;
else
{
- mxTempSignatureStorage = comphelper::OStorageHelper::GetStorageOfFormatFromStream(ZIP_STORAGE_FORMAT_STRING, mxTempSignatureStream);
+ mxTempSignatureStorage = comphelper::OStorageHelper::GetStorageOfFormatFromStream(
+ ZIP_STORAGE_FORMAT_STRING, mxTempSignatureStream);
aHelper.xSignatureStorage = mxTempSignatureStorage;
}
}
@@ -209,7 +212,8 @@ SignatureStreamHelper DocumentSignatureManager::ImplOpenSignatureStream(sal_Int3
{
//When we read from the temp stream, then we must have previously
//created one.
- SAL_WARN_IF(!mxTempSignatureStream.is(), "xmlsecurity.helper", "empty temp. signature stream reference");
+ SAL_WARN_IF(!mxTempSignatureStream.is(), "xmlsecurity.helper",
+ "empty temp. signature stream reference");
}
aHelper.xSignatureStream = mxTempSignatureStream;
if (aHelper.nStorageFormat == embed::StorageFormats::OFOPXML)
@@ -225,7 +229,8 @@ SignatureStreamHelper DocumentSignatureManager::ImplOpenSignatureStream(sal_Int3
//Or DocumentDigitalSignatures::showDocumentContentSignatures was called,
//in which case Add/Remove is not allowed. This is done, for example, if the
//document is readonly
- aHelper = DocumentSignatureHelper::OpenSignatureStream(mxStore, nStreamOpenMode, meSignatureMode);
+ aHelper = DocumentSignatureHelper::OpenSignatureStream(mxStore, nStreamOpenMode,
+ meSignatureMode);
}
else
{
@@ -235,7 +240,8 @@ SignatureStreamHelper DocumentSignatureManager::ImplOpenSignatureStream(sal_Int3
if (nStreamOpenMode & embed::ElementModes::TRUNCATE)
{
- if (aHelper.xSignatureStream.is() && aHelper.nStorageFormat != embed::StorageFormats::OFOPXML)
+ if (aHelper.xSignatureStream.is()
+ && aHelper.nStorageFormat != embed::StorageFormats::OFOPXML)
{
uno::Reference<io::XTruncate> xTruncate(aHelper.xSignatureStream, uno::UNO_QUERY_THROW);
xTruncate->truncate();
@@ -253,11 +259,10 @@ SignatureStreamHelper DocumentSignatureManager::ImplOpenSignatureStream(sal_Int3
return aHelper;
}
-bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>& xCert,
- const uno::Reference<xml::crypto::XXMLSecurityContext>& xSecurityContext,
- const OUString& rDescription,
- sal_Int32& nSecurityId,
- bool bAdESCompliant)
+bool DocumentSignatureManager::add(
+ const uno::Reference<security::XCertificate>& xCert,
+ const uno::Reference<xml::crypto::XXMLSecurityContext>& xSecurityContext,
+ const OUString& rDescription, sal_Int32& nSecurityId, bool bAdESCompliant)
{
if (!xCert.is())
{
@@ -266,8 +271,9 @@ bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>&
}
// GPG or X509 key?
- uno::Reference< lang::XServiceInfo > xServiceInfo(xSecurityContext, uno::UNO_QUERY);
- if (xServiceInfo->getImplementationName() == "com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl")
+ uno::Reference<lang::XServiceInfo> xServiceInfo(xSecurityContext, uno::UNO_QUERY);
+ if (xServiceInfo->getImplementationName()
+ == "com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl")
{
// GPG keys only really have PGPKeyId and PGPKeyPacket
if (!mxStore.is())
@@ -291,9 +297,11 @@ bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>&
aKeyId = aBuffer.makeStringAndClear();
}
else
- SAL_WARN("xmlsecurity.helper", "XCertificate implementation without an xmlsecurity::Certificate one");
+ SAL_WARN("xmlsecurity.helper",
+ "XCertificate implementation without an xmlsecurity::Certificate one");
- maSignatureHelper.SetGpgCertificate(nSecurityId, aKeyId, aStrBuffer.makeStringAndClear(), xCert->getIssuerName());
+ maSignatureHelper.SetGpgCertificate(nSecurityId, aKeyId, aStrBuffer.makeStringAndClear(),
+ xCert->getIssuerName());
}
else
{
@@ -334,14 +342,16 @@ bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>&
aCertDigest = aBuffer.makeStringAndClear();
}
else
- SAL_WARN("xmlsecurity.helper", "XCertificate implementation without an xmlsecurity::Certificate one");
-
- maSignatureHelper.SetX509Certificate(nSecurityId, xCert->getIssuerName(), aCertSerial, aStrBuffer.makeStringAndClear(), aCertDigest);
+ SAL_WARN("xmlsecurity.helper",
+ "XCertificate implementation without an xmlsecurity::Certificate one");
+ maSignatureHelper.SetX509Certificate(nSecurityId, xCert->getIssuerName(), aCertSerial,
+ aStrBuffer.makeStringAndClear(), aCertDigest);
}
- uno::Sequence< uno::Reference< security::XCertificate > > aCertPath = xSecurityContext->getSecurityEnvironment()->buildCertificatePath(xCert);
- const uno::Reference< security::XCertificate >* pCertPath = aCertPath.getConstArray();
+ uno::Sequence<uno::Reference<security::XCertificate>> aCertPath
+ = xSecurityContext->getSecurityEnvironment()->buildCertificatePath(xCert);
+ const uno::Reference<security::XCertificate>* pCertPath = aCertPath.getConstArray();
sal_Int32 nCnt = aCertPath.getLength();
OUStringBuffer aStrBuffer;
@@ -351,8 +361,8 @@ bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>&
maSignatureHelper.AddEncapsulatedX509Certificate(aStrBuffer.makeStringAndClear());
}
-
- std::vector< OUString > aElements = DocumentSignatureHelper::CreateElementList(mxStore, meSignatureMode, DocumentSignatureAlgorithm::OOo3_2);
+ std::vector<OUString> aElements = DocumentSignatureHelper::CreateElementList(
+ mxStore, meSignatureMode, DocumentSignatureAlgorithm::OOo3_2);
DocumentSignatureHelper::AppendContentTypes(mxStore, aElements);
sal_Int32 nElements = aElements.size();
@@ -362,7 +372,8 @@ bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>&
maSignatureHelper.AddForSigning(nSecurityId, aElements[n], bBinaryMode, bAdESCompliant);
}
- maSignatureHelper.SetDateTime(nSecurityId, Date(Date::SYSTEM), tools::Time(tools::Time::SYSTEM));
+ maSignatureHelper.SetDateTime(nSecurityId, Date(Date::SYSTEM),
+ tools::Time(tools::Time::SYSTEM));
maSignatureHelper.SetDescription(nSecurityId, rDescription);
// We open a signature stream in which the existing and the new
@@ -370,18 +381,23 @@ bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>&
//then read the stream an will fill maCurrentSignatureInformations. The final signature
//is written when the user presses OK. Then only maCurrentSignatureInformation and
//a sax writer are used to write the information.
- SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, true);
+ SignatureStreamHelper aStreamHelper
+ = ImplOpenSignatureStream(embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, true);
if (aStreamHelper.nStorageFormat != embed::StorageFormats::OFOPXML)
{
- uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream, uno::UNO_QUERY_THROW);
- uno::Reference<xml::sax::XWriter> xSaxWriter = maSignatureHelper.CreateDocumentHandlerWithHeader(xOutputStream);
+ uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream,
+ uno::UNO_QUERY_THROW);
+ uno::Reference<xml::sax::XWriter> xSaxWriter
+ = maSignatureHelper.CreateDocumentHandlerWithHeader(xOutputStream);
// Export old signatures...
- uno::Reference<xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter, uno::UNO_QUERY_THROW);
+ uno::Reference<xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter,
+ uno::UNO_QUERY_THROW);
std::size_t nInfos = maCurrentSignatureInformations.size();
for (std::size_t n = 0; n < nInfos; n++)
- XMLSignatureHelper::ExportSignature(xDocumentHandler, maCurrentSignatureInformations[n], bAdESCompliant);
+ XMLSignatureHelper::ExportSignature(xDocumentHandler, maCurrentSignatureInformations[n],
+ bAdESCompliant);
// Create a new one...
maSignatureHelper.CreateAndWriteSignature(xDocumentHandler, bAdESCompliant);
@@ -397,23 +413,29 @@ bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>&
maSignatureHelper.EnsureSignaturesRelation(mxStore, /*bAdd=*/true);
// Old signatures + the new one.
int nSignatureCount = maCurrentSignatureInformations.size() + 1;
- maSignatureHelper.ExportSignatureRelations(aStreamHelper.xSignatureStorage, nSignatureCount);
+ maSignatureHelper.ExportSignatureRelations(aStreamHelper.xSignatureStorage,
+ nSignatureCount);
// Export old signatures.
for (std::size_t i = 0; i < maCurrentSignatureInformations.size(); ++i)
- maSignatureHelper.ExportOOXMLSignature(mxStore, aStreamHelper.xSignatureStorage, maCurrentSignatureInformations[i], i + 1);
+ maSignatureHelper.ExportOOXMLSignature(mxStore, aStreamHelper.xSignatureStorage,
+ maCurrentSignatureInformations[i], i + 1);
// Create a new signature.
- maSignatureHelper.CreateAndWriteOOXMLSignature(mxStore, aStreamHelper.xSignatureStorage, nSignatureCount);
+ maSignatureHelper.CreateAndWriteOOXMLSignature(mxStore, aStreamHelper.xSignatureStorage,
+ nSignatureCount);
// Flush objects.
- uno::Reference<embed::XTransactedObject> xTransact(aStreamHelper.xSignatureStorage, uno::UNO_QUERY);
+ uno::Reference<embed::XTransactedObject> xTransact(aStreamHelper.xSignatureStorage,
+ uno::UNO_QUERY);
xTransact->commit();
- uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream, uno::UNO_QUERY);
+ uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream,
+ uno::UNO_QUERY);
xOutputStream->closeOutput();
uno::Reference<io::XTempFile> xTempFile(aStreamHelper.xSignatureStream, uno::UNO_QUERY);
- SAL_INFO("xmlsecurity.helper", "DocumentSignatureManager::add temporary storage at " << xTempFile->getUri());
+ SAL_INFO("xmlsecurity.helper",
+ "DocumentSignatureManager::add temporary storage at " << xTempFile->getUri());
}
maSignatureHelper.EndMission();
@@ -434,24 +456,30 @@ void DocumentSignatureManager::remove(sal_uInt16 nPosition)
// Only erase when the removal was successful, it may fail for PDF.
// Also, erase the requested and all following signatures, as PDF signatures are always chained.
- maCurrentSignatureInformations.erase(maCurrentSignatureInformations.begin() + nPosition, maCurrentSignatureInformations.end());
+ maCurrentSignatureInformations.erase(maCurrentSignatureInformations.begin() + nPosition,
+ maCurrentSignatureInformations.end());
return;
}
maCurrentSignatureInformations.erase(maCurrentSignatureInformations.begin() + nPosition);
// Export all other signatures...
- SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, /*bTempStream=*/true);
+ SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(
+ embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, /*bTempStream=*/true);
if (aStreamHelper.nStorageFormat != embed::StorageFormats::OFOPXML)
{
- uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream, uno::UNO_QUERY_THROW);
- uno::Reference<xml::sax::XWriter> xSaxWriter = maSignatureHelper.CreateDocumentHandlerWithHeader(xOutputStream);
+ uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream,
+ uno::UNO_QUERY_THROW);
+ uno::Reference<xml::sax::XWriter> xSaxWriter
+ = maSignatureHelper.CreateDocumentHandlerWithHeader(xOutputStream);
- uno::Reference< xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter, uno::UNO_QUERY_THROW);
+ uno::Reference<xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter,
+ uno::UNO_QUERY_THROW);
std::size_t nInfos = maCurrentSignatureInformations.size();
- for (std::size_t n = 0 ; n < nInfos ; ++n)
- XMLSignatureHelper::ExportSignature(xDocumentHandler, maCurrentSignatureInformations[n], false /* ??? */);
+ for (std::size_t n = 0; n < nInfos; ++n)
+ XMLSignatureHelper::ExportSignature(xDocumentHandler, maCurrentSignatureInformations[n],
+ false /* ??? */);
XMLSignatureHelper::CloseDocumentHandler(xDocumentHandler);
}
@@ -461,20 +489,25 @@ void DocumentSignatureManager::remove(sal_uInt16 nPosition)
// Handle relations.
int nSignatureCount = maCurrentSignatureInformations.size();
- maSignatureHelper.ExportSignatureRelations(aStreamHelper.xSignatureStorage, nSignatureCount);
+ maSignatureHelper.ExportSignatureRelations(aStreamHelper.xSignatureStorage,
+ nSignatureCount);
// Export old signatures.
for (std::size_t i = 0; i < maCurrentSignatureInformations.size(); ++i)
- maSignatureHelper.ExportOOXMLSignature(mxStore, aStreamHelper.xSignatureStorage, maCurrentSignatureInformations[i], i + 1);
+ maSignatureHelper.ExportOOXMLSignature(mxStore, aStreamHelper.xSignatureStorage,
+ maCurrentSignatureInformations[i], i + 1);
// Flush objects.
- uno::Reference<embed::XTransactedObject> xTransact(aStreamHelper.xSignatureStorage, uno::UNO_QUERY);
+ uno::Reference<embed::XTransactedObject> xTransact(aStreamHelper.xSignatureStorage,
+ uno::UNO_QUERY);
xTransact->commit();
- uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream, uno::UNO_QUERY);
+ uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream,
+ uno::UNO_QUERY);
xOutputStream->closeOutput();
uno::Reference<io::XTempFile> xTempFile(aStreamHelper.xSignatureStream, uno::UNO_QUERY);
- SAL_INFO("xmlsecurity.helper", "DocumentSignatureManager::remove: temporary storage is at " << xTempFile->getUri());
+ SAL_INFO("xmlsecurity.helper", "DocumentSignatureManager::remove: temporary storage is at "
+ << xTempFile->getUri());
}
}
@@ -487,14 +520,19 @@ void DocumentSignatureManager::read(bool bUseTempStream, bool bCacheLastSignatur
// ZIP-based: ODF or OOXML.
maSignatureHelper.StartMission(mxSecurityContext);
- SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(embed::ElementModes::READ, bUseTempStream);
- if (aStreamHelper.nStorageFormat != embed::StorageFormats::OFOPXML && aStreamHelper.xSignatureStream.is())
+ SignatureStreamHelper aStreamHelper
+ = ImplOpenSignatureStream(embed::ElementModes::READ, bUseTempStream);
+ if (aStreamHelper.nStorageFormat != embed::StorageFormats::OFOPXML
+ && aStreamHelper.xSignatureStream.is())
{
- uno::Reference< io::XInputStream > xInputStream(aStreamHelper.xSignatureStream, uno::UNO_QUERY);
+ uno::Reference<io::XInputStream> xInputStream(aStreamHelper.xSignatureStream,
+ uno::UNO_QUERY);
maSignatureHelper.ReadAndVerifySignature(xInputStream);
}
- else if (aStreamHelper.nStorageFormat == embed::StorageFormats::OFOPXML && aStreamHelper.xSignatureStorage.is())
- maSignatureHelper.ReadAndVerifySignatureStorage(aStreamHelper.xSignatureStorage, bCacheLastSignature);
+ else if (aStreamHelper.nStorageFormat == embed::StorageFormats::OFOPXML
+ && aStreamHelper.xSignatureStorage.is())
+ maSignatureHelper.ReadAndVerifySignatureStorage(aStreamHelper.xSignatureStorage,
+ bCacheLastSignature);
maSignatureHelper.EndMission();
maCurrentSignatureInformations = maSignatureHelper.GetSignatureInformations();
@@ -517,29 +555,36 @@ void DocumentSignatureManager::write(bool bXAdESCompliantIfODF)
}
// Export all other signatures...
- SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(embed::ElementModes::WRITE|embed::ElementModes::TRUNCATE, false);
+ SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(
+ embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, false);
- if (aStreamHelper.xSignatureStream.is() && aStreamHelper.nStorageFormat != embed::StorageFormats::OFOPXML)
+ if (aStreamHelper.xSignatureStream.is()
+ && aStreamHelper.nStorageFormat != embed::StorageFormats::OFOPXML)
{
// ODF
- uno::Reference< io::XOutputStream > xOutputStream(aStreamHelper.xSignatureStream, uno::UNO_QUERY);
- uno::Reference<xml::sax::XWriter> xSaxWriter = maSignatureHelper.CreateDocumentHandlerWithHeader(xOutputStream);
+ uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream,
+ uno::UNO_QUERY);
+ uno::Reference<xml::sax::XWriter> xSaxWriter
+ = maSignatureHelper.CreateDocumentHandlerWithHeader(xOutputStream);
- uno::Reference< xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter, uno::UNO_QUERY_THROW);
+ uno::Reference<xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter,
+ uno::UNO_QUERY_THROW);
std::size_t nInfos = maCurrentSignatureInformations.size();
- for (std::size_t n = 0 ; n < nInfos ; ++n)
- XMLSignatureHelper::ExportSignature(xDocumentHandler, maCurrentSignatureInformations[n], bXAdESCompliantIfODF);
+ for (std::size_t n = 0; n < nInfos; ++n)
+ XMLSignatureHelper::ExportSignature(xDocumentHandler, maCurrentSignatureInformations[n],
+ bXAdESCompliantIfODF);
XMLSignatureHelper::CloseDocumentHandler(xDocumentHandler);
-
}
- else if (aStreamHelper.xSignatureStorage.is() && aStreamHelper.nStorageFormat == embed::StorageFormats::OFOPXML)
+ else if (aStreamHelper.xSignatureStorage.is()
+ && aStreamHelper.nStorageFormat == embed::StorageFormats::OFOPXML)
{
// OOXML
std::size_t nSignatureCount = maCurrentSignatureInformations.size();
maSignatureHelper.ExportSignatureContentTypes(mxStore, nSignatureCount);
if (nSignatureCount > 0)
- maSignatureHelper.ExportSignatureRelations(aStreamHelper.xSignatureStorage, nSignatureCount);
+ maSignatureHelper.ExportSignatureRelations(aStreamHelper.xSignatureStorage,
+ nSignatureCount);
else
{
// Removing all signatures: then need to remove the signature relation as well.
@@ -550,36 +595,42 @@ void DocumentSignatureManager::write(bool bXAdESCompliantIfODF)
}
for (std::size_t i = 0; i < nSignatureCount; ++i)
- maSignatureHelper.ExportOOXMLSignature(mxStore, aStreamHelper.xSignatureStorage, maCurrentSignatureInformations[i], i + 1);
+ maSignatureHelper.ExportOOXMLSignature(mxStore, aStreamHelper.xSignatureStorage,
+ maCurrentSignatureInformations[i], i + 1);
}
// If stream was not provided, we are responsible for committing it....
if (!mxSignatureStream.is() && aStreamHelper.xSignatureStorage.is())
{
- uno::Reference<embed::XTransactedObject> xTrans(aStreamHelper.xSignatureStorage, uno::UNO_QUERY);
+ uno::Reference<embed::XTransactedObject> xTrans(aStreamHelper.xSignatureStorage,
+ uno::UNO_QUERY);
xTrans->commit();
}
}
uno::Reference<xml::crypto::XSecurityEnvironment> DocumentSignatureManager::getSecurityEnvironment()
{
- return mxSecurityContext.is() ? mxSecurityContext->getSecurityEnvironment() : uno::Reference<xml::crypto::XSecurityEnvironment>();
+ return mxSecurityContext.is() ? mxSecurityContext->getSecurityEnvironment()
+ : uno::Reference<xml::crypto::XSecurityEnvironment>();
}
-uno::Reference<xml::crypto::XSecurityEnvironment> DocumentSignatureManager::getGpgSecurityEnvironment()
+uno::Reference<xml::crypto::XSecurityEnvironment>
+DocumentSignatureManager::getGpgSecurityEnvironment()
{
- return mxGpgSecurityContext.is() ? mxGpgSecurityContext->getSecurityEnvironment() : uno::Reference<xml::crypto::XSecurityEnvironment>();
+ return mxGpgSecurityContext.is() ? mxGpgSecurityContext->getSecurityEnvironment()
+ : uno::Reference<xml::crypto::XSecurityEnvironment>();
}
-uno::Reference<xml::crypto::XXMLSecurityContext> const & DocumentSignatureManager::getSecurityContext()
+uno::Reference<xml::crypto::XXMLSecurityContext> const&
+DocumentSignatureManager::getSecurityContext()
{
return mxSecurityContext;
}
-uno::Reference<xml::crypto::XXMLSecurityContext> const & DocumentSignatureManager::getGpgSecurityContext()
+uno::Reference<xml::crypto::XXMLSecurityContext> const&
+DocumentSignatureManager::getGpgSecurityContext()
{
return mxGpgSecurityContext;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index c75266d8626e..3402107dee64 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -26,7 +26,8 @@ using namespace ::com::sun::star;
PDFSignatureHelper::PDFSignatureHelper() = default;
-bool PDFSignatureHelper::ReadAndVerifySignature(const uno::Reference<io::XInputStream>& xInputStream)
+bool PDFSignatureHelper::ReadAndVerifySignature(
+ const uno::Reference<io::XInputStream>& xInputStream)
{
if (!xInputStream.is())
{
@@ -62,12 +63,14 @@ bool PDFSignatureHelper::ReadAndVerifySignature(const uno::Reference<io::XInputS
return true;
}
-SignatureInformations const & PDFSignatureHelper::GetSignatureInformations() const
+SignatureInformations const& PDFSignatureHelper::GetSignatureInformations() const
{
return m_aSignatureInfos;
}
-uno::Sequence<security::DocumentSignatureInformation> PDFSignatureHelper::GetDocumentSignatureInformations(const uno::Reference<xml::crypto::XSecurityEnvironment>& xSecEnv) const
+uno::Sequence<security::DocumentSignatureInformation>
+PDFSignatureHelper::GetDocumentSignatureInformations(
+ const uno::Reference<xml::crypto::XSecurityEnvironment>& xSecEnv) const
{
uno::Sequence<security::DocumentSignatureInformation> aRet(m_aSignatureInfos.size());
@@ -75,7 +78,8 @@ uno::Sequence<security::DocumentSignatureInformation> PDFSignatureHelper::GetDoc
{
const SignatureInformation& rInternal = m_aSignatureInfos[i];
security::DocumentSignatureInformation& rExternal = aRet[i];
- rExternal.SignatureIsValid = rInternal.nStatus == xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED;
+ rExternal.SignatureIsValid
+ = rInternal.nStatus == xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED;
if (!rInternal.ouX509Certificate.isEmpty())
rExternal.Signer = xSecEnv->createCertificateFromAscii(rInternal.ouX509Certificate);
rExternal.PartialDocumentSignature = rInternal.bPartialDocumentSignature;
@@ -100,12 +104,10 @@ uno::Sequence<security::DocumentSignatureInformation> PDFSignatureHelper::GetDoc
return aRet;
}
-sal_Int32 PDFSignatureHelper::GetNewSecurityId() const
-{
- return m_aSignatureInfos.size();
-}
+sal_Int32 PDFSignatureHelper::GetNewSecurityId() const { return m_aSignatureInfos.size(); }
-void PDFSignatureHelper::SetX509Certificate(const uno::Reference<security::XCertificate>& xCertificate)
+void PDFSignatureHelper::SetX509Certificate(
+ const uno::Reference<security::XCertificate>& xCertificate)
{
m_xCertificate = xCertificate;
}
@@ -142,7 +144,8 @@ bool PDFSignatureHelper::Sign(const uno::Reference<io::XInputStream>& xInputStre
return true;
}
-bool PDFSignatureHelper::RemoveSignature(const uno::Reference<io::XInputStream>& xInputStream, sal_uInt16 nPosition)
+bool PDFSignatureHelper::RemoveSignature(const uno::Reference<io::XInputStream>& xInputStream,
+ sal_uInt16 nPosition)
{
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
vcl::filter::PDFDocument aDocument;