summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-01-16 23:56:09 +0100
committerMichael Stahl <mstahl@redhat.com>2015-01-17 01:03:30 +0100
commit5f6bdce0c0ac687f418821ce328f2987bf340cda (patch)
treee59f769e234d5feee4a54d60f8c2ac9e1a21f920 /sw
parent3b70717f02d5f2f255de078bd277e8662884bfb0 (diff)
rhbz#1136013: svx: try to make the ExternalToolEdit not crash all the time
This thing was starting a timer that re-starts itself forever, and when the file it was watching changed, it would just assume the drawing objects were still there (and the document, for that matter...) Change-Id: I35f187f0828097a05618dc1733dce819fc6bffc6
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/inc/grfsh.hxx4
-rw-r--r--sw/source/uibase/shells/grfsh.cxx49
2 files changed, 36 insertions, 17 deletions
diff --git a/sw/source/uibase/inc/grfsh.hxx b/sw/source/uibase/inc/grfsh.hxx
index 75c1ab0a53ff..5a74c46487f4 100644
--- a/sw/source/uibase/inc/grfsh.hxx
+++ b/sw/source/uibase/inc/grfsh.hxx
@@ -23,6 +23,9 @@
class SwGrfShell: public SwBaseShell
{
+ class SwExternalToolEdit;
+ std::vector<std::unique_ptr<SwExternalToolEdit>> m_ExternalEdits;
+
public:
SFX_DECL_INTERFACE(SW_GRFSHELL)
@@ -39,6 +42,7 @@ public:
void GetAttrStateForRotation(SfxItemSet& rRequest);
SwGrfShell(SwView &rView);
+ virtual ~SwGrfShell();
};
#endif
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index b6714ce6e8ac..b261adcd42a7 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -75,27 +75,37 @@
#include <sfx2/msg.hxx>
#include "swslots.hxx"
#include "swabstdlg.hxx"
+#include <unocrsr.hxx>
#include <boost/scoped_ptr.hpp>
#define TOOLBOX_NAME "colorbar"
-namespace
+class SwGrfShell::SwExternalToolEdit
+ : public ExternalToolEdit
{
- class SwExternalToolEdit : public ExternalToolEdit
+private:
+ SwWrtShell *const m_pShell;
+ ::std::unique_ptr<SwUnoCrsr> const m_pCursor;
+
+public:
+ SwExternalToolEdit(SwWrtShell *const pShell)
+ : m_pShell(pShell)
+ , m_pCursor( // need only Point, must point to SwGrfNode
+ pShell->GetDoc()->CreateUnoCrsr(
+ *pShell->GetCurrentShellCursor().GetPoint()))
{
- SwWrtShell* m_pShell;
-
- public:
- SwExternalToolEdit ( SwWrtShell* pShell ) :
- m_pShell (pShell)
- {}
+ }
- virtual void Update( Graphic& aGraphic ) SAL_OVERRIDE
- {
- m_pShell->ReRead(OUString(), OUString(), (const Graphic*) &aGraphic);
- }
- };
-}
+ virtual void Update(Graphic & rGraphic) SAL_OVERRIDE
+ {
+ DBG_TESTSOLARMUTEX();
+ m_pShell->Push();
+ m_pShell->GetCurrentShellCursor().DeleteMark();
+ *m_pShell->GetCurrentShellCursor().GetPoint() = *m_pCursor->GetPoint();
+ m_pShell->ReRead(OUString(), OUString(), &rGraphic);
+ m_pShell->Pop();
+ }
+};
SFX_IMPL_INTERFACE(SwGrfShell, SwBaseShell)
@@ -180,11 +190,12 @@ void SwGrfShell::Execute(SfxRequest &rReq)
{
// When the graphic is selected to be opened via some external tool
// for advanced editing
- GraphicObject *pGraphicObject = (GraphicObject *) rSh.GetGraphicObj();
+ GraphicObject const*const pGraphicObject(rSh.GetGraphicObj());
if(0 != pGraphicObject)
{
- SwExternalToolEdit* externalToolEdit = new SwExternalToolEdit( &rSh );
- externalToolEdit->Edit ( pGraphicObject );
+ m_ExternalEdits.push_back(std::unique_ptr<SwExternalToolEdit>(
+ new SwExternalToolEdit(&rSh)));
+ m_ExternalEdits.back()->Edit(pGraphicObject);
}
}
break;
@@ -905,6 +916,10 @@ void SwGrfShell::GetAttrStateForRotation(SfxItemSet &rSet)
SetGetStateSet( 0 );
}
+SwGrfShell::~SwGrfShell()
+{
+}
+
SwGrfShell::SwGrfShell(SwView &_rView) :
SwBaseShell(_rView)
{