diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-03-19 11:01:25 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-03-20 07:43:34 +0100 |
commit | 39fd78b79efd00e27ea068c03edf83b9dc6b9b57 (patch) | |
tree | 6fc592f8f655ad21ccb4d60fee6c7484d1dd7669 /xmloff | |
parent | ecb20d71ff6bd6e6230c06a2c50ee71d35c88949 (diff) |
tdf#83877 ODF: Load signature lines
Change-Id: I6a92246161be34bc6ecea8f1c04229a5dd593deb
Reviewed-on: https://gerrit.libreoffice.org/51535
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/Library_xo.mk | 1 | ||||
-rw-r--r-- | xmloff/source/draw/SignatureLineContext.cxx | 50 | ||||
-rw-r--r-- | xmloff/source/draw/SignatureLineContext.hxx | 28 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 9 |
5 files changed, 93 insertions, 0 deletions
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk index 0f2156ce2364..031e7da6ab5d 100644 --- a/xmloff/Library_xo.mk +++ b/xmloff/Library_xo.mk @@ -141,6 +141,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\ xmloff/source/draw/sdxmlimp \ xmloff/source/draw/shapeexport \ xmloff/source/draw/shapeimport \ + xmloff/source/draw/SignatureLineContext \ xmloff/source/draw/xexptran \ xmloff/source/draw/ximp3dobject \ xmloff/source/draw/ximp3dscene \ diff --git a/xmloff/source/draw/SignatureLineContext.cxx b/xmloff/source/draw/SignatureLineContext.cxx new file mode 100644 index 000000000000..5e8bdb32f578 --- /dev/null +++ b/xmloff/source/draw/SignatureLineContext.cxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "SignatureLineContext.hxx" + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> + +#include <xmloff/xmltoken.hxx> + +using namespace css; +using namespace css::xml::sax; +using namespace css::uno; +using namespace css::drawing; +using namespace xmloff::token; + +SignatureLineContext::SignatureLineContext(SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLocalName, + const Reference<XAttributeList>& xAttrList, + const Reference<XShape>& rxShape) + : SvXMLImportContext(rImport, nPrfx, rLocalName) +{ + Reference<beans::XPropertySet> xPropSet(rxShape, UNO_QUERY_THROW); + + xPropSet->setPropertyValue("IsSignatureLine", Any(true)); + + xPropSet->setPropertyValue("SignatureLineId", Any(xAttrList->getValueByName("loext:id"))); + xPropSet->setPropertyValue("SignatureLineSuggestedSignerName", + Any(xAttrList->getValueByName("loext:suggested-signer-name"))); + xPropSet->setPropertyValue("SignatureLineSuggestedSignerTitle", + Any(xAttrList->getValueByName("loext:suggested-signer-title"))); + xPropSet->setPropertyValue("SignatureLineSuggestedSignerEmail", + Any(xAttrList->getValueByName("loext:suggested-signer-email"))); + xPropSet->setPropertyValue("SignatureLineSigningInstructions", + Any(xAttrList->getValueByName("loext:signing-instructions"))); + + bool bShowSignDate = xAttrList->getValueByName("loext:show-sign-date") == GetXMLToken(XML_TRUE); + bool bCanAddComment + = xAttrList->getValueByName("loext:can-add-comment") == GetXMLToken(XML_TRUE); + xPropSet->setPropertyValue("SignatureLineShowSignDate", Any(bShowSignDate)); + xPropSet->setPropertyValue("SignatureLineCanAddComment", Any(bCanAddComment)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/xmloff/source/draw/SignatureLineContext.hxx b/xmloff/source/draw/SignatureLineContext.hxx new file mode 100644 index 000000000000..f64b81bda5f4 --- /dev/null +++ b/xmloff/source/draw/SignatureLineContext.hxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_XMLOFF_SOURCE_DRAW_SIGNATURELINECONTEXT_HXX +#define INCLUDED_XMLOFF_SOURCE_DRAW_SIGNATURELINECONTEXT_HXX + +#include <com/sun/star/drawing/XShape.hpp> +#include <xmloff/xmlictxt.hxx> + +// signatureline inside a shape + +class SignatureLineContext : public SvXMLImportContext +{ +public: + SignatureLineContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, + const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList, + const css::uno::Reference<css::drawing::XShape>& rxShape); +}; + +#endif // INCLUDED_XMLOFF_SOURCE_DRAW_SIGNATURELINECONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 740dae0c00a6..b48c92d3c577 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -69,6 +69,7 @@ #include "sdpropls.hxx" #include "eventimp.hxx" #include "descriptionimp.hxx" +#include "SignatureLineContext.hxx" #include "ximpcustomshape.hxx" #include <XMLEmbeddedObjectImportContext.hxx> #include <xmloff/xmlerror.hxx> @@ -179,6 +180,10 @@ SvXMLImportContextRef SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefi { xContext = new SdXMLDescriptionContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape ); } + else if( p_nPrefix == XML_NAMESPACE_LO_EXT && IsXMLToken( rLocalName, XML_SIGNATURELINE ) ) + { + xContext = new SignatureLineContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape ); + } else if( p_nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) ) { xContext = new SdXMLEventsContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape ); diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 786461819d89..50c8eae919ea 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -1666,6 +1666,15 @@ SvXMLImportContextRef XMLTextFrameContext::CreateChildContext( } xContext = m_xImplContext->CreateChildContext( p_nPrefix, rLocalName, xAttrList ); } + else if (p_nPrefix == XML_NAMESPACE_LO_EXT && (IsXMLToken(rLocalName, XML_SIGNATURELINE))) + { + if (getSupportsMultipleContents()) + { // tdf#103567 ensure props are set on surviving shape + // note: no more draw:image can be added once we get here + m_xImplContext = solveMultipleImages(); + } + xContext = m_xImplContext->CreateChildContext(p_nPrefix, rLocalName, xAttrList); + } else { // the child is a drawing shape |