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

(-)sc/source/ui/view/viewfun5.cxx (-3 / +38 lines)
Lines 119-124 Link Here
119
#include "tabvwsh.hxx"		//	wegen GetViewFrame
119
#include "tabvwsh.hxx"		//	wegen GetViewFrame
120
#include "compiler.hxx"
120
#include "compiler.hxx"
121
121
122
#include "asciiopt.hxx"
123
#include "scabstdlg.hxx"
124
#include "vcl/msgbox.hxx"
125
122
#ifndef _SFXVIEWFRM_HXX //autogen
126
#ifndef _SFXVIEWFRM_HXX //autogen
123
#include <sfx2/viewfrm.hxx>
127
#include <sfx2/viewfrm.hxx>
124
#endif
128
#endif
Lines 272-283 Link Here
272
			ScAddress aPos( nPosX, nPosY, GetViewData()->GetTabNo() );
276
			ScAddress aPos( nPosX, nPosY, GetViewData()->GetTabNo() );
273
			ScImportExport aObj( GetViewData()->GetDocument(), aPos );
277
			ScImportExport aObj( GetViewData()->GetDocument(), aPos );
274
278
275
            ::rtl::OUString aStr;
279
			::rtl::OUString aStr;
276
			SotStorageStreamRef xStream;
280
			SotStorageStreamRef xStream;
277
			if ( aDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.Is() )
281
			if ( aDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.Is() )
278
				bRet = aObj.ImportStream( *xStream, nFormatId );
282
				bRet = aObj.ImportStream( *xStream, nFormatId );
279
			else if ( aDataHelper.GetString( nFormatId, aStr ) )
283
280
				bRet = aObj.ImportString( aStr, nFormatId );
284
			else if ( aDataHelper.GetString( nFormatId, aStr ) ) {
285
286
			  sal_Int32 newln;
287
			  newln = aStr.indexOf ('\n');
288
/*			  ::rtl::OString tmpStr = OUStringToOString
289
			      ( aStr, RTL_TEXTENCODING_UTF8 );
290
			  fprintf (stderr, "String is '%s' (%d) [%d]\n",
291
				   tmpStr.getStr (), tmpStr.getLength(), newln); */
292
			  if (newln >= 0 && newln != aStr.getLength () - 1) { // do dialog
293
				// FIXME: split me out - if only C++ 'private' didn't suck rocks.
294
295
				SvMemoryStream aStrm( (void*)aStr.getStr(), aStr.getLength() * sizeof(sal_Unicode), STREAM_READ );
296
				aStrm.SetStreamCharSet( RTL_TEXTENCODING_UNICODE );
297
				// Hack - copied from impex.cxx - we need a helper to do this [!]
298
				aStrm.SetEndianSwap( FALSE );
299
300
				ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
301
				AbstractScImportAsciiDlg *pDlg = pFact->CreateScImportAsciiDlg
302
					( NULL, String::CreateFromAscii("Pasted Data"), &aStrm, 
303
					  ResId(RID_SCDLG_ASCII) );
304
305
				if (pDlg->Execute() == RET_OK) {
306
				  ScAsciiOptions aOptions;
307
				  pDlg->GetOptions( aOptions );
308
				  aObj.SetExtOptions( aOptions );
309
310
				  bRet = aObj.ImportString( aStr, nFormatId );
311
				} else
312
				  bRet = FALSE;
313
			  } else
314
			    bRet = aObj.ImportString( aStr, nFormatId );
315
			}
281
316
282
			InvalidateAttribs();
317
			InvalidateAttribs();
283
			GetViewData()->UpdateInputHandler();
318
			GetViewData()->UpdateInputHandler();

Return to issue 15509