]>
Commit | Line | Data |
---|---|---|
d7335463 | 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 | |
8 | @@ -120,6 +120,9 @@ | |
9 | #include "tabvwsh.hxx" // wegen GetViewFrame | |
10 | #include "compiler.hxx" | |
11 | ||
12 | +#include "asciiopt.hxx" | |
13 | +#include "vcl/msgbox.hxx" | |
14 | + | |
15 | #ifndef _SFXVIEWFRM_HXX //autogen | |
16 | #include <sfx2/viewfrm.hxx> | |
17 | #endif | |
18 | @@ -131,6 +134,8 @@ | |
19 | ||
20 | //------------------------------------------------------------------ | |
21 | ||
22 | +#include <stdio.h> | |
23 | + | |
24 | BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId, | |
25 | const uno::Reference<datatransfer::XTransferable>& rxTransferable, | |
26 | USHORT nPosX, USHORT nPosY, Point* pLogicPos, BOOL bLink ) | |
27 | @@ -268,12 +273,41 @@ | |
28 | ScAddress aPos( nPosX, nPosY, GetViewData()->GetTabNo() ); | |
29 | ScImportExport aObj( GetViewData()->GetDocument(), aPos ); | |
30 | ||
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 ); | |
38 | + | |
39 | + else if ( aDataHelper.GetString( nFormatId, aStr ) ) { | |
40 | + | |
41 | + sal_Int32 newln; | |
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. | |
49 | + | |
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 ); | |
54 | + | |
55 | + ScImportAsciiDlg* pDlg = new ScImportAsciiDlg | |
56 | + ( NULL, String::CreateFromAscii("Pasted Data"), &aStrm ); | |
57 | + | |
58 | + if (pDlg->Execute() == RET_OK) { | |
59 | + ScAsciiOptions aOptions; | |
60 | + pDlg->GetOptions( aOptions ); | |
61 | + aObj.SetExtOptions( aOptions ); | |
62 | + | |
63 | + bRet = aObj.ImportString( aStr, nFormatId ); | |
64 | + } else | |
65 | + bRet = FALSE; | |
66 | + } else | |
67 | + bRet = aObj.ImportString( aStr, nFormatId ); | |
68 | + } | |
69 | ||
70 | InvalidateAttribs(); | |
71 | GetViewData()->UpdateInputHandler(); |