12 #include <com/sun/star/graphic/GraphicProvider.hpp>
13 #include <com/sun/star/security/DocumentDigitalSignatures.hpp>
19 #include <config_folders.h>
20 #include <rtl/bootstrap.hxx>
26 #include <svx/strings.hrc>
41 OUString aType = rType;
44 aType =
"signature-line.svg";
46 OUString aPath(
"$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER
"/filter/" + aType);
47 rtl::Bootstrap::expandMacros(aPath);
51 SAL_WARN(
"cui.dialogs",
"failed to open " << aType);
55 return OUString::fromUtf8(svg);
63 return uno::Reference<security::XCertificate>();
68 return uno::Reference<security::XCertificate>();
71 uno::Reference<security::XDocumentDigitalSignatures> xSigner;
74 xSigner = security::DocumentDigitalSignatures::createDefault(
79 OUString
const aODFVersion(
81 xSigner = security::DocumentDigitalSignatures::createWithVersion(
84 xSigner->setParentWindow(pParent->
GetXWindow());
85 OUString aDescription;
86 security::CertificateKind certificateKind = security::CertificateKind_NONE;
90 certificateKind = security::CertificateKind_X509;
92 uno::Reference<security::XCertificate> xSignCertificate
93 = xSigner->selectSigningCertificateWithType(certificateKind, aDescription);
94 return xSignCertificate;
97 OUString
getSignerName(
const css::uno::Reference<css::security::XCertificate>& xCertificate)
100 xCertificate->getCertificateKind());
108 return rLocaleData.
getDate(aDateTime);
111 uno::Reference<graphic::XGraphic>
importSVG(std::u16string_view rSVG)
117 uno::Reference<graphic::XGraphicProvider> xProvider
118 = graphic::GraphicProvider::create(xContext);
120 uno::Sequence<beans::PropertyValue> aMediaProperties(1);
121 aMediaProperties[0].Name =
"InputStream";
122 aMediaProperties[0].Value <<= xInputStream;
123 uno::Reference<graphic::XGraphic>
xGraphic(xProvider->queryGraphic(aMediaProperties));
128 const css::uno::Reference<css::security::XCertificate>& xCertificate)
144 uno::Reference<beans::XPropertySet> xShapeProps(pSignatureLine->
getUnoShape(), uno::UNO_QUERY);
146 aMap[
"SignatureCertificate"] <<= xCertificate;
147 xShapeProps->setPropertyValue(
"InteropGrabBag",
152 aSvgImage = aSvgImage.replaceAll(
"[SIGNED_BY]",
SvxResId(RID_SVXSTR_SIGNATURELINE_DSIGNED_BY));
154 aSvgImage = aSvgImage.replaceAll(
"[SIGNER_NAME]", aSignerName);
156 aDate =
SvxResId(RID_SVXSTR_SIGNATURELINE_DATE).replaceFirst(
"%1", aDate);
157 aSvgImage = aSvgImage.replaceAll(
"[DATE]", aDate);
160 xShapeProps->setPropertyValue(
"Graphic",
uno::Any(xGraphic));
virtual css::uno::Reference< css::awt::XWindow > GetXWindow()=0
size_t GetMarkCount() const
OUString getSignatureImage(const OUString &rType)
Returns an SVG template.
OUString getSignerName(const css::uno::Reference< css::security::XCertificate > &xCertificate)
Get a signer name out of a certificate.
SdrMark * GetMark(size_t nNum) const
SvStream & WriteOString(const OString &rStr)
OUString getLocalizedDate()
Gets a localized date string.
css::uno::Reference< css::embed::XStorage > const & GetStorage()
HashMap_OWString_Interface aMap
const LocaleDataWrapper & GetLocaleData() const
virtual css::uno::Reference< css::uno::XInterface > getUnoShape()
OUString SvxResId(const char *pId)
uno::Reference< security::XCertificate > getSignatureCertificate(SfxObjectShell *pShell, weld::Window *pParent)
Choose a signature for signature line purposes.
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
sal_uInt64 remainingSize()
SdrObject * GetMarkedSdrObj() const
Everything a View needs to know about a selected object.
OUString GetContentPart(const OUString &_rRawString, const css::security::CertificateKind &rKind)
const SdrMarkList & GetMarkedObjectList() const
uno::Reference< graphic::XGraphic > importSVG(std::u16string_view rSVG)
Interprets rSVG as a graphic and gives back the resulting UNO wrapper.
const std::shared_ptr< const SfxFilter > & GetFilter() const
OUString getDate(const Date &rDate) const
Any makeAny(Color const &value)
void setShapeCertificate(const SdrView *pView, const css::uno::Reference< css::security::XCertificate > &xCertificate)
Sets xCertificate as the signing certificate of the selected shape on pView.
Reference< XComponentContext > getProcessComponentContext()
static OUString GetODFVersionFromStorage(const css::uno::Reference< css::embed::XStorage > &xStorage)
#define SAL_WARN(area, stream)
OString read_uInt8s_ToOString(SvStream &rStrm, std::size_t nLen)
Reference< XGraphic > xGraphic
exports com.sun.star. svg
SfxMedium * GetMedium() const