Lines 125-130
Link Here
|
125 |
using namespace ::com::sun::star::beans; |
125 |
using namespace ::com::sun::star::beans; |
126 |
namespace css = ::com::sun::star; |
126 |
namespace css = ::com::sun::star; |
127 |
|
127 |
|
|
|
128 |
#include <vos/mutex.hxx> |
129 |
#ifndef _COM_SUN_STAR_SYSTEM_XSYSTEMSHELLEXECUTE_HPP_ |
130 |
#include <com/sun/star/system/XSystemShellExecute.hpp> |
131 |
#endif |
132 |
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ |
133 |
#include <comphelper/processfactory.hxx> |
134 |
#endif |
135 |
#ifndef _OSL_FILE_HXX_ |
136 |
#include <osl/file.hxx> |
137 |
#endif |
138 |
#ifndef _COM_SUN_STAR_SYSTEM_SYSTEMSHELLEXECUTEFLAGS_HPP_ |
139 |
#include <com/sun/star/system/SystemShellExecuteFlags.hpp> |
140 |
#endif |
141 |
#ifndef _SV_MSGBOX_HXX |
142 |
#include <vcl/msgbox.hxx> |
143 |
#endif |
144 |
#ifndef _URLOBJ_HXX //autogen |
145 |
#include <tools/urlobj.hxx> |
146 |
#endif |
147 |
#ifndef _UNOTOOLS_TEMPFILE_HXX |
148 |
#include <unotools/tempfile.hxx> |
149 |
#endif |
150 |
#ifndef _SFXDOCFILE_HXX //autogen |
151 |
#include <sfx2/docfile.hxx> |
152 |
#endif |
153 |
#ifndef _SFX_DOCFILT_HACK_HXX |
154 |
#include <sfx2/docfilt.hxx> |
155 |
#endif |
156 |
|
157 |
using namespace ::com::sun::star::uno; |
158 |
using namespace ::com::sun::star::util; |
159 |
using namespace ::com::sun::star::system; |
160 |
using namespace ::cppu; |
161 |
//using namespace ::rtl; |
128 |
//========================================================================= |
162 |
//========================================================================= |
129 |
DBG_NAME(SfxViewShell) |
163 |
DBG_NAME(SfxViewShell) |
130 |
|
164 |
|
Lines 309-314
Link Here
|
309 |
} |
343 |
} |
310 |
|
344 |
|
311 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
345 |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
|
346 |
case SID_WEBHTML: |
347 |
{ |
348 |
String aHTMLExtension = String::CreateFromAscii( ".htm" ); |
349 |
const SfxFilter* pFilter = NULL; |
350 |
SfxFilterContainer* pFilterContainer =GetObjectShell()-> GetFactory().GetFilterContainer(); |
351 |
|
352 |
if ( pFilterContainer ) { |
353 |
|
354 |
pFilter = pFilterContainer->GetFilter4Extension( aHTMLExtension, SFX_FILTER_EXPORT ); |
355 |
} |
356 |
|
357 |
if ( NULL == pFilter ) { |
358 |
printf("ERROR: cannot get filter for \"htm\"\n"); |
359 |
break; |
360 |
} |
361 |
|
362 |
SfxObjectShellRef xDocShell = SfxObjectShell::Current(); |
363 |
SfxDispatcher* pDisp = xDocShell->GetFrame()->GetDispatcher(); |
364 |
String rFileName; |
365 |
|
366 |
// save the document as HTML format |
367 |
if ( xDocShell.Is() && xDocShell->GetMedium() ) { |
368 |
// save old settings |
369 |
BOOL bModified = xDocShell->IsModified(); |
370 |
// detect filter |
371 |
|
372 |
sal_Bool bHasFilter = pFilter ? sal_True : sal_False; |
373 |
|
374 |
// create temp file name with leading chars and extension |
375 |
sal_Bool bHasName = xDocShell->HasName(); |
376 |
String aLeadingStr; |
377 |
|
378 |
if ( !bHasName ) { |
379 |
aLeadingStr = String( DEFINE_CONST_UNICODE("noname") ); |
380 |
} |
381 |
|
382 |
::utl::TempFile aTempFile( aLeadingStr, &aHTMLExtension ); |
383 |
|
384 |
rFileName = aTempFile.GetURL(); |
385 |
|
386 |
// save document to temp file |
387 |
SfxStringItem aFileName( SID_FILE_NAME, rFileName ); |
388 |
SfxBoolItem aPicklist( SID_PICKLIST, FALSE ); |
389 |
SfxBoolItem aSaveTo( SID_SAVETO, TRUE ); |
390 |
|
391 |
SfxStringItem* pFilterName = NULL; |
392 |
String sFilterName = ((class SfxFilter*) pFilter)->GetFilterName(); |
393 |
|
394 |
if ( pFilter && bHasFilter ) |
395 |
pFilterName = new SfxStringItem( SID_FILTER_NAME, sFilterName); |
396 |
|
397 |
const SfxBoolItem *pRet = (const SfxBoolItem*)pDisp->Execute( \ |
398 |
SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON, &aFileName, &aPicklist, &aSaveTo, |
399 |
pFilterName , 0L, 0L ); |
400 |
BOOL bRet = pRet ? pRet->GetValue() : FALSE; |
401 |
|
402 |
delete pFilterName; |
403 |
|
404 |
// restore old settings |
405 |
if ( !bModified && xDocShell->IsEnableSetModified() ) |
406 |
xDocShell->SetModified( FALSE ); |
407 |
|
408 |
} |
409 |
else { |
410 |
return; |
411 |
} |
412 |
|
413 |
::com::sun::star::uno::Reference< XSystemShellExecute > xSystemShellExecute(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), UNO_QUERY ); |
414 |
|
415 |
if ( xSystemShellExecute.is() ){ |
416 |
try { |
417 |
xSystemShellExecute->execute( \ |
418 |
rFileName, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); |
419 |
} |
420 |
catch ( ... ) { |
421 |
::vos::OGuard aGuard( Application::GetSolarMutex() ); |
422 |
Window *pWindow = SFX_APP()->GetTopWindow(); |
423 |
// InfoBox( pWindow, ::rtl::OUString::createFromAscii("Can't run Browser")).Execute(); |
424 |
String aMsg; |
425 |
ByteString roStr("Can't run Browser."); |
426 |
aMsg += UniString(roStr,RTL_TEXTENCODING_GBK); |
427 |
InfoBox( pWindow, ::rtl::OUString::OUString(aMsg)).Execute(); |
428 |
} |
429 |
} |
430 |
|
431 |
break; |
432 |
} |
312 |
case SID_PLUGINS_ACTIVE: |
433 |
case SID_PLUGINS_ACTIVE: |
313 |
{ |
434 |
{ |
314 |
SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nId, FALSE); |
435 |
SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nId, FALSE); |