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
56842d2c
Kaydet (Commit)
56842d2c
authored
Ara 10, 2000
tarafından
Frank Schönheit
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
support XContainer - so that other instances may listen for insertions/removals of data sources
üst
79384e87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
9 deletions
+55
-9
databasecontext.cxx
dbaccess/source/core/dataaccess/databasecontext.cxx
+35
-3
databasecontext.hxx
dbaccess/source/core/dataaccess/databasecontext.hxx
+20
-6
No files found.
dbaccess/source/core/dataaccess/databasecontext.cxx
Dosyayı görüntüle @
56842d2c
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: databasecontext.cxx,v $
* $RCSfile: databasecontext.cxx,v $
*
*
* $Revision: 1.1
3
$
* $Revision: 1.1
4
$
*
*
* last change: $Author: fs $ $Date: 2000-1
1-10 17:28:17
$
* last change: $Author: fs $ $Date: 2000-1
2-10 16:14:22
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -161,6 +161,7 @@ Reference< XInterface >
...
@@ -161,6 +161,7 @@ Reference< XInterface >
ODatabaseContext
::
ODatabaseContext
(
const
Reference
<
XMultiServiceFactory
>
&
xServiceManager
)
ODatabaseContext
::
ODatabaseContext
(
const
Reference
<
XMultiServiceFactory
>
&
xServiceManager
)
:
DatabaseAccessContext_Base
(
m_aMutex
)
:
DatabaseAccessContext_Base
(
m_aMutex
)
,
m_xServiceManager
(
xServiceManager
)
,
m_xServiceManager
(
xServiceManager
)
,
m_aContainerListeners
(
m_aMutex
)
{
{
DBG_CTOR
(
ODatabaseContext
,
NULL
);
DBG_CTOR
(
ODatabaseContext
,
NULL
);
...
@@ -250,6 +251,11 @@ sal_Int64 SAL_CALL ODatabaseContext::getSomething(const Sequence<sal_Int8>& _rId
...
@@ -250,6 +251,11 @@ sal_Int64 SAL_CALL ODatabaseContext::getSomething(const Sequence<sal_Int8>& _rId
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
ODatabaseContext
::
disposing
()
void
ODatabaseContext
::
disposing
()
{
{
// notify our listener
EventObject
aDisposeEvent
(
static_cast
<
XContainer
*
>
(
this
));
m_aContainerListeners
.
disposeAndClear
(
aDisposeEvent
);
// dispose the data sources
for
(
ObjectCache
::
iterator
aIter
=
m_aDatabaseObjects
.
begin
();
for
(
ObjectCache
::
iterator
aIter
=
m_aDatabaseObjects
.
begin
();
aIter
!=
m_aDatabaseObjects
.
end
();
aIter
!=
m_aDatabaseObjects
.
end
();
++
aIter
++
aIter
...
@@ -398,6 +404,11 @@ void ODatabaseContext::registerObject(const rtl::OUString& _rName, const Referen
...
@@ -398,6 +404,11 @@ void ODatabaseContext::registerObject(const rtl::OUString& _rName, const Referen
else
else
DBG_ERROR
(
"ODatabaseContext::registerObject: missing the XComponent interface!"
);
DBG_ERROR
(
"ODatabaseContext::registerObject: missing the XComponent interface!"
);
// notify our container listeners
ContainerEvent
aEvent
(
static_cast
<
XContainer
*>
(
this
),
makeAny
(
_rName
),
makeAny
(
_rxObject
),
Any
());
OInterfaceIteratorHelper
aListenerLoop
(
m_aContainerListeners
);
while
(
aListenerLoop
.
hasMoreElements
())
static_cast
<
XContainerListener
*>
(
aListenerLoop
.
next
())
->
elementInserted
(
aEvent
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -457,6 +468,18 @@ void SAL_CALL ODatabaseContext::disposing( const EventObject& _rSource ) throw(R
...
@@ -457,6 +468,18 @@ void SAL_CALL ODatabaseContext::disposing( const EventObject& _rSource ) throw(R
}
}
}
}
//------------------------------------------------------------------------------
void
SAL_CALL
ODatabaseContext
::
addContainerListener
(
const
Reference
<
XContainerListener
>&
_rxListener
)
throw
(
RuntimeException
)
{
m_aContainerListeners
.
addInterface
(
_rxListener
);
}
//------------------------------------------------------------------------------
void
SAL_CALL
ODatabaseContext
::
removeContainerListener
(
const
Reference
<
XContainerListener
>&
_rxListener
)
throw
(
RuntimeException
)
{
m_aContainerListeners
.
removeInterface
(
_rxListener
);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
ODatabaseContext
::
revokeObject
(
const
rtl
::
OUString
&
_rName
)
throw
(
Exception
,
RuntimeException
)
void
ODatabaseContext
::
revokeObject
(
const
rtl
::
OUString
&
_rName
)
throw
(
Exception
,
RuntimeException
)
{
{
...
@@ -468,10 +491,12 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
...
@@ -468,10 +491,12 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
if
(
!
aObjectNode
.
isValid
())
if
(
!
aObjectNode
.
isValid
())
throw
NoSuchElementException
();
throw
NoSuchElementException
();
Reference
<
XInterface
>
xExistent
;
ObjectCacheIterator
aExistent
=
m_aDatabaseObjects
.
find
(
_rName
);
ObjectCacheIterator
aExistent
=
m_aDatabaseObjects
.
find
(
_rName
);
if
(
aExistent
!=
m_aDatabaseObjects
.
end
())
if
(
aExistent
!=
m_aDatabaseObjects
.
end
())
{
{
Reference
<
XInterface
>
xExistent
=
aExistent
->
second
.
get
();
xExistent
=
aExistent
->
second
.
get
();
if
(
xExistent
.
is
())
if
(
xExistent
.
is
())
{
{
Reference
<
XComponent
>
xComponent
(
xExistent
,
UNO_QUERY
);
Reference
<
XComponent
>
xComponent
(
xExistent
,
UNO_QUERY
);
...
@@ -499,6 +524,13 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
...
@@ -499,6 +524,13 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
}
}
else
else
DBG_ERROR
(
"ODatabaseContext::revokeObject: inconsistent state!"
);
DBG_ERROR
(
"ODatabaseContext::revokeObject: inconsistent state!"
);
// notify our container listeners
ContainerEvent
aEvent
(
static_cast
<
XContainer
*>
(
this
),
makeAny
(
_rName
),
Any
(),
makeAny
(
xExistent
));
// note that xExistent may be empty, in case somebody removed the data source while it is not alive at this moment
OInterfaceIteratorHelper
aListenerLoop
(
m_aContainerListeners
);
while
(
aListenerLoop
.
hasMoreElements
())
static_cast
<
XContainerListener
*>
(
aListenerLoop
.
next
())
->
elementRemoved
(
aEvent
);
}
}
// ::com::sun::star::container::XElementAccess
// ::com::sun::star::container::XElementAccess
...
...
dbaccess/source/core/dataaccess/databasecontext.hxx
Dosyayı görüntüle @
56842d2c
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: databasecontext.hxx,v $
* $RCSfile: databasecontext.hxx,v $
*
*
* $Revision: 1.
4
$
* $Revision: 1.
5
$
*
*
* last change: $Author: fs $ $Date: 2000-1
1-08 16:02:50
$
* last change: $Author: fs $ $Date: 2000-1
2-10 16:14:22
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -80,15 +80,21 @@
...
@@ -80,15 +80,21 @@
#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#endif
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
#include <com/sun/star/container/XContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#endif
#endif
#ifndef _CPPUHELPER_COMPBASE
6
_HXX_
#ifndef _CPPUHELPER_COMPBASE
7
_HXX_
#include <cppuhelper/compbase
6
.hxx>
#include <cppuhelper/compbase
7
.hxx>
#endif
#endif
#ifndef _COMPHELPER_STLTYPES_HXX_
#ifndef _COMPHELPER_STLTYPES_HXX_
#include <comphelper/stl_types.hxx>
#include <comphelper/stl_types.hxx>
#endif
#endif
#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
#include <cppuhelper/interfacecontainer.hxx>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_ELEMENTEXISTEXCEPTION_HPP_
#ifndef _COM_SUN_STAR_CONTAINER_ELEMENTEXISTEXCEPTION_HPP_
#include <com/sun/star/container/ElementExistException.hpp>
#include <com/sun/star/container/ElementExistException.hpp>
#endif
#endif
...
@@ -122,12 +128,14 @@ namespace dbaccess
...
@@ -122,12 +128,14 @@ namespace dbaccess
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XInterface
>
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XInterface
>
ODatabaseContext_CreateInstance
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
);
ODatabaseContext_CreateInstance
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
);
typedef
::
cppu
::
WeakComponentImplHelper
6
<
::
com
::
sun
::
star
::
lang
::
XServiceInfo
typedef
::
cppu
::
WeakComponentImplHelper
7
<
::
com
::
sun
::
star
::
lang
::
XServiceInfo
,
::
com
::
sun
::
star
::
container
::
XEnumerationAccess
,
::
com
::
sun
::
star
::
container
::
XEnumerationAccess
,
::
com
::
sun
::
star
::
container
::
XNameAccess
,
::
com
::
sun
::
star
::
container
::
XNameAccess
,
::
com
::
sun
::
star
::
uno
::
XNamingService
,
::
com
::
sun
::
star
::
uno
::
XNamingService
,
::
com
::
sun
::
star
::
lang
::
XEventListener
,
::
com
::
sun
::
star
::
lang
::
XEventListener
,
::
com
::
sun
::
star
::
lang
::
XUnoTunnel
>
DatabaseAccessContext_Base
;
,
::
com
::
sun
::
star
::
lang
::
XUnoTunnel
,
::
com
::
sun
::
star
::
container
::
XContainer
>
DatabaseAccessContext_Base
;
class
ODatabaseContext
class
ODatabaseContext
:
public
DatabaseAccessContext_Base
:
public
DatabaseAccessContext_Base
...
@@ -149,6 +157,8 @@ protected:
...
@@ -149,6 +157,8 @@ protected:
// recreated afterwards. So it's our (the context's) responsibility to store the session-persistent
// recreated afterwards. So it's our (the context's) responsibility to store the session-persistent
// properties.
// properties.
::
cppu
::
OInterfaceContainerHelper
m_aContainerListeners
;
public
:
public
:
ODatabaseContext
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
);
ODatabaseContext
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
);
virtual
~
ODatabaseContext
();
virtual
~
ODatabaseContext
();
...
@@ -192,6 +202,10 @@ public:
...
@@ -192,6 +202,10 @@ public:
// ::com::sun::star::lang::XEventListener
// ::com::sun::star::lang::XEventListener
virtual
void
SAL_CALL
disposing
(
const
::
com
::
sun
::
star
::
lang
::
EventObject
&
Source
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
void
SAL_CALL
disposing
(
const
::
com
::
sun
::
star
::
lang
::
EventObject
&
Source
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
// ::com::sun::star::container::XContainer
virtual
void
SAL_CALL
addContainerListener
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
container
::
XContainerListener
>&
xListener
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
void
SAL_CALL
removeContainerListener
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
container
::
XContainerListener
>&
xListener
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
private
:
private
:
/// get the node a data source is based on
/// get the node a data source is based on
OConfigurationNode
getObjectNode
(
const
::
rtl
::
OUString
&
_rTitle
,
sal_Bool
_bCreate
)
throw
();
OConfigurationNode
getObjectNode
(
const
::
rtl
::
OUString
&
_rTitle
,
sal_Bool
_bCreate
)
throw
();
...
...
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