1 Index: sc/source/ui/view/viewfun5.cxx
2 ===================================================================
3 RCS file: /cvs/sc/sc/source/ui/view/viewfun5.cxx,v
4 retrieving revision 1.18
5 diff -u -r1.18 viewfun5.cxx
6 --- sc/source/ui/view/viewfun5.cxx 7 Nov 2001 12:49:49 -0000 1.18
7 +++ sc/source/ui/view/viewfun5.cxx 12 Dec 2002 13:12:57 -0000
9 #include "tabvwsh.hxx" // wegen GetViewFrame
10 #include "compiler.hxx"
12 +#include "asciiopt.hxx"
13 +#include "vcl/msgbox.hxx"
15 #ifndef _SFXVIEWFRM_HXX //autogen
16 #include <sfx2/viewfrm.hxx>
20 //------------------------------------------------------------------
24 BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId,
25 const uno::Reference<datatransfer::XTransferable>& rxTransferable,
26 USHORT nPosX, USHORT nPosY, Point* pLogicPos, BOOL bLink )
28 ScAddress aPos( nPosX, nPosY, GetViewData()->GetTabNo() );
29 ScImportExport aObj( GetViewData()->GetDocument(), aPos );
31 - ::rtl::OUString aStr;
32 + ::rtl::OUString aStr;
33 SotStorageStreamRef xStream;
34 if ( aDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.Is() )
35 bRet = aObj.ImportStream( *xStream, nFormatId );
36 - else if ( aDataHelper.GetString( nFormatId, aStr ) )
37 - bRet = aObj.ImportString( aStr, nFormatId );
39 + else if ( aDataHelper.GetString( nFormatId, aStr ) ) {
42 + newln = aStr.indexOf ('\n');
43 +/* ::rtl::OString tmpStr = OUStringToOString
44 + ( aStr, RTL_TEXTENCODING_UTF8 );
45 + fprintf (stderr, "String is '%s' (%d) [%d]\n",
46 + tmpStr.getStr (), tmpStr.getLength(), newln); */
47 + if (newln >= 0 && newln != aStr.getLength () - 1) { // do dialog
48 + // FIXME: split me out - if only C++ 'private' didn't suck rocks.
50 + SvMemoryStream aStrm( (void*)aStr.getStr(), aStr.getLength() * sizeof(sal_Unicode), STREAM_READ );
51 + aStrm.SetStreamCharSet( RTL_TEXTENCODING_UNICODE );
52 + // Hack - copied from impex.cxx - we need a helper to do this [!]
53 + aStrm.SetEndianSwap( FALSE );
55 + ScImportAsciiDlg* pDlg = new ScImportAsciiDlg
56 + ( NULL, String::CreateFromAscii("Pasted Data"), &aStrm );
58 + if (pDlg->Execute() == RET_OK) {
59 + ScAsciiOptions aOptions;
60 + pDlg->GetOptions( aOptions );
61 + aObj.SetExtOptions( aOptions );
63 + bRet = aObj.ImportString( aStr, nFormatId );
67 + bRet = aObj.ImportString( aStr, nFormatId );
71 GetViewData()->UpdateInputHandler();