summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-01-16 23:56:09 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-01-19 12:28:41 +0000
commit0e0595c59ba399b265146c256bf0e0631623e898 (patch)
treef8d21e69e1f2e40ff40c615b05e2b69f0a179a95 /sw/source/uibase
parente02c897a4bbb33d8b506077048557d9c37bd8852 (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...) (cherry picked from commit 5f6bdce0c0ac687f418821ce328f2987bf340cda) Conflicts: sc/source/ui/drawfunc/graphsh.cxx Change-Id: I35f187f0828097a05618dc1733dce819fc6bffc6 Reviewed-on: https://gerrit.libreoffice.org/13995 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase')
-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 2679b8b4f6c8..aef74b1b338c 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, SW_RES(STR_SHELLNAME_GRAPHIC))
@@ -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)
{