View | Details | Raw Unified | Return to issue 15509
Collapse All | Expand All

(-)sc/source/ui/view/viewfun5.cxx (-3 / +37 lines)
Lines 120-125 Link Here
120
#include "tabvwsh.hxx"		//	wegen GetViewFrame
120
#include "tabvwsh.hxx"		//	wegen GetViewFrame
121
#include "compiler.hxx"
121
#include "compiler.hxx"
122
122
123
#include "asciiopt.hxx"
124
#include "vcl/msgbox.hxx"
125
123
#ifndef _SFXVIEWFRM_HXX //autogen
126
#ifndef _SFXVIEWFRM_HXX //autogen
124
#include <sfx2/viewfrm.hxx>
127
#include <sfx2/viewfrm.hxx>
125
#endif
128
#endif
Lines 131-136 Link Here
131
134
132
//------------------------------------------------------------------
135
//------------------------------------------------------------------
133
136
137
#include <stdio.h>
138
134
BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId,
139
BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId,
135
					const uno::Reference<datatransfer::XTransferable>& rxTransferable,
140
					const uno::Reference<datatransfer::XTransferable>& rxTransferable,
136
					USHORT nPosX, USHORT nPosY, Point* pLogicPos, BOOL bLink )
141
					USHORT nPosX, USHORT nPosY, Point* pLogicPos, BOOL bLink )
Lines 268-279 Link Here
268
			ScAddress aPos( nPosX, nPosY, GetViewData()->GetTabNo() );
273
			ScAddress aPos( nPosX, nPosY, GetViewData()->GetTabNo() );
269
			ScImportExport aObj( GetViewData()->GetDocument(), aPos );
274
			ScImportExport aObj( GetViewData()->GetDocument(), aPos );
270
275
271
            ::rtl::OUString aStr;
276
			::rtl::OUString aStr;
272
			SotStorageStreamRef xStream;
277
			SotStorageStreamRef xStream;
273
			if ( aDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.Is() )
278
			if ( aDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.Is() )
274
				bRet = aObj.ImportStream( *xStream, nFormatId );
279
				bRet = aObj.ImportStream( *xStream, nFormatId );
275
			else if ( aDataHelper.GetString( nFormatId, aStr ) )
280
276
				bRet = aObj.ImportString( aStr, nFormatId );
281
			else if ( aDataHelper.GetString( nFormatId, aStr ) ) {
282
283
			  sal_Int32 newln;
284
			  newln = aStr.indexOf ('\n');
285
/*			  ::rtl::OString tmpStr = OUStringToOString
286
			      ( aStr, RTL_TEXTENCODING_UTF8 );
287
			  fprintf (stderr, "String is '%s' (%d) [%d]\n",
288
				   tmpStr.getStr (), tmpStr.getLength(), newln); */
289
			  if (newln >= 0 && newln != aStr.getLength () - 1) { // do dialog
290
				// FIXME: split me out - if only C++ 'private' didn't suck rocks.
291
292
				SvMemoryStream aStrm( (void*)aStr.getStr(), aStr.getLength() * sizeof(sal_Unicode), STREAM_READ );
293
				aStrm.SetStreamCharSet( RTL_TEXTENCODING_UNICODE );
294
				// Hack - copied from impex.cxx - we need a helper to do this [!]
295
				aStrm.SetEndianSwap( FALSE );
296
297
				ScImportAsciiDlg* pDlg = new ScImportAsciiDlg
298
				  ( NULL, String::CreateFromAscii("Pasted Data"), &aStrm );
299
300
				if (pDlg->Execute() == RET_OK) {
301
				  ScAsciiOptions aOptions;
302
				  pDlg->GetOptions( aOptions );
303
				  aObj.SetExtOptions( aOptions );
304
305
				  bRet = aObj.ImportString( aStr, nFormatId );
306
				} else
307
				  bRet = FALSE;
308
			  } else
309
			    bRet = aObj.ImportString( aStr, nFormatId );
310
			}
277
311
278
			InvalidateAttribs();
312
			InvalidateAttribs();
279
			GetViewData()->UpdateInputHandler();
313
			GetViewData()->UpdateInputHandler();

Return to issue 15509