desktop/source/lib/init.cxx | 14 ++++++++++++-- sd/sdi/_drvwsh.sdi | 1 + svx/source/svdraw/svdedtv1.cxx | 11 ++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-)
New commits: commit 05bd193820adc6568b0d4bb6fc139e3edfe2f487 Author: Miklos Vajna <[email protected]> AuthorDate: Wed Jan 8 09:42:53 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Jan 9 12:32:14 2025 +0100 cool#10630 lok doc sign: allow setting the pos of the Impress sign line Open a PDF in LOK mode, insert a signature line, try to drag the selected signature widget/shape, nothing happens. Given that the inserted shape has a default position at page center, you typically want to adjust that default position, but that requires adding a few exceptions, since PDFs are normally read-only. Desktop Impress gets around this since commit 5d296183072dc7cfe7a9985c38388b56f37d873c (sd signature line: allow move / resize of shape before signing, 2020-06-26), but LOK clients want to rather dispatch an UNO command (instead of handling this in the mouse event handler), so this requires additional work. A first problem is in isCommandAllowed() in desktop/ that explicitly rejects the UNO command for read-only documents: allow this when a signature widget is selected. A second problem is in SdrEditView::SetGeoAttrToMarked(), check for the signature widget there as well. Given that the implementation of .uno:TransformDialog already has a set of flags to prevent doing anything for read-only documents, it looks safe to allow the execution of the command itself. The size of the widget should be also possible to modify, that's not yet done here. Change-Id: I92a60717e98ac33f7a1eb9770cd0c7903f60759c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179938 Tested-by: Jenkins CollaboraOffice <[email protected]> Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a7c77c9534ed..cff80deceab0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5420,13 +5420,23 @@ static bool isCommandAllowed(OUString& command) { return true; else { - if (command == u".uno:Save"_ustr && SfxViewShell::Current() && SfxViewShell::Current()->IsAllowChangeComments()) + SfxViewShell* pViewShell = SfxViewShell::Current(); + if (command == u".uno:Save"_ustr && pViewShell && pViewShell->IsAllowChangeComments()) return true; for (size_t i = 0; i < std::size(nonAllowedList); i++) { if (nonAllowedList[i] == command) - return false; + { + bool bRet = false; + if (pViewShell && command == u".uno:TransformDialog"_ustr) + { + // If the just added signature line shape is selected, allow moving it. + SfxObjectShell* pDocShell = pViewShell->GetObjectShell(); + bRet = pDocShell->GetSignPDFCertificate().is(); + } + return bRet; + } } return true; } diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index 55ed82d07dbe..ff760bf82d57 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -227,6 +227,7 @@ interface DrawView [ ExecMethod = FuTemporary ; StateMethod = GetMenuState ; + ReadOnlyDoc = TRUE ; ] SID_ATTR_TRANSFORM_WIDTH // ole : no, status : ? diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index a942af276ee5..e2d2aa6547ce 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -70,6 +70,7 @@ #include <sfx2/viewsh.hxx> #include <comphelper/lok.hxx> #include <osl/diagnose.h> +#include <sfx2/objsh.hxx> // EditView @@ -1784,7 +1785,15 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin } // change position - if (bChgPos && m_bMoveAllowed) { + bool bMoveAllowed = m_bMoveAllowed; + SfxViewShell* pViewShell = GetSfxViewShell(); + SfxObjectShell* pObjectShell = pViewShell ? pViewShell->GetObjectShell() : nullptr; + if (!bMoveAllowed && pObjectShell && pObjectShell->GetSignPDFCertificate().is()) + { + // If the just added signature line shape is selected, allow moving it. + bMoveAllowed = true; + } + if (bChgPos && bMoveAllowed) { MoveMarkedObj(Size(nPosDX,nPosDY)); }
