summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2011-03-16 08:29:30 +0100
committerobo <obo@openoffice.org>2011-03-16 08:29:30 +0100
commitc342b166dbb2dd1d931cf33f41ea4f7bcf00de9f (patch)
tree770ba0d29fe56e0cd95699ceca60078378c89327 /svx
parent1174a070b2d475470d748913add4989f2e6f0cf3 (diff)
parent50d648ef3345aac539655d386fb6598121e3efe0 (diff)
CWS-TOOLING: integrate CWS debuglevels
Diffstat (limited to 'svx')
-rw-r--r--svx/source/form/fmundo.cxx80
-rw-r--r--svx/source/stbctrls/pszctrl.cxx2
-rw-r--r--svx/source/tbxctrls/itemwin.cxx4
3 files changed, 30 insertions, 56 deletions
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index f825c606b0..435c8f7068 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -66,6 +66,7 @@
#include <comphelper/property.hxx>
#include <comphelper/uno3.hxx>
#include <comphelper/stl_types.hxx>
+#include <comphelper/componentcontext.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
@@ -88,7 +89,9 @@ typedef cppu::WeakImplHelper1< XScriptListener > ScriptEventListener_BASE;
class ScriptEventListenerWrapper : public ScriptEventListener_BASE
{
public:
- ScriptEventListenerWrapper( FmFormModel& _rModel) throw ( RuntimeException ) : pModel(&_rModel)
+ ScriptEventListenerWrapper( FmFormModel& _rModel) throw ( RuntimeException )
+ :m_rModel( _rModel )
+ ,m_attemptedListenerCreation( false )
{
}
@@ -98,7 +101,7 @@ public:
// XScriptListener
virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException)
{
- setModel();
+ attemptListenerCreation();
if ( m_vbaListener.is() )
{
m_vbaListener->firing( evt );
@@ -107,7 +110,7 @@ public:
virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw( com::sun::star::reflection::InvocationTargetException, RuntimeException)
{
- setModel();
+ attemptListenerCreation();
if ( m_vbaListener.is() )
{
return m_vbaListener->approveFiring( evt );
@@ -116,61 +119,32 @@ public:
}
private:
- void setModel()
+ void attemptListenerCreation()
{
- if ( !m_vbaListener.is() )
- {
- Reference < XPropertySet > xProps(
- ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- if ( xProps.is() )
- {
- Reference< XComponentContext > xCtx( xProps->getPropertyValue(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY );
- if ( xCtx.is() )
- {
- Reference< XMultiComponentFactory > xMFac(
- xCtx->getServiceManager(), UNO_QUERY );
-
- // SfxObjectShellRef is good here since the model controls the lifetime of the shell
- SfxObjectShellRef xObjSh = pModel->GetObjectShell();
- Reference< XMultiServiceFactory > xDocFac;
- if ( xObjSh.Is() )
- xDocFac.set( xObjSh->GetModel(), UNO_QUERY );
-
- if ( xMFac.is() )
- {
- m_vbaListener.set( xMFac->createInstanceWithContext(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "ooo.vba.EventListener" ) ), xCtx ),
- UNO_QUERY_THROW );
- }
- }
- }
+ if ( m_attemptedListenerCreation )
+ return;
+ m_attemptedListenerCreation = true;
+
+ try
+ {
+ ::comphelper::ComponentContext const aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XScriptListener > const xScriptListener( aContext.createComponent( "ooo.vba.EventListener" ), UNO_QUERY_THROW );
+ Reference< XPropertySet > const xListenerProps( xScriptListener, UNO_QUERY_THROW );
+ // SfxObjectShellRef is good here since the model controls the lifetime of the shell
+ SfxObjectShellRef const xObjectShell = m_rModel.GetObjectShell();
+ ENSURE_OR_THROW( xObjectShell.Is(), "no object shell!" );
+ xListenerProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ), makeAny( xObjectShell->GetModel() ) );
+
+ m_vbaListener = xScriptListener;
}
- Reference< XPropertySet > xProps( m_vbaListener, UNO_QUERY );
- if ( xProps.is() )
+ catch( Exception const & )
{
- try
- {
- // SfxObjectShellRef is good here since the model controls the lifetime of the shell
- SfxObjectShellRef xObjSh = pModel->GetObjectShell();
- if ( xObjSh.Is() && m_vbaListener.is() )
- {
- Any aVal;
- aVal <<= xObjSh->GetModel();
- xProps->setPropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ),
- aVal );
- }
- }
- catch( Exception& )
- {
- //swallow any errors
- }
+ DBG_UNHANDLED_EXCEPTION();
}
}
- FmFormModel* pModel;
- Reference< XScriptListener > m_vbaListener;
+ FmFormModel& m_rModel;
+ Reference< XScriptListener > m_vbaListener;
+ bool m_attemptedListenerCreation;
};
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index e730dd5ec4..463cb6ce8f 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -78,7 +78,7 @@
String SvxPosSizeStatusBarControl::GetMetricStr_Impl( long nVal )
{
// Applikations-Metrik besorgen und setzen
- FieldUnit eOutUnit = SfxModule::GetCurrentFieldUnit();
+ FieldUnit eOutUnit = SfxModule::GetModuleFieldUnit( getFrameInterface() );
FieldUnit eInUnit = FUNIT_100TH_MM;
String sMetric;
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index adec39c436..bcbd617c3e 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -491,7 +491,7 @@ SvxMetricField::SvxMetricField(
SetLast( 5000 );
SetFirst( 0 );
- eDlgUnit = SfxModule::GetCurrentFieldUnit();
+ eDlgUnit = SfxModule::GetModuleFieldUnit( mxFrame );
SetFieldUnit( *this, eDlgUnit, sal_False );
Show();
}
@@ -576,7 +576,7 @@ void SvxMetricField::SetCoreUnit( SfxMapUnit eUnit )
void SvxMetricField::RefreshDlgUnit()
{
- FieldUnit eTmpUnit = SfxModule::GetCurrentFieldUnit();
+ FieldUnit eTmpUnit = SfxModule::GetModuleFieldUnit( mxFrame );
if ( eDlgUnit != eTmpUnit )
{
eDlgUnit = eTmpUnit;