[Libreoffice-commits] core.git: editeng/source include/vcl vcl/source
editeng/source/editeng/impedit.cxx | 13 +- editeng/source/editeng/impedit.hxx |1 include/vcl/transfer.hxx |4 ++ vcl/source/treelist/transfer2.cxx | 41 + vcl/source/window/window.cxx | 69 + 5 files changed, 67 insertions(+), 61 deletions(-) New commits: commit f8f43e55ec4ae7e436a5043fe6f4bae7b39cc6ad Author: Jan-Marek Glogowski AuthorDate: Tue Jul 9 20:29:05 2019 + Commit: Jan-Marek Glogowski CommitDate: Wed Jul 10 17:51:43 2019 +0200 tdf#126316 revert Clipboard to PrimarySelection Regression from commit ce9795954d39 ("fix crash in header/footer calc dialog"), which replaced some GetPrimarySelection() calls with GetClipboard() calls. This replaces the Window class calls for clipboard with global GetSystem* calls in vcl/transfer.hxx. Not sure if this is the best place, but the crowded Window class is definitly not. Change-Id: Ic5f9e575c1ac5d43df234426c5616eca616dea30 Reviewed-on: https://gerrit.libreoffice.org/75318 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 15937acb1cf2..15a25c4cdd68 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1279,7 +1279,14 @@ Reference ImpEditView::GetClipboard() { if (vcl::Window* pWindow = GetWindow()) return pWindow->GetClipboard(); -return css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext()); +return GetSystemClipboard(); +} + +Reference ImpEditView::GetSelection() +{ +if (vcl::Window* pWindow = GetWindow()) +return pWindow->GetPrimarySelection(); +return GetSystemPrimarySelection(); } bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * pFrameWin ) @@ -1343,12 +1350,12 @@ bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent ) if ( rMouseEvent.IsMiddle() && !bReadOnly && ( pWindow->GetSettings().GetMouseSettings().GetMiddleButtonAction() == MouseMiddleButtonAction::PasteSelection ) ) { -Reference aClipBoard(GetClipboard()); +Reference aClipBoard(GetSelection()); Paste( aClipBoard ); } else if ( rMouseEvent.IsLeft() && GetEditSelection().HasRange() ) { -Reference aClipBoard(GetClipboard()); +Reference aClipBoard(GetSelection()); CutCopy( aClipBoard, false ); } } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index b7f7d5db0323..0ef1130322c0 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -283,6 +283,7 @@ private: void InvalidateAtWindow(const tools::Rectangle& rRect); css::uno::Reference GetClipboard(); +css::uno::Reference GetSelection(); protected: diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx index 3e1c4ee5b325..888fe254e115 100644 --- a/include/vcl/transfer.hxx +++ b/include/vcl/transfer.hxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -503,6 +504,9 @@ public: const Link& rCallbck ); }; +css::uno::Reference VCL_DLLPUBLIC GetSystemClipboard(); +css::uno::Reference VCL_DLLPUBLIC GetSystemPrimarySelection(); + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/treelist/transfer2.cxx b/vcl/source/treelist/transfer2.cxx index a731ec2abf23..9160ba416e02 100644 --- a/vcl/source/treelist/transfer2.cxx +++ b/vcl/source/treelist/transfer2.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + #include #include #include @@ -26,9 +28,12 @@ #include #include #include +#include +#include #include #include #include +#include #include #include #include @@ -460,4 +465,40 @@ void TransferDataContainer::DragFinished( sal_Int8 nDropAction ) pImpl->aFinshedLnk.Call( nDropAction ); } +Reference GetSystemClipboard() +{ +Reference xClipboard; +try +{ +xClipboard = css::datatransfer::clipboard::SystemClipboard::create( +comphelper::getProcessComponentContext()); +} +catch (DeploymentException const &) {} +return xClipboard; +} + +Reference GetSystemPrimarySelection() +{ +Reference xSelection; +try +{ +Reference xContext(comphelper::getProcessComponentContext()); +#if HAVE_FEATURE_X11 +// A hack, making the primary selection available as an instance +// of the SystemClipboard service on X11: +Sequence< Any > args(1); +args[0] <<= OUString("PRIMARY"); + xSelection.set(xContext->getServiceManager()->createInstanceWithArgumentsAndContext( +"com.sun.star.datatransf
[Libreoffice-commits] core.git: editeng/source include/vcl vcl/source
editeng/source/editeng/impedit2.cxx |4 +++- include/vcl/event.hxx |3 ++- vcl/source/window/keyevent.cxx | 10 ++ 3 files changed, 15 insertions(+), 2 deletions(-) New commits: commit 8c46185bf28f61e674186694e4944c1f8b3a9c00 Author: Tamás Zolnai Date: Sun Apr 23 14:55:52 2017 +0200 Handle keyinput properly in case of BottomToTop vertical text Change-Id: I2b0f7cee9a4a7d7ad154c705f84a8b995b4f23a1 Reviewed-on: https://gerrit.libreoffice.org/36830 Tested-by: Jenkins Reviewed-by: Tamás Zolnai diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 510281f8..9e4072636e9a 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -756,8 +756,10 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE EditPaM aOldPaM( aPaM ); TextDirectionality eTextDirection = TextDirectionality::LeftToRight_TopToBottom; -if ( IsVertical() ) +if (IsVertical() && IsTopToBottom()) eTextDirection = TextDirectionality::TopToBottom_RightToLeft; +else if (IsVertical() && !IsTopToBottom()) +eTextDirection = TextDirectionality::BottomToTop_LeftToRight; else if ( IsRightToLeft( GetEditDoc().GetPos( aPaM.GetNode() ) ) ) eTextDirection = TextDirectionality::RightToLeft_TopToBottom; diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx index 7c58ac620c01..26ce846ed9f4 100644 --- a/include/vcl/event.hxx +++ b/include/vcl/event.hxx @@ -41,7 +41,8 @@ namespace com { namespace sun { namespace star { namespace awt { enum class TextDirectionality { LeftToRight_TopToBottom, RightToLeft_TopToBottom, -TopToBottom_RightToLeft +TopToBottom_RightToLeft, +BottomToTop_LeftToRight }; class VCL_DLLPUBLIC KeyEvent diff --git a/vcl/source/window/keyevent.cxx b/vcl/source/window/keyevent.cxx index d644bc3d19c9..f5a7c5b1abe8 100644 --- a/vcl/source/window/keyevent.cxx +++ b/vcl/source/window/keyevent.cxx @@ -55,6 +55,16 @@ KeyEvent KeyEvent::LogicalTextDirectionality (TextDirectionality eMode) const } break; +case TextDirectionality::BottomToTop_LeftToRight: +switch (nCode) +{ +case KEY_DOWN: aClone.maKeyCode = vcl::KeyCode(KEY_LEFT, nMod); break; +case KEY_UP:aClone.maKeyCode = vcl::KeyCode(KEY_RIGHT, nMod); break; +case KEY_LEFT: aClone.maKeyCode = vcl::KeyCode(KEY_UP, nMod); break; +case KEY_RIGHT: aClone.maKeyCode = vcl::KeyCode(KEY_DOWN, nMod); break; +} +break; + case TextDirectionality::LeftToRight_TopToBottom: /* do nothing */ break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/vcl vcl/source
editeng/source/editeng/impedit2.cxx |6 +++--- include/vcl/event.hxx |8 vcl/source/edit/textview.cxx|4 ++-- vcl/source/window/keyevent.cxx |6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) New commits: commit cc12a1b7277f8b6651655462c38b1ed418722fcb Author: Noel Grandin Date: Thu May 26 10:06:56 2016 +0200 Convert TextDirectionality to scoped enum Change-Id: I1046e791a73ec07be5a946c63a2256939a323e91 Reviewed-on: https://gerrit.libreoffice.org/25497 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 6ac1fef..843bba6 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -750,11 +750,11 @@ EditSelection ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, EditView* pE EditPaM aOldPaM( aPaM ); -TextDirectionality eTextDirection = TextDirectionality_LeftToRight_TopToBottom; +TextDirectionality eTextDirection = TextDirectionality::LeftToRight_TopToBottom; if ( IsVertical() ) -eTextDirection = TextDirectionality_TopToBottom_RightToLeft; +eTextDirection = TextDirectionality::TopToBottom_RightToLeft; else if ( IsRightToLeft( GetEditDoc().GetPos( aPaM.GetNode() ) ) ) -eTextDirection = TextDirectionality_RightToLeft_TopToBottom; +eTextDirection = TextDirectionality::RightToLeft_TopToBottom; KeyEvent aTranslatedKeyEvent = rKeyEvent.LogicalTextDirectionality( eTextDirection ); diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx index 81232fa..bfe2f39 100644 --- a/include/vcl/event.hxx +++ b/include/vcl/event.hxx @@ -38,10 +38,10 @@ namespace com { namespace sun { namespace star { namespace awt { struct MouseEvent; } } } } -enum TextDirectionality { -TextDirectionality_LeftToRight_TopToBottom, -TextDirectionality_RightToLeft_TopToBottom, -TextDirectionality_TopToBottom_RightToLeft +enum class TextDirectionality { +LeftToRight_TopToBottom, +RightToLeft_TopToBottom, +TopToBottom_RightToLeft }; class VCL_DLLPUBLIC KeyEvent diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index 732651e..288b981 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -1175,9 +1175,9 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent ) TextPaM aPaM( mpImpl->maSelection.GetEnd() ); TextPaM aOldEnd( aPaM ); -TextDirectionality eTextDirection = TextDirectionality_LeftToRight_TopToBottom; +TextDirectionality eTextDirection = TextDirectionality::LeftToRight_TopToBottom; if ( mpImpl->mpTextEngine->IsRightToLeft() ) -eTextDirection = TextDirectionality_RightToLeft_TopToBottom; +eTextDirection = TextDirectionality::RightToLeft_TopToBottom; KeyEvent aTranslatedKeyEvent = rKeyEvent.LogicalTextDirectionality( eTextDirection ); diff --git a/vcl/source/window/keyevent.cxx b/vcl/source/window/keyevent.cxx index 6b980c2..d644bc3 100644 --- a/vcl/source/window/keyevent.cxx +++ b/vcl/source/window/keyevent.cxx @@ -37,7 +37,7 @@ KeyEvent KeyEvent::LogicalTextDirectionality (TextDirectionality eMode) const switch (eMode) { -case TextDirectionality_RightToLeft_TopToBottom: +case TextDirectionality::RightToLeft_TopToBottom: switch (nCode) { case KEY_LEFT: aClone.maKeyCode = vcl::KeyCode(KEY_RIGHT, nMod); break; @@ -45,7 +45,7 @@ KeyEvent KeyEvent::LogicalTextDirectionality (TextDirectionality eMode) const } break; -case TextDirectionality_TopToBottom_RightToLeft: +case TextDirectionality::TopToBottom_RightToLeft: switch (nCode) { case KEY_DOWN: aClone.maKeyCode = vcl::KeyCode(KEY_RIGHT, nMod); break; @@ -55,7 +55,7 @@ KeyEvent KeyEvent::LogicalTextDirectionality (TextDirectionality eMode) const } break; -case TextDirectionality_LeftToRight_TopToBottom: +case TextDirectionality::LeftToRight_TopToBottom: /* do nothing */ break; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits