summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2012-06-28 00:19:28 +0200
committerTomaž Vajngerl <quikee@gmail.com>2012-06-28 00:27:47 +0200
commit7a3ae89a12b2c11e90d3f0c76293ddb63203bd2a (patch)
tree0882ad037d36e6d2281d22e8dbffbb635ca7c138
parente18655e47530f1e399cb546a6001fa0aa0f1873c (diff)
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
-rw-r--r--sc/sdi/graphsh.sdi18
-rw-r--r--sc/source/ui/drawfunc/graphsh.cxx66
-rw-r--r--sc/source/ui/drawfunc/objdraw.src4
-rw-r--r--sc/source/ui/inc/graphsh.hxx3
-rw-r--r--svx/Library_svxcore.mk1
-rw-r--r--svx/Package_inc.mk3
-rw-r--r--svx/inc/globlmn_tmpl.hrc5
-rw-r--r--svx/inc/svx/extedit.hxx (renamed from sw/source/ui/inc/extedit.hxx)28
-rw-r--r--svx/inc/svx/svxids.hrc4
-rw-r--r--svx/sdi/svx.sdi25
-rw-r--r--svx/source/core/extedit.cxx (renamed from sw/source/ui/docvw/extedit.cxx)111
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/inc/cmdid.h3
-rw-r--r--sw/inc/swcommands.h1
-rw-r--r--sw/sdi/_grfsh.sdi4
-rw-r--r--sw/sdi/swriter.sdi27
-rw-r--r--sw/source/ui/app/mn.src5
-rw-r--r--sw/source/ui/shells/grfsh.cxx30
18 files changed, 225 insertions, 114 deletions
diff --git a/sc/sdi/graphsh.sdi b/sc/sdi/graphsh.sdi
index cbf2583556b2..6eb051bc5eaf 100644
--- a/sc/sdi/graphsh.sdi
+++ b/sc/sdi/graphsh.sdi
@@ -128,11 +128,18 @@ interface GraphSelection
ExecMethod = Execute;
StateMethod = GetAttrState;
]
- SID_COLOR_SETTINGS
- [
- ExecMethod = Execute;
- StateMethod = GetAttrState;
- ]
+
+ SID_COLOR_SETTINGS
+ [
+ ExecMethod = Execute;
+ StateMethod = GetAttrState;
+ ]
+
+ SID_EXTERNAL_EDIT
+ [
+ ExecMethod = ExecuteExternalEdit;
+ StateMethod = GetExternalEditState;
+ ]
}
// ===========================================================================
@@ -140,4 +147,3 @@ shell ScGraphicShell : ScDrawShell
{
import GraphSelection;
}
-
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index 751fc41cab63..ff4d43d72dae 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -39,12 +39,40 @@
#include "viewdata.hxx"
#include "drawview.hxx"
#include "scresid.hxx"
+#include <svx/extedit.hxx>
#define ScGraphicShell
#include "scslots.hxx"
#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) )
{
@@ -140,4 +168,42 @@ void ScGraphicShell::ExecuteFilter( SfxRequest& rReq )
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: */
diff --git a/sc/source/ui/drawfunc/objdraw.src b/sc/source/ui/drawfunc/objdraw.src
index 5df0c5f3f490..02fc43505b1b 100644
--- a/sc/source/ui/drawfunc/objdraw.src
+++ b/sc/source/ui/drawfunc/objdraw.src
@@ -404,7 +404,7 @@ String RID_POPUP_DRAW
Text [ en-US ] = "Pop-up menu for drawing objects" ;
};
//
- // Popup-Menue fuer (allgemeine) Zeichenobjekte
+ // Pop-up menu for drawing objects
//
Menu RID_POPUP_DRAW
{
@@ -527,6 +527,7 @@ Menu RID_POPUP_GRAPHIC
MN_EDITLNK
MN_DELLNK
MenuItem { ITEM_OPEN_HYPERLINK };
+ MenuItem { ITEM_EXTERNAL_EDIT };
};
};
@@ -657,4 +658,3 @@ Menu RID_POPUP_DRAWTEXT
};
};
};
-
diff --git a/sc/source/ui/inc/graphsh.hxx b/sc/source/ui/inc/graphsh.hxx
index 7e7c5fa6e62d..3c700c73ad12 100644
--- a/sc/source/ui/inc/graphsh.hxx
+++ b/sc/source/ui/inc/graphsh.hxx
@@ -44,6 +44,9 @@ public:
void ExecuteFilter(SfxRequest& rReq);
void GetFilterState(SfxItemSet &rSet);
+
+ void ExecuteExternalEdit(SfxRequest& rReq);
+ void GetExternalEditState(SfxItemSet &rSet);
};
#endif
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index beda9bd52366..8361ec162224 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -92,6 +92,7 @@ $(eval $(call gb_Library_use_external,svxcore,icuuc))
$(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/core/coreservices \
+ svx/source/core/extedit \
svx/source/customshapes/EnhancedCustomShape2d \
svx/source/customshapes/EnhancedCustomShapeGeometry \
svx/source/customshapes/EnhancedCustomShapeTypeNames \
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
index df90d0fc74cc..b6888d1a12a3 100644
--- a/svx/Package_inc.mk
+++ b/svx/Package_inc.mk
@@ -2,7 +2,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2000, 2011 Oracle and/or its affiliates.
#
# 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))
$(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/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:
diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc
index f6b8f73b170c..e85bd91398f8 100644
--- a/svx/inc/globlmn_tmpl.hrc
+++ b/svx/inc/globlmn_tmpl.hrc
@@ -257,6 +257,11 @@
Command = ".uno:ImageMapDialog" ; \
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 \
Identifier = SID_ATTR_ZOOM ; \
Command = ".uno:Zoom" ; \
diff --git a/sw/source/ui/inc/extedit.hxx b/svx/inc/svx/extedit.hxx
index d013890a338d..b286ad825af1 100644
--- a/sw/source/ui/inc/extedit.hxx
+++ b/svx/inc/svx/extedit.hxx
@@ -28,23 +28,27 @@
#include <osl/process.h>
#include <vcl/graph.hxx>
#include <svtools/grfmgr.hxx>
-#include <wrtsh.hxx>
#include <vcl/timer.hxx>
+#include "svx/svxdllapi.h"
-struct Data
+class SVX_DLLPUBLIC ExternalToolEdit
{
- GraphicObject *pGraphicObject;
- rtl::OUString fileName;
- SwWrtShell *rSh ;
-};
+public:
+ GraphicObject* m_pGraphicObject;
+ rtl::OUString m_aFileName;
-class ExternalProcessClass_Impl
-{
- public:
- DECL_LINK( CloseEvent, void *pEvent );
- DECL_LINK( StartListeningEvent, void *pEvent );
+ ExternalToolEdit();
+ virtual ~ExternalToolEdit();
+
+ virtual void Update( Graphic& aGraphic ) = 0;
+ 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
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index fca583186b5f..918d44d60b95 100644
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -955,9 +955,10 @@
#define SID_INSERT_FORM_SPIN (SID_SVX_START+1110)
#define SID_INSERT_FORM_VSCROLL (SID_SVX_START+1111)
#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
-#define SID_SVX_FIRSTFREE (SID_INSERT_FORM_HSCROLL + 1)
+#define SID_SVX_FIRSTFREE (SID_EXTERNAL_EDIT + 1)
// --------------------------------------------------------------------------
// Overflow check for slot IDs
@@ -970,4 +971,3 @@
#endif // #ifndef _SVX_SVXIDS_HRC
// ******************************************************************* EOF
-
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 5e1917576bb6..8b168c8eabde 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -5948,6 +5948,30 @@ SfxBoolItem ImageMapExecute SID_IMAP_EXEC
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
@@ -15323,4 +15347,3 @@ SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT
ToolBoxConfig = FALSE,
GroupId = GID_EXPLORER;
]
-
diff --git a/sw/source/ui/docvw/extedit.cxx b/svx/source/core/extedit.cxx
index 8b70262e2568..eddb16acd4b4 100644
--- a/sw/source/ui/docvw/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -22,11 +22,9 @@
* instead of those above.
*/
-#include <extedit.hxx>
-#include <view.hxx>
+#include <svx/extedit.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
-#include <wrtsh.hxx>
#include <osl/file.hxx>
#include <osl/thread.hxx>
#include <osl/process.h>
@@ -38,8 +36,7 @@
#include <vcl/svapp.hxx>
#include <vcl/graph.hxx>
#include <vcl/cvtgrf.hxx>
-#include <basesh.hxx>
-#include "romenu.hxx"
+
#include "com/sun/star/system/XSystemShellExecute.hpp"
#include "com/sun/star/system/SystemShellExecuteFlags.hpp"
#include <comphelper/processfactory.hxx>
@@ -47,66 +44,98 @@
#include <boost/bind.hpp>
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;
//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)
{
GraphicConverter::Import(*pStream, newGraphic);
// Now update the Graphic in the shell by re-reading from the newGraphic
// TODO: Make this action Undoable !
- rSh->ReRead(aEmptyStr, aEmptyStr, (const Graphic*) &newGraphic);
+ //rSh->ReRead(aEmptyStr, aEmptyStr, (const Graphic*) &newGraphic);
+ pData->Update( newGraphic );
delete(pStream);
}
}
-IMPL_LINK (ExternalProcessClass_Impl, StartListeningEvent, void*, pEvent)
+IMPL_LINK (ExternalToolEdit, StartListeningEvent, void*, pEvent)
{
//Start an event listener implemented via VCL timeout
- Data *pData = ( Data* )pEvent;
- String aURL( pData->fileName );
+ ExternalToolEdit* pData = ( ExternalToolEdit* )pEvent;
+ String aURL( pData->m_aFileName );
new FileChangedChecker(
- pData->fileName,
- ::boost::bind(&HandleCloseEvent,aURL,pData->rSh));
+ pData->m_aFileName,
+ ::boost::bind(&HandleCloseEvent, pData));
return 0;
}
-void pWorker(void *pThreadData)
+void ExternalToolEdit::threadWorker(void* pThreadData)
{
- Data *pData = (Data*)(pThreadData);
- rtl_uString *aFileName = new rtl_uString();
- rtl_uString_newFromAscii (
- &aFileName, rtl::OUStringToOString(
- pData->fileName, RTL_TEXTENCODING_UTF8).getStr());
+ ExternalToolEdit* pData = (ExternalToolEdit*) pThreadData;
// Make an asynchronous call to listen to the event of temporary image file
// getting changed
- Application::PostUserEvent(
- LINK(NULL, ExternalProcessClass_Impl, StartListeningEvent), pThreadData);
+ Application::PostUserEvent( LINK( NULL, ExternalToolEdit, StartListeningEvent ), pThreadData);
uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
::comphelper::getProcessServiceFactory()->createInstance(
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
- const Graphic pGraphic = pGraphicObject->GetGraphic();
+ m_pGraphicObject = pGraphicObject;
+ const Graphic aGraphic = pGraphicObject->GetGraphic();
//get the Preferred File Extension for this graphic
- String fExt;
- GetPreferedExtension(fExt, pGraphic);
+ String fExtension;
+ GetPreferedExtension(fExtension, aGraphic);
//Create the temp File
rtl::OUString tempFileBase, tempFileName;
@@ -114,36 +143,28 @@ void EditWithExternalTool(GraphicObject *pGraphicObject, SwWrtShell *rSh)
osl::FileBase::createTempFile(0, &pHandle, &tempFileBase);
// Move it to a file name with image extension properly set
- tempFileName = tempFileBase + rtl::OUString(String('.')) +
- rtl::OUString(fExt);
+ tempFileName = tempFileBase + rtl::OUString(String('.')) + rtl::OUString(fExtension);
osl::File::move(tempFileBase, tempFileName);
//Write Graphic to the Temp File
- GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
- sal_uInt16 nFilter(rGF.GetExportFormatNumber(fExt));
- String aFilter(rGF.GetExportFormatShortName(nFilter));
+ GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+ sal_uInt16 nFilter(rGraphicFilter.GetExportFormatNumber(fExtension));
+ String aFilter(rGraphicFilter.GetExportFormatShortName(nFilter));
String sPath(tempFileName);
// Write the Graphic to the file now
- XOutBitmap::WriteGraphic(pGraphic, sPath, aFilter,
- XOUTBMP_USE_NATIVE_IF_POSSIBLE|XOUTBMP_DONT_EXPAND_FILENAME);
+ XOutBitmap::WriteGraphic(aGraphic, sPath, aFilter, XOUTBMP_USE_NATIVE_IF_POSSIBLE|XOUTBMP_DONT_EXPAND_FILENAME);
// There is a possiblity that sPath extnesion might have been changed if the
// provided extension is not writable
tempFileName = rtl::OUString(sPath);
//Create a thread
- rtl_uString *fileName = new rtl_uString();
+ rtl_uString* aFileName = new rtl_uString();
rtl_uString_newFromAscii(
- &fileName, rtl::OUStringToOString(tempFileName,
- RTL_TEXTENCODING_UTF8).getStr());
-
+ &aFileName,
+ rtl::OUStringToOString(tempFileName, RTL_TEXTENCODING_UTF8).getStr());
+ m_aFileName = aFileName;
// Create the data that is needed by the thread later
- Data *pThreadData = new Data();
- pThreadData->pGraphicObject = pGraphicObject;
- pThreadData->fileName = fileName;
- pThreadData->rSh = rSh ;
-
- osl_createThread(pWorker, pThreadData);
-
+ osl_createThread(ExternalToolEdit::threadWorker, this);
}
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 1ddc142c108c..dc25ed8acc57 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -585,7 +585,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/ui/docvw/edtwin \
sw/source/ui/docvw/edtwin2 \
sw/source/ui/docvw/edtwin3 \
- sw/source/ui/docvw/extedit \
sw/source/ui/docvw/frmsidebarwincontainer \
sw/source/ui/docvw/romenu \
sw/source/ui/docvw/srcedtw \
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index ac547f67a226..2262521988ef 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -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_META (FN_EXTRA2 + 112)
#define FN_UNO_NESTED_TEXT_CONTENT (FN_EXTRA2 + 113)
-/* Edit Graphic with External Tool */
-#define FN_EXTERNAL_EDIT (FN_EXTRA2 + 114)
/* Navigation buttons */
#define FN_NAVIGATION_BACK (FN_EXTRA2 + 115)
#define FN_NAVIGATION_FORWARD (FN_EXTRA2 + 116)
-
// #i972: bool items to be passed to SwFrmPage for evaluation
#define FN_OLE_IS_MATH (FN_EXTRA2 + 114)
#define FN_MATH_BASELINE_ALIGNMENT (FN_EXTRA2 + 115)
diff --git a/sw/inc/swcommands.h b/sw/inc/swcommands.h
index 530e3a6d02c1..69e546c06de6 100644
--- a/sw/inc/swcommands.h
+++ b/sw/inc/swcommands.h
@@ -48,7 +48,6 @@
#define CMD_FN_FORMAT_FRAME_DLG ".uno:FrameDialog"
#define CMD_FN_FORMAT_GRAFIC_DLG ".uno:GraphicDialog"
#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_EDIT_IDX_ENTRY_DLG ".uno:IndexEntryDialog"
#define CMD_FN_INSERT_FLD_AUTHOR ".uno:InsertAuthorField"
diff --git a/sw/sdi/_grfsh.sdi b/sw/sdi/_grfsh.sdi
index d60dc39d4b36..42d9666a7105 100644
--- a/sw/sdi/_grfsh.sdi
+++ b/sw/sdi/_grfsh.sdi
@@ -58,11 +58,12 @@ interface BaseTextGraphic
StateMethod = GetAttrState ;
]
- FN_EXTERNAL_EDIT
+ SID_EXTERNAL_EDIT
[
ExecMethod = Execute ;
StateMethod = GetAttrState ;
]
+
SID_INSERT_GRAPHIC // zeigt auf FN_FORMAT_GRAFIC_DLG
[
ExecMethod = Execute ;
@@ -218,4 +219,3 @@ interface BaseTextGraphic
]
}
-
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index bab0c1b7442f..7e9680e58f80 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -3462,33 +3462,6 @@ SfxVoidItem SaveGraphic FN_SAVE_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
()
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index deed82e7c615..8b312910a3c0 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -1290,9 +1290,7 @@ Menu MN_GRF_POPUPMENU
SEPARATOR;
MenuItem
{
- Identifier = FN_EXTERNAL_EDIT ;
- HelpID = CMD_FN_EXTERNAL_EDIT ;
- Text [ en-US ] = "Edit with External Tool...";
+ ITEM_EXTERNAL_EDIT
};
SEPARATOR;
MenuItem
@@ -1462,4 +1460,3 @@ Menu MN_TEXT_POPUPMENU
BASE_TEXT_POPUPMENU_BEGIN
BASE_TEXT_POPUPMENU_NOWEB
BASE_TEXT_POPUPMENU_END
-
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 898da61dd449..f47284124ea0 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -70,7 +70,7 @@
#include <swwait.hxx>
#include <shells.hrc>
#include <popup.hrc>
-#include <extedit.hxx>
+#include <svx/extedit.hxx>
#define SwGrfShell
#include <sfx2/msg.hxx>
#include "swslots.hxx"
@@ -79,6 +79,21 @@
#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_POPUPMENU_REGISTRATION(SW_RES(MN_GRF_POPUPMENU));
@@ -108,7 +123,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
}
}
break;
- case FN_EXTERNAL_EDIT:
+ case SID_EXTERNAL_EDIT:
{
/* When the graphic is selected to be opened via some external tool
* for advanced editing
@@ -116,7 +131,8 @@ void SwGrfShell::Execute(SfxRequest &rReq)
GraphicObject *pGraphicObject = (GraphicObject *) rSh.GetGraphicObj();
if(0 != pGraphicObject)
{
- EditWithExternalTool(pGraphicObject, &rSh);
+ SwExternalToolEdit* externalToolEdit = new SwExternalToolEdit( &rSh );
+ externalToolEdit->Edit ( pGraphicObject );
}
}
break;
@@ -541,10 +557,10 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
if( rSh.GetGraphicType() == GRAPHIC_NONE )
bDisable = sal_True;
break;
- /*
- * If the Graphic is None type it should be externally editable
- */
- case FN_EXTERNAL_EDIT:
+ case SID_EXTERNAL_EDIT:
+ /*
+ * If the Graphic is None type it should be externally editable
+ */
if( rSh.GetGraphicType() == GRAPHIC_NONE )
bDisable = sal_True;
break;