diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2025-01-15 09:32:30 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2025-01-15 18:22:25 +0100 |
commit | 9dd225ee8c45d6c944b9ce5578780d89612e9ffb (patch) | |
tree | be6264b8d12acd9afbb102fe03570d1d1d562c63 /sd | |
parent | 11bc8cc7d89f69a0fdcf97db92fd86299acc0734 (diff) |
cool#10630 doc electronic sign: fix no graphic selection for the signature line
Insert a signature line in "extern" mode, the shape gets selected but
there is no graphic selection at a LOK API level.
This is because GetSignPDFCertificate() returned an XCertificate, which
is empty in the external signing case, so we can't differentiate between
no signing and external signing.
Fix this by changing the return type to svl::crypto::CertificateOrName,
this way SdrMarkView::SetMarkHandlesForLOKit() can annotate the
signature line correctly even in the external signing case.
The tracking of the signature line selection is still in the model (not
in the view), that's not yet fixed here.
Change-Id: I4ef9c1fa0a88af0c0fcd55156b973a3705f985c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180296
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering2.cxx | 24 | ||||
-rw-r--r-- | sd/source/ui/func/fusel.cxx | 3 |
2 files changed, 26 insertions, 1 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering2.cxx b/sd/qa/unit/tiledrendering/tiledrendering2.cxx index e6b846769988..53b174a8684e 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering2.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering2.cxx @@ -48,9 +48,11 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testInsertSignatureLineExternal) createTempCopy(u"empty.pdf"); loadWithParams(maTempFile.GetURL(), aArgs); SdXImpressDocument* pImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get()); + pImpressDocument->initializeForTiledRendering({}); sd::ViewShell* pViewShell = pImpressDocument->GetDocShell()->GetViewShell(); sd::View* pView = pViewShell->GetView(); pView->SetAuthor("myauthor"); + ViewCallback aView; // When inserting a signature line for electronic (external) signing: aArgs = { @@ -67,6 +69,28 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testInsertSignatureLineExternal) aMarkedObjects[0]->GetGrabBagItem(aAny); comphelper::SequenceAsHashMap aMap(aAny); CPPUNIT_ASSERT(aMap.contains("SignatureCertificate")); + // Also verify that this is exposed at a LOK level: + OString aShapeSelection = "[" + aView.m_ShapeSelection + "]"; + const char* pShapeSelectionStr = aShapeSelection.getStr(); + std::stringstream aStream(pShapeSelectionStr); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + int nCount = 0; + bool bSignature = false; + for (const auto& i : aTree) + { + ++nCount; + if (nCount <= 5) + { + // x, y, w, h, part + continue; + } + boost::property_tree::ptree aProps = i.second; + // Without the accompanying fix in place, this test would have failed with: + // - No such node (isSignature) + bSignature = aProps.get<bool>("isSignature"); + } + CPPUNIT_ASSERT(bSignature); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index aa43a76ee91b..8624c784fca5 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -61,6 +61,7 @@ #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <comphelper/lok.hxx> +#include <svl/cryptosign.hxx> using namespace ::com::sun::star; @@ -204,7 +205,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) bTextEdit = true; bool bPreventModify = mpDocSh->IsReadOnly(); - if (bPreventModify && mpDocSh->GetSignPDFCertificate().is()) + if (bPreventModify && mpDocSh->GetSignPDFCertificate().Is()) { // If the just added signature line shape is selected, allow moving / resizing it. bPreventModify = false; |