Issue 107734 - Support for Math Input Panel in Windows 7
Summary: Support for Math Input Panel in Windows 7
Alias: None
Product: Math
Classification: Application
Component: ui (show other issues)
Version: recent-trunk
Hardware: PC Windows 7
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2009-12-16 22:14 UTC by speedstone
Modified: 2017-05-20 10:45 UTC (History)
5 users (show)

See Also:
Latest Confirmation in: ---
Developer Difficulty: ---

not yet ready, but can be tested (10.43 KB, patch)
2015-06-26 23:09 UTC, Regina Henschel
no flags Details | Diff
improved encoding handling (10.90 KB, patch)
2015-06-30 10:14 UTC, Regina Henschel
no flags Details | Diff
Version including changes to the help (18.50 KB, patch)
2015-07-02 09:59 UTC, Regina Henschel
rb.henschel: review?
Details | Diff
Now without the part ;windows_formatname=\"MathML\" (49.67 KB, patch)
2015-07-05 15:48 UTC, Regina Henschel
rb.henschel: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description speedstone 2009-12-16 22:14:25 UTC
Windows 7 has a cool little tool for easy input of math formulas: Math Input
Panel. It would be great if OpenOffice worked with it. MIP simply puts MathML
objects in clipboard, so retrieving formulas this way shouldn't be that hard.
Comment 1 michael.ruess 2010-01-04 09:13:08 UTC
Reassigned to requirements.
Comment 2 Rainer Bielefeld 2013-06-08 06:02:47 UTC
Can your solve your problem with the hint on <>?
Comment 3 Rainer Bielefeld 2013-06-28 17:49:13 UTC
Closing issue due to reporter's inactivity.

Please feel free to reopen this issue if you find out that the problem still exists in the latest release of AOO and if hints in forum did not help you.
Comment 4 Regina Henschel 2015-04-08 17:38:34 UTC
The Math Input Panel put varies kinds of MathML into the clipboard. It is a missing feature in AOO, that it cannot be inserted from Clipboard, but Math module can only import MathML via Tools > Import. I think, that "Wontfix" is wrong for a missing feature. If a volunteer wants to implement such feature, that would be OK.

The problem is not only with the output of the Math Input Panel, but it is a general problem, that clipboard content can only be inserted as plain text, but a "paste special" for interpreting the content as MathML before inserting it, is missing.

(In reply to Rainer Bielefeld from comment #3)
> Closing issue due to reporter's inactivity.
> @reporter:
> Please feel free to reopen this issue if you find out that the problem still
> exists in the latest release of AOO and if hints in forum did not help you.

The suggestions in the thread does not solve the problem.
Comment 5 Regina Henschel 2015-06-14 12:45:30 UTC
I'm working on it.
Comment 6 Regina Henschel 2015-06-26 23:09:24 UTC
Created attachment 84808 [details]
not yet ready, but can be tested

The patch adds a new item "Import MathML from Clipboard" to the menu Tools in module Math. If the clipboard has suitable content, for example form the Math Input Panel, then it is converted to StarMath and inserted. If the parser cannot handle the content, then nothing is inserted.
The patch needs to be examined by an experienced developer.

Please look for coding errors.

Please look at the parts in smslots.sdi and in smath.sdi. I have mimic, what I have seen there, but do not really know, what those parts mean. Help and explanations would be nice.

I have tested this on Windows 7, but I have no environment to test on Linux or Mac. They have different kind of clipboards, and I do not know, what will happen there.
Comment 7 Regina Henschel 2015-06-28 18:23:44 UTC
I have found

This information requires a revision of the changes in smath.sdi and smslots.sdi.
Comment 8 Regina Henschel 2015-06-30 10:14:39 UTC
Created attachment 84809 [details]
improved encoding handling

Import from clipboard via item in menu should work now.
I have not yet tested, to use the new .uno command with the dispatcher in a macro.
Comment 9 Regina Henschel 2015-07-02 09:59:27 UTC
Created attachment 84813 [details]
Version including changes to the help

The attached version works fine for me for Windows. But I have no environment for Linux or Mac. It is important to test it for Linux and Mac, because their clipboard works different from the Windows clipboard. So please, if you have such environment, test the patch.

If the clipboard has a content of MIME type "application/mathml+xml" or has a text, which is a MathML source, then the new item "Import MathML form Clipboard" in menu Tools should import it. The result might not be nice or correct, but that is a different problem. If the content cannot be transformed to StarMath, nothing is added to the command window and no error message should appear.

On Windows the "Math Input Panel", or MS Word, or the application MathCast produce such clipboard content. I do not know, whether similar application exist on Linux or Mac. Or you copy such content from a Website, or open a .mml file in an editor and copy the source. For Windows there exists the free clipboard viewer "FreeClipViewer" to see the clipboard content. Perhaps similar application exists for Linux or Mac?

Please examine the patch and report back. If nobody objects, I'll commit the patch after five days.
Comment 10 hanya 2015-07-03 13:13:07 UTC
It worked on Linux environment, Xubuntu 14.04. 
I used the following to generate mathml.
Push "Copy MML" button on the left bottom corner of the window to copy the formula as MathML.
Importing from the text contains MathML comming from the clipboard worked. 

But I could not find the application which push MathML into the clipboard on Linux environment now.
So I tried to make one using pyGtk. 
First I tried to use the following mime-type for MathML: "application/mathml+xml".
But it did not work with the mime-type. I needed to change it like: 
Since the function works well with plain text, its not large problem.
Here is the code to push MathML data to clipboard using pyGtk. 
Thanks for the work.

The following code require pyGtk.

import pygtk
import gtk

clipboard = gtk.clipboard_get()

TEXT_MIME_TYPE = 'text/plain;charset=utf-8'
MATHML_MIME_TYPE = 'application/mathml+xml;windows_formatname=\"MathML\"'

targets = (
    (TEXT_MIME_TYPE, 0, 0), 
    (MATHML_MIME_TYPE, 0, 1),

mathml_content = """<math xmlns="">

def get_func(clipboard, selectiondata, info, user_data):
    print("get_func, info: " + str(info))
    if info == 0:
    elif info == 1:
        selectiondata.set(MATHML_MIME_TYPE, 8, mathml_content)

def clear_func(clipboard, user_data):

clipboard.set_with_data(targets, get_func, clear_func, None)

# create dummy window
class MainWindow(gtk.Window):
    def __init__(self, *args, **kwargs):
        gtk.Window.__init__(self, *args, **kwargs)

class App:
    def main(self):
        win = MainWindow()

Comment 11 Regina Henschel 2015-07-03 19:35:30 UTC
Thank you for looking at it. I will test, whether it still works on Windows when I remove the part
Comment 12 hanya 2015-07-05 13:32:57 UTC
From reading the last section of the following page,
> Each private MimeType has a parameter "windows_formatname" identifying the clipboard format name used under Windows. 

The mime-type for MathML is Iana registered one. So it might not need "windows_formatname" in SOT_FORMATSTR_ID_MATHML definition. But I'm not really sure it is.
Comment 13 Regina Henschel 2015-07-05 15:48:23 UTC
Created attachment 84816 [details]
Now without the part ;windows_formatname=\"MathML\"

I have removed the part ;windows_formatname=\"MathML\".

The code has a line with a dummy entry and I followed that schema. But perhaps that was only needed for older Windows versions.

The attached patch has a lot of whitespace changes, please ignore them. I'll remove them on the final submit. The attached patch replaces the old patch and is not on top of it. So first revert the old one before applying the current.

It would be nice, if you can test it again on Linux.
Comment 14 hanya 2015-07-05 16:12:43 UTC
After the new patch, both text based and MathML worked well on Xubuntu 14.04 and Xfce.
The code in Comment 10 can be like now: 
MATHML_MIME_TYPE = 'application/mathml+xml'
Comment 15 SVN Robot 2015-07-08 12:31:44 UTC
"regina" committed SVN revision 1689859 into trunk:
#i107734 Support for Math Input Panel in Windows 7
Comment 16 Marcus 2017-05-20 10:45:21 UTC
Reset the assignee to the default "".