Kaydet (Commit) 7a3ae89a authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

Enable menu option "Edit witn External Tool.." for Calc.

Currently it was only possible to use "Exit with External Tool.."
menu option in Writer. Now it is also possible to use this in
Calc and in future Draw and Impress. Code has been refactored and
extacted out of "sw" into "svx", so other components can use it.

Currently there is no cleanup of temporary images after processing
was done, and also pinging for changes are still active even when
editing in external tool is done. This behavior will be changed
in the future.

Change-Id: I09969d44dfddbf9183b30ff3fffa2d201c7ae40f
üst e18655e4
...@@ -128,11 +128,18 @@ interface GraphSelection ...@@ -128,11 +128,18 @@ interface GraphSelection
ExecMethod = Execute; ExecMethod = Execute;
StateMethod = GetAttrState; StateMethod = GetAttrState;
] ]
SID_COLOR_SETTINGS
[ SID_COLOR_SETTINGS
ExecMethod = Execute; [
StateMethod = GetAttrState; ExecMethod = Execute;
] StateMethod = GetAttrState;
]
SID_EXTERNAL_EDIT
[
ExecMethod = ExecuteExternalEdit;
StateMethod = GetExternalEditState;
]
} }
// =========================================================================== // ===========================================================================
...@@ -140,4 +147,3 @@ shell ScGraphicShell : ScDrawShell ...@@ -140,4 +147,3 @@ shell ScGraphicShell : ScDrawShell
{ {
import GraphSelection; import GraphSelection;
} }
...@@ -39,12 +39,40 @@ ...@@ -39,12 +39,40 @@
#include "viewdata.hxx" #include "viewdata.hxx"
#include "drawview.hxx" #include "drawview.hxx"
#include "scresid.hxx" #include "scresid.hxx"
#include <svx/extedit.hxx>
#define ScGraphicShell #define ScGraphicShell
#include "scslots.hxx" #include "scslots.hxx"
#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
class ScExternalToolEdit : public ExternalToolEdit
{
ScDrawView* m_pView;
SdrObject* m_pObj;
public:
ScExternalToolEdit ( ScDrawView* pView, SdrObject* pObj ) :
m_pView (pView),
m_pObj (pObj)
{}
virtual void Update( Graphic& aGraphic )
{
SdrPageView* pPageView = m_pView->GetSdrPageView();
if( pPageView )
{
SdrGrafObj* pNewObj = (SdrGrafObj*) m_pObj->Clone();
String aStr( m_pView->GetDescriptionOfMarkedObjects() );
aStr.Append( sal_Unicode(' ') );
aStr.Append( String( "External Edit" ) );
m_pView->BegUndo( aStr );
pNewObj->SetGraphicObject( aGraphic );
m_pView->ReplaceObjectAtView( m_pObj, *pPageView, pNewObj );
m_pView->EndUndo();
}
}
};
SFX_IMPL_INTERFACE(ScGraphicShell, ScDrawShell, ScResId(SCSTR_GRAPHICSHELL) ) SFX_IMPL_INTERFACE(ScGraphicShell, ScDrawShell, ScResId(SCSTR_GRAPHICSHELL) )
{ {
...@@ -140,4 +168,42 @@ void ScGraphicShell::ExecuteFilter( SfxRequest& rReq ) ...@@ -140,4 +168,42 @@ void ScGraphicShell::ExecuteFilter( SfxRequest& rReq )
Invalidate(); Invalidate();
} }
void ScGraphicShell::GetExternalEditState( SfxItemSet& rSet )
{
ScDrawView* pView = GetViewData()->GetScDrawView();
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
bool bEnable = false;
printf("ZO!\n");
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
if( pObj && pObj->ISA( SdrGrafObj ) && ( ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP ) )
bEnable = true;
}
if( !bEnable )
rSet.DisableItem( SID_EXTERNAL_EDIT );
}
void ScGraphicShell::ExecuteExternalEdit( SfxRequest& rReq )
{
ScDrawView* pView = GetViewData()->GetScDrawView();
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
printf("YO!\n");
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
{
GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
ScExternalToolEdit* aExternalToolEdit = new ScExternalToolEdit( pView, pObj );
aExternalToolEdit->Edit( &aGraphicObject );
}
}
Invalidate();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -404,7 +404,7 @@ String RID_POPUP_DRAW ...@@ -404,7 +404,7 @@ String RID_POPUP_DRAW
Text [ en-US ] = "Pop-up menu for drawing objects" ; Text [ en-US ] = "Pop-up menu for drawing objects" ;
}; };
// //
// Popup-Menue fuer (allgemeine) Zeichenobjekte // Pop-up menu for drawing objects
// //
Menu RID_POPUP_DRAW Menu RID_POPUP_DRAW
{ {
...@@ -527,6 +527,7 @@ Menu RID_POPUP_GRAPHIC ...@@ -527,6 +527,7 @@ Menu RID_POPUP_GRAPHIC
MN_EDITLNK MN_EDITLNK
MN_DELLNK MN_DELLNK
MenuItem { ITEM_OPEN_HYPERLINK }; MenuItem { ITEM_OPEN_HYPERLINK };
MenuItem { ITEM_EXTERNAL_EDIT };
}; };
}; };
...@@ -657,4 +658,3 @@ Menu RID_POPUP_DRAWTEXT ...@@ -657,4 +658,3 @@ Menu RID_POPUP_DRAWTEXT
}; };
}; };
}; };
...@@ -44,6 +44,9 @@ public: ...@@ -44,6 +44,9 @@ public:
void ExecuteFilter(SfxRequest& rReq); void ExecuteFilter(SfxRequest& rReq);
void GetFilterState(SfxItemSet &rSet); void GetFilterState(SfxItemSet &rSet);
void ExecuteExternalEdit(SfxRequest& rReq);
void GetExternalEditState(SfxItemSet &rSet);
}; };
#endif #endif
......
...@@ -92,6 +92,7 @@ $(eval $(call gb_Library_use_external,svxcore,icuuc)) ...@@ -92,6 +92,7 @@ $(eval $(call gb_Library_use_external,svxcore,icuuc))
$(eval $(call gb_Library_add_exception_objects,svxcore,\ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/core/coreservices \ svx/source/core/coreservices \
svx/source/core/extedit \
svx/source/customshapes/EnhancedCustomShape2d \ svx/source/customshapes/EnhancedCustomShape2d \
svx/source/customshapes/EnhancedCustomShapeGeometry \ svx/source/customshapes/EnhancedCustomShapeGeometry \
svx/source/customshapes/EnhancedCustomShapeTypeNames \ svx/source/customshapes/EnhancedCustomShapeTypeNames \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#************************************************************************* #*************************************************************************
# #
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# Copyright 2000, 2011 Oracle and/or its affiliates. # Copyright 2000, 2011 Oracle and/or its affiliates.
# #
# OpenOffice.org - a multi-platform office productivity suite # OpenOffice.org - a multi-platform office productivity suite
...@@ -553,5 +553,6 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxdllapi.h,svx/svxdllapi.h)) ...@@ -553,5 +553,6 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxdllapi.h,svx/svxdllapi.h))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/colrctrl.hxx,svx/colrctrl.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/colrctrl.hxx,svx/colrctrl.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmdpage.hxx,svx/fmdpage.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmdpage.hxx,svx/fmdpage.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtpitm.hxx,svx/sxmtpitm.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtpitm.hxx,svx/sxmtpitm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/extedit.hxx,svx/extedit.hxx))
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -257,6 +257,11 @@ ...@@ -257,6 +257,11 @@
Command = ".uno:ImageMapDialog" ; \ Command = ".uno:ImageMapDialog" ; \
Text [ en-US ] = "ImageMap" ; \ Text [ en-US ] = "ImageMap" ; \
#define ITEM_EXTERNAL_EDIT \
Identifier = SID_EXTERNAL_EDIT ; \
Command = ".uno:ExternalEdit" ; \
Text [ en-US ] = "Edit with External Tool..." ; \
#define ITEM_VIEW_ATTR_ZOOM \ #define ITEM_VIEW_ATTR_ZOOM \
Identifier = SID_ATTR_ZOOM ; \ Identifier = SID_ATTR_ZOOM ; \
Command = ".uno:Zoom" ; \ Command = ".uno:Zoom" ; \
......
...@@ -28,23 +28,27 @@ ...@@ -28,23 +28,27 @@
#include <osl/process.h> #include <osl/process.h>
#include <vcl/graph.hxx> #include <vcl/graph.hxx>
#include <svtools/grfmgr.hxx> #include <svtools/grfmgr.hxx>
#include <wrtsh.hxx>
#include <vcl/timer.hxx> #include <vcl/timer.hxx>
#include "svx/svxdllapi.h"
struct Data class SVX_DLLPUBLIC ExternalToolEdit
{ {
GraphicObject *pGraphicObject; public:
rtl::OUString fileName; GraphicObject* m_pGraphicObject;
SwWrtShell *rSh ; rtl::OUString m_aFileName;
};
class ExternalProcessClass_Impl ExternalToolEdit();
{ virtual ~ExternalToolEdit();
public:
DECL_LINK( CloseEvent, void *pEvent ); virtual void Update( Graphic& aGraphic ) = 0;
DECL_LINK( StartListeningEvent, void *pEvent ); void Edit( GraphicObject *pGraphic );
DECL_LINK( StartListeningEvent, void *pEvent );
static void threadWorker( void *pThreadData );
static void HandleCloseEvent( ExternalToolEdit* pData );
}; };
void EditWithExternalTool(GraphicObject *pGraphic, SwWrtShell *rSh);
#endif #endif
...@@ -955,9 +955,10 @@ ...@@ -955,9 +955,10 @@
#define SID_INSERT_FORM_SPIN (SID_SVX_START+1110) #define SID_INSERT_FORM_SPIN (SID_SVX_START+1110)
#define SID_INSERT_FORM_VSCROLL (SID_SVX_START+1111) #define SID_INSERT_FORM_VSCROLL (SID_SVX_START+1111)
#define SID_INSERT_FORM_HSCROLL (SID_SVX_START+1112) #define SID_INSERT_FORM_HSCROLL (SID_SVX_START+1112)
#define SID_EXTERNAL_EDIT (SID_SVX_START+1113)
// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
#define SID_SVX_FIRSTFREE (SID_INSERT_FORM_HSCROLL + 1) #define SID_SVX_FIRSTFREE (SID_EXTERNAL_EDIT + 1)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Overflow check for slot IDs // Overflow check for slot IDs
...@@ -970,4 +971,3 @@ ...@@ -970,4 +971,3 @@
#endif // #ifndef _SVX_SVXIDS_HRC #endif // #ifndef _SVX_SVXIDS_HRC
// ******************************************************************* EOF // ******************************************************************* EOF
...@@ -5948,6 +5948,30 @@ SfxBoolItem ImageMapExecute SID_IMAP_EXEC ...@@ -5948,6 +5948,30 @@ SfxBoolItem ImageMapExecute SID_IMAP_EXEC
GroupId = GID_EDIT; GroupId = GID_EDIT;
] ]
SfxVoidItem ExternalEdit SID_EXTERNAL_EDIT
[
/* flags: */
AutoUpdate = FALSE,
Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = TRUE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
/* config: */
AccelConfig = TRUE,
MenuConfig = TRUE,
StatusBarConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = GID_GRAPHIC;
]
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
SfxBoolItem Init3D SID_3D_INIT SfxBoolItem Init3D SID_3D_INIT
...@@ -15323,4 +15347,3 @@ SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT ...@@ -15323,4 +15347,3 @@ SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT
ToolBoxConfig = FALSE, ToolBoxConfig = FALSE,
GroupId = GID_EXPLORER; GroupId = GID_EXPLORER;
] ]
...@@ -22,11 +22,9 @@ ...@@ -22,11 +22,9 @@
* instead of those above. * instead of those above.
*/ */
#include <extedit.hxx> #include <svx/extedit.hxx>
#include <view.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx> #include <sfx2/bindings.hxx>
#include <wrtsh.hxx>
#include <osl/file.hxx> #include <osl/file.hxx>
#include <osl/thread.hxx> #include <osl/thread.hxx>
#include <osl/process.h> #include <osl/process.h>
...@@ -38,8 +36,7 @@ ...@@ -38,8 +36,7 @@
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/graph.hxx> #include <vcl/graph.hxx>
#include <vcl/cvtgrf.hxx> #include <vcl/cvtgrf.hxx>
#include <basesh.hxx>
#include "romenu.hxx"
#include "com/sun/star/system/XSystemShellExecute.hpp" #include "com/sun/star/system/XSystemShellExecute.hpp"
#include "com/sun/star/system/SystemShellExecuteFlags.hpp" #include "com/sun/star/system/SystemShellExecuteFlags.hpp"
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
...@@ -47,66 +44,98 @@ ...@@ -47,66 +44,98 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
ExternalToolEdit::ExternalToolEdit()
{}
ExternalToolEdit::~ExternalToolEdit()
{}
void HandleCloseEvent(const String& rURL, SwWrtShell *rSh) void ExternalToolEdit::HandleCloseEvent(ExternalToolEdit* pData)
{ {
//create a new Graphic
Graphic newGraphic; Graphic newGraphic;
//import the temp file image stream into the newGraphic //import the temp file image stream into the newGraphic
SvStream* pStream = utl::UcbStreamHelper::CreateStream(rURL, STREAM_READ); SvStream* pStream = utl::UcbStreamHelper::CreateStream(pData->m_aFileName, STREAM_READ);
if(pStream) if(pStream)
{ {
GraphicConverter::Import(*pStream, newGraphic); GraphicConverter::Import(*pStream, newGraphic);
// Now update the Graphic in the shell by re-reading from the newGraphic // Now update the Graphic in the shell by re-reading from the newGraphic
// TODO: Make this action Undoable ! // TODO: Make this action Undoable !
rSh->ReRead(aEmptyStr, aEmptyStr, (const Graphic*) &newGraphic); //rSh->ReRead(aEmptyStr, aEmptyStr, (const Graphic*) &newGraphic);
pData->Update( newGraphic );
delete(pStream); delete(pStream);
} }
} }
IMPL_LINK (ExternalProcessClass_Impl, StartListeningEvent, void*, pEvent) IMPL_LINK (ExternalToolEdit, StartListeningEvent, void*, pEvent)
{ {
//Start an event listener implemented via VCL timeout //Start an event listener implemented via VCL timeout
Data *pData = ( Data* )pEvent; ExternalToolEdit* pData = ( ExternalToolEdit* )pEvent;
String aURL( pData->fileName ); String aURL( pData->m_aFileName );
new FileChangedChecker( new FileChangedChecker(
pData->fileName, pData->m_aFileName,
::boost::bind(&HandleCloseEvent,aURL,pData->rSh)); ::boost::bind(&HandleCloseEvent, pData));
return 0; return 0;
} }
void pWorker(void *pThreadData) void ExternalToolEdit::threadWorker(void* pThreadData)
{ {
Data *pData = (Data*)(pThreadData); ExternalToolEdit* pData = (ExternalToolEdit*) pThreadData;
rtl_uString *aFileName = new rtl_uString();
rtl_uString_newFromAscii (
&aFileName, rtl::OUStringToOString(
pData->fileName, RTL_TEXTENCODING_UTF8).getStr());
// Make an asynchronous call to listen to the event of temporary image file // Make an asynchronous call to listen to the event of temporary image file
// getting changed // getting changed
Application::PostUserEvent( Application::PostUserEvent( LINK( NULL, ExternalToolEdit, StartListeningEvent ), pThreadData);
LINK(NULL, ExternalProcessClass_Impl, StartListeningEvent), pThreadData);
uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
::comphelper::getProcessServiceFactory()->createInstance( ::comphelper::getProcessServiceFactory()->createInstance(
DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW ); DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW );
xSystemShellExecute->execute( pData->fileName, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); xSystemShellExecute->execute( pData->m_aFileName, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
} }
void EditWithExternalTool(GraphicObject *pGraphicObject, SwWrtShell *rSh)
void GetPreferedExtension( String &rExt, const Graphic &rGrf )
{
// then propose the "best" filter using the native-info, if applicable
const sal_Char* pExt = "png";
switch( const_cast<Graphic&>(rGrf).GetLink().GetType() )
{
case GFX_LINK_TYPE_NATIVE_GIF:
pExt = "gif";
break;
case GFX_LINK_TYPE_NATIVE_TIF:
pExt = "tif";
break;
case GFX_LINK_TYPE_NATIVE_WMF:
pExt = "wmf";
break;
case GFX_LINK_TYPE_NATIVE_MET:
pExt = "met";
break;
case GFX_LINK_TYPE_NATIVE_PCT:
pExt = "pct";
break;
case GFX_LINK_TYPE_NATIVE_JPG:
pExt = "jpg";
break;
default:
break;
}
rExt.AssignAscii( pExt );
}
void ExternalToolEdit::Edit( GraphicObject* pGraphicObject )
{ {
//Get the graphic from the GraphicObject //Get the graphic from the GraphicObject
const Graphic pGraphic = pGraphicObject->GetGraphic(); m_pGraphicObject = pGraphicObject;
const Graphic aGraphic = pGraphicObject->GetGraphic();
//get the Preferred File Extension for this graphic //get the Preferred File Extension for this graphic
String fExt; String fExtension;
GetPreferedExtension(fExt, pGraphic); GetPreferedExtension(fExtension, aGraphic);
//Create the temp File //Create the temp File
rtl::OUString tempFileBase, tempFileName; rtl::OUString tempFileBase, tempFileName;
...@@ -114,36 +143,28 @@ void EditWithExternalTool(GraphicObject *pGraphicObject, SwWrtShell *rSh) ...@@ -114,36 +143,28 @@ void EditWithExternalTool(GraphicObject *pGraphicObject, SwWrtShell *rSh)
osl::FileBase::createTempFile(0, &pHandle, &tempFileBase); osl::FileBase::createTempFile(0, &pHandle, &tempFileBase);
// Move it to a file name with image extension properly set // Move it to a file name with image extension properly set
tempFileName = tempFileBase + rtl::OUString(String('.')) + tempFileName = tempFileBase + rtl::OUString(String('.')) + rtl::OUString(fExtension);
rtl::OUString(fExt);
osl::File::move(tempFileBase, tempFileName); osl::File::move(tempFileBase, tempFileName);
//Write Graphic to the Temp File //Write Graphic to the Temp File
GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
sal_uInt16 nFilter(rGF.GetExportFormatNumber(fExt)); sal_uInt16 nFilter(rGraphicFilter.GetExportFormatNumber(fExtension));
String aFilter(rGF.GetExportFormatShortName(nFilter)); String aFilter(rGraphicFilter.GetExportFormatShortName(nFilter));
String sPath(tempFileName); String sPath(tempFileName);
// Write the Graphic to the file now // Write the Graphic to the file now
XOutBitmap::WriteGraphic(pGraphic, sPath, aFilter, XOutBitmap::WriteGraphic(aGraphic, sPath, aFilter, XOUTBMP_USE_NATIVE_IF_POSSIBLE|XOUTBMP_DONT_EXPAND_FILENAME);
XOUTBMP_USE_NATIVE_IF_POSSIBLE|XOUTBMP_DONT_EXPAND_FILENAME);
// There is a possiblity that sPath extnesion might have been changed if the // There is a possiblity that sPath extnesion might have been changed if the
// provided extension is not writable // provided extension is not writable
tempFileName = rtl::OUString(sPath); tempFileName = rtl::OUString(sPath);
//Create a thread //Create a thread
rtl_uString *fileName = new rtl_uString(); rtl_uString* aFileName = new rtl_uString();
rtl_uString_newFromAscii( rtl_uString_newFromAscii(
&fileName, rtl::OUStringToOString(tempFileName, &aFileName,
RTL_TEXTENCODING_UTF8).getStr()); rtl::OUStringToOString(tempFileName, RTL_TEXTENCODING_UTF8).getStr());
m_aFileName = aFileName;
// Create the data that is needed by the thread later // Create the data that is needed by the thread later
Data *pThreadData = new Data(); osl_createThread(ExternalToolEdit::threadWorker, this);
pThreadData->pGraphicObject = pGraphicObject;
pThreadData->fileName = fileName;
pThreadData->rSh = rSh ;
osl_createThread(pWorker, pThreadData);
} }
...@@ -585,7 +585,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ ...@@ -585,7 +585,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/ui/docvw/edtwin \ sw/source/ui/docvw/edtwin \
sw/source/ui/docvw/edtwin2 \ sw/source/ui/docvw/edtwin2 \
sw/source/ui/docvw/edtwin3 \ sw/source/ui/docvw/edtwin3 \
sw/source/ui/docvw/extedit \
sw/source/ui/docvw/frmsidebarwincontainer \ sw/source/ui/docvw/frmsidebarwincontainer \
sw/source/ui/docvw/romenu \ sw/source/ui/docvw/romenu \
sw/source/ui/docvw/srcedtw \ sw/source/ui/docvw/srcedtw \
......
...@@ -853,14 +853,11 @@ included in c-context files, so c++ style stuff will cause problems. ...@@ -853,14 +853,11 @@ included in c-context files, so c++ style stuff will cause problems.
#define FN_UNO_TABLE_NAME (FN_EXTRA2 + 111) #define FN_UNO_TABLE_NAME (FN_EXTRA2 + 111)
#define FN_UNO_META (FN_EXTRA2 + 112) #define FN_UNO_META (FN_EXTRA2 + 112)
#define FN_UNO_NESTED_TEXT_CONTENT (FN_EXTRA2 + 113) #define FN_UNO_NESTED_TEXT_CONTENT (FN_EXTRA2 + 113)
/* Edit Graphic with External Tool */
#define FN_EXTERNAL_EDIT (FN_EXTRA2 + 114)
/* Navigation buttons */ /* Navigation buttons */
#define FN_NAVIGATION_BACK (FN_EXTRA2 + 115) #define FN_NAVIGATION_BACK (FN_EXTRA2 + 115)
#define FN_NAVIGATION_FORWARD (FN_EXTRA2 + 116) #define FN_NAVIGATION_FORWARD (FN_EXTRA2 + 116)
// #i972: bool items to be passed to SwFrmPage for evaluation // #i972: bool items to be passed to SwFrmPage for evaluation
#define FN_OLE_IS_MATH (FN_EXTRA2 + 114) #define FN_OLE_IS_MATH (FN_EXTRA2 + 114)
#define FN_MATH_BASELINE_ALIGNMENT (FN_EXTRA2 + 115) #define FN_MATH_BASELINE_ALIGNMENT (FN_EXTRA2 + 115)
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#define CMD_FN_FORMAT_FRAME_DLG ".uno:FrameDialog" #define CMD_FN_FORMAT_FRAME_DLG ".uno:FrameDialog"
#define CMD_FN_FORMAT_GRAFIC_DLG ".uno:GraphicDialog" #define CMD_FN_FORMAT_GRAFIC_DLG ".uno:GraphicDialog"
#define CMD_FN_SAVE_GRAPHIC ".uno:SaveGraphic" #define CMD_FN_SAVE_GRAPHIC ".uno:SaveGraphic"
#define CMD_FN_EXTERNAL_EDIT ".uno:ExternalEdit"
#define CMD_FN_NUM_BULLET_UP ".uno:IncrementLevel" #define CMD_FN_NUM_BULLET_UP ".uno:IncrementLevel"
#define CMD_FN_EDIT_IDX_ENTRY_DLG ".uno:IndexEntryDialog" #define CMD_FN_EDIT_IDX_ENTRY_DLG ".uno:IndexEntryDialog"
#define CMD_FN_INSERT_FLD_AUTHOR ".uno:InsertAuthorField" #define CMD_FN_INSERT_FLD_AUTHOR ".uno:InsertAuthorField"
......
...@@ -58,11 +58,12 @@ interface BaseTextGraphic ...@@ -58,11 +58,12 @@ interface BaseTextGraphic
StateMethod = GetAttrState ; StateMethod = GetAttrState ;
] ]
FN_EXTERNAL_EDIT SID_EXTERNAL_EDIT
[ [
ExecMethod = Execute ; ExecMethod = Execute ;
StateMethod = GetAttrState ; StateMethod = GetAttrState ;
] ]
SID_INSERT_GRAPHIC // zeigt auf FN_FORMAT_GRAFIC_DLG SID_INSERT_GRAPHIC // zeigt auf FN_FORMAT_GRAFIC_DLG
[ [
ExecMethod = Execute ; ExecMethod = Execute ;
...@@ -218,4 +219,3 @@ interface BaseTextGraphic ...@@ -218,4 +219,3 @@ interface BaseTextGraphic
] ]
} }
...@@ -3462,33 +3462,6 @@ SfxVoidItem SaveGraphic FN_SAVE_GRAPHIC ...@@ -3462,33 +3462,6 @@ SfxVoidItem SaveGraphic FN_SAVE_GRAPHIC
GroupId = GID_GRAPHIC; GroupId = GID_GRAPHIC;
] ]
//------------------------------------------------------------------------
SfxVoidItem ExternalEdit FN_EXTERNAL_EDIT
()
[
/* flags: */
AutoUpdate = FALSE,
Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = TRUE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
/* config: */
AccelConfig = TRUE,
MenuConfig = TRUE,
StatusBarConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = GID_GRAPHIC;
]
//------------------------------------------------------------------------
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
SfxVoidItem Grow FN_GROW_FONT_SIZE SfxVoidItem Grow FN_GROW_FONT_SIZE
() ()
......
...@@ -1290,9 +1290,7 @@ Menu MN_GRF_POPUPMENU ...@@ -1290,9 +1290,7 @@ Menu MN_GRF_POPUPMENU
SEPARATOR; SEPARATOR;
MenuItem MenuItem
{ {
Identifier = FN_EXTERNAL_EDIT ; ITEM_EXTERNAL_EDIT
HelpID = CMD_FN_EXTERNAL_EDIT ;
Text [ en-US ] = "Edit with External Tool...";
}; };
SEPARATOR; SEPARATOR;
MenuItem MenuItem
...@@ -1462,4 +1460,3 @@ Menu MN_TEXT_POPUPMENU ...@@ -1462,4 +1460,3 @@ Menu MN_TEXT_POPUPMENU
BASE_TEXT_POPUPMENU_BEGIN BASE_TEXT_POPUPMENU_BEGIN
BASE_TEXT_POPUPMENU_NOWEB BASE_TEXT_POPUPMENU_NOWEB
BASE_TEXT_POPUPMENU_END BASE_TEXT_POPUPMENU_END
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
#include <swwait.hxx> #include <swwait.hxx>
#include <shells.hrc> #include <shells.hrc>
#include <popup.hrc> #include <popup.hrc>
#include <extedit.hxx> #include <svx/extedit.hxx>
#define SwGrfShell #define SwGrfShell
#include <sfx2/msg.hxx> #include <sfx2/msg.hxx>
#include "swslots.hxx" #include "swslots.hxx"
...@@ -79,6 +79,21 @@ ...@@ -79,6 +79,21 @@
#define TOOLBOX_NAME ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "colorbar" ) ) #define TOOLBOX_NAME ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "colorbar" ) )
class SwExternalToolEdit : public ExternalToolEdit
{
SwWrtShell* m_pShell;
public:
SwExternalToolEdit ( SwWrtShell* pShell ) :
m_pShell (pShell)
{}
virtual void Update( Graphic& aGraphic )
{
m_pShell->ReRead(aEmptyStr, aEmptyStr, (const Graphic*) &aGraphic);
}
};
SFX_IMPL_INTERFACE(SwGrfShell, SwBaseShell, SW_RES(STR_SHELLNAME_GRAPHIC)) SFX_IMPL_INTERFACE(SwGrfShell, SwBaseShell, SW_RES(STR_SHELLNAME_GRAPHIC))
{ {
SFX_POPUPMENU_REGISTRATION(SW_RES(MN_GRF_POPUPMENU)); SFX_POPUPMENU_REGISTRATION(SW_RES(MN_GRF_POPUPMENU));
...@@ -108,7 +123,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) ...@@ -108,7 +123,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
} }
} }
break; break;
case FN_EXTERNAL_EDIT: case SID_EXTERNAL_EDIT:
{ {
/* When the graphic is selected to be opened via some external tool /* When the graphic is selected to be opened via some external tool
* for advanced editing * for advanced editing
...@@ -116,7 +131,8 @@ void SwGrfShell::Execute(SfxRequest &rReq) ...@@ -116,7 +131,8 @@ void SwGrfShell::Execute(SfxRequest &rReq)
GraphicObject *pGraphicObject = (GraphicObject *) rSh.GetGraphicObj(); GraphicObject *pGraphicObject = (GraphicObject *) rSh.GetGraphicObj();
if(0 != pGraphicObject) if(0 != pGraphicObject)
{ {
EditWithExternalTool(pGraphicObject, &rSh); SwExternalToolEdit* externalToolEdit = new SwExternalToolEdit( &rSh );
externalToolEdit->Edit ( pGraphicObject );
} }
} }
break; break;
...@@ -541,10 +557,10 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) ...@@ -541,10 +557,10 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
if( rSh.GetGraphicType() == GRAPHIC_NONE ) if( rSh.GetGraphicType() == GRAPHIC_NONE )
bDisable = sal_True; bDisable = sal_True;
break; break;
/* case SID_EXTERNAL_EDIT:
* If the Graphic is None type it should be externally editable /*
*/ * If the Graphic is None type it should be externally editable
case FN_EXTERNAL_EDIT: */
if( rSh.GetGraphicType() == GRAPHIC_NONE ) if( rSh.GetGraphicType() == GRAPHIC_NONE )
bDisable = sal_True; bDisable = sal_True;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment