summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/svdmodel.hxx1
-rw-r--r--svx/source/form/fmscriptingenv.cxx83
-rw-r--r--svx/source/form/fmview.cxx1
-rw-r--r--svx/source/form/formcontroller.cxx2
-rw-r--r--svx/source/svdraw/svdmodel.cxx5
-rw-r--r--svx/source/unodraw/unopage.cxx14
-rw-r--r--svx/source/unodraw/unoshape.cxx9
7 files changed, 39 insertions, 76 deletions
diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx
index b1bb7d74887f..21e9b5c5a05f 100644
--- a/svx/inc/svx/svdmodel.hxx
+++ b/svx/inc/svx/svdmodel.hxx
@@ -632,6 +632,7 @@ public:
/** application can set it's own undo manager, BegUndo, EndUndo and AddUndoAction
calls are routet to this interface if given */
void SetSdrUndoManager( SfxUndoManager* pUndoManager );
+ SfxUndoManager* GetSdrUndoManager() const;
/** applications can set their own undo factory to overide creation of
undo actions. The SdrModel will become owner of the given SdrUndoFactory
diff --git a/svx/source/form/fmscriptingenv.cxx b/svx/source/form/fmscriptingenv.cxx
index 154999333296..f351dba85815 100644
--- a/svx/source/form/fmscriptingenv.cxx
+++ b/svx/source/form/fmscriptingenv.cxx
@@ -28,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#include "fmscriptingenv.hxx"
-#include <svx/fmmodel.hxx>
+#include "svx/fmmodel.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/lang/IllegalArgumentException.hpp>
@@ -37,6 +37,7 @@
#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
/** === end UNO includes === **/
+
#include <tools/diagnose_ex.h>
#include <cppuhelper/implbase1.hxx>
#include <comphelper/implementationreference.hxx>
@@ -45,6 +46,8 @@
#include <vcl/svapp.hxx>
#include <vos/mutex.hxx>
#include <sfx2/objsh.hxx>
+#include <sfx2/app.hxx>
+#include <basic/basmgr.hxx>
#include <boost/shared_ptr.hpp>
@@ -416,60 +419,6 @@ namespace svxform
m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs );
}
-
- //................................................................
- //. QualifiedBasicScript
- //................................................................
- class QualifiedBasicScript : public IScript
- {
- SfxObjectShell& m_rObjectShell;
- const ::rtl::OUString m_sMacroLocation;
- const ::rtl::OUString m_sScriptCode;
-
- public:
- QualifiedBasicScript( SfxObjectShell& _rObjectShell, const ::rtl::OUString& _rLocation, const ::rtl::OUString& _rScriptCode )
- :m_rObjectShell( _rObjectShell )
- ,m_sMacroLocation( _rLocation )
- ,m_sScriptCode( _rScriptCode )
- {
- }
-
- // IScript
- virtual void invoke( const Sequence< Any >& _rArguments, Any& _rSynchronousResult );
- };
-
- //................................................................
- void QualifiedBasicScript::invoke( const Sequence< Any >& _rArguments, Any& _rSynchronousResult )
- {
- m_rObjectShell.CallStarBasicScript( m_sScriptCode, m_sMacroLocation,
- &_rArguments, &_rSynchronousResult );
- }
-
- //................................................................
- //. UnqualifiedBasicScript
- //................................................................
- class UnqualifiedBasicScript : public IScript
- {
- SfxObjectShell& m_rObjectShell;
- const ::rtl::OUString m_sScriptCode;
-
- public:
- UnqualifiedBasicScript( SfxObjectShell& _rObjectShell, const ::rtl::OUString& _rScriptCode )
- :m_rObjectShell( _rObjectShell )
- ,m_sScriptCode( _rScriptCode )
- {
- }
-
- // IScript
- virtual void invoke( const Sequence< Any >& _rArguments, Any& _rSynchronousResult );
- };
-
- //................................................................
- void UnqualifiedBasicScript::invoke( const Sequence< Any >& _rArguments, Any& _rSynchronousResult )
- {
- m_rObjectShell.CallScript( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ), m_sScriptCode,
- &_rArguments, &_rSynchronousResult );
- }
}
//--------------------------------------------------------------------
@@ -513,14 +462,24 @@ namespace svxform
sScriptCode = sScriptCode.copy( nPrefixLen + 1 );
}
- if ( sMacroLocation.getLength() )
- { // we have a StarBasic macro with fully-qualified macro location
- pScript.reset( new QualifiedBasicScript( *xObjectShell, sMacroLocation, sScriptCode ) );
- }
- else
- { // we have a StarBasic macro without qualified location - let the object shell gues ....
- pScript.reset( new UnqualifiedBasicScript( *xObjectShell, sScriptCode ) );
+ if ( !sMacroLocation.getLength() )
+ {
+ // legacy format: use the app-wide Basic, if it has a respective method, otherwise fall back to the doc's Basic
+ if ( SFX_APP()->GetBasicManager()->HasMacro( sScriptCode ) )
+ sMacroLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application" ) );
+ else
+ sMacroLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "document" ) );
}
+
+ ::rtl::OUStringBuffer aScriptURI;
+ aScriptURI.appendAscii( "vnd.sun.star.script:" );
+ aScriptURI.append( sScriptCode );
+ aScriptURI.appendAscii( "?language=Basic" );
+ aScriptURI.appendAscii( "&location=" );
+ aScriptURI.append( sMacroLocation );
+
+ const ::rtl::OUString sScriptURI( aScriptURI.makeStringAndClear() );
+ pScript.reset( new NewStyleUNOScript( *xObjectShell, sScriptURI ) );
}
OSL_ENSURE( pScript.get(), "FormScriptingEnvironment::doFireScriptEvent: no script to execute!" );
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 22681d511b82..71eed4a0c60e 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -46,7 +46,6 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <basic/sbuno.hxx>
-#include <sfx2/macrconf.hxx>
#include <basic/sbx.hxx>
#include "fmitems.hxx"
#include "fmobj.hxx"
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index f43233ae08ba..74d8e98e405d 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -81,7 +81,7 @@
#include <comphelper/property.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/uno3.hxx>
-#include <comphelper/scopeguard.hxx>
+#include <comphelper/flagguard.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <toolkit/controls/unocontrol.hxx>
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 9abb1969459d..015631d6d11d 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -2115,6 +2115,11 @@ void SdrModel::SetSdrUndoManager( SfxUndoManager* pUndoManager )
mpImpl->mpUndoManager = pUndoManager;
}
+SfxUndoManager* SdrModel::GetSdrUndoManager() const
+{
+ return mpImpl->mpUndoManager;
+}
+
SdrUndoFactory& SdrModel::GetSdrUndoFactory() const
{
if( !mpImpl->mpUndoFactory )
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index 9d5e1695c5cb..61d92f1c8caf 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -58,6 +58,7 @@
#include <svx/extrud3d.hxx>
#include <svx/lathe3d.hxx>
#include <vcl/svapp.hxx>
+#include <tools/diagnose_ex.h>
using ::rtl::OUString;
using namespace ::vos;
@@ -306,7 +307,7 @@ void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape
{
OGuard aGuard( Application::GetSolarMutex() );
- if( (mpModel == 0) || (mpPage == 0) )
+ if ( ( mpModel == NULL ) || ( mpPage == NULL ) )
throw lang::DisposedException();
SvxShape* pShape = SvxShape::getImplementation( xShape );
@@ -319,6 +320,7 @@ void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape
if(!pObj)
{
pObj = CreateSdrObject( xShape );
+ ENSURE_OR_RETURN_VOID( pObj != NULL, "SvxDrawPage::add: no SdrObject was created!" );
}
else if ( !pObj->IsInserted() )
{
@@ -326,14 +328,10 @@ void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape
mpPage->InsertObject( pObj );
}
- if(pObj == NULL)
- return;
-
- if(pShape)
- pShape->Create( pObj, this );
+ pShape->Create( pObj, this );
+ OSL_ENSURE( pShape->GetSdrObject() == pObj, "SvxDrawPage::add: shape does not know about its newly created SdrObject!" );
- if( mpModel )
- mpModel->SetChanged();
+ mpModel->SetChanged();
}
//----------------------------------------------------------------------
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index afb8cbb8723a..b48a703c0964 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -147,7 +147,7 @@ struct SvxShapeImpl
* SdrObject so a multiple call to SvxShape::Create() with same SdrObject
* is prohibited.
*/
- SdrObject* mpCreatedObj;
+ ::tools::WeakReference< SdrObject > mpCreatedObj;
// for xComponent
::cppu::OInterfaceContainerHelper maDisposeListeners;
@@ -160,7 +160,7 @@ struct SvxShapeImpl
,mpMaster( NULL )
,mbHasSdrObjectOwnership( false )
,mbDisposing( false )
- ,mpCreatedObj( NULL )
+ ,mpCreatedObj()
,maDisposeListeners( _rMutex )
,maPropertyNotifier( _rAntiImpl, _rMutex )
{
@@ -468,11 +468,12 @@ void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
if ( !pNewObj )
return;
- OSL_ENSURE( ( mpImpl->mpCreatedObj == NULL ) || ( mpImpl->mpCreatedObj == pNewObj ),
+ SdrObject* pCreatedObj = mpImpl->mpCreatedObj.get();
+ OSL_ENSURE( ( pCreatedObj == NULL ) || ( pCreatedObj == pNewObj ),
"SvxShape::Create: the same shape used for two different objects?! Strange ..." );
// --> CL, OD 2005-07-19 #i52126# - correct condition
- if ( mpImpl->mpCreatedObj != pNewObj )
+ if ( pCreatedObj != pNewObj )
// <--
{
DBG_ASSERT( pNewObj->GetModel(), "no model for SdrObject?" );