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
d16421f8
Kaydet (Commit)
d16421f8
authored
Mar 10, 2010
tarafından
Vladimir Glazunov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
CWS-TOOLING: integrate CWS ab76
üst
a5177cb1
98667ff6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
115 additions
and
0 deletions
+115
-0
sbunoobj.cxx
basic/source/classes/sbunoobj.cxx
+97
-0
sbunoobj.hxx
basic/source/inc/sbunoobj.hxx
+18
-0
No files found.
basic/source/classes/sbunoobj.cxx
100644 → 100755
Dosyayı görüntüle @
d16421f8
...
...
@@ -103,6 +103,7 @@ TYPEINIT1(SbUnoObject,SbxObject)
TYPEINIT1
(
SbUnoClass
,
SbxObject
)
TYPEINIT1
(
SbUnoService
,
SbxObject
)
TYPEINIT1
(
SbUnoServiceCtor
,
SbxMethod
)
TYPEINIT1
(
SbUnoSingleton
,
SbxObject
)
typedef
WeakImplHelper1
<
XAllListener
>
BasicAllListenerHelper
;
...
...
@@ -3299,6 +3300,18 @@ SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t )
pRes
->
PutObject
(
xWrapper
);
}
}
// An UNO singleton?
if
(
!
pRes
)
{
SbUnoSingleton
*
pUnoSingleton
=
findUnoSingleton
(
aNewName
);
if
(
pUnoSingleton
)
{
pRes
=
new
SbxVariable
(
SbxVARIANT
);
SbxObjectRef
xWrapper
=
(
SbxObject
*
)
pUnoSingleton
;
pRes
->
PutObject
(
xWrapper
);
}
}
}
}
...
...
@@ -3579,6 +3592,90 @@ SbxInfo* SbUnoServiceCtor::GetInfo()
}
SbUnoSingleton
*
findUnoSingleton
(
const
String
&
rName
)
{
SbUnoSingleton
*
pSbUnoSingleton
=
NULL
;
Reference
<
XHierarchicalNameAccess
>
xTypeAccess
=
getTypeProvider_Impl
();
if
(
xTypeAccess
->
hasByHierarchicalName
(
rName
)
)
{
Any
aRet
=
xTypeAccess
->
getByHierarchicalName
(
rName
);
Reference
<
XTypeDescription
>
xTypeDesc
;
aRet
>>=
xTypeDesc
;
if
(
xTypeDesc
.
is
()
)
{
TypeClass
eTypeClass
=
xTypeDesc
->
getTypeClass
();
if
(
eTypeClass
==
TypeClass_SINGLETON
)
{
Reference
<
XSingletonTypeDescription
>
xSingletonTypeDesc
(
xTypeDesc
,
UNO_QUERY
);
if
(
xSingletonTypeDesc
.
is
()
)
pSbUnoSingleton
=
new
SbUnoSingleton
(
rName
,
xSingletonTypeDesc
);
}
}
}
return
pSbUnoSingleton
;
}
SbUnoSingleton
::
SbUnoSingleton
(
const
String
&
aName_
,
const
Reference
<
XSingletonTypeDescription
>&
xSingletonTypeDesc
)
:
SbxObject
(
aName_
)
,
m_xSingletonTypeDesc
(
xSingletonTypeDesc
)
{
SbxVariableRef
xGetMethodRef
=
new
SbxMethod
(
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"get"
)
),
SbxOBJECT
);
QuickInsert
(
(
SbxVariable
*
)
xGetMethodRef
);
}
void
SbUnoSingleton
::
SFX_NOTIFY
(
SfxBroadcaster
&
rBC
,
const
TypeId
&
rBCType
,
const
SfxHint
&
rHint
,
const
TypeId
&
rHintType
)
{
const
SbxHint
*
pHint
=
PTR_CAST
(
SbxHint
,
&
rHint
);
if
(
pHint
)
{
SbxVariable
*
pVar
=
pHint
->
GetVar
();
SbxArray
*
pParams
=
pVar
->
GetParameters
();
UINT32
nParamCount
=
pParams
?
((
UINT32
)
pParams
->
Count
()
-
1
)
:
0
;
UINT32
nAllowedParamCount
=
1
;
Reference
<
XComponentContext
>
xContextToUse
;
if
(
nParamCount
>
0
)
{
// Check if first parameter is a context and use it then
Reference
<
XComponentContext
>
xFirstParamContext
;
Any
aArg1
=
sbxToUnoValue
(
pParams
->
Get
(
1
)
);
if
(
(
aArg1
>>=
xFirstParamContext
)
&&
xFirstParamContext
.
is
()
)
xContextToUse
=
xFirstParamContext
;
}
if
(
!
xContextToUse
.
is
()
)
{
Reference
<
XPropertySet
>
xProps
(
::
comphelper
::
getProcessServiceFactory
(),
UNO_QUERY_THROW
);
xContextToUse
.
set
(
xProps
->
getPropertyValue
(
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"DefaultContext"
))
),
UNO_QUERY_THROW
);
--
nAllowedParamCount
;
}
if
(
nParamCount
>
nAllowedParamCount
)
{
StarBASIC
::
Error
(
SbERR_BAD_ARGUMENT
);
return
;
}
Any
aRetAny
;
if
(
xContextToUse
.
is
()
)
{
String
aSingletonName
(
RTL_CONSTASCII_USTRINGPARAM
(
"/singletons/"
)
);
aSingletonName
+=
GetName
();
Reference
<
XInterface
>
xRet
;
xContextToUse
->
getValueByName
(
aSingletonName
)
>>=
xRet
;
aRetAny
<<=
xRet
;
}
unoToSbxValue
(
pVar
,
aRetAny
);
}
else
SbxObject
::
SFX_NOTIFY
(
rBC
,
rBCType
,
rHint
,
rHintType
);
}
//========================================================================
//========================================================================
...
...
basic/source/inc/sbunoobj.hxx
Dosyayı görüntüle @
d16421f8
...
...
@@ -41,6 +41,7 @@
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/reflection/XIdlClass.hpp>
#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
#include <rtl/ustring.hxx>
class
SbUnoObject
:
public
SbxObject
...
...
@@ -226,6 +227,23 @@ public:
};
// Wrapper for UNO Singleton
class
SbUnoSingleton
:
public
SbxObject
{
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
reflection
::
XSingletonTypeDescription
>
m_xSingletonTypeDesc
;
public
:
TYPEINFO
();
SbUnoSingleton
(
const
String
&
aName_
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
reflection
::
XSingletonTypeDescription
>&
xSingletonTypeDesc
);
void
SFX_NOTIFY
(
SfxBroadcaster
&
,
const
TypeId
&
,
const
SfxHint
&
rHint
,
const
TypeId
&
);
};
SV_DECL_IMPL_REF
(
SbUnoSingleton
);
SbUnoSingleton
*
findUnoSingleton
(
const
String
&
rName
);
// #105565 Special Object to wrap a strongly typed Uno Any
class
SbUnoAnyObject
:
public
SbxObject
{
...
...
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