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 a10d5191b62822b96b247e0c95d8be735cc4feed Author: Miklos Vajna <[email protected]> AuthorDate: Wed Jan 8 09:42:53 2025 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jan 10 10:25:29 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/+/180049 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 6a6cffd57e95..5a5cc6716db6 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5378,13 +5378,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 76fde4080010..e2cc2c705b46 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -232,6 +232,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 f5ec2423d821..c62f7c05d80c 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -69,6 +69,7 @@ #include <sfx2/viewsh.hxx> #include <comphelper/lok.hxx> #include <osl/diagnose.h> +#include <sfx2/objsh.hxx> // EditView @@ -1825,7 +1826,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)); }
