This file is indexed.

/usr/lib/libreoffice/share/extensions/DmathsAddon/CmathOOo/mTextToClipboard.xba is in libreoffice-dmaths 3.4+dfsg1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="mTextToClipboard" script:language="StarBasic">REM  *****  BASIC  *****

&apos;####################################################################
&apos; les procedures ci-dessous (et de nombreuses autres) sont proposées 
&apos; sur oooForum.org par DannyB
&apos;####################################################################
&apos;
&apos; Given a string of text, put that text into the clipboard.
&apos; This works by...
&apos;   1. Invisibly create a new Writer document
&apos;   2. Insert text into that document.
&apos;   3. Select All
&apos;   4. Copy
&apos;   5. Close the invisible writer document.
&apos; So what ends up in the clipboard can be pasted to an external
&apos;  program as Text.  But the clipboard contains additional information
&apos;  about the text, such as whatever default font and style it had in
&apos;  the temporary Writer document.
&apos;
Sub TextToClipboard( ByVal cText As String )
   dim oDoc
   dim oText
   dim oCursor
   
   oDoc = StarDesktop.loadComponentFromURL( &quot;private:factory/swriter&quot;, &quot;_blank&quot;, 0,_
          Array( MakePropertyValue( &quot;Hidden&quot;, True ) ) )

   &apos; Get the text of the document.
   oText = oDoc.getText()
   &apos; Get a cursor that can move over or to any part of the text.
   oCursor = oText.createTextCursor()
   
   &apos; Insert text and paragraph breaks into the text, at the cursor position.
   oText.insertString( oCursor, cText, False )
   
   SelectAll( oDoc )
   ClipboardCopy( oDoc )
   
   oDoc.close( True )
End Sub

&apos;----------
&apos; This will always return the document&apos;s frame.
&apos; Pass in any one of...
&apos;   * the document&apos;s model (subclass of com.sun.star.document.OfficeDocument)
&apos;   * the document&apos;s controller
&apos;   * the document&apos;s frame
Function GetDocumentFrame( oDoc As Object ) As Object
   Dim oFrame As Object
   Dim oCtrl As Object
   
   &apos; If the caller gave us the document model...
   If oDoc.supportsService( &quot;com.sun.star.document.OfficeDocument&quot; ) Then
      &apos; ...then get the controller from that.
      oCtrl = oDoc.getCurrentController()
      &apos; ...then get the frame from the controller.
      oFrame = oCtrl.getFrame()

   &apos; If the caller gave us a document controller...
   ElseIf HasUnoInterfaces( oDoc, &quot;com.sun.star.frame.XController&quot; ) Then
      oCtrl = oDoc
      &apos; ...then get the frame from the controller.
      oFrame = oCtrl.getFrame()
   
   &apos; If the caller gave us the document frame...
   ElseIf HasUnoInterfaces( oDoc, &quot;com.sun.star.frame.XFrame&quot; ) Then
      &apos; ...thanks!  That&apos;s just what we wanted!
      oFrame = oDoc
   
   Else
      &apos; The caller did not give us what we expected!
      MsgBox( &quot;GetDocumentFrame called with incorrect parameter.&quot; )
   EndIf
   
   GetDocumentFrame() = oFrame
End Function

&apos;----------
&apos;   Create and return a new com.sun.star.beans.PropertyValue.
&apos;
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
   Dim oPropertyValue As New com.sun.star.beans.PropertyValue
   If Not IsMissing( cName ) Then
      oPropertyValue.Name = cName
   EndIf
   If Not IsMissing( uValue ) Then
      oPropertyValue.Value = uValue
   EndIf
   MakePropertyValue() = oPropertyValue
End Function

Sub SelectAll( oDocumentFrame )
   DocumentDispatch( oDocumentFrame, &quot;.uno:SelectAll&quot; )
&apos;   DocumentDispatch( oDocumentFrame, &quot;slot:5723&quot; )
End Sub

&apos;----------
&apos; An easy to use Dispatch on an office document.
&apos; Arguments are similar to the args for the com.sun.star.frame.XDispatchHelper
&apos;  interface of com.sun.star.frame.DispatchHelper.
&apos; What makes this so easy to use are two things:
&apos;   1. The fact that the oDocumentFrame parameter can actually accept
&apos;      either the document model or one of its controllers.
&apos;   2. The optional parameters.
&apos; For an example of how simple this routine is to use, see
&apos;  routines such as ClipboardCopy().
&apos;
&apos; Parameters:
&apos;      oDocumentFrame      -   An office document frame.
&apos;                        But wait!  It could be the document controller
&apos;                         or the document model.  This routine will find
&apos;                         the document frame from either of these.
&apos;      cURL            -   The dispatch URL.
&apos; Optional:
&apos;      cTargetFrameName   -   Defaults to blank.
&apos;      nSearchFlags      -   Defaults to zero.
&apos;      aDispatchArgs      -   Defaults an an empty sequence.
&apos;
Sub DocumentDispatch( ByVal oDocumentFrame As Object,_
                  ByVal cURL As String,_
                  Optional cTargetFrameName,_
                  Optional nSearchFlags,_
                  Optional aDispatchArgs )

   dim oDispatchHelper   

   &apos; If they gave us the wrong parameter...
   If Not HasUnoInterfaces( oDocumentFrame, &quot;com.sun.star.frame.XFrame&quot; ) Then
      &apos; Be sure that we&apos;ve got the document frame.
      &apos; Someone might have passed us the document model or one of
      &apos;  its controller&apos;s.
      oDocumentFrame = GetDocumentFrame( oDocumentFrame )
   EndIf
   
   If IsMissing( cTargetFrameName ) Then
      cTargetFrameName = &quot;&quot;
   EndIf
   If IsMissing( nSearchFlags ) Then
      nSearchFlags = 0
   EndIf
   If IsMissing( aDispatchArgs ) Then
      aDispatchArgs = Array()
   EndIf
   
   oDispatchHelper = createUnoService( &quot;com.sun.star.frame.DispatchHelper&quot; )
   oDispatchHelper.executeDispatch( oDocumentFrame, cURL, cTargetFrameName, nSearchFlags, aDispatchArgs )
End Sub

&apos;############################################################
&apos;   Clipboard manipulation
&apos;############################################################

Sub ClipboardPaste( oDocumentFrame )
   DocumentDispatch( oDocumentFrame, &quot;.uno:Paste&quot; )
End Sub

Sub ClipboardCopy( oDocumentFrame )
   DocumentDispatch( oDocumentFrame, &quot;.uno:Copy&quot; )
End Sub

Sub ClipboardCut( oDocumentFrame )
   DocumentDispatch( oDocumentFrame, &quot;.uno:Cut&quot; )
End Sub
</script:module>