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) |