View | Details | Raw Unified | Return to issue 107734
Collapse All | Expand All

(-)a/main/dtrans/source/win32/ftransl/ftransl.cxx (+2 lines)
Lines 516-521 void SAL_CALL CDataFormatTranslator::initTranslationTable() Link Here
516
	m_TranslTable.push_back(FormatEntry("image/bmp", "Windows Bitmap", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
516
	m_TranslTable.push_back(FormatEntry("image/bmp", "Windows Bitmap", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
517
	//SOT_FORMATSTR_ID_PNG
517
	//SOT_FORMATSTR_ID_PNG
518
	m_TranslTable.push_back(FormatEntry("image/png", "PNG", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
518
	m_TranslTable.push_back(FormatEntry("image/png", "PNG", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
519
    //SOT_FORMATSTR_ID_MATHML
520
    m_TranslTable.push_back(FormatEntry("application/mathml+xml;windows_formatname=\"MathML\"", "MathML", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
519
	//SOT_FORMATSTR_ID_DUMMY3
521
	//SOT_FORMATSTR_ID_DUMMY3
520
	m_TranslTable.push_back(FormatEntry("application/x-openoffice-dummy3;windows_formatname=\"SO_DUMMYFORMAT_3\"", "SO_DUMMYFORMAT_3", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
522
	m_TranslTable.push_back(FormatEntry("application/x-openoffice-dummy3;windows_formatname=\"SO_DUMMYFORMAT_3\"", "SO_DUMMYFORMAT_3", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
521
	//SOT_FORMATSTR_ID_DUMMY4
523
	//SOT_FORMATSTR_ID_DUMMY4
(-)a/main/officecfg/registry/data/org/openoffice/Office/UI/MathCommands.xcu (+5 lines)
Lines 77-82 Link Here
77
                    <value xml:lang="en-US">~Import Formula...</value>
77
                    <value xml:lang="en-US">~Import Formula...</value>
78
                </prop>
78
                </prop>
79
            </node>
79
            </node>
80
            <node oor:name=".uno:ImportMathMLClipboard" oor:op="replace">
81
                <prop oor:name="Label" oor:type="xs:string">
82
                    <value xml:lang="en-US">Import MathML from Clipboard</value>
83
                </prop>
84
            </node>
80
            <node oor:name=".uno:InsertCommand" oor:op="replace">
85
            <node oor:name=".uno:InsertCommand" oor:op="replace">
81
                <prop oor:name="Label" oor:type="xs:string">
86
                <prop oor:name="Label" oor:type="xs:string">
82
                    <value xml:lang="en-US">Insert Command</value>
87
                    <value xml:lang="en-US">Insert Command</value>
(-)a/main/sot/inc/sot/formats.hxx (-1 / +2 lines)
Lines 182-188 Link Here
182
#define SOT_FORMATSTR_ID_STARBASE_8             ((sal_uLong)139)
182
#define SOT_FORMATSTR_ID_STARBASE_8             ((sal_uLong)139)
183
#define SOT_FORMATSTR_ID_HC_GDIMETAFILE         ((sal_uLong)140)
183
#define SOT_FORMATSTR_ID_HC_GDIMETAFILE         ((sal_uLong)140)
184
#define SOT_FORMATSTR_ID_PNG                    ((sal_uLong)141)
184
#define SOT_FORMATSTR_ID_PNG                    ((sal_uLong)141)
185
#define SOT_FORMATSTR_ID_USER_END               SOT_FORMATSTR_ID_PNG
185
#define SOT_FORMATSTR_ID_MATHML                 ((sal_uLong)142)
186
#define SOT_FORMATSTR_ID_USER_END               SOT_FORMATSTR_ID_MATHML
186
187
187
#endif // _SOT_FORMATS_HXX
188
#endif // _SOT_FORMATS_HXX
188
189
(-)a/main/sot/source/base/exchange.cxx (+1 lines)
Lines 208-213 namespace Link Here
208
            /*139 SOT_FORMATSTR_ID_STARBASE_8*/            { MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII, "StarBase 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
208
            /*139 SOT_FORMATSTR_ID_STARBASE_8*/            { MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII, "StarBase 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
209
            /*140 SOT_FORMAT_GDIMETAFILE*/					{ "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"", "High Contrast GDIMetaFile", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
209
            /*140 SOT_FORMAT_GDIMETAFILE*/					{ "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"", "High Contrast GDIMetaFile", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
210
            /*141 SOT_FORMATSTR_ID_PNG*/                    { "image/png", "PNG Bitmap", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
210
            /*141 SOT_FORMATSTR_ID_PNG*/                    { "image/png", "PNG Bitmap", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
211
            /*142 SOT_FORMATSTR_ID_MATHML*/                 { "application/mathml+xml;windows_formatname=\"MathML\"", "MathML", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
211
            };
212
            };
212
	    return &aInstance[0];
213
	    return &aInstance[0];
213
        }
214
        }
(-)a/main/starmath/inc/starmath.hrc (+1 lines)
Lines 52-57 Link Here
52
#define SID_SYMBOLS 				(SID_SMA_START + 56) // Muss erstmal wieder aufgenommen werden !
52
#define SID_SYMBOLS 				(SID_SMA_START + 56) // Muss erstmal wieder aufgenommen werden !
53
#define SID_TEXTMODE 				(SID_SMA_START + 57)
53
#define SID_TEXTMODE 				(SID_SMA_START + 57)
54
#define SID_IMPORT_FORMULA          (SID_SMA_START + 58)
54
#define SID_IMPORT_FORMULA          (SID_SMA_START + 58)
55
#define SID_IMPORT_MATHML_CLIPBOARD (SID_SMA_START + 59)
55
#define SID_TEXT                    (SID_SMA_START + 100)
56
#define SID_TEXT                    (SID_SMA_START + 100)
56
#define SID_GAPHIC_SM               (SID_SMA_START + 101)
57
#define SID_GAPHIC_SM               (SID_SMA_START + 101)
57
#define SID_FITINWINDOW 			(SID_SMA_START + 103)
58
#define SID_FITINWINDOW 			(SID_SMA_START + 103)
(-)a/main/starmath/sdi/smath.sdi (+25 lines)
Lines 424-429 SfxBoolItem ImportFormula SID_IMPORT_FORMULA Link Here
424
]
424
]
425
425
426
//--------------------------------------------------------------------------
426
//--------------------------------------------------------------------------
427
SfxBoolItem ImportMathMLClipboard SID_IMPORT_MATHML_CLIPBOARD
428
(SfxStringItem Name SID_IMPORT_MATHML_CLIPBOARD,SfxStringItem Filter FN_PARAM_1)
429
[
430
	/* flags: */  
431
	AutoUpdate = FALSE, 
432
	Cachable = Cachable, 
433
	FastCall = FALSE, 
434
	HasCoreId = FALSE, 
435
	HasDialog = FALSE, 
436
	ReadOnlyDoc = FALSE, 
437
	Toggle = FALSE, 
438
	Container = FALSE, 
439
	RecordAbsolute = FALSE, 
440
	RecordPerSet;
441
	Asynchron;
442
443
	/* config: */ 
444
	AccelConfig = TRUE, 
445
	MenuConfig = TRUE, 
446
	StatusBarConfig = FALSE, 
447
	ToolBoxConfig = TRUE, 
448
	GroupId = GID_INSERT;
449
]
450
451
//--------------------------------------------------------------------------
427
SfxVoidItem LoadSymbols SID_LOADSYMBOLS
452
SfxVoidItem LoadSymbols SID_LOADSYMBOLS
428
()
453
()
429
[
454
[
(-)a/main/starmath/sdi/smslots.sdi (+6 lines)
Lines 277-282 interface FormulaView Link Here
277
        StateMethod = GetState ;
277
        StateMethod = GetState ;
278
        Export = FALSE ;
278
        Export = FALSE ;
279
    ]
279
    ]
280
    SID_IMPORT_MATHML_CLIPBOARD //idlpp ole : no , status : no
281
    [
282
        ExecMethod = Execute ;
283
        StateMethod = GetState ;
284
        Export = FALSE ;
285
    ]
280
	//idlpp kein Menueeintrag , also keine Texte
286
	//idlpp kein Menueeintrag , also keine Texte
281
	SID_ATTR_ZOOM //idlpp ole : no , status : no
287
	SID_ATTR_ZOOM //idlpp ole : no , status : no
282
	[
288
	[
(-)a/main/starmath/source/view.cxx (+64 lines)
Lines 64-69 Link Here
64
#include <vcl/menu.hxx>
64
#include <vcl/menu.hxx>
65
#include <vcl/msgbox.hxx>
65
#include <vcl/msgbox.hxx>
66
#include <vcl/wrkwin.hxx>
66
#include <vcl/wrkwin.hxx>
67
#include <unotools/streamwrap.hxx>
67
68
68
#include "unomodel.hxx"
69
#include "unomodel.hxx"
69
#include "view.hxx"
70
#include "view.hxx"
Lines 90-95 using namespace com::sun::star; Link Here
90
using namespace com::sun::star::accessibility;
91
using namespace com::sun::star::accessibility;
91
using namespace com::sun::star::uno;
92
using namespace com::sun::star::uno;
92
93
94
using ::rtl::OUString;
95
using ::rtl::OString;
96
93
//////////////////////////////////////////////////////////////////////
97
//////////////////////////////////////////////////////////////////////
94
98
95
SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
99
SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
Lines 1601-1606 void SmViewShell::Execute(SfxRequest& rReq) Link Here
1601
            break;
1605
            break;
1602
        }
1606
        }
1603
1607
1608
        case SID_IMPORT_MATHML_CLIPBOARD:
1609
        {
1610
            TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard(GetEditWindow()) );
1611
            uno::Reference < io::XInputStream > xStrm;
1612
            SotFormatStringId nId = SOT_FORMAT_SYSTEM_START; //dummy initialize to avoid warning
1613
            if  ( aDataHelper.GetTransferable().is() )
1614
            {
1615
                if ( aDataHelper.HasFormat( nId = SOT_FORMATSTR_ID_MATHML ) )
1616
                {
1617
                    if ( aDataHelper.GetInputStream( nId, xStrm ) && xStrm.is() )
1618
                    {
1619
                        SfxMedium* pClipboardMedium = new SfxMedium();
1620
                        pClipboardMedium->GetItemSet(); //generate initial itemset, not sure if necessary
1621
                        const SfxFilter* pMathFilter = SfxFilter::GetFilterByName( String::CreateFromAscii(MATHML_XML) );
1622
                        pClipboardMedium->SetFilter(pMathFilter);
1623
                        pClipboardMedium->setStreamToLoadFrom( xStrm, sal_True /*bIsReadOnly*/ );
1624
                        InsertFrom(*pClipboardMedium);
1625
                        GetDoc()->UpdateText();
1626
                        delete pClipboardMedium;
1627
                    }
1628
                }
1629
                else
1630
                {
1631
                    if ( aDataHelper.HasFormat( nId = FORMAT_STRING) )
1632
                    {
1633
                        // In case of FORMAT_STRING no stream exists, need to generate one
1634
                        ::rtl::OUString aString;
1635
                        if (aDataHelper.GetString( nId, aString))
1636
                        {
1637
// ToDo detection whether it is MathML at all ?
1638
                            SfxMedium* pClipboardMedium = new SfxMedium();
1639
                            pClipboardMedium->GetItemSet(); //generates initial itemset, not sure if necessary
1640
                            const SfxFilter* pMathFilter = SfxFilter::GetFilterByName( String::CreateFromAscii(MATHML_XML) );
1641
                            pClipboardMedium->SetFilter(pMathFilter);
1642
1643
                            SvMemoryStream * pStrm;
1644
                            // The text to be imported might asserts 'encoding="utf-8"', convert to utf-8 in that case
1645
                            if ( aString.indexOf( OUString(RTL_CONSTASCII_USTRINGPARAM("encoding=\"utf-8\"")) , 0) >= 0  ||
1646
                                 aString.indexOf( OUString(RTL_CONSTASCII_USTRINGPARAM("encoding=\"UTF-8\"")) , 0) >= 0 )
1647
                            {
1648
                                OString aStringUTF8 = OUStringToOString(aString,RTL_TEXTENCODING_UTF8);
1649
                                pStrm = new SvMemoryStream( (void*)aStringUTF8.getStr(), aStringUTF8.getLength(), STREAM_READ);
1650
                            }
1651
                            else
1652
                            {
1653
                                pStrm = new SvMemoryStream( (void*)aString.getStr(), aString.getLength() * sizeof(sal_Unicode), STREAM_READ);
1654
                            }
1655
                            com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xStrm( new ::utl::OInputStreamWrapper( *pStrm ) );
1656
                            pClipboardMedium->setStreamToLoadFrom( xStrm, sal_True /*bIsReadOnly*/ );
1657
                            InsertFrom(*pClipboardMedium);
1658
                            GetDoc()->UpdateText();
1659
                            delete pClipboardMedium;
1660
                            delete pStrm;
1661
                        }
1662
                    }
1663
                }
1664
            }
1665
            break;
1666
        }
1667
1604
        case SID_NEXTERR:
1668
        case SID_NEXTERR:
1605
			NextError();
1669
			NextError();
1606
			if (pWin)
1670
			if (pWin)
(-)a/main/starmath/uiconfig/smath/menubar/menubar.xml (+1 lines)
Lines 104-109 Link Here
104
    <menu:menupopup>
104
    <menu:menupopup>
105
      <menu:menuitem menu:id=".uno:SymbolCatalogue"/>
105
      <menu:menuitem menu:id=".uno:SymbolCatalogue"/>
106
      <menu:menuitem menu:id=".uno:ImportFormula"/>
106
      <menu:menuitem menu:id=".uno:ImportFormula"/>
107
      <menu:menuitem menu:id=".uno:ImportMathMLClipboard"/>
107
      <menu:menuseparator/>
108
      <menu:menuseparator/>
108
      <menu:menu menu:id=".uno:MacrosMenu">
109
      <menu:menu menu:id=".uno:MacrosMenu">
109
        <menu:menupopup>
110
        <menu:menupopup>

Return to issue 107734