view.cxx (86e1cf34) view.cxx (397d541d)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 50 unchanged lines hidden (view full) ---

59#include <svx/dialogs.hrc>
60#include <editeng/editeng.hxx>
61#include <svx/svxdlg.hxx>
62#include <svx/zoomitem.hxx>
63#include <vcl/decoview.hxx>
64#include <vcl/menu.hxx>
65#include <vcl/msgbox.hxx>
66#include <vcl/wrkwin.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 50 unchanged lines hidden (view full) ---

59#include <svx/dialogs.hrc>
60#include <editeng/editeng.hxx>
61#include <svx/svxdlg.hxx>
62#include <svx/zoomitem.hxx>
63#include <vcl/decoview.hxx>
64#include <vcl/menu.hxx>
65#include <vcl/msgbox.hxx>
66#include <vcl/wrkwin.hxx>
67#include <unotools/streamwrap.hxx>
67
68#include "unomodel.hxx"
69#include "view.hxx"
70#include "config.hxx"
71#include "dialog.hxx"
72#include "document.hxx"
73#include "starmath.hrc"
74#include "toolbox.hxx"

--- 10 unchanged lines hidden (view full) ---

85
86#define SmViewShell
87#include "smslots.hxx"
88
89using namespace com::sun::star;
90using namespace com::sun::star::accessibility;
91using namespace com::sun::star::uno;
92
68
69#include "unomodel.hxx"
70#include "view.hxx"
71#include "config.hxx"
72#include "dialog.hxx"
73#include "document.hxx"
74#include "starmath.hrc"
75#include "toolbox.hxx"

--- 10 unchanged lines hidden (view full) ---

86
87#define SmViewShell
88#include "smslots.hxx"
89
90using namespace com::sun::star;
91using namespace com::sun::star::accessibility;
92using namespace com::sun::star::uno;
93
94using ::rtl::OUString;
95
93//////////////////////////////////////////////////////////////////////
94
95SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
96 ScrollableWindow(&pShell->GetViewFrame()->GetWindow(), 0),
97 pAccessible(0),
98 pViewShell(pShell),
99 nZoom(100),
100 bIsCursorVisible(sal_False)

--- 1495 unchanged lines hidden (view full) ---

1596 pImpl->pRequest = new SfxRequest( rReq );
1597 delete pImpl->pDocInserter;
1598 pImpl->pDocInserter =
1599 new ::sfx2::DocumentInserter( 0, GetDoc()->GetFactory().GetFactoryName(), 0 );
1600 pImpl->pDocInserter->StartExecuteModal( LINK( this, SmViewShell, DialogClosedHdl ) );
1601 break;
1602 }
1603
96//////////////////////////////////////////////////////////////////////
97
98SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
99 ScrollableWindow(&pShell->GetViewFrame()->GetWindow(), 0),
100 pAccessible(0),
101 pViewShell(pShell),
102 nZoom(100),
103 bIsCursorVisible(sal_False)

--- 1495 unchanged lines hidden (view full) ---

1599 pImpl->pRequest = new SfxRequest( rReq );
1600 delete pImpl->pDocInserter;
1601 pImpl->pDocInserter =
1602 new ::sfx2::DocumentInserter( 0, GetDoc()->GetFactory().GetFactoryName(), 0 );
1603 pImpl->pDocInserter->StartExecuteModal( LINK( this, SmViewShell, DialogClosedHdl ) );
1604 break;
1605 }
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:
1605 NextError();
1606 if (pWin)
1607 pWin->GrabFocus();
1608 break;
1609
1610 case SID_PREVERR:
1611 PrevError();

--- 324 unchanged lines hidden ---
1678 case SID_NEXTERR:
1679 NextError();
1680 if (pWin)
1681 pWin->GrabFocus();
1682 break;
1683
1684 case SID_PREVERR:
1685 PrevError();

--- 324 unchanged lines hidden ---