diff options
Diffstat (limited to 'svx/source/dialog/signaturelinehelper.cxx')
-rw-r--r-- | svx/source/dialog/signaturelinehelper.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/svx/source/dialog/signaturelinehelper.cxx b/svx/source/dialog/signaturelinehelper.cxx index 5e15cc0ba5b0..0b07c5169430 100644 --- a/svx/source/dialog/signaturelinehelper.cxx +++ b/svx/source/dialog/signaturelinehelper.cxx @@ -14,6 +14,7 @@ #include <com/sun/star/security/XCertificate.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/sequenceashashmap.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/xmlsechelper.hxx> #include <config_folders.h> @@ -22,6 +23,8 @@ #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/objsh.hxx> +#include <svx/svdmark.hxx> +#include <svx/svdview.hxx> #include <tools/stream.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/streamwrap.hxx> @@ -109,6 +112,30 @@ uno::Reference<graphic::XGraphic> importSVG(const OUString& rSVG) uno::Reference<graphic::XGraphic> xGraphic(xProvider->queryGraphic(aMediaProperties)); return xGraphic; } + +void setShapeCertificate(SdrView* pView, + const css::uno::Reference<css::security::XCertificate>& xCertificate) +{ + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + if (rMarkList.GetMarkCount() < 1) + { + return; + } + + const SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pSignatureLine = pMark->GetMarkedSdrObj(); + if (!pSignatureLine) + { + return; + } + + // Remember the selected certificate. + uno::Reference<beans::XPropertySet> xShapeProps(pSignatureLine->getUnoShape(), uno::UNO_QUERY); + comphelper::SequenceAsHashMap aMap(xShapeProps->getPropertyValue("InteropGrabBag")); + aMap["SignatureCertificate"] <<= xCertificate; + xShapeProps->setPropertyValue("InteropGrabBag", + uno::makeAny(aMap.getAsConstPropertyValueList())); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |