xref: /trunk/main/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _DBA_CORE_BOOKMARKCONTAINER_HXX_
28cdf0e10cSrcweir #include "bookmarkcontainer.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBASTRINGS_HRC
31cdf0e10cSrcweir #include "dbastrings.hrc"
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _DBASHARED_APITOOLS_HXX_
34cdf0e10cSrcweir #include "apitools.hxx"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _DBA_CORE_RESOURCE_HXX_
37cdf0e10cSrcweir #include "core_resource.hxx"
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _DBA_CORE_RESOURCE_HRC_
40cdf0e10cSrcweir #include "core_resource.hrc"
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX
44cdf0e10cSrcweir #include <tools/debug.hxx>
45cdf0e10cSrcweir #endif
46cdf0e10cSrcweir #ifndef _COMPHELPER_SEQUENCE_HXX_
47cdf0e10cSrcweir #include <comphelper/sequence.hxx>
48cdf0e10cSrcweir #endif
49cdf0e10cSrcweir #ifndef _COMPHELPER_ENUMHELPER_HXX_
50cdf0e10cSrcweir #include <comphelper/enumhelper.hxx>
51cdf0e10cSrcweir #endif
52cdf0e10cSrcweir #ifndef _COMPHELPER_EXTRACT_HXX_
53cdf0e10cSrcweir #include <comphelper/extract.hxx>
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
56cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
57cdf0e10cSrcweir #endif
58cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
59cdf0e10cSrcweir #include <comphelper/types.hxx>
60cdf0e10cSrcweir #endif
61cdf0e10cSrcweir 
62cdf0e10cSrcweir using namespace ::com::sun::star::uno;
63cdf0e10cSrcweir using namespace ::com::sun::star::lang;
64cdf0e10cSrcweir using namespace ::com::sun::star::beans;
65cdf0e10cSrcweir using namespace ::com::sun::star::container;
66cdf0e10cSrcweir using namespace ::osl;
67cdf0e10cSrcweir using namespace ::comphelper;
68cdf0e10cSrcweir using namespace ::cppu;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir //........................................................................
71cdf0e10cSrcweir namespace dbaccess
72cdf0e10cSrcweir {
73cdf0e10cSrcweir //........................................................................
74cdf0e10cSrcweir 
75cdf0e10cSrcweir //==========================================================================
76cdf0e10cSrcweir //= OBookmarkContainer
77cdf0e10cSrcweir //==========================================================================
DBG_NAME(OBookmarkContainer)78cdf0e10cSrcweir DBG_NAME(OBookmarkContainer)
79cdf0e10cSrcweir //--------------------------------------------------------------------------
80cdf0e10cSrcweir OBookmarkContainer::OBookmarkContainer(OWeakObject& _rParent, Mutex& _rMutex)
81cdf0e10cSrcweir     :m_rParent(_rParent)
82cdf0e10cSrcweir     ,m_aContainerListeners(_rMutex)
83cdf0e10cSrcweir     ,m_rMutex(_rMutex)
84cdf0e10cSrcweir {
85cdf0e10cSrcweir     DBG_CTOR(OBookmarkContainer, NULL);
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir //--------------------------------------------------------------------------
dispose()89cdf0e10cSrcweir void OBookmarkContainer::dispose()
90cdf0e10cSrcweir {
91cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     // say our listeners goobye
94cdf0e10cSrcweir     EventObject aEvt(*this);
95cdf0e10cSrcweir     m_aContainerListeners.disposeAndClear(aEvt);
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     // remove our elements
98cdf0e10cSrcweir     m_aBookmarksIndexed.clear();
99cdf0e10cSrcweir     m_aBookmarks.clear();
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir //--------------------------------------------------------------------------
acquire()103cdf0e10cSrcweir void SAL_CALL OBookmarkContainer::acquire(  ) throw()
104cdf0e10cSrcweir {
105cdf0e10cSrcweir     m_rParent.acquire();
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir //--------------------------------------------------------------------------
release()109cdf0e10cSrcweir void SAL_CALL OBookmarkContainer::release(  ) throw()
110cdf0e10cSrcweir {
111cdf0e10cSrcweir     m_rParent.release();
112cdf0e10cSrcweir }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir //--------------------------------------------------------------------------
~OBookmarkContainer()115cdf0e10cSrcweir OBookmarkContainer::~OBookmarkContainer()
116cdf0e10cSrcweir {
117cdf0e10cSrcweir     DBG_DTOR(OBookmarkContainer, NULL);
118cdf0e10cSrcweir }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir // XServiceInfo
121cdf0e10cSrcweir //--------------------------------------------------------------------------
getImplementationName()122cdf0e10cSrcweir ::rtl::OUString SAL_CALL OBookmarkContainer::getImplementationName(  ) throw(RuntimeException)
123cdf0e10cSrcweir {
124cdf0e10cSrcweir     return ::rtl::OUString::createFromAscii("com.sun.star.comp.dba.OBookmarkContainer");
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir //--------------------------------------------------------------------------
supportsService(const::rtl::OUString & _rServiceName)128cdf0e10cSrcweir sal_Bool SAL_CALL OBookmarkContainer::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
131cdf0e10cSrcweir     checkValid(sal_False);
132cdf0e10cSrcweir     return findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
133cdf0e10cSrcweir }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir //--------------------------------------------------------------------------
getSupportedServiceNames()136cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL OBookmarkContainer::getSupportedServiceNames(  ) throw(RuntimeException)
137cdf0e10cSrcweir {
138cdf0e10cSrcweir     Sequence< ::rtl::OUString > aReturn(1);
139cdf0e10cSrcweir     aReturn.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.DefinitionContainer");
140cdf0e10cSrcweir     return aReturn;
141cdf0e10cSrcweir }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir // XNameContainer
144cdf0e10cSrcweir //--------------------------------------------------------------------------
insertByName(const::rtl::OUString & _rName,const Any & aElement)145cdf0e10cSrcweir void SAL_CALL OBookmarkContainer::insertByName( const ::rtl::OUString& _rName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
146cdf0e10cSrcweir {
147cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
148cdf0e10cSrcweir     checkValid(sal_True);
149cdf0e10cSrcweir 
150cdf0e10cSrcweir     if (checkExistence(_rName))
151cdf0e10cSrcweir         throw ElementExistException();
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     if (0 == _rName.getLength())
154cdf0e10cSrcweir         throw IllegalArgumentException();
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     // approve the new object
157cdf0e10cSrcweir     ::rtl::OUString sNewLink;
158cdf0e10cSrcweir     if (!(aElement >>= sNewLink))
159cdf0e10cSrcweir         throw IllegalArgumentException();
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     implAppend(_rName, sNewLink);
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     // notify the listeners
165cdf0e10cSrcweir     if (m_aContainerListeners.getLength())
166cdf0e10cSrcweir     {
167cdf0e10cSrcweir         ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), Any());
168cdf0e10cSrcweir         OInterfaceIteratorHelper aListenerIterator(m_aContainerListeners);
169cdf0e10cSrcweir         while (aListenerIterator.hasMoreElements())
170cdf0e10cSrcweir             static_cast< XContainerListener* >(aListenerIterator.next())->elementInserted(aEvent);
171cdf0e10cSrcweir     }
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir //--------------------------------------------------------------------------
removeByName(const::rtl::OUString & _rName)175cdf0e10cSrcweir void SAL_CALL OBookmarkContainer::removeByName( const ::rtl::OUString& _rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
176cdf0e10cSrcweir {
177cdf0e10cSrcweir     ::rtl::OUString sOldBookmark;
178cdf0e10cSrcweir     {
179cdf0e10cSrcweir         MutexGuard aGuard(m_rMutex);
180cdf0e10cSrcweir         checkValid(sal_True);
181cdf0e10cSrcweir 
182cdf0e10cSrcweir         // check the arguments
183cdf0e10cSrcweir         if (!_rName.getLength())
184cdf0e10cSrcweir             throw IllegalArgumentException();
185cdf0e10cSrcweir 
186cdf0e10cSrcweir         if (!checkExistence(_rName))
187cdf0e10cSrcweir             throw NoSuchElementException();
188cdf0e10cSrcweir 
189cdf0e10cSrcweir         // the old element (for the notifications)
190cdf0e10cSrcweir         sOldBookmark = m_aBookmarks[_rName];
191cdf0e10cSrcweir 
192cdf0e10cSrcweir         // do the removal
193cdf0e10cSrcweir         implRemove(_rName);
194cdf0e10cSrcweir     }
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     // notify the listeners
197cdf0e10cSrcweir     if (m_aContainerListeners.getLength())
198cdf0e10cSrcweir     {
199cdf0e10cSrcweir         ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sOldBookmark), Any());
200cdf0e10cSrcweir         OInterfaceIteratorHelper aListenerIterator(m_aContainerListeners);
201cdf0e10cSrcweir         while (aListenerIterator.hasMoreElements())
202cdf0e10cSrcweir             static_cast< XContainerListener* >(aListenerIterator.next())->elementRemoved(aEvent);
203cdf0e10cSrcweir     }
204cdf0e10cSrcweir }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir // XNameReplace
207cdf0e10cSrcweir //--------------------------------------------------------------------------
replaceByName(const::rtl::OUString & _rName,const Any & aElement)208cdf0e10cSrcweir void SAL_CALL OBookmarkContainer::replaceByName( const ::rtl::OUString& _rName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
209cdf0e10cSrcweir {
210cdf0e10cSrcweir     ClearableMutexGuard aGuard(m_rMutex);
211cdf0e10cSrcweir     checkValid(sal_True);
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     // check the arguments
214cdf0e10cSrcweir     if (!_rName.getLength())
215cdf0e10cSrcweir         throw IllegalArgumentException();
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     // do we have such an element?
218cdf0e10cSrcweir     if (!checkExistence(_rName))
219cdf0e10cSrcweir         throw NoSuchElementException();
220cdf0e10cSrcweir 
221cdf0e10cSrcweir     // approve the new object
222cdf0e10cSrcweir     ::rtl::OUString sNewLink;
223cdf0e10cSrcweir     if (!(aElement >>= sNewLink))
224cdf0e10cSrcweir         throw IllegalArgumentException();
225cdf0e10cSrcweir 
226cdf0e10cSrcweir     // the old element (for the notifications)
227cdf0e10cSrcweir     ::rtl::OUString sOldLink = m_aBookmarks[_rName];
228cdf0e10cSrcweir 
229cdf0e10cSrcweir     // do the replace
230cdf0e10cSrcweir     implReplace(_rName, sNewLink);
231cdf0e10cSrcweir 
232cdf0e10cSrcweir     // notify the listeners
233cdf0e10cSrcweir     aGuard.clear();
234cdf0e10cSrcweir     if (m_aContainerListeners.getLength())
235cdf0e10cSrcweir     {
236cdf0e10cSrcweir         ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), makeAny(sOldLink));
237cdf0e10cSrcweir         OInterfaceIteratorHelper aListenerIterator(m_aContainerListeners);
238cdf0e10cSrcweir         while (aListenerIterator.hasMoreElements())
239cdf0e10cSrcweir             static_cast< XContainerListener* >(aListenerIterator.next())->elementReplaced(aEvent);
240cdf0e10cSrcweir     }
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir //--------------------------------------------------------------------------
addContainerListener(const Reference<XContainerListener> & _rxListener)244cdf0e10cSrcweir void SAL_CALL OBookmarkContainer::addContainerListener( const Reference< XContainerListener >& _rxListener ) throw(RuntimeException)
245cdf0e10cSrcweir {
246cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
247cdf0e10cSrcweir     if (_rxListener.is())
248cdf0e10cSrcweir         m_aContainerListeners.addInterface(_rxListener);
249cdf0e10cSrcweir }
250cdf0e10cSrcweir 
251cdf0e10cSrcweir //--------------------------------------------------------------------------
removeContainerListener(const Reference<XContainerListener> & _rxListener)252cdf0e10cSrcweir void SAL_CALL OBookmarkContainer::removeContainerListener( const Reference< XContainerListener >& _rxListener ) throw(RuntimeException)
253cdf0e10cSrcweir {
254cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
255cdf0e10cSrcweir     if (_rxListener.is())
256cdf0e10cSrcweir         m_aContainerListeners.removeInterface(_rxListener);
257cdf0e10cSrcweir }
258cdf0e10cSrcweir 
259cdf0e10cSrcweir // XElementAccess
260cdf0e10cSrcweir //--------------------------------------------------------------------------
getElementType()261cdf0e10cSrcweir Type SAL_CALL OBookmarkContainer::getElementType( ) throw (RuntimeException)
262cdf0e10cSrcweir {
263cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
264cdf0e10cSrcweir     checkValid(sal_False);
265cdf0e10cSrcweir     return ::getCppuType( static_cast< ::rtl::OUString* >(NULL) );
266cdf0e10cSrcweir }
267cdf0e10cSrcweir 
268cdf0e10cSrcweir //--------------------------------------------------------------------------
hasElements()269cdf0e10cSrcweir sal_Bool SAL_CALL OBookmarkContainer::hasElements( ) throw (RuntimeException)
270cdf0e10cSrcweir {
271cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
272cdf0e10cSrcweir     checkValid(sal_False);
273cdf0e10cSrcweir     return !m_aBookmarks.empty();
274cdf0e10cSrcweir }
275cdf0e10cSrcweir 
276cdf0e10cSrcweir // XEnumerationAccess
277cdf0e10cSrcweir //--------------------------------------------------------------------------
createEnumeration()278cdf0e10cSrcweir Reference< XEnumeration > SAL_CALL OBookmarkContainer::createEnumeration(  ) throw(RuntimeException)
279cdf0e10cSrcweir {
280cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
281cdf0e10cSrcweir     checkValid(sal_False);
282cdf0e10cSrcweir     return new ::comphelper::OEnumerationByIndex(static_cast<XIndexAccess*>(this));
283cdf0e10cSrcweir }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir //--------------------------------------------------------------------------
286cdf0e10cSrcweir // XIndexAccess
getCount()287cdf0e10cSrcweir sal_Int32 SAL_CALL OBookmarkContainer::getCount(  ) throw(RuntimeException)
288cdf0e10cSrcweir {
289cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
290cdf0e10cSrcweir     checkValid(sal_False);
291cdf0e10cSrcweir     return m_aBookmarks.size();
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir //--------------------------------------------------------------------------
getByIndex(sal_Int32 _nIndex)295cdf0e10cSrcweir Any SAL_CALL OBookmarkContainer::getByIndex( sal_Int32 _nIndex ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
296cdf0e10cSrcweir {
297cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
298cdf0e10cSrcweir     checkValid(sal_False);
299cdf0e10cSrcweir 
300cdf0e10cSrcweir     if ((_nIndex < 0) || (_nIndex >= (sal_Int32)m_aBookmarksIndexed.size()))
301cdf0e10cSrcweir         throw IndexOutOfBoundsException();
302cdf0e10cSrcweir 
303cdf0e10cSrcweir     return makeAny(m_aBookmarksIndexed[_nIndex]->second);
304cdf0e10cSrcweir }
305cdf0e10cSrcweir 
306cdf0e10cSrcweir //--------------------------------------------------------------------------
getByName(const::rtl::OUString & _rName)307cdf0e10cSrcweir Any SAL_CALL OBookmarkContainer::getByName( const ::rtl::OUString& _rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
308cdf0e10cSrcweir {
309cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
310cdf0e10cSrcweir     checkValid(sal_False);
311cdf0e10cSrcweir 
312cdf0e10cSrcweir     if (!checkExistence(_rName))
313cdf0e10cSrcweir         throw NoSuchElementException();
314cdf0e10cSrcweir 
315cdf0e10cSrcweir     return makeAny(m_aBookmarks[_rName]);
316cdf0e10cSrcweir }
317cdf0e10cSrcweir 
318cdf0e10cSrcweir //--------------------------------------------------------------------------
getElementNames()319cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL OBookmarkContainer::getElementNames(  ) throw(RuntimeException)
320cdf0e10cSrcweir {
321cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
322cdf0e10cSrcweir     checkValid(sal_False);
323cdf0e10cSrcweir 
324cdf0e10cSrcweir     Sequence< ::rtl::OUString > aNames(m_aBookmarks.size());
325cdf0e10cSrcweir     ::rtl::OUString* pNames = aNames.getArray();
326cdf0e10cSrcweir     ;
327cdf0e10cSrcweir     for (   ConstMapIteratorVectorIterator aNameIter = m_aBookmarksIndexed.begin();
328cdf0e10cSrcweir             aNameIter != m_aBookmarksIndexed.end();
329cdf0e10cSrcweir             ++pNames, ++aNameIter
330cdf0e10cSrcweir         )
331cdf0e10cSrcweir     {
332cdf0e10cSrcweir         *pNames = (*aNameIter)->first;
333cdf0e10cSrcweir     }
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     return aNames;
336cdf0e10cSrcweir }
337cdf0e10cSrcweir 
338cdf0e10cSrcweir //--------------------------------------------------------------------------
hasByName(const::rtl::OUString & _rName)339cdf0e10cSrcweir sal_Bool SAL_CALL OBookmarkContainer::hasByName( const ::rtl::OUString& _rName ) throw(RuntimeException)
340cdf0e10cSrcweir {
341cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
342cdf0e10cSrcweir     checkValid(sal_False);
343cdf0e10cSrcweir 
344cdf0e10cSrcweir     return checkExistence(_rName);
345cdf0e10cSrcweir }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir //--------------------------------------------------------------------------
implRemove(const::rtl::OUString & _rName)348cdf0e10cSrcweir void OBookmarkContainer::implRemove(const ::rtl::OUString& _rName)
349cdf0e10cSrcweir {
350cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
351cdf0e10cSrcweir 
352cdf0e10cSrcweir     // look for the name in the index access vector
353cdf0e10cSrcweir     MapString2StringIterator aMapPos = m_aBookmarks.end();
354cdf0e10cSrcweir     for (   MapIteratorVectorIterator aSearch = m_aBookmarksIndexed.begin();
355cdf0e10cSrcweir             aSearch != m_aBookmarksIndexed.end();
356cdf0e10cSrcweir             ++aSearch
357cdf0e10cSrcweir         )
358cdf0e10cSrcweir     {
359cdf0e10cSrcweir #ifdef DBG_UTIL
360cdf0e10cSrcweir         ::rtl::OUString sName = (*aSearch)->first;
361cdf0e10cSrcweir #endif
362cdf0e10cSrcweir         if ((*aSearch)->first == _rName)
363cdf0e10cSrcweir         {
364cdf0e10cSrcweir             aMapPos = *aSearch;
365cdf0e10cSrcweir             m_aBookmarksIndexed.erase(aSearch);
366cdf0e10cSrcweir             break;
367cdf0e10cSrcweir         }
368cdf0e10cSrcweir     }
369cdf0e10cSrcweir 
370cdf0e10cSrcweir     if (m_aBookmarks.end() == aMapPos)
371cdf0e10cSrcweir     {
372cdf0e10cSrcweir         DBG_ERROR("OBookmarkContainer::implRemove: inconsistence!");
373cdf0e10cSrcweir         return;
374cdf0e10cSrcweir     }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir     // remove the map entries
377cdf0e10cSrcweir     m_aBookmarks.erase(aMapPos);
378cdf0e10cSrcweir }
379cdf0e10cSrcweir 
380cdf0e10cSrcweir //--------------------------------------------------------------------------
implAppend(const::rtl::OUString & _rName,const::rtl::OUString & _rDocumentLocation)381cdf0e10cSrcweir void OBookmarkContainer::implAppend(const ::rtl::OUString& _rName, const ::rtl::OUString& _rDocumentLocation)
382cdf0e10cSrcweir {
383cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
384cdf0e10cSrcweir 
385cdf0e10cSrcweir     OSL_ENSURE(m_aBookmarks.find(_rName) == m_aBookmarks.end(),"Bookmark already known!");
386cdf0e10cSrcweir     m_aBookmarksIndexed.push_back(m_aBookmarks.insert(  MapString2String::value_type(_rName,_rDocumentLocation)).first);
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir //--------------------------------------------------------------------------
implReplace(const::rtl::OUString & _rName,const::rtl::OUString & _rNewLink)390cdf0e10cSrcweir void OBookmarkContainer::implReplace(const ::rtl::OUString& _rName, const ::rtl::OUString& _rNewLink)
391cdf0e10cSrcweir {
392cdf0e10cSrcweir     MutexGuard aGuard(m_rMutex);
393cdf0e10cSrcweir     DBG_ASSERT(checkExistence(_rName), "OBookmarkContainer::implReplace : invalid name !");
394cdf0e10cSrcweir 
395cdf0e10cSrcweir     m_aBookmarks[_rName] = _rNewLink;
396cdf0e10cSrcweir }
397cdf0e10cSrcweir 
398cdf0e10cSrcweir //--------------------------------------------------------------------------
checkValid(sal_Bool) const399cdf0e10cSrcweir void OBookmarkContainer::checkValid(sal_Bool /*_bIntendWriteAccess*/) const throw (RuntimeException, DisposedException)
400cdf0e10cSrcweir {
401cdf0e10cSrcweir }
402cdf0e10cSrcweir 
403cdf0e10cSrcweir //--------------------------------------------------------------------------
getParent()404cdf0e10cSrcweir Reference< XInterface > SAL_CALL OBookmarkContainer::getParent(  ) throw (RuntimeException)
405cdf0e10cSrcweir {
406cdf0e10cSrcweir     return m_rParent;
407cdf0e10cSrcweir }
408cdf0e10cSrcweir 
409cdf0e10cSrcweir //--------------------------------------------------------------------------
setParent(const Reference<XInterface> &)410cdf0e10cSrcweir void SAL_CALL OBookmarkContainer::setParent( const Reference< XInterface >& /*Parent*/ ) throw (NoSupportException, RuntimeException)
411cdf0e10cSrcweir {
412cdf0e10cSrcweir     throw NoSupportException();
413cdf0e10cSrcweir }
414cdf0e10cSrcweir 
415cdf0e10cSrcweir //........................................................................
416cdf0e10cSrcweir }   // namespace dbaccess
417cdf0e10cSrcweir //........................................................................
418