Lines 145-150
Link Here
|
145 |
#ifndef _SVX_DLG_NAME_HXX |
145 |
#ifndef _SVX_DLG_NAME_HXX |
146 |
#include <svx/dlgname.hxx> |
146 |
#include <svx/dlgname.hxx> |
147 |
#endif |
147 |
#endif |
|
|
148 |
#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX |
149 |
#include <svtools/pathoptions.hxx> |
150 |
#endif |
151 |
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKER_HPP_ |
152 |
#include <com/sun/star/ui/dialogs/XFilePicker.hpp> |
153 |
#endif |
154 |
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERMANAGER_HPP_ |
155 |
#include <com/sun/star/ui/dialogs/XFilterManager.hpp> |
156 |
#endif |
157 |
#ifndef _COM_SUN_STAR_UI_DIALOGS_TEMPLATEDESCRIPTION_HPP_ |
158 |
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> |
159 |
#endif |
160 |
#ifndef _FILEDLGHELPER_HXX |
161 |
#include <sfx2/filedlghelper.hxx> |
162 |
#endif |
163 |
#ifndef _URLOBJ_HXX |
164 |
#include <tools/urlobj.hxx> |
165 |
#endif |
166 |
#ifndef _FILTER_HXX |
167 |
#include <svtools/filter.hxx> |
168 |
#endif |
169 |
#ifndef _SVX_IMPGRF_HXX |
170 |
#include <svx/impgrf.hxx> |
171 |
#endif |
172 |
#ifndef _XOUTBMP_HXX |
173 |
#include <svx/xoutbmp.hxx> |
174 |
#endif |
148 |
|
175 |
|
149 |
#pragma hdrstop |
176 |
#pragma hdrstop |
150 |
|
177 |
|
Lines 1139-1144
void SdDrawViewShell::FuTemporary(SfxReq
Link Here
|
1139 |
rReq.Done(); |
1166 |
rReq.Done(); |
1140 |
break; |
1167 |
break; |
1141 |
|
1168 |
|
|
|
1169 |
case SID_SAVEGRAPHIC: |
1170 |
SaveGraphic(); |
1171 |
Cancel(); |
1172 |
rReq.Ignore(); |
1173 |
break; |
1174 |
|
1142 |
default: |
1175 |
default: |
1143 |
{ |
1176 |
{ |
1144 |
// switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die |
1177 |
// switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die |
Lines 1355-1357
void SdDrawViewShell::CreateOrDuplicateP
Link Here
|
1355 |
GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); |
1388 |
GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); |
1356 |
rReq.Done (); |
1389 |
rReq.Done (); |
1357 |
} |
1390 |
} |
|
|
1391 |
|
1392 |
// From sw/source/ui/docvw/romenu.cxx |
1393 |
void lcl_GetPreferedExtension( String &rExt, const Graphic &rGrf ) |
1394 |
{ |
1395 |
// dann ggfs. ueber die native-Info der Grafik den "besten" |
1396 |
// Filter vorschlagen |
1397 |
const sal_Char* pExt = "png"; |
1398 |
switch( ((Graphic *)&rGrf)->GetLink().GetType() ) |
1399 |
{ |
1400 |
case GFX_LINK_TYPE_NATIVE_GIF: pExt = "gif"; break; |
1401 |
case GFX_LINK_TYPE_NATIVE_TIF: pExt = "tif"; break; |
1402 |
case GFX_LINK_TYPE_NATIVE_WMF: pExt = "wmf"; break; |
1403 |
case GFX_LINK_TYPE_NATIVE_MET: pExt = "met"; break; |
1404 |
case GFX_LINK_TYPE_NATIVE_PCT: pExt = "pct"; break; |
1405 |
case GFX_LINK_TYPE_NATIVE_JPG: pExt = "jpg"; break; |
1406 |
} |
1407 |
rExt.AssignAscii( pExt ); |
1408 |
} |
1409 |
|
1410 |
void SdDrawViewShell::SaveGraphic() |
1411 |
{ |
1412 |
using namespace ::com::sun::star::uno; |
1413 |
using namespace com::sun::star::ui::dialogs; |
1414 |
using namespace ::sfx2; |
1415 |
|
1416 |
SvtPathOptions aPathOpt; |
1417 |
String sGrfPath( aPathOpt.GetGraphicPath() ); |
1418 |
|
1419 |
FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_SIMPLE, 0 ); |
1420 |
Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); |
1421 |
|
1422 |
INetURLObject aPath; |
1423 |
aPath.SetSmartURL( sGrfPath); |
1424 |
|
1425 |
SdrGrafObj *pGrafObj = PTR_CAST( SdrGrafObj, pDrView->GetMarkList().GetMark( 0 )->GetObj() ); |
1426 |
if (0 == pGrafObj ) |
1427 |
return; |
1428 |
|
1429 |
const Graphic &rGraphic = pGrafObj->GetGraphic(); |
1430 |
|
1431 |
String aExt; |
1432 |
lcl_GetPreferedExtension( aExt, rGraphic ); |
1433 |
aExt.ToLowerAscii(); |
1434 |
int nDfltFilter = INT_MAX; |
1435 |
|
1436 |
xFP->setDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) ); |
1437 |
|
1438 |
GraphicFilter& rGF = *GetGrfFilter(); |
1439 |
const USHORT nCount = rGF.GetExportFormatCount(); |
1440 |
|
1441 |
Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); |
1442 |
|
1443 |
for ( int i = 0; i < nCount; i++ ) |
1444 |
{ |
1445 |
xFltMgr->appendFilter( rGF.GetExportFormatName( i ), rGF.GetExportWildcard( i ) ); |
1446 |
if ( COMPARE_EQUAL == aExt.CompareIgnoreCaseToAscii(rGF.GetExportFormatShortName( i ).ToLowerAscii() )) |
1447 |
nDfltFilter = i; |
1448 |
} |
1449 |
|
1450 |
if( INT_MAX == nDfltFilter ) |
1451 |
return; |
1452 |
|
1453 |
xFltMgr->setCurrentFilter( rGF.GetExportFormatName( nDfltFilter ) ); |
1454 |
|
1455 |
if( aDlgHelper.Execute() == ERRCODE_NONE ) |
1456 |
{ |
1457 |
String sPath( xFP->getFiles().getConstArray()[0] ); |
1458 |
//verwendeten Pfad merken - bitte nicht wieder wegoptimieren! |
1459 |
aPath.SetSmartURL( sPath); |
1460 |
sGrfPath = aPath.GetPath(); |
1461 |
|
1462 |
int nFilter; |
1463 |
if ( xFltMgr->getCurrentFilter().getLength() && rGF.GetExportFormatCount() ) |
1464 |
nFilter = rGF.GetExportFormatNumber( xFltMgr->getCurrentFilter() ); |
1465 |
else |
1466 |
nFilter = GRFILTER_FORMAT_DONTKNOW; |
1467 |
String aFilter( rGF.GetExportFormatShortName( nFilter ) ); |
1468 |
XOutBitmap::WriteGraphic( rGraphic, sPath, aFilter, |
1469 |
XOUTBMP_DONT_EXPAND_FILENAME ); |
1470 |
return; |
1471 |
} |
1472 |
} |