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
4fe2c8f9
Kaydet (Commit)
4fe2c8f9
authored
Eyl 10, 2003
tarafından
Noel Power
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#i12906#
Updates from code inspection
üst
de11ba9e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
203 additions
and
187 deletions
+203
-187
ActiveMSPList.cxx
scripting/source/provider/ActiveMSPList.cxx
+152
-117
ActiveMSPList.hxx
scripting/source/provider/ActiveMSPList.hxx
+9
-7
MasterScriptProvider.cxx
scripting/source/provider/MasterScriptProvider.cxx
+18
-48
MasterScriptProvider.hxx
scripting/source/provider/MasterScriptProvider.hxx
+24
-15
No files found.
scripting/source/provider/ActiveMSPList.cxx
Dosyayı görüntüle @
4fe2c8f9
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: ActiveMSPList.cxx,v $
*
* $Revision: 1.
1
$
* $Revision: 1.
2
$
*
* last change: $Author: npower $ $Date: 2003-09-
04 07:23:28
$
* last change: $Author: npower $ $Date: 2003-09-
10 08:08:13
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -68,9 +68,9 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
#include <drafts/com/sun/star/script/framework/provider/XScriptProviderAccess.hpp>
#include <drafts/com/sun/star/script/framework/browse/BrowseNodeTypes.hpp>
#include "MasterScriptProvider.hxx"
#include "ActiveMSPList.hxx"
using
namespace
com
::
sun
::
star
;
...
...
@@ -83,35 +83,23 @@ namespace func_provider
class
BrowseNodeImpl
:
public
::
cppu
::
WeakImplHelper1
<
browse
::
XBrowseNode
>
{
public
:
BrowseNodeImpl
(
const
Reference
<
provider
::
XScriptProvider
>&
msp
,
const
::
rtl
::
OUString
&
location
)
:
m_sNodeName
(
location
),
m_xSP
(
msp
)
BrowseNodeImpl
(
const
Reference
<
provider
::
XScriptProvider
>&
msp
,
const
::
rtl
::
OUString
&
location
)
:
m_xSP
(
msp
)
{
// strip out the last leaf of location name
// e.g. file://dir1/dir2/Blah.sxw - > Blah.sxw
::
rtl
::
OUString
temp
=
location
;
sal_Int32
lastSlashIndex
=
temp
.
lastIndexOf
(
::
rtl
::
OUString
::
createFromAscii
(
"/"
)
);
if
(
(
lastSlashIndex
+
1
)
<
temp
.
getLength
()
)
{
temp
=
temp
.
copy
(
lastSlashIndex
+
1
);
}
// maybe we should throw here!!!
else
{
OSL_TRACE
(
"Something wrong with name, perhaps we should throw an exception"
);
}
m_sNodeName
=
temp
;
m_sNodeName
=
parseLocationName
(
location
);
}
virtual
::
rtl
::
OUString
virtual
::
rtl
::
OUString
SAL_CALL
getName
()
throw
(
RuntimeException
)
{
return
m_sNodeName
;
}
virtual
Sequence
<
Reference
<
browse
::
XBrowseNode
>
>
SAL_CALL
getChildNodes
()
throw
(
RuntimeException
)
{
Reference
<
provider
::
XScriptProviderAccess
>
providerGetter
(
m_xSP
,
UNO_QUERY
);
MasterScriptProvider
*
providerGetter
=
static_cast
<
MasterScriptProvider
*
>
(
m_xSP
.
get
()
);
Sequence
<
Reference
<
provider
::
XScriptProvider
>
>
providers
=
providerGetter
->
getAllProviders
();
Sequence
<
Reference
<
browse
::
XBrowseNode
>
>
children
(
providers
.
getLength
()
);
for
(
sal_Int32
index
=
0
;
index
<
providers
.
getLength
();
index
++
)
...
...
@@ -133,10 +121,116 @@ virtual sal_Int16 SAL_CALL getType()
{
return
browse
::
BrowseNodeTypes
::
CONTAINER
;
}
private
:
protected
:
::
rtl
::
OUString
parseLocationName
(
const
::
rtl
::
OUString
&
location
)
{
// strip out the last leaf of location name
// e.g. file://dir1/dir2/Blah.sxw - > Blah.sxw
::
rtl
::
OUString
temp
=
location
;
sal_Int32
lastSlashIndex
=
temp
.
lastIndexOf
(
::
rtl
::
OUString
::
createFromAscii
(
"/"
)
);
if
(
(
lastSlashIndex
+
1
)
<
temp
.
getLength
()
)
{
temp
=
temp
.
copy
(
lastSlashIndex
+
1
);
}
// maybe we should throw here!!!
else
{
OSL_TRACE
(
"Something wrong with name, perhaps we should throw an exception"
);
}
return
temp
;
}
BrowseNodeImpl
(){}
::
rtl
::
OUString
m_sNodeName
;
Reference
<
provider
::
XScriptProvider
>
m_xSP
;
};
class
DocBrowseNodeImpl
:
public
BrowseNodeImpl
{
public
:
DocBrowseNodeImpl
(
const
Reference
<
provider
::
XScriptProvider
>&
msp
,
const
Reference
<
frame
::
XModel
>&
xModel
)
:
m_xModel
(
xModel
)
{
OSL_TRACE
(
"DocBrowseNodeImpl() ctor"
);
m_sNodeName
=
parseLocationName
(
getDocNameOrURLFromModel
(
m_xModel
)
);
m_xSP
=
msp
;
}
virtual
::
rtl
::
OUString
SAL_CALL
getName
()
throw
(
RuntimeException
)
{
OSL_TRACE
(
"DocBrowseNodeImpl::getName() have to change name"
);
if
(
m_xModel
->
getURL
().
getLength
()
>
0
)
{
::
rtl
::
OUString
docName
=
parseLocationName
(
m_xModel
->
getURL
()
);
if
(
!
m_sNodeName
.
equals
(
docName
)
)
{
m_sNodeName
=
docName
;
}
}
return
m_sNodeName
;
}
private
:
Reference
<
frame
::
XModel
>
m_xModel
;
::
rtl
::
OUString
getDocNameOrURLFromModel
(
const
Reference
<
frame
::
XModel
>&
xModel
)
{
// Set a default name, this should never be seen.
::
rtl
::
OUString
docNameOrURL
;
docNameOrURL
=
::
rtl
::
OUString
::
createFromAscii
(
"Unknown"
);
if
(
xModel
.
is
()
)
{
if
(
xModel
->
getURL
().
getLength
()
!=
0
)
{
docNameOrURL
=
xModel
->
getURL
();
OSL_TRACE
(
"DocBrowseNodeImpl::getDocNameOrURLFromModel() url for document %s."
,
::
rtl
::
OUStringToOString
(
docNameOrURL
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
}
else
// Untitled document
{
::
rtl
::
OUString
tempName
;
try
{
Reference
<
beans
::
XPropertySet
>
propSet
(
xModel
->
getCurrentController
()
->
getFrame
(),
UNO_QUERY
);
if
(
propSet
.
is
()
)
{
if
(
sal_True
==
(
propSet
->
getPropertyValue
(
::
rtl
::
OUString
::
createFromAscii
(
"Title"
)
)
>>=
tempName
)
)
{
// process "UntitledX - YYYYYYYY"
// to get UntitledX
sal_Int32
pos
=
0
;
docNameOrURL
=
tempName
.
getToken
(
0
,
' '
,
pos
);
OSL_TRACE
(
"DocBrowseNodeImpl::getDocNameOrURLFromModel() Title for document is %s."
,
::
rtl
::
OUStringToOString
(
docNameOrURL
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
}
}
else
{
OSL_TRACE
(
"DocBrowseNodeImpl::getDocNameOrURLFromModel() doc model invalid"
);
}
}
catch
(
Exception
&
e
)
{
OSL_TRACE
(
"DocBrowseNodeImpl::getDocNameOrURLFromModel() exception thrown: "
,
::
rtl
::
OUStringToOString
(
e
.
Message
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
}
}
}
else
{
OSL_TRACE
(
"DocBrowseNodeImpl::getDocNameOrURLFromModel() doc model is null"
);
}
return
docNameOrURL
;
}
};
ActiveMSPList
::
ActiveMSPList
(
const
Reference
<
XComponentContext
>
&
xContext
)
:
m_xContext
(
xContext
)
{
OSL_TRACE
(
"ActiveMSPList::ActiveMSPList) - ctor"
);
...
...
@@ -168,45 +262,37 @@ void
ActiveMSPList
::
addActiveMSP
(
const
Reference
<
frame
::
XModel
>&
xModel
,
const
Reference
<
dcsssf
::
provider
::
XScriptProvider
>&
msp
)
{
// add self as listener for document dispose
// should probably throw from this method!!, reexamine
try
{
Reference
<
lang
::
XComponent
>
xComponent
=
Reference
<
lang
::
XComponent
>
(
xModel
,
UNO_QUERY_THROW
);
validateXRef
(
xComponent
,
"ActiveMSPList::addActiveMSP: model not XComponent
\n
"
);
xComponent
->
addEventListener
(
this
);
}
catch
(
RuntimeException
&
e
)
{
OSL_TRACE
(
"ActiveMSPList::addActiveMSP() failed to add self as listener: %s"
,
::
rtl
::
OUStringToOString
(
e
.
Message
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
}
::
rtl
::
OUString
doc
=
getDocNameOrURLFromModel
(
xModel
);
if
(
doc
.
getLength
()
!=
0
)
::
osl
::
MutexGuard
guard
(
m_mutex
);
Model_map
::
const_iterator
itr
=
m_mModels
.
find
(
xModel
);
if
(
itr
==
m_mModels
.
end
()
)
{
::
osl
::
MutexGuard
guard
(
m_mutex
);
Model_map
::
const_iterator
itr
=
m_mModels
.
find
(
xModel
);
if
(
itr
!=
m_mModels
.
end
()
)
MspInst
theMsp
;
theMsp
.
provider
=
msp
;
theMsp
.
node
=
new
DocBrowseNodeImpl
(
msp
,
xModel
);
m_mModels
[
xModel
]
=
theMsp
;
// add self as listener for document dispose
// should probably throw from this method!!, reexamine
try
{
OSL_TRACE
(
"ActiveMSPList::addActiveMSP() have MSP for model already"
);
Reference
<
lang
::
XComponent
>
xComponent
=
Reference
<
lang
::
XComponent
>
(
xModel
,
UNO_QUERY_THROW
);
validateXRef
(
xComponent
,
"ActiveMSPList::addActiveMSP: model not XComponent
\n
"
);
xComponent
->
addEventListener
(
this
);
}
else
catch
(
RuntimeException
&
e
)
{
MspInst
theMsp
;
theMsp
.
docName
=
doc
;
theMsp
.
provider
=
msp
;
m_mModels
[
xModel
]
=
theMsp
;
OSL_TRACE
(
"ActiveMSPList::addActiveMSP() failed to add self as listener: %s"
,
::
rtl
::
OUStringToOString
(
e
.
Message
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
}
}
else
{
OSL_TRACE
(
"ActiveMSPList::addActiveMSP()
couldn't get document name from model
"
);
OSL_TRACE
(
"ActiveMSPList::addActiveMSP()
model for document exists already in map
"
);
}
}
...
...
@@ -254,63 +340,13 @@ throw ( ::com::sun::star::uno::RuntimeException )
}
}
::
rtl
::
OUString
ActiveMSPList
::
getDocNameOrURLFromModel
(
const
Reference
<
frame
::
XModel
>&
xModel
)
{
::
rtl
::
OUString
docNameOrURL
;
if
(
xModel
.
is
()
)
{
if
(
xModel
->
getURL
().
getLength
()
!=
0
)
{
docNameOrURL
=
xModel
->
getURL
();
OSL_TRACE
(
"ActiveMSPList::getDocNameOrURLFromModel() url for document %s."
,
::
rtl
::
OUStringToOString
(
docNameOrURL
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
}
else
// Untitled document
{
::
rtl
::
OUString
tempName
;
try
{
Reference
<
beans
::
XPropertySet
>
propSet
(
xModel
->
getCurrentController
()
->
getFrame
(),
UNO_QUERY
);
if
(
propSet
.
is
()
)
{
if
(
sal_True
==
(
propSet
->
getPropertyValue
(
::
rtl
::
OUString
::
createFromAscii
(
"Title"
)
)
>>=
tempName
)
)
{
// process "UntitledX - YYYYYYYY"
// to get UntitledX
sal_Int32
pos
=
0
;
docNameOrURL
=
tempName
.
getToken
(
0
,
' '
,
pos
);
OSL_TRACE
(
"ActiveMSPList::getDocNameOrURLFromModel() Title for document is %s."
,
::
rtl
::
OUStringToOString
(
docNameOrURL
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
}
}
else
{
OSL_TRACE
(
"ActiveMSPList::getDocNameOrURLFromModel() doc model invalid"
);
}
}
catch
(
Exception
&
e
)
{
OSL_TRACE
(
"ActiveMSPList::getDocNameOrURLFromModel() exception thrown: "
,
::
rtl
::
OUStringToOString
(
e
.
Message
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
}
}
}
else
{
OSL_TRACE
(
"ActiveMSPList::getDocNameOrURLFromModel() doc model is null"
);
}
return
docNameOrURL
;
}
ActiveMSPList
&
ActiveMSPList
::
instance
(
const
Reference
<
XComponentContext
>
&
xContext
)
{
static
ActiveMSPList
*
inst
=
0
;
// need to not only hold a static pointer to this object but also
// keep it aqcuired
static
Reference
<
lang
::
XEventListener
>
holder
;
if
(
!
inst
)
{
...
...
@@ -346,12 +382,18 @@ ActiveMSPList::createNonDocMSPs()
args
[
0
]
<<=
userDirString
;
Reference
<
provider
::
XScriptProvider
>
userMsp
(
m_xContext
->
getServiceManager
()
->
createInstanceWithArgumentsAndContext
(
serviceName
,
args
,
m_xContext
),
UNO_QUERY
);
// should check if provider reference is valid
m_hMsps
[
userDirString
]
=
userMsp
;
MspInst
userInstance
;
userInstance
.
node
=
new
BrowseNodeImpl
(
userMsp
,
userDirString
);
userInstance
.
provider
=
userMsp
;
m_hMsps
[
userDirString
]
=
userInstance
;
args
[
0
]
<<=
shareDirString
;
Reference
<
provider
::
XScriptProvider
>
shareMsp
(
m_xContext
->
getServiceManager
()
->
createInstanceWithArgumentsAndContext
(
serviceName
,
args
,
m_xContext
),
UNO_QUERY
);
MspInst
shareInstance
;
shareInstance
.
node
=
new
BrowseNodeImpl
(
shareMsp
,
shareDirString
);
shareInstance
.
provider
=
shareMsp
;
// should check if provider reference is valid
m_hMsps
[
shareDirString
]
=
share
Msp
;
m_hMsps
[
shareDirString
]
=
share
Instance
;
created
=
true
;
}
...
...
@@ -382,10 +424,12 @@ ActiveMSPList::getChildNodes()
Msp_hash
::
iterator
h_itEnd
=
m_hMsps
.
end
();
Sequence
<
Reference
<
browse
::
XBrowseNode
>
>
children
(
numChildNodes
);
sal_Int32
count
=
0
;
for
(
Msp_hash
::
iterator
h_it
=
m_hMsps
.
begin
();
h_it
!=
h_itEnd
;
++
h_it
)
{
OSL_TRACE
(
"Adding application browsenode index [ %d ]"
,
count
);
children
[
count
++
]
=
new
BrowseNodeImpl
(
h_it
->
second
,
h_it
->
first
)
;
children
[
count
++
]
=
h_it
->
second
.
node
;
}
// get providers for active documents
...
...
@@ -394,16 +438,7 @@ ActiveMSPList::getChildNodes()
for
(
Model_map
::
iterator
m_it
=
m_mModels
.
begin
();
m_it
!=
m_itEnd
;
++
m_it
)
{
OSL_TRACE
(
"Adding document browsenode index [ %d ]"
,
count
);
::
rtl
::
OUString
docName
=
m_it
->
second
.
docName
;
if
(
m_it
->
first
->
getURL
().
getLength
()
>
0
)
{
if
(
!
m_it
->
second
.
docName
.
equals
(
m_it
->
first
->
getURL
()
)
)
{
OSL_TRACE
(
"Need to change doc name"
);
m_it
->
second
.
docName
=
m_it
->
first
->
getURL
();
}
}
children
[
count
++
]
=
new
BrowseNodeImpl
(
m_it
->
second
.
provider
,
m_it
->
second
.
docName
);
children
[
count
++
]
=
m_it
->
second
.
node
;
}
return
children
;
...
...
scripting/source/provider/ActiveMSPList.hxx
Dosyayı görüntüle @
4fe2c8f9
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: ActiveMSPList.hxx,v $
*
* $Revision: 1.
1
$
* $Revision: 1.
2
$
*
* last change: $Author: npower $ $Date: 2003-09-
04 07:23:12
$
* last change: $Author: npower $ $Date: 2003-09-
10 08:08:14
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -87,19 +87,21 @@ namespace func_provider
//Typedefs
//=============================================================================
typedef
::
std
::
hash_map
<
::
rtl
::
OUString
,
css
::
uno
::
Reference
<
dcsssf
::
provider
::
XScriptProvider
>
,
::
rtl
::
OUStringHash
,
::
std
::
equal_to
<
::
rtl
::
OUString
>
>
Msp_hash
;
struct
MspInst
{
css
::
uno
::
Reference
<
dcsssf
::
provider
::
XScriptProvider
>
provider
;
::
rtl
::
OUString
docNam
e
;
css
::
uno
::
Reference
<
dcsssf
::
browse
::
XBrowseNode
>
nod
e
;
};
typedef
::
std
::
map
<
css
::
uno
::
Reference
<
css
::
frame
::
XModel
>
,
MspInst
>
Model_map
;
typedef
::
std
::
hash_map
<
::
rtl
::
OUString
,
MspInst
,
::
rtl
::
OUStringHash
,
::
std
::
equal_to
<
::
rtl
::
OUString
>
>
Msp_hash
;
class
ActiveMSPList
:
public
::
cppu
::
WeakImplHelper2
<
css
::
lang
::
XEventListener
,
dcsssf
::
browse
::
XBrowseNode
>
{
...
...
scripting/source/provider/MasterScriptProvider.cxx
Dosyayı görüntüle @
4fe2c8f9
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: MasterScriptProvider.cxx,v $
*
* $Revision: 1.
3
$
* $Revision: 1.
4
$
*
* last change: $Author: npower $ $Date: 2003-09-
04 07:24:47
$
* last change: $Author: npower $ $Date: 2003-09-
10 08:08:14
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -98,7 +98,7 @@ Sequence< ::rtl::OUString > s_serviceNames = Sequence <
//
//*************************************************************************
MasterScriptProvider
::
MasterScriptProvider
(
const
Reference
<
XComponentContext
>
&
xContext
)
throw
(
RuntimeException
)
:
m_xContext
(
xContext
),
m_bI
nitialised
(
false
),
m_bIsVali
d
(
false
),
m_xContext
(
xContext
),
m_bI
sValid
(
false
),
m_bInitialise
d
(
false
),
m_pPCache
(
0
)
{
OSL_TRACE
(
"< MasterScriptProvider ctor called >
\n
"
);
...
...
@@ -135,7 +135,13 @@ MasterScriptProvider::MasterScriptProvider( const Reference< XComponentContext >
throw
RuntimeException
(
temp
.
concat
(
e
.
Message
),
Reference
<
XInterface
>
()
);
}
//Sequence< ::rtl::OUString >& providers = getProviderNames();
// Set up contextless cache
// if initialise method is called a new ProviderCache will be
// created with the appropriate context supplied as an argument
Sequence
<
Any
>
invokeArgs
(
1
);
invokeArgs
[
0
]
<<=
m_XScriptingContext
;
m_pPCache
=
new
ProviderCache
(
m_xContext
,
invokeArgs
);
m_bIsValid
=
true
;
}
...
...
@@ -165,6 +171,7 @@ throw ( Exception, RuntimeException )
m_bIsValid
=
false
;
// related to issue 11866
// warning dialog gets launched when adding binding to script in doc
// workaround issue: no functionProvider created on doc open
...
...
@@ -339,12 +346,15 @@ throw ( Exception, RuntimeException )
//invokeArgs[ 0 ] <<= m_XScriptingContext;
invokeArgs
=
Sequence
<
Any
>
(
0
);
// no arguments
}
//
should be zero, if not initialised, put assert here
if
(
m_pPCache
=
=
0
)
// should be initialised from ctor ( in case createInstance called
//
instead of createInsanceWithArgs.... )
if
(
m_pPCache
!
=
0
)
{
m_pPCache
=
new
ProviderCache
(
m_xContext
,
invokeArgs
);
OSL_TRACE
(
"** MSP init, creating provider cache"
);
delete
m_pPCache
;
}
m_pPCache
=
new
ProviderCache
(
m_xContext
,
invokeArgs
);
if
(
m_xModel
.
is
()
)
{
// This MSP created from a document, add to ActiveMSPList
...
...
@@ -496,46 +506,6 @@ MasterScriptProvider::getLanguageFromURI( const ::rtl::OUString& scriptURI )
//*************************************************************************
Reference
<
provider
::
XScriptProvider
>
MasterScriptProvider
::
getScriptProvider
(
const
::
rtl
::
OUString
&
language
,
const
Sequence
<
Any
>&
aArgs
)
throw
(
RuntimeException
)
{
Reference
<
provider
::
XScriptProvider
>
xScriptProvider
;
try
{
// need to attempt to get the runtime service (not singleton) for the lang
::
rtl
::
OUStringBuffer
buf
(
80
);
buf
.
appendAscii
(
"drafts.com.sun.star.script.framework.provider.ScriptProviderFor"
);
buf
.
append
(
language
);
::
rtl
::
OUString
serviceName
=
buf
.
makeStringAndClear
();
OSL_TRACE
(
"Service name is %s"
,
::
rtl
::
OUStringToOString
(
serviceName
,
RTL_TEXTENCODING_ASCII_US
).
pData
->
buffer
);
Reference
<
XInterface
>
xInterface
=
m_xMgr
->
createInstanceWithArgumentsAndContext
(
serviceName
,
aArgs
,
m_xContext
);
// need to get the XScriptProvider interface from the service
validateXRef
(
xInterface
,
"MasterScriptProvider::getScriptProvider: cannot get appropriate language ScriptProvider Service"
);
xScriptProvider
=
Reference
<
provider
::
XScriptProvider
>
(
xInterface
,
UNO_QUERY_THROW
);
validateXRef
(
xScriptProvider
,
"Service doesn't support XScriptProvider interface"
);
}
catch
(
RuntimeException
&
e
)
{
::
rtl
::
OUString
temp
=
OUSTR
(
"MasterScriptProvider::getScriptProvider: can't get ScriptProvider for "
);
temp
.
concat
(
language
);
temp
.
concat
(
OUSTR
(
" :"
)
);
throw
RuntimeException
(
temp
.
concat
(
e
.
Message
),
Reference
<
XInterface
>
()
);
}
return
xScriptProvider
;
}
::
rtl
::
OUString
SAL_CALL
MasterScriptProvider
::
getName
()
throw
(
css
::
uno
::
RuntimeException
)
...
...
scripting/source/provider/MasterScriptProvider.hxx
Dosyayı görüntüle @
4fe2c8f9
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: MasterScriptProvider.hxx,v $
*
* $Revision: 1.
3
$
* $Revision: 1.
4
$
*
* last change: $Author: npower $ $Date: 2003-09-
04 07:24:47
$
* last change: $Author: npower $ $Date: 2003-09-
10 08:08:14
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -63,13 +63,12 @@
#define _FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
#include <rtl/ustring>
#include <cppuhelper/implbase
5
.hxx>
#include <cppuhelper/implbase
4
.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <drafts/com/sun/star/script/framework/provider/XScriptProvider.hpp>
#include <drafts/com/sun/star/script/framework/provider/XScriptProviderAccess.hpp>
#include <drafts/com/sun/star/script/framework/runtime/XScriptInvocation.hpp>
#include <drafts/com/sun/star/script/framework/storage/XScriptStorageManager.hpp>
#include <drafts/com/sun/star/script/framework/browse/XBrowseNode.hpp>
...
...
@@ -83,9 +82,9 @@ namespace func_provider
#define dcsssf ::drafts::com::sun::star::script::framework
class
MasterScriptProvider
:
public
::
cppu
::
WeakImplHelper
5
<
dcsssf
::
provider
::
XScriptProvider
,
dcsssf
::
browse
::
XBrowseNode
,
dcsssf
::
provider
::
XScriptProviderAccess
,
css
::
lang
::
X
ServiceInfo
,
css
::
lang
::
X
Initialization
>
public
::
cppu
::
WeakImplHelper
4
<
dcsssf
::
provider
::
XScriptProvider
,
dcsssf
::
browse
::
XBrowseNode
,
css
::
lang
::
XServiceInfo
,
css
::
lang
::
XInitialization
>
{
public
:
MasterScriptProvider
(
...
...
@@ -107,9 +106,7 @@ public:
virtual
sal_Int16
SAL_CALL
getType
()
throw
(
css
::
uno
::
RuntimeException
);
// XBrowseNode implementation
virtual
css
::
uno
::
Sequence
<
css
::
uno
::
Reference
<
dcsssf
::
provider
::
XScriptProvider
>
>
SAL_CALL
getAllProviders
()
throw
(
css
::
uno
::
RuntimeException
);
virtual
sal_Bool
SAL_CALL
supportsService
(
const
::
rtl
::
OUString
&
ServiceName
)
throw
(
css
::
uno
::
RuntimeException
);
virtual
css
::
uno
::
Sequence
<
::
rtl
::
OUString
>
SAL_CALL
getSupportedServiceNames
(
)
...
...
@@ -128,22 +125,34 @@ public:
*/
virtual
void
SAL_CALL
initialize
(
const
css
::
uno
::
Sequence
<
css
::
uno
::
Any
>
&
args
)
throw
(
css
::
uno
::
Exception
,
css
::
uno
::
RuntimeException
);
// Public method to return all Language Providers in this MasterScriptProviders
// context.
css
::
uno
::
Sequence
<
css
::
uno
::
Reference
<
dcsssf
::
provider
::
XScriptProvider
>
>
SAL_CALL
getAllProviders
()
throw
(
css
::
uno
::
RuntimeException
);
private
:
void
addStorageAsListener
()
throw
(
css
::
uno
::
RuntimeException
);
bool
isValid
();
const
css
::
uno
::
Sequence
<
::
rtl
::
OUString
>&
getProviderNames
();
::
rtl
::
OUString
getLanguageFromURI
(
const
::
rtl
::
OUString
&
scriptURI
);
css
::
uno
::
Reference
<
dcsssf
::
provider
::
XScriptProvider
>
getScriptProvider
(
const
::
rtl
::
OUString
&
language
,
const
css
::
uno
::
Sequence
<
css
::
uno
::
Any
>&
args
)
throw
(
css
::
uno
::
RuntimeException
);
/* to obtain other services if needed */
css
::
uno
::
Reference
<
css
::
uno
::
XComponentContext
>
m_xContext
;
css
::
uno
::
Reference
<
css
::
lang
::
XMultiComponentFactory
>
m_xMgr
;
css
::
uno
::
Reference
<
css
::
frame
::
XModel
>
m_xModel
;
css
::
uno
::
Reference
<
dcsssf
::
storage
::
XScriptStorageManager
>
m_xScriptStorageMgr
;
bool
m_bInitialised
;
// This component supports XInitialization, it can be created
// using createInstanceXXX() or createInstanceWithArgumentsXXX using
// the service Mangager.
// Need to detect proper initialisation and validity
// for the object, so m_bIsValid indicates that the object is valid is set in ctor
// in case of createInstanceWithArgumentsXXX() called m_bIsValid is set to reset
// and then set to true when initialisation is complete
bool
m_bIsValid
;
// m_bInitialised ensure initialisation only takes place once.
bool
m_bInitialised
;
css
::
uno
::
Reference
<
css
::
beans
::
XPropertySet
>
m_XScriptingContext
;
ProviderCache
*
m_pPCache
;
osl
::
Mutex
m_mutex
;
...
...
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