[Libreoffice-commits] core.git: Branch 'private/mmeeks/cp-6.2-bits' - 9023 commits - accessibility/inc accessibility/Library_acc.mk accessibility/source android/Bootstrap android/CustomTarget_lo_android.mk android/mobile-config.py android/README android/source animations/IwyuFilter_animations.yaml animations/source apple_remote/source autogen.sh avmedia/inc avmedia/Library_avmediagst_0_10.mk avmedia/Library_avmediagst.mk avmedia/Library_avmediaQuickTime.mk avmedia/Module_avmedia.mk avmedia/source basctl/inc basctl/Library_basctl.mk basctl/sdi basctl/source basctl/uiconfig basegfx/CppunitTest_basegfx.mk basegfx/inc basegfx/IwyuFilter_basegfx.yaml basegfx/Library_basegfx.mk basegfx/source basegfx/test basic/CppunitTest_basic_macros.mk basic/inc basic/qa basic/source bean/com bean/qa binaryurp/source bin/check-elf-dynamic-objects bin/distro-install-desktop-integration bin/distro-install-file-lists bin/find-german-comments bin/find-most-repeated-functions.py bin/find-unneeded-includes bin/gbuild-to-i de bin/get-bugzilla-attachments-by-mimetype bin/gla11y bin/lo-all-static-libs bin/lo-commit-stat bin/lo-xlate-lang bin/oss-fuzz-build.sh bin/run bin/symbolstore.py bin/ui-checkdomain.sh bin/ui-translatable.sh bin/unpack-sources bin/update_pch bin/update_pch.sh bin/verify-custom-widgets-libs bridges/inc bridges/Library_cpp_uno.mk bridges/source canvas/Executable_canvasdemo.mk canvas/Module_canvas.mk canvas/source canvas/workben chart2/CppunitTest_chart2_export.mk chart2/inc chart2/IwyuFilter_chart2.yaml chart2/Library_chartcontroller.mk chart2/Library_chartcore.mk chart2/qa chart2/source chart2/uiconfig cli_ure/readme.txt cli_ure/source codemaker/source comphelper/CppunitTest_comphelper_test.mk comphelper/inc comphelper/IwyuFilter_comphelper.yaml comphelper/Library_comphelper.mk comphelper/qa comphelper/source comphelper/StaticLibrary_windows_process.mk compilerplugins/clang compilerplugins/LICENSE.TXT compilerplugins/Makefile-clang.mk config.guess config_host/config_features.h.in co nfig_host/config_global.h.in config_host/config_gtk3_kde5.h.in config_host/config_kde4.h.in config_host/config_kde5.h.in config_host/config_qt5.h.in config_host/config_vclplug.h.in config_host.mk.in configmgr/CppunitTest_configmgr_unit.mk configmgr/inc configmgr/IwyuFilter_configmgr.yaml configmgr/Library_configmgr.mk configmgr/qa configmgr/README configmgr/source config.sub configure.ac connectivity/com connectivity/CppunitTest_connectivity_commontools.mk connectivity/CppunitTest_connectivity_sharedresources.mk connectivity/inc connectivity/Library_dbpool2.mk connectivity/Library_firebird_sdbc.mk connectivity/Library_mysqlc.mk connectivity/Library_postgresql-sdbc-impl.mk connectivity/Module_connectivity.mk connectivity/qa connectivity/README connectivity/registry connectivity/source connectivity/workben cppcanvas/inc cppcanvas/Library_cppcanvas.mk cppcanvas/qa cppcanvas/source cppuhelper/inc cppuhelper/IwyuFilter_cppuhelper.yaml cppuhelper/qa cppuhelper/source cppu/IwyuFilter_cppu. yaml cppu/qa cppu/source cpputools/source cui/inc cui/IwyuFilter_cui.yaml cui/Library_cui.mk cui/qa cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/CppunitTest_dbaccess_tdf126268.mk dbaccess/Executable_odbcconfig.mk dbaccess/inc dbaccess/JunitTest_dbaccess_complex.mk dbaccess/Module_dbaccess.mk dbaccess/qa dbaccess/source dbaccess/uiconfig dbaccess/win32 desktop/CppunitTest_desktop_app.mk desktop/CppunitTest_desktop_lib.mk desktop/CppunitTest_desktop_lokinit.mk desktop/Executable_minidump_upload.mk desktop/Executable_sbase.mk desktop/Executable_scalc.mk desktop/Executable_sdraw.mk desktop/Executable_simpress.mk desktop/Executable_smath.mk desktop/Executable_soffice_bin.mk desktop/Executable_soffice_com.mk desktop/Executable_soffice_exe.mk desktop/Executable_soffice.mk desktop/Executable_sweb.mk desktop/Executable_swriter.mk desktop/Executable_unopkg.mk desktop/inc desktop/Library_crashreport.mk desktop/Library_offacc.mk desktop/Library_sofficeapp.mk desktop/Module_desktop.mk de sktop/qa desktop/README desktop/scripts desktop/source desktop/StaticLibrary_winlauncher.mk desktop/test desktop/uiconfig desktop/UIConfig_deployment.mk desktop/unx desktop/win32 dictionaries distro-configs/Jenkins distro-configs/LibreOfficeAndroidAarch64.conf distro-configs/LibreOfficeAndroid.conf distro-configs/LibreOfficeAndroidX86.conf distro-configs/LibreOfficeCoverity.conf distro-configs/LibreOfficeFlatpak.conf distro-configs/LibreOfficeiOS.conf distro-configs/LibreOfficeiOS_Sim.conf distro-configs/LibreOfficeLinux.conf distro-configs/LibreOfficeOnline.conf distro-configs/LibreOfficeOpenBSD.conf distro-configs/LibreOfficeVanillaMacAppStore.conf download.lst drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/qa drawinglayer/source dtrans/Library_sysdtrans.mk dtrans/source dtrans/test editeng/CustomTarget_generated.mk editeng/inc editeng/Library_editeng.mk editeng/qa editeng/source embeddedobj/Module_embeddedobj.mk embeddedobj/source embeddedobj/test embedserv/Mo dule_embedserv.mk embedserv/source emfio/inc emfio/qa emfio/source eventattacher/IwyuFilter_eventattacher.yaml eventattacher/source extensions/CppunitTest_extensions_test_update.mk extensions/Executable_twain32shim.mk extensions/inc extensions/Library_ldapbe2.mk extensions/Library_oleautobridge.mk extensions/Library_scn.mk extensions/Library_so_activex_x64.mk extensions/Library_updchk.mk extensions/Module_extensions.mk extensions/qa extensions/README extensions/source extensions/test extensions/uiconfig extensions/UIConfig_spropctrlr.mk external/apr external/boost external/breakpad external/cairo external/clucene external/coinmp external/cppunit external/curl external/epm external/epoxy external/expat external/firebird external/freetype external/gpgmepp external/graphite external/harfbuzz external/hunspell external/hyphen external/icu external/languagetool external/lcms2 external/libabw external/libatomic_ops external/libcdr external/libcmis external/libebook external/libepubgen ext ernal/libetonyek external/libexttextcat external/libfreehand external/libgpg-error external/libjpeg-turbo external/liblangtag external/libmspub external/libmwaw external/libnumbertext external/libodfgen external/liborcus external/libpagemaker external/libpng external/libqxp external/librevenge external/libstaroffice external/libvisio external/libwpd external/libwpg external/libwps external/libxml2 external/libxslt external/libzmf external/lpsolve external/mariadb-connector-c external/mdds external/mdnsresponder external/Module_external.mk external/more_fonts external/mythes external/neon external/nss external/pdfium external/poppler external/postgresql external/python3 external/qrcodegen external/redland external/rhino external/twain_dsm external/ucpp external/xmlsec external/zlib extras/CustomTarget_autocorr.mk extras/CustomTarget_autotextshare.mk extras/CustomTarget_autotextuser.mk extras/CustomTarget_fontconfig.mk extras/CustomTarget_tplofficorr.mk extras/CustomTarget_tploffimisc .mk extras/CustomTarget_tplpersonal.mk extras/CustomTarget_tplpresnt.mk extras/CustomTarget_tpl_styles.mk extras/Module_extras.mk extras/Package_autocorr.mk extras/Package_fontconfig.mk extras/Package_palettes.mk extras/Package_tplwizbitmap.mk extras/source filter/Configuration_filter.mk filter/inc filter/Library_icg.mk filter/qa filter/README filter/source filter/uiconfig forms/inc forms/qa forms/source formula/inc formula/source formula/uiconfig fpicker/Library_fps.mk fpicker/README fpicker/source framework/dtd framework/inc framework/JunitTest_framework_complex.mk framework/Library_fwk.mk framework/qa framework/source framework/uiconfig .git-hooks/commit-msg .git-hooks/pre-commit .gitignore .gitmodules .gitreview hardened_runtime.xcent helpcompiler/inc helpcompiler/IwyuFilter_helpcompiler.yaml helpcompiler/source helpcontent2 hwpfilter/inc hwpfilter/source i18nlangtag/IwyuFilter_i18nlangtag.yaml i18nlangtag/qa i18nlangtag/source i18npool/inc i18npool/IwyuFilter_i18npool.yaml i18n pool/Library_localedata_en.mk i18npool/Library_localedata_euro.mk i18npool/Library_localedata_others.mk i18npool/qa i18npool/source i18npool/util i18nutil/IwyuFilter_i18nutil.yaml i18nutil/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_svg icon-themes/colibre icon-themes/colibre_svg icon-themes/elementary icon-themes/elementary_svg icon-themes/karasa_jaga icon-themes/karasa_jaga_svg icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_svg icon-themes/tango icon-themes/tango_svg idlc/inc idlc/source idlc/test idl/inc idl/source include/android include/animations include/avmedia include/basegfx include/basic include/canvas include/com include/comphelper include/connectivity include/cppcanvas include/cppuhelper include/cui include/dbaccess include/desktop include/drawinglayer include/editeng include/filter include/formula include/framework include/i18nlangtag include/i18nutil include/IwyuFilter_include.yaml include/jvmfwk include/LibreOfficeKit include/linguist ic include/o3tl include/onlineupdate include/oox include/opencl include/osl include/package include/postwin.h include/registry include/rtl include/sal include/salhelper include/sax include/sfx2 include/sot include/store include/svl include/svtools include/svx include/test include/toolkit include/tools include/typelib include/ucbhelper include/uno include/unoidl include/unotools include/vbahelper include/vcl include/xmloff include/xmlreader instsetoo_native/inc_common instsetoo_native/inc_openoffice io/IwyuFilter_io.yaml io/Library_io.mk io/qa ios/CustomTarget_iOS_link.mk ios/CustomTarget_iOS_setup.mk ios/LibreOfficeLight io/source ios/README ios/UnitTest io/test javaunohelper/com javaunohelper/IwyuFilter_javaunohelper.yaml javaunohelper/Library_juhx.mk javaunohelper/source jurt/com jurt/Library_jpipe.mk jurt/source jvmaccess/IwyuFilter_jvmaccess.yaml jvmaccess/source jvmfwk/distributions jvmfwk/inc jvmfwk/IwyuFilter_jvmfwk.yaml jvmfwk/plugins jvmfwk/README jvmfwk/source l10ntools/in c l10ntools/source librelogo/CustomTarget_librelogo.mk librelogo/source libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk libreofficekit/Executable_gtktiledviewer.mk libreofficekit/Executable_tilebench.mk libreofficekit/qa libreofficekit/source lingucomponent/Module_lingucomponent.mk lingucomponent/source linguistic/source logerrit lotuswordpro/inc lotuswordpro/source lo.xcent lo.xcent.in Makefile.fetch Makefile.in nlpsolver/README nlpsolver/src nlpsolver/ThirdParty o3tl/CppunitTest_o3tl_tests.mk o3tl/qa odk/build-examples_common.mk odk/config odk/CustomTarget_javadoc.mk odk/docs odk/examples odk/index.html odk/index_online.html odk/Package_share_readme.mk odk/README odk/source odk/util offapi/com offapi/README offapi/type_reference offapi/UnoApi_offapi.mk officecfg/registry onlineupdate/Executable_mar.mk onlineupdate/Executable_mbsdiff.mk onlineupdate/Executable_test_updater_dialog.mk onlineupdate/Executable_updater.mk onlineupdate/Executable_update_service.mk onlineupdat e/source onlineupdate/StaticLibrary_libmar.mk onlineupdate/StaticLibrary_libmarverify.mk onlineupdate/StaticLibrary_updatehelper.mk oovbaapi/ooo oox/AllLangMoTarget_oox.mk oox/inc oox/Library_oox.mk oox/Module_oox.mk oox/README oox/source opencl/Executable_opencltest.mk opencl/inc opencl/IwyuFilter_opencl.yaml opencl/Module_opencl.mk opencl/opencltest opencl/source osx/README package/inc package/Library_package2.mk package/Library_xstor.mk package/qa package/source postprocess/CustomTarget_fontconfig.mk postprocess/CustomTarget_images.mk postprocess/CustomTarget_registry.mk postprocess/CustomTarget_signing.mk postprocess/Module_postprocess.mk postprocess/Package_fontconfig.mk postprocess/packimages postprocess/Rdb_services.mk pyuno/inc pyuno/IwyuFilter_pyuno.yaml pyuno/Module_pyuno.mk pyuno/PythonTest_pyuno_pytests_ssl.mk pyuno/PythonTest_pyuno_pytests_testcollections.mk pyuno/PythonTest_pyuno_pytests_testssl.mk pyuno/qa pyuno/source qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOO o/runner qadevOOo/tests readlicense_oo/CustomTarget_license.mk readlicense_oo/license readlicense_oo/Module_readlicense_oo.mk readlicense_oo/Package_files.mk readlicense_oo/Package_license.mk readlicense_oo/README README.cross README.md registry/inc registry/IwyuFilter_registry.yaml registry/source registry/tools remotebridges/source reportbuilder/java reportdesign/inc reportdesign/source reportdesign/uiconfig RepositoryExternal.mk RepositoryFixes.mk Repository.mk RepositoryModule_host.mk ridljar/com sal/android sal/CppunitTest_sal_comtools.mk salhelper/IwyuFilter_salhelper.yaml salhelper/qa salhelper/source sal/inc sal/Library_sal.mk sal/Module_sal.mk sal/osl sal/qa sal/rtl sal/test sal/textenc sax/Library_expwrap.mk sax/qa sax/source sax/test scaddins/IwyuFilter_scaddins.yaml scaddins/source sccomp/IwyuFilter_sccomp.yaml sccomp/qa sccomp/source sc/CppunitTest_sc_autoformatsobj.mk sc/CppunitTest_sc_cellfieldsobj.mk sc/CppunitTest_sc_cellformatsobj.mk sc/CppunitTest_sc_cellsearchobj .mk sc/CppunitTest_sc_cellsobj.mk sc/CppunitTest_sc_chartobj.mk sc/CppunitTest_sc_chartsobj.mk sc/CppunitTest_sc_datapilotfieldgroupitemobj.mk sc/CppunitTest_sc_datapilotfieldgroupobj.mk sc/CppunitTest_sc_datapilotfieldgroupsobj.mk sc/CppunitTest_sc_datapilotfieldsobj.mk sc/CppunitTest_sc_datapilotitemsobj.mk sc/CppunitTest_sc_ddelinkobj.mk sc/CppunitTest_sc_ddelinksobj.mk sc/CppunitTest_sc_drawpageobj.mk sc/CppunitTest_sc_drawpagesobj.mk sc/CppunitTest_sc_filterdescriptorbase.mk sc/CppunitTest_sc_filterdescriptorbaseobj.mk sc/CppunitTest_sc_headerfieldsobj.mk sc/CppunitTest_sc_indexenumeration_cellannotationsenumeration.mk sc/CppunitTest_sc_indexenumeration_cellarealinksenumeration.mk sc/CppunitTest_sc_indexenumeration_databaserangesenumeration.mk sc/CppunitTest_sc_indexenumeration_datapilotfieldsenumeration.mk sc/CppunitTest_sc_indexenumeration_datapilotitemsenumeration.mk sc/CppunitTest_sc_indexenumeration_datapilottablesenumeration.mk sc/CppunitTest_sc_indexenumeration_functiond escriptionenumeration.mk sc/CppunitTest_sc_indexenumeration_labelrangesenumeration.mk sc/CppunitTest_sc_indexenumeration_namedrangesenumeration.mk sc/CppunitTest_sc_indexenumeration_sheetcellrangesenumeration.mk sc/CppunitTest_sc_indexenumeration_sheetlinksenumeration.mk sc/CppunitTest_sc_indexenumeration_spreadsheetsenumeration.mk sc/CppunitTest_sc_indexenumeration_spreadsheetviewpanesenumeration.mk sc/CppunitTest_sc_indexenumeration_subtotalfieldsenumeration.mk sc/CppunitTest_sc_indexenumeration_tableautoformatenumeration.mk sc/CppunitTest_sc_indexenumeration_tablechartsenumeration.mk sc/CppunitTest_sc_pdf_export.mk sc/CppunitTest_sc_sheetlinksobj.mk sc/CppunitTest_sc_stylefamiliesobj.mk sc/CppunitTest_sc_stylefamilyobj.mk sc/CppunitTest_sc_styleloaderobj.mk sc/CppunitTest_sc_subtotaldescriptorbase.mk sc/CppunitTest_sc_subtotaldescriptorbaseobj.mk sc/CppunitTest_sc_tablecolumnobj.mk sc/CppunitTest_sc_tablecolumnsobj.mk sc/CppunitTest_sc_tableconditionalformat.mk sc/CppunitTest_sc_ tableconditionalformatobj.mk sc/CppunitTest_sc_tablerowobj.mk sc/CppunitTest_sc_tablerowsobj.mk sc/CppunitTest_sc_ucalc.mk sc/CppunitTest_sc_uniquecellformatsobj.mk schema/libreoffice schema/odf1.3 sc/inc sc/IwyuFilter_sc.yaml sc/JunitTest_sc_unoapi_5.mk sc/Library_sc.mk sc/Module_sc.mk scp2/inc scp2/InstallScript_setup_osl.mk scp2/macros scp2/Module_scp2.mk scp2/source sc/qa sc/README scripting/examples scripting/Jar_ScriptProviderForBeanShell.mk scripting/java scripting/Library_protocolhandler.mk scripting/Package_ScriptsPython.mk scripting/source sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk sc/UITest_calc_dialogs.mk sc/UITest_calc_tests7.mk sc/UITest_calc_tests8.mk sc/UITest_calc_tests9.mk sc/UITest_chart.mk sc/UITest_pageFormat.mk sc/UITest_range_name.mk sc/UITest_search_replace.mk sc/UITest_sort.mk sc/UITest_statistics.mk sd/CppunitTest_sd_activex_controls_tests.mk sd/CppunitTest_sd_filters_test.mk sd/CppunitTest_sd_html_export_tests.mk sd/CppunitTest_sd_import_tests.mk sd /CppunitTest_sd_import_tests_smartart.mk sd/CppunitTest_sd_misc_tests.mk sd/CppunitTest_sd_uiimpress.mk sd/CppunitTest_sd_uimpress.mk sdext/inc sdext/Library_PresentationMinimizer.mk sdext/Module_sdext.mk sdext/source sd/inc sd/IwyuFilter_sd.yaml sd/Library_sd.mk sd/Library_sdui.mk sd/Module_sd.mk sd/qa sd/sdi sd/source sd/uiconfig sd/UIConfig_sdraw.mk sd/UIConfig_simpress.mk sd/UITest_sd_findReplace.mk sd/xml setup_native/Library_reg4allmsdoc.mk setup_native/Library_shlxtmsi.mk setup_native/source setup_native/StaticLibrary_quickstarter.mk sfx2/inc sfx2/Library_sfx.mk sfx2/qa sfx2/sdi sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk shell/AllLangMoTarget_shell.mk shell/CustomTarget_x64.mk shell/Executable_spsupp_helper.mk shell/inc shell/Library_cmdmail.mk shell/Library_desktopbe.mk shell/Library_kde4be.mk shell/Library_kde5be.mk shell/Library_kf5be.mk shell/Library_ooofilt.mk shell/Library_ooofilt_x64.mk shell/Library_propertyhdl.mk shell/Library_propertyhdl_x64.mk shell/Library_rec entfile.mk shell/Library_shlxthdl.mk shell/Library_shlxthdl_x64.mk shell/Library_spsupp.mk shell/Library_spsupp_x64.mk shell/Library_spsupp_x86.mk shell/Module_shell.mk shell/qa shell/README shell/source shell/StaticLibrary_shlxthandler_common.mk shell/StaticLibrary_shlxthandler_common_x64.mk shell/WinResTarget_spsupp_dlg.mk slideshow/CppunitTest_slideshow.mk slideshow/Executable_demoshow.mk slideshow/inc slideshow/manifest.txt slideshow/Module_slideshow.mk slideshow/source slideshow/test smoketest/Executable_libtest.mk smoketest/libtest.cxx solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/flatpak-manifest.in solenv/gbuild solenv/gbuildtojson solenv/gdb solenv/maven solenv/PythonTest_solenv_python.mk solenv/qa solenv/sanitizers solenv/vs soltools/cpp soltools/mkdepend sot/inc sot/IwyuFilter_sot.yaml sot/qa sot/source starmath/inc starmath/IwyuFilter_starmath.yaml starmath/Library_smd.mk starmath/Library_sm.mk starmath/qa starmath/sdi starmath/source starmath/uiconfig starmath/util stoc/IwyuFilter_stoc.yaml stoc/Library_bootstrap.mk stoc/Library_javaloader.mk stoc/Library_javavm.mk stoc/source store/IwyuFilter_store.yaml store/source svgio/CppunitTest_svgio_read.mk svgio/inc svgio/Library_svgio.mk svgio/Module_svgio.mk svgio/qa svgio/source svl/CppunitTest_svl_items.mk svl/CppunitTest_svl_lockfiles.mk svl/inc svl/JunitTest_svl_complex.mk svl/Library_svl.mk svl/Module_svl.mk svl/qa svl/source svtools/inc svtools/langsupport svtools/Library_svt.mk svtools/qa svtools/README svtools/source svtools/uiconfig svtools/UIConfig_svt.mk svx/CppunitTest_svx_unit.mk svx/Executable_gengal.mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/qa svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk sw/CppunitTest_sw_apitests.mk sw/CppunitTest_sw_filters_test2.mk sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_layoutwriter.mk sw/CppunitTest_sw_macros_test.mk sw/CppunitTest_sw_mailmerge.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw_o oxmlencryption.mk sw/CppunitTest_sw_ooxmlexport13.mk sw/CppunitTest_sw_ooxmlexport8.mk sw/CppunitTest_sw_ooxmlexport_template.mk sw/CppunitTest_sw_ooxmlfieldexport.mk sw/CppunitTest_sw_ooxmlimport2.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_ooxmllinks.mk sw/CppunitTest_sw_ooxmlw14export.mk sw/CppunitTest_sw_rtfexport4.mk sw/CppunitTest_sw_rtfexport5.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_unowriter.mk sw/CppunitTest_sw_ww8export2.mk sw/CppunitTest_sw_ww8export3.mk sw/CppunitTest_sw_ww8export.mk sw/CppunitTest_sw_ww8import.mk sw/CustomTarget_generated.mk swext/mediawiki sw/inc sw/IwyuFilter_sw.yaml sw/Library_sw.mk sw/Library_swui.mk sw/Module_sw.mk sw/ooxmlexport_setup.mk sw/PythonTest_sw_python.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UIConfig_sglobal.mk sw/UIConfig_swform.mk sw/UIConfig_swreport.mk sw/UIConfig_swriter.mk sw/UIConfig_swxform.mk sw/UITest_classification.mk sw/UITest_findReplace.mk sw/UITest_options.mk sw/UITest_sw _findReplace.mk sw/UITest_sw_findSimilarity.mk sw/UITest_writer_dialogs.mk sw/UITest_writer_macro_tests.mk sw/UITest_writer_tests6.mk sysui/CustomTarget_infoplist.mk sysui/CustomTarget_share.mk sysui/desktop sysui/Package_infoplist.mk test/CppunitTest_test_xpath.mk test/Library_subsequenttest.mk test/Library_test.mk test/Module_test.mk test/qa test/source testtools/qa testtools/source test/user-template toolkit/CppunitTest_toolkit.mk toolkit/JunitTest_toolkit_complex.mk toolkit/qa toolkit/source tools/CppunitTest_tools_test.mk tools/inc tools/IwyuFilter_tools.yaml tools/Library_tl.mk tools/qa tools/source translations ucbhelper/IwyuFilter_ucbhelper.yaml ucbhelper/source ucb/Library_ucpcmis1.mk ucb/Library_ucpexpand1.mk ucb/Library_ucpfile1.mk ucb/source udkapi/com uitest/calc_tests uitest/demo_ui uitest/test_main.py uitest/uitest uitest/UITest_demo_ui.mk uitest/writer_tests UnoControls/inc UnoControls/IwyuFilter_UnoControls.yaml UnoControls/source unodevtools/source unoidl/IwyuFilte r_unoidl.yaml unoidl/source unotest/source unotools/inc unotools/IwyuFilter_unotools.yaml unotools/Library_utl.mk unotools/qa unotools/source unoxml/inc unoxml/Library_unoxml.mk unoxml/qa unoxml/source uui/inc uui/source uui/uiconfig vbahelper/inc vbahelper/source vcl/android vcl/backendtest vcl/commonfuzzer.mk vcl/CppunitTest_vcl_backend_test.mk vcl/CppunitTest_vcl_bitmap_render_test.mk vcl/CppunitTest_vcl_bitmap_test.mk vcl/CppunitTest_vcl_complextext.mk vcl/CppunitTest_vcl_fontmetric.mk vcl/CppunitTest_vcl_gen.mk vcl/CppunitTest_vcl_graphic_test.mk vcl/CppunitTest_vcl_jpeg_read_write_test.mk vcl/CppunitTest_vcl_lifecycle.mk vcl/CppunitTest_vcl_outdev.mk vcl/CppunitTest_vcl_png_test.mk vcl/CppunitTest_vcl_svm_test.mk vcl/CppunitTest_vcl_widget_definition_reader_test.mk vcl/CustomTarget_kde4_moc.mk vcl/CustomTarget_kde5_moc.mk vcl/CustomTarget_kf5_moc.mk vcl/CustomTarget_qt5_moc.mk vcl/Executable_icontest.mk vcl/Executable_lo_kde5filepicker.mk vcl/Executable_mtfdemo.mk vcl/Executab le_ui-previewer.mk vcl/Executable_vcldemo.mk vcl/Executable_visualbackendtest.mk vcl/headless vcl/inc vcl/ios vcl/IwyuFilter_vcl.yaml vcl/Library_desktop_detector.mk vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/Library_vclplug_kde4.mk vcl/Library_vclplug_kde5.mk vcl/Library_vclplug_kf5.mk vcl/Library_vclplug_qt5.mk vcl/Library_vclplug_win.mk vcl/Module_vcl.mk vcl/opengl vcl/osx vcl/Package_opengl.mk vcl/Package_opengl_shader.mk vcl/Package_theme_definitions.mk vcl/Package_tipoftheday.mk vcl/qa vcl/qt5 vcl/quartz vcl/README vcl/README.lifecycle vcl/README.scheduler vcl/README.vars vcl/source vcl/StaticLibrary_fuzzerstubs.mk vcl/StaticLibrary_glxtest.mk vcl/uiconfig vcl/UIConfig_vcl.mk vcl/unx vcl/vcl.ios.component vcl/win vcl/workben winaccessibility/inc winaccessibility/Library_uacccom.mk winaccessibility/Module_winaccessibility.mk winaccessibility/README winaccessibility/source wizards/com wizards/CustomTarget_wizards.mk wizards/source writerfilter/inc writerfilter/Library_writerfilter.mk writerfilter/qa writerfilter/README writerfilter/source writerperfect/inc writerperfect/qa writerperfect/source xmerge/source xmlhelp/Library_ucpchelp1.mk xmlhelp/source xmloff/dtd xmloff/inc xmloff/qa xmloff/source xmloff/util xmlreader/IwyuFilter_xmlreader.yaml xmlreader/source xmlscript/dtd xmlscript/inc xmlscript/source xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk xmlsecurity/CppunitTest_xmlsecurity_signing.mk xmlsecurity/inc xmlsecurity/IwyuFilter_xmlsecurity.yaml xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/qa xmlsecurity/source xmlsecurity/test_docs xmlsecurity/uiconfig xmlsecurity/workben

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 3 18:26:48 UTC 2019


Rebased ref, commits from common ancestor:
commit bbac50887a557e0395c35aa3503d0d51b4458d3f
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Aug 2 15:11:21 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 15:28:34 2019 -0400

    clipboard: add profile zones.
    
    Change-Id: I2c005e78884fbe35c3045f76c203a7a369e97646

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f17251c70bf5..e1640836bf3c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3611,6 +3611,8 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMi
 
 static int doc_getSelectionType(LibreOfficeKitDocument* pThis)
 {
+    comphelper::ProfileZone aZone("doc_getSelectionType");
+
     SolarMutexGuard aGuard;
     SetLastExceptionMsg();
 
@@ -3649,6 +3651,8 @@ static int doc_getClipboard(LibreOfficeKitDocument* pThis,
                             size_t     **pOutSizes,
                             char      ***pOutStreams)
 {
+    comphelper::ProfileZone aZone("doc_getClipboard");
+
     SolarMutexGuard aGuard;
     SetLastExceptionMsg();
 
@@ -3731,7 +3735,7 @@ static int doc_setClipboard(LibreOfficeKitDocument* pThis,
                             const size_t  *pInSizes,
                             const char   **pInStreams)
 {
-    comphelper::ProfileZone aZone("doc_paste");
+    comphelper::ProfileZone aZone("doc_setClipboard");
 
     SolarMutexGuard aGuard;
     SetLastExceptionMsg();
@@ -3761,6 +3765,8 @@ static int doc_setClipboard(LibreOfficeKitDocument* pThis,
 
 static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, const char* pData, size_t nSize)
 {
+    comphelper::ProfileZone aZone("doc_paste");
+
     SolarMutexGuard aGuard;
 
     const char *pInMimeTypes[1];
commit 6d1bf3d1bde72b2cbc2d867dd6ff566b3c4e1ca6
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Aug 2 15:26:32 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 15:28:08 2019 -0400

    clipboard: elide string constructor.
    
    Change-Id: I1f476d981989296138ab9b9b58075919da4c09b8

diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index 8b7577f3bf63..46c63bc02951 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -79,10 +79,7 @@ Sequence<OUString> LOKClipboard::getSupportedServiceNames_static()
     return aRet;
 }
 
-OUString LOKClipboard::getImplementationName()
-{
-    return OUString("com.sun.star.datatransfer.LOKClipboard");
-}
+OUString LOKClipboard::getImplementationName() { return "com.sun.star.datatransfer.LOKClipboard"; }
 
 Sequence<OUString> LOKClipboard::getSupportedServiceNames()
 {
commit 6a3c5b418437ae928553530b938f4b7b3e5ea9e0
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Aug 2 13:58:48 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 14:00:30 2019 -0400

    clipboard: elide string constructor.
    
    Change-Id: I18c01e77e0ddf4b86f2f5ba610509555160f96c3

diff --git a/desktop/source/lib/lokclipboard.hxx b/desktop/source/lib/lokclipboard.hxx
index 6c0509265db4..7da5f3ef3900 100644
--- a/desktop/source/lib/lokclipboard.hxx
+++ b/desktop/source/lib/lokclipboard.hxx
@@ -54,7 +54,7 @@ public:
         const css::uno::Reference<css::datatransfer::XTransferable>& xTransferable,
         const css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner)
         override;
-    OUString SAL_CALL getName() override { return OUString("CLIPBOARD"); }
+    OUString SAL_CALL getName() override { return "CLIPBOARD"; }
 
     // XClipboardEx
     sal_Int8 SAL_CALL getRenderingCapabilities() override { return 0; }
commit e5e26b83e722bc49727c434ea5c775a97f737566
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Aug 2 13:13:51 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 14:00:30 2019 -0400

    XTransferable2 - add missing 'since' tag on isComplex.
    
    Change-Id: Ib8165edb4d87fb5bbb115fe26b8dbbe5a70bd59a

diff --git a/offapi/com/sun/star/datatransfer/XTransferable2.idl b/offapi/com/sun/star/datatransfer/XTransferable2.idl
index a6b53f0671e2..9fb99e600177 100644
--- a/offapi/com/sun/star/datatransfer/XTransferable2.idl
+++ b/offapi/com/sun/star/datatransfer/XTransferable2.idl
@@ -34,6 +34,8 @@ interface XTransferable2 : com::sun::star::datatransfer::XTransferable
 
     /**
      * Returns true if the selection contains embedded objects or is a large text blob.
+     *
+     * @since LibreOffice 6.4
      */
     boolean isComplex();
 };
commit 07e2d6ca179f13666a9d7adfbf1d907ddc5b878b
Author:     Andrea Gelmini <andrea.gelmini at gelma.net>
AuthorDate: Fri Aug 2 18:37:43 2019 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Fri Aug 2 19:01:33 2019 +0200

    Removed duplicated include
    
    Change-Id: Ic54fab581f34f385f5a6395bb39020299fbf2bde
    Reviewed-on: https://gerrit.libreoffice.org/76882
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7193b1ec4571..f17251c70bf5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -56,7 +56,6 @@
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/scopeguard.hxx>
 #include <comphelper/threadpool.hxx>
-#include <comphelper/base64.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
commit 343bc8260d428f2fc3b61c82af25eda4adfc04e4
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Jul 27 16:56:46 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:50 2019 -0400

    Use implicit OString constructor and cleanup casts.
    
    Change-Id: I686c32d3666bceb23dd86a4220428fa319ffdf45

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 8a7934b9f0e2..8ccb6b01335f 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2649,13 +2649,13 @@ void DesktopLOKTest::testComplexSelection()
     static const OString aText("hello world");
 
     // Certainly not complex.
-    CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_NONE, pDocument->pClass->getSelectionType(pDocument));
+    CPPUNIT_ASSERT_EQUAL(static_cast<int>(LOK_SELTYPE_NONE), pDocument->pClass->getSelectionType(pDocument));
 
     // Paste text.
     CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength()));
 
     // No selection.
-    CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_NONE, pDocument->pClass->getSelectionType(pDocument));
+    CPPUNIT_ASSERT_EQUAL(static_cast<int>(LOK_SELTYPE_NONE), pDocument->pClass->getSelectionType(pDocument));
 
     // Paste an image.
     OUString aFileURL;
@@ -2689,7 +2689,7 @@ void DesktopLOKTest::testComplexSelection()
     free(pText);
 
     // We expect this to be complex.
-    CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_COMPLEX, pDocument->pClass->getSelectionType(pDocument));
+    CPPUNIT_ASSERT_EQUAL(static_cast<int>(LOK_SELTYPE_COMPLEX), pDocument->pClass->getSelectionType(pDocument));
 }
 
 namespace {
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 03c0d86267d1..7193b1ec4571 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -986,6 +986,15 @@ LibLODocument_Impl::~LibLODocument_Impl()
     }
 }
 
+static OUString getGenerator()
+{
+    OUString sGenerator(
+        Translate::ExpandVariables("%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION (%1)"));
+    OUString os("$_OS");
+    ::rtl::Bootstrap::expandMacros(os);
+    return sGenerator.replaceFirst("%1", os);
+}
+
 extern "C" {
 
 CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, LibreOfficeKitCallback pCallback, void* pData)
@@ -3427,15 +3436,6 @@ static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int n
     pDoc->setTextSelection(nType, nX, nY);
 }
 
-static OUString getGenerator()
-{
-    OUString sGenerator(
-        Translate::ExpandVariables("%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION (%1)"));
-    OUString os("$_OS");
-    ::rtl::Bootstrap::expandMacros(os);
-    return sGenerator.replaceFirst("%1", os);
-}
-
 static bool getFromTransferrable(
     const css::uno::Reference<css::datatransfer::XTransferable> &xTransferable,
     const OString &aInMimeType, OString &aRet);
@@ -3633,7 +3633,7 @@ static int doc_getSelectionType(LibreOfficeKitDocument* pThis)
         return LOK_SELTYPE_COMPLEX;
 
     OString aRet;
-    bool bSuccess = getFromTransferrable(xTransferable, OString("text/plain;charset=utf-8"), aRet);
+    bool bSuccess = getFromTransferrable(xTransferable, "text/plain;charset=utf-8", aRet);
     if (!bSuccess)
         return LOK_SELTYPE_NONE;
 
commit 666427b7a51eb16829d96563b53bcef2de541da1
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Jul 25 19:02:47 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:50 2019 -0400

    clipboard: repair unit test so that it runs in the lok mode.
    
    SwTransferable::AddSupportedFormats needs the kit to be active.
    
    Change-Id: Id84210eb2e526785f35dfae609d861c310885314

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 6d6416a46e16..8a7934b9f0e2 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2641,6 +2641,9 @@ void DesktopLOKTest::testShowHideDialog()
 
 void DesktopLOKTest::testComplexSelection()
 {
+    // needed for SwTransferable to cope with the selection.
+    comphelper::LibreOfficeKit::setActive();
+
     // Start with a blank text file and add contents.
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     static const OString aText("hello world");
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9036abedba15..03c0d86267d1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -878,7 +878,6 @@ ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis)
  * we also need to ensure that this works for the first view which
  * has no clear 'createView' called for it (unfortunately).
  */
-
 rtl::Reference<LOKClipboard> forceSetClipboardForCurrentView(LibreOfficeKitDocument *pThis)
 {
     ITiledRenderable* pDoc = getTiledRenderable(pThis);
commit 6e33d3046186b10f4ef49f3de8ee87adb100bab9
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Jul 22 19:00:23 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:50 2019 -0400

    clipboard: log before erasing
    
    Change-Id: I6d59cdd31c62bbc7db81ccb8985745f68d19cd28

diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index 9ed05bc2c383..8b7577f3bf63 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -51,8 +51,8 @@ void LOKClipboardFactory::releaseClipboardForView(int nViewId)
         auto it = gClipboards.get()->find(nViewId);
         if (it != gClipboards.get()->end())
         {
+            SAL_INFO("lok", "Releasing clip: " << it->second.get() << " for destroyed " << nViewId);
             gClipboards.get()->erase(it);
-            SAL_INFO("lok", "Released clip: " << it->second.get() << " for destroyed " << nViewId);
         }
     }
 }
commit 8d82bb6d4a6e9a0a7150bd0a2117970c99a48f63
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Jul 23 09:49:11 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:50 2019 -0400

    clipboard: check for null.
    
    Change-Id: I07060035a9744642c98d4a0946695408dc0f6b42

diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index 2c155c121d91..9ed05bc2c383 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -37,7 +37,6 @@ rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView()
     return xClip;
 }
 
-/// FIXME: should really copy and stash its content for a bit.
 void LOKClipboardFactory::releaseClipboardForView(int nViewId)
 {
     osl::MutexGuard aGuard(gMutex);
@@ -47,7 +46,7 @@ void LOKClipboardFactory::releaseClipboardForView(int nViewId)
         gClipboards.get()->clear();
         SAL_INFO("lok", "Released all clipboards on doc destroy\n");
     }
-    else
+    else if (gClipboards.get())
     {
         auto it = gClipboards.get()->find(nViewId);
         if (it != gClipboards.get()->end())
commit c4bebdc659bd922831db28cbb59c62291d327b2f
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Jul 22 09:48:46 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:50 2019 -0400

    lok: share more of the clipboard mime-type handling code.
    
    Change-Id: I98fc9fa0fd1b5afa00c33b642d2d504eab0b62ba

diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index c85ac029406c..2c155c121d91 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -189,20 +189,7 @@ LOKTransferable::LOKTransferable(const size_t nInCount, const char** pInMimeType
     m_aFlavors = css::uno::Sequence<css::datatransfer::DataFlavor>(nInCount);
     for (size_t i = 0; i < nInCount; ++i)
     {
-        OUString aMimeType = OUString::fromUtf8(pInMimeTypes[i]);
-
-        // cf. sot/source/base/exchange.cxx for these two exceptional types.
-        if (aMimeType.startsWith("text/plain"))
-        {
-            aMimeType = "text/plain;charset=utf-16";
-            m_aFlavors[i].DataType = cppu::UnoType<OUString>::get();
-        }
-        else if (aMimeType == "application/x-libreoffice-tsvc")
-            m_aFlavors[i].DataType = cppu::UnoType<OUString>::get();
-        else
-            m_aFlavors[i].DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get();
-        m_aFlavors[i].MimeType = aMimeType;
-        m_aFlavors[i].HumanPresentableName = aMimeType;
+        initFlavourFromMime(m_aFlavors[i], OUString::fromUtf8(pInMimeTypes[i]));
 
         uno::Any aContent;
         if (m_aFlavors[i].DataType == cppu::UnoType<OUString>::get())
commit ed9bdfaf472d4a208d855897f3cc12497a5176a9
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Jul 20 11:22:09 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:50 2019 -0400

    clipboard: encourage paste to show up by having some dummy content.
    
    Having an empty system clipboard is a hyper-unusual state, but
    this is quite common for new lok instances. If we populate some dummy
    state we can hide that.
    
    Allows context-menu paste into new documents.
    
    Change-Id: Ia180dd370c180d2d666cc57330db6c1385578a36

diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index 18b728c2343a..c85ac029406c 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -69,6 +69,9 @@ LOKClipboard::LOKClipboard()
     : cppu::WeakComponentImplHelper<css::datatransfer::clipboard::XSystemClipboard,
                                     css::lang::XServiceInfo>(m_aMutex)
 {
+    // Encourage 'paste' menu items to always show up.
+    uno::Reference<datatransfer::XTransferable> xTransferable(new LOKTransferable());
+    setContents(xTransferable, uno::Reference<datatransfer::clipboard::XClipboardOwner>());
 }
 
 Sequence<OUString> LOKClipboard::getSupportedServiceNames_static()
@@ -150,6 +153,18 @@ LOKTransferable::LOKTransferable(const OUString& sMimeType,
         aContent <<= aSequence;
     m_aContent.push_back(aContent);
 }
+
+/// Use to ensure we have some dummy content on the clipboard to allow a 1st 'paste'
+LOKTransferable::LOKTransferable()
+{
+    m_aContent.reserve(1);
+    m_aFlavors = css::uno::Sequence<css::datatransfer::DataFlavor>(1);
+    initFlavourFromMime(m_aFlavors[0], "text/plain");
+    uno::Any aContent;
+    aContent <<= OUString();
+    m_aContent.push_back(aContent);
+}
+
 // cf. sot/source/base/exchange.cxx for these two exceptional types.
 void LOKTransferable::initFlavourFromMime(css::datatransfer::DataFlavor& rFlavor,
                                           OUString aMimeType)
diff --git a/desktop/source/lib/lokclipboard.hxx b/desktop/source/lib/lokclipboard.hxx
index 90e41176fee4..6c0509265db4 100644
--- a/desktop/source/lib/lokclipboard.hxx
+++ b/desktop/source/lib/lokclipboard.hxx
@@ -77,6 +77,7 @@ class LOKTransferable : public cppu::WeakImplHelper<css::datatransfer::XTransfer
     static void initFlavourFromMime(css::datatransfer::DataFlavor& rFlavor, OUString sMimeType);
 
 public:
+    LOKTransferable();
     LOKTransferable(const size_t nInCount, const char** pInMimeTypes, const size_t* pInSizes,
                     const char** pInStreams);
     LOKTransferable(const OUString& sMimeType, const css::uno::Sequence<sal_Int8>& aSequence);
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 656018abbf79..a0727a2f464a 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -392,7 +392,7 @@ sal_Bool SAL_CALL TransferableHelper::isComplex()
 {
     // By default everything is complex, until proven otherwise
     // in the respective document type transferable handler.
-    return sal_True;
+    return true;
 }
 
 Sequence< DataFlavor > SAL_CALL TransferableHelper::getTransferDataFlavors()
commit 21072445cebfe74dc01165dc6a120bf0fb951767
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Jun 28 18:36:15 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:50 2019 -0400

    Try harder to generate HTML from text.
    
    Change-Id: I5b4778cceefc652274a72b779cd6c060a50bf06c

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 96ba15ace3fd..9036abedba15 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3439,6 +3439,54 @@ static OUString getGenerator()
 
 static bool getFromTransferrable(
     const css::uno::Reference<css::datatransfer::XTransferable> &xTransferable,
+    const OString &aInMimeType, OString &aRet);
+
+static bool encodeImageAsHTML(
+    const css::uno::Reference<css::datatransfer::XTransferable> &xTransferable,
+    const OString &aMimeType, OString &aRet)
+{
+    if (!getFromTransferrable(xTransferable, aMimeType, aRet))
+        return false;
+
+    // Encode in base64.
+    auto aSeq = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),
+                                   aRet.getLength());
+    OUStringBuffer aBase64Data;
+    comphelper::Base64::encode(aBase64Data, aSeq);
+
+    // Embed in HTML.
+    aRet = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n"
+        "<html><head>"
+        "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/><meta "
+        "name=\"generator\" content=\""
+        + getGenerator().toUtf8()
+        + "\"/>"
+        "</head><body><img src=\"data:" + aMimeType + ";base64,"
+        + aBase64Data.makeStringAndClear().toUtf8() + "\"/></body></html>";
+
+    return true;
+}
+
+static bool encodeTextAsHTML(
+    const css::uno::Reference<css::datatransfer::XTransferable> &xTransferable,
+    const OString &aMimeType, OString &aRet)
+{
+    if (!getFromTransferrable(xTransferable, aMimeType, aRet))
+        return false;
+
+    // Embed in HTML - FIXME: needs some escaping.
+    aRet = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n"
+        "<html><head>"
+        "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/><meta "
+        "name=\"generator\" content=\""
+        + getGenerator().toUtf8()
+        + "\"/></head><body><pre>" + aRet + "</pre></body></html>";
+
+    return true;
+}
+
+static bool getFromTransferrable(
+    const css::uno::Reference<css::datatransfer::XTransferable> &xTransferable,
     const OString &aInMimeType, OString &aRet)
 {
     OString aMimeType(aInMimeType);
@@ -3464,28 +3512,15 @@ static bool getFromTransferrable(
 
     if (!xTransferable->isDataFlavorSupported(aFlavor))
     {
-        // If html is not supported, might be a graphic-selection, which supports png.
-        if (aInMimeType == "text/html" && getFromTransferrable(xTransferable, "image/png", aRet))
+        // Try harder for HTML it is our copy/paste meta-file format
+        if (aInMimeType == "text/html")
         {
-            // Encode in base64.
-            auto aSeq = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),
-                                           aRet.getLength());
-            OUStringBuffer aBase64Data;
-            comphelper::Base64::encode(aBase64Data, aSeq);
-
-            // Embed in HTML.
-            static const OString aHeader
-                = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
-                  "<html><head>"
-                  "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/><meta "
-                  "name=\"generator\" content=\""
-                  + getGenerator().toUtf8()
-                  + "\"/>"
-                    "</head><body><img src=\"data:image/png;charset=utf-8;base64,";
-
-            aRet = aHeader + aBase64Data.makeStringAndClear().toUtf8() + "\"/></body></html>";
-
-            return true;
+            // Desperate measures - convert text to HTML instead.
+            if (encodeTextAsHTML(xTransferable, "text/plain;charset=utf-8", aRet))
+                return true;
+            // If html is not supported, might be a graphic-selection,
+            if (encodeImageAsHTML(xTransferable, "image/png", aRet))
+                return true;
         }
 
         SetLastExceptionMsg("Flavor " + aFlavor.MimeType + " is not supported");
@@ -3603,7 +3638,7 @@ static int doc_getSelectionType(LibreOfficeKitDocument* pThis)
     if (!bSuccess)
         return LOK_SELTYPE_NONE;
 
-    if (aRet.getLength() > 1000) // About 2 paragraphs.
+    if (aRet.getLength() > 10000)
         return LOK_SELTYPE_COMPLEX;
 
     return aRet.getLength() ? LOK_SELTYPE_TEXT : LOK_SELTYPE_NONE;
commit 93400d9b37063721d4d925a9c37020633801248c
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Jul 20 11:15:05 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:49 2019 -0400

    lok: minimal implementation of isComplex for calc for now.
    
    Change-Id: Ic4141d30a0ff48a9ec5ecc8e6119d9d779c4a0fc

diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index 79a0437f6061..3a1c2128d560 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -413,4 +413,16 @@ void ScSelectionTransferObj::ObjectReleased()
     TransferableHelper::ObjectReleased();
 }
 
+sal_Bool SAL_CALL ScSelectionTransferObj::isComplex()
+{
+    switch (eMode)
+    {
+    case SC_SELTRANS_CELL:
+    case SC_SELTRANS_CELLS:
+        return false;
+    default:
+        return true;
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index c78e8ae9e859..dfa3d47cf8e9 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -234,6 +234,42 @@ void ScTransferObj::AddSupportedFormats()
     }
 }
 
+static ScRange lcl_reduceBlock(ScDocumentUniquePtr &pDoc, ScRange aReducedBlock, bool bIncludeVisual = false)
+{
+    if ((aReducedBlock.aEnd.Col() == MAXCOL || aReducedBlock.aEnd.Row() == MAXROW) &&
+        aReducedBlock.aStart.Tab() == aReducedBlock.aEnd.Tab())
+    {
+        // Shrink the block here so we don't waste time creating huge
+        // output when whole columns or rows are selected.
+
+        SCCOL nPrintAreaEndCol = 0;
+        SCROW nPrintAreaEndRow = 0;
+        if (bIncludeVisual)
+            pDoc->GetPrintArea( aReducedBlock.aStart.Tab(), nPrintAreaEndCol, nPrintAreaEndRow, true );
+
+        // Shrink the area to allow pasting to external applications.
+        // Shrink to real data area for HTML, RTF and RICHTEXT, but include
+        // all objects and top-left area for BITMAP and PNG.
+        SCCOL nStartCol = aReducedBlock.aStart.Col();
+        SCROW nStartRow = aReducedBlock.aStart.Row();
+        SCCOL nEndCol = aReducedBlock.aEnd.Col();
+        SCROW nEndRow = aReducedBlock.aEnd.Row();
+        bool bShrunk = false;
+        pDoc->ShrinkToUsedDataArea( bShrunk, aReducedBlock.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow,
+                                      false, bIncludeVisual /*bStickyTopRow*/, bIncludeVisual /*bStickyLeftCol*/,
+                                      bIncludeVisual /*bConsiderCellNotes*/, bIncludeVisual /*bConsiderCellDrawObjects*/);
+
+        if ( nPrintAreaEndRow > nEndRow )
+            nEndRow = nPrintAreaEndRow;
+
+        if ( nPrintAreaEndCol > nEndCol )
+            nEndCol = nPrintAreaEndCol;
+
+        aReducedBlock = ScRange(nStartCol, nStartRow, aReducedBlock.aStart.Tab(), nEndCol, nEndRow, aReducedBlock.aEnd.Tab());
+    }
+    return aReducedBlock;
+}
+
 bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUString& /*rDestDoc*/ )
 {
     SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor );
@@ -250,39 +286,11 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt
             || nFormat == SotClipboardFormatId::BITMAP
             || nFormat == SotClipboardFormatId::PNG;
 
-        if (bReduceBlockFormat && (m_aBlock.aEnd.Col() == MAXCOL || m_aBlock.aEnd.Row() == MAXROW) &&
-                m_aBlock.aStart.Tab() == m_aBlock.aEnd.Tab())
-        {
-            // Shrink the block here so we don't waste time creating huge
-            // output when whole columns or rows are selected.
-
-            SCCOL nPrintAreaEndCol = 0;
-            SCROW nPrintAreaEndRow = 0;
-            const bool bIncludeVisual = (nFormat == SotClipboardFormatId::BITMAP ||
-                    nFormat == SotClipboardFormatId::PNG);
-            if (bIncludeVisual)
-                m_pDoc->GetPrintArea( m_aBlock.aStart.Tab(), nPrintAreaEndCol, nPrintAreaEndRow, true );
-
-            // Shrink the area to allow pasting to external applications.
-            // Shrink to real data area for HTML, RTF and RICHTEXT, but include
-            // all objects and top-left area for BITMAP and PNG.
-            SCCOL nStartCol = aReducedBlock.aStart.Col();
-            SCROW nStartRow = aReducedBlock.aStart.Row();
-            SCCOL nEndCol = aReducedBlock.aEnd.Col();
-            SCROW nEndRow = aReducedBlock.aEnd.Row();
-            bool bShrunk = false;
-            m_pDoc->ShrinkToUsedDataArea( bShrunk, aReducedBlock.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow,
-                    false, bIncludeVisual /*bStickyTopRow*/, bIncludeVisual /*bStickyLeftCol*/,
-                    bIncludeVisual /*bConsiderCellNotes*/, bIncludeVisual /*bConsiderCellDrawObjects*/);
-
-            if ( nPrintAreaEndRow > nEndRow )
-                nEndRow = nPrintAreaEndRow;
-
-            if ( nPrintAreaEndCol > nEndCol )
-                nEndCol = nPrintAreaEndCol;
-
-            aReducedBlock = ScRange(nStartCol, nStartRow, aReducedBlock.aStart.Tab(), nEndCol, nEndRow, aReducedBlock.aEnd.Tab());
-        }
+        const bool bIncludeVisual = (nFormat == SotClipboardFormatId::BITMAP ||
+                                     nFormat == SotClipboardFormatId::PNG);
+
+        if (bReduceBlockFormat)
+            aReducedBlock = lcl_reduceBlock(m_pDoc, m_aBlock, bIncludeVisual);
 
         if ( nFormat == SotClipboardFormatId::LINKSRCDESCRIPTOR || nFormat == SotClipboardFormatId::OBJECTDESCRIPTOR )
         {
@@ -535,6 +543,15 @@ bool ScTransferObj::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* p
     return bRet;
 }
 
+sal_Bool SAL_CALL ScTransferObj::isComplex()
+{
+    ScRange aReduced = lcl_reduceBlock(m_pDoc, m_aBlock);
+    size_t nCells = (aReduced.aEnd.Col() - aReduced.aStart.Col() + 1) *
+                    (aReduced.aEnd.Row() - aReduced.aStart.Row() + 1) *
+                    (aReduced.aEnd.Tab() - aReduced.aStart.Tab() + 1);
+    return nCells > 1000;
+}
+
 void ScTransferObj::DragFinished( sal_Int8 nDropAction )
 {
     if ( nDropAction == DND_ACTION_MOVE && !m_bDragWasInternal && !(m_nDragSourceFlags & ScDragSrc::Navigator) )
diff --git a/sc/source/ui/inc/seltrans.hxx b/sc/source/ui/inc/seltrans.hxx
index af73f0adf896..83adb2c11eb2 100644
--- a/sc/source/ui/inc/seltrans.hxx
+++ b/sc/source/ui/inc/seltrans.hxx
@@ -67,6 +67,7 @@ public:
     virtual void        AddSupportedFormats() override;
     virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
     virtual void        ObjectReleased() override;
+    virtual sal_Bool SAL_CALL isComplex() override;
 };
 
 #endif
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index 5b7f405fb55e..1ebfd1a4e892 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -76,6 +76,7 @@ public:
     virtual bool        WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
                                         const css::datatransfer::DataFlavor& rFlavor ) override;
     virtual void        DragFinished( sal_Int8 nDropAction ) override;
+    virtual sal_Bool SAL_CALL isComplex() override;
 
     ScDocument*         GetDocument() const     { return m_pDoc.get(); }        // owned by ScTransferObj
     const ScRange&      GetRange() const        { return m_aBlock; }
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 798b3dd23e3a..f4b8bf904532 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -419,7 +419,7 @@ namespace
     }
 }
 
-sal_Bool SwTransferable::isComplex()
+sal_Bool SAL_CALL SwTransferable::isComplex()
 {
     // Copy into a new Doc so we don't mess with the existing one.
     //FIXME: We *should* be able to avoid this and improve the performance.
diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx
index 0b15b8f15acf..c19bc8efc075 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -151,7 +151,7 @@ protected:
                                         const css::datatransfer::DataFlavor& rFlavor ) override;
     virtual void        DragFinished( sal_Int8 nDropAction ) override;
     virtual void        ObjectReleased() override;
-    virtual sal_Bool isComplex() override;
+    virtual sal_Bool SAL_CALL isComplex() override;
 
     using TransferableHelper::StartDrag;
 
commit 05683f3ade1ed623847df5204338f440981239c7
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Jun 28 12:30:40 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:49 2019 -0400

    lok: vital to quote nested JSON inserted into a json property.
    
    Somehow this managed to work fine in most browsers, but when
    the Kit/Poco tried to parse JSON to extract viewID it could explode.
    
    Change-Id: I39d2ecc9ee95b7e6f67a23c8b15f9a1d01769ddc

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index a7828287205d..55b157ef6cb2 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -143,11 +143,26 @@ void SfxLokHelper::setViewLanguage(int nId, const OUString& rBcp47LanguageTag)
     }
 }
 
+static OString lcl_escapeQuotes(const OString &rStr)
+{
+    if (rStr.getLength() < 1)
+        return rStr;
+    // FIXME: need an optimized 'escape' method for O[U]String.
+    OStringBuffer aBuf(rStr.getLength() + 8);
+    for (sal_Int32 i = 0; i < rStr.getLength(); ++i)
+    {
+        if (rStr[i] == '"' || rStr[i] == '\\')
+            aBuf.append('\\');
+        aBuf.append(rStr[i]);
+    }
+    return aBuf.makeStringAndClear();
+}
+
 void SfxLokHelper::notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const OString& rKey, const OString& rPayload)
 {
     OString aPayload = OString("{ \"viewId\": \"") + OString::number(SfxLokHelper::getView(pThisView)) +
                        "\", \"part\": \"" + OString::number(pThisView->getPart()) +
-                       "\", \"" + rKey + "\": \"" + rPayload + "\" }";
+                       "\", \"" + rKey + "\": \"" + lcl_escapeQuotes(rPayload) + "\" }";
 
     pOtherView->libreOfficeKitViewCallback(nType, aPayload.getStr());
 }
commit bd304791005f6006487941272dfac525509434ea
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Sat Jul 20 11:07:56 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:49 2019 -0400

    Set clipboard for a window when created
    
    This allows to paste in dialogs input using tunneled context menu.
    
    Change-Id: Ie6cc6f1a6cd453734c8f6084b0bd50d1d7ab6c09

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index af4f531e89ba..96ba15ace3fd 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1529,6 +1529,18 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
             }
             return false;
         });
+
+        VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
+        if (!pWindow)
+        {
+            gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+            return false;
+        }
+
+        auto xClip = forceSetClipboardForCurrentView(m_pDocument);
+
+        uno::Reference<datatransfer::clipboard::XClipboard> xClipboard(xClip.get());
+        pWindow->SetClipboard(xClipboard);
     }
     else if (aAction == "size_changed")
     {
commit b7b091ed71557213e9ce9123dfed727393e86b4b
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Jul 20 11:07:01 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:49 2019 -0400

    LOK: Copy Graphics as embedded PNG in HTML
    
    Change-Id: Id8c14d7304d30bfcd956b126dfe291ef044f62bf

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6b0e8863bbd9..af4f531e89ba 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -47,6 +47,7 @@
 #include <rtl/strbuf.hxx>
 #include <rtl/uri.hxx>
 #include <cppuhelper/bootstrap.hxx>
+#include <comphelper/base64.hxx>
 #include <comphelper/dispatchcommand.hxx>
 #include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
@@ -3415,6 +3416,15 @@ static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int n
     pDoc->setTextSelection(nType, nX, nY);
 }
 
+static OUString getGenerator()
+{
+    OUString sGenerator(
+        Translate::ExpandVariables("%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION (%1)"));
+    OUString os("$_OS");
+    ::rtl::Bootstrap::expandMacros(os);
+    return sGenerator.replaceFirst("%1", os);
+}
+
 static bool getFromTransferrable(
     const css::uno::Reference<css::datatransfer::XTransferable> &xTransferable,
     const OString &aInMimeType, OString &aRet)
@@ -3442,6 +3452,30 @@ static bool getFromTransferrable(
 
     if (!xTransferable->isDataFlavorSupported(aFlavor))
     {
+        // If html is not supported, might be a graphic-selection, which supports png.
+        if (aInMimeType == "text/html" && getFromTransferrable(xTransferable, "image/png", aRet))
+        {
+            // Encode in base64.
+            auto aSeq = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),
+                                           aRet.getLength());
+            OUStringBuffer aBase64Data;
+            comphelper::Base64::encode(aBase64Data, aSeq);
+
+            // Embed in HTML.
+            static const OString aHeader
+                = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
+                  "<html><head>"
+                  "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/><meta "
+                  "name=\"generator\" content=\""
+                  + getGenerator().toUtf8()
+                  + "\"/>"
+                    "</head><body><img src=\"data:image/png;charset=utf-8;base64,";
+
+            aRet = aHeader + aBase64Data.makeStringAndClear().toUtf8() + "\"/></body></html>";
+
+            return true;
+        }
+
         SetLastExceptionMsg("Flavor " + aFlavor.MimeType + " is not supported");
         return false;
     }
@@ -3478,7 +3512,7 @@ static bool getFromTransferrable(
         aRet = OString(reinterpret_cast<sal_Char*>(aSequence.getArray()), aSequence.getLength());
     }
 
-    return true;;
+    return true;
 }
 
 // Tolerate embedded \0s etc.
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 67e71396e8dc..656018abbf79 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -390,7 +390,8 @@ Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, co
 
 sal_Bool SAL_CALL TransferableHelper::isComplex()
 {
-    //FIXME: get from each document.
+    // By default everything is complex, until proven otherwise
+    // in the respective document type transferable handler.
     return sal_True;
 }
 
commit ab8a6d596f2850b600bc3bc2f08f008b96fc65cd
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Jul 20 11:05:49 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:49 2019 -0400

    lok: cleanup clipboards associated with a view on destruction.
    
    Also defer destruction potentially indefinitely for bad users who
    quit without destroying views, documents, shutting down nicely etc.
    
    Change-Id: Ieea6ad00b2983d372b745179bfe3b884c3c64eb0

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bb938443861f..6b0e8863bbd9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1650,6 +1650,8 @@ static void doc_destroy(LibreOfficeKitDocument *pThis)
 
     SolarMutexGuard aGuard;
 
+    LOKClipboardFactory::releaseClipboardForView(-1);
+
     LibLODocument_Impl *pDocument = static_cast<LibLODocument_Impl*>(pThis);
     delete pDocument;
 }
@@ -4369,6 +4371,8 @@ static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis
     SolarMutexGuard aGuard;
     SetLastExceptionMsg();
 
+    LOKClipboardFactory::releaseClipboardForView(nId);
+
     SfxLokHelper::destroyView(nId);
 }
 
diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index ef52a4596c43..18b728c2343a 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -8,14 +8,16 @@
  */
 
 #include "lokclipboard.hxx"
+#include <vcl/lazydelete.hxx>
 #include <sfx2/lokhelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
 using namespace css;
 using namespace css::uno;
 
-osl::Mutex LOKClipboardFactory::gMutex;
-std::unordered_map<int, rtl::Reference<LOKClipboard>> LOKClipboardFactory::gClipboards;
+/* static */ osl::Mutex LOKClipboardFactory::gMutex;
+static vcl::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>>
+gClipboards(new std::unordered_map<int, rtl::Reference<LOKClipboard>>);
 
 rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView()
 {
@@ -23,18 +25,39 @@ rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView()
 
     osl::MutexGuard aGuard(gMutex);
 
-    auto it = gClipboards.find(nViewId);
-    if (it != gClipboards.end())
+    auto it = gClipboards.get()->find(nViewId);
+    if (it != gClipboards.get()->end())
     {
         SAL_INFO("lok", "Got clip: " << it->second.get() << " from " << nViewId);
         return it->second;
     }
     rtl::Reference<LOKClipboard> xClip(new LOKClipboard());
-    gClipboards[nViewId] = xClip;
+    (*gClipboards.get())[nViewId] = xClip;
     SAL_INFO("lok", "Created clip: " << xClip.get() << " for viewId " << nViewId);
     return xClip;
 }
 
+/// FIXME: should really copy and stash its content for a bit.
+void LOKClipboardFactory::releaseClipboardForView(int nViewId)
+{
+    osl::MutexGuard aGuard(gMutex);
+
+    if (nViewId < 0) // clear all
+    {
+        gClipboards.get()->clear();
+        SAL_INFO("lok", "Released all clipboards on doc destroy\n");
+    }
+    else
+    {
+        auto it = gClipboards.get()->find(nViewId);
+        if (it != gClipboards.get()->end())
+        {
+            gClipboards.get()->erase(it);
+            SAL_INFO("lok", "Released clip: " << it->second.get() << " for destroyed " << nViewId);
+        }
+    }
+}
+
 uno::Reference<uno::XInterface>
     SAL_CALL LOKClipboardFactory::createInstanceWithArguments(const Sequence<Any>& /* rArgs */)
 {
@@ -178,7 +201,7 @@ LOKTransferable::LOKTransferable(const size_t nInCount, const char** pInMimeType
 
 uno::Any SAL_CALL LOKTransferable::getTransferData(const datatransfer::DataFlavor& rFlavor)
 {
-    assert(m_aContent.size() == (size_t)m_aFlavors.getLength());
+    assert(m_aContent.size() == static_cast<size_t>(m_aFlavors.getLength()));
     for (size_t i = 0; i < m_aContent.size(); ++i)
     {
         if (m_aFlavors[i].MimeType == rFlavor.MimeType)
diff --git a/desktop/source/lib/lokclipboard.hxx b/desktop/source/lib/lokclipboard.hxx
index e6f7876d4836..90e41176fee4 100644
--- a/desktop/source/lib/lokclipboard.hxx
+++ b/desktop/source/lib/lokclipboard.hxx
@@ -92,7 +92,6 @@ public:
 class LOKClipboardFactory : public ::cppu::WeakComponentImplHelper<css::lang::XSingleServiceFactory>
 {
     static osl::Mutex gMutex;
-    static std::unordered_map<int, rtl::Reference<LOKClipboard>> gClipboards;
 
 public:
     LOKClipboardFactory()
@@ -106,7 +105,12 @@ public:
     }
     css::uno::Reference<css::uno::XInterface> SAL_CALL
     createInstanceWithArguments(const css::uno::Sequence<css::uno::Any>& /* rArgs */) override;
+
+    /// Fetch clipboard from the gobal pool.
     static rtl::Reference<LOKClipboard> getClipboardForCurView();
+
+    /// Release a clipboard before its document dies, nViewId of -1 clears all.
+    static void releaseClipboardForView(int nViewId);
 };
 
 #endif
commit c3816a0c85839404d3042ce46635a11ada8a41e3
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Jun 25 23:45:37 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:49 2019 -0400

    LOK: Improved selection complexity detection
    
    Only Graphics and OLE now unconditionally
    trigger 'complex' case, and for all others,
    we actually tally the number of text characters.
    
    Currently anything above 512KB is flagged as 'complex'.
    
    Change-Id: I19fbef72f2eb725648b2a18c1ee41b1612d2bac0

diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index bd6609c321a4..517a38a50527 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -356,7 +356,7 @@ public:
      *
      * @return an element of the LibreOfficeKitSelectionType enum.
      */
-    int getSelectionType(LibreOfficeKitDocument* /*pThis*/)
+    int getSelectionType()
     {
         return mpDoc->pClass->getSelectionType(mpDoc);
     }
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 223ed806bc32..798b3dd23e3a 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -421,15 +421,6 @@ namespace
 
 sal_Bool SwTransferable::isComplex()
 {
-    const SelectionType nSelectionType = m_pWrtShell->GetSelectionType();
-
-    // Anything other than text is complex by definition.
-    if (nSelectionType != SelectionType::Text)
-        return true;
-
-    if (m_pWrtShell->IsFrameSelected() || m_pWrtShell->IsObjSelected())
-        return true;
-
     // Copy into a new Doc so we don't mess with the existing one.
     //FIXME: We *should* be able to avoid this and improve the performance.
     m_pClpDocFac.reset(new SwDocFac);
@@ -439,21 +430,29 @@ sal_Bool SwTransferable::isComplex()
         .LockExpFields(); // never update fields - leave text as it is
     lclOverWriteDoc(*m_pWrtShell, *pTmpDoc);
 
-    bool isComplex = false;
+    sal_Int32 nTextLength = 0;
+    const SwNode* pEndOfContent = &m_pWrtShell->GetDoc()->GetNodes().GetEndOfContent();
     SwNodes& aNodes = pTmpDoc->GetNodes();
     for( sal_uLong nIndex = 0; nIndex < aNodes.Count(); ++nIndex)
     {
         SwNode& rNd = *aNodes[nIndex];
-        if (rNd.IsContentNode() && !rNd.IsTextNode())
-        {
-            isComplex = true;
+        if (&rNd == pEndOfContent)
             break;
+
+        if (rNd.IsOLENode() || rNd.IsGrfNode())
+            return true; // Complex
+
+        SwTextNode* pTextNode = rNd.GetTextNode();
+        if (pTextNode)
+        {
+            nTextLength += pTextNode->GetText().getLength();
+            if (nTextLength >= 1024 * 512)
+                return true; // Complex
         }
-        else if (&rNd == &m_pWrtShell->GetDoc()->GetNodes().GetEndOfContent())
-            break;
     }
 
-    return isComplex;
+    // Simple
+    return false;
 }
 
 bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
commit ff90a487276fa98d1868fdeda4d14dceae5f75b5
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Jul 20 11:01:38 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:48 2019 -0400

    LOK: Enable embedding images in text/html format output
    
    Change-Id: Ibd8bed796678ee26de2ceb6e434dce24da4eab05

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 9f1e66a0851e..6d6416a46e16 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2682,7 +2682,7 @@ void DesktopLOKTest::testComplexSelection()
     pText = pDocument->pClass->getTextSelection(pDocument, "text/html", nullptr);
     CPPUNIT_ASSERT(pText != nullptr);
     CPPUNIT_ASSERT(std::string(pText).find(aText.getStr()) != std::string::npos); // Must have the text.
-    // CPPUNIT_ASSERT(std::string(pText).find("<img") != std::string::npos); // Must have the image as well.
+    CPPUNIT_ASSERT(std::string(pText).find("<img") != std::string::npos); // Must have the image as well.
     free(pText);
 
     // We expect this to be complex.
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 54afa80ba7c9..5c1a6ab52a42 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -91,7 +91,7 @@ using namespace css;
 static sal_Char sIndentTabs[MAX_INDENT_LEVEL+2] =
     "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
 
-SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL )
+SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL, const OUString& rFilterOptions )
     : m_pNumRuleInfo(new SwHTMLNumRuleInfo)
     , m_nHTMLMode(0)
     , m_eCSS1Unit(FieldUnit::NONE)
@@ -163,6 +163,8 @@ SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL )
         mpTempBaseURL->EnableKillingFile();
         SetBaseURL(mpTempBaseURL->GetURL());
     }
+
+    SetupFilterOptions(rFilterOptions);
 }
 
 SwHTMLWriter::~SwHTMLWriter()
@@ -185,21 +187,26 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
         return;
 
 
-    OUString sFilterOptions = static_cast<const SfxStringItem*>(pItem)->GetValue();
-    if (sFilterOptions == "SkipImages")
+    const OUString sFilterOptions = static_cast<const SfxStringItem*>(pItem)->GetValue();
+    SetupFilterOptions(sFilterOptions);
+}
+
+void SwHTMLWriter::SetupFilterOptions(const OUString& rFilterOptions)
+{
+    if (rFilterOptions == "SkipImages")
     {
         mbSkipImages = true;
     }
-    else if (sFilterOptions == "SkipHeaderFooter")
+    else if (rFilterOptions == "SkipHeaderFooter")
     {
         mbSkipHeaderFooter = true;
     }
-    else if (sFilterOptions == "EmbedImages" )
+    else if (rFilterOptions == "EmbedImages")
     {
         mbEmbedImages = true;
     }
 
-    uno::Sequence<OUString> aOptionSeq = comphelper::string::convertCommaSeparated(sFilterOptions);
+    uno::Sequence<OUString> aOptionSeq = comphelper::string::convertCommaSeparated(rFilterOptions);
     const OUString aXhtmlNsKey("xhtmlns=");
     for (const auto& rOption : aOptionSeq)
     {
@@ -823,13 +830,6 @@ void SwHTMLWriter::Out_SwDoc( SwPaM* pPam )
                 OutHTML_Section( *this, *rNd.GetSectionNode() );
                 m_nBkmkTabPos = m_bWriteAll ? FindPos_Bkmk( *m_pCurrentPam->GetPoint() ) : -1;
             }
-            else if( rNd.IsGrfNode() )
-            {
-                SwGrfNode* pGrfNd = rNd.GetGrfNode();
-                assert(pGrfNd && !"FIXME: Implement Graphic copy as HTML.");
-                // if (pGrfNd)
-                //     OutHTML_SwGrfNode( *this, *pGrfNd );
-            }
             else if( &rNd == &m_pDoc->GetNodes().GetEndOfContent() )
                 break;
 
@@ -1555,9 +1555,9 @@ HTMLSaveData::~HTMLSaveData()
     }
 }
 
-void GetHTMLWriter( const OUString&, const OUString& rBaseURL, WriterRef& xRet )
+void GetHTMLWriter( const OUString& rFilterOptions, const OUString& rBaseURL, WriterRef& xRet )
 {
-    xRet = new SwHTMLWriter( rBaseURL );
+    xRet = new SwHTMLWriter( rBaseURL, rFilterOptions );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 47893227f98f..98c9005fe095 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -269,6 +269,8 @@ class SW_DLLPUBLIC SwHTMLWriter : public Writer
     void AddLinkTarget( const OUString& rURL );
     void CollectLinkTargets();
 
+    void SetupFilterOptions(const OUString& rFilterOptions);
+
 protected:
     ErrCode WriteStream() override;
     void SetupFilterOptions(SfxMedium& rMedium) override;
@@ -403,7 +405,9 @@ public:
     /// Tracks which text portion attributes are currently open: a which id -> open count map.
     std::map<sal_uInt16, int> maStartedAttributes;
 
-    explicit SwHTMLWriter( const OUString& rBaseURL );
+    /// Construct an instance of SwHTMLWriter and optionally give it
+    /// the filter options directly, which can also be set via SetupFilterOptions().
+    explicit SwHTMLWriter( const OUString& rBaseURL, const OUString& rFilterOptions = "" );
     virtual ~SwHTMLWriter() override;
 
     void Out_SwDoc( SwPaM* );       // write the marked range
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 847ec3481590..223ed806bc32 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -432,7 +432,7 @@ sal_Bool SwTransferable::isComplex()
 
     // Copy into a new Doc so we don't mess with the existing one.
     //FIXME: We *should* be able to avoid this and improve the performance.
-    m_pClpDocFac = new SwDocFac;
+    m_pClpDocFac.reset(new SwDocFac);
     SwDoc* const pTmpDoc = lcl_GetDoc(*m_pClpDocFac);
 
     pTmpDoc->getIDocumentFieldsAccess()
@@ -773,8 +773,12 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& xStream,
         break;
 
     case SWTRANSFER_OBJECTTYPE_HTML:
-        GetHTMLWriter(OUString(), OUString(), xWrt);
+    {
+        // LOK is interested in getting images embedded for copy/paste support.
+        const OUString aFilterOptions("EmbedImages");
+        GetHTMLWriter( comphelper::LibreOfficeKit::isActive() ? aFilterOptions : OUString(), OUString(), xWrt );
         break;
+    }
 
     case SWTRANSFER_OBJECTTYPE_RTF:
     case SWTRANSFER_OBJECTTYPE_RICHTEXT:
commit 7fe30d1cb00c576469d6cbe5606268a9cdf35bd3
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Jun 25 12:36:52 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:48 2019 -0400

    LOK: detect Graphics in isComplex for Writer
    
    Change-Id: I814d71a21fa5352a9a1051f5477cb452a0dc5c2f

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 8eaaacecc475..9f1e66a0851e 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2686,7 +2686,7 @@ void DesktopLOKTest::testComplexSelection()
     free(pText);
 
     // We expect this to be complex.
-    // CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_COMPLEX, pDocument->pClass->getSelectionType(pDocument)); // Fails!
+    CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_COMPLEX, pDocument->pClass->getSelectionType(pDocument));
 }
 
 namespace {
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 79a2f34d7d83..847ec3481590 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -430,6 +430,8 @@ sal_Bool SwTransferable::isComplex()
     if (m_pWrtShell->IsFrameSelected() || m_pWrtShell->IsObjSelected())
         return true;
 
+    // Copy into a new Doc so we don't mess with the existing one.
+    //FIXME: We *should* be able to avoid this and improve the performance.
     m_pClpDocFac = new SwDocFac;
     SwDoc* const pTmpDoc = lcl_GetDoc(*m_pClpDocFac);
 
@@ -437,36 +439,18 @@ sal_Bool SwTransferable::isComplex()
         .LockExpFields(); // never update fields - leave text as it is
     lclOverWriteDoc(*m_pWrtShell, *pTmpDoc);
 
-    // in CORE a new one was created (OLE-objects copied!)
-    m_aDocShellRef = pTmpDoc->GetTmpDocShell();
-    if (m_aDocShellRef.Is())
-        SwTransferable::InitOle(m_aDocShellRef);
-    pTmpDoc->SetTmpDocShell(nullptr);
-
-    SwPaM aOrigPam(pTmpDoc->GetNodes().GetEndOfContent());
-    aOrigPam.Move(fnMoveBackward, GoInDoc);
-    aOrigPam.SetMark();
-    aOrigPam.Move(fnMoveForward, GoInDoc);
-
-    SwPaM aPam(*aOrigPam.End(), *aOrigPam.Start());
-
     bool isComplex = false;
-    while (aPam.GetPoint()->nNode.GetIndex() < aPam.GetMark()->nNode.GetIndex()
-        || (aPam.GetPoint()->nNode.GetIndex() == aPam.GetMark()->nNode.GetIndex()
-            && aPam.GetPoint()->nContent.GetIndex() <= aPam.GetMark()->nContent.GetIndex()))
+    SwNodes& aNodes = pTmpDoc->GetNodes();
+    for( sal_uLong nIndex = 0; nIndex < aNodes.Count(); ++nIndex)
     {
-        SwNode& rNd = aPam.GetNode();
-
+        SwNode& rNd = *aNodes[nIndex];
         if (rNd.IsContentNode() && !rNd.IsTextNode())
         {
-            //FIXME: this doesn't detect GrfNode, which we need to detect complex selections.
             isComplex = true;
             break;
         }
         else if (&rNd == &m_pWrtShell->GetDoc()->GetNodes().GetEndOfContent())
             break;
-
-        ++aPam.GetPoint()->nNode;
     }
 
     return isComplex;
commit 169a87563a3940299811d874b4df0ad13591771c
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Jun 24 22:07:08 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:48 2019 -0400

    LOK: Implement getSelectionType
    
    Detects all complex scenarios, except for Graphics.
    
    DesktopLOKTest::testComplexSelection() has commented
    out check that currently fails due to the missing
    detection of Graphics nodes.
    
    Change-Id: Ifce17192d26daba218d2c3d38577cccec0699e99

diff --git a/desktop/qa/data/objects.odt b/desktop/qa/data/objects.odt
new file mode 100644
index 000000000000..45c2b39cc1a4
Binary files /dev/null and b/desktop/qa/data/objects.odt differ
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index d482f23e5eff..8eaaacecc475 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2643,12 +2643,17 @@ void DesktopLOKTest::testComplexSelection()
 {
     // Start with a blank text file and add contents.
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
-    // LibLODocument_Impl* pDocument = loadDoc("sheet_with_image.ods");
     static const OString aText("hello world");
 
+    // Certainly not complex.
+    CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_NONE, pDocument->pClass->getSelectionType(pDocument));
+
     // Paste text.
     CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength()));
 
+    // No selection.
+    CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_NONE, pDocument->pClass->getSelectionType(pDocument));
+
     // Paste an image.
     OUString aFileURL;
     createFileURL("paste.jpg", aFileURL);
@@ -2660,10 +2665,6 @@ void DesktopLOKTest::testComplexSelection()
     pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false);
     Scheduler::ProcessEventsToIdle();
 
-    // We expect this to be complex.
-    const int type = pDocument->pClass->getSelectionType(pDocument);
-    CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_COMPLEX, type);
-
     // Export as plain text, we should get only the text part "hello".
     char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr);
     CPPUNIT_ASSERT(pText != nullptr);
@@ -2683,6 +2684,9 @@ void DesktopLOKTest::testComplexSelection()
     CPPUNIT_ASSERT(std::string(pText).find(aText.getStr()) != std::string::npos); // Must have the text.
     // CPPUNIT_ASSERT(std::string(pText).find("<img") != std::string::npos); // Must have the image as well.
     free(pText);
+
+    // We expect this to be complex.
+    // CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_COMPLEX, pDocument->pClass->getSelectionType(pDocument)); // Fails!
 }
 
 namespace {
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 351e7782c273..79a2f34d7d83 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -419,6 +419,59 @@ namespace
     }
 }
 
+sal_Bool SwTransferable::isComplex()
+{
+    const SelectionType nSelectionType = m_pWrtShell->GetSelectionType();
+
+    // Anything other than text is complex by definition.
+    if (nSelectionType != SelectionType::Text)
+        return true;
+
+    if (m_pWrtShell->IsFrameSelected() || m_pWrtShell->IsObjSelected())
+        return true;
+
+    m_pClpDocFac = new SwDocFac;
+    SwDoc* const pTmpDoc = lcl_GetDoc(*m_pClpDocFac);
+
+    pTmpDoc->getIDocumentFieldsAccess()
+        .LockExpFields(); // never update fields - leave text as it is
+    lclOverWriteDoc(*m_pWrtShell, *pTmpDoc);
+
+    // in CORE a new one was created (OLE-objects copied!)
+    m_aDocShellRef = pTmpDoc->GetTmpDocShell();
+    if (m_aDocShellRef.Is())
+        SwTransferable::InitOle(m_aDocShellRef);
+    pTmpDoc->SetTmpDocShell(nullptr);
+
+    SwPaM aOrigPam(pTmpDoc->GetNodes().GetEndOfContent());
+    aOrigPam.Move(fnMoveBackward, GoInDoc);
+    aOrigPam.SetMark();
+    aOrigPam.Move(fnMoveForward, GoInDoc);
+
+    SwPaM aPam(*aOrigPam.End(), *aOrigPam.Start());
+
+    bool isComplex = false;
+    while (aPam.GetPoint()->nNode.GetIndex() < aPam.GetMark()->nNode.GetIndex()
+        || (aPam.GetPoint()->nNode.GetIndex() == aPam.GetMark()->nNode.GetIndex()
+            && aPam.GetPoint()->nContent.GetIndex() <= aPam.GetMark()->nContent.GetIndex()))
+    {
+        SwNode& rNd = aPam.GetNode();
+
+        if (rNd.IsContentNode() && !rNd.IsTextNode())
+        {
+            //FIXME: this doesn't detect GrfNode, which we need to detect complex selections.
+            isComplex = true;
+            break;
+        }
+        else if (&rNd == &m_pWrtShell->GetDoc()->GetNodes().GetEndOfContent())
+            break;
+
+        ++aPam.GetPoint()->nNode;
+    }
+
+    return isComplex;
+}
+
 bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
 {
     SotClipboardFormatId nFormat = SotExchange::GetFormat( rFlavor );
diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx
index 1b3cf2536964..0b15b8f15acf 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -151,6 +151,7 @@ protected:
                                         const css::datatransfer::DataFlavor& rFlavor ) override;
     virtual void        DragFinished( sal_Int8 nDropAction ) override;
     virtual void        ObjectReleased() override;
+    virtual sal_Bool isComplex() override;
 
     using TransferableHelper::StartDrag;
 
commit 164188c3e2f0be1d20765accd8d59f5e4df77c3d
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Jul 20 10:55:35 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:48 2019 -0400

    clipboard: get view setting correct before setClipboard.
    
    Change-Id: If8e9b057b819074f035c598569e3bf6d3d2fff00

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 07158ce052b9..bb938443861f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3589,12 +3589,12 @@ static int doc_getClipboard(LibreOfficeKitDocument* pThis,
     }
 
     rtl::Reference<LOKClipboard> xClip(LOKClipboardFactory::getClipboardForCurView());
-    SAL_INFO("lok", "Got clipboard for view " << xClip.get());
 
     css::uno::Reference<css::datatransfer::XTransferable> xTransferable = xClip->getContents();
+    SAL_INFO("lok", "Got from clip: " << xClip.get() << " transferrable: " << xTransferable);
     if (!xTransferable)
     {
-        SetLastExceptionMsg("No selection available");
+        SetLastExceptionMsg("No clipboard content available");
         return 0;
     }
 
@@ -3667,6 +3667,8 @@ static int doc_setClipboard(LibreOfficeKitDocument* pThis,
     auto xClip = forceSetClipboardForCurrentView(pThis);
     xClip->setContents(xTransferable, uno::Reference<datatransfer::clipboard::XClipboardOwner>());
 
+    SAL_INFO("lok", "Set clip: " << xClip.get() << " to: " << xTransferable);
+
     if (!pDoc->isMimeTypeSupported())
     {
         SetLastExceptionMsg("Document doesn't support this mime type");
diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index a959258269a1..ef52a4596c43 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -25,10 +25,13 @@ rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView()
 
     auto it = gClipboards.find(nViewId);
     if (it != gClipboards.end())
+    {
+        SAL_INFO("lok", "Got clip: " << it->second.get() << " from " << nViewId);
         return it->second;
+    }
     rtl::Reference<LOKClipboard> xClip(new LOKClipboard());
     gClipboards[nViewId] = xClip;
-    SAL_INFO("lok", "Created clipboard for view " << nViewId << " as " << xClip.get());
+    SAL_INFO("lok", "Created clip: " << xClip.get() << " for viewId " << nViewId);
     return xClip;
 }
 
@@ -81,6 +84,7 @@ void LOKClipboard::setContents(
     std::vector<Reference<datatransfer::clipboard::XClipboardListener>> aListeners(m_aListeners);
     datatransfer::clipboard::ClipboardEvent aEv;
     aEv.Contents = m_xTransferable;
+    SAL_INFO("lok", "Clip: " << this << " set contents to " << m_xTransferable);
 
     aGuard.clear();
 
commit 153700dbb5b8fd3bcadb46e668224507a6b7fb45
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Jul 20 10:52:51 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:48 2019 -0400

    lok: clipboard: per view clipboard creation.
    
    A bit brutal, but the mess around clipboard instantiation is awful.
    
    Change-Id: I62d6af8bf6813e6bab81123417ea8bfb28394e29

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 6874c92f4cf7..d482f23e5eff 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -588,7 +588,7 @@ void DesktopLOKTest::testPasteWriter()
     free(pText);
 
     // textt/plain should be rejected.
-    CPPUNIT_ASSERT(!pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength()));
+    CPPUNIT_ASSERT(!pDocument->pClass->paste(pDocument, "textt/plain;charset=utf-8", aText.getStr(), aText.getLength()));
     // Writer is expected to support text/html.
     CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/html", aText.getStr(), aText.getLength()));
 
@@ -2772,7 +2772,7 @@ void DesktopLOKTest::testABI()
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct _LibreOfficeKitDocumentClass, selectPart));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), offsetof(struct _LibreOfficeKitDocumentClass, moveSelectedParts));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), offsetof(struct _LibreOfficeKitDocumentClass, resizeWindow));
-    CPPUNIT_ASSERT_EQUAL(documentClassOffset(52), offsetof(struct _LibreOfficeKitDocumentClass, getSelection));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(52), offsetof(struct _LibreOfficeKitDocumentClass, getClipboard));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(53), offsetof(struct _LibreOfficeKitDocumentClass, setClipboard));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(54), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionType));
 
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2eb862c07564..07158ce052b9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3650,9 +3650,6 @@ static int doc_setClipboard(LibreOfficeKitDocument* pThis,
                             const size_t  *pInSizes,
                             const char   **pInStreams)
 {
-    SolarMutexGuard aGuard;
-    if (gImpl)
-
     comphelper::ProfileZone aZone("doc_paste");
 
     SolarMutexGuard aGuard;
diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index 74e5131f435d..a959258269a1 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -9,6 +9,7 @@
 
 #include "lokclipboard.hxx"
 #include <sfx2/lokhelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 using namespace css;
 using namespace css::uno;
@@ -105,17 +106,38 @@ void LOKClipboard::removeClipboardListener(
     m_aListeners.erase(std::remove(m_aListeners.begin(), m_aListeners.end(), listener),
                        m_aListeners.end());
 }
-
-LOKTransferable::LOKTransferable(const char* pMimeType, const char* pData, std::size_t nSize)
-    : m_aMimeType(OUString::fromUtf8(pMimeType))
-    , m_aSequence(reinterpret_cast<const sal_Int8*>(pData), nSize)
+LOKTransferable::LOKTransferable(const OUString& sMimeType,
+                                 const css::uno::Sequence<sal_Int8>& aSequence)
 {
-}
+    m_aContent.reserve(1);
+    m_aFlavors = css::uno::Sequence<css::datatransfer::DataFlavor>(1);
+    initFlavourFromMime(m_aFlavors[0], sMimeType);
 
-LOKTransferable::LOKTransferable(OUString sMimeType, const css::uno::Sequence<sal_Int8>& aSequence)
-    : m_aMimeType(std::move(sMimeType))
-    , m_aSequence(aSequence)
+    uno::Any aContent;
+    if (m_aFlavors[0].DataType == cppu::UnoType<OUString>::get())
+    {
+        auto pText = reinterpret_cast<const sal_Char*>(aSequence.getConstArray());
+        aContent <<= OUString(pText, aSequence.getLength(), RTL_TEXTENCODING_UTF8);
+    }
+    else
+        aContent <<= aSequence;
+    m_aContent.push_back(aContent);
+}
+// cf. sot/source/base/exchange.cxx for these two exceptional types.
+void LOKTransferable::initFlavourFromMime(css::datatransfer::DataFlavor& rFlavor,
+                                          OUString aMimeType)
 {
+    if (aMimeType.startsWith("text/plain"))
+    {
+        aMimeType = "text/plain;charset=utf-16";
+        rFlavor.DataType = cppu::UnoType<OUString>::get();
+    }
+    else if (aMimeType == "application/x-libreoffice-tsvc")
+        rFlavor.DataType = cppu::UnoType<OUString>::get();
+    else
+        rFlavor.DataType = cppu::UnoType<uno::Sequence<sal_Int8>>::get();
+    rFlavor.MimeType = aMimeType;
+    rFlavor.HumanPresentableName = aMimeType;
 }
 
 LOKTransferable::LOKTransferable(const size_t nInCount, const char** pInMimeTypes,
@@ -152,7 +174,7 @@ LOKTransferable::LOKTransferable(const size_t nInCount, const char** pInMimeType
 
 uno::Any SAL_CALL LOKTransferable::getTransferData(const datatransfer::DataFlavor& rFlavor)
 {
-    assert(m_aContent.size() == m_aFlavors.getLength());
+    assert(m_aContent.size() == (size_t)m_aFlavors.getLength());
     for (size_t i = 0; i < m_aContent.size(); ++i)
     {
         if (m_aFlavors[i].MimeType == rFlavor.MimeType)
diff --git a/desktop/source/lib/lokclipboard.hxx b/desktop/source/lib/lokclipboard.hxx
index d917a377eb11..e6f7876d4836 100644
--- a/desktop/source/lib/lokclipboard.hxx
+++ b/desktop/source/lib/lokclipboard.hxx
@@ -29,6 +29,7 @@ class LOKClipboard
                                            css::lang::XServiceInfo>
 {
     osl::Mutex m_aMutex;
+    css::uno::Reference<css::datatransfer::XTransferable> m_xTransferable;
     css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner> m_aOwner;
     std::vector<css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>> m_aListeners;
 
@@ -73,9 +74,12 @@ class LOKTransferable : public cppu::WeakImplHelper<css::datatransfer::XTransfer
     css::uno::Sequence<css::datatransfer::DataFlavor> m_aFlavors;
     std::vector<css::uno::Any> m_aContent;
 
+    static void initFlavourFromMime(css::datatransfer::DataFlavor& rFlavor, OUString sMimeType);
+
 public:
     LOKTransferable(const size_t nInCount, const char** pInMimeTypes, const size_t* pInSizes,
                     const char** pInStreams);
+    LOKTransferable(const OUString& sMimeType, const css::uno::Sequence<sal_Int8>& aSequence);
 
     css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override;
 
commit f59e986d0dc04a2d62cc1f236acedfcf727449ce
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Jul 20 10:43:39 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:48 2019 -0400

    lok: clipboard: per view clipboard creation.
    
    A bit brutal, but the mess around clipboard instantiation is awful.
    
    Change-Id: I62d6af8bf6813e6bab81123417ea8bfb28394e29

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 4ebb21cdfe0a..6874c92f4cf7 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2772,9 +2772,13 @@ void DesktopLOKTest::testABI()
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct _LibreOfficeKitDocumentClass, selectPart));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), offsetof(struct _LibreOfficeKitDocumentClass, moveSelectedParts));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), offsetof(struct _LibreOfficeKitDocumentClass, resizeWindow));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(52), offsetof(struct _LibreOfficeKitDocumentClass, getSelection));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(53), offsetof(struct _LibreOfficeKitDocumentClass, setClipboard));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(54), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionType));
+
     // Extending is fine, update this, and add new assert for the offsetof the
     // new method
-    CPPUNIT_ASSERT_EQUAL(documentClassOffset(52), sizeof(struct _LibreOfficeKitDocumentClass));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(55), sizeof(struct _LibreOfficeKitDocumentClass));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index eb9c7854bc13..2eb862c07564 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -790,7 +790,7 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis,
                                   const char* pMimeType,
                                   char** pUsedMimeType);
 static int doc_getSelectionType(LibreOfficeKitDocument* pThis);
-static int doc_getSelection (LibreOfficeKitDocument* pThis,
+static int doc_getClipboard (LibreOfficeKitDocument* pThis,
                              const char **pMimeTypes,
                              size_t      *pOutCount,
                              char      ***pOutMimeTypes,
@@ -863,6 +863,34 @@ static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu
 static void doc_resizeWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId,
                              const int nWidth, const int nHeight);
 
+} // extern "C"
+
+namespace {
+ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis)
+{
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+    return dynamic_cast<ITiledRenderable*>(pDocument->mxComponent.get());
+}
+
+/*
+ * Unfortunately clipboard creation using UNO is insanely baroque.
+ * we also need to ensure that this works for the first view which
+ * has no clear 'createView' called for it (unfortunately).
+ */
+
+rtl::Reference<LOKClipboard> forceSetClipboardForCurrentView(LibreOfficeKitDocument *pThis)
+{
+    ITiledRenderable* pDoc = getTiledRenderable(pThis);
+    rtl::Reference<LOKClipboard> xClip(LOKClipboardFactory::getClipboardForCurView());
+
+    SAL_INFO("lok", "Set to clipboard for view " << xClip.get());
+    // FIXME: using a hammer here - should not be necessary if all tests used createView.
+    pDoc->setClipboard(uno::Reference<datatransfer::clipboard::XClipboard>(xClip->getXI(), UNO_QUERY));
+
+    return xClip;
+}
+} // anonymous namespace
+
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
     : mxComponent(xComponent)
 {
@@ -901,7 +929,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         m_pDocumentClass->setTextSelection = doc_setTextSelection;
         m_pDocumentClass->getTextSelection = doc_getTextSelection;
         m_pDocumentClass->getSelectionType = doc_getSelectionType;
-        m_pDocumentClass->getSelection = doc_getSelection;
+        m_pDocumentClass->getClipboard = doc_getClipboard;
         m_pDocumentClass->setClipboard = doc_setClipboard;
         m_pDocumentClass->paste = doc_paste;
         m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection;
@@ -942,6 +970,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         gDocumentClass = m_pDocumentClass;
     }
     pClass = m_pDocumentClass.get();
+
+    forceSetClipboardForCurrentView(this);
 }
 
 LibLODocument_Impl::~LibLODocument_Impl()
@@ -956,6 +986,8 @@ LibLODocument_Impl::~LibLODocument_Impl()
     }
 }
 
+extern "C" {
+
 CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, LibreOfficeKitCallback pCallback, void* pData)
     : Idle( "lokit timer callback" ),
       m_pDocument(pDocument),
@@ -1691,12 +1723,6 @@ LibLibreOffice_Impl::~LibLibreOffice_Impl()
 namespace
 {
 
-ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis)
-{
-    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
-    return dynamic_cast<ITiledRenderable*>(pDocument->mxComponent.get());
-}
-
 #ifdef IOS
 void paintTileToCGContext(ITiledRenderable* pDocument,
                           void* rCGContext, const Size nCanvasSize,
@@ -3535,7 +3561,7 @@ static int doc_getSelectionType(LibreOfficeKitDocument* pThis)
     return aRet.getLength() ? LOK_SELTYPE_TEXT : LOK_SELTYPE_NONE;
 }
 
-static int doc_getSelection(LibreOfficeKitDocument* pThis,
+static int doc_getClipboard(LibreOfficeKitDocument* pThis,
                             const char **pMimeTypes,
                             size_t      *pOutCount,
                             char      ***pOutMimeTypes,
@@ -3562,7 +3588,10 @@ static int doc_getSelection(LibreOfficeKitDocument* pThis,
         return 0;
     }
 
-    css::uno::Reference<css::datatransfer::XTransferable> xTransferable = pDoc->getSelection();
+    rtl::Reference<LOKClipboard> xClip(LOKClipboardFactory::getClipboardForCurView());
+    SAL_INFO("lok", "Got clipboard for view " << xClip.get());
+
+    css::uno::Reference<css::datatransfer::XTransferable> xTransferable = xClip->getContents();
     if (!xTransferable)
     {
         SetLastExceptionMsg("No selection available");
@@ -3637,9 +3666,9 @@ static int doc_setClipboard(LibreOfficeKitDocument* pThis,
     }
 
     uno::Reference<datatransfer::XTransferable> xTransferable(new LOKTransferable(nInCount, pInMimeTypes, pInSizes, pInStreams));
-    uno::Reference<datatransfer::clipboard::XClipboard> xClipboard(new LOKClipboard);
-    xClipboard->setContents(xTransferable, uno::Reference<datatransfer::clipboard::XClipboardOwner>());
-    pDoc->setClipboard(xClipboard);
+
+    auto xClip = forceSetClipboardForCurrentView(pThis);
+    xClip->setContents(xTransferable, uno::Reference<datatransfer::clipboard::XClipboardOwner>());
 
     if (!pDoc->isMimeTypeSupported())
     {
@@ -4305,7 +4334,7 @@ static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int
     pDoc->setOutlineState(bColumn, nLevel, nIndex, bHidden);
 }
 
-static int doc_createViewWithOptions(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/,
+static int doc_createViewWithOptions(LibreOfficeKitDocument* pThis,
                                      const char* pOptions)
 {
     comphelper::ProfileZone aZone("doc_createView");
@@ -4322,7 +4351,11 @@ static int doc_createViewWithOptions(SAL_UNUSED_PARAMETER LibreOfficeKitDocument
         comphelper::LibreOfficeKit::setLanguageTag(LanguageTag(aLanguage));
     }
 
-    return SfxLokHelper::createView();
+    int nId = SfxLokHelper::createView();
+
+    forceSetClipboardForCurrentView(pThis);
+
+    return nId;
 }
 
 static int doc_createView(LibreOfficeKitDocument* pThis)
@@ -5498,14 +5531,10 @@ static void lo_destroy(LibreOfficeKit* pThis)
     SAL_INFO("lok", "LO Destroy Done");
 }
 
-}
-
 #ifdef IOS
 
 // Used by the unmaintained LibreOfficeLight app. Once that has been retired, get rid of this, too.
 
-extern "C"
-{
 __attribute__((visibility("default")))
 void temporaryHackToInvokeCallbackHandlers(LibreOfficeKitDocument* pThis)
 {
@@ -5519,7 +5548,9 @@ void temporaryHackToInvokeCallbackHandlers(LibreOfficeKitDocument* pThis)
         pDocument->mpCallbackFlushHandlers[nOrigViewId]->Invoke();
     }
 }
-}
+
 #endif
 
+} // extern "C"
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index 015690bd9bc4..74e5131f435d 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -8,23 +8,103 @@
  */
 
 #include "lokclipboard.hxx"
-#include <comphelper/sequence.hxx>
+#include <sfx2/lokhelper.hxx>
 
-using namespace com::sun::star;
+using namespace css;
+using namespace css::uno;
 
-uno::Reference<datatransfer::XTransferable> SAL_CALL LOKClipboard::getContents()
+osl::Mutex LOKClipboardFactory::gMutex;
+std::unordered_map<int, rtl::Reference<LOKClipboard>> LOKClipboardFactory::gClipboards;
+
+rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView()
+{
+    int nViewId = SfxLokHelper::getView(); // currently active.
+
+    osl::MutexGuard aGuard(gMutex);
+
+    auto it = gClipboards.find(nViewId);
+    if (it != gClipboards.end())
+        return it->second;
+    rtl::Reference<LOKClipboard> xClip(new LOKClipboard());
+    gClipboards[nViewId] = xClip;
+    SAL_INFO("lok", "Created clipboard for view " << nViewId << " as " << xClip.get());
+    return xClip;
+}
+
+uno::Reference<uno::XInterface>
+    SAL_CALL LOKClipboardFactory::createInstanceWithArguments(const Sequence<Any>& /* rArgs */)
+{
+    return uno::Reference<uno::XInterface>(
+        static_cast<cppu::OWeakObject*>(getClipboardForCurView().get()));
+}
+
+LOKClipboard::LOKClipboard()
+    : cppu::WeakComponentImplHelper<css::datatransfer::clipboard::XSystemClipboard,
+                                    css::lang::XServiceInfo>(m_aMutex)
+{
+}
+
+Sequence<OUString> LOKClipboard::getSupportedServiceNames_static()
+{
+    Sequence<OUString> aRet{ "com.sun.star.datatransfer.clipboard.SystemClipboard" };
+    return aRet;
+}
+
+OUString LOKClipboard::getImplementationName()
+{
+    return OUString("com.sun.star.datatransfer.LOKClipboard");
+}
+
+Sequence<OUString> LOKClipboard::getSupportedServiceNames()
+{
+    return getSupportedServiceNames_static();
+}
+
+sal_Bool LOKClipboard::supportsService(const OUString& ServiceName)
+{
+    return cppu::supportsService(this, ServiceName);
+}
+
+Reference<css::datatransfer::XTransferable> LOKClipboard::getContents() { return m_xTransferable; }
+
+void LOKClipboard::setContents(
+    const Reference<css::datatransfer::XTransferable>& xTrans,
+    const Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner)
 {
-    return m_xTransferable;
+    osl::ClearableMutexGuard aGuard(m_aMutex);
+    Reference<datatransfer::clipboard::XClipboardOwner> xOldOwner(m_aOwner);
+    Reference<datatransfer::XTransferable> xOldContents(m_xTransferable);
+    m_xTransferable = xTrans;
+    m_aOwner = xClipboardOwner;
+
+    std::vector<Reference<datatransfer::clipboard::XClipboardListener>> aListeners(m_aListeners);
+    datatransfer::clipboard::ClipboardEvent aEv;
+    aEv.Contents = m_xTransferable;
+
+    aGuard.clear();
+
+    if (xOldOwner.is() && xOldOwner != xClipboardOwner)
+        xOldOwner->lostOwnership(this, xOldContents);
+    for (auto const& listener : aListeners)
+    {
+        listener->changedContents(aEv);
+    }
 }
 
-void SAL_CALL LOKClipboard::setContents(
-    const uno::Reference<datatransfer::XTransferable>& xTransferable,
-    const uno::Reference<datatransfer::clipboard::XClipboardOwner>& /*xClipboardOwner*/)
+void LOKClipboard::addClipboardListener(
+    const Reference<datatransfer::clipboard::XClipboardListener>& listener)
 {
-    m_xTransferable = xTransferable;
+    osl::ClearableMutexGuard aGuard(m_aMutex);
+    m_aListeners.push_back(listener);
 }
 
-OUString SAL_CALL LOKClipboard::getName() { return OUString(); }
+void LOKClipboard::removeClipboardListener(
+    const Reference<datatransfer::clipboard::XClipboardListener>& listener)
+{
+    osl::ClearableMutexGuard aGuard(m_aMutex);
+    m_aListeners.erase(std::remove(m_aListeners.begin(), m_aListeners.end(), listener),
+                       m_aListeners.end());
+}
 
 LOKTransferable::LOKTransferable(const char* pMimeType, const char* pData, std::size_t nSize)
     : m_aMimeType(OUString::fromUtf8(pMimeType))
diff --git a/desktop/source/lib/lokclipboard.hxx b/desktop/source/lib/lokclipboard.hxx
index 5da8b3e2b63e..d917a377eb11 100644
--- a/desktop/source/lib/lokclipboard.hxx
+++ b/desktop/source/lib/lokclipboard.hxx
@@ -11,24 +11,60 @@
 #define INCLUDED_DESKTOP_SOURCE_LIB_LOKCLIPBOARD_HXX
 
 #include <vector>
+#include <unordered_map>
 
+#include <rtl/ref.hxx>
 #include <cppuhelper/implbase.hxx>
-#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <comphelper/sequence.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/datatransfer/clipboard/XSystemClipboard.hpp>
+
+using namespace css::uno;
 
 /// A clipboard implementation for LibreOfficeKit.
-class LOKClipboard : public cppu::WeakImplHelper<css::datatransfer::clipboard::XClipboard>
+class LOKClipboard
+    : public cppu::WeakComponentImplHelper<css::datatransfer::clipboard::XSystemClipboard,
+                                           css::lang::XServiceInfo>
 {
-    css::uno::Reference<css::datatransfer::XTransferable> m_xTransferable;
+    osl::Mutex m_aMutex;
+    css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner> m_aOwner;
+    std::vector<css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>> m_aListeners;
 
 public:
-    css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL getContents() override;
+    LOKClipboard();
+
+    /// get an XInterface easily.
+    css::uno::Reference<css::uno::XInterface> getXI()
+    {
+        return css::uno::Reference<css::uno::XInterface>(static_cast<cppu::OWeakObject*>(this));
+    }
+
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName() override;
+    virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
+    virtual Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+    static Sequence<OUString> getSupportedServiceNames_static();
 
+    // XClipboard
+    css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL getContents() override;
     void SAL_CALL setContents(
         const css::uno::Reference<css::datatransfer::XTransferable>& xTransferable,
         const css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner>& xClipboardOwner)
         override;
+    OUString SAL_CALL getName() override { return OUString("CLIPBOARD"); }
+
+    // XClipboardEx
+    sal_Int8 SAL_CALL getRenderingCapabilities() override { return 0; }
 
-    OUString SAL_CALL getName() override;
+    // XClipboardNotifier
+    void SAL_CALL addClipboardListener(
+        const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener)
+        override;
+    void SAL_CALL removeClipboardListener(
+        const css::uno::Reference<css::datatransfer::clipboard::XClipboardListener>& listener)
+        override;
 };
 
 /// Represents the contents of LOKClipboard.
@@ -38,10 +74,8 @@ class LOKTransferable : public cppu::WeakImplHelper<css::datatransfer::XTransfer
     std::vector<css::uno::Any> m_aContent;
 
 public:
-    LOKTransferable(const size_t   nInCount,
-                    const char   **pInMimeTypes,
-                    const size_t  *pInSizes,
-                    const char   **pInStreams);
+    LOKTransferable(const size_t nInCount, const char** pInMimeTypes, const size_t* pInSizes,
+                    const char** pInStreams);
 
     css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor& rFlavor) override;
 
@@ -50,6 +84,27 @@ public:
     sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor) override;
 };
 
+/// Theoretically to hook into the (horrible) vcl dtranscomp.cxx code.
+class LOKClipboardFactory : public ::cppu::WeakComponentImplHelper<css::lang::XSingleServiceFactory>
+{
+    static osl::Mutex gMutex;
+    static std::unordered_map<int, rtl::Reference<LOKClipboard>> gClipboards;
+
+public:
+    LOKClipboardFactory()
+        : cppu::WeakComponentImplHelper<css::lang::XSingleServiceFactory>(gMutex)
+    {
+    }
+
+    css::uno::Reference<css::uno::XInterface> SAL_CALL createInstance() override
+    {
+        return createInstanceWithArguments(css::uno::Sequence<css::uno::Any>());
+    }
+    css::uno::Reference<css::uno::XInterface> SAL_CALL
+    createInstanceWithArguments(const css::uno::Sequence<css::uno::Any>& /* rArgs */) override;
+    static rtl::Reference<LOKClipboard> getClipboardForCurView();
+};
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index abdc9863c1f0..93b430f5da0b 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -390,8 +390,8 @@ struct _LibreOfficeKitDocumentClass
                           const int width, const int height);
 
     /// Pass a nullptr terminated array of mime-type strings
-    /// @see lok::Document::getSelection for more details
-    int (*getSelection) (LibreOfficeKitDocument* pThis,
+    /// @see lok::Document::getClipboard for more details
+    int (*getClipboard) (LibreOfficeKitDocument* pThis,
                          const char **pMimeTypes,
                          size_t      *pOutCount,
                          char      ***pOutMimeTypes,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index f38d2b5109f6..bd6609c321a4 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -362,7 +362,7 @@ public:
     }
 
     /**
-     * Gets the selected content for the current view as a series of binary streams.
+     * Gets the content on the clipboard for the current view as a series of binary streams.
      *
      * NB. returns a complete set of possible selection types if nullptr is passed for pMimeTypes.
      *
@@ -374,13 +374,13 @@ public:
      *
      * @returns: true on success, false on error.
      */
-    bool getSelection(const char **pMimeTypes,
+    bool getClipboard(const char **pMimeTypes,
                       size_t      *pOutCount,
                       char      ***pOutMimeTypes,
                       size_t     **pOutSizes,
                       char      ***pOutStreams)
     {
-        return mpDoc->pClass->getSelection(mpDoc, pMimeTypes, pOutCount, pOutMimeTypes, pOutSizes, pOutStreams);
+        return mpDoc->pClass->getClipboard(mpDoc, pMimeTypes, pOutCount, pOutMimeTypes, pOutSizes, pOutStreams);
     }
 
     /**
commit 482419ffeab01642db00cd16a2b46a5790a3323e
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Mon Jun 24 10:33:51 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:48 2019 -0400

    build fix: missing #include <ndgrf.hxx>
    
    Change-Id: I72caa16d3c5b5698226cc7d3f07d3d32820032d8

diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index bba11082b6db..54afa80ba7c9 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -55,6 +55,7 @@
 #include <docary.hxx>
 #include <pam.hxx>
 #include <doc.hxx>
+#include <ndgrf.hxx>
 #include <ndtxt.hxx>
 #include <mdiexp.hxx>
 #include <fltini.hxx>
commit 639d9376685c5393bf3c69a414bb96e2ff1408a2
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jun 24 09:24:59 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:47 2019 -0400

    Fix build: unused argument
    
    Change-Id: Id79d9c093da21b9f68bb38a51ac5f142a69364ed

diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index ca0287a6b584..f38d2b5109f6 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -356,7 +356,7 @@ public:
      *
      * @return an element of the LibreOfficeKitSelectionType enum.
      */
-    int getSelectionType(LibreOfficeKitDocument* pThis)
+    int getSelectionType(LibreOfficeKitDocument* /*pThis*/)
     {
         return mpDoc->pClass->getSelectionType(mpDoc);
     }
commit 7e174f327a3cf16a09e4b2f8e2ffba2225c21901
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Jul 19 23:51:16 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Aug 2 11:41:47 2019 -0400

    LOK: Support detecting complex selections
    
    Includes unit-test, but is otherwise not complete
    implementation.
    
    Change-Id: I5fdcd543358caab1858f6351238c21312665839c

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 36e7d727efb0..4ebb21cdfe0a 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -139,6 +139,7 @@ public:
     void testInsertCertificate_PEM_DOCX();
     void testSignDocument_PEM_PDF();
     void testTextSelectionHandles();
+    void testComplexSelection();
     void testDialogPaste();
     void testShowHideDialog();
     void testABI();
@@ -193,6 +194,7 @@ public:
     CPPUNIT_TEST(testSignDocument_PEM_PDF);
 #endif
     CPPUNIT_TEST(testTextSelectionHandles);
+    CPPUNIT_TEST(testComplexSelection);
     CPPUNIT_TEST(testDialogPaste);
     CPPUNIT_TEST(testShowHideDialog);
     CPPUNIT_TEST(testABI);
@@ -586,7 +588,7 @@ void DesktopLOKTest::testPasteWriter()
     free(pText);
 
     // textt/plain should be rejected.
-    CPPUNIT_ASSERT(!pDocument->pClass->paste(pDocument, "textt/plain;charset=utf-8", aText.getStr(), aText.getLength()));
+    CPPUNIT_ASSERT(!pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength()));
     // Writer is expected to support text/html.
     CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/html", aText.getStr(), aText.getLength()));
 
@@ -2637,6 +2639,52 @@ void DesktopLOKTest::testShowHideDialog()
     CPPUNIT_ASSERT_EQUAL(std::string("invalidate"), aView.m_aCallbackWindowResult.get<std::string>("action"));
 }
 
+void DesktopLOKTest::testComplexSelection()
+{
+    // Start with a blank text file and add contents.
+    LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+    // LibLODocument_Impl* pDocument = loadDoc("sheet_with_image.ods");
+    static const OString aText("hello world");
+
+    // Paste text.
+    CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength()));
+
+    // Paste an image.
+    OUString aFileURL;
+    createFileURL("paste.jpg", aFileURL);
+    std::ifstream aImageStream(aFileURL.toUtf8().copy(strlen("file://")).getStr());
+    std::vector<char> aImageContents((std::istreambuf_iterator<char>(aImageStream)), std::istreambuf_iterator<char>());
+    CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "image/jpeg", aImageContents.data(), aImageContents.size()));
+
+    // Now select-all.
+    pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false);
+    Scheduler::ProcessEventsToIdle();
+
+    // We expect this to be complex.
+    const int type = pDocument->pClass->getSelectionType(pDocument);
+    CPPUNIT_ASSERT_EQUAL((int)LOK_SELTYPE_COMPLEX, type);
+
+    // Export as plain text, we should get only the text part "hello".
+    char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr);
+    CPPUNIT_ASSERT(pText != nullptr);
+    CPPUNIT_ASSERT_EQUAL(aText, OString(pText));
+    free(pText);
+
+    // Export as rtf, we should also get the image.
+    pText = pDocument->pClass->getTextSelection(pDocument, "text/rtf", nullptr);
+    CPPUNIT_ASSERT(pText != nullptr);
+    CPPUNIT_ASSERT(std::string(pText).find(aText.getStr()) != std::string::npos); // Must have the text.
+    CPPUNIT_ASSERT(std::string(pText).find("pict{") != std::string::npos); // Must have the image as well.
+    free(pText);
+
+    // Export as html, we should also get the image.
+    pText = pDocument->pClass->getTextSelection(pDocument, "text/html", nullptr);
+    CPPUNIT_ASSERT(pText != nullptr);
+    CPPUNIT_ASSERT(std::string(pText).find(aText.getStr()) != std::string::npos); // Must have the text.
+    // CPPUNIT_ASSERT(std::string(pText).find("<img") != std::string::npos); // Must have the image as well.
+    free(pText);
+}
+
 namespace {
 
 constexpr size_t classOffset(int i)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3b835c0d66b8..eb9c7854bc13 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -78,6 +78,7 @@
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
 #include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp>
+#include <com/sun/star/datatransfer/XTransferable2.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/document/XRedlinesSupplier.hpp>
 #include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
@@ -788,6 +789,7 @@ static void doc_setTextSelection (LibreOfficeKitDocument* pThis,
 static char* doc_getTextSelection(LibreOfficeKitDocument* pThis,
                                   const char* pMimeType,
                                   char** pUsedMimeType);
+static int doc_getSelectionType(LibreOfficeKitDocument* pThis);
 static int doc_getSelection (LibreOfficeKitDocument* pThis,
                              const char **pMimeTypes,
                              size_t      *pOutCount,
@@ -898,6 +900,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         m_pDocumentClass->postUnoCommand = doc_postUnoCommand;
         m_pDocumentClass->setTextSelection = doc_setTextSelection;
         m_pDocumentClass->getTextSelection = doc_getTextSelection;
+        m_pDocumentClass->getSelectionType = doc_getSelectionType;
         m_pDocumentClass->getSelection = doc_getSelection;
         m_pDocumentClass->setClipboard = doc_setClipboard;
         m_pDocumentClass->paste = doc_paste;
@@ -3499,6 +3502,39 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMi
     return convertOString(aRet);
 }
 
+static int doc_getSelectionType(LibreOfficeKitDocument* pThis)
+{
+    SolarMutexGuard aGuard;
+    SetLastExceptionMsg();
+
+    ITiledRenderable* pDoc = getTiledRenderable(pThis);
+    if (!pDoc)
+    {
+        SetLastExceptionMsg("Document doesn't support tiled rendering");
+        return LOK_SELTYPE_NONE;
+    }
+
+    css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(pDoc->getSelection(), css::uno::UNO_QUERY);
+    if (!xTransferable)
+    {
+        SetLastExceptionMsg("No selection available");
+        return LOK_SELTYPE_NONE;
+    }
+
+    if (xTransferable->isComplex())
+        return LOK_SELTYPE_COMPLEX;
+
+    OString aRet;
+    bool bSuccess = getFromTransferrable(xTransferable, OString("text/plain;charset=utf-8"), aRet);
+    if (!bSuccess)
+        return LOK_SELTYPE_NONE;
+
+    if (aRet.getLength() > 1000) // About 2 paragraphs.
+        return LOK_SELTYPE_COMPLEX;
+
+    return aRet.getLength() ? LOK_SELTYPE_TEXT : LOK_SELTYPE_NONE;
+}
+
 static int doc_getSelection(LibreOfficeKitDocument* pThis,
                             const char **pMimeTypes,
                             size_t      *pOutCount,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 14b7bb995b10..abdc9863c1f0 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -405,6 +405,9 @@ struct _LibreOfficeKitDocumentClass
                          const size_t  *pInSizes,
                          const char   **pInStreams);
 
+    /// @see lok::Document::getSelectionType
+    int (*getSelectionType) (LibreOfficeKitDocument* pThis);
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index cb1ca1e4c2d3..ca0287a6b584 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -352,6 +352,16 @@ public:
     }
 
     /**
+     * Gets the type of the selected content.
+     *
+     * @return an element of the LibreOfficeKitSelectionType enum.
+     */
+    int getSelectionType(LibreOfficeKitDocument* pThis)
+    {
+        return mpDoc->pClass->getSelectionType(mpDoc);
+    }
+
+    /**
      * Gets the selected content for the current view as a series of binary streams.
      *
      * NB. returns a complete set of possible selection types if nullptr is passed for pMimeTypes.
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list