Created attachment 82204 [details] A working example macro in an odt. (Noel, Joel Madero asked that I cc you when I contacted him via #libreoffice-qa) The example code from Andrew Pitonyak (listed below) has stopped working in the 4.1 series of LO. It works for me in 4.0.4. I copied the basic code and pasted it into a Writer Doc in order find the reason why. It now works with standard text from gedit but not with any text/numeric combo from Calc . Download the document or create your own pasting in the code below. Open the clipboardAPI.odt Writer document. Open a blank calc doc and enter this data in a 2x2 grid, 1 character in a cell. A B 1 2 Select the 4 cells, then ctrl+c or copy from Edit Menu Select the ClipboardAPI.odt Writer document and open the Macro Selector (Tools-Macros-Run Macro...) Click on ClipboardAPI.odt, then underneath that Standard, and again until the Macro Name column choose 'clipboardAPI' Under 4.0.2.2 a dialog box appears containing (whitespace may differ): A B 1 2 Under 4.1.0.2 Nothing happens, but if you Shift+Ctrl+V or 'Paste Special', you still get various options and you can paste them O.K Under 4.1.0.2, oClipContents.getTransferDataFlavors() returns an empty array in Xray and the Watch window shows nothing.
I have confirmed this one on 4.1 RC1 as well as Master Major + High as it's a regression and breaks at least one extension
Normally these 'api' issues are nothing to do with basic, this case is no different. There is certainly something odd going on with the Clipboard stuff :-/ Not at all sure what the correct component for this bug should be even :-) Anyway, since I have started to debug it hopefully I can find what is wrong
Noel Power committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=942501b6e49c6c9e19556d9ec132a458e5fef6c3 fix for fdo#66718, access correct clipboard The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
(In reply to comment #0) > The example code from Andrew Pitonyak (listed below) has stopped working in > the 4.1 series of LO. It works for me in 4.0.4. > I copied the basic code and pasted it into a Writer Doc in order find the > reason why. It now works with standard text from gedit but not with any > text/numeric combo from Calc . > > Download the document or create your own pasting in the code below. For easier reference, the macro code in attachment 82204 [details] is: > Sub ViewClipBoard > Dim oClip, oClipContents, oTypes > Dim oConverter, convertedString$ > Dim i%, iPlainLoc% > iPlainLoc = -1 > Dim s$ : s$ = "com.sun.star.datatransfer.clipboard.SystemClipboard" > oClip = createUnoService(s$) > oConverter = createUnoService("com.sun.star.script.Converter") > 'Print "Clipboard name = " & oClip.getName() > 'Print "Implemantation name = " & oClip.getImplementationName() > oClipContents = oClip.getContents() > oTypes = oClipContents.getTransferDataFlavors() > Dim msg$, iLoc%, outS > msg = "" > iLoc = -1 > For i=LBound(oTypes) To UBound(oTypes) > If oTypes(i).MimeType = "text/plain;charset=utf-16" Then > iPlainLoc = i > Exit For > End If > 'msg = msg & "Mime type = " & x(ii).MimeType & " normal = " & x(ii).HumanPresentableName & Chr$(10) > Next > If (iPlainLoc >= 0) Then > convertedString = oConverter.convertToSimpleType( _ > oClipContents.getTransferData(oTypes(iPlainLoc)), _ > com.sun.star.uno.TypeClass.STRING) > MsgBox convertedString > End If > End Sub
Noel Power committed a patch related to this issue. It has been pushed to "libreoffice-4-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=35208d62e32ee0a7aeacfe2f577b68c9dcb40671&h=libreoffice-4-1 fix for fdo#66718, access correct clipboard It will be available in LibreOffice 4.1.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
stephan I think you are correct that xInit is redundant, I guess createDefault & createUnix ( and the XInit processing ) can all go. I can do that, ok for you ??
(In reply to comment #6) > stephan I think you are correct that xInit is redundant, I guess > createDefault & createUnix ( and the XInit processing ) can all go. I can do > that, ok for you ?? hah just looked at this again, XInitialization is not even part of the class hierarchy anymore ( I guess since the new service definition change ) And previous to that like you said X11Clipboard::initialize had no implementation )
Looking deeper, the com.sun.star.datatransfer.clipboard.SystemClipboard service has only ever been instantiated in two different modes for X11: (1) To access "the clipboard," i.e., the "CLIPBOARD" selection on $DISPLAY. In the past, this had always been done via a no-arguments createInstance("...SystemClipboard") (and the subsequent call to initialize in Window::GetClipboard, vcl/soruce/window/window.cxx, passing in those default arguments again, served no purpose, as X11Clipbard::initialize, vcl/unx/generic/dtrans/X11_clipboard.cxx, is empty). Since <http://cgit.freedesktop.org/libreoffice/core/commit/?id=2fe852386c9450014f84910b0a282d684f40b56a> "fdo#46808, Adapt SystemClipboard UNO service to new style," this is either done via SystemClipboard::createUnix explicitly passing in the default $DISPLAY and "CLIPBOARD" arguments (in Window::GetClipboard, vcl/source/window/window.cxx; referenced as case A below), or via SystemClipboard::createDefault (or even a good-old no-arguments createInstance("...SystemClipboard") like in the past) implicitly using the default $DISPLAY and "CLIPBOARD" arguments (referenced as base B below). (2) As a special hack, in Window::GetPrimarySelection (vcl/source/window/window.cxx), to access "the primary selection," i.e., the "PRIMARY" selection on $DISPLAY. (In the past, this had been done via createInstanceWithArguments, now with SystemClipboard::createUnix, in each case passing in $DISPLAY and "PRIMARY" as arguments.) What ultimately caused the regression described in this bug is the code in X11SalInstance::CreateClipboard (vcl/unx/generic/dtrans/X11_service.cxx) that calls SelectionManager::get(aDisplayName) with aDisplayName either being $DISPLAY (case A above) or empty (case B above), where in the latter case SelectionManager::get internally completes it to aDisplayName = $DISPLAY. However, X11SalInstance::CreateClipboard uses the unchanged aDisplayName a few lines later as an index into its own m_aInstances map, so even though case A and B obtain the same SelectionManager instance from SelectionManger::get(aDisplayName) they result in different X11Clipboard instances returned from X11SalInstance::CreateClipboard. What (1) and (2) demonstrate is that the introduction of the three-argument createUnix new-style service constructor in <http://cgit.freedesktop.org/libreoffice/core/commit/?id=2fe852386c9450014f84910b0a282d684f40b56a> "fdo#46808, Adapt SystemClipboard UNO service to new style" towards LO 4.1 was actually overkill and promotes a hack (in the internals of Window::GetPrimarySelection) to a stable API feature. Therefore, I suggest to revert 2fe852386c9450014f84910b0a282d684f40b56a for LO 4.1 again (which will fix this bug and make the previous fix, comment 3 and comment 5, obsolete) and re-introduce it @since LO 4.2 with only a default new-style service constructor (keeping the use of createInstanceWithArguments for the hack in Window::GetPrimarySelection).
Stephan Bergmann committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=9579db98d87c13977bd3a907f3560d564d5d9302 Revert "fix for fdo#66718, access correct clipboard" The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Stephan Bergmann committed a patch related to this issue. It has been pushed to "libreoffice-4-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=f19b16e0b0aba67c355010271a81cfe5420fab93&h=libreoffice-4-1 Revert "fix for fdo#66718, access correct clipboard" It will be available in LibreOffice 4.1.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Stephan Bergmann committed a patch related to this issue. It has been pushed to "libreoffice-4-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=60455c972b09ca02b18660c6fb3dafc03b30b2b5&h=libreoffice-4-1 fdo#66718: Revert "fdo#46808, Adapt SystemClipboard UNO service to new style" It will be available in LibreOffice 4.1.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
(In reply to comment #11) > Stephan Bergmann committed a patch related to this issue. > It has been pushed to "libreoffice-4-1": > > http://cgit.freedesktop.org/libreoffice/core/commit/ > ?id=60455c972b09ca02b18660c6fb3dafc03b30b2b5&h=libreoffice-4-1 > > fdo#66718: Revert "fdo#46808, Adapt SystemClipboard UNO service to new style" > > > It will be available in LibreOffice 4.1.1. requested backport to libreoffice-4-1-0 at <https://gerrit.libreoffice.org/#/c/4817/>
Stephan Bergmann committed a patch related to this issue. It has been pushed to "libreoffice-4-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=bd115a62bb3d1b741a035ace9d9c2608acd95c47&h=libreoffice-4-1 fdo#66718: Remove XSystemClipboard from reference rdb again It will be available in LibreOffice 4.1.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Stephan Bergmann committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=73cdc655fb16fa229324d66eba01f0a3262314a4 fdo#66718: Demote SystemClipboard.createUnix to an internal hack The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Stephan Bergmann committed a patch related to this issue. It has been pushed to "libreoffice-4-1-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=948dc44712f41c6a12342e4f44e0f2039f62744b&h=libreoffice-4-1-0 fdo#66718: Revert "fdo#46808, Adapt SystemClipboard UNO service to new style" It will be available already in LibreOffice 4.1.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.