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
()
429
[
430
	/* flags: */  
431
	AutoUpdate = FALSE, 
432
	Cachable = Cachable, 
433
	FastCall = TRUE, 
434
	HasCoreId = FALSE, /*obsolete */
435
	HasDialog = FALSE, /*obsolete */
436
	ReadOnlyDoc = FALSE, 
437
	Toggle = FALSE, 
438
	Container = FALSE, 
439
	RecordAbsolute = FALSE, /*obsolete */
440
	RecordPerSet;
441
	Synchron;
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 (+74 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
93
//////////////////////////////////////////////////////////////////////
96
//////////////////////////////////////////////////////////////////////
94
97
95
SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
98
SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
Lines 1601-1606 void SmViewShell::Execute(SfxRequest& rReq) Link Here
1601
            break;
1604
            break;
1602
        }
1605
        }
1603
1606
1607
        case SID_IMPORT_MATHML_CLIPBOARD:
1608
        {
1609
            TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard(GetEditWindow()) );
1610
            uno::Reference < io::XInputStream > xStrm;
1611
            SotFormatStringId nId = SOT_FORMAT_SYSTEM_START; //dummy initialize to avoid warning
1612
            if  ( aDataHelper.GetTransferable().is() )
1613
            {
1614
                if ( aDataHelper.HasFormat( nId = SOT_FORMATSTR_ID_MATHML ) )
1615
                {
1616
                    if ( aDataHelper.GetInputStream( nId, xStrm ) && xStrm.is() )
1617
                    {
1618
                        SfxMedium* pClipboardMedium = new SfxMedium();
1619
                        pClipboardMedium->GetItemSet(); //generate initial itemset, not sure if necessary
1620
                        const SfxFilter* pMathFilter = SfxFilter::GetFilterByName( String::CreateFromAscii(MATHML_XML) );
1621
                        pClipboardMedium->SetFilter(pMathFilter);
1622
                        pClipboardMedium->setStreamToLoadFrom( xStrm, sal_True /*bIsReadOnly*/ );
1623
                        InsertFrom(*pClipboardMedium);
1624
                        GetDoc()->UpdateText();
1625
                        delete pClipboardMedium;
1626
                    }
1627
                }
1628
                else
1629
                {
1630
                    if ( aDataHelper.HasFormat( nId = FORMAT_STRING) )
1631
                    {
1632
                        // In case of FORMAT_STRING no stream exists, need to generate one
1633
                        ::rtl::OUString aString;
1634
                        if (aDataHelper.GetString( nId, aString))
1635
                        {
1636
                            SfxMedium* pClipboardMedium = new SfxMedium();
1637
                            pClipboardMedium->GetItemSet(); //generates initial itemset, not sure if necessary
1638
                            const SfxFilter* pMathFilter = SfxFilter::GetFilterByName( String::CreateFromAscii(MATHML_XML) );
1639
                            pClipboardMedium->SetFilter(pMathFilter);
1640
1641
                            SvMemoryStream * pStrm;
1642
                            // The text to be imported might asserts encoding like 'encoding="utf-8"' but FORMAT_STRING is UTF-16.
1643
                            // Force encoding to UTF-16, if encoding exists.
1644
                            bool bForceUTF16 = false;
1645
                            sal_Int32 nPosL = aString.indexOf( OUString::createFromAscii("encoding=\""));
1646
                            sal_Int32 nPosU = -1;
1647
                            if ( nPosL >= 0 && nPosL +10 < aString.getLength() )
1648
                            {
1649
                                nPosL += 10;
1650
                                nPosU = aString.indexOf( '"',nPosL);
1651
                                if (nPosU > nPosL)
1652
                                {
1653
                                    bForceUTF16 = true;
1654
                                }
1655
                            }
1656
                            if ( bForceUTF16 )
1657
                            {
1658
                                OUString aNewString = aString.replaceAt( nPosL,nPosU-nPosL,OUString::createFromAscii("UTF-16"));
1659
                                pStrm = new SvMemoryStream( (void*)aNewString.getStr(), aNewString.getLength() * sizeof(sal_Unicode), STREAM_READ);
1660
                            }
1661
                            else
1662
                            {
1663
                                pStrm = new SvMemoryStream( (void*)aString.getStr(), aString.getLength() * sizeof(sal_Unicode), STREAM_READ);
1664
                            }
1665
                            com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xStrm( new ::utl::OInputStreamWrapper( *pStrm ) );
1666
                            pClipboardMedium->setStreamToLoadFrom( xStrm, sal_True /*bIsReadOnly*/ );
1667
                            InsertFrom(*pClipboardMedium);
1668
                            GetDoc()->UpdateText();
1669
                            delete pClipboardMedium;
1670
                            delete pStrm;
1671
                        }
1672
                    }
1673
                }
1674
            }
1675
            break;
1676
        }
1677
1604
        case SID_NEXTERR:
1678
        case SID_NEXTERR:
1605
			NextError();
1679
			NextError();
1606
			if (pWin)
1680
			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