diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-28 13:31:52 +0100 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2016-05-07 19:58:26 +0000 |
commit | abe370afab1d92debbf38d485906d372235a248f (patch) | |
tree | 0a33479c374544ddefb863ae720998144974d630 /desktop | |
parent | 6afeaee7055bdadf22e2935203cfc99b63172215 (diff) |
sw: add AnchorType parameter to .uno:Paste
Which allows not hardcoding as-char for LOK.
(cherry picked from commit 552361aaad740e55fcfa7993b4111aba354f863f)
Change-Id: I3b2987abbaf1f259c614b7b2a8709f15048d362d
Reviewed-on: https://gerrit.libreoffice.org/24727
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 11 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 10 |
2 files changed, 18 insertions, 3 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index fdd6e414246c..a7d07afbca0c 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -476,6 +476,17 @@ void DesktopLOKTest::testPasteWriterJPEG() // This was text::TextContentAnchorType_AT_PARAGRAPH. CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, xShape->getPropertyValue("AnchorType").get<text::TextContentAnchorType>()); + // Delete the pasted picture, and paste again with a custom anchor type. + uno::Reference<lang::XComponent>(xShape, uno::UNO_QUERY)->dispose(); + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + {"AnchorType", uno::makeAny(static_cast<sal_uInt16>(text::TextContentAnchorType_AT_CHARACTER))}, + })); + comphelper::dispatchCommand(".uno:Paste", aPropertyValues); + xShape.set(xDrawPage->getByIndex(0), uno::UNO_QUERY); + // This was text::TextContentAnchorType_AS_CHARACTER, AnchorType argument was ignored. + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, xShape->getPropertyValue("AnchorType").get<text::TextContentAnchorType>()); + comphelper::LibreOfficeKit::setActive(false); } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 1ee6e25bcc73..20a40ce60b8d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -39,6 +39,7 @@ #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> +#include <comphelper/propertysequence.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -56,6 +57,7 @@ #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> #include <editeng/fontitem.hxx> #include <editeng/flstitem.hxx> @@ -1364,9 +1366,11 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons return false; } - OUString aCommand(".uno:Paste"); - uno::Sequence<beans::PropertyValue> aPropertyValues; - if (!comphelper::dispatchCommand(aCommand, aPropertyValues)) + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + {"AnchorType", uno::makeAny(static_cast<sal_uInt16>(text::TextContentAnchorType_AS_CHARACTER))}, + })); + if (!comphelper::dispatchCommand(".uno:Paste", aPropertyValues)) { gImpl->maLastExceptionMsg = "Failed to dispatch the .uno: command"; return false; |