Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
797e69c3
Kaydet (Commit)
797e69c3
authored
Tem 14, 2006
tarafından
Oliver Bolte
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
INTEGRATION: CWS ab28 (1.8.2); FILE MERGED
2006/07/12 08:44:16 ab 1.8.2.1: #i66948# XDialogProvider2 support
üst
5162d047
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
143 additions
and
16 deletions
+143
-16
dlgevtatt.cxx
scripting/source/dlgprov/dlgevtatt.cxx
+143
-16
No files found.
scripting/source/dlgprov/dlgevtatt.cxx
Dosyayı görüntüle @
797e69c3
...
@@ -4,9 +4,9 @@
...
@@ -4,9 +4,9 @@
*
*
* $RCSfile: dlgevtatt.cxx,v $
* $RCSfile: dlgevtatt.cxx,v $
*
*
* $Revision: 1.
8
$
* $Revision: 1.
9
$
*
*
* last change: $Author:
hr $ $Date: 2006-06-19 10:18:49
$
* last change: $Author:
obo $ $Date: 2006-07-14 07:09:20
$
*
*
* The Contents of this file are made available subject to
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
* the terms of GNU Lesser General Public License Version 2.1.
...
@@ -40,10 +40,22 @@
...
@@ -40,10 +40,22 @@
#ifndef SCRIPTING_DLGPROV_HXX
#ifndef SCRIPTING_DLGPROV_HXX
#include "dlgprov.hxx"
#include "dlgprov.hxx"
#endif
#endif
#ifndef _SFX_HRC
#include <sfx2/sfx.hrc>
#endif
#ifndef _SFXAPP_HXX
#include <sfx2/app.hxx>
#endif
#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XControl.hpp>
#endif
#endif
#ifndef _COM_SUN_STAR_AWT_XDIALOGEVENTHANDLER_HPP_
#include <com/sun/star/awt/XDialogEventHandler.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#endif
...
@@ -62,6 +74,18 @@
...
@@ -62,6 +74,18 @@
#ifndef _COM_SUN_STAR_SCRIPT_PROVIDER_XSCRIPTPROVIDERSUPPLIER_HPP_
#ifndef _COM_SUN_STAR_SCRIPT_PROVIDER_XSCRIPTPROVIDERSUPPLIER_HPP_
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
#endif
#endif
#ifndef _COM_SUN_STAR_LANG_NOSUCHMETHODEXCEPTION_HPP_
#include <com/sun/star/lang/NoSuchMethodException.hpp>
#endif
#ifndef _COM_SUN_STAR_REFLECTION_XIDLMETHOD_HPP_
#include <com/sun/star/reflection/XIdlMethod.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_METHODCONCEPT_HPP_
#include <com/sun/star/beans/MethodConcept.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XMATERIALHOLDER_HPP_
#include <com/sun/star/beans/XMaterialHolder.hpp>
#endif
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
;
...
@@ -71,6 +95,7 @@ using namespace ::com::sun::star::lang;
...
@@ -71,6 +95,7 @@ using namespace ::com::sun::star::lang;
using
namespace
::
com
::
sun
::
star
::
script
;
using
namespace
::
com
::
sun
::
star
::
script
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
script
;
using
namespace
::
com
::
sun
::
star
::
script
;
using
namespace
::
com
::
sun
::
star
::
reflection
;
//.........................................................................
//.........................................................................
...
@@ -239,7 +264,6 @@ namespace dlgprov
...
@@ -239,7 +264,6 @@ namespace dlgprov
aScriptEvent
.
MethodName
=
Event
.
MethodName
;
aScriptEvent
.
MethodName
=
Event
.
MethodName
;
aScriptEvent
.
Arguments
=
Event
.
Arguments
;
aScriptEvent
.
Arguments
=
Event
.
Arguments
;
aScriptEvent
.
Helper
=
Event
.
Helper
;
aScriptEvent
.
Helper
=
Event
.
Helper
;
aScriptEvent
.
Arguments
=
Event
.
Arguments
;
aScriptEvent
.
ScriptType
=
m_sScriptType
;
aScriptEvent
.
ScriptType
=
m_sScriptType
;
aScriptEvent
.
ScriptCode
=
m_sScriptCode
;
aScriptEvent
.
ScriptCode
=
m_sScriptCode
;
...
@@ -289,9 +313,15 @@ namespace dlgprov
...
@@ -289,9 +313,15 @@ namespace dlgprov
// =============================================================================
// =============================================================================
DialogScriptListenerImpl
::
DialogScriptListenerImpl
(
const
Reference
<
XComponentContext
>&
rxContext
,
DialogScriptListenerImpl
::
DialogScriptListenerImpl
(
const
Reference
<
XComponentContext
>&
rxContext
,
const
Reference
<
::
com
::
sun
::
star
::
frame
::
XModel
>&
rxModel
)
const
Reference
<
::
com
::
sun
::
star
::
frame
::
XModel
>&
rxModel
,
const
Reference
<
::
com
::
sun
::
star
::
awt
::
XDialog
>&
rxDialog
,
const
Reference
<
::
com
::
sun
::
star
::
uno
::
XInterface
>&
rxHandler
,
const
Reference
<
::
com
::
sun
::
star
::
beans
::
XIntrospectionAccess
>&
rxIntrospectionAccess
)
:
m_xContext
(
rxContext
)
:
m_xContext
(
rxContext
)
,
m_xModel
(
rxModel
)
,
m_xModel
(
rxModel
)
,
m_xDialog
(
rxDialog
)
,
m_xHandler
(
rxHandler
)
,
m_xIntrospectionAccess
(
rxIntrospectionAccess
)
{
{
}
}
...
@@ -305,25 +335,37 @@ namespace dlgprov
...
@@ -305,25 +335,37 @@ namespace dlgprov
void
DialogScriptListenerImpl
::
firing_impl
(
const
ScriptEvent
&
aScriptEvent
,
Any
*
pRet
)
void
DialogScriptListenerImpl
::
firing_impl
(
const
ScriptEvent
&
aScriptEvent
,
Any
*
pRet
)
{
{
static
::
rtl
::
OUString
aVndSunStarUNO
=
::
rtl
::
OUString
::
createFromAscii
(
"vnd.sun.star.UNO:"
);
::
rtl
::
OUString
sScriptURL
;
::
rtl
::
OUString
sScriptURL
;
::
rtl
::
OUString
sScriptCode
(
aScriptEvent
.
ScriptCode
);
::
rtl
::
OUString
sScriptCode
(
aScriptEvent
.
ScriptCode
);
if
(
aScriptEvent
.
ScriptType
.
compareToAscii
(
"StarBasic"
)
==
0
)
bool
bUNO
=
(
sScriptCode
.
indexOf
(
aVndSunStarUNO
)
==
0
);
if
(
bUNO
)
{
{
// StarBasic script: convert ScriptCode to scriptURL
handleUnoScript
(
aScriptEvent
,
pRet
);
sal_Int32
nIndex
=
sScriptCode
.
indexOf
(
':'
);
return
;
if
(
nIndex
>=
0
&&
nIndex
<
sScriptCode
.
getLength
()
)
{
sScriptURL
=
::
rtl
::
OUString
::
createFromAscii
(
"vnd.sun.star.script:"
);
sScriptURL
+=
sScriptCode
.
copy
(
nIndex
+
1
);
sScriptURL
+=
::
rtl
::
OUString
::
createFromAscii
(
"?language=Basic&location="
);
sScriptURL
+=
sScriptCode
.
copy
(
0
,
nIndex
);
}
}
}
else
else
{
{
// scripting framework script: ScriptCode contains scriptURL
if
(
aScriptEvent
.
ScriptType
.
compareToAscii
(
"StarBasic"
)
==
0
)
sScriptURL
=
sScriptCode
;
{
// StarBasic script: convert ScriptCode to scriptURL
sal_Int32
nIndex
=
sScriptCode
.
indexOf
(
':'
);
if
(
nIndex
>=
0
&&
nIndex
<
sScriptCode
.
getLength
()
)
{
sScriptURL
=
::
rtl
::
OUString
::
createFromAscii
(
"vnd.sun.star.script:"
);
sScriptURL
+=
sScriptCode
.
copy
(
nIndex
+
1
);
sScriptURL
+=
::
rtl
::
OUString
::
createFromAscii
(
"?language=Basic&location="
);
sScriptURL
+=
sScriptCode
.
copy
(
0
,
nIndex
);
}
}
else
{
// scripting framework script: ScriptCode contains scriptURL
sScriptURL
=
sScriptCode
;
}
}
}
try
try
...
@@ -389,6 +431,91 @@ namespace dlgprov
...
@@ -389,6 +431,91 @@ namespace dlgprov
}
}
}
}
void
DialogScriptListenerImpl
::
handleUnoScript
(
const
ScriptEvent
&
aScriptEvent
,
Any
*
pRet
)
{
static
::
rtl
::
OUString
sUnoURLScheme
=
::
rtl
::
OUString
::
createFromAscii
(
"vnd.sun.star.UNO:"
);
::
rtl
::
OUString
sScriptCode
(
aScriptEvent
.
ScriptCode
);
::
rtl
::
OUString
aMethodName
=
aScriptEvent
.
ScriptCode
.
copy
(
sUnoURLScheme
.
getLength
()
);
const
Any
*
pArguments
=
aScriptEvent
.
Arguments
.
getConstArray
();
Any
aEventObject
=
pArguments
[
0
];
Reference
<
XDialogEventHandler
>
xDialogEventHandler
(
m_xHandler
,
UNO_QUERY
);
bool
bHandled
=
false
;
if
(
xDialogEventHandler
.
is
()
)
{
bHandled
=
xDialogEventHandler
->
callHandlerMethod
(
m_xDialog
,
aEventObject
,
aMethodName
);
}
Any
aRet
;
if
(
!
bHandled
&&
m_xIntrospectionAccess
.
is
()
)
{
try
{
// Methode ansprechen
const
Reference
<
XIdlMethod
>&
rxMethod
=
m_xIntrospectionAccess
->
getMethod
(
aMethodName
,
MethodConcept
::
ALL
-
MethodConcept
::
DANGEROUS
);
Reference
<
XMaterialHolder
>
xMaterialHolder
=
Reference
<
XMaterialHolder
>::
query
(
m_xIntrospectionAccess
);
Any
aHandlerObject
=
xMaterialHolder
->
getMaterial
();
Sequence
<
Reference
<
XIdlClass
>
>
aParamTypeSeq
=
rxMethod
->
getParameterTypes
();
sal_Int32
nParamCount
=
aParamTypeSeq
.
getLength
();
if
(
nParamCount
==
0
)
{
Sequence
<
Any
>
args
;
rxMethod
->
invoke
(
aHandlerObject
,
args
);
bHandled
=
true
;
}
else
if
(
nParamCount
==
2
)
{
// Signature check automatically done by reflection
Sequence
<
Any
>
Args
(
2
);
Any
*
pArgs
=
Args
.
getArray
();
pArgs
[
0
]
<<=
m_xDialog
;
pArgs
[
1
]
=
aEventObject
;
aRet
=
rxMethod
->
invoke
(
aHandlerObject
,
Args
);
bHandled
=
true
;
}
}
catch
(
com
::
sun
::
star
::
lang
::
IllegalArgumentException
&
e
)
{}
catch
(
com
::
sun
::
star
::
lang
::
NoSuchMethodException
&
e
)
{}
catch
(
com
::
sun
::
star
::
reflection
::
InvocationTargetException
&
e
)
{}
}
if
(
bHandled
)
{
if
(
pRet
)
*
pRet
=
aRet
;
}
else
{
ResMgr
*
pResMgr
=
SFX_APP
()
->
GetSfxResManager
();
if
(
pResMgr
)
{
String
aRes
(
ResId
(
STR_ERRUNOEVENTBINDUNG
,
pResMgr
)
);
::
rtl
::
OUString
aQuoteChar
(
RTL_CONSTASCII_USTRINGPARAM
(
"
\"
"
)
);
::
rtl
::
OUString
aOURes
=
aRes
;
sal_Int32
nIndex
=
aOURes
.
indexOf
(
'%'
);
::
rtl
::
OUString
aOUFinal
;
aOUFinal
+=
aOURes
.
copy
(
0
,
nIndex
);
aOUFinal
+=
aQuoteChar
;
aOUFinal
+=
aMethodName
;
aOUFinal
+=
aQuoteChar
;
aOUFinal
+=
aOURes
.
copy
(
nIndex
+
2
);
ErrorBox
(
NULL
,
WinBits
(
WB_OK
),
aOUFinal
).
Execute
();
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// XEventListener
// XEventListener
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment